Bläddra i källkod

数采仪列表的需求完成

zjs 2 dagar sedan
förälder
incheckning
740bd14a83

+ 128 - 0
src/main/java/com/cn/esermis/coding/PollutionWater.java

@@ -0,0 +1,128 @@
1
+package com.cn.esermis.coding;
2
+
3
+
4
+import com.cn.esermis.CodeMean;
5
+
6
+/**
7
+ * Created by xiaoyao9184 on 2018/3/26.
8
+ */
9
+public enum PollutionWater implements CodeMean {
10
+
11
+    w00000("污水","B01","升/秒","立方米","N5.2"),
12
+    w01001("pH值","001","无量纲","N2.2"),
13
+    w01002("色度","002","[色]度","N3.2"),
14
+    w01006("溶解性总固体","--","毫克/升","千克","N4"),
15
+    w01009("溶解氧","--","毫克/升","N3.1"),
16
+    w01010("水温","--","摄氏度","N3.1"),
17
+    w01012("悬浮物","003","毫克/升","千克","N4"),
18
+    w01014("电导率","--","微西[门子]/厘米","N3.1"),
19
+    w01017("五日生化需氧量","010","毫克/升","千克","N5.1"),
20
+    w01018("化学需氧量","011","毫克/升","千克","N5.1"),
21
+    w01019("高锰酸盐指数","--","毫克/升","千克","N3.1"),
22
+    w01020("总有机碳","015","毫克/升","千克","N3.1"),
23
+    w02003("粪大肠菌群","550","个/升","N9"),
24
+    w02006("细菌总数","--","个/升","N9"),
25
+    w03001("总α放射性","570","贝可[勒尔]/升","N3.1"),
26
+    w03002("总β放射性","571","贝可[勒尔]/升","N3.1"),
27
+    w19001("表面活性剂","--","毫克/升","千克","N3.2"),
28
+    w19002("阴离子表面活性剂","520","毫克/升","千克","N3.2"),
29
+    w20012("钡","039","毫克/升","千克","N3.3"),
30
+    w20023("硼","037","毫克/升","千克","N3.3"),
31
+    w20038("钴","040","毫克/升","千克","N3.4"),
32
+    w20061("钼","038","毫克/升","千克","N3.4"),
33
+    w20089("铊","041","纳克/升","毫克","N4"),
34
+    w20092("锡","036","毫克/升","千克","N3.1"),
35
+    w20111("总汞","020","微克/升","克","N3.2"),
36
+    w20113("烷基汞","021","纳克/升","毫克","N4"),
37
+    w20115("总镉","022","微克/升","克","N3.1"),
38
+    w20116("总铬","023","毫克/升","千克","N3.3"),
39
+    w20117("六价铬","024","微克/升","克","N2.3"),
40
+    w20119("总砷","026","微克/升","克","N2.3"),
41
+    w20120("总铅","027","微克/升","克","N4"),
42
+    w20121("总镍","028","毫克/升","千克","N3.2"),
43
+    w20122("总铜","029","毫克/升","千克","N3.2"),
44
+    w20123("总锌","030","毫克/升","千克","N3.3"),
45
+    w20124("总锰","031","毫克/升","千克","N3.3"),
46
+    w20125("总铁","032","毫克/升","千克","N3.3"),
47
+    w20126("总银","033","毫克/升","千克","N3.3"),
48
+    w20127("总铍","034","微克/升","克","N3.3"),
49
+    w20128("总硒","035","微克/升","克","N4.2"),
50
+    w20138("铜","毫克/升","千克","N3.3"),
51
+    w20139("锌","毫克/升","千克","N3.3"),
52
+    w20140("硒","毫克/升","千克","N3.3"),
53
+    w20141("砷","毫克/升","千克","N3.3"),
54
+    w20142("汞","微克/升","克","N3.3"),
55
+    w20143("镉","微克/升","克","N3.3"),
56
+    w20144("铅","毫克/升","千克","N3.3"),
57
+    w21001("总氮","065","毫克/升","千克","N4.2"),
58
+    w21003("氨氮","060","毫克/升","千克","N4.2"),
59
+    w21004("凯氏氮","062","毫克/升","千克","N3.1"),
60
+    w21006("亚硝酸盐","063","毫克/升","千克","N2.3"),
61
+    w21007("硝酸盐","064","毫克/升","千克","N2.3"),
62
+    w21011("总磷","101","毫克/升","千克","N3.2"),
63
+    w21016("氰化物","070","毫克/升","千克","N3.3"),
64
+    w21017("氟化物","072","毫克/升","千克","N4.2"),
65
+    w21019("硫化物","071","毫克/升","千克","N3.3"),
66
+    w21022("氯化物","090","毫克/升","千克","N3.1"),
67
+    w21038("硫酸盐","--","毫克/升","千克","N6"),
68
+    w22001("石油类","080","毫克/升","千克","N3.2"),
69
+    w23002("挥发酚","110","毫克/升","千克","N3.4"),
70
+    w25043("苯并[α]芘","540","微克/升","克","N3.1"),
71
+    w33001("六六六","350","纳克/升","毫克","N4"),
72
+    w33007("滴滴涕","351","纳克/升","毫克","N4"),
73
+    w99001("有机氮","061","毫克/升","千克","N3.1")
74
+    ;
75
+
76
+    private String code;
77
+    private String meaning;
78
+    private String oldCode;
79
+    private String chromaUnit;
80
+    private String amountUnit;
81
+    private String type;
82
+
83
+    PollutionWater(String meaning, String chromaUnit, String amountUnit, String type){
84
+        this.code = name();
85
+        this.meaning = meaning;
86
+        this.oldCode = "--";
87
+        this.chromaUnit = chromaUnit;
88
+        this.amountUnit = amountUnit;
89
+        this.type = type;
90
+    }
91
+
92
+    PollutionWater(String meaning, String oldCode, String chromaUnit, String amountUnit, String type){
93
+        this.code = name();
94
+        this.meaning = meaning;
95
+        this.oldCode = oldCode;
96
+        this.chromaUnit = chromaUnit;
97
+        this.amountUnit = amountUnit;
98
+        this.type = type;
99
+    }
100
+
101
+    @Override
102
+    public String code() {
103
+        return code;
104
+    }
105
+
106
+    @Override
107
+    public String mean() {
108
+        return meaning;
109
+    }
110
+
111
+
112
+    public String oldCode() {
113
+        return oldCode;
114
+    }
115
+    public String chromaUnit() {
116
+        return chromaUnit;
117
+    }
118
+    public String amountUnit() {
119
+        return amountUnit;
120
+    }
121
+
122
+    public String unit() {
123
+        return chromaUnit + " " + amountUnit;
124
+    }
125
+    public String type() {
126
+        return type;
127
+    }
128
+}

