|
@@ -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
|
}
|