From 12e94ba6d6cb64e2e631447194d385a054fb8860 Mon Sep 17 00:00:00 2001 From: wanggongfeng <1305282856@qq.com> Date: Tue, 21 Jun 2022 16:35:26 +0800 Subject: [PATCH] =?UTF-8?q?=E7=96=AB=E8=8B=97=E6=8E=A5=E7=A7=8D=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E6=A0=B8=E9=85=B8=E6=A3=80=E6=B5=8B=E7=82=B9=20pc=20?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/constants/ImportTaskConstants.java | 1 + .../dto/result/CommunityInfoResultDTO.java | 41 +++ .../controller/CustomerAgencyController.java | 12 + .../java/com/epmet/dao/CustomerAgencyDao.java | 2 + .../epmet/service/CustomerAgencyService.java | 10 + .../impl/CustomerAgencyServiceImpl.java | 7 + .../resources/mapper/CustomerAgencyDao.xml | 13 + .../IcPointNucleicMonitoringController.java | 71 +++++ .../dao/IcPointNucleicMonitoringDao.java | 12 +- .../IcPointNucleicMonitoringImportExcel.java | 58 +++++ .../PointNucleicMonitoringErrorModel.java | 35 +++ .../com/epmet/feign/GovOrgFeignClient.java | 11 + .../fallback/GovOrgFeignClientFallBack.java | 6 + .../IcPointNucleicMonitoringService.java | 13 +- .../IcPointNucleicMonitoringServiceImpl.java | 244 +++++++++++++++++- .../excel/ic_point_nucleic_monitoring.xlsx | Bin 0 -> 11348 bytes .../mapper/IcPointNucleicMonitoringDao.xml | 9 +- 17 files changed, 537 insertions(+), 8 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityInfoResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPointNucleicMonitoringImportExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/PointNucleicMonitoringErrorModel.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/excel/ic_point_nucleic_monitoring.xlsx diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java index 8c439aa218..9c461a1f18 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/constants/ImportTaskConstants.java @@ -19,6 +19,7 @@ public interface ImportTaskConstants { String BIZ_TYPE_ATTENTION_VACCINATION = "attention_vaccination"; String BIZ_TYPE_ATTENTION_TRIP_REPORT = "attention_vaccination"; String BIZ_TYPE_IC_PARTY_MEMBER = "ic_party_member"; + String IC_POINT_NUCLEIC_MONITORING = "ic_point_nucleic_monitoring"; /** * 核酸检测 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityInfoResultDTO.java new file mode 100644 index 0000000000..46300096d5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CommunityInfoResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 社区所属组织基本信息 + * @Author wgf + * @Date 2020/4/26 22:35 + */ +@Data +public class CommunityInfoResultDTO implements Serializable { + private static final long serialVersionUID = 4360690752084258055L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 社区组织ID + */ + private String deptId; + + /** + * 社区名称 + */ + private String deptName; + + /** + * 网格的上级组织 + */ + private String pid; + + /** + * 网格的所有上级组织 + */ + private String pids; +} + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 5325163074..24008e536e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -463,5 +463,17 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.getDelAgencyGridIdList(agencyId)); } + /** + * @param orgName + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据社区名称查询所属组织信息 + * @Date 2022/6/21 22:41 + **/ + @GetMapping("getCommunityInfo/{orgName}") + public Result getCommunityInfo(@PathVariable("orgName") String orgName) { + return customerAgencyService.getCommunityInfo(orgName); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 02e483d9f2..17fb8356f3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java @@ -344,5 +344,7 @@ public interface CustomerAgencyDao extends BaseDao { @Param("customerId") String customerId); List getDelAgencyIdList(@Param("agencyId") String agencyId); + + CommunityInfoResultDTO getCommunityInfo(@Param("orgName") String orgName); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index dcdc1d44a8..d6651bc29b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -24,6 +24,7 @@ import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; +import org.springframework.web.bind.annotation.PathVariable; import java.util.List; import java.util.Map; @@ -317,4 +318,13 @@ public interface CustomerAgencyService extends BaseService * @Description 获取当前组织及下级无效组织、网格Id列表 **/ DelAgencyGridIdResultDTO getDelAgencyGridIdList(String agencyId); + + /** + * @param orgName + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据社区名称查询所属组织信息 + * @Date 2022/6/21 22:41 + **/ + Result getCommunityInfo(String orgName); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index adaf547abf..7c6cfa6d50 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -1566,4 +1566,11 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl getCommunityInfo(String orgName) { + CommunityInfoResultDTO communityInfoResultDTO = baseDao.getCommunityInfo(orgName); + + return new Result().ok(communityInfoResultDTO); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml index 2fd5aa5feb..e5d635d88f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml @@ -880,4 +880,17 @@ AND pids LIKE CONCAT('%', #{agencyId}, '%') + + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointNucleicMonitoringController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointNucleicMonitoringController.java index 4b97c98389..b1bc4385a3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointNucleicMonitoringController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcPointNucleicMonitoringController.java @@ -1,7 +1,13 @@ package com.epmet.controller; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelPoiUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -9,13 +15,22 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcPointNucleicMonitoringDTO; +import com.epmet.dto.form.ImportTaskCommonFormDTO; +import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.excel.IcPointNucleicMonitoringExcel; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.IcPointNucleicMonitoringService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -28,11 +43,15 @@ import java.util.Map; */ @RestController @RequestMapping("icPointNucleicMonitoring") +@Slf4j public class IcPointNucleicMonitoringController { @Autowired private IcPointNucleicMonitoringService icPointNucleicMonitoringService; + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + @RequestMapping("page") public Result> page(@RequestParam Map params){ PageData page = icPointNucleicMonitoringService.page(params); @@ -78,5 +97,57 @@ public class IcPointNucleicMonitoringController { } + /** + * Desc: 【核酸检测点】导入 + * @param + * @author wgf + * @date 2022/6/21 13:40 + */ + @PostMapping("pointNucleicMonitoringImport") + public Result pointNucleicMonitoringImport(@LoginUser TokenDto tokenDto, @RequestParam("file") MultipartFile file){ + if (file.isEmpty()) { + throw new EpmetException("请上传文件"); + } + // 校验文件类型 + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (!"xls".equals(extension) && !"xlsx".equals(extension)) { + throw new EpmetException("文件类型不匹配"); + } + + ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); + importTaskForm.setOriginFileName(file.getOriginalFilename()); + importTaskForm.setOperatorId(tokenDto.getUserId()); + importTaskForm.setBizType(ImportTaskConstants.IC_POINT_NUCLEIC_MONITORING); + Result result = commonServiceOpenFeignClient.createImportTask(importTaskForm); + if (!result.success()) { + throw new EpmetException(9999,"存在进行中的导入"); + } + InputStream inputStream = null; + try { + inputStream = file.getInputStream(); + }catch (Exception e){ + ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); + input.setOperatorId(tokenDto.getUserId()); + input.setTaskId(result.getData().getTaskId()); + input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); + commonServiceOpenFeignClient.finishImportTask(input); + log.error("读取文件失败"); + } + icPointNucleicMonitoringService.importFile(tokenDto,inputStream,result.getData().getTaskId()); + return new Result(); + } + + /** + * 导出模板 + * @param response + * @throws Exception + */ + @PostMapping("exporttemplate") + public void exportTemplate( HttpServletResponse response) throws Exception { + TemplateExportParams templatePath = new TemplateExportParams("excel/ic_point_nucleic_monitoring.xlsx"); + ExcelPoiUtils.exportExcel(templatePath ,new HashMap<>(),"核酸检测点录入表",response); + } + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java index 5621b19449..563d33553d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcPointNucleicMonitoringDao.java @@ -4,6 +4,8 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.IcPointNucleicMonitoringEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 核酸监测点 * @@ -12,5 +14,11 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcPointNucleicMonitoringDao extends BaseDao { - -} \ No newline at end of file + + /** + * 获取所有地点名称 + * @return + */ + List getAllAddressName(); + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPointNucleicMonitoringImportExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPointNucleicMonitoringImportExcel.java new file mode 100644 index 0000000000..22c04a2b51 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcPointNucleicMonitoringImportExcel.java @@ -0,0 +1,58 @@ +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.annotation.ExcelIgnore; +import lombok.Data; + +import java.util.Date; + +/** + * 核酸监测点 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-06-20 + */ +@Data +public class IcPointNucleicMonitoringImportExcel { + + @Excel(name = "所属组织名称") + private String orgName; + + @Excel(name = "核酸监测点名称") + private String name; + + @Excel(name = "服务时间") + private String serveTime; + + @Excel(name = "咨询电话") + private String mobile; + + @Excel(name = "监测点地址") + private String address; + + @ExcelIgnore + private Boolean addStatus = false; + + @ExcelIgnore + private Integer num; + + /** + * 所属组织ID + */ + @ExcelIgnore + private String orgId; + + /** + * 组织ID上级 + */ + @ExcelIgnore + private String pid; + + /** + * 组织ID所有上级 + */ + @ExcelIgnore + private String pids; + + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/PointNucleicMonitoringErrorModel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/PointNucleicMonitoringErrorModel.java new file mode 100644 index 0000000000..722142e35b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/error/PointNucleicMonitoringErrorModel.java @@ -0,0 +1,35 @@ +package com.epmet.excel.error; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * @Author wgf + * @DateTime 2022/6/21 16:57 + * @DESC + */ +@Data +public class PointNucleicMonitoringErrorModel { + + @Excel(name = "行号",width = 10) + private Integer num; + + @Excel(name = "所属组织名称",width = 30) + private String orgName; + + @Excel(name = "核酸监测点名称",width = 30) + private String name; + + @Excel(name = "服务时间",width = 20) + private String serveTime; + + @Excel(name = "电话",width = 30) + private String mobile; + + @Excel(name = "监测点地址",width = 40) + private String address; + + @Excel(name = "错误信息", width = 200) + private String errorMsg; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java index e0f881766e..b364fa689d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/GovOrgFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.CommunityInfoResultDTO; import com.epmet.dto.result.GridInfoResultDTO; import com.epmet.feign.fallback.GovOrgFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; @@ -63,4 +64,14 @@ public interface GovOrgFeignClient { //@PostMapping("/gov/org/grid/getbaseinfo") //Result getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO); + /** + * @param orgName + * @return com.epmet.commons.tools.utils.Result + * @Author wgf + * @Description 根据社区名称查询所属组织信息 + * @Date 2020/4/26 23:16 + **/ + @GetMapping("/gov/org/customeragency/getCommunityInfo/{orgName}") + Result getCommunityInfo(@PathVariable("orgName") String orgName); + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java index 047208bdc4..f01da41601 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/fallback/GovOrgFeignClientFallBack.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerGridDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.CustomerGridFormDTO; +import com.epmet.dto.result.CommunityInfoResultDTO; import com.epmet.dto.result.GridInfoResultDTO; import com.epmet.feign.GovOrgFeignClient; import org.springframework.stereotype.Component; @@ -39,4 +40,9 @@ public class GovOrgFeignClientFallBack implements GovOrgFeignClient { //public Result getGridBaseInfoByGridId(CustomerGridFormDTO customerGridFormDTO) { // return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getGridBaseInfoByGridId", customerGridFormDTO); //} + + @Override + public Result getCommunityInfo(String orgName) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCommunityInfo",orgName); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java index 5cde04efe2..d74f89f861 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcPointNucleicMonitoringService.java @@ -2,9 +2,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcPointNucleicMonitoringDTO; import com.epmet.entity.IcPointNucleicMonitoringEntity; +import java.io.InputStream; import java.util.List; import java.util.Map; @@ -75,4 +77,13 @@ public interface IcPointNucleicMonitoringService extends BaseService implements IcPointNucleicMonitoringService { @Autowired private IcPointNucleicMonitoringRedis icPointNucleicMonitoringRedis; + @Autowired + private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; + + @Autowired + private OssFeignClient ossFeignClient; + + @Autowired + private GovOrgFeignClient govOrgFeignClient; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -84,4 +128,196 @@ public class IcPointNucleicMonitoringServiceImpl extends BaseServiceImpl errorInfo = new ArrayList<>(); + + try { + List list = ExcelPoiUtils.importExcel(inputStream, 0,1,IcPointNucleicMonitoringImportExcel.class); + if (CollectionUtils.isEmpty(list)){ + closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); + return; + } + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo){ + throw new EpmetException("未查询到工作人员信息"+tokenDto.getUserId()); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo){ + throw new EpmetException("未查询到组织信息"+staffInfo.getAgencyId()); + } + // 获取所有地点名称 + List addressList = baseDao.getAllAddressName(); + for (int i = 0; i < list.size(); i++) { + list.get(i).setNum(i+1); + if (StringUtils.isBlank(list.get(i).getOrgName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "所属组织名称不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "核酸监测点名称不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getServeTime()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "服务时间不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getMobile()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "咨询电话不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + if (StringUtils.isBlank(list.get(i).getAddress()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "监测点地址不能为空",i+1)); + list.get(i).setAddStatus(true); + continue; + } + // 校验数据库是否存在该地点名称 + if (addressList.contains(list.get(i).getName()) && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "核酸监测点名称已存在",i+1)); + list.get(i).setAddStatus(true); + continue; + } + + // 校验所属组织通过名称能否匹配到ID + Result resultDTOResult = govOrgFeignClient.getCommunityInfo(list.get(i).getOrgName()); + CommunityInfoResultDTO communityInfoResultDTO = resultDTOResult.getData(); + if(communityInfoResultDTO == null && !list.get(i).getAddStatus()){ + errorInfo.add(getErrorInfo(list.get(i), "所属组织匹配失败",i+1)); + list.get(i).setAddStatus(true); + continue; + }else{ + list.get(i).setOrgId(communityInfoResultDTO.getDeptId()); + list.get(i).setPid(communityInfoResultDTO.getPid()); + list.get(i).setPids(communityInfoResultDTO.getPids()); + } + + } + if (list.size() > errorInfo.size()){ + Map groupByName = list.stream().collect(Collectors.groupingBy(IcPointNucleicMonitoringImportExcel::getName, Collectors.counting())); + groupByName.forEach((name,count) -> { + if (Integer.valueOf(count.toString()).compareTo(1) != 0){ + for (IcPointNucleicMonitoringImportExcel i : list) { + if (name.equals(i.getName()) && !i.getAddStatus()){ + errorInfo.add(getErrorInfo(i,"数据重复",i.getNum())); + i.setAddStatus(true); + } + } + } + }); + } + Map> groupByStatus = list.stream().collect(Collectors.groupingBy(IcPointNucleicMonitoringImportExcel::getAddStatus)); + List needInsert = groupByStatus.get(false); + if (CollectionUtils.isNotEmpty(needInsert)){ + List entities = ConvertUtils.sourceToTarget(needInsert, IcPointNucleicMonitoringEntity.class); + entities.forEach(e -> { + // 设置客户ID + e.setCustomerId(tokenDto.getCustomerId()); + }); + insertBatch(entities); + } + if (CollectionUtils.isNotEmpty(errorInfo)){ + String url = importOssUpload(errorInfo, EpidemicSpecialAttentionErrorModel.class); + closeTask(taskId,tokenDto.getUserId(), ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,url); + }else { + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS,""); + } + }catch (Exception e){ + log.error(e.getMessage()); + closeTask(taskId,tokenDto.getUserId(),ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL,""); + } + } + + /** + * Desc: 关闭任务 + * @param taskId + * @param userId + * @param status + * @param url + * @author wgf + * @date 2022/3/30 09:05 + */ + public void closeTask(String taskId,String userId,String status,String url){ + ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); + input.setOperatorId(userId); + input.setTaskId(taskId); + input.setProcessStatus(status); + input.setResultDescFilePath(url); + commonServiceOpenFeignClient.finishImportTask(input); + } + + /** + * Desc: 构造错误信息 + * @param dto + * @param info + * @param num + * @author wgf + * @date 2022/3/29 17:17 + */ + public PointNucleicMonitoringErrorModel getErrorInfo(IcPointNucleicMonitoringImportExcel dto, String info, Integer num){ + PointNucleicMonitoringErrorModel result = ConvertUtils.sourceToTarget(dto, PointNucleicMonitoringErrorModel.class); + result.setErrorMsg(info); + result.setNum(num); + return result; + } + + /** + * Desc: 文件上传并返回url + * @param errorRows + * @param tClass + * @author zxc + * @date 2022/3/30 09:16 + */ + public String importOssUpload(Collection errorRows, Class tClass) throws IOException { + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表","导入失败的数据列表"), + tClass, errorRows); + + // 文件名 + String resultDescFileName = UUID.randomUUID().toString().concat(".xls"); + + FileItemFactory factory = new DiskFileItemFactory(16, null); + FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName); + OutputStream os = fileItem.getOutputStream(); + Result uploadResult = null; + try { + workbook.write(os); + uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); + } catch (Exception e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件:{}", errormsg); + } finally { + try { + os.close(); + } catch (IOException e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件关闭输出流:{}", errormsg); + } + try { + fileItem.delete(); + } catch (Exception e) { + String errormsg = ExceptionUtils.getErrorStackTrace(e); + log.error("上传错误描述文件删除临时文件:{}", errormsg); + } + } + + if (uploadResult == null || !uploadResult.success()) { + log.error("调用OSS上传结果描述文件失败"); + return null; + } + return uploadResult.getData().getUrl(); + } + + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_point_nucleic_monitoring.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_point_nucleic_monitoring.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..5afef2dc0a41cdd614b64316e8feaf2cc14c88f2 GIT binary patch literal 11348 zcmeIYRaBf?(=Lh!5AN;|+}*u#O9<}n?(Po3HMkSpA-H?+Ai*7y;1YI|eE-S{-}=`$ z=XQ@hFS>hlm-Kw9W>vkjN&x^40Sof9LgY3CpWgpx!2mxP+88L<+t@lVC;-XOfL}oW zB)frgd*lHH0kHuC0YUmZnVzjJy{naFX8f2mI1^gXmH#PHP1Sx(=(|)jp}wd$A6jBk zd8~9PV4COOU#Nd>Lh=NE-4W#l7!DmI-;{|Js&dp^k*shtr-R-q z@&*^!8kwm@4Z{-_koNR>c9r}-6&Xb_3#TTT6}IT zw|pW2?d-KR0)cF8X5T?DT>is zvaT0Fwomx}xI5y52qQ5<>vSTtPnL}Qjn5x1mKQTDLt@XK+c{)#Dp;y(T2nYsEoX{~ zpBLIq$gOf+a~qN>!Pl8q%6vEinl6%>sy~f^$Y7}!(X3CslG*r3bt#!k9L&0_!oiU;8+T!8<>o-&RP@Y-y0O}cI z{bW9XAYRqRMA6mQa?g$v{>EA^`5ZXw8>Hwc(R5JfVb#+uM{aRD!F#{M7xeqGFz+8o zr3Ym%F13BotEml_As$h{BXFDi1jt2j&Z+lZLU{x=cUK=VzHvbtC^E!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RMT8@MNjr z$wbiiR8=iSaEd~@+}>GI@s-yM6ynCfA(S(far&bjBq5|EnMgsae2m!*usjB14Y6S^ zEyG1Mk*qWy|7`X~A{F&Zgpz(GSc(fQZ=5STz88oQdh+W7V}mmT3HILe z%LcEnFoSS!_p~`d zKgXP>`2A}=&9D&@|BmK=Dt#W$pLl*L75j_l=ZW|?Wls&3U+YQP)B4+N-JklNPuD#W z|I$bKceek`+C7Kp`N-IB?pUCw|E2VQ2FRYXKc8~?&5j3*zrWf4ntA%SO#?apvz|8X z2=Oy`{~N=fC|QyGE!sc-qtDaAlcHZJz56@cej^Gh;9&-8|69)b zH{Pe5_-j4!4geG0pS=H*A^!yZd5(ON@XOMv y9>1l`01f-+#(qlqIqvcQUCKJJhW!UAKj#D#0FXbUC?*IdNDi<^oJH}Z{r>>B?JSM} literal 0 HcmV?d00001 diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml index e3c97b3342..2cb4e10db6 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcPointNucleicMonitoringDao.xml @@ -24,5 +24,12 @@ + - \ No newline at end of file + +