Ver código fonte

送检记录接口上传

lijie 3 anos atrás
pai
commit
9da293c37c
24 arquivos alterados com 1112 adições e 26 exclusões
  1. 72 0
      railway-admin/src/main/java/com/railway/web/controller/business/safetool/SecExperimentController.java
  2. 62 0
      railway-admin/src/main/java/com/railway/web/controller/business/safetool/SecExperimentToolController.java
  3. 64 0
      railway-business/src/main/java/com/railway/business/safetool/domain/SecExperiment.java
  4. 51 0
      railway-business/src/main/java/com/railway/business/safetool/domain/SecExperimentTool.java
  5. 0 8
      railway-business/src/main/java/com/railway/business/safetool/domain/SecScheduled.java
  6. 31 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpAddParmVo.java
  7. 32 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpDetailVo.java
  8. 23 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpEndParmVo.java
  9. 34 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpListParmVo.java
  10. 48 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpListVo.java
  11. 24 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpNQParmVo.java
  12. 32 0
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpToolsVo.java
  13. 2 2
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecScheduledListParmVo.java
  14. 4 1
      railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecScheduledToolsVo.java
  15. 48 0
      railway-business/src/main/java/com/railway/business/safetool/mapper/SecExperimentMapper.java
  16. 44 0
      railway-business/src/main/java/com/railway/business/safetool/mapper/SecExperimentToolMapper.java
  17. 36 0
      railway-business/src/main/java/com/railway/business/safetool/service/ISecExperimentService.java
  18. 39 0
      railway-business/src/main/java/com/railway/business/safetool/service/ISecExperimentToolService.java
  19. 114 0
      railway-business/src/main/java/com/railway/business/safetool/service/impl/SecExperimentServiceImpl.java
  20. 72 0
      railway-business/src/main/java/com/railway/business/safetool/service/impl/SecExperimentToolServiceImpl.java
  21. 2 0
      railway-business/src/main/java/com/railway/business/safetool/service/impl/SecScheduledServiceImpl.java
  22. 114 0
      railway-business/src/main/resources/mapper/safetool/SecExperimentMapper.xml
  23. 152 0
      railway-business/src/main/resources/mapper/safetool/SecExperimentToolMapper.xml
  24. 12 15
      railway-business/src/main/resources/mapper/safetool/SecScheduledMapper.xml

+ 72 - 0
railway-admin/src/main/java/com/railway/web/controller/business/safetool/SecExperimentController.java

@@ -0,0 +1,72 @@
+package com.railway.web.controller.business.safetool;
+
+
+import com.railway.business.safetool.domain.SecExperiment;
+import com.railway.business.safetool.domain.vo.*;
+import com.railway.business.safetool.service.ISecExperimentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.WebDataBinder;
+import com.railway.common.core.controller.BaseController;
+import com.railway.common.core.domain.AjaxResult;
+import com.railway.common.core.page.TableDataInfo;
+import javax.validation.Valid;
+import java.util.List;
+
+import javax.validation.Valid;
+
+@Api(value = "rest/safetool/sec/experiment", tags = "安全工具 - 送检记录表")
+@RestController
+@Validated
+@RequestMapping(value = "business/safetool/sec/experiment")
+public class SecExperimentController extends BaseController {
+    @Autowired
+    private ISecExperimentService secExperimentService;
+
+    @ApiOperation(value = "新增")
+    @PostMapping("/add")
+    public AjaxResult add(@Validated @RequestBody SecExpAddParmVo secExpAddParmVo) {
+        return toAjax(secExperimentService.create(secExpAddParmVo));
+    }
+
+//    @ApiOperation(value = "删除")
+//    @DeleteMapping("/{ids}")
+//    public AjaxResult delete(@RequestParam String[] ids) {
+//        return toAjax(secExperimentService.delete(ids));
+//    }
+
+    @ApiOperation(value = "完成实验")
+    @PostMapping("/expEnd")
+    public AjaxResult expEnd(@RequestBody @Valid SecExpEndParmVo p) {
+        return toAjax(secExperimentService.update(p));
+    }
+
+    @ApiOperation(value = "设置安全工具是否合格")
+    @PostMapping("/setToolNQ")
+    public AjaxResult setToolNQ(@RequestBody @Valid SecExpNQParmVo p) {
+
+        return toAjax(secExperimentService.nq(p));
+    }
+
+    @ApiOperation(value = "送检记录详情")
+    @GetMapping(value = {"/", "/{id}"})
+    public AjaxResult getInfo(String id) {
+        List<SecExpDetailVo>  info = secExperimentService.getInfo(id);
+        AjaxResult ajax = AjaxResult.success();
+        ajax.put("info",info);
+        return ajax;
+    }
+
+    @ApiOperation(value = "送检记录列表")
+    @GetMapping(value = "list")
+    public TableDataInfo getList(SecExpListParmVo secExperiment) {
+        startPage();
+        List<SecExpListVo> list = secExperimentService.getList(secExperiment);
+        return getDataTable(list);
+    }
+
+}

+ 62 - 0
railway-admin/src/main/java/com/railway/web/controller/business/safetool/SecExperimentToolController.java

