Explorar el Código

联合检查-v1.0

hanqingsong hace 4 meses
padre
commit
a8fad71234
Se han modificado 11 ficheros con 251 adiciones y 29 borrados
  1. 1 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesInspectionResultCollect/service/impl/LesInspectionResultCollectServiceImpl.java
  2. 1 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesInspectionTemplate/service/impl/LesInspectionTemplateServiceImpl.java
  3. 5 5
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/controller/LesJointInspectionTaskController.java
  4. 23 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/entity/LesJointInspectionTask.java
  5. 4 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/mapper/LesJointInspectionTaskMapper.java
  6. 11 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/mapper/mapping/LesJointInspectionTaskMapper.xml
  7. 14 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/param/LesJointInspectionTaskAddParam.java
  8. 14 1
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/param/LesJointInspectionTaskEditParam.java
  9. 5 0
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/param/LesJointInspectionTaskPageParam.java
  10. 147 6
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/service/impl/LesJointInspectionTaskServiceImpl.java
  11. 26 12
      unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTaskItem/controller/LesJointInspectionTaskItemController.java

+ 1 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesInspectionResultCollect/service/impl/LesInspectionResultCollectServiceImpl.java

@@ -72,7 +72,7 @@ public class LesInspectionResultCollectServiceImpl extends ServiceImpl<LesInspec
72 72
             queryWrapper.orderBy(true, lesInspectionResultCollectPageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
73 73
                     StrUtil.toUnderlineCase(lesInspectionResultCollectPageParam.getSortField()));
74 74
         } else {
75
-            queryWrapper.lambda().orderByAsc(LesInspectionResultCollect::getId);
75
+            queryWrapper.lambda().orderByDesc(LesInspectionResultCollect::getId);
76 76
         }
77 77
         return this.page(CommonPageRequest.defaultPage(), queryWrapper);
78 78
     }

+ 1 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesInspectionTemplate/service/impl/LesInspectionTemplateServiceImpl.java

@@ -67,7 +67,7 @@ public class LesInspectionTemplateServiceImpl extends ServiceImpl<LesInspectionT
67 67
             queryWrapper.orderBy(true, lesInspectionTemplatePageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
68 68
                     StrUtil.toUnderlineCase(lesInspectionTemplatePageParam.getSortField()));
69 69
         } else {
70
-            queryWrapper.lambda().orderByAsc(LesInspectionTemplate::getId);
70
+            queryWrapper.lambda().orderByDesc(LesInspectionTemplate::getId);
71 71
         }
72 72
         return this.page(CommonPageRequest.defaultPage(), queryWrapper);
73 73
     }

+ 5 - 5
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/controller/LesJointInspectionTaskController.java

@@ -60,7 +60,7 @@ public class LesJointInspectionTaskController {
60 60
      */
61 61
     @ApiOperationSupport(order = 1)
62 62
     @ApiOperation("获取联合检查-联合检查任务分页")
63
-    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/page")
63
+//    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/page")
64 64
     @GetMapping("/lawEnforcementSupervision/lesJointInspectionTask/page")
65 65
     public CommonResult<Page<LesJointInspectionTask>> page(LesJointInspectionTaskPageParam lesJointInspectionTaskPageParam) {
66 66
         return CommonResult.data(lesJointInspectionTaskService.page(lesJointInspectionTaskPageParam));
@@ -75,7 +75,7 @@ public class LesJointInspectionTaskController {
75 75
     @ApiOperationSupport(order = 2)
76 76
     @ApiOperation("添加联合检查-联合检查任务")
77 77
     @CommonLog("添加联合检查-联合检查任务")
78
-    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/add")
78
+//    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/add")
79 79
     @PostMapping("/lawEnforcementSupervision/lesJointInspectionTask/add")
80 80
     public CommonResult<String> add(@RequestBody @Valid LesJointInspectionTaskAddParam lesJointInspectionTaskAddParam) {
81 81
         lesJointInspectionTaskService.add(lesJointInspectionTaskAddParam);
@@ -91,7 +91,7 @@ public class LesJointInspectionTaskController {
91 91
     @ApiOperationSupport(order = 3)
92 92
     @ApiOperation("编辑联合检查-联合检查任务")
93 93
     @CommonLog("编辑联合检查-联合检查任务")
94
-    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/edit")
94
+//    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/edit")
95 95
     @PostMapping("/lawEnforcementSupervision/lesJointInspectionTask/edit")
96 96
     public CommonResult<String> edit(@RequestBody @Valid LesJointInspectionTaskEditParam lesJointInspectionTaskEditParam) {
97 97
         lesJointInspectionTaskService.edit(lesJointInspectionTaskEditParam);
@@ -107,7 +107,7 @@ public class LesJointInspectionTaskController {
107 107
     @ApiOperationSupport(order = 4)
108 108
     @ApiOperation("删除联合检查-联合检查任务")
109 109
     @CommonLog("删除联合检查-联合检查任务")
110
-    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/delete")
110
+//    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/delete")
111 111
     @PostMapping("/lawEnforcementSupervision/lesJointInspectionTask/delete")
112 112
     public CommonResult<String> delete(@RequestBody @Valid @NotEmpty(message = "集合不能为空")
113 113
                                                    CommonValidList<LesJointInspectionTaskIdParam> lesJointInspectionTaskIdParamList) {
@@ -123,7 +123,7 @@ public class LesJointInspectionTaskController {
123 123
      */
124 124
     @ApiOperationSupport(order = 5)
125 125
     @ApiOperation("获取联合检查-联合检查任务详情")
126
-    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/detail")
126
+//    @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTask/detail")
127 127
     @GetMapping("/lawEnforcementSupervision/lesJointInspectionTask/detail")
128 128
     public CommonResult<LesJointInspectionTask> detail(@Valid LesJointInspectionTaskIdParam lesJointInspectionTaskIdParam) {
129 129
         return CommonResult.data(lesJointInspectionTaskService.detail(lesJointInspectionTaskIdParam));

+ 23 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/entity/LesJointInspectionTask.java

@@ -13,11 +13,13 @@
13 13
 package com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.entity;
14 14
 
15 15
 import com.baomidou.mybatisplus.annotation.*;
16
+import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTaskItem.entity.LesJointInspectionTaskItem;
16 17
 import io.swagger.annotations.ApiModelProperty;
17 18
 import lombok.Getter;
18 19
 import lombok.Setter;
19 20
 import java.math.BigDecimal;
20 21
 import java.util.Date;
22
+import java.util.List;
21 23
 
22 24
 /**
23 25
  * 联合检查-联合检查任务实体
@@ -80,6 +82,26 @@ public class LesJointInspectionTask {
80 82
     private Integer inspectionType;
81 83
 
82 84
     /** 状态 0:保存状态;1:发布(申请中); */
83
-    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);", position = 12)
85
+    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);2:审核通过;3:驳回", position = 12)
84 86
     private Integer status;
87
+
88
+    @ApiModelProperty(value = "检查项", position = 13)
89
+    @TableField(exist = false)
90
+    private List<LesJointInspectionTaskItem> items;
91
+
92
+    @ApiModelProperty(value = "审核意见", position = 14)
93
+    @TableField(exist = false)
94
+    private String auditAdvice;
95
+
96
+    @ApiModelProperty(value = "审核人id(当前登录人)", position = 15)
97
+    @TableField(exist = false)
98
+    private String auditUserId;
99
+
100
+    @ApiModelProperty(value = "审核人名(当前登录人)", position = 16)
101
+    @TableField(exist = false)
102
+    private String auditUserName;
103
+
104
+    @ApiModelProperty(value = "审核时间", position = 17)
105
+    @TableField(exist = false)
106
+    private String auditTime;
85 107
 }

+ 4 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/mapper/LesJointInspectionTaskMapper.java

@@ -12,8 +12,11 @@
12 12
  */
13 13
 package com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.mapper;
14 14
 
15
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
15 16
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
17
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
16 18
 import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.entity.LesJointInspectionTask;
19
+import org.apache.ibatis.annotations.Param;
17 20
 
18 21
 /**
19 22
  * 联合检查-联合检查任务Mapper接口
@@ -22,4 +25,5 @@ import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.entity.
22 25
  * @date  2024/06/25 17:13
23 26
  **/
24 27
 public interface LesJointInspectionTaskMapper extends BaseMapper<LesJointInspectionTask> {
28
+    Page<LesJointInspectionTask> pageList(Page<Object> objectPage,@Param("ew") QueryWrapper<LesJointInspectionTask> queryWrapper);
25 29
 }

+ 11 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/mapper/mapping/LesJointInspectionTaskMapper.xml

@@ -1,5 +1,15 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.mapper.LesJointInspectionTaskMapper">
4
-
4
+    <select id="pageList" parameterType="com.baomidou.mybatisplus.core.conditions.Wrapper" resultType="com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.entity.LesJointInspectionTask">
5
+        SELECT
6
+            jit.*, ar.audit_user_id auditUserId,
7
+            ar.audit_time auditTime,
8
+            su.`NAME` auditUserName
9
+        FROM
10
+            biz_les_joint_inspection_task jit
11
+        LEFT JOIN biz_audit_request ar ON jit.id = ar.request_id
12
+        LEFT JOIN sys_user su ON ar.audit_user_id = su.ID
13
+        ${ew.customSqlSegment}
14
+    </select>
5 15
 </mapper>

+ 14 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/param/LesJointInspectionTaskAddParam.java

@@ -12,6 +12,7 @@
12 12
  */
13 13
 package com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.param;
14 14
 
15
+import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTaskItem.entity.LesJointInspectionTaskItem;
15 16
 import io.swagger.annotations.ApiModelProperty;
16 17
 import lombok.Getter;
17 18
 import lombok.Setter;
@@ -20,6 +21,7 @@ import javax.validation.constraints.NotBlank;
20 21
 import javax.validation.constraints.NotNull;
21 22
 import java.math.BigDecimal;
22 23
 import java.util.Date;
24
+import java.util.List;
23 25
 
24 26
 /**
25 27
  * 联合检查-联合检查任务添加参数
@@ -56,7 +58,18 @@ public class LesJointInspectionTaskAddParam {
56 58
     private Integer inspectionType;
57 59
 
58 60
     /** 状态 0:保存状态;1:发布(申请中); */
59
-    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);", position = 12)
61
+    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);2:审核通过;3:驳回", position = 12)
60 62
     private Integer status;
61 63
 
64
+    @ApiModelProperty(value = "检查项", position = 13)
65
+    private List<LesJointInspectionTaskItem> items;
66
+
67
+    @ApiModelProperty(value = "审核意见", position = 14)
68
+    private String auditAdvice;
69
+
70
+    @ApiModelProperty(value = "审核人id(当前登录人)", position = 15)
71
+    private String auditUserId;
72
+
73
+    @ApiModelProperty(value = "审核人名(当前登录人)", position = 16)
74
+    private String auditUserName;
62 75
 }

+ 14 - 1
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/param/LesJointInspectionTaskEditParam.java

@@ -12,6 +12,7 @@
12 12
  */
13 13
 package com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.param;
14 14
 
15
+import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTaskItem.entity.LesJointInspectionTaskItem;
15 16
 import io.swagger.annotations.ApiModelProperty;
16 17
 import lombok.Getter;
17 18
 import lombok.Setter;
@@ -20,6 +21,7 @@ import javax.validation.constraints.NotBlank;
20 21
 import javax.validation.constraints.NotNull;
21 22
 import java.math.BigDecimal;
22 23
 import java.util.Date;
24
+import java.util.List;
23 25
 
24 26
 /**
25 27
  * 联合检查-联合检查任务编辑参数
@@ -61,7 +63,18 @@ public class LesJointInspectionTaskEditParam {
61 63
     private Integer inspectionType;
62 64
 
63 65
     /** 状态 0:保存状态;1:发布(申请中); */
64
-    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);", position = 12)
66
+    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);2:审核通过;3:驳回", position = 12)
65 67
     private Integer status;
66 68
 
69
+    @ApiModelProperty(value = "检查项", position = 13)
70
+    private List<LesJointInspectionTaskItem> items;
71
+
72
+    @ApiModelProperty(value = "审核意见", position = 14)
73
+    private String auditAdvice;
74
+
75
+    @ApiModelProperty(value = "审核人id(当前登录人)", position = 15)
76
+    private String auditUserId;
77
+
78
+    @ApiModelProperty(value = "审核人名(当前登录人)", position = 16)
79
+    private String auditUserName;
67 80
 }

+ 5 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/param/LesJointInspectionTaskPageParam.java

@@ -48,4 +48,9 @@ public class LesJointInspectionTaskPageParam {
48 48
     @ApiModelProperty(value = "关键词")
49 49
     private String searchKey;
50 50
 
51
+    @ApiModelProperty(value = "检查任务名称")
52
+    private String inspectionTaskName;
53
+
54
+    @ApiModelProperty(value = "状态 0:保存状态;1:发布(申请中);2:审核通过;3:驳回")
55
+    private Integer status;
51 56
 }

+ 147 - 6
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTask/service/impl/LesJointInspectionTaskServiceImpl.java

@@ -17,8 +17,17 @@ import cn.hutool.core.collection.CollStreamUtil;
17 17
 import cn.hutool.core.util.ObjectUtil;
18 18
 import cn.hutool.core.util.StrUtil;
19 19
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
20
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
21
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
22
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
20 23
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
21 24
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
25
+import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTaskItem.entity.LesJointInspectionTaskItem;
26
+import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTaskItem.mapper.LesJointInspectionTaskItemMapper;
27
+import com.unis.policy.info.modular.auditRecord.entity.AuditRecord;
28
+import com.unis.policy.info.modular.auditRecord.mapper.AuditRecordMapper;
29
+import com.unis.policy.info.modular.auditRequest.entity.AuditRequest;
30
+import com.unis.policy.info.modular.auditRequest.mapper.AuditRequestMapper;
22 31
 import org.springframework.stereotype.Service;
23 32
 import org.springframework.transaction.annotation.Transactional;
24 33
 import com.unis.common.enums.CommonSortOrderEnum;
@@ -32,28 +41,49 @@ import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.param.L
32 41
 import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.param.LesJointInspectionTaskPageParam;
33 42
 import com.unis.lawEnforcementSupervision.modular.lesJointInspectionTask.service.LesJointInspectionTaskService;
34 43
 
44
+import javax.annotation.Resource;
35 45
 import java.util.List;
36 46
 
37 47
 /**
38 48
  * 联合检查-联合检查任务Service接口实现类
39 49
  *
40 50
  * @author QSHan
41
- * @date  2024/06/25 17:13
51
+ * @date 2024/06/25 17:13
42 52
  **/
43 53
 @Service
44 54
 public class LesJointInspectionTaskServiceImpl extends ServiceImpl<LesJointInspectionTaskMapper, LesJointInspectionTask> implements LesJointInspectionTaskService {
55
+    @Resource
56
+    private LesJointInspectionTaskItemMapper lesJointInspectionTaskItemMapper;
57
+    @Resource
58
+    private LesJointInspectionTaskMapper lesJointInspectionTaskMapper;
59
+    // 流程主表
60
+    @Resource
61
+    private AuditRequestMapper auditRequestMapper;
62
+    // 流程记录
63
+    @Resource
64
+    private AuditRecordMapper auditRecordMapper;
45 65
 
46 66
     @Override
47 67
     public Page<LesJointInspectionTask> page(LesJointInspectionTaskPageParam lesJointInspectionTaskPageParam) {
48 68
         QueryWrapper<LesJointInspectionTask> queryWrapper = new QueryWrapper<>();
49
-        if(ObjectUtil.isAllNotEmpty(lesJointInspectionTaskPageParam.getSortField(), lesJointInspectionTaskPageParam.getSortOrder())) {
69
+        // 检查任务名称
70
+        if (StringUtils.isNotEmpty(lesJointInspectionTaskPageParam.getInspectionTaskName())) {
71
+            queryWrapper.lambda().like(LesJointInspectionTask::getInspectionTaskName, lesJointInspectionTaskPageParam.getInspectionTaskName());
72
+        }
73
+        // 检查任务审核,查询状态非0的数据(状态 0:保存状态;1:发布(申请中);2:审核通过;3:驳回)
74
+        if (ObjectUtils.isNotEmpty(lesJointInspectionTaskPageParam.getStatus())) {
75
+            if (0 != lesJointInspectionTaskPageParam.getStatus()) {
76
+                queryWrapper.lambda().ne(LesJointInspectionTask::getStatus, 0);
77
+            }
78
+        }
79
+        if (ObjectUtil.isAllNotEmpty(lesJointInspectionTaskPageParam.getSortField(), lesJointInspectionTaskPageParam.getSortOrder())) {
50 80
             CommonSortOrderEnum.validate(lesJointInspectionTaskPageParam.getSortOrder());
51 81
             queryWrapper.orderBy(true, lesJointInspectionTaskPageParam.getSortOrder().equals(CommonSortOrderEnum.ASC.getValue()),
52 82
                     StrUtil.toUnderlineCase(lesJointInspectionTaskPageParam.getSortField()));
53 83
         } else {
54
-            queryWrapper.lambda().orderByAsc(LesJointInspectionTask::getId);
84
+            queryWrapper.lambda().orderByDesc(LesJointInspectionTask::getId);
55 85
         }
56
-        return this.page(CommonPageRequest.defaultPage(), queryWrapper);
86
+        return lesJointInspectionTaskMapper.pageList(CommonPageRequest.defaultPage(), queryWrapper);
57 87
     }
58 88
 
59 89
     @Transactional(rollbackFor = Exception.class)
@@ -61,6 +91,12 @@ public class LesJointInspectionTaskServiceImpl extends ServiceImpl<LesJointInspe
61 91
     public void add(LesJointInspectionTaskAddParam lesJointInspectionTaskAddParam) {
62 92
         LesJointInspectionTask lesJointInspectionTask = BeanUtil.toBean(lesJointInspectionTaskAddParam, LesJointInspectionTask.class);
63 93
         this.save(lesJointInspectionTask);
94
+        if (CollectionUtils.isNotEmpty(lesJointInspectionTaskAddParam.getItems())) {
95
+            // 保存子表关联数据
96
+            this.insertChild(lesJointInspectionTask);
97
+        }
98
+        // 添加审批
99
+        this.audit(lesJointInspectionTask);
64 100
     }
65 101
 
66 102
     @Transactional(rollbackFor = Exception.class)
@@ -69,6 +105,14 @@ public class LesJointInspectionTaskServiceImpl extends ServiceImpl<LesJointInspe
69 105
         LesJointInspectionTask lesJointInspectionTask = this.queryEntity(lesJointInspectionTaskEditParam.getId());
70 106
         BeanUtil.copyProperties(lesJointInspectionTaskEditParam, lesJointInspectionTask);
71 107
         this.updateById(lesJointInspectionTask);
108
+        if (CollectionUtils.isNotEmpty(lesJointInspectionTask.getItems())) {
109
+            // 先删除
110
+            this.deleteChild(lesJointInspectionTask.getId());
111
+            // 在新增
112
+            this.insertChild(lesJointInspectionTask);
113
+        }
114
+        // 添加审批
115
+        this.audit(lesJointInspectionTask);
72 116
     }
73 117
 
74 118
     @Transactional(rollbackFor = Exception.class)
@@ -76,19 +120,116 @@ public class LesJointInspectionTaskServiceImpl extends ServiceImpl<LesJointInspe
76 120
     public void delete(List<LesJointInspectionTaskIdParam> lesJointInspectionTaskIdParamList) {
77 121
         // 执行删除
78 122
         this.removeByIds(CollStreamUtil.toList(lesJointInspectionTaskIdParamList, LesJointInspectionTaskIdParam::getId));
123
+        // 删除子表关联数据
124
+        lesJointInspectionTaskIdParamList.forEach(ids -> this.deleteChild(ids.getId()));
79 125
     }
80 126
 
81 127
     @Override
82 128
     public LesJointInspectionTask detail(LesJointInspectionTaskIdParam lesJointInspectionTaskIdParam) {
83
-        return this.queryEntity(lesJointInspectionTaskIdParam.getId());
129
+        LesJointInspectionTask lesJointInspectionTask = this.queryEntity(lesJointInspectionTaskIdParam.getId());
130
+        // 查询子表关联数据
131
+        List<LesJointInspectionTaskItem> items = lesJointInspectionTaskItemMapper.selectList(this.queryObject(lesJointInspectionTask.getId()));
132
+        if (CollectionUtils.isNotEmpty(items)) {
133
+            lesJointInspectionTask.setItems(items);
134
+        }
135
+        // 查询审批意见
136
+        QueryWrapper<AuditRequest> wrapper = new QueryWrapper<>();
137
+        wrapper.lambda().eq(AuditRequest::getRequestId, lesJointInspectionTask.getId());
138
+        wrapper.lambda().eq(AuditRequest::getType, 12);
139
+        wrapper.lambda().eq(AuditRequest::getStep, 12);
140
+        AuditRequest request = auditRequestMapper.selectOne(wrapper);
141
+        if (ObjectUtils.isNotEmpty(request)) {
142
+            lesJointInspectionTask.setAuditAdvice(request.getAuditAdvice());
143
+        }
144
+        return lesJointInspectionTask;
84 145
     }
85 146
 
86 147
     @Override
87 148
     public LesJointInspectionTask queryEntity(String id) {
88 149
         LesJointInspectionTask lesJointInspectionTask = this.getById(id);
89
-        if(ObjectUtil.isEmpty(lesJointInspectionTask)) {
150
+        if (ObjectUtil.isEmpty(lesJointInspectionTask)) {
90 151
             throw new CommonException("联合检查-联合检查任务不存在,id值为:{}", id);
91 152
         }
92 153
         return lesJointInspectionTask;
93 154
     }
155
+
156
+    // 新增关联主表数据
157
+    private void insertChild(LesJointInspectionTask lesJointInspectionTask) {
158
+        lesJointInspectionTask.getItems().forEach(item -> {
159
+            item.setLesJointInspectionTaskId(lesJointInspectionTask.getId());
160
+            // 保存子表关联数据
161
+            lesJointInspectionTaskItemMapper.insert(item);
162
+        });
163
+    }
164
+
165
+    // 删除关联主表数据
166
+    private void deleteChild(String lesJointInspectionTaskId) {
167
+        lesJointInspectionTaskItemMapper.delete(this.queryObject(lesJointInspectionTaskId));
168
+    }
169
+
170
+    // 条件对象
171
+    private QueryWrapper<LesJointInspectionTaskItem> queryObject(String lesJointInspectionTaskId) {
172
+        QueryWrapper<LesJointInspectionTaskItem> wrapper = new QueryWrapper<>();
173
+        wrapper.lambda().eq(LesJointInspectionTaskItem::getLesJointInspectionTaskId, lesJointInspectionTaskId);
174
+        return wrapper;
175
+    }
176
+
177
+    // 流程
178
+    private void audit(LesJointInspectionTask lesJointInspectionTask) {
179
+        // 状态 0:保存状态;1:发布(申请中);2:审核通过;3:驳回
180
+        Integer status = lesJointInspectionTask.getStatus();
181
+        if (1 == status) {
182
+            // 添加审批(状态 0:待审核;1:已审核;2:驳回)
183
+            AuditRequest request = this.addAuditRequest(lesJointInspectionTask);
184
+            // 添加审批流程记录
185
+            this.addAuditRecord(lesJointInspectionTask, request.getId(), 0);
186
+        } else if (2 == status) {
187
+            this.editAuditRequest(lesJointInspectionTask, 1);
188
+        } else if (3 == status) {
189
+            this.editAuditRequest(lesJointInspectionTask, 2);
190
+        }
191
+    }
192
+
193
+    // 新增流程主表关联数据
194
+    private AuditRequest addAuditRequest(LesJointInspectionTask lesJointInspectionTask) {
195
+        AuditRequest request = new AuditRequest();
196
+        request.setType(12);
197
+        request.setStep(12);
198
+        request.setRequestId(lesJointInspectionTask.getId());
199
+        // 状态 0:待审核;1:已审核;2:驳回
200
+        request.setAuditStatus(0);
201
+        request.setAuditAdvice(lesJointInspectionTask.getAuditAdvice());
202
+        request.setAuditUserId(lesJointInspectionTask.getAuditUserId());
203
+        auditRequestMapper.insert(request);
204
+        return request;
205
+    }
206
+
207
+    // 增加一条流程记录
208
+    private void addAuditRecord(LesJointInspectionTask lesJointInspectionTask, String requestId, Integer status) {
209
+        AuditRecord record = new AuditRecord();
210
+        record.setAuditRequestId(requestId);
211
+        record.setType(12);
212
+        record.setStep(12);
213
+        record.setRequestId(lesJointInspectionTask.getId());
214
+        // 状态 0:待审核;1:已审核;2:驳回
215
+        record.setAuditStatus(status);
216
+        record.setAuditAdvice(lesJointInspectionTask.getAuditAdvice());
217
+        record.setAuditUserId(lesJointInspectionTask.getAuditUserId());
218
+        auditRecordMapper.insert(record);
219
+    }
220
+
221
+    // 更新流程主表关联数据
222
+    private void editAuditRequest(LesJointInspectionTask lesJointInspectionTask, Integer status) {
223
+        QueryWrapper<AuditRequest> wrapper = new QueryWrapper<>();
224
+        wrapper.lambda().eq(AuditRequest::getRequestId, lesJointInspectionTask.getId());
225
+        AuditRequest request = new AuditRequest();
226
+        // 状态 0:待审核;1:已审核;2:驳回
227
+        request.setAuditStatus(status);
228
+        request.setAuditAdvice(lesJointInspectionTask.getAuditAdvice());
229
+        request.setAuditUserId(lesJointInspectionTask.getAuditUserId());
230
+        auditRequestMapper.update(request, wrapper);
231
+
232
+        // 新增流程记录
233
+        this.addAuditRecord(lesJointInspectionTask, lesJointInspectionTask.getId(), status);
234
+    }
94 235
 }

+ 26 - 12
unis-plugin/unis-plugin-biz/src/main/java/com/unis/lawEnforcementSupervision/modular/lesJointInspectionTaskItem/controller/LesJointInspectionTaskItemController.java

@@ -9,7 +9,8 @@
9 9
  * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10 10
  * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11 11
  * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
- */
12
+ *//*
13
+
13 14
 package com.unis.lawEnforcementSupervision.modular.lesJointInspectionTaskItem.controller;
14 15
 
15 16
 import cn.dev33.satoken.annotation.SaCheckPermission;
@@ -37,12 +38,14 @@ import javax.annotation.Resource;
37 38
 import javax.validation.Valid;
38 39
 import javax.validation.constraints.NotEmpty;
39 40
 
41
+*/
40 42
 /**
41 43
  * 联合检查任务-检查项控制器
42 44
  *
43 45
  * @author QSHan
44 46
  * @date  2024/06/25 17:15
45
- */
47
+ *//*
48
+
46 49
 @Api(tags = "联合检查任务-检查项控制器")
47 50
 @ApiSupport(author = "UNIS_TEAM", order = 1)
48 51
 @RestController
@@ -52,12 +55,14 @@ public class LesJointInspectionTaskItemController {
52 55
     @Resource
53 56
     private LesJointInspectionTaskItemService lesJointInspectionTaskItemService;
54 57
 
55
-    /**
58
+    */
59
+/**
56 60
      * 获取联合检查任务-检查项分页
57 61
      *
58 62
      * @author QSHan
59 63
      * @date  2024/06/25 17:15
60
-     */
64
+     *//*
65
+
61 66
     @ApiOperationSupport(order = 1)
62 67
     @ApiOperation("获取联合检查任务-检查项分页")
63 68
     @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTaskItem/page")
@@ -66,12 +71,14 @@ public class LesJointInspectionTaskItemController {
66 71
         return CommonResult.data(lesJointInspectionTaskItemService.page(lesJointInspectionTaskItemPageParam));
67 72
     }
68 73
 
69
-    /**
74
+    */
75
+/**
70 76
      * 添加联合检查任务-检查项
71 77
      *
72 78
      * @author QSHan
73 79
      * @date  2024/06/25 17:15
74
-     */
80
+     *//*
81
+
75 82
     @ApiOperationSupport(order = 2)
76 83
     @ApiOperation("添加联合检查任务-检查项")
77 84
     @CommonLog("添加联合检查任务-检查项")
@@ -82,12 +89,14 @@ public class LesJointInspectionTaskItemController {
82 89
         return CommonResult.ok();
83 90
     }
84 91
 
85
-    /**
92
+    */
93
+/**
86 94
      * 编辑联合检查任务-检查项
87 95
      *
88 96
      * @author QSHan
89 97
      * @date  2024/06/25 17:15
90
-     */
98
+     *//*
99
+
91 100
     @ApiOperationSupport(order = 3)
92 101
     @ApiOperation("编辑联合检查任务-检查项")
93 102
     @CommonLog("编辑联合检查任务-检查项")
@@ -98,12 +107,14 @@ public class LesJointInspectionTaskItemController {
98 107
         return CommonResult.ok();
99 108
     }
100 109
 
101
-    /**
110
+    */
111
+/**
102 112
      * 删除联合检查任务-检查项
103 113
      *
104 114
      * @author QSHan
105 115
      * @date  2024/06/25 17:15
106
-     */
116
+     *//*
117
+
107 118
     @ApiOperationSupport(order = 4)
108 119
     @ApiOperation("删除联合检查任务-检查项")
109 120
     @CommonLog("删除联合检查任务-检查项")
@@ -115,12 +126,14 @@ public class LesJointInspectionTaskItemController {
115 126
         return CommonResult.ok();
116 127
     }
117 128
 
118
-    /**
129
+    */
130
+/**
119 131
      * 获取联合检查任务-检查项详情
120 132
      *
121 133
      * @author QSHan
122 134
      * @date  2024/06/25 17:15
123
-     */
135
+     *//*
136
+
124 137
     @ApiOperationSupport(order = 5)
125 138
     @ApiOperation("获取联合检查任务-检查项详情")
126 139
     @SaCheckPermission("/lawEnforcementSupervision/lesJointInspectionTaskItem/detail")
@@ -129,3 +142,4 @@ public class LesJointInspectionTaskItemController {
129 142
         return CommonResult.data(lesJointInspectionTaskItemService.detail(lesJointInspectionTaskItemIdParam));
130 143
     }
131 144
 }
145
+*/