|
|
@@ -5,6 +5,13 @@ import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertR
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.qhse.cert.vo.IotMeasureCertSaveReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.cert.IotMeasureCertDO;
|
|
|
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.dto.DeptRespDTO;
|
|
|
+import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
+import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
|
|
+import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@@ -40,6 +47,12 @@ public class IotMeasureCertController {
|
|
|
|
|
|
@Resource
|
|
|
private IotMeasureCertService iotMeasureCertService;
|
|
|
+ @Autowired
|
|
|
+ private DeptApi deptApi;
|
|
|
+ @Autowired
|
|
|
+ private AdminUserApi adminUserApi;
|
|
|
+ @Autowired
|
|
|
+ private DictDataService dictDataService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建计量器具-证书管理")
|
|
|
@@ -90,9 +103,32 @@ public class IotMeasureCertController {
|
|
|
HttpServletResponse response) throws IOException {
|
|
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
List<IotMeasureCertDO> list = iotMeasureCertService.getIotMeasureCertPage(pageReqVO).getList();
|
|
|
+ List<IotMeasureCertRespVO> bean = BeanUtils.toBean(list, IotMeasureCertRespVO.class);
|
|
|
+ List<DictDataDO> personCert = dictDataService.getDictDataListByDictType("person_cert");
|
|
|
+ List<DictDataDO> orgCert = dictDataService.getDictDataListByDictType("org_cert");
|
|
|
+ bean.forEach(e ->{
|
|
|
+ if (Objects.nonNull(e.getDeptId())) {
|
|
|
+ DeptRespDTO dept = deptApi.getDept(e.getDeptId());
|
|
|
+ if (Objects.nonNull(dept)){
|
|
|
+ e.setDeptName(dept.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(e.getUserId())) {
|
|
|
+ AdminUserRespDTO user = adminUserApi.getUser(e.getUserId());
|
|
|
+ if (Objects.nonNull(user)) {
|
|
|
+ e.setUserName(user.getNickname());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ("personal".equals(e.getType())) {
|
|
|
+ e.setType("个人证书");
|
|
|
+ personCert.stream().filter(f -> f.getValue().equals(e.getClassify())).findFirst().ifPresent(f -> e.setClassify(f.getLabel()));
|
|
|
+ } else {
|
|
|
+ e.setType("组织证书");
|
|
|
+ orgCert.stream().filter(f -> f.getValue().equals(e.getClassify())).findFirst().ifPresent(f -> e.setClassify(f.getLabel()));
|
|
|
+ }
|
|
|
+ });
|
|
|
// 导出 Excel
|
|
|
- ExcelUtils.write(response, "计量器具-证书管理.xls", "数据", IotMeasureCertRespVO.class,
|
|
|
- BeanUtils.toBean(list, IotMeasureCertRespVO.class));
|
|
|
+ ExcelUtils.write(response, "计量器具-证书管理.xls", "数据", IotMeasureCertRespVO.class, bean);
|
|
|
}
|
|
|
|
|
|
}
|