@@ -0,0 +1,62 @@
+package com.railway.web.controller.business.safetool;
+
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.WebDataBinder;
+import com.railway.common.core.controller.BaseController;
+import com.railway.common.core.domain.AjaxResult;
+import com.railway.common.core.page.TableDataInfo;
+import javax.validation.Valid;
+import java.util.List;
+
+import javax.validation.Valid;
+
+@Api(value = "rest/safetool/sec/experiment/tool", tags = "送检记录工具表")
+@RestController
+@Validated
+@RequestMapping(value = "business/safetool/sec/experiment/tool")
+public class SecExperimentToolController extends BaseController {
+//    @Autowired
+//    private ISecExperimentToolService secExperimentToolService;
+//
+//    @ApiOperation(value = "新增")
+//    @PostMapping("/add")
+//    public AjaxResult add(@Validated @RequestBody SecExperimentTool secExperimentTool) {
+//        return toAjax(secExperimentToolService.create(secExperimentTool));
+//    }
+//
+//    @ApiOperation(value = "删除")
+//    @DeleteMapping("/{ids}")
+//    public AjaxResult delete(@RequestParam String[] ids) {
+//        return toAjax(secExperimentToolService.delete(ids));
+//    }
+//
+//    @ApiOperation(value = "更新")
+//    @PutMapping("/update")
+//    public AjaxResult update(@RequestBody @Valid SecExperimentTool secExperimentTool) {
+//        return toAjax(secExperimentToolService.update(secExperimentTool));
+//    }
+//
+//    @ApiOperation(value = "单个")
+//    @GetMapping(value = {"/", "/{id}"})
+//    public AjaxResult getInfo(String id) {
+//        SecExperimentTool info = secExperimentToolService.getInfo(id);
+//        AjaxResult ajax = AjaxResult.success();
+//        ajax.put("info",info);
+//        return ajax;
+//    }
+//
+//    @ApiOperation(value = "列表")
+//    @GetMapping(value = "list")
+//    public TableDataInfo getList(SecExperimentTool secExperimentTool) {
+//        startPage();
+//        List<SecExperimentTool> list = secExperimentToolService.getList(secExperimentTool);
+//        return getDataTable(list);
+//    }
+
+}

+ 64 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/SecExperiment.java

@@ -0,0 +1,64 @@
+package com.railway.business.safetool.domain;
+
+import com.railway.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.Date;
+
+import org.hibernate.validator.constraints.Length;
+import javax.validation.constraints.NotNull;
+/**
+ * 送检记录表
+ * @author lijie 2021-12-25
+ */
+@Data
+@ApiModel("送检记录表")
+@EqualsAndHashCode(callSuper = true)
+public class SecExperiment extends BaseEntity{
+
+    @ApiModelProperty(value = "主键", hidden = true)
+    private String id;
+
+    @ApiModelProperty(value = "实验室id 部门表类型为实验室")
+    private Long labId;
+
+    @ApiModelProperty(value = "送检计划id")
+    private Long schedledId;
+
+    @ApiModelProperty(value = "截止时间")
+    private Date endTime;
+
+    @ApiModelProperty(value = "车间")
+    private Long deptName;
+
+    @ApiModelProperty(value = "送检日期")
+    private Date scheduledTime;
+
+    @ApiModelProperty(value = "送检日期")
+    private Date expDate;
+
+    @ApiModelProperty(value = "状态,0待实验,1已实验")
+    @Length(min = 1, max = 1, message = "【状态,0待实验,1已实验】长度必须介于 {min} 和 {max} 之间")
+    private String state;
+
+    @ApiModelProperty(value = "del_flag")
+    @Length(min = 1, max = 1, message = "【del_flag】长度必须介于 {min} 和 {max} 之间")
+    private String delFlag;
+
+    @ApiModelProperty(value = "create_by")
+    @Length(min = 1, max = 64, message = "【create_by】长度必须介于 {min} 和 {max} 之间")
+    private String createBy;
+
+    @ApiModelProperty(value = "update_by")
+    @Length(min = 1, max = 64, message = "【update_by】长度必须介于 {min} 和 {max} 之间")
+    private String updateBy;
+
+    @ApiModelProperty(value = "update_time")
+    private Date updateTime;
+
+    public SecExperiment() {
+    }
+
+}

+ 51 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/SecExperimentTool.java

@@ -0,0 +1,51 @@
+package com.railway.business.safetool.domain;
+
+import com.railway.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import java.util.Date;
+
+import org.hibernate.validator.constraints.Length;
+import javax.validation.constraints.NotNull;
+/**
+ * 送检记录工具表
+ * @author lijie 2021-12-25
+ */
+@Data
+@ApiModel("送检记录工具表")
+@EqualsAndHashCode(callSuper = true)
+public class SecExperimentTool extends BaseEntity{
+
+    @ApiModelProperty(value = "主键", hidden = true)
+    private String id;
+
+    @ApiModelProperty(value = "安全工具id")
+    private Long toolId;
+
+    @ApiModelProperty(value = "是否合格")
+    private String isok;
+
+    @ApiModelProperty(value = "送检记录id")
+    private Date expId;
+
+    @ApiModelProperty(value = "del_flag")
+    @Length(min = 1, max = 1, message = "【del_flag】长度必须介于 {min} 和 {max} 之间")
+    private String delFlag;
+
+    @ApiModelProperty(value = "create_by")
+    @Length(min = 1, max = 64, message = "【create_by】长度必须介于 {min} 和 {max} 之间")
+    private String createBy;
+
+    @ApiModelProperty(value = "update_by")
+    @Length(min = 1, max = 64, message = "【update_by】长度必须介于 {min} 和 {max} 之间")
+    private String updateBy;
+
+    @ApiModelProperty(value = "update_time")
+    private Date updateTime;
+
+    public SecExperimentTool() {
+    }
+
+}

