|
@@ -9,10 +9,8 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertSaveReqVO;
|
|
|
-import cn.iocoder.yudao.module.pms.controller.admin.qhse.measure.IotMeasureBookController;
|
|
|
|
|
-import cn.iocoder.yudao.module.pms.controller.admin.qhse.measure.vo.IotMeasureBookPageReqVO;
|
|
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.cert.IotMeasureCertDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.cert.IotMeasureCertDO;
|
|
|
-import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.measure.IotMeasureBookDO;
|
|
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.qhse.cert.IotMeasureCertMapper;
|
|
|
import cn.iocoder.yudao.module.pms.service.qhse.cert.IotMeasureCertService;
|
|
import cn.iocoder.yudao.module.pms.service.qhse.cert.IotMeasureCertService;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
@@ -34,7 +32,10 @@ import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
-import java.util.*;
|
|
|
|
|
|
|
+import java.util.HashSet;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+import java.util.Objects;
|
|
|
|
|
+import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
@@ -57,6 +58,8 @@ public class IotMeasureCertController {
|
|
|
private DictDataService dictDataService;
|
|
private DictDataService dictDataService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private DeptService deptService;
|
|
private DeptService deptService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IotMeasureCertMapper iotMeasureCertMapper;
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建计量器具-证书管理")
|
|
@Operation(summary = "创建计量器具-证书管理")
|
|
@@ -155,29 +158,20 @@ public class IotMeasureCertController {
|
|
|
ids.add(deptId);
|
|
ids.add(deptId);
|
|
|
}
|
|
}
|
|
|
//到期
|
|
//到期
|
|
|
- IotMeasureBookPageReqVO reqVO = new IotMeasureBookPageReqVO();
|
|
|
|
|
|
|
+ IotMeasureCertPageReqVO reqVO = new IotMeasureCertPageReqVO();
|
|
|
reqVO.setExpired(true);
|
|
reqVO.setExpired(true);
|
|
|
- long expired = iotMeasureBookMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
|
|
|
|
+ long expired = iotMeasureCertMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
reqVO.setExpired(null);
|
|
reqVO.setExpired(null);
|
|
|
reqVO.setAlertWarn(true);
|
|
reqVO.setAlertWarn(true);
|
|
|
//90天预警
|
|
//90天预警
|
|
|
- long warn = iotMeasureBookMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
|
|
|
|
+ long warn = iotMeasureCertMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
reqVO.setAlertWarn(null);
|
|
reqVO.setAlertWarn(null);
|
|
|
- List<IotMeasureBookDO> iotMeasureBookDOS = iotMeasureBookMapper.selectListByDept(reqVO, ids);
|
|
|
|
|
- Map<String, Long> classifyCountMap = iotMeasureBookDOS.stream()
|
|
|
|
|
- .collect(Collectors.groupingBy(
|
|
|
|
|
- IotMeasureBookDO::getClassify,
|
|
|
|
|
- Collectors.counting() // 直接统计每个分组的数量
|
|
|
|
|
- ));
|
|
|
|
|
- List<IotMeasureBookController.ClassifyMeasureBookStatVo> results = new ArrayList<>();
|
|
|
|
|
- List<DictDataDO> dictType = dictDataService.getDictDataListByDictType("measure_type");
|
|
|
|
|
- classifyCountMap.forEach((key, value) -> dictType.stream().filter(e -> e.getValue().equals(key)).findFirst().ifPresent(f ->{
|
|
|
|
|
- IotMeasureBookController.ClassifyMeasureBookStatVo statVo = new IotMeasureBookController.ClassifyMeasureBookStatVo();
|
|
|
|
|
- statVo.setClassify(f.getLabel());
|
|
|
|
|
- statVo.setCount(value);
|
|
|
|
|
- results.add(statVo);
|
|
|
|
|
- }));
|
|
|
|
|
-
|
|
|
|
|
- return success(ImmutableMap.of("expired", expired, "warn", warn, "classify", results));
|
|
|
|
|
|
|
+ reqVO.setType("personal");
|
|
|
|
|
+ Long personal = iotMeasureCertMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
|
|
+ reqVO.setType("organization");
|
|
|
|
|
+ Long org = iotMeasureCertMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
|
|
+ reqVO.setType(null);
|
|
|
|
|
+ Long total = iotMeasureCertMapper.selectCountByDeptAndExpireAndWarn(reqVO, ids);
|
|
|
|
|
+ return success(ImmutableMap.of("expired", expired, "warn", warn,"personal", personal,"organization", org,"total", total));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|