+ 56 - 0
src/main/java/com/cn/esermis/config/BizException.java

@@ -0,0 +1,56 @@
1
+package com.cn.esermis.config;
2
+
3
+
4
+import lombok.Getter;
5
+
6
+@Getter
7
+public class BizException extends RuntimeException {
8
+
9
+    private static final long serialVersionUID = 1L;
10
+
11
+
12
+    protected String errorCode;
13
+
14
+    protected String errorMsg;
15
+
16
+    public BizException() {
17
+        super();
18
+    }
19
+
20
+    public BizException(String errorMsg) {
21
+        super(errorMsg);
22
+        this.errorMsg = errorMsg;
23
+    }
24
+
25
+    public BizException(String errorCode, String errorMsg) {
26
+        super(errorCode);
27
+        this.errorCode = errorCode;
28
+        this.errorMsg = errorMsg;
29
+    }
30
+
31
+    public BizException(String errorCode, String errorMsg, Throwable cause) {
32
+        super(errorCode, cause);
33
+        this.errorCode = errorCode;
34
+        this.errorMsg = errorMsg;
35
+    }
36
+
37
+
38
+    public void setErrorCode(String errorCode) {
39
+        this.errorCode = errorCode;
40
+    }
41
+
42
+    public void setErrorMsg(String errorMsg) {
43
+        this.errorMsg = errorMsg;
44
+    }
45
+
46
+    public String getMessage() {
47
+        return errorMsg;
48
+    }
49
+
50
+    @Override
51
+    public Throwable fillInStackTrace() {
52
+        return this;
53
+    }
54
+
55
+}
56
+

+ 18 - 0
src/main/java/com/cn/esermis/config/GlobalExceptionHandler.java

@@ -0,0 +1,18 @@
1
+package com.cn.esermis.config;
2
+
3
+import com.cn.esermis.dpld.model.AjaxResult;
4
+import org.springframework.http.HttpStatus;
5
+import org.springframework.http.ResponseEntity;
6
+import org.springframework.web.bind.annotation.ControllerAdvice;
7
+import org.springframework.web.bind.annotation.ExceptionHandler;
8
+
9
+@ControllerAdvice
10
+public class GlobalExceptionHandler {
11
+
12
+    @ExceptionHandler(BizException.class)
13
+    public ResponseEntity<AjaxResult> handleException(BizException e) {
14
+
15
+        AjaxResult error = AjaxResult.error(Integer.parseInt(e.getErrorCode()), e.getErrorMsg());
16
+        return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(error);
17
+    }
18
+}