+ 0 - 8
railway-business/src/main/java/com/railway/business/safetool/domain/SecScheduled.java

@@ -25,10 +25,6 @@ public class SecScheduled extends BaseEntity{
     @ApiModelProperty(value = "车间id")
     protected Long deptId;
 
-    @ApiModelProperty(value = "存放处所")
-    @Length(min = 1, max = 100, message = "【存放处所】长度必须介于 {min} 和 {max} 之间")
-    protected String storePlace;
-
     @ApiModelProperty(value = "实验室id 部门表类型为实验室")
     protected Long labId;
 
@@ -36,19 +32,15 @@ public class SecScheduled extends BaseEntity{
     protected Date scheduledTime;
 
     @ApiModelProperty(value = "状态,0待送检,1已送检" )
-    @Length(min = 1, max = 1, message = "【状态,0待送检,1已送检】长度必须介于 {min} 和 {max} 之间")
     protected String state;
 
     @ApiModelProperty(value = "del_flag", hidden = true)
-    @Length(min = 1, max = 1, message = "【del_flag】长度必须介于 {min} 和 {max} 之间")
     protected String delFlag;
 
     @ApiModelProperty(value = "create_by", hidden = true)
-    @Length(min = 1, max = 64, message = "【create_by】长度必须介于 {min} 和 {max} 之间")
     protected String createBy;
 
     @ApiModelProperty(value = "update_by", hidden = true)
-    @Length(min = 1, max = 64, message = "【update_by】长度必须介于 {min} 和 {max} 之间")
     protected String updateBy;
 
     @ApiModelProperty(value = "update_time", hidden = true)

+ 31 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpAddParmVo.java

@@ -0,0 +1,31 @@
+package com.railway.business.safetool.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 送检记录新增参数
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("送检记录新增参数")
+public class SecExpAddParmVo implements Serializable {
+
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+    @ApiModelProperty(value = "计划ID")
+    private String secid;
+
+    @ApiModelProperty(value = "送检员")
+    private String createby;
+
+
+
+
+}

+ 32 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpDetailVo.java

@@ -0,0 +1,32 @@
+package com.railway.business.safetool.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 送检记录详情
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("送检记录详情")
+public class SecExpDetailVo implements Serializable {
+
+
+    @ApiModelProperty(value = "工具名")
+    private String toolName;
+
+    @ApiModelProperty(value = "数量")
+    private String c;
+
+    @ApiModelProperty(value = "单位")
+    private String unit;
+
+
+    @ApiModelProperty(value = "分组数据")
+    private List<SecExpToolsVo> baseSafetyTools;
+
+}

+ 23 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpEndParmVo.java

@@ -0,0 +1,23 @@
+package com.railway.business.safetool.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 完成实验
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("完成实验")
+public class SecExpEndParmVo implements Serializable {
+
+
+    @ApiModelProperty(value = "id")
+    private String id;
+
+
+}

+ 34 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpListParmVo.java

@@ -0,0 +1,34 @@
+package com.railway.business.safetool.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 送检记录列表查询参数
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("送检记录列表查询参数")
+public class SecExpListParmVo implements Serializable {
+
+    //用户所在单位
+    @ApiModelProperty(value = "实验室ID")
+    private String labId;
+
+    @ApiModelProperty(value = "送检车间ID")
+    private String deptId;
+
+    @ApiModelProperty(value = "排序ASC DESC")
+    private String orderby;
+
+    @ApiModelProperty(value = "状态:1已实验  0未实验")
+    private String state;
+
+    @ApiModelProperty(value = "送检日期")
+    private String scheduledTime;
+
+
+}

+ 48 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpListVo.java

@@ -0,0 +1,48 @@
+package com.railway.business.safetool.domain.vo;
+
+import com.railway.business.safetool.domain.SecScheduled;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 送检记录列表
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("送检记录列表")
+public class SecExpListVo implements Serializable {
+
+
+    @ApiModelProperty(value = "送检记录id")
+    private long id;
+
+    @ApiModelProperty(value = "实验状态")
+    private String state;
+
+    @ApiModelProperty(value = "送检日期")
+    private String scheduledTime;
+
+    @ApiModelProperty(value = "实验截止日期")
+    private String endTime;
+
+    @ApiModelProperty(value = "实验日期")
+    private String expDate;
+
+    @ApiModelProperty(value = "车间")
+    private String deptName;
+
+    @ApiModelProperty(value = "实验室")
+    private String labName;
+
+    @ApiModelProperty(value = "送检人员")
+    private String realName;
+
+    public SecExpListVo() {
+    }
+
+}

+ 24 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpNQParmVo.java

@@ -0,0 +1,24 @@
+package com.railway.business.safetool.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 实验不合格安全工具
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("实验不合格安全工具")
+public class SecExpNQParmVo implements Serializable {
+
+
+    @ApiModelProperty(value = "id")
+    private String id;
+    @ApiModelProperty(value = "是否合格")
+    private String isok;
+
+
+}

+ 32 - 0
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecExpToolsVo.java

@@ -0,0 +1,32 @@
+package com.railway.business.safetool.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 送检记录安全工具
+ * @author lijie 2021-12-04
+ */
+@Data
+@ApiModel("送检记录安全工具")
+public class SecExpToolsVo implements Serializable {
+    @ApiModelProperty(value = "安全工具ID")
+    protected Long toolId;
+
+    @ApiModelProperty(value = "编号")
+    protected String toolCode;
+
+    @ApiModelProperty(value = "id")
+    protected String id;
+
+    @ApiModelProperty(value = "是否合格")
+    protected String isok;
+
+
+    public SecExpToolsVo() {
+    }
+
+}

+ 2 - 2
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecScheduledListParmVo.java

@@ -22,8 +22,8 @@ public class SecScheduledListParmVo implements Serializable {
     @ApiModelProperty(value = "车间id")
     protected Long deptId;
 
-    @ApiModelProperty(value = "存放处所")
-    protected String storePlace;
+    @ApiModelProperty(value = "实验室ID")
+    protected Long labId;
 
     @ApiModelProperty(value = "排序方式 asc desc")
     protected String orderby;

+ 4 - 1
railway-business/src/main/java/com/railway/business/safetool/domain/vo/SecScheduledToolsVo.java

@@ -19,12 +19,15 @@ import java.util.List;
 @Data
 @ApiModel("安全工具计划内显示的工具")
 public class SecScheduledToolsVo implements Serializable {
-    @ApiModelProperty(value = "主键")
+    @ApiModelProperty(value = "安全工具ID")
     protected Long toolId;
 
     @ApiModelProperty(value = "编号")
     protected String toolCode;
 
+    @ApiModelProperty(value = "id")
+    protected String id;
+
     public SecScheduledToolsVo() {
     }
 

+ 48 - 0
railway-business/src/main/java/com/railway/business/safetool/mapper/SecExperimentMapper.java

@@ -0,0 +1,48 @@
+package com.railway.business.safetool.mapper;
+
+import com.github.pagehelper.Page;
+
+import com.railway.business.safetool.domain.SecExperiment;
+import com.railway.business.safetool.domain.vo.SecExpAddParmVo;
+import com.railway.business.safetool.domain.vo.SecExpDetailVo;
+import com.railway.business.safetool.domain.vo.SecExpListParmVo;
+import com.railway.business.safetool.domain.vo.SecExpListVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+* 送检记录表
+* @author lijie
+* @date 2021/12/25
+*/
+@Mapper
+@Repository
+public interface SecExperimentMapper {
+
+    /**
+    * 新增
+    */
+    int insertExp(SecExpAddParmVo secExpAddParmVo);
+
+    int insertTool(@Param("secid") String secid,@Param("expid") String expid,@Param("createby") String createby);
+
+    /**
+    * 更新
+    */
+    int update(SecExperiment secExperiment);
+    int updateScheduled(@Param("id") String id,@Param("state") String state);
+
+    /**
+    * 获取单个
+    */
+    List<SecExpDetailVo> getInfo(@Param("id") String id);
+
+    /**
+    * 查询列表
+    */
+    Page<SecExpListVo> getList(SecExpListParmVo listParmVo);
+
+}

+ 44 - 0
railway-business/src/main/java/com/railway/business/safetool/mapper/SecExperimentToolMapper.java

@@ -0,0 +1,44 @@
+package com.railway.business.safetool.mapper;
+
+import com.github.pagehelper.Page;
+
+import com.railway.business.safetool.domain.SecExperimentTool;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+/**
+* 送检记录工具表
+* @author lijie
+* @date 2021/12/25
+*/
+@Mapper
+@Repository
+public interface SecExperimentToolMapper {
+
+    /**
+    * 新增
+    */
+    int insert(SecExperimentTool secExperimentTool);
+
+    /**
+    * 删除
+    */
+    int delete(@Param("id") String id);
+
+    /**
+    * 更新
+    */
+    int update(SecExperimentTool secExperimentTool);
+
+    /**
+    * 获取单个
+    */
+    SecExperimentTool getInfo(@Param("id") String id);
+
+    /**
+    * 查询列表
+    */
+    Page<SecExperimentTool> getList(SecExperimentTool secExperimentTool);
+
+}

+ 36 - 0
railway-business/src/main/java/com/railway/business/safetool/service/ISecExperimentService.java

@@ -0,0 +1,36 @@
+package com.railway.business.safetool.service;
+
+import com.railway.business.safetool.domain.SecExperiment;
+import com.railway.business.safetool.domain.vo.*;
+
+import java.util.List;
+/**
+* 送检记录表
+* @author lijie
+* @date 2021/12/25
+*/
+public interface ISecExperimentService{
+
+    /**
+    * 新增
+    */
+    int create(SecExpAddParmVo secExpAddParmVo);
+
+
+
+    /**
+    * 更新
+    */
+    int update(SecExpEndParmVo secExperiment);
+    int nq(SecExpNQParmVo nq);
+    /**
+    * 获取单个
+    */
+    List<SecExpDetailVo>  getInfo(String id);
+
+    /**
+    * 查询列表
+    */
+    List<SecExpListVo> getList(SecExpListParmVo parm);
+
+}

+ 39 - 0
railway-business/src/main/java/com/railway/business/safetool/service/ISecExperimentToolService.java

@@ -0,0 +1,39 @@
+package com.railway.business.safetool.service;
+
+
+import com.railway.business.safetool.domain.SecExperimentTool;
+
+import java.util.List;
+/**
+* 送检记录工具表
+* @author lijie
+* @date 2021/12/25
+*/
+public interface ISecExperimentToolService{
+
+    /**
+    * 新增
+    */
+    int create(SecExperimentTool secExperimentTool);
+
+    /**
+    * 删除
+    */
+    int delete(String[] ids);
+
+    /**
+    * 更新
+    */
+    int update(SecExperimentTool secExperimentTool);
+
+    /**
+    * 获取单个
+    */
+    SecExperimentTool getInfo(String id);
+
+    /**
+    * 查询列表
+    */
+    List<SecExperimentTool> getList(SecExperimentTool secExperimentTool);
+
+}

+ 114 - 0
railway-business/src/main/java/com/railway/business/safetool/service/impl/SecExperimentServiceImpl.java

@@ -0,0 +1,114 @@
+package com.railway.business.safetool.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+
+import com.railway.business.safetool.domain.SecExperiment;
+import com.railway.business.safetool.domain.SecExperimentTool;
+import com.railway.business.safetool.domain.vo.*;
+import com.railway.business.safetool.mapper.SecExperimentMapper;
+import com.railway.business.safetool.mapper.SecExperimentToolMapper;
+import com.railway.business.safetool.mapper.SecScheduledMapper;
+import com.railway.business.safetool.service.ISecExperimentService;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.railway.common.utils.SecurityUtils;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+import java.util.Date;
+/**
+* 送检记录表
+* @author lijie
+* @date 2021/12/25
+*/
+@Service
+@Transactional(readOnly = true)
+public class SecExperimentServiceImpl implements ISecExperimentService {
+@Autowired
+private SecExperimentMapper secExperimentMapper;
+	@Autowired
+	private SecExperimentToolMapper secExperimentToolMapper;
+
+	/**
+	* 新增
+	*/
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public int create(SecExpAddParmVo secExpAddParmVo) {
+//		secExpAddParmVo.setCreateTime(new Date());
+
+		secExpAddParmVo.setCreateby(SecurityUtils.getUsername());
+		int r = secExperimentMapper.insertExp(secExpAddParmVo);
+
+		if(r>0){
+			String secid = secExpAddParmVo.getSecid();
+			String expid = secExpAddParmVo.getId();
+			String createby = SecurityUtils.getUsername();
+			secExperimentMapper.insertTool(secid,expid,createby);
+		}
+		//设置已送检状态
+		if(r>0){
+			r =secExperimentMapper.updateScheduled(secExpAddParmVo.getSecid(),"1");
+		}
+		return r;
+	}
+
+
+
+	/**
+	* 更新
+	*/
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public int update(SecExpEndParmVo p) {
+		SecExperiment secExperiment = new SecExperiment();
+		BeanUtils.copyProperties(p,secExperiment);
+		secExperiment.setState("1");
+		secExperiment.setExpDate(new Date());
+		secExperiment.setUpdateTime(new Date());
+    	secExperiment.setUpdateBy(SecurityUtils.getUsername());
+		int r = secExperimentMapper.update(secExperiment);
+		if(r>0){
+			//设置待送检状态
+			r =secExperimentMapper.updateScheduled(secExperiment.getId(),"0");
+		}
+		return r;
+	}
+
+	//设置安全工具
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public int nq(SecExpNQParmVo p) {
+		SecExperimentTool set = new SecExperimentTool();
+		BeanUtils.copyProperties(p,set);
+		set.setUpdateTime(new Date());
+		set.setUpdateBy(SecurityUtils.getUsername());
+		int r = secExperimentToolMapper.update(set);
+		return r;
+	}
+	/**
+	* 获取单个
+	*/
+	@Override
+	public List<SecExpDetailVo>  getInfo(String id) {
+
+
+		List<SecExpDetailVo> r = secExperimentMapper.getInfo(id);
+		r.forEach( vo->
+				vo.setC(vo.getBaseSafetyTools().size()+"")
+		);
+		return r;
+
+	}
+
+	/**
+	* 查询列表
+	*/
+	@Override
+	public List<SecExpListVo> getList(SecExpListParmVo parm) {
+		parm.setLabId(SecurityUtils.getLoginUser().getDeptId().toString());
+		return secExperimentMapper.getList(parm);
+	}
+}

+ 72 - 0
railway-business/src/main/java/com/railway/business/safetool/service/impl/SecExperimentToolServiceImpl.java

@@ -0,0 +1,72 @@
+package com.railway.business.safetool.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+
+import com.railway.business.safetool.domain.SecExperimentTool;
+import com.railway.business.safetool.mapper.SecExperimentToolMapper;
+import com.railway.business.safetool.service.ISecExperimentToolService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.railway.common.utils.SecurityUtils;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+import java.util.Date;
+/**
+* 送检记录工具表
+* @author lijie
+* @date 2021/12/25
+*/
+@Service
+@Transactional(readOnly = true)
+public class SecExperimentToolServiceImpl implements ISecExperimentToolService {
+@Autowired
+private SecExperimentToolMapper secExperimentToolMapper;
+
+	/**
+	* 新增
+	*/
+	@Transactional(rollbackFor = Exception.class)
+	public int create(SecExperimentTool secExperimentTool) {
+	    secExperimentTool.setCreateTime(new Date());
+        secExperimentTool.setCreateBy(SecurityUtils.getUsername());
+		return secExperimentToolMapper.insert(secExperimentTool);
+	}
+
+	/**
+	* 删除
+	*/
+	@Transactional(rollbackFor = Exception.class)
+	public int delete(String[] ids) {
+		int r =0;
+		for (String id : ids) {
+			int j= secExperimentToolMapper.delete(id);
+			r = r + j;
+		}
+		return	r;
+	}
+
+	/**
+	* 更新
+	*/
+	@Transactional(rollbackFor = Exception.class)
+	public int update(SecExperimentTool secExperimentTool) {
+		secExperimentTool.setUpdateTime(new Date());
+    	secExperimentTool.setUpdateBy(SecurityUtils.getUsername());
+		return secExperimentToolMapper.update(secExperimentTool);
+	}
+
+	/**
+	* 获取单个
+	*/
+	public SecExperimentTool getInfo(String id) {
+		return secExperimentToolMapper.getInfo(id);
+	}
+
+	/**
+	* 查询列表
+	*/
+	public List<SecExperimentTool> getList(SecExperimentTool secExperimentTool) {
+		return secExperimentToolMapper.getList(secExperimentTool);
+	}
+}

+ 2 - 0
railway-business/src/main/java/com/railway/business/safetool/service/impl/SecScheduledServiceImpl.java

@@ -51,6 +51,8 @@ private SecScheduledMapper secScheduledMapper;
 		}
 		SecScheduled s = new SecScheduled();
 		BeanUtils.copyBeanProp(s,secScheduled);
+		s.setState("0");
+		s.setDelFlag("0");
 		int r = secScheduledMapper.insert(s);
 		if (r<1){
 			throw new Exception("计划插入失败");

+ 114 - 0
railway-business/src/main/resources/mapper/safetool/SecExperimentMapper.xml

@@ -0,0 +1,114 @@
+<?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="com.railway.business.safetool.mapper.SecExperimentMapper">
+
+    <resultMap id="BaseResultMap" type="com.railway.business.safetool.domain.vo.SecExpDetailVo">
+        <result column="toolName" property="toolName"/>
+        <result column="unit" property="unit"/>
+        <collection property="baseSafetyTools" ofType="com.railway.business.safetool.domain.vo.SecExpToolsVo">
+            <result column="tool_id" property="toolId"/>
+            <result column="tool_code" property="toolCode"/>
+            <result column="id" property="id"/>
+            <result column="isok" property="isok"/>
+        </collection>
+
+    </resultMap>
+
+
+
+    <resultMap id="listResultMap" type="com.railway.business.safetool.domain.vo.SecExpListVo">
+        <result column="id" property="id"/>
+        <result column="state" property="state"/>
+        <result column="scheduled_time" property="scheduledTime"/>
+        <result column="end_time" property="endTime"/>
+        <result column="exp_date" property="expDate"/>
+        <result column="dept_name" property="deptName"/>
+        <result column="lab_name" property="labName"/>
+        <result column="real_name" property="realName"/>
+
+    </resultMap>
+
+
+    <insert id="insertExp" keyProperty="id" parameterType="com.railway.business.safetool.domain.vo.SecExpAddParmVo">
+        INSERT INTO sec_experiment (lab_id,lab_name,schedled_id,end_time,dept_id,dept_name,
+        scheduled_time,state,del_flag,create_time,create_by)
+        select lab_id,d2.dept_name lab_name,s.id schedled_id,
+        ADDDATE(now(),3) end_time ,s.dept_id,d.dept_name,
+        now() scheduled_time,
+        '0' state ,'0' del_flag, now() create_time , #{createby} create_by
+        from sec_scheduled s
+        left join sys_dept d on s.dept_id = d.dept_id
+        left join sys_dept d2 on lab_id = d2.dept_id
+        where  s.id = #{secid}
+    </insert>
+
+
+    <insert id="insertTool" >
+        INSERT INTO sec_experiment_tool (tool_id,isok,exp_id,del_flag,create_time,create_by)
+        select tool_id,'0' isok ,#{expid} exp_id ,'0' del_flag, now() create_time , #{createby} create_by
+        from sec_scheduled_tool
+        where scheduled_id = #{secid}
+    </insert>
+
+
+    <update id="update" parameterType="com.railway.business.safetool.domain.SecExperiment">
+        UPDATE sec_experiment
+        <set>
+                    <if test ='null != labId'>lab_id = #{labId},</if>
+                    <if test ='null != schedledId'>schedled_id = #{schedledId},</if>
+                    <if test ='null != endTime'>end_time = #{endTime},</if>
+                    <if test ='null != deptName'>dept_name = #{deptName},</if>
+                    <if test ='null != scheduledTime'>scheduled_time = #{scheduledTime},</if>
+                    <if test ='null != expDate'>exp_date = #{expDate},</if>
+                    <if test ='null != state'>state = #{state},</if>
+                    <if test ='null != delFlag'>del_flag = #{delFlag},</if>
+                    <if test ='null != createBy'>create_by = #{createBy},</if>
+                    <if test ='null != createTime'>create_time = #{createTime},</if>
+                    <if test ='null != updateBy'>update_by = #{updateBy},</if>
+                    <if test ='null != updateTime'>update_time = #{updateTime}</if>
+        </set>
+        WHERE id = #{id}
+    </update>
+    <update id="updateScheduled" >
+	             update sec_scheduled
+					set 	state = #{state}
+					where id = (
+				 select schedled_id from sec_experiment where id = #{id}
+				 )
+    </update>
+    <select id="getInfo" resultMap="BaseResultMap">
+ select  d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code,r.id,r.isok
+ FROM sec_experiment s
+ LEFT JOIN sec_experiment_tool r
+ ON r.exp_id = s.id
+ INNER JOIN base_safety_tool t
+ ON t.tool_id = r.tool_id
+ left join sys_dept d1 on s.dept_id = d1.dept_id
+ left join sys_dept d2 on s.lab_id =  d2.dept_id
+ left join sys_dict_data d3 on d3.dict_type = 'tool_type' and d3.dict_value = t.tool_type
+ WHERE s.del_flag = '0' and t.del_flag = '0' and t.state = '1'
+   and s.id=#{id}
+    </select>
+
+    <select id="getList" resultMap="listResultMap">
+
+        select e.id,e.state,e.scheduled_time,e.end_time,e.exp_date,e.dept_name,e.lab_name,u.real_name from sec_experiment e
+        left join sys_user u on e.create_by = u.user_name
+        where e.lab_id =#{labId}
+
+        <if test="deptId!=null and deptId!=''">
+            and  e.deptId =#{deptId}
+        </if>
+
+        <if test="scheduledTime!=null and scheduledTime!=''">
+            and  e.scheduled_time =#{scheduledTime}
+        </if>
+
+        <if test="orderby!=null and orderby!=''">
+            order by end_time ${orderby}
+        </if>
+
+    </select>
+
+</mapper>

+ 152 - 0
railway-business/src/main/resources/mapper/safetool/SecExperimentToolMapper.xml

@@ -0,0 +1,152 @@
+<?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="com.railway.business.safetool.mapper.SecExperimentToolMapper">
+
+    <resultMap id="BaseResultMap" type="com.railway.business.safetool.domain.SecExperimentTool">
+                <result column="id" property="id"/>
+                <result column="tool_id" property="toolId"/>
+                <result column="isok" property="isok"/>
+                <result column="exp_id" property="expId"/>
+                <result column="del_flag" property="delFlag"/>
+                <result column="create_by" property="createBy"/>
+                <result column="create_time" property="createTime"/>
+                <result column="update_by" property="updateBy"/>
+                <result column="update_time" property="updateTime"/>
+    </resultMap>
+
+    <sql id="Base_Column_List">
+                id,
+                tool_id,
+                isok,
+                exp_id,
+                del_flag,
+                create_by,
+                create_time,
+                update_by,
+                update_time
+    </sql>
+
+    <insert id="insert" parameterType="com.railway.business.safetool.domain.SecExperimentTool">
+        <selectKey keyProperty="id" order="BEFORE" resultType="String">
+            select replace(uuid(), '-', '') from dual
+        </selectKey>
+        INSERT INTO sec_experiment_tool
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+                    <if test ='null != toolId'>
+                    tool_id,
+                    </if>
+                    <if test ='null != isok'>
+                    isok,
+                    </if>
+                    <if test ='null != expId'>
+                    exp_id,
+                    </if>
+                    <if test ='null != delFlag'>
+                    del_flag,
+                    </if>
+                    <if test ='null != createBy'>
+                    create_by,
+                    </if>
+                    <if test ='null != createTime'>
+                    create_time,
+                    </if>
+                    <if test ='null != updateBy'>
+                    update_by,
+                    </if>
+                    <if test ='null != updateTime'>
+                    update_time
+                    </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+                    <if test ='null != toolId'>
+                    #{toolId},
+                    </if>
+                    <if test ='null != isok'>
+                    #{isok},
+                    </if>
+                    <if test ='null != expId'>
+                    #{expId},
+                    </if>
+                    <if test ='null != delFlag'>
+                    #{delFlag},
+                    </if>
+                    <if test ='null != createBy'>
+                    #{createBy},
+                    </if>
+                    <if test ='null != createTime'>
+                    #{createTime},
+                    </if>
+                    <if test ='null != updateBy'>
+                    #{updateBy},
+                    </if>
+                    <if test ='null != updateTime'>
+                    #{updateTime}
+                    </if>
+        </trim>
+    </insert>
+
+    <delete id="delete">
+        UPDATE sec_experiment_tool
+        set del_flag='1'
+        WHERE id = #{id}
+    </delete>
+
+    <update id="update" parameterType="com.railway.business.safetool.domain.SecExperimentTool">
+        UPDATE sec_experiment_tool
+        <set>
+                    <if test ='null != toolId'>tool_id = #{toolId},</if>
+                    <if test ='null != isok'>isok = #{isok},</if>
+                    <if test ='null != expId'>exp_id = #{expId},</if>
+                    <if test ='null != delFlag'>del_flag = #{delFlag},</if>
+                    <if test ='null != createBy'>create_by = #{createBy},</if>
+                    <if test ='null != createTime'>create_time = #{createTime},</if>
+                    <if test ='null != updateBy'>update_by = #{updateBy},</if>
+                    <if test ='null != updateTime'>update_time = #{updateTime}</if>
+        </set>
+        WHERE id = #{id}
+    </update>
+
+
+    <select id="getInfo" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM sec_experiment_tool
+        WHERE del_flag='0' and id = #{id}
+
+    </select>
+
+    <select id="getList" resultMap="BaseResultMap">
+        SELECT
+        <include refid="Base_Column_List"/>
+        FROM sec_experiment_tool
+        <where>
+            del_flag='0'
+                <if test="toolId!=null and toolId!=''">
+                    and tool_id=#{toolId}
+                </if>
+                <if test="isok!=null and isok!=''">
+                    and isok=#{isok}
+                </if>
+                <if test="expId!=null and expId!=''">
+                    and exp_id=#{expId}
+                </if>
+                <if test="delFlag!=null and delFlag!=''">
+                    and del_flag=#{delFlag}
+                </if>
+                <if test="createBy!=null and createBy!=''">
+                    and create_by=#{createBy}
+                </if>
+                <if test="createTime!=null and createTime!=''">
+                    and create_time=#{createTime}
+                </if>
+                <if test="updateBy!=null and updateBy!=''">
+                    and update_by=#{updateBy}
+                </if>
+                <if test="updateTime!=null and updateTime!=''">
+                    and update_time=#{updateTime}
+                </if>
+        </where>
+    </select>
+
+</mapper>

+ 12 - 15
railway-business/src/main/resources/mapper/safetool/SecScheduledMapper.xml

@@ -9,13 +9,14 @@
         <collection property="baseSafetyTools" ofType="com.railway.business.safetool.domain.vo.SecScheduledToolsVo">
             <result column="tool_id" property="toolId"/>
             <result column="tool_code" property="toolCode"/>
+            <result column="id" property="id"/>
         </collection>
 
     </resultMap>
     <resultMap id="BaseResultMap2" type="com.railway.business.safetool.domain.vo.SecScheduledListVo2">
         <result column="id" property="id"/>
         <result column="dept_id" property="deptId"/>
-        <result column="store_place" property="storePlace"/>
+
         <result column="lab_id" property="labId"/>
         <result column="scheduled_time" property="scheduledTime"/>
         <result column="deptName" property="deptName"/>
@@ -48,9 +49,7 @@
                     <if test ='null != deptId'>
                     dept_id,
                     </if>
-                    <if test ='null != storePlace'>
-                    store_place,
-                    </if>
+
                     <if test ='null != labId'>
                     lab_id,
                     </if>
@@ -80,9 +79,7 @@
                     <if test ='null != deptId'>
                     #{deptId},
                     </if>
-                    <if test ='null != storePlace'>
-                    #{storePlace},
-                    </if>
+
                     <if test ='null != labId'>
                     #{labId},
                     </if>
@@ -120,7 +117,7 @@
         UPDATE sec_scheduled
         <set>
                     <if test ='null != deptId'>dept_id = #{deptId},</if>
-                    <if test ='null != storePlace'>store_place = #{storePlace},</if>
+
                     <if test ='null != labId'>lab_id = #{labId},</if>
                     <if test ='null != scheduledTime'>scheduled_time = #{scheduledTime},</if>
                     <if test ='null != state'>state = #{state},</if>
@@ -135,7 +132,7 @@
 
 
     <select id="getInfo" resultMap="BaseResultMap">
-select  d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code
+select  d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code,r.id
  FROM sec_scheduled s
  LEFT JOIN sec_scheduled_tool r
  ON r.scheduled_id = s.id
@@ -151,7 +148,7 @@ select  d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code
 
     <select id="getList" resultMap="BaseResultMap2">
 
-        select s.id,s.dept_id,s.store_place,s.lab_id,s.scheduled_time ,d1.dept_name deptName,d2.dept_name labName,concat(count(1),'件') c
+        select s.id,s.dept_id,s.lab_id,s.scheduled_time ,d1.dept_name deptName,d2.dept_name labName,concat(count(1),'件') c
          from
         sec_scheduled s
         left join  sec_scheduled_tool r
@@ -161,13 +158,13 @@ select  d3.dict_label toolName ,t.unit,t.tool_id,t.tool_code
         left join sys_dept d1 on s.dept_id = d1.dept_id
         left join sys_dept d2 on s.lab_id =  d2.dept_id
         where s.del_flag = '0' and s.state = 0 and t.del_flag = '0' and t.state = '1'
-        <if test="deptId!=null and deptId!=''">
+
             and s.dept_id=#{deptId}
-        </if>
-        <if test="storePlace!=null and storePlace!=''">
-            and  s.store_place like concat(#{storePlace},'%')
-        </if>
 
+
+        <if test="labId!=null and labId!=''">
+            and s.lab_id=#{labId}
+        </if>
         <if test="orderby!=null and orderby!=''">
             order by scheduled_time ${orderby}
         </if>