|
@@ -15,6 +15,8 @@ import com.cn.esermis.dpld.model.OutletAndFactorVo;
|
15
|
15
|
import com.cn.esermis.dpld.service.IAnalyticalInstrumentsService;
|
16
|
16
|
import com.cn.esermis.dpld.service.IDataAcquisitionInstrumentService;
|
17
|
17
|
import com.cn.esermis.dpld.service.IDetectMonitoringFactorService;
|
|
18
|
+import com.cn.esermis.model.BaseUser;
|
|
19
|
+import com.cn.esermis.utils.TokenUtils;
|
18
|
20
|
import org.springframework.beans.BeanUtils;
|
19
|
21
|
import org.springframework.beans.factory.annotation.Autowired;
|
20
|
22
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -23,10 +25,13 @@ import org.springframework.validation.annotation.Validated;
|
23
|
25
|
import org.springframework.web.bind.annotation.*;
|
24
|
26
|
|
25
|
27
|
import javax.annotation.Resource;
|
|
28
|
+import javax.servlet.http.HttpServletRequest;
|
26
|
29
|
|
27
|
30
|
import java.util.*;
|
28
|
31
|
|
|
32
|
+import static com.cn.esermis.dpld.model.AjaxResult.error;
|
29
|
33
|
import static com.cn.esermis.dpld.model.AjaxResult.success;
|
|
34
|
+import static com.cn.esermis.utils.TokenUtils.extractToken;
|
30
|
35
|
|
31
|
36
|
@RestController
|
32
|
37
|
@RequestMapping("/data_Acquisition")
|
|
@@ -43,10 +48,12 @@ public class DataAcquisitionInstrumentController {
|
43
|
48
|
* 获取数采仪信息表
|
44
|
49
|
*/
|
45
|
50
|
@GetMapping("/list")
|
46
|
|
- public AjaxResult list(DataAcquisitionInstrumentVo vo)
|
|
51
|
+ public AjaxResult list(DataAcquisitionInstrumentVo vo, HttpServletRequest request)
|
47
|
52
|
{
|
48
|
53
|
IPage<DataAcquisitionInstrument> page = new Page<>(vo.getPageNum(), vo.getPageSize());
|
49
|
54
|
QueryWrapper<DataAcquisitionInstrument> wrapper = new QueryWrapper<>();
|
|
55
|
+ BaseUser userInfo = TokenUtils.getUserInfo(extractToken(request));
|
|
56
|
+// wrapper.eq("company_code",userInfo.getCompanyId());
|
50
|
57
|
wrapper.orderByDesc("department_code");
|
51
|
58
|
IPage<DataAcquisitionInstrument> pageList = dataAcquisitionInstrumentService.page(page, wrapper);
|
52
|
59
|
IPage<DataAcquisitionInstrumentVo> volits = new Page<>();
|
|
@@ -231,11 +238,15 @@ public class DataAcquisitionInstrumentController {
|
231
|
238
|
* 获取数采仪信息表
|
232
|
239
|
*/
|
233
|
240
|
@GetMapping("/listByCode")
|
234
|
|
- public AjaxResult listByCode(DataAcquisitionInstrumentVo vo)
|
|
241
|
+ public AjaxResult listByCode(HttpServletRequest request)
|
235
|
242
|
{
|
236
|
243
|
QueryWrapper<DataAcquisitionInstrument> wrapper = new QueryWrapper<>();
|
237
|
|
- wrapper.eq(vo.getDepartmentCode()!=null,"department_code", vo.getDepartmentCode());
|
238
|
|
-// wrapper.eq(vo.getCompanyCode()!=null,"company_code", vo.getCompanyCode());
|
|
244
|
+ BaseUser userInfo = TokenUtils.getUserInfo(extractToken(request));
|
|
245
|
+ if (userInfo==null){
|
|
246
|
+ return error("无数据");
|
|
247
|
+ }
|
|
248
|
+ wrapper.eq(userInfo.getCompanyId()!=null,"department_code", userInfo.getCompanyId());
|
|
249
|
+ wrapper.eq(userInfo.getFactoryId()!=null,"company_code", userInfo.getFactoryId());
|
239
|
250
|
// List<DataAcquisitionInstrument> dataAcquisitionInstruments = dataAcquisitionInstrumentService.listByCode(vo);
|
240
|
251
|
List<DataAcquisitionInstrument> dataAcquisitionInstruments = dataAcquisitionInstrumentService.list(wrapper);
|
241
|
252
|
return success(dataAcquisitionInstruments);
|