diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java index 3fe71d8b60..786fc77928 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcSocietyOrgController.java @@ -139,7 +139,7 @@ public class IcSocietyOrgController { /** * @Author sun - * @Description 九小场所下组织列表导入---咱不能使用 程序未开发 + * @Description 九小场所下组织列表导入 **/ @PostMapping("import") public Result importExcel(@LoginUser TokenDto tokenDTO, @RequestParam("file") MultipartFile file) throws IOException, ParseException { @@ -151,7 +151,7 @@ public class IcSocietyOrgController { List numList = new ArrayList<>(); if (!CollectionUtils.isEmpty(failList)) { for (IcSocietyOrgExcel entity : failList) { - log.error("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());//打印失败的行 和失败的信息 + log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());//打印失败的行 和失败的信息 numList.add(entity.getRowNum()); } //return new Result().error(8001,failList.get(0).getErrorMsg()); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java index 2a435d7d9f..60f62e3a8d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcSocietyOrgDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcSocietyOrgDTO; import com.epmet.dto.form.GetListSocietyOrgFormDTO; import com.epmet.dto.result.GetListSocietyOrgResultDTO; import com.epmet.dto.result.SocietyOrgListResultDTO; @@ -53,4 +54,10 @@ public interface IcSocietyOrgDao extends BaseDao { @Param("societyName")String societyName, @Param("customerId")String customerId, @Param("queryPurpose")String queryPurpose); + + /** + * @Author sun + * @Description 查询当前组织下的社会组织数据 + **/ + List getByAgencyId(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index 4e37c4cd50..e9fc54a6f1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.IcSocietyOrgDao; import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.IcSocietyOrgDTO; import com.epmet.dto.form.*; import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.result.*; @@ -179,20 +180,36 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl importExcel(String customerId, List list, String staffId, List numList) throws ParseException { - //1.数据校验 只允许导入当前组织下社会组织 CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, staffId); + //查询当前组织下的社会组织数据 + List societyOrgList = baseDao.getByAgencyId(staffInfoCache.getAgencyId()); + //1.数据校验 只允许导入当前组织下社会组织且是当前组织下不存在的社会组织 //组织名称不一样的数据舍弃 Iterator iterator = list.iterator(); while (iterator.hasNext()) { IcSocietyOrgExcel obj = iterator.next(); if (!obj.getAgencyName().trim().equals(staffInfoCache.getAgencyName())) { numList.add(obj.getRowNum()); + log.warn(String.format("不是当前组织下可导入的数据,组织名称->%s,行号->%s", obj.getAgencyName(), obj.getRowNum())); iterator.remove(); + continue; } + societyOrgList.forEach(org -> { + if (obj.getSocietyName().equals(org.getSocietyName())) { + numList.add(obj.getRowNum()); + log.warn(String.format("当前组织下的社会组织已存在,社会组织名称->%s,行号->%s", obj.getSocietyName(), obj.getRowNum())); + iterator.remove(); + } + }); + } - if(CollectionUtils.isEmpty(list)){ + if (CollectionUtils.isEmpty(list)) { return numList; } @@ -205,12 +222,21 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl iter = list.iterator(); + while (iter.hasNext()) { + IcSocietyOrgExcel obj = iter.next(); + numList.add(obj.getRowNum()); + iterator.remove(); + } + return numList; + } Map map = staffResult.getData().stream().collect(Collectors.toMap(CustomerStaffDTO::getRealName, CustomerStaffDTO::getUserId)); //3.遍历封装有效数据 List houseEntityList = new ArrayList<>(); Iterator iterator1 = list.iterator(); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); while (iterator1.hasNext()) { IcSocietyOrgExcel icHouseExcel = iterator1.next(); IcSocietyOrgEntity entity = new IcSocietyOrgEntity(); @@ -223,9 +249,10 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl%s,行号->%s", icHouseExcel.getAdminStaffName(), icHouseExcel.getRowNum())); iterator1.remove(); continue; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml index 46f1475d7d..56daf5dc2b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml @@ -65,4 +65,26 @@ + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 6bf9a4466e..4e9b5f9d0e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -658,6 +658,6 @@ public interface EpmetUserOpenFeignClient { * @Author sun * @Description 根据工作人员姓名批量查询基础信息数据 **/ - @GetMapping(value = "epmetuser/customerstaff/getbyrealnames") + @PostMapping(value = "epmetuser/customerstaff/getbyrealnames") Result> getByRealNames(@RequestBody GetByRealNamesFormDTO formDTO); }