Browse Source

增加试验信息,修改大屏信息的试验信息相关的

dongjh 1 year ago
parent
commit
b49e84f28b

+ 144 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/controller/GuanTestController.java

@@ -0,0 +1,144 @@
+package org.jeecg.modules.webaccess.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.webaccess.entity.GuanDashboardParam;
+import org.jeecg.modules.webaccess.entity.GuanTest;
+import org.jeecg.modules.webaccess.service.IGuanTestService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+@Api(tags = "试验信息")
+@RestController
+@RequestMapping("/guan/test")
+@Slf4j
+public class GuanTestController extends JeecgController<GuanTest, IGuanTestService> {
+    @Autowired
+    private IGuanTestService guanTestService;
+
+
+    @ApiOperation(value = "试验信息", notes = "试验信息")
+    @GetMapping(value = "/list")
+    public Result<IPage<GuanTest>> queryList(GuanTest guanTest,
+                                                       @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                       @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                       HttpServletRequest req) {
+        QueryWrapper<GuanTest> queryWrapper = QueryGenerator.initQueryWrapper(guanTest, req.getParameterMap());
+        Page<GuanTest> page = new Page<GuanTest>(pageNo, pageSize);
+        IPage<GuanTest> pageList = guanTestService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     *   添加
+     *
+     * @param guanTest
+     * @return
+     */
+    @AutoLog(value = "试验信息-添加")
+    @ApiOperation(value="试验信息-添加", notes="试验信息-添加")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody GuanTest guanTest) {
+        guanTestService.save(guanTest);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     *  编辑
+     *
+     * @param guanTest
+     * @return
+     */
+    @AutoLog(value = "试验信息-编辑")
+    @ApiOperation(value="试验信息-编辑", notes="试验信息-编辑")
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+    public Result<String> edit(@RequestBody GuanTest guanTest) {
+        guanTestService.updateById(guanTest);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     *   通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "试验信息-通过id删除")
+    @ApiOperation(value="试验信息-通过id删除", notes="试验信息-通过id删除")
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+        guanTestService.removeById(id);
+        return Result.OK("删除成功!");
+    }
+
+    /**
+     *  批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "试验信息-批量删除")
+    @ApiOperation(value="试验信息-批量删除", notes="试验信息-批量删除")
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+        this.guanTestService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    @ApiOperation(value="试验信息-通过id查询", notes="试验信息-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<GuanTest> queryById(@RequestParam(name="id",required=true) String id) {
+        GuanTest guanTest = guanTestService.getById(id);
+        if(guanTest==null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(guanTest);
+    }
+
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param guanTest
+     */
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, GuanTest guanTest) {
+        return super.exportXls(request, guanTest, GuanTest.class, "试验信息表");
+    }
+
+    /**
+     * 通过excel导入数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    //@RequiresPermissions("org.jeecg.modules:dashboard_param:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, GuanTest.class);
+    }
+}

+ 2 - 4
module-guan/src/main/java/org/jeecg/modules/webaccess/entity/GuanDashboardParam.java

@@ -1,7 +1,5 @@
 package org.jeecg.modules.webaccess.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -16,7 +14,7 @@ import java.util.Date;
 public class GuanDashboardParam {
     /**主键*/
     @ApiModelProperty(value = "主键")
-    private Integer id;
+    private String id;
 
     /**大屏参数名称*/
     @Excel(name = "大屏参数名称", width = 50)
@@ -80,7 +78,7 @@ public class GuanDashboardParam {
     @ApiModelProperty(value = "修改人")
     private String updateBy;
     /**备注*/
-    @Excel(name = "备注", width = 15)
+    @Excel(name = "备注", width = 500)
     @ApiModelProperty(value = "备注")
     private String remark;
 }

+ 68 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/entity/GuanTest.java

@@ -0,0 +1,68 @@
+package org.jeecg.modules.webaccess.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.util.Date;
+
+@Data
+@TableName("guan_test")
+public class GuanTest {
+    /**主键*/
+    @ApiModelProperty(value = "主键")
+    private String id;
+
+    /**试验名称*/
+    @Excel(name = "试验名称", width = 100)
+    @ApiModelProperty(value = "试验名称")
+    private String testname;
+
+    /**试验类型*/
+    @Excel(name = "试验类型", width = 25)
+    @ApiModelProperty(value = "试验类型")
+    private String testtype;
+
+    /**试验条件*/
+    @Excel(name = "试验条件", width = 250)
+    @ApiModelProperty(value = "试验条件")
+    private String conditions;
+
+    /**客户名称*/
+    @Excel(name = "客户名称", width = 50)
+    @ApiModelProperty(value = "客户名称")
+    private String clientname;
+
+    /**联系人*/
+    @Excel(name = "联系人", width = 50)
+    @ApiModelProperty(value = "联系人")
+    private String linker;
+
+    /**创建时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    /**创建人*/
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    /**修改时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "修改时间")
+    private Date updateTime;
+
+    /**修改人*/
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+
+    /**备注*/
+    @Excel(name = "备注", width = 500)
+    @ApiModelProperty(value = "备注")
+    private String remark;
+}