+ 6 - 5
src/main/java/com/cn/esermis/config/MyInterceptor.java

@@ -29,20 +29,21 @@ public class MyInterceptor  implements HandlerInterceptor  {
29 29
             BaseUser userInfo = TokenUtils.getUserInfo(token);
30 30
             if (userInfo != null){
31 31
                 // 查询数据库是否有 公司和工厂信息
32
-                Boolean verifyCompany = dataAcquisitionInstrumentMapper.verifyCompany(userInfo.getCompanyId());
32
+                String verifyCompany = dataAcquisitionInstrumentMapper.verifyCompany(userInfo.getCompanyId());
33 33
 //                Boolean verifydepartmen = dataAcquisitionInstrumentMapper.verifydepartmen(userInfo.getFactoryId());
34
-                if (verifyCompany){
34
+                if (verifyCompany!=null){
35 35
                     // 将用户信息设置到请求属性中,便于后续使用
36
+                    userInfo.setLevelid(verifyCompany);
36 37
                     request.setAttribute("userInfo", JSON.toJSONString(userInfo));
37 38
                     return true;
38 39
                 }else {
39
-                    throw new RuntimeException("用户无权限!");
40
+                    throw new BizException("403","用户无权限!");
40 41
                 }
41 42
             }else{
42
-                throw new RuntimeException("token解析失败!");
43
+                throw new BizException("403","token解析失败!");
43 44
             }
44 45
         }else {
45
-            throw new RuntimeException("token为空!");
46
+            throw new BizException("403","token为空!");
46 47
         }
47 48
 
48 49
     }

+ 75 - 60
src/main/java/com/cn/esermis/controller/DataAcquisitionInstrumentController.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 8
 import com.cn.esermis.dpld.entity.AnalyticalInstruments;
9 9
 import com.cn.esermis.dpld.entity.DataAcquisitionInstrument;
10 10
 import com.cn.esermis.dpld.entity.DetectMonitoringFactor;
11
+import com.cn.esermis.dpld.mapper.DataAcquisitionInstrumentMapper;
11 12
 import com.cn.esermis.dpld.model.AjaxResult;
12 13
 import com.cn.esermis.dpld.model.AnalyticalInstrumentsVo;
13 14
 import com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo;
@@ -42,52 +43,72 @@ public class DataAcquisitionInstrumentController {
42 43
     private IDetectMonitoringFactorService detectMonitoringFactorService;
43 44
     @Resource
44 45
     private IDataAcquisitionInstrumentService dataAcquisitionInstrumentService;
46
+    @Resource
47
+    private   DataAcquisitionInstrumentMapper dataAcquisitionInstrumentMapper;
45 48
     @Autowired
46 49
     private RedisTemplate<String, Object> redisTemplate;
50
+
47 51
     /**
48 52
      * 获取数采仪信息表
49 53
      */
50 54
     @GetMapping("/list")
51
-    public AjaxResult list(DataAcquisitionInstrumentVo vo, HttpServletRequest request)
52
-    {
55
+    public AjaxResult list(DataAcquisitionInstrumentVo vo, HttpServletRequest request) {
53 56
         IPage<DataAcquisitionInstrument> page = new Page<>(vo.getPageNum(), vo.getPageSize());
54 57
         QueryWrapper<DataAcquisitionInstrument> wrapper = new QueryWrapper<>();
55 58
         BaseUser userInfo = TokenUtils.getUserInfo(extractToken(request));
56
-//        wrapper.eq("company_code",userInfo.getCompanyId());
59
+        String verifyCompany = dataAcquisitionInstrumentMapper.verifyCompany(userInfo.getCompanyId());
60
+        if (vo.getCompanyName() != null) {
61
+            String companyId = userInfo.getCompanyId();
62
+            if (verifyCompany != null && verifyCompany.length() < 5) {
63
+                List<String> companyCodes = dataAcquisitionInstrumentService.getComponyListAll(vo.getCompanyName());
64
+                if (!companyCodes.isEmpty()) {
65
+                    wrapper.in("company_code", companyCodes);
66
+                }
67
+            }else{
68
+                List<String> companyCodes = dataAcquisitionInstrumentService.getComponyList(vo.getCompanyName(), companyId);
69
+                if (!companyCodes.isEmpty()) {
70
+                    wrapper.in("company_code", companyCodes);
71
+                }
72
+            }
73
+        }
74
+        if (vo.getOutletName() != null) {
75
+            wrapper.like("outlet_name", vo.getOutletName());
76
+        }
57 77
         wrapper.orderByDesc("department_code");
58 78
         IPage<DataAcquisitionInstrument> pageList = dataAcquisitionInstrumentService.page(page, wrapper);
59 79
         IPage<DataAcquisitionInstrumentVo> volits = new Page<>();
60
-        if (!pageList.getRecords().isEmpty()){
80
+        if (!pageList.getRecords().isEmpty()) {
61 81
             volits.setTotal(pageList.getTotal());
62 82
             volits.setCurrent(pageList.getCurrent());
63 83
             volits.setSize(pageList.getSize());
64 84
             List<DataAcquisitionInstrument> records = pageList.getRecords();
65 85
             List<DataAcquisitionInstrumentVo> revoList = new ArrayList<>();
66 86
             // 查询企业
67
-            Map<String,Object> componyMap =  dataAcquisitionInstrumentService.getComponyMap();
87
+            Map<String, Object> componyMap = dataAcquisitionInstrumentService.getComponyMap();
68 88
             // 查询工厂
69 89
             Map<String, Object> departmentMap = dataAcquisitionInstrumentService.getDepartmentMap();
70
-            records.forEach(x->{
90
+            records.forEach(x -> {
71 91
                 DataAcquisitionInstrumentVo instrumentVo = new DataAcquisitionInstrumentVo();
72 92
                 List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(x.getId());
73 93
                 BeanUtils.copyProperties(x, instrumentVo);
74
-                if (instrumentVo.getCompanyCode()!=null  && componyMap.get(instrumentVo.getCompanyCode())!=null){
75
-                    Map componyMapobj = (Map)componyMap.get(instrumentVo.getCompanyCode());
94
+                if (instrumentVo.getCompanyCode() != null && componyMap.get(instrumentVo.getCompanyCode()) != null) {
95
+                    Map componyMapobj = (Map) componyMap.get(instrumentVo.getCompanyCode());
76 96
                     instrumentVo.setCompanyName(componyMapobj.get("companylongname").toString());
77 97
                 }
78
-                if (instrumentVo.getDepartmentCode()!=null && departmentMap.get(instrumentVo.getDepartmentCode())!=null){
79
-                    Map componyMapobj = (Map)departmentMap.get(instrumentVo.getDepartmentCode());
98
+                if (instrumentVo.getDepartmentCode() != null && departmentMap.get(instrumentVo.getDepartmentCode()) != null) {
99
+                    Map componyMapobj = (Map) departmentMap.get(instrumentVo.getDepartmentCode());
80 100
                     instrumentVo.setDepartmentName(componyMapobj.get("departmentname").toString());
81
-                };
82
-                if (!analyticalInstruments.isEmpty()){
101
+                }
102
+                ;
103
+                if (!analyticalInstruments.isEmpty()) {
83 104
                     List<AnalyticalInstrumentsVo> analyticalInstrumentList = new ArrayList<>();
84
-                    analyticalInstruments.forEach(y->{
105
+                    analyticalInstruments.forEach(y -> {
85 106
                         AnalyticalInstrumentsVo analyticalInstrumentsVo = new AnalyticalInstrumentsVo();
86 107
                         BeanUtils.copyProperties(y, analyticalInstrumentsVo);
87 108
                         analyticalInstrumentList.add(analyticalInstrumentsVo);
88 109
                         List<DetectMonitoringFactor> analyticalInstrumentId = detectMonitoringFactorService.listByParentId(y.getId());
89
-                        if (!analyticalInstrumentId.isEmpty()){
90
-                            analyticalInstrumentId.forEach(z->{
110
+                        if (!analyticalInstrumentId.isEmpty()) {
111
+                            analyticalInstrumentId.forEach(z -> {
91 112
                                 analyticalInstrumentsVo.getDetectMonitoringFactors().add(z);
92 113
                             });
93 114
                         }
@@ -107,21 +128,20 @@ public class DataAcquisitionInstrumentController {
107 128
      * 根据菜单编号获取详细信息
108 129
      */
109 130
     @GetMapping(value = "delete/{id}")
110
-    public AjaxResult delete(@PathVariable String id)
111
-    {
131
+    public AjaxResult delete(@PathVariable String id) {
112 132
         DataAcquisitionInstrument dataAcquisitionInstrument = dataAcquisitionInstrumentService.getById(id);
113 133
         DataAcquisitionInstrumentVo instrumentVo = new DataAcquisitionInstrumentVo();
114
-        if (dataAcquisitionInstrument != null){
134
+        if (dataAcquisitionInstrument != null) {
115 135
             BeanUtils.copyProperties(dataAcquisitionInstrument, instrumentVo);
116 136
             List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(dataAcquisitionInstrument.getId());
117
-            if (!analyticalInstruments.isEmpty()){
137
+            if (!analyticalInstruments.isEmpty()) {
118 138
                 List<AnalyticalInstrumentsVo> analyticalInstrumentList = new ArrayList<>();
119
-                analyticalInstruments.forEach(y->{
139
+                analyticalInstruments.forEach(y -> {
120 140
                     if (y.getId() != null)
121
-                    detectMonitoringFactorService.remove(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
141
+                        detectMonitoringFactorService.remove(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
122 142
                 });
123 143
                 if (analyticalInstruments.isEmpty())
124
-                analyticalInstrumentsService.remove(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
144
+                    analyticalInstrumentsService.remove(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
125 145
                 instrumentVo.setAnalyticalInstruments(analyticalInstrumentList);
126 146
             }
127 147
         }
@@ -135,27 +155,26 @@ public class DataAcquisitionInstrumentController {
135 155
      * 根据菜单编号获取详细信息
136 156
      */
137 157
     @GetMapping(value = "/{id}")
138
-    public AjaxResult getInfo(@PathVariable String id)
139
-    {
158
+    public AjaxResult getInfo(@PathVariable String id) {
140 159
         DataAcquisitionInstrument dataAcquisitionInstrument = dataAcquisitionInstrumentService.getById(id);
141 160
         DataAcquisitionInstrumentVo instrumentVo = new DataAcquisitionInstrumentVo();
142
-        if (dataAcquisitionInstrument != null){
161
+        if (dataAcquisitionInstrument != null) {
143 162
             BeanUtils.copyProperties(dataAcquisitionInstrument, instrumentVo);
144 163
             List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(dataAcquisitionInstrument.getId());
145
-            if (!analyticalInstruments.isEmpty()){
164
+            if (!analyticalInstruments.isEmpty()) {
146 165
                 List<AnalyticalInstrumentsVo> analyticalInstrumentList = new ArrayList<>();
147
-                analyticalInstruments.forEach(x->{
148
-                        AnalyticalInstrumentsVo analyticalInstrumentsVo = new AnalyticalInstrumentsVo();
149
-                        BeanUtils.copyProperties(x, analyticalInstrumentsVo);
166
+                analyticalInstruments.forEach(x -> {
167
+                    AnalyticalInstrumentsVo analyticalInstrumentsVo = new AnalyticalInstrumentsVo();
168
+                    BeanUtils.copyProperties(x, analyticalInstrumentsVo);
150 169
 
151
-                        List<DetectMonitoringFactor> analyticalInstrumentId = detectMonitoringFactorService.listByParentId(x.getId());
152
-                        if (!analyticalInstrumentId.isEmpty()){
153
-                            analyticalInstrumentId.forEach(z->{
154
-                                analyticalInstrumentsVo.getDetectMonitoringFactors().add(z);
155
-                            });
156
-                        }
157
-                        analyticalInstrumentList.add(analyticalInstrumentsVo);
158
-                    });
170
+                    List<DetectMonitoringFactor> analyticalInstrumentId = detectMonitoringFactorService.listByParentId(x.getId());
171
+                    if (!analyticalInstrumentId.isEmpty()) {
172
+                        analyticalInstrumentId.forEach(z -> {
173
+                            analyticalInstrumentsVo.getDetectMonitoringFactors().add(z);
174
+                        });
175
+                    }
176
+                    analyticalInstrumentList.add(analyticalInstrumentsVo);
177
+                });
159 178
                 instrumentVo.setAnalyticalInstruments(analyticalInstrumentList);
160 179
             }
161 180
         }
@@ -170,19 +189,18 @@ public class DataAcquisitionInstrumentController {
170 189
      */
171 190
     @PostMapping("/save")
172 191
     @Transactional
173
-    public AjaxResult save(@Validated @RequestBody DataAcquisitionInstrumentVo vo)
174
-    {
192
+    public AjaxResult save(@Validated @RequestBody DataAcquisitionInstrumentVo vo) {
175 193
         DataAcquisitionInstrument dataAcquisitionInstrument = new DataAcquisitionInstrument();
176 194
         BeanUtils.copyProperties(vo, dataAcquisitionInstrument);
177 195
         boolean save = dataAcquisitionInstrumentService.saveOrUpdate(dataAcquisitionInstrument);
178
-        if (save && vo.getAnalyticalInstruments()!=null){
196
+        if (save && vo.getAnalyticalInstruments() != null) {
179 197
             List<AnalyticalInstrumentsVo> analyticalInstrumentList = vo.getAnalyticalInstruments();
180 198
             // 删除子项 全删全增操作
181 199
             {
182
-                if (dataAcquisitionInstrument.getId() != null){
200
+                if (dataAcquisitionInstrument.getId() != null) {
183 201
                     List<AnalyticalInstruments> dataAcquisitionInstrumentId = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(dataAcquisitionInstrument.getId());
184
-                    if (!dataAcquisitionInstrumentId.isEmpty()){
185
-                        analyticalInstrumentList.forEach(y->{
202
+                    if (!dataAcquisitionInstrumentId.isEmpty()) {
203
+                        analyticalInstrumentList.forEach(y -> {
186 204
                             detectMonitoringFactorService.remove(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
187 205
                         });
188 206
                         analyticalInstrumentsService.remove(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
@@ -190,22 +208,22 @@ public class DataAcquisitionInstrumentController {
190 208
                 }
191 209
             }
192 210
             // 新增子表
193
-            analyticalInstrumentList.forEach(x->{
211
+            analyticalInstrumentList.forEach(x -> {
194 212
                 AnalyticalInstruments analyticalInstruments = new AnalyticalInstruments();
195 213
                 BeanUtils.copyProperties(x, analyticalInstruments);
196 214
                 analyticalInstruments.setDataAcquisitionInstrumentId(dataAcquisitionInstrument.getId());
197 215
                 boolean save1 = analyticalInstrumentsService.save(analyticalInstruments);
198
-                if (x.getDetectMonitoringFactors()!=null && save1){
216
+                if (x.getDetectMonitoringFactors() != null && save1) {
199 217
                     List<DetectMonitoringFactor> detectMonitoringFactors = x.getDetectMonitoringFactors();
200
-                    detectMonitoringFactors.forEach(y->{
218
+                    detectMonitoringFactors.forEach(y -> {
201 219
                         y.setAnalyticalInstrumentId(analyticalInstruments.getId());
202 220
                         y.setDataAcquisitionInstrumentId(dataAcquisitionInstrument.getId());
203 221
                         boolean save2 = detectMonitoringFactorService.save(y);
204
-                        if (!save2){
222
+                        if (!save2) {
205 223
                             throw new RuntimeException("添加失败");
206 224
                         }
207 225
                     });
208
-               }
226
+                }
209 227
             });
210 228
         }
211 229
         List<OutletAndFactorVo> selectlist = dataAcquisitionInstrumentService.selectlist();
@@ -214,39 +232,36 @@ public class DataAcquisitionInstrumentController {
214 232
     }
215 233
 
216 234
     @GetMapping(value = "getCompony")
217
-    public AjaxResult getCompony()
218
-    {
219
-        List<Map<String,Object>> list = dataAcquisitionInstrumentService.getCompony();
235
+    public AjaxResult getCompony() {
236
+        List<Map<String, Object>> list = dataAcquisitionInstrumentService.getCompony();
220 237
         return success(list);
221 238
     }
222 239
 
223 240
 
224 241
     /**
225 242
      * 部门
243
+     *
226 244
      * @return
227 245
      */
228 246
     @GetMapping(value = "getDepartment/{componyid}")
229
-    public AjaxResult getDepartment(@PathVariable String componyid)
230
-    {
231
-        List<Map<String,Object>> list = dataAcquisitionInstrumentService.getDepartment(componyid);
247
+    public AjaxResult getDepartment(@PathVariable String componyid) {
248
+        List<Map<String, Object>> list = dataAcquisitionInstrumentService.getDepartment(componyid);
232 249
         return success(list);
233 250
     }
234 251
 
235 252
 
236
-
237 253
     /**
238 254
      * 获取数采仪信息表
239 255
      */
240 256
     @GetMapping("/listByCode")
241
-    public AjaxResult listByCode(HttpServletRequest  request)
242
-    {
257
+    public AjaxResult listByCode(HttpServletRequest request) {
243 258
         QueryWrapper<DataAcquisitionInstrument> wrapper = new QueryWrapper<>();
244 259
         BaseUser userInfo = TokenUtils.getUserInfo(extractToken(request));
245
-        if (userInfo==null){
260
+        if (userInfo == null) {
246 261
             return error("无数据");
247 262
         }
248
-        wrapper.eq(userInfo.getCompanyId()!=null,"department_code", userInfo.getCompanyId());
249
-        wrapper.eq(userInfo.getFactoryId()!=null,"company_code", userInfo.getFactoryId());
263
+        wrapper.eq(userInfo.getCompanyId() != null, "department_code", userInfo.getCompanyId());
264
+        wrapper.eq(userInfo.getFactoryId() != null, "company_code", userInfo.getFactoryId());
250 265
 //        List<DataAcquisitionInstrument> dataAcquisitionInstruments = dataAcquisitionInstrumentService.listByCode(vo);
251 266
         List<DataAcquisitionInstrument> dataAcquisitionInstruments = dataAcquisitionInstrumentService.list(wrapper);
252 267
         return success(dataAcquisitionInstruments);

+ 1 - 1
src/main/java/com/cn/esermis/dpld/entity/AnalyticalInstruments.java

@@ -74,7 +74,7 @@ public class AnalyticalInstruments {
74 74
      * k值
75 75
      */
76 76
     @TableField(value = "k_value")
77
-    private String kValue;
77
+    private String kvalue;
78 78
     /**
79 79
      * 烟道(监测口)截面积 M3
80 80
      */

+ 6 - 1
src/main/java/com/cn/esermis/dpld/mapper/DataAcquisitionInstrumentMapper.java

@@ -6,6 +6,7 @@ import com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo;
6 6
 import com.cn.esermis.dpld.model.OutletAndFactorVo;
7 7
 import org.apache.ibatis.annotations.MapKey;
8 8
 import org.apache.ibatis.annotations.Mapper;
9
+import org.apache.ibatis.annotations.Param;
9 10
 
10 11
 import java.util.List;
11 12
 import java.util.Map;
@@ -29,5 +30,9 @@ public interface DataAcquisitionInstrumentMapper extends BaseMapper<DataAcquisit
29 30
 
30 31
     Boolean verifydepartmen(String factoryId);
31 32
 
32
-    Boolean verifyCompany(String companyId);
33
+    String verifyCompany(String companyId);
34
+
35
+    List<String> getComponyList(String companyName, String companyId);
36
+
37
+    List<String> getComponyListAll(@Param("companyName") String companyName);
33 38
 }

+ 4 - 1
src/main/java/com/cn/esermis/dpld/service/IDataAcquisitionInstrumentService.java

@@ -6,7 +6,6 @@ import com.cn.esermis.dpld.model.DataAcquisitionInstrumentVo;
6 6
 import com.cn.esermis.dpld.model.OutletAndFactorVo;
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
-import java.util.Collection;
10 9
 import java.util.List;
11 10
 import java.util.Map;
12 11
 
@@ -25,4 +24,8 @@ public interface IDataAcquisitionInstrumentService extends IService<DataAcquisit
25 24
     Map<String, Object> getDepartmentMap();
26 25
 
27 26
     List<DataAcquisitionInstrument> listByCode(DataAcquisitionInstrumentVo vo);
27
+
28
+    List<String> getComponyList(String companyName,String companyId);
29
+
30
+    List<String> getComponyListAll(String companyName);
28 31
 }

+ 10 - 2
src/main/java/com/cn/esermis/dpld/service/impl/DataAcquisitionInstrumentServiceImpl.java

@@ -1,6 +1,5 @@
1 1
 package com.cn.esermis.dpld.service.impl;
2 2
 
3
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 3
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 4
 import com.cn.esermis.dpld.entity.DataAcquisitionInstrument;
6 5
 import com.cn.esermis.dpld.mapper.DataAcquisitionInstrumentMapper;
@@ -10,7 +9,6 @@ import com.cn.esermis.dpld.service.IDataAcquisitionInstrumentService;
10 9
 import org.springframework.stereotype.Service;
11 10
 
12 11
 import javax.annotation.Resource;
13
-import java.util.Collection;
14 12
 import java.util.Collections;
15 13
 import java.util.List;
16 14
 import java.util.Map;
@@ -52,4 +50,14 @@ public class DataAcquisitionInstrumentServiceImpl extends ServiceImpl<DataAcquis
52 50
         List<DataAcquisitionInstrument> dataAcquisitionInstruments = mapper.listByCode(vo);
53 51
         return dataAcquisitionInstruments;
54 52
     }
53
+
54
+    @Override
55
+    public List<String> getComponyList(String companyName, String companyId) {
56
+        return mapper.getComponyList(companyName,companyId);
57
+    }
58
+
59
+    @Override
60
+    public List<String> getComponyListAll(String companyName) {
61
+        return mapper.getComponyListAll(companyName);
62
+    }
55 63
 }

+ 2 - 0
src/main/java/com/cn/esermis/model/BaseUser.java

@@ -12,6 +12,8 @@ public class BaseUser {
12 12
 
13 13
     private String factoryId;
14 14
 
15
+    private String levelid;
16
+
15 17
 
16 18
 
17 19
 }

+ 2 - 2
src/main/resources/static/mybatis/AnalyticalInstrumentsMapper.xml

@@ -4,14 +4,14 @@
4 4
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 5
 <mapper namespace="com.cn.esermis.dpld.mapper.AnalyticalInstrumentsMapper">
6 6
     <insert id="saveOb" parameterType="com.cn.esermis.dpld.entity.AnalyticalInstruments">
7
-        insert into analytical_instruments(id,brand,model,name,factorInfor,range,data_acquisition_instrument_id,reference_oxygen_content,velocity_field_coefficient,pitot_tube_coefficient,k_value,flue_area,dilution_ratio,type)
7
+        insert into analytical_instruments(id,brand,model,name,factorInfor,range_str,data_acquisition_instrument_id,reference_oxygen_content,velocity_field_coefficient,pitot_tube_coefficient,k_value,flue_area,dilution_ratio,type)
8 8
         values(#{id},#{brand},#{model},#{name},#{factorInfor},#{range},#{dataAcquisitionInstrumentId},#{referenceOxygenContent},#{velocityFieldCoefficient},#{pitotTubeCoefficient},#{kValue},#{flueArea},#{dilutionRatio},#{type})
9 9
 
10 10
     </insert>
11 11
 
12 12
     <select id="getByDataAcquisitionInstrumentid" resultType="com.cn.esermis.dpld.entity.AnalyticalInstruments"
13 13
             parameterType="java.lang.String">
14
-        select * from analytical_instruments
14
+        select t.*,t.range_str `range` from analytical_instruments t
15 15
             <where>
16 16
             <if test="productId != null">
17 17
                 and data_acquisition_instrument_id = #{productId}

+ 17 - 2
src/main/resources/static/mybatis/DataAcquisitionInstrumentMapper.xml

@@ -49,8 +49,23 @@
49 49
     <select id="verifydepartmen" resultType="java.lang.Boolean">
50 50
         select count(0)>0 from department where departmentid = #{factoryId}
51 51
     </select>
52
-    <select id="verifyCompany" resultType="java.lang.Boolean" parameterType="java.lang.String">
53
-        select count(0)>0 from company where companyid =  #{companyId}
52
+    <select id="verifyCompany" resultType="java.lang.String" parameterType="java.lang.String">
53
+        select levelid from company where companyid =  #{companyId}
54
+    </select>
55
+    <select id="getComponyList" resultType="java.lang.String">
56
+        select distinct  a.companyid from company a inner join  company b on a.levelid like concat(LEFT(b.levelid, 2),'%')
57
+                                                                                 <if test="companyId != null and companyId != ''">
58
+                                                                                     and b.companyid = #{companyId}
59
+                                                                                 </if>
60
+        <if test="companyName != null and companyName != ''">
61
+            where a.companyname like concat('%',#{companyName},'%')
62
+        </if>
63
+    </select>
64
+    <select id="getComponyListAll" resultType="java.lang.String">
65
+        select companyid from company
66
+        <if test="companyName != null and companyName != ''">
67
+            where companyname like concat('%',#{companyName},'%')
68
+        </if>
54 69
     </select>
55 70
 </mapper>
56 71
 

+ 1 - 1
src/main/resources/static/mybatis/DetectMonitoringFactorMapper.xml

@@ -6,7 +6,7 @@
6 6
 
7 7
 
8 8
     <select id="listByParentId" resultType="com.cn.esermis.dpld.entity.DetectMonitoringFactor">
9
-        select * from monitoring_factor
9
+        select t.*,t.range_str `range` from monitoring_factor t
10 10
         <where>
11 11
             <if test="parentId != null">
12 12
                 and analytical_instrument_id = #{parentId}