Browse Source

数采仪列表 事后审核控制

zjs 1 day ago
parent
commit
59824d66a5

+ 68 - 3
src/main/java/com/cn/esermis/controller/PostMarkingController.java

@@ -4,13 +4,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.cn.esermis.dpld.entity.PostMarking;
7
+import com.cn.esermis.dpld.mapper.DataAcquisitionInstrumentMapper;
7 8
 import com.cn.esermis.dpld.model.PostMarkingVo;
9
+import com.cn.esermis.dpld.service.IDataAcquisitionInstrumentService;
8 10
 import com.cn.esermis.dpld.service.IPostMarkingService;
11
+import com.cn.esermis.model.BaseUser;
12
+import com.cn.esermis.utils.TokenUtils;
13
+import org.springframework.beans.BeanUtils;
9 14
 import org.springframework.web.bind.annotation.*;
10 15
 
11 16
 import javax.annotation.Resource;
17
+import javax.servlet.http.HttpServletRequest;
12 18
 
19
+import java.util.ArrayList;
20
+import java.util.List;
21
+import java.util.Map;
22
+
23
+import static com.cn.esermis.dpld.model.AjaxResult.error;
13 24
 import static com.cn.esermis.dpld.model.AjaxResult.success;
25
+import static com.cn.esermis.utils.TokenUtils.extractToken;
14 26
 
15 27
 /**
16 28
  * 事后标记
@@ -21,17 +33,63 @@ public class PostMarkingController
21 33
 {
22 34
     @Resource
23 35
     private IPostMarkingService postMarkingService;
24
-
36
+    @Resource
37
+    private IDataAcquisitionInstrumentService dataAcquisitionInstrumentService;
38
+    @Resource
39
+    private DataAcquisitionInstrumentMapper dataAcquisitionInstrumentMapper;
25 40
     /**
26 41
      * 分页查询列表
27 42
      * @param vo
28 43
      * @return
29 44
      */
30 45
     @GetMapping("/list")
31
-    public Object list(PostMarkingVo vo)
46
+    public Object list(PostMarkingVo vo, HttpServletRequest request)
32 47
     {
33 48
         IPage<PostMarking> page = new Page<>(vo.getPageNum(), vo.getPageSize());
34
-        return success(postMarkingService.page(page,new QueryWrapper<>()));
49
+        BaseUser userInfo = TokenUtils.getUserInfo(extractToken(request));
50
+        QueryWrapper<PostMarking> objectQueryWrapper = new QueryWrapper<>();
51
+        String verifyCompany = dataAcquisitionInstrumentMapper.verifyCompany(userInfo.getCompanyId());
52
+//        if (vo.getCompanyName() != null) {
53
+            String companyId = userInfo.getCompanyId();
54
+            if (verifyCompany != null && verifyCompany.length() < 5) {
55
+                List<String> companyCodes = dataAcquisitionInstrumentService.getComponyListAll(vo.getCompanyName());
56
+                if (!companyCodes.isEmpty()) {
57
+                    objectQueryWrapper.in("company_code", companyCodes);
58
+                }
59
+            }else{
60
+                List<String> companyCodes = dataAcquisitionInstrumentService.getComponyList(vo.getCompanyName(), companyId);
61
+                if (!companyCodes.isEmpty()) {
62
+                    objectQueryWrapper.in("company_code", companyCodes);
63
+                }
64
+            }
65
+//        }
66
+        IPage<PostMarking> rpage = postMarkingService.page(page, new QueryWrapper<>());
67
+        IPage<PostMarkingVo> voIPage = new Page<>();
68
+        List<PostMarking> records = rpage.getRecords();
69
+        List<PostMarkingVo> recordsvo = new ArrayList<>();
70
+        // 查询企业
71
+        Map<String, Object> componyMap = dataAcquisitionInstrumentService.getComponyMap();
72
+        // 查询工厂
73
+        Map<String, Object> departmentMap = dataAcquisitionInstrumentService.getDepartmentMap();
74
+        records.forEach(x->{
75
+            PostMarkingVo postMarkingVo = new PostMarkingVo();
76
+            BeanUtils.copyProperties(x, postMarkingVo);
77
+            if (postMarkingVo.getCompanyCode() != null && componyMap.get(postMarkingVo.getCompanyCode()) != null) {
78
+                Map componyMapobj = (Map) componyMap.get(postMarkingVo.getCompanyCode());
79
+                postMarkingVo.setCompanyName(componyMapobj.get("companylongname").toString());
80
+            }
81
+            if (postMarkingVo.getDepartmentCode() != null && departmentMap.get(postMarkingVo.getDepartmentCode()) != null) {
82
+                Map componyMapobj = (Map) departmentMap.get(postMarkingVo.getDepartmentCode());
83
+                postMarkingVo.setDepartmentName(componyMapobj.get("departmentname").toString());
84
+            }
85
+            recordsvo.add(postMarkingVo);
86
+        });
87
+        voIPage.setRecords(recordsvo);
88
+        voIPage.setCurrent(rpage.getCurrent());
89
+        voIPage.setSize(rpage.getSize());
90
+        voIPage.setTotal(rpage.getTotal());
91
+        voIPage.setPages(rpage.getPages());
92
+        return success(voIPage);
35 93
     }
36 94
 
37 95
     /**
@@ -67,6 +125,13 @@ public class PostMarkingController
67 125
     @PostMapping("/edit")
68 126
     public Object edit(@RequestBody PostMarking postMarking)
69 127
     {
128
+        // 审核流程控制
129
+        if (postMarking.getVerificationStatus() !=null && postMarking.getReasonClassification()!=null){
130
+            postMarking.setUnitType(1);
131
+        }
132
+        if (postMarking.getUnitType() == 3){
133
+            return error("请填写驳回原因。");
134
+        }
70 135
         postMarkingService.updateById(postMarking);
71 136
         return success();
72 137
     }

+ 4 - 0
src/main/java/com/cn/esermis/dpld/entity/PostMarking.java

@@ -79,5 +79,9 @@ public class PostMarking {
79 79
     private String companyCode;
80 80
     @TableField(value = "department_code")
81 81
     private String departmentCode;
82
+    @TableField(value = "unit_type")
83
+    private Integer unitType;
84
+    @TableField(value = "unit_opinion")
85
+    private String unitOpinion;
82 86
 
83 87
 }

+ 11 - 0
src/main/java/com/cn/esermis/dpld/model/PostMarkingVo.java

@@ -1,5 +1,6 @@
1 1
 package com.cn.esermis.dpld.model;
2 2
 
3
+import com.baomidou.mybatisplus.annotation.TableField;
3 4
 import com.cn.esermis.dpld.entity.PostMarking;
4 5
 import lombok.Data;
5 6
 
@@ -15,4 +16,14 @@ public class PostMarkingVo extends PostMarking {
15 16
      */
16 17
     private Integer pageSize;
17 18
 
19
+    /**
20
+     * 公司名称
21
+     */
22
+    private String companyName;
23
+
24
+    /**
25
+     * 工厂名称
26
+     */
27
+    private String departmentName;
28
+
18 29
 }