+ 14 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/GuanTestMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.webaccess.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.webaccess.entity.GuanTest;
+
+import java.util.List;
+
+public interface GuanTestMapper extends BaseMapper<GuanTest> {
+    /**
+     * 获取最新一条试验信息
+     * @return
+     */
+    public GuanTest selectTop1Test();
+}

+ 26 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/mapper/xml/GuanTestMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.webaccess.mapper.GuanTestMapper">
+
+    <resultMap type="org.jeecg.modules.webaccess.entity.GuanTest" id="GuanTestResult">
+        <result property="id"    column="id"    />
+        <result property="testname"    column="testname"    />
+        <result property="testtype"    column="testtype"    />
+        <result property="conditions"    column="conditions"    />
+        <result property="clientname"    column="clientname"    />
+        <result property="linker"    column="linker"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+
+    <select id="selectTop1Test" resultMap="GuanTestResult">
+        select * from guan_test
+        order by create_time desc
+        limit 1
+    </select>
+
+</mapper>

+ 12 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/IGuanTestService.java

@@ -0,0 +1,12 @@
+package org.jeecg.modules.webaccess.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.webaccess.entity.GuanTest;
+
+public interface IGuanTestService extends IService<GuanTest> {
+    /**
+     * 获取最新一条试验信息
+     * @return
+     */
+    public GuanTest selectTop1Test();
+}

+ 19 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/WebAccessService.java

@@ -10,7 +10,9 @@ import org.jeecg.modules.webaccess.dto.CirculateDTO;
 import org.jeecg.modules.webaccess.dto.SectionDTO;
 import org.jeecg.modules.webaccess.dto.WaLogDTO;
 import org.jeecg.modules.webaccess.entity.GuanDashboardParam;
+import org.jeecg.modules.webaccess.entity.GuanTest;
 import org.jeecg.modules.webaccess.mapper.GuanDashboardParamMapper;
+import org.jeecg.modules.webaccess.mapper.GuanTestMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpEntity;
 import org.springframework.http.HttpHeaders;
@@ -43,6 +45,9 @@ public class WebAccessService {
     @Autowired
     private GuanDashboardParamMapper dashboardParamMapper;
 
+    @Autowired
+    private GuanTestMapper guanTestMapper;
+
     //region <<字典获取webaccess信息>>
     /**
      * 获取webaccess的API信息
@@ -541,6 +546,20 @@ public class WebAccessService {
         addObject.put("Quality", 0);
         resJsonArray.add(addObject);
 
+        // 试验信息
+        GuanTest guanTest = guanTestMapper.selectTop1Test();
+        if (guanTest != null) {
+            addObject.put("Name", "试验名称");
+            addObject.put("Value", guanTest.getTestname());
+            addObject.put("Quality", 0);
+            resJsonArray.add(addObject);
+
+            addObject.put("Name", "试验类型");
+            addObject.put("Value", guanTest.getTesttype());
+            addObject.put("Quality", 0);
+            resJsonArray.add(addObject);
+        }
+
         return resJsonArray;
     }
 

+ 23 - 0
module-guan/src/main/java/org/jeecg/modules/webaccess/service/impl/GuanTestServiceImpl.java

@@ -0,0 +1,23 @@
+package org.jeecg.modules.webaccess.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.webaccess.entity.GuanTest;
+import org.jeecg.modules.webaccess.mapper.GuanTestMapper;
+import org.jeecg.modules.webaccess.service.IGuanTestService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class GuanTestServiceImpl extends ServiceImpl<GuanTestMapper, GuanTest> implements IGuanTestService {
+
+    @Autowired
+    private GuanTestMapper guanTestMapper;
+
+    /**
+     * 获取最新一条试验信息
+     * @return
+     */
+    public GuanTest selectTop1Test() {
+        return guanTestMapper.selectTop1Test();
+    }
+}