|
|
@@ -1,7 +1,5 @@
|
|
|
package com.zd.laboratory.controller;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.zd.algorithm.api.fire.entity.vo.HardwareFireDeviceVO;
|
|
|
import com.zd.common.core.annotation.Log;
|
|
|
import com.zd.common.core.annotation.PreAuthorize;
|
|
|
import com.zd.common.core.log.BusinessType;
|
|
|
@@ -22,7 +20,6 @@ import com.zd.laboratory.service.ILabHazardService;
|
|
|
import com.zd.laboratory.service.ILabHazardSubjectRelationService;
|
|
|
import com.zd.laboratory.service.ILabQpSubjectRelationService;
|
|
|
import com.zd.model.constant.BaseConstants;
|
|
|
-import com.zd.model.constant.CacheConstants;
|
|
|
import com.zd.model.domain.ResultData;
|
|
|
import com.zd.model.domain.per.PerFun;
|
|
|
import com.zd.model.domain.per.PerPrefix;
|
|
|
@@ -88,13 +85,13 @@ public class LabHazardController extends BaseController {
|
|
|
@GetMapping(value = "/getQpHazard")
|
|
|
@ApiOperation(value = "获取实验室气瓶存储数量")
|
|
|
public ResultData<LabQpSubjectRelation> getQpHazard(Long subId) {
|
|
|
- LabQpSubjectRelation LabQpSubjectRelation = new LabQpSubjectRelation();
|
|
|
- LabQpSubjectRelation.setSubjectId(subId);
|
|
|
- List<LabQpSubjectRelation> list = labQpSubjectRelationService.selectLabQpSubjectRelationList(LabQpSubjectRelation);
|
|
|
- if(list.size()>0){
|
|
|
- LabQpSubjectRelation = list.get(0);
|
|
|
+ LabQpSubjectRelation labQpSubjectRelation = new LabQpSubjectRelation();
|
|
|
+ labQpSubjectRelation.setSubjectId(subId);
|
|
|
+ List<LabQpSubjectRelation> list = labQpSubjectRelationService.selectLabQpSubjectRelationList(labQpSubjectRelation);
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ labQpSubjectRelation = list.get(0);
|
|
|
}
|
|
|
- return ResultData.success(LabQpSubjectRelation);
|
|
|
+ return ResultData.success(labQpSubjectRelation);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -139,7 +136,7 @@ public class LabHazardController extends BaseController {
|
|
|
public ResultData<LabHazardNewVo> getInfo(@PathVariable("id") Long id) {
|
|
|
LabHazard labHazard = labHazardService.selectLabHazardById(id);
|
|
|
LabHazardNewVo labHazardNewVo = new LabHazardNewVo();
|
|
|
- if(labHazard != null){
|
|
|
+ if (labHazard != null) {
|
|
|
BeanUtils.copyProperties(labHazard, labHazardNewVo);
|
|
|
}
|
|
|
return ResultData.success(labHazardNewVo);
|
|
|
@@ -154,7 +151,7 @@ public class LabHazardController extends BaseController {
|
|
|
public ResultData<LabHazardNewVo> lookUp(@PathVariable("id") Long id) {
|
|
|
LabHazardNewVo labHazardNewVo = new LabHazardNewVo();
|
|
|
LabHazard labHazard = labHazardService.selectLabHazardById(id);
|
|
|
- if(labHazard != null){
|
|
|
+ if (labHazard != null) {
|
|
|
labHazard.setScanCount(labHazard.getScanCount() + 1);
|
|
|
labHazardService.updateLabHazardLook(labHazard);
|
|
|
BeanUtils.copyProperties(labHazard, labHazardNewVo);
|
|
|
@@ -181,7 +178,7 @@ public class LabHazardController extends BaseController {
|
|
|
@PostMapping("/edit")
|
|
|
@ApiOperation(value = "修改危险源")
|
|
|
public ResultData edit(@RequestBody @Validated(ValidGroup.Crud.Update.class) LabHazard labHazard) {
|
|
|
- if(labHazard.getId() == null){
|
|
|
+ if (labHazard.getId() == null) {
|
|
|
return ResultData.fail("ID不能为空!");
|
|
|
}
|
|
|
return ResultData.success(labHazardService.updateLabHazard(labHazard));
|
|
|
@@ -248,7 +245,6 @@ public class LabHazardController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 危险源统计列表(大屏用)
|
|
|
*/
|
|
|
@@ -256,11 +252,11 @@ public class LabHazardController extends BaseController {
|
|
|
@ApiOperation(value = "危险源统计列表(大屏用)")
|
|
|
public ResultData queryBigViewHazardList(LabHazardVO labHazardVO) {
|
|
|
List<LabHazardBigViewVO> list = labHazardService.queryBigViewHazardList(labHazardVO);
|
|
|
- if(list!=null && list.size()>0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
//占比计算
|
|
|
- Integer count= list.stream().mapToInt(a->a.getTotalNum()).sum();
|
|
|
- for (LabHazardBigViewVO vo:list) {
|
|
|
- vo.setRatio(myPercent(vo.getTotalNum(),count,"##.0%"));
|
|
|
+ Integer count = list.stream().mapToInt(a -> a.getTotalNum()).sum();
|
|
|
+ for (LabHazardBigViewVO vo : list) {
|
|
|
+ vo.setRatio(myPercent(vo.getTotalNum(), count, "##.0%"));
|
|
|
}
|
|
|
}
|
|
|
return ResultData.success(list);
|
|
|
@@ -275,38 +271,38 @@ public class LabHazardController extends BaseController {
|
|
|
//获取数据源
|
|
|
List<LabHazardSubjectRelation> list = labHazardSubjectRelationService.relationBigViewCount(relation);
|
|
|
//获取危险源列表
|
|
|
- List<SysDictData> dictDataList = redisService.getCacheObject(BaseConstants.SYS_DICT_KEY+"lab_hazard_type");
|
|
|
+ List<SysDictData> dictDataList = redisService.getCacheObject(BaseConstants.SYS_DICT_KEY + "lab_hazard_type");
|
|
|
//按学院分组
|
|
|
Map<String, List<LabHazardSubjectRelation>> bottleConfigMap = list.stream().collect(Collectors.groupingBy(LabHazardSubjectRelation::getDeptName));
|
|
|
|
|
|
- Map<String,Object> allMap = new HashMap <>();
|
|
|
- List<Map<String,Object>> backtList = new ArrayList<>();
|
|
|
- LinkedHashSet <String> deptNames = new LinkedHashSet<>();
|
|
|
+ Map<String, Object> allMap = new HashMap<>();
|
|
|
+ List<Map<String, Object>> backtList = new ArrayList<>();
|
|
|
+ LinkedHashSet<String> deptNames = new LinkedHashSet<>();
|
|
|
|
|
|
- if(!bottleConfigMap.isEmpty()){
|
|
|
- for (SysDictData dicData:dictDataList) {
|
|
|
- Map<String,Object> hazardMap = new HashMap <>();
|
|
|
- hazardMap.put("name",dicData.getDictLabel());
|
|
|
+ if (!bottleConfigMap.isEmpty()) {
|
|
|
+ for (SysDictData dicData : dictDataList) {
|
|
|
+ Map<String, Object> hazardMap = new HashMap<>();
|
|
|
+ hazardMap.put("name", dicData.getDictLabel());
|
|
|
List<Integer> hazardtList = new ArrayList<>();
|
|
|
for (Map.Entry entry : bottleConfigMap.entrySet()) {
|
|
|
Object Key = entry.getKey();
|
|
|
- deptNames.add(Key+"");
|
|
|
+ deptNames.add(Key + "");
|
|
|
Integer deptCount = 0;
|
|
|
// 循环数据源
|
|
|
- for (LabHazardSubjectRelation lsr:list) {
|
|
|
- if(Key.toString().equals(lsr.getDeptName()) && dicData.getDictLabel().equals(lsr.getHazardTypeModeName())){
|
|
|
+ for (LabHazardSubjectRelation lsr : list) {
|
|
|
+ if (Key.toString().equals(lsr.getDeptName()) && dicData.getDictLabel().equals(lsr.getHazardTypeModeName())) {
|
|
|
deptCount = lsr.getTotalNum();
|
|
|
}
|
|
|
}
|
|
|
hazardtList.add(deptCount);
|
|
|
}
|
|
|
- hazardMap.put("data",hazardtList);
|
|
|
+ hazardMap.put("data", hazardtList);
|
|
|
backtList.add(hazardMap);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- allMap.put("list",backtList);
|
|
|
- allMap.put("deptNames",deptNames);
|
|
|
+ allMap.put("list", backtList);
|
|
|
+ allMap.put("deptNames", deptNames);
|
|
|
return ResultData.success(allMap);
|
|
|
}
|
|
|
|