From e8cacc3cf6eb3157807dc2c7827bf027e4c01939 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 2 Nov 2021 09:20:18 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../opendata/controller/BaseGridInfoController.java | 4 ++-- .../opendata/service/impl/BaseGridInfoServiceImpl.java | 3 ++- .../src/main/resources/mapper/ExDeptDao.xml | 9 ++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java index 531ecc8cde..628c4802ca 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/controller/BaseGridInfoController.java @@ -44,7 +44,7 @@ public class BaseGridInfoController { /** * @Author sun - * @Description 组织基础信息中介库同步 + * @Description 组织基础信息中间库同步 **/ @PostMapping("agencybaseinfo") public Result getAgencyBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) { @@ -55,7 +55,7 @@ public class BaseGridInfoController { /** * @Author sun - * @Description 网格基础信息中介库同步 + * @Description 网格基础信息中间库同步 **/ @PostMapping("gridbaseinfo") public Result getGridBaseInfo(@RequestBody(required = false) GridBaseInfoFormDTO formDTO) { diff --git a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java index 8c7fd0d5c8..e50d9404e4 100644 --- a/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java +++ b/epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridInfoServiceImpl.java @@ -144,7 +144,8 @@ public class BaseGridInfoServiceImpl extends BaseServiceImpl - when grid_code = #{item.gridCode} then #{item.deptIdQx} + + when dept_name_qx = #{item.deptNameQx} then #{item.deptIdQx} @@ -29,7 +30,8 @@ - when grid_code = #{item.gridCode} then #{item.deptNameQx} + when dept_name_qx = #{item.deptNameQx} then #{item.deptIdQx} + @@ -38,7 +40,8 @@ WHERE 1=1 - grid_code = #{item.gridCode} + + dept_name_qx = #{item.deptNameQx} From b2f40e8ad9d4145b1003dddd122cf96ced1bdb3f Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 5 Nov 2021 14:17:26 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E5=92=8C=E7=BD=91=E6=A0=BC=E6=A0=91=20=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E7=BB=84=E7=BB=87=E9=87=8C=E9=9D=A2=20?= =?UTF-8?q?=E5=B9=B3=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/result/AgencyResultDTO.java | 5 +- .../epmet/dto/result/AgencyTreeResultDTO.java | 2 + .../controller/CustomerAgencyController.java | 14 ++++- .../java/com/epmet/dao/CustomerAgencyDao.java | 9 ++- .../epmet/service/CustomerAgencyService.java | 10 +++- .../impl/CustomerAgencyServiceImpl.java | 58 ++++++++++++++++++- .../resources/mapper/CustomerAgencyDao.xml | 25 ++++++-- 7 files changed, 113 insertions(+), 10 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java index e4592c5b0b..808e25d791 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java @@ -41,9 +41,12 @@ public class AgencyResultDTO implements Serializable { * 机关组织名称 */ private String agencyName = ""; + + private String pid; + private String level; /** * 所有上级组织机构ID(以英文:隔开) */ @JsonIgnore private String pids = ""; -} \ No newline at end of file +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java index 896ebfb57c..3afae3011a 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyTreeResultDTO.java @@ -24,6 +24,8 @@ public class AgencyTreeResultDTO implements Serializable { private String agencyName; private String pid; + + private String level; /** * 下级机关组织 */ 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 c3937127ba..1b12beb474 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 @@ -325,7 +325,7 @@ public class CustomerAgencyController { } /** - * @Description 获取客户下组织树 + * @Description 获取客户下组织树不含网格和部门 * @Param tokenDTO * @Return {@link Result< AgencyTreeResultDTO >} * @Author zhaoqifeng @@ -339,4 +339,16 @@ public class CustomerAgencyController { return new Result().ok(customerAgencyService.getAgencyList(formDTO)); } + /** + * @Description 获取当前登陆人的 所属组织及下级组织/网格(含直属网格)树 + * @Param tokenDTO + * @Return {@link Result< AgencyTreeResultDTO >} + * @Author zhaoqifeng + * @Date 2021/9/8 15:20 + */ + @PostMapping("agencygridtree") + public Result getOrgTreeData(@LoginUser TokenDto tokenDTO) { + return new Result().ok(customerAgencyService.getOrgTreeData(tokenDTO.getUserId())); + } + } \ No newline at end of file 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 145178f50f..971117874d 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 @@ -243,4 +243,11 @@ public interface CustomerAgencyDao extends BaseDao { AgencyTreeResultDTO getAllAgency(@Param("customerId") String customerId); List getSubAgencyList(@Param("pid") String pid); -} \ No newline at end of file + + /** + * desc:获取组织网格树 含直属网格 + * @param agencyId + * @return + */ + AgencyTreeResultDTO getAgencyGridTree(String agencyId); +} 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 b13bae23e7..96932318db 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 @@ -19,7 +19,6 @@ 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.commons.tools.utils.Result; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.*; @@ -255,4 +254,11 @@ public interface CustomerAgencyService extends BaseService * @Date 2021/9/8 15:21 */ AgencyTreeResultDTO getAgencyList(GetAgencyListFormDTO formDTO); -} \ No newline at end of file + + /** + * desc:获取用户所属组织的组织及网格树 + * @param staffId + * @return + */ + AgencyTreeResultDTO getOrgTreeData(String staffId); +} 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 fc9f181a20..451a50deb9 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 @@ -16,7 +16,6 @@ */ package com.epmet.service.impl; - import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -1107,6 +1106,63 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl%s", staffId)); + throw new RenException(CustomerAgencyConstant.SELECT_STAFF_AGENCY_EXCEPTION); + } + result.setPid(rootAgency.getPid()); + result.setAgencyName(rootAgency.getAgencyName()); + result.setAgencyId(rootAgency.getAgencyId()); + result.setLevel(rootAgency.getLevel()); + ExtStaffPermissionResultDTO res = baseDao.selectAgencyById(rootAgency.getAgencyId()); + convert2AgencyTreeResult(result,res.getSubAgencyList(),res.getGridList()); + return result; + } + /** + * 递归查询子节点 + * @param root 根节点 + * @param all 所有节点 + * @return 根节点信息 + */ + private void convert2AgencyTreeResult(AgencyTreeResultDTO root, List agencyList, List gridList) { + try { + for (ExtStaffPermissionResultDTO agency : agencyList) { + AgencyTreeResultDTO resultDTO = new AgencyTreeResultDTO(); + resultDTO.setAgencyId(agency.getAgencyId()); + resultDTO.setAgencyName(agency.getAgencyName()); + resultDTO.setPid(root.getAgencyId()); + resultDTO.setLevel(agency.getLevel()); + + if (root.getSubAgencyList() == null) { + root.setSubAgencyList(new ArrayList<>()); + } + root.getSubAgencyList().add(resultDTO); + if (CollectionUtils.isNotEmpty(agency.getSubAgencyList()) || CollectionUtils.isNotEmpty(agency.getGridList())) { + convert2AgencyTreeResult(resultDTO, agency.getSubAgencyList(), agency.getGridList()); + } + } + for (ExtGridResultDTO o : gridList) { + AgencyTreeResultDTO grid = new AgencyTreeResultDTO(); + grid.setAgencyId(o.getGridId()); + grid.setAgencyName(o.getGridName()); + grid.setPid(root.getAgencyId()); + grid.setLevel("grid"); + grid.setSubAgencyList(null); + if (root.getSubAgencyList() == null) { + root.setSubAgencyList(new ArrayList<>()); + } + root.getSubAgencyList().add(grid); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + /** * @Description 组织树最后一级没有数据的话设null * @Param agencyList 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 89a5df87f4..9d7564368e 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 @@ -304,7 +304,9 @@ SELECT ca.id AS "agencyId", ca.organization_name AS "agencyName", - ca.pids AS "pids" + ca.pids AS "pids", + ca.PID AS pid, + ca.LEVEL FROM customer_agency ca INNER JOIN customer_staff_agency csa ON ca.id = csa.agency_id @@ -507,6 +509,7 @@ + @@ -519,18 +522,32 @@ select ID AS agencyId, ORGANIZATION_NAME AS agencyName, - PID + PID, + LEVEL from customer_agency where DEL_FLAG = 0 AND PID= #{pid} ORDER BY ID + - \ No newline at end of file + From ef484d6af8fd13c4ee6e85034820985fa5a770e2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 5 Nov 2021 14:21:10 +0800 Subject: [PATCH 03/23] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/CustomerAgencyDao.xml | 12 ------------ 1 file changed, 12 deletions(-) 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 9d7564368e..f49a8cf4e6 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 @@ -530,18 +530,6 @@ AND PID= #{pid} ORDER BY ID - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index e890e36389..08bd089160 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -158,4 +158,24 @@ AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH)) ) + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml index 4189b03d16..0294005b7f 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml @@ -54,4 +54,30 @@ )and m.CUSTOMER_ID=#{customerId} order by resolvedRatio+0 desc + + + + + + \ No newline at end of file From 3a07521d40ebb35748798ee0b860d9f5a804f941 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 5 Nov 2021 15:13:23 +0800 Subject: [PATCH 06/23] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/GovOrgController.java | 31 ++++++++++++++++--- .../service/govorg/GovOrgService.java | 18 +++++++++++ .../govorg/impl/GovOrgServiceImpl.java | 23 ++++++++++++++ 3 files changed, 68 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 17f939b2c6..72815d45b3 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -9,18 +9,19 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO; +import com.epmet.dataaggre.dto.govorg.CustomerGridDTO; import com.epmet.dataaggre.dto.govorg.form.*; import com.epmet.dataaggre.dto.govorg.result.*; +import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; +import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums; import com.epmet.dataaggre.service.AggreGridService; import com.epmet.dataaggre.service.govorg.GovOrgService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; @@ -178,4 +179,26 @@ public class GovOrgController { return new Result>().ok(govOrgService.getAgencyTree(tokenDto, formDTO)); } + /** + * @Description 查询组织信息 + * @param agencyId + * @author zxc + * @date 2021/11/5 2:54 下午 + */ + @PostMapping("agency") + public Result getAgencyInfo(@RequestParam("agencyId")String agencyId){ + return new Result().ok(govOrgService.getAgencyInfo(agencyId)); + } + + /** + * @Description 查询网格信息 + * @param gridId + * @author zxc + * @date 2021/11/5 2:54 下午 + */ + @PostMapping("grid") + public Result getGridInfo(@RequestParam("gridId")String gridId){ + return new Result().ok(govOrgService.getGridInfo(gridId)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index 41b97b57ac..a927352031 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -10,6 +10,8 @@ import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO; import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; +import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; +import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; import java.util.List; @@ -154,4 +156,20 @@ public interface GovOrgService { * @Date 2021/9/23 10:14 */ List getStaffOrgList(String staffId); + + /** + * @Description 查询组织信息 + * @param agencyId + * @author zxc + * @date 2021/11/5 2:54 下午 + */ + CustomerAgencyEntity getAgencyInfo(String agencyId); + + /** + * @Description 查询网格信息 + * @param gridId + * @author zxc + * @date 2021/11/5 2:57 下午 + */ + CustomerGridEntity getGridInfo(String gridId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index d4e265cdec..eaf846cf45 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -20,6 +20,7 @@ import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO; import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO; import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity; +import com.epmet.dataaggre.entity.govorg.CustomerGridEntity; import com.epmet.dataaggre.service.commonservice.AreaCodeService; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.govorg.GovOrgService; @@ -532,4 +533,26 @@ public class GovOrgServiceImpl implements GovOrgService { return customerAgencyDao.getOrgList(staffId); } + /** + * @Description 查询组织信息 + * @param agencyId + * @author zxc + * @date 2021/11/5 2:54 下午 + */ + @Override + public CustomerAgencyEntity getAgencyInfo(String agencyId) { + return customerAgencyDao.selectById(agencyId); + } + + /** + * @Description 查询网格信息 + * @param gridId + * @author zxc + * @date 2021/11/5 2:57 下午 + */ + @Override + public CustomerGridEntity getGridInfo(String gridId) { + return customerGridDao.selectById(gridId); + } + } From 1e30a72cac4fc714c3175c22485c4ab09bc68d1b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 5 Nov 2021 15:50:00 +0800 Subject: [PATCH 07/23] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/feign/CommonAggFeignClient.java | 21 +++ .../CommonAggFeignClientFallback.java | 12 ++ .../tools/redis/common/CustomerOrgRedis.java | 93 +++++++++++++ .../redis/common/bean/AgencyInfoCache.java | 126 ++++++++++++++++++ .../redis/common/bean/GridInfoCache.java | 111 +++++++++++++++ .../controller/GovOrgController.java | 4 +- .../dataaggre/dao/govorg/CustomerGridDao.java | 8 ++ .../service/govorg/GovOrgService.java | 2 +- .../govorg/impl/GovOrgServiceImpl.java | 4 +- .../mapper/govorg/CustomerGridDao.xml | 12 ++ .../result/CategoryProjectListResultDTO.java | 5 + .../screen/impl/ScreenProjectServiceImpl.java | 29 ++-- .../mapper/screen/ScreenProjectDataDao.xml | 3 +- 13 files changed, 414 insertions(+), 16 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java index 5bfb7b698f..5a03583011 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java @@ -2,11 +2,14 @@ package com.epmet.commons.tools.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.Result; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; /** @@ -24,4 +27,22 @@ public interface CommonAggFeignClient { */ @PostMapping("/data/aggregator/epmetuser/getStaffInfo/{staffId}") Result getStaffInfo(@PathVariable("staffId") String staffId); + + /** + * @Description 查询组织信息 + * @param agencyId + * @author zxc + * @date 2021/11/5 2:54 下午 + */ + @PostMapping("/data/aggregator/org/agency") + Result getAgencyInfo(@RequestParam("agencyId")String agencyId); + + /** + * @Description 查询网格信息 + * @param gridId + * @author zxc + * @date 2021/11/5 2:54 下午 + */ + @PostMapping("/data/aggregator/org/grid") + Result getGridInfo(@RequestParam("gridId")String gridId); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java index 2495d6b588..02f209f4f2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java @@ -2,7 +2,9 @@ package com.epmet.commons.tools.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.feign.CommonAggFeignClient; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import org.springframework.stereotype.Component; @@ -20,4 +22,14 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient { public Result getStaffInfo(String staffId) { return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getStaffInfo", staffId); } + + @Override + public Result getAgencyInfo(String agencyId) { + return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId); + } + + @Override + public Result getGridInfo(String gridId) { + return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java new file mode 100644 index 0000000000..9cf82c29d6 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java @@ -0,0 +1,93 @@ +package com.epmet.commons.tools.redis.common; + +import cn.hutool.core.bean.BeanUtil; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.feign.CommonAggFeignClient; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.redis.common.bean.*; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import javax.annotation.PostConstruct; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2021/11/5 2:29 下午 + * @DESC + */ +@Slf4j +@Component +public class CustomerOrgRedis { + + @Autowired + private RedisUtils redisUtils; + + @Autowired + private CommonAggFeignClient commonAggFeignClient; + + private static CustomerOrgRedis customerOrgRedis; + private static final String ROLE_MAP_KEY = "roleMap"; + + @PostConstruct + public void init() { + customerOrgRedis = this; + customerOrgRedis.redisUtils = this.redisUtils; + customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient; + } + + /** + * @Description 获取网格信息 + * @param gridId + * @author zxc + * @date 2021/11/5 3:12 下午 + */ + public static GridInfoCache getGridInfo(String gridId){ + String key = RedisKeys.getGridInfoKey(gridId); + Map grid = customerOrgRedis.redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(grid)) { + return ConvertUtils.mapToEntity(grid, GridInfoCache.class); + } + Result gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId); + if (!gridInfoResult.success()){ + throw new RenException("查询网格信息失败..."); + } + if (null == gridInfoResult.getData()){ + throw new RenException("没有此网格信息..."); + } + Map map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true); + customerOrgRedis.redisUtils.hMSet(key, map); + return gridInfoResult.getData(); + } + + /** + * @Description 获取组织信息 + * @param agencyId + * @author zxc + * @date 2021/11/5 3:12 下午 + */ + public static AgencyInfoCache getAgencyInfo(String agencyId){ + String key = RedisKeys.getAgencyByIdKey(agencyId); + Map agency = customerOrgRedis.redisUtils.hGetAll(key); + if (!CollectionUtils.isEmpty(agency)) { + return ConvertUtils.mapToEntity(agency, AgencyInfoCache.class); + } + Result agencyInfoResult = customerOrgRedis.commonAggFeignClient.getAgencyInfo(agencyId); + if (!agencyInfoResult.success()){ + throw new RenException("查询组织信息失败..."); + } + if (null == agencyInfoResult.getData()){ + throw new RenException("没有此组织信息..."); + } + Map map = BeanUtil.beanToMap(agencyInfoResult.getData(), false, true); + customerOrgRedis.redisUtils.hMSet(key, map); + return agencyInfoResult.getData(); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java new file mode 100644 index 0000000000..90bb2aef80 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java @@ -0,0 +1,126 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2021/11/5 2:45 下午 + * @DESC + */ +@Data +public class AgencyInfoCache implements Serializable { + + private static final long serialVersionUID = -1332373159954084159L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 上级组织机构ID + */ + private String pid; + + /** + * 所有上级组织机构ID(以英文:隔开) + */ + private String pids; + + /** + * 所有上级名称,以-连接 + */ + private String allParentName; + + /** + * 组织名称 + */ + private String organizationName; + + /** + * 机关级别(社区级:community, + 乡(镇、街道)级:street, + 区县级: district, + 市级: city + 省级:province) 机关级别(社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province) + */ + private String level; + + /** + * 地区编码 + */ + private String areaCode; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 总人数 + */ + private Integer totalUser; + + /** + * 省 + */ + private String province; + + /** + * 市 + */ + private String city; + + /** + * 区县 + */ + private String district; + + /** + * 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701 + */ + private String parentAreaCode; + + /** + * 街道 + */ + private String street; + + /** + * 社区 + */ + private String community; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java new file mode 100644 index 0000000000..f41f5c6f33 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java @@ -0,0 +1,111 @@ +package com.epmet.commons.tools.redis.common.bean; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @DateTime 2021/11/5 2:24 下午 + * @DESC + */ +@Data +public class GridInfoCache implements Serializable { + + private static final long serialVersionUID = -6159429894486235267L; + + + /** + * ID 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格名称 + */ + private String gridName; + + /** 组织-网格 */ + private String gridNamePath; + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; + + /** + * 所属地区码(所属组织地区码) + */ + private String areaCode; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 管辖区域 + */ + private String manageDistrict; + + /** + * 当前网格总人数 + */ + private Integer totalUser; + + /** + * 所属组织机构ID(customer_organization.id) + */ + private String pid; + + /** + * 所有上级组织ID + */ + private String pids; + + /** + * 所属组织机构名 + */ + private String agencyName; + + /** + * 所有上级组织名 + */ + private String allParentName; +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java index 72815d45b3..14500cc2ab 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java @@ -197,8 +197,8 @@ public class GovOrgController { * @date 2021/11/5 2:54 下午 */ @PostMapping("grid") - public Result getGridInfo(@RequestParam("gridId")String gridId){ - return new Result().ok(govOrgService.getGridInfo(gridId)); + public Result getGridInfo(@RequestParam("gridId")String gridId){ + return new Result().ok(govOrgService.getGridInfo(gridId)); } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java index 56d07daafb..4ee22247f2 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java @@ -76,4 +76,12 @@ public interface CustomerGridDao extends BaseDao { **/ List getGridListByAgencyId(@Param("agencyId") String agencyId); + /** + * @Description 查询网格信息 + * @param gridId + * @author zxc + * @date 2021/11/5 3:39 下午 + */ + CustomerGridDTO getGridInfo(@Param("gridId") String gridId); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java index a927352031..77c8c33d0f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java @@ -171,5 +171,5 @@ public interface GovOrgService { * @author zxc * @date 2021/11/5 2:57 下午 */ - CustomerGridEntity getGridInfo(String gridId); + CustomerGridDTO getGridInfo(String gridId); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java index eaf846cf45..db39899f4f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java @@ -551,8 +551,8 @@ public class GovOrgServiceImpl implements GovOrgService { * @date 2021/11/5 2:57 下午 */ @Override - public CustomerGridEntity getGridInfo(String gridId) { - return customerGridDao.selectById(gridId); + public CustomerGridDTO getGridInfo(String gridId) { + return customerGridDao.getGridInfo(gridId); } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml index 0fa266afc8..387e3264b4 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml @@ -163,4 +163,16 @@ AND cg.pid = #{agencyId} + + + diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java index a4b64673ac..c1e191b8bb 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java @@ -40,6 +40,11 @@ public class CategoryProjectListResultDTO implements Serializable { */ private String createTime; + /** + * 项目ID + */ + private String projectId; + @JsonIgnore private String orgId; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index 398010d5a2..3a71dbb206 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -5,7 +5,10 @@ import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -364,20 +367,26 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { formDTO.setOrgType(FactConstant.AGENCY); } PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO(); + List list; if (formDTO.getIsPage()){ PageInfo objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus())); - List list = objectPageInfo.getList(); + list = objectPageInfo.getList(); result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); - if (!CollectionUtils.isEmpty(list)){ - list.forEach(l -> { - if (l.getOrgType().equals(FactConstant.AGENCY)){ - - }else { - - } - }); - } + }else { + list = screenProjectDataDao.selectCategoryProjectList(tokenDto.getCustomerId(), formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus()); + } + if (!CollectionUtils.isEmpty(list)){ + list.forEach(l -> { + if (l.getOrgType().equals(FactConstant.AGENCY)){ + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(l.getOrgId()); + l.setGridName(agencyInfo.getOrganizationName()); + }else { + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getOrgId()); + l.setGridName(gridInfo.getGridNamePath()); + } + }); } + result.setList(list); return result; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml index 08bd089160..27681bacad 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -167,7 +167,8 @@ IFNULL(PROJECT_TITLE,'') AS projectTitle, DATE_FORMAT(PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime, ORG_ID, - ORG_TYPE + ORG_TYPE, + PROJECT_ID FROM screen_project_data WHERE DEL_FLAG = '0' From 9066fd45d8fface7258cceef7983733f35e60c0a Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 5 Nov 2021 16:00:06 +0800 Subject: [PATCH 08/23] emm --- .../src/main/resources/mapper/govorg/CustomerGridDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml index 387e3264b4..fde243eafa 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml @@ -167,7 +167,7 @@ + \ No newline at end of file From 004a6a0e964d81df378893066729ab66cd6f16d3 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 5 Nov 2021 16:39:05 +0800 Subject: [PATCH 13/23] =?UTF-8?q?=E7=BB=8F=E7=BA=AC=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/redis/common/bean/AgencyInfoCache.java | 16 ++++++++++++++++ .../tools/redis/common/bean/GridInfoCache.java | 5 +++++ .../dataaggre/dto/govorg/CustomerGridDTO.java | 5 +++++ 3 files changed, 26 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java index 90bb2aef80..684440db65 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java @@ -123,4 +123,20 @@ public class AgencyInfoCache implements Serializable { * 社区 */ private String community; + + /** + * 坐标区域 + */ + private String coordinates; + + + /** + * 中心位置经度 + */ + private String longitude; + + /** + * 中心位置纬度 + */ + private String latitude; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java index f41f5c6f33..cf90afee5b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java @@ -108,4 +108,9 @@ public class GridInfoCache implements Serializable { * 所有上级组织名 */ private String allParentName; + + /** + * 坐标区域 + */ + private String coordinates; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java index 1488f29853..fcb6d13250 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java @@ -59,6 +59,11 @@ public class CustomerGridDTO implements Serializable { */ private String latitude; + /** + * 坐标区域 + */ + private String coordinates; + /** * 所属地区码(所属组织地区码) */ From 86b30db26840d987eb7ed0fbb60b8432922cc830 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 5 Nov 2021 16:53:46 +0800 Subject: [PATCH 14/23] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/ProjectCategoryResultDTO.java | 3 + .../data-report/data-report-server/pom.xml | 10 ++++ .../screen/ScreenProjectController.java | 52 +++++++++++++++++- .../excel/project_category_temp.xlsx | Bin 0 -> 9409 bytes 4 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java index 2d986e5773..f94fe8cb40 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.project.dto.result; import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -48,6 +49,8 @@ public class ProjectCategoryResultDTO implements Serializable { private String closedRatio; private List children; + @JsonIgnore + private int index; public ProjectCategoryResultDTO() { this.categoryCode = ""; diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 43c7bffcae..15936771b6 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -116,6 +116,16 @@ true + + org.apache.maven.plugins + maven-resources-plugin + + + xls + xlsx + + + ${project.basedir}/src/main/java diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index d71280e79a..afc882a39d 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java @@ -1,7 +1,13 @@ package com.epmet.datareport.controller.screen; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService; @@ -17,15 +23,21 @@ import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResu import com.epmet.project.dto.form.CategoryProjectListFormDTO; import com.epmet.project.dto.form.CategoryTopAppealFormDTO; import com.epmet.project.dto.form.ProjectCategoryFormDTO; -import com.epmet.project.dto.result.CategoryProjectListResultDTO; import com.epmet.project.dto.result.CategoryTopAppealResultDTO; import com.epmet.project.dto.result.PageCategoryProjectListResultDTO; import com.epmet.project.dto.result.ProjectCategoryResultDTO; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 项目 @@ -175,6 +187,44 @@ public class ScreenProjectController { ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.ProjectCategoryForm.class); return new Result>().ok(screenProjectService.selectProjectCategory(formDTO,tokenDto)); } + /** + * @Description 【项目分类】查询项目分类 + * @param formDTO + * @param tokenDto + * @author zxc + * @date 2021/11/4 3:38 下午 + */ + @PostMapping("selectprojectcategory/export") + public void selectProjectCategoryExport(@RequestBody ProjectCategoryFormDTO formDTO, /*@LoginUser*/ TokenDto tokenDto, HttpServletResponse response) throws Exception { + tokenDto.setUserId("36bc0fb38565ecdebf8ab9b476b44548"); + tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc"); + ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.ProjectCategoryForm.class); + List data = screenProjectService.selectProjectCategory(formDTO, tokenDto); + String templatePath = "excel/project_category_temp.xlsx"; + + StringBuilder dateBuilder = new StringBuilder(); + if (StringUtils.isNotBlank(formDTO.getStartTime())){ + dateBuilder.append(formDTO.getStartTime()).append(StrConstant.HYPHEN); + } + if (StringUtils.isNotBlank(formDTO.getEndTime())){ + dateBuilder.append(formDTO.getEndTime()); + } + List resultDTOList = new ArrayList<>(); + data.forEach(e->{ + resultDTOList.add(e); + e.setIndex(1); + resultDTOList.addAll(ConvertUtils.sourceToTarget(e.getChildren(),ProjectCategoryResultDTO.class)); + }); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + Map mapData = new HashMap<>(); + mapData.put("list",resultDTOList); + mapData.put("orgName",staffInfo.getAgencyName()); + mapData.put("exportDate",dateBuilder.toString()); + Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(templatePath), mapData); + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("项目分类统计.xls", "UTF-8")); + workbook.write(response.getOutputStream()); + } /** * @Description 【项目分类】查询分类下的项目 diff --git a/epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx b/epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..f12e92967d768f7ee7873566c8c431caabba3676 GIT binary patch literal 9409 zcma)C1yo#1(#G8_xMgs63ogMOg1fs6?oMzIl0bmq?iQRN!QFzpOK=JQknBFmzTNZp zIWu?8Onp^-zv`}AQ`L$xkWdI<&m&BJUFiAx?*R|`U}A5q=w$EU%%lhs!vcK)_fxEe zYrcXR91M&d0t^i8uVRJ{4vg-$HXq_Ur6F0c#IFON(5mg(7|4}bX#&IfV6|L`*z6ZN zWHAzU#_kvxfn+zZb{F=l4@hj7V?~WlZu-YtZQtRt?9Yj91t0Yh{qJ_z-WgDK~-9yJk_)b)gcWj{Oju&)h zCDL@CMJqwm~m5c zukCI82&q})6NH>!(v>_4T4fl~QncWQzvI*s$lKI{*~NEWkgmwULTCrSXqOy!BnMdj z2hp}4>y3MFxbAQ5&Y=I!ZYHv9rYMMAT@btIe`VL$-pTZt-sl7+nQmsRkQL}B(E+av zkTTK5fUm?o0S4k{3;;LnDk3iI{C9$a%@2N#ch`ruc;%kT@h2M~pDg zA2wVJK0VfCzoC@ZY%<<(WL_>7nN2_KRi+M?d<^+NEQSP(QlN>DMIwq!1*bDC47Fz3xsm z7?t9C;6Y-0jC1R? zNl<|pM*=a9`8UR0oPqYX&z$GQk3MtWcM=HVyj3opQI~Ha=AuvN6*adTlVvk@`X|61 zF#M?n&p85?$399ptU)XDNP0v+EHQO$kF$usB`giu@SqwuY}|zrN;zXu(sk-VrEP+(y6s9<2Y{~`Mm!t!%> zywi=%;6)2Pq5JUU@4bR%&NXj>t?Xi3N?ep&oLOO=!VRz0!Ltfj^jl$pnIX;2keI|92^{x#p3bh%UG>ntWJ$bFTy1 ziu(zsi-R(^iX+NunFr-QpPiSUlaBS6sA+z8;_(aaFqb@TqDFkIk$HDmzl7y$zrN(E z-@%@`ARhe+u*v3w1(aJAHb1u~voCWd**m;t()_A3$d8pFmLEPU-HO{S2tF)#I?@q5 zm+(d0H0p^5|#GGb?_mm^)Ar;WRN2oH~l6 zkD)>~QfJe!+|L=zNzva@OIeMJ%fq97Lm?KjQb;>QPN9_Cs`bc8zBIIrS~9#o@*_~# z*Rrno4&0KYrG82R3ZWrcR^n07{{SaE+I{ z%>1OqKVk&BJP2`UultjVO+hUk=_s&%k#irX6A@CyytvB$@DMBJGGIT8?R(~AA9iWN zHw`}+XHiKg0fw;yySC_xO2YHyb<0X-Q+7rq$Qa>>00$u?-q%%%o$zv@cj?p?mQ{n5RI{VXxP`D%^dvK!xC$d>&gbE#cXSqM{nLtx2bEEo^o<1I-TuaLMx=zRQvN1X z0Nj14%8qz{@IKNnLfjpRU`%JhP@k{|C*aW)taGlV0I=H5-tp35EkSbm_p#Z zSFl{4q5{O9GT;L0m>5Wx0D}(ZRoqXwaIo$e%}n;($V69SP{Gi_umI$6hqo0yz;$?v zdSSkU1fwp9F31EJvBsV^MxHyt7>mlf6sgP+@TijbXloeyZ!K*xrEU70lMTA4DPNIV z3I)q}Q{-pKQ9CZYf23EG)ev$Qn(&8vcOxyUouRl6Y|(?Kj57K|WAkD#M#0{tG_xTV zCUG1)X%|Hs#^fet5_fCGn?U&7)KmXY;OLBJ$*Fo=**%s4tr)Vn?-?F?`#>}5c`qr! zRMJCCbU0FzFkHoFQma(X$YH}qeF%8HPiQmLCqPWn5x@GLXse-=2gijV`5dhLd)oXd z=asDClZDH1ebA_Mcl^f|{!SLvE;FEA{S<88#VIUI<)|3!u=@s&+cn~Uk4(>r4k$7K zElh1qe@k>^iBiTEp~1jN@qRrR{t){q{4?AfY0B9XaG|xn*!9ymY>hWLc*#l*TQ9Iq z>53sH9YI*6YxNG@t%;O|uNixwN+=-5a$F{0*^_z!M$%tzLVtr(JOknuk;v%{opO#< zUq2axkv`x!V{K#T6uGI{>C#Z7)p!Wn(6X;WxA=}&9ug;kegDSobxVdMh zTCI$e4xYT|B##=rp@9+;!@$pNtzMzijWz@yj+%tFz@3Od-Wq{yJ4dF;Ey|)V3{S+B zwF@=xL3h399uIa#s1vz;;Bd-)6U+y!2q*y5SfXKSG>gbJGF$mtGGmavuwaTp5dbNEp3ze%XvKD2v4K>~lQ^*|)ya=U zQBga$ilj54Q&E|4+yf?k?U`hA=rR=*`VTjEU)WAABMS;*GqVKlwl2;#CSMEgw9$7% zCQ0P4m7KKS+%GD$wrBcW?+?7O`^K-|o8y(Un!PDVQnfb344__v5q& zd}YJJrt3AJv#aH;!e>7EfV#boxuLVv_Ovh55Y=E9+5^HJ4cO*_zMD3lH*#EaSx-HO#qd5qoO^jZx5?1xg?~vyHKR?Gv;Ey zU`brMdF&i96MsM{xpMKE9{SGYu%DVmt2N;utEuBO2L*GAv^y zJxtM~0`RMR{*Jdi=-Rik(bMFCqTb_)c`Qgh&d)AmZ#;*6z_8yc(*DNc$**E8-iod9V(9fkeZ#-3oNVZt)O70UdYI8HDIzdqB!(E+a<5a0 z>5dlO-ZiuKNTgk|u8(g!V}zq#E1A%|q>JK(c9 zi6z1!fNf$5slGRZOp`(?Wn}5vwun$`A1G#FG(Befg(r>x8v{_V6S6HVIpiPwphHIM zx^7i7^a)Gp=aDA(qq;HeWz8Q@0x_&>t!Vwp&`%=@QeLwGPSvZis!bou*z-kPhi3zu zL(d(>YH+cMzF>VPEYJJ=DYreDg}DveI@BMZj0S&=TN!x|71u6`U(mXF!s}*^wr) zeC!UnMT8^}1UuX9Z25+lO#T86dEpWE?|%|d-=J`-gHl&kMKCbrUylrDpofjA^K;TU zt#c5&sDb?y)AMAI7l=w{hQT*d!k0EN5Jm9`x@?M^47`~2Et~N`6>MLT84ekCv#Ehn zyy6Rll4K26jwDo|KXlb}_0bPDx%AuGCx{&ZZy!4+B6D8MzDY@<#ir|5zB`ViKHLOc zDEH;AvnVhzCme`(o<$$$_4-bDm-T8+9~Wn|T0bIp)z8|tw3%}uzP|eCVEp|+e-StM zb-9oAO1&tuqBIdh)s@BQ&U<`M9?IqfBRc1XaeULXn zbR_3=pIcW1yYetFhPt9->}U7w<8YhLYdWl#DXDENa#=3-`-7OSo%2fMZ2FEf`%IeF zjJ@7uLtlc!f$|A2&%C6P*u^d^4Vj@J?25+-(#7!TG&g6KzU|)X*_h-)sZ%O&a>1Nf zxGgf?WXaP{p6LpXi8#EhWc69EyXUlK;e8w)+=;a)d30q4J2562r1X&RiETLK%Or^l z6Yt$f;7(>73R9Mx-i7cEY+W+z4D_S8dEL`WZ`J~}-mhvZqREQwlkiohJ-n#VDjLT^ zT{qpTM$dhqm%leePyoMvxqd!#DP;FuUJRUb*L#yBtrVVg7~lQVMBefV zCquC0w;Rnlqzvz*${;|uh_Ya40hYJqgBDas^7F+h#%dom-ETZ!?^EYA&e7iTuqA#J02qv;eAKD zu&SOwhIFYJUTvuw?PbI=vn>D1AI!*FEJJ~Q$QKm{)1Ix%%!9mjI~Zp#zI-yR)0&@a zuA(gsDKFEqrXtXd*EhF*BhXsht5E?ckNZIY9lN(CrwkztWWg$Cf< zgo79Eoi}>BB);Q*k!=x@YVcG(sTsi3N;_Y+nek&TLP)sp$}w-Z0BK*+X0MUTfw-nv zEuhgIzRENXm4-}NIO8ZDV#y|q9n9Q|zIemBi#orVGHpMdqehjDP9hn+n)<}!ruSee zay`s<$h>A zZ9zQ1!Yb?gesRR0yRn&4yD-1mrL1B07;7F##aCZU%{SzXTkIhK6?d88owuD~D7bHV z>kpR6MSD>_jks9}R?EWpYw1v7G5SXsc))}h4X2a!tFyzFZ0u@v%|{Owi4S2Hg?EAd zc22N%w)N27b25}N^^ZLBtUAWcTKB6R{CCTh?bfh3{QW|C9~ByQh45Eaq5$C}twcB3 zOYnQ+2&^M|LXy>(B=GRun<|pQfKr)lRY@Wb1E9?o$ z&GtxU4aJBd-c*xh^>(gEiVNOxj*x1?(z0ufRF?NO1c;J{#Sh`HHwGBlqQne}qd=jH zNDbhV>ZU20G{2Cd@F4t@!6Rb2=V-u|7fgEGg<)4_HG(>L(f_y|`MxY}HSi6%dSVi0 z(ShU;<~f_Nm?(J>`#Myu6RH8z#;3BuEtFBZR47Fv?-&57`HYPU#MQ#Ll#D`$cJfN{ z*Z$X^&XbV9gv9NV)oa0yJ#tHH0S({o;5`ad1Ud4K{IbKq%A3e1`&Pjx=Iy z!GnMQnoM=ebQd4H?MlWrAP&CdL8G$Jpkep5XOFr9615s=XC3p&6z|kOib1z0bLGF((7stpSI&4uf5l0ih7bDE3+Xt7q zL5ML+_|_3KAQ!rqYM(}IuBYK84BgSAI;TB3Iq|eJusc8cvdyF(<9ps~o`QMWRSYC4 zXhJupS=F!YcaxFh6}~(_`tH#cs?Uksa>CXMJSdwH=iap-ZbFOY$)aX3$-=B|o0v4P zCCAaAg>S|2qb#SY%?T-H;Sn&SEi-7$hMbn_EZS&yOxc?IroVzrQh4!N0kRL?xl2jtxj6kXxPwY&p6PSy+ml%y)+17K?{l@cc`;biS5P6~?smQcYaXi?<>y5X*H4^> zq#T;GOLmV=_)f7uy|B6x{oxo{y{Qzy=5aSWezKhC1EsYd^YA($U!taGh&GfO7mpcF zg{bW52SH=en2x+cC1T##t8u;nlEFPw9)7hX6Rb3~O)hFkzV3GFi7W-)h<0N*&z7Z? z?#@&>^SPu>@^~`!=l()c21-bliVpvfOWB#Quh7>VbJ{%QWx|#u^=oBtp65DKSF5mHE8;N@7hiwIoHdUU61d`D8}h~X6@r&6lmNvpmsOFoYrGLOos+c(mw#r zOJ?SltD@>WElb+WQjWfALlzt!um zOO(&CTi2fQeVLC^trAt}kA=i&O#%+tY8}a2T`Lh;9EiK2Zxuc=2F@M&6^l8N`X1VU zfBJg@`YyQ0OA%D1wgXkEpL;Q&VuZ7Wp_8eJ3ed^Y&irQ{8j>I=(=CJ>=GJ+FhLWAw zq$&)mOOwZtD+_kSf3|%&pxfUnEdvLvCYloeKvhEc=Rh5*<48&>bBG1ff;pklT(qJnN~s&2EWv`4={r zN8IWi#E7I))#KgXHyC|mh~mL~NYjVL4=F3MX1S9OJj0WVw~uaSA7c zy~>>Y_Z)P?^Q6P&S;gOsIQiNKi7R~VHup?9i63dHHy(^M@;2PdkdaqZ_{5hs7%$id zC!);CW`vfMP*1`O_385v7;6un8k(v@;<+JUwIR~lZMu!TJH{}lOAUzhB^|Dx*pogm zi6?l=6y7miQT^QmStSWTYLEw(Krc`g`q=}|nYaT609)SXKiII;v!T ztV%DxHf^v-DGi$18jTJv35|CRTqQFh8wJj%wX=2?k#%PJUaZBp}jMoZS29fR4G` zjv(4Ril2(Z!Y`Gqh{K#cQRi+ubON4TiSa`Wj);{m6~NIyt%g zQIVAcdNWd7f*7Usg=!dOeA%r@rpv1zVdDhCr2?#rCEf=^c!?Xj-{R1|b}K7ka5{a% zWE`cN}a*{9gO_;&%P~1o~|SwDb}GkYRk5 zEK3-b?qNpjJqbKP+isI{!$zM6GLaw3nfUmp%07)zVkT%FwY3T>(N8tQ#-`nFXRLUe zv=A(j>apa)`-3Y08uord&Kb?Aa>**`bB4-VRXm9)SJh}ZR2 z9%BvTqe-+J-&0i-%Hrb?FW?b0ei_8sYNu%T^<1Jii&#Ed@gH1l;;^HFymRN;(JsYdV0cEITm%MB+@!-w%gh*%#dShbRU*D^ z>9jl2r}gQ`lSEK_9KIEroZRW^j33vo9hBq^rpP&X0OBc+4I1}xoQP(T_@LMOakk70 z%$Uy4!U$GIJEI}1KU?!7@SP4)R&e_X)!^b%)5#PnrIj(Wq6rT*65}1`6ige+2`baa zaNE=RNO0sR$x6DDlX{Xl%@mobT1Xm4c$1HY#Cmm?VaET_qEa?x_Tf;GX~Fb^H<&^~!R=ls-*vYX-bGkU%*9-jnH-bihvFX>1HsWDTe=R=M(@isENFK}CL z9JhX}{T7~SIh%tvIx?vK``i@N7PYqnn%V*NRXrR`opql#d|A?p6>P1ugWVxpN+DVkRfG1cI7mFM7u!?HfL z1fAsuyKcL6)E`IZywwtB!C`4dkl}1RcOvu=k`FCzSBsgu zm@G;W!bg-rR~@S_6-o{OkWnHFW^Xj;eFtYVBeg@{pk`NBRuspEHf5*Pv8BB8<>U6O0w&42v zNM&~|&E;2wqmk7e29X7y;=Sd|w)pyX`p@4xzZ-Ktz$nUqLty=Uw)bA7hJ(4}!`Nh)CUt#|d*M8UYdv5io zo)4hb&p%~aziartJou*uLQtyktl^Jh;s5{M_uzg)|J|DU`wIEJIrXPSG!TOzi@#uh zwyJ)g^6%-)p9)9_ek%AYZU1Z1&#n7k Date: Fri, 5 Nov 2021 17:54:19 +0800 Subject: [PATCH 15/23] emm --- .../java/com/epmet/dto/result/PersonDataResultDTO.java | 6 ++++++ .../src/main/java/com/epmet/dao/IcResiUserDao.java | 9 +++++++++ .../com/epmet/service/impl/IcResiUserServiceImpl.java | 8 ++++++++ .../src/main/resources/mapper/IcResiUserDao.xml | 5 +++++ 4 files changed, 28 insertions(+) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java index ae4082c383..9cc92f1a37 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java @@ -72,4 +72,10 @@ public class PersonDataResultDTO implements Serializable { */ @JsonIgnore private String idCard; + + /** + * 是否是志愿者 1是,0否 + */ + @JsonIgnore + private String isVolunteer; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 7a8d0e2478..0288fea156 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -124,4 +124,13 @@ public interface IcResiUserDao extends BaseDao { @MapKey("HOME_ID") Map> getHomeUserCategoryCount(@Param("buildId") String buildId); + + /** + * @Description 根据userId查询志愿者 + * @param userId + * @author zxc + * @date 2021/11/5 5:44 下午 + */ + List selectVolunteerByUserId(@Param("userId")String userId); + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index df5d844ea0..18c8896477 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -493,6 +493,14 @@ public class IcResiUserServiceImpl extends BaseServiceImpl volunteers = baseDao.selectVolunteerByUserId(formDTO.getUserId()); + volunteers.forEach(v -> { + + }); + } // TODO return personData; } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 95762a74ee..319743fe3e 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -240,4 +240,9 @@ AND BUILD_ID = #{buildId} GROUP BY HOME_ID + + + \ No newline at end of file From 0cfcd837874b716dbd4cad6c82b86ddaa8464d31 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Sun, 7 Nov 2021 00:06:54 +0800 Subject: [PATCH 16/23] =?UTF-8?q?=E4=BF=AE=E6=94=B9:=20=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E5=AF=BC=E5=85=A5=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=92=8C=E8=B7=B3=E8=BF=87=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E6=94=B6=E9=9B=86=20=E5=AE=8C=E6=88=90=E9=99=84=E5=8A=A0?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=AF=BC=E5=85=A5=E5=90=8E=E5=AF=B9=E4=B8=BB?= =?UTF-8?q?=E8=A1=A8=E4=BF=A1=E6=81=AF=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/IcResiUserDao.java | 2 +- .../com/epmet/enums/IcResiUserTableEnums.java | 82 +++++ .../handler/DynamicEasyExcelListener.java | 6 +- .../impl/IcResiUserImportServiceImpl.java | 288 +++++++++++++----- 4 files changed, 299 insertions(+), 79 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnums.java diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 45e31dd726..02f4fc5386 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -49,7 +49,7 @@ public interface IcResiUserDao extends BaseDao { * @Author sun * @Description 更新或新增居民信息各表数据 **/ - void upTable(@Param("tableName") String tableName, @Param("id") String id, @Param("map") Map map); + void upTable(@Param("tableName") String tableName, @Param("id") String id, @Param("map") Map map); List> selectListResiMap(@Param("customerId") String customerId, @Param("formCode") String formCode, diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnums.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnums.java new file mode 100644 index 0000000000..c03d5649c3 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnums.java @@ -0,0 +1,82 @@ +package com.epmet.enums; + +import lombok.AllArgsConstructor; +import lombok.Data; + +/** + * @Description 描述 + * @Author wangxianzhang + * @Date 2021/11/5 10:37 上午 + * @Version 1.0 + */ +@AllArgsConstructor +public enum IcResiUserTableEnums { + + IC_RESI_USER("ic_resi_user","社区居民基本信息录入表", 0, 3, null), + IC_PARTY_MEMBER("ic_party_member","党员信息录入表", 1, 2, "IS_PARTY"), + IC_ENSURE_HOUSE("ic_ensure_house","保障房人员信息录入表", 2, 2, "IS_ENSURE_HOUSE"), + IC_UNEMPLOYED("ic_unemployed","失业人员信息录入表", 3, 2, "IS_UNEMPLOYED"), + IC_VETERANS("ic_veterans","退役军人信息录入表", 4, 2, "IS_VETERANS"), + IC_UNITED_FRONT("ic_united_front","统战人员信息录入表", 5, 2, "IS_UNITED_FRONT"), + IC_VOLUNTEER("ic_volunteer","志愿者信息录入表", 6, 3, "IS_VOLUNTEER"), + IC_OLD_PEOPLE("ic_old_people","老年人信息录入表", 7, 2, "IS_OLD_PEOPLE"), + IC_SPECIAL("ic_special","特殊人群信息录入表", 8, 3, "IS_SPECIAL"); + + private String tableName; + private String tableComment; + private int sheetNo; + private int headRowNo; + private String mainTableFlagColumnName; + + public static IcResiUserTableEnums getObjectByTableName(String tableName) { + for (IcResiUserTableEnums i : IcResiUserTableEnums.values()) { + if (i.tableName.equals(tableName)) { + return i; + } + } + return null; + } + + + + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getTableComment() { + return tableComment; + } + + public void setTableComment(String tableComment) { + this.tableComment = tableComment; + } + + public int getSheetNo() { + return sheetNo; + } + + public void setSheetNo(int sheetNo) { + this.sheetNo = sheetNo; + } + + public int getHeadRowNo() { + return headRowNo; + } + + public void setHeadRowNo(int headRowNo) { + this.headRowNo = headRowNo; + } + + public String getMainTableFlagColumnName() { + return mainTableFlagColumnName; + } + + public void setMainTableFlagColumnName(String mainTableFlagColumnName) { + this.mainTableFlagColumnName = mainTableFlagColumnName; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/DynamicEasyExcelListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/DynamicEasyExcelListener.java index 0abf0f28d0..4c12594a45 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/DynamicEasyExcelListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/DynamicEasyExcelListener.java @@ -34,7 +34,7 @@ public class DynamicEasyExcelListener extends AnalysisEventListener headMap, AnalysisContext context) { - log.info("解析到一条头数据:{}", JSON.toJSONString(headMap)); + //log.info("解析到一条头数据:{}", JSON.toJSONString(headMap)); //存储全部表头数据 headList.add(headMap); } @@ -48,7 +48,7 @@ public class DynamicEasyExcelListener extends AnalysisEventListener data, AnalysisContext context) { - log.info("解析到一条数据:{}", JSON.toJSONString(data)); + //log.info("解析到一条数据:{}", JSON.toJSONString(data)); dataList.add(data); } @@ -60,7 +60,7 @@ public class DynamicEasyExcelListener extends AnalysisEventListener> getHeadList() { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 4e121b2e8f..e8fa1ffc79 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -1,10 +1,12 @@ package com.epmet.service.impl; import com.alibaba.excel.EasyExcelFactory; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.security.user.LoginUserUtil; @@ -19,6 +21,7 @@ import com.epmet.dto.result.FormItem; import com.epmet.dto.result.LoginUserDetailsResultDTO; import com.epmet.dto.result.OptionDTO; import com.epmet.entity.IcResiUserEntity; +import com.epmet.enums.IcResiUserTableEnums; import com.epmet.excel.handler.DynamicEasyExcelListener; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -47,7 +50,9 @@ import java.util.stream.Collectors; @Service public class IcResiUserImportServiceImpl implements IcResiUserImportService, ResultDataResolver { - public static final ThreadLocal errorRow = new ThreadLocal(); + // 错误和跳过excel行暂存 + public static final ThreadLocal>> errorRows = new ThreadLocal<>(); + public static final ThreadLocal>> skipedRows = new ThreadLocal<>(); @Autowired private LoginUserUtil loginUserUtil; @@ -80,6 +85,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res private String columnName; private String itemType; private String itemId; + + // 是否必填 + private Integer required; private List colIndexs; //private List colContents; // 单元格内容 @@ -104,13 +112,20 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res /** * 错误行信息 */ + @Data public static class ErrorRow { - private String sheetName; private String idCard; private String name; private String errorInfo; } + @Data + public static class SkipedRow { + private String idCard; + private String name; + private String info; + } + /** * 导入居民信息 * 导入主表和所有子表信息 @@ -134,19 +149,62 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(currUserAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); String customerId = agencyInfo.getCustomerId(); - importIcResiBaseInfoFromExcel(excelPathName, 0, 3, currUserAgencyId, agencyInfo.getPids(), loginUserId); - importIcResiExtraInfoFromExcel(excelPathName, 1, 2, currUserAgencyId, loginUserId, "ic_party_member", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 2, 2, currUserAgencyId, loginUserId, "ic_ensure_house", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 3, 2, currUserAgencyId, loginUserId, "ic_unemployed", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 4, 2, currUserAgencyId, loginUserId, "ic_veterans", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 5, 2, currUserAgencyId, loginUserId, "ic_united_front", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 6, 3, currUserAgencyId, loginUserId, "ic_volunteer", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 7, 2, currUserAgencyId, loginUserId, "ic_old_people", customerId); - importIcResiExtraInfoFromExcel(excelPathName, 8, 3, currUserAgencyId, loginUserId, "ic_special", customerId); + try { + initThreadLocalRowsStorage(); + + // 上传主表信息 + importIcResiBaseInfoFromExcel(excelPathName, IcResiUserTableEnums.IC_RESI_USER.getSheetNo(), IcResiUserTableEnums.IC_RESI_USER.getHeadRowNo(), + currUserAgencyId, agencyInfo.getPids(), loginUserId, IcResiUserTableEnums.IC_RESI_USER.getTableName()); + + // 上传附表信息 + for (IcResiUserTableEnums sheet : IcResiUserTableEnums.values()) { + if (sheet == IcResiUserTableEnums.IC_RESI_USER) { + continue; + } + + try { + importIcResiExtraInfoFromExcel(excelPathName, sheet.getSheetNo(), sheet.getHeadRowNo(), currUserAgencyId, loginUserId, sheet.getTableName(), customerId); + } catch (Exception e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("导入IC居民附加信息【{}】错误:{}", sheet.getTableComment(), errorMsg); + ErrorRow errorRow = new ErrorRow(); + errorRow.setName("*"); + errorRow.setIdCard("*"); + errorRows.get().get(sheet.getTableName()).add(errorRow); + } + } + + String errors = JSON.toJSONString(errorRows.get()); + String skipeds = JSON.toJSONString(skipedRows.get()); + + log.error(errors); + log.error(skipeds); + + } finally { + skipedRows.remove(); + errorRows.remove(); + } return null; } + /** + * 暂存rows信息初始化 + */ + private void initThreadLocalRowsStorage() { + Map> skipedRowsMap = new LinkedHashMap<>(); + for (IcResiUserTableEnums e : IcResiUserTableEnums.values()) { + skipedRowsMap.put(e.getTableName(), new LinkedList<>()); + } + skipedRows.set(skipedRowsMap); + + Map> errorRowsMap = new LinkedHashMap<>(); + for (IcResiUserTableEnums e : IcResiUserTableEnums.values()) { + errorRowsMap.put(e.getTableName(), new LinkedList<>()); + } + errorRows.set(errorRowsMap); + } + /** * excel导入居民基本信息 * @param sheetNo @@ -156,7 +214,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param currentUserId * @return */ - private Object importIcResiBaseInfoFromExcel(String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId) { + private Object importIcResiBaseInfoFromExcel(String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId, + String tableName) { DynamicEasyExcelListener readListener = new DynamicEasyExcelListener(); EasyExcelFactory.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead(); @@ -189,7 +248,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res Map headerColumnWrapper = convertExcelHeaders2DBColumnWrappers(formItemMap, combinedHeaders, dataList, abandonedHeaders); // 持久化 - persistIcResiBaseInfo(headerColumnWrapper, dataList, currUserAgencyId, abandonedHeaders, currUserAgencyPids, currentUserId); + persistIcResiBaseInfo(headerColumnWrapper, dataList, currUserAgencyId, abandonedHeaders, currUserAgencyPids, currentUserId, tableName); return headers; } @@ -249,39 +308,64 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res */ private void persistIcResiBaseInfo(Map headerColumnWrapper, List> dataRows, String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, - String currUserAgencyPids, String currentUserId) { + String currUserAgencyPids, String currentUserId, String tableName) { // 遍历每一行,将行内容转化为 for (Map row : dataRows) { - LinkedHashMap columnAndValues = convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel); - - columnAndValues.put("IS_ENSURE_HOUSE", "0"); - columnAndValues.put("IS_OLD_PEOPLE", "0"); - columnAndValues.put("IS_PARTY", "0"); - columnAndValues.put("IS_SPECIAL", "0"); - columnAndValues.put("IS_UNEMPLOYED", "0"); - columnAndValues.put("IS_UNITED_FRONT", "0"); - columnAndValues.put("IS_VETERANS", "0"); - columnAndValues.put("IS_VOLUNTEER", "0"); - - columnAndValues.put("AGENCY_ID", currUserAgencyId); - columnAndValues.put("PIDS", currUserAgencyPids); - columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId()); - columnAndValues.put("CREATED_BY", currentUserId); - columnAndValues.put("UPDATED_BY", currentUserId); - columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", "")); - - // 验证居民信息是否存在 - String idCard = columnAndValues.get("ID_CARD"); - LambdaQueryWrapper idCardQuery = new LambdaQueryWrapper<>(); - idCardQuery.eq(IcResiUserEntity::getIdCard, idCard); - - if (icResiUserDao.selectCount(idCardQuery) > 0) { - log.info("身份证号为【{}】的居民信息已存在,跳过导入", idCard); - } + LinkedHashMap columnAndValues = new LinkedHashMap<>(); + try { + convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues); + + columnAndValues.put("IS_ENSURE_HOUSE", "0"); + columnAndValues.put("IS_OLD_PEOPLE", "0"); + columnAndValues.put("IS_PARTY", "0"); + columnAndValues.put("IS_SPECIAL", "0"); + columnAndValues.put("IS_UNEMPLOYED", "0"); + columnAndValues.put("IS_UNITED_FRONT", "0"); + columnAndValues.put("IS_VETERANS", "0"); + columnAndValues.put("IS_VOLUNTEER", "0"); + + columnAndValues.put("AGENCY_ID", currUserAgencyId); + columnAndValues.put("PIDS", currUserAgencyPids); + columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId()); + columnAndValues.put("CREATED_BY", currentUserId); + columnAndValues.put("UPDATED_BY", currentUserId); + columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", "")); + + // 验证居民信息是否存在 + String idCard = columnAndValues.get("ID_CARD"); + LambdaQueryWrapper idCardQuery = new LambdaQueryWrapper<>(); + idCardQuery.eq(IcResiUserEntity::getIdCard, idCard); + + if (icResiUserDao.selectCount(idCardQuery) > 0) { + //log.info("身份证号为【{}】的居民信息已存在,跳过导入", idCard); + SkipedRow skipedRow = new SkipedRow(); + skipedRow.setName(columnAndValues.get("NAME")); + skipedRow.setIdCard(idCard); + skipedRow.setInfo("身份证号已存在,跳过导入"); + skipedRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(skipedRow); + continue; + } - icResiUserDao.add("ic_resi_user", columnAndValues); + icResiUserDao.add(tableName, columnAndValues); + } catch (Exception e) { + String errorMsg; + if (e instanceof RenException) { + errorMsg = e.getMessage(); + } else { + errorMsg = "未知系统错误"; + log.error(ExceptionUtils.getErrorStackTrace(e)); + } + + ErrorRow errorRow = new ErrorRow(); + errorRow.setIdCard(columnAndValues.get("ID_CARD")); + errorRow.setName(columnAndValues.get("NAME")); + errorRow.setErrorInfo(errorMsg); + errorRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(errorRow); + } finally { + columnAndValues.clear(); + } } } @@ -297,44 +381,73 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, String currentUserId, String targetTableName, String customerId) { + LinkedHashMap columnAndValues = new LinkedHashMap<>(); + // 遍历每一行,将行内容转化为 for (Map row : dataRows) { - LinkedHashMap columnAndValues = convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel); + try { + convertColumnWrappers2Map4Persist(headerColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues); - // 检验身份证号 - String idCard = columnAndValues.get("ID_CARD"); - if (StringUtils.isBlank(idCard)) { - throw new RenException(EpmetErrorCode.IDCARDNO_ERROR.getCode(), String.format("用户【%s】身份证号未填写或格式错误", columnAndValues.get("NAME"))); - } + // 检验身份证号 + String idCard = columnAndValues.get("ID_CARD"); + if (StringUtils.isBlank(idCard)) { + throw new RenException(EpmetErrorCode.IDCARDNO_ERROR.getCode(), String.format("用户【%s】身份证号未填写或格式错误", columnAndValues.get("NAME"))); + } - // 检查用户是否存在 - LambdaQueryWrapper idCardQuery = new LambdaQueryWrapper<>(); - idCardQuery.eq(IcResiUserEntity::getIdCard, idCard); + // 检查用户是否存在 + LambdaQueryWrapper idCardQuery = new LambdaQueryWrapper<>(); + idCardQuery.eq(IcResiUserEntity::getIdCard, idCard); - IcResiUserEntity icResiUserBaseInfo = icResiUserDao.selectOne(idCardQuery); - if (icResiUserBaseInfo == null) { - throw new RenException(EpmetErrorCode.RESI_NOT_FOUND.getCode(), String.format("身份证号为【%s】的居民信息未找到,请确认该居民信息存在", idCard)); - } + IcResiUserEntity icResiUserBaseInfo = icResiUserDao.selectOne(idCardQuery); + if (icResiUserBaseInfo == null) { + throw new RenException(EpmetErrorCode.RESI_NOT_FOUND.getCode(), String.format("身份证号为【%s】的居民信息未找到,请确认该居民信息存在", idCard)); + } - String icResiId = icResiUserBaseInfo.getId(); + String icResiId = icResiUserBaseInfo.getId(); - // 验证党员信息是否存在 - if (CollectionUtils.isNotEmpty(icResiUserDao.selectSubTableRecords(customerId, icResiId, targetTableName))) { - log.info("身份证号为【{}】的居民【{}】信息已存在,跳过导入", idCard, targetTableName); - continue; - } + // 验证党员信息是否存在 + if (CollectionUtils.isNotEmpty(icResiUserDao.selectSubTableRecords(customerId, icResiId, targetTableName))) { + log.info("身份证号为【{}】的居民【{}】信息已存在,跳过导入", idCard, targetTableName); + + SkipedRow skipedRow = new SkipedRow(); + skipedRow.setName(columnAndValues.get("NAME")); + skipedRow.setIdCard(columnAndValues.get("ID_CARD")); + skipedRow.setInfo("信息已存在,跳过导入"); + skipedRows.get().get(targetTableName).add(skipedRow); + + continue; + } + + columnAndValues.put("IC_RESI_USER", icResiId); - columnAndValues.put("IC_RESI_USER", icResiId); + columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId()); + columnAndValues.put("CREATED_BY", currentUserId); + columnAndValues.put("UPDATED_BY", currentUserId); + columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", "")); - columnAndValues.put("CUSTOMER_ID", loginUserUtil.getCurrentCustomerId()); - columnAndValues.put("CREATED_BY", currentUserId); - columnAndValues.put("UPDATED_BY", currentUserId); - columnAndValues.put("ID", UUID.randomUUID().toString().replace("-", "")); + columnAndValues = removeNeedlessColumns(columnAndValues); - columnAndValues = removeNeedlessColumns(columnAndValues); + icResiUserDao.add(targetTableName, columnAndValues); - icResiUserDao.add(targetTableName, columnAndValues); + updateMainTableResiTypeFlag(Objects.requireNonNull(IcResiUserTableEnums.getObjectByTableName(targetTableName)), icResiId); + } catch (Exception e) { + String errorMsg; + if (e instanceof RenException) { + errorMsg = e.getMessage(); + } else { + errorMsg = "未知系统错误"; + log.error(ExceptionUtils.getErrorStackTrace(e)); + } + + ErrorRow errorRow = new ErrorRow(); + errorRow.setName(columnAndValues.get("NAME")); + errorRow.setIdCard(columnAndValues.get("ID_CARD")); + errorRow.setErrorInfo(errorMsg); + errorRows.get().get(targetTableName).add(errorRow); + } finally { + columnAndValues.clear(); + } } } @@ -365,12 +478,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param row 当前行数据 * @param currUserAgencyId 当前用户所属机构ID * @param checkBoxOptionColumnIdxAndLabel 复选框options列表。key:列号,value:复选框中文 - * @return + * @param target 要将数据放到哪个对象中 */ - private LinkedHashMap convertColumnWrappers2Map4Persist(Map headerColumnWrapper, Map row, - String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel) { - LinkedHashMap columnAndValues = new LinkedHashMap<>(); - + private void convertColumnWrappers2Map4Persist(Map headerColumnWrapper, Map row, + String currUserAgencyId, Map checkBoxOptionColumnIdxAndLabel, + LinkedHashMap target) { + + boolean interupt = false; + + List errorColumnNames = new LinkedList<>(); + for (Map.Entry columnWrapperEntry : headerColumnWrapper.entrySet()) { ColumnWrapper columnWrapper = columnWrapperEntry.getValue(); @@ -408,10 +525,19 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String checkBoxColValue = getCheckBoxColValue(columnWrapper, row, checkBoxOptionColumnIdxAndLabel); columnWrapper.setColValue(checkBoxColValue); } - columnAndValues.put(columnWrapper.columnName, columnWrapper.colValue); + + // requiredColumns中的值为必填项 + if (columnWrapper.getRequired() == 1 && StringUtils.isBlank(columnWrapper.colValue)) { + interupt = true; + errorColumnNames.add(columnWrapper.combinedLabel); + } + + target.put(columnWrapper.columnName, columnWrapper.colValue); + } + + if (interupt) { + throw new RenException(String.join(",", errorColumnNames) + "的值未填写"); } - - return columnAndValues; } /** @@ -517,6 +643,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res columnWrapper.setCombinedLabel(combinedLabel); columnWrapper.setColumnName(item.getColumnName()); columnWrapper.setColIndexs(entry.getValue()); + columnWrapper.setRequired(item.getRequired()); columnWrapper.setOptionSourceType(item.getOptionSourceType()); columnWrapper.setOptionSourceValue(item.getOptionSourceValue()); @@ -714,5 +841,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res }*/ } + + /** + * 更新主表中人员类别标记 + * @param icResiUserTableEnum + * @param resiUserId + */ + private void updateMainTableResiTypeFlag(IcResiUserTableEnums icResiUserTableEnum, String resiUserId) { + HashMap map = new HashMap<>(); + map.put(icResiUserTableEnum.getMainTableFlagColumnName(), true); + icResiUserDao.upTable("ic_resi_user", resiUserId, map); + } } From 76de3478bb5e41e4be9ab0e23cf21ce2203f6533 Mon Sep 17 00:00:00 2001 From: lzh Date: Sun, 7 Nov 2021 15:33:54 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=B1=BB=E5=88=AB?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/BuildingResultDTO.java | 24 ++ .../epmet/feign/GovOrgOpenFeignClient.java | 3 + .../GovOrgOpenFeignClientFallback.java | 5 + .../epmet/controller/BuildingController.java | 14 +- .../java/com/epmet/dao/IcBuildingDao.java | 3 + .../com/epmet/service/BuildingService.java | 3 + .../service/impl/BuildingServiceImpl.java | 7 + .../main/resources/mapper/IcBuildingDao.xml | 20 ++ .../IcResiCategoryStatsConfigSortFormDTO.java | 3 +- .../feign/OperCustomizeOpenFeignClient.java | 14 ++ .../OperCustomizeOpenFeignClientFallback.java | 16 ++ .../ResiCategoryStatsConfigController.java | 43 ++++ .../IcResiCategoryWarnConfigEntity.java | 4 + .../ResiCategoryStatsConfigServiceImpl.java | 26 ++- .../com/epmet/dto/IcStatsResiWarnDTO.java | 111 +++++++++ .../epmet/dto/form/StatsResiListFormDTO.java | 46 ++++ .../epmet/dto/form/StatsResiWarnFormDTO.java | 55 +++++ .../dto/result/IcStatsResiResultDTO.java | 44 ++++ .../IcStatsResiWarnBuildingResultDTO.java | 58 +++++ .../result/IcStatsResiWarnUserResultDTO.java | 47 ++++ .../com/epmet/constant/LevelConstant.java | 8 + .../controller/IcStatsResiWarnController.java | 94 ++++++++ .../controller/StatsResiWarnController.java | 95 ++++++++ .../com/epmet/dao/IcStatsResiWarnDao.java | 49 ++++ .../epmet/entity/IcStatsResiWarnEntity.java | 81 +++++++ .../com/epmet/excel/IcStatsResiWarnExcel.java | 80 +++++++ .../com/epmet/redis/IcStatsResiWarnRedis.java | 47 ++++ .../epmet/service/IcStatsResiWarnService.java | 95 ++++++++ .../epmet/service/StatsResiWarnService.java | 41 ++++ .../impl/IcStatsResiWarnServiceImpl.java | 104 +++++++++ .../impl/StatsResiWarnServiceImpl.java | 210 ++++++++++++++++++ .../resources/mapper/IcStatsResiWarnDao.xml | 106 +++++++++ 32 files changed, 1553 insertions(+), 3 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcStatsResiWarnDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnBuildingResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/constant/LevelConstant.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcStatsResiWarnController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcStatsResiWarnEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcStatsResiWarnExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcStatsResiWarnRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcStatsResiWarnService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java new file mode 100644 index 0000000000..4835cefba5 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/BuildingResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/10/25 15:03 + */ +@Data +public class BuildingResultDTO implements Serializable { + private static final long serialVersionUID = -2129418426919785999L; + private String buildingId; + + private String gridName; + + private String neighborhoodName; + + private String buildingName; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 5b18f345d2..08cee7d65d 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -519,4 +519,7 @@ public interface GovOrgOpenFeignClient { @GetMapping("/gov/org/ichouse/{id}") Result get(@PathVariable("id") String id); + + @PostMapping("/gov/org/building/buildinglistbyids") + Result> buildingListByIds(@RequestBody List buildingIdList); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index c6e0f96aa4..7734d66901 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -315,6 +315,11 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "get", id); } + @Override + public Result> buildingListByIds(List buildingIdList) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "buildingListByIds", buildingIdList); + } + @Override public Result selectPidsByGridId(String gridId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java index e576abec7c..c3222f2ad4 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java @@ -37,6 +37,7 @@ import com.epmet.dto.form.IcBulidingFormDTO; import com.epmet.dto.form.IcBulidingUnitFormDTO; import com.epmet.dto.form.IcNeighborHoodFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.entity.IcBuildingUnitEntity; import com.epmet.excel.IcBuildingExcel; @@ -206,7 +207,7 @@ public class BuildingController { * @return * @throws IOException */ - @PostMapping("buildingunitlist") + public Result buildingunitlist(@LoginUser TokenDto tokenDTO,@RequestBody IcBulidingUnitFormDTO icBulidingUnitFormDTO ){ ValidatorUtils.validateEntity(icBulidingUnitFormDTO); List icBuildingUnitEntityList = icBuildingUnitDao.selectList(new QueryWrapper().lambda().eq(IcBuildingUnitEntity::getBuildingId, icBulidingUnitFormDTO.getBuildingId()).orderByAsc(IcBuildingUnitEntity::getUnitNum)); @@ -221,4 +222,15 @@ public class BuildingController { return new Result().ok(result); } + + @PostMapping("buildinglistbyids") + public Result> buildingListByIds(@RequestBody List buildingIdList){ + if(CollectionUtils.isEmpty(buildingIdList)){ + return new Result(); + } + List result = buildingService.buildingListByIds(buildingIdList); + return new Result>().ok(result); + + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java index ddae0aca45..accf59bb87 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java @@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.result.BaseInfoFamilyBuildingResultDTO; +import com.epmet.dto.result.BuildingResultDTO; import com.epmet.entity.CustomerAgencyEntity; import com.epmet.entity.IcBuildingEntity; import com.epmet.entity.IcHouseEntity; @@ -69,4 +70,6 @@ public interface IcBuildingDao extends BaseDao { * @date 2021/11/2 9:25 上午 */ List baseInfoFamilyBuilding(@Param("neighborHoodId")String neighborHoodId); + + List buildingListByIds(@Param("buildingIdList") List buildingIdList); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java index 39df4d14df..728c472116 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.dto.BuildingTreeLevelDTO; import com.epmet.dto.form.IcBulidingFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.excel.IcBuildingExcel; import com.epmet.excel.IcNeighborHoodExcel; @@ -57,4 +58,6 @@ public interface BuildingService { IcNeighborHoodResultDTO listBuilding(ListIcNeighborHoodFormDTO formDTO); void exportBuildinginfo(ListIcNeighborHoodFormDTO formDTO, HttpServletResponse response) throws Exception ; + + List buildingListByIds(List buildingIdList); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 10371e3369..ef09973b53 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -13,6 +13,7 @@ import com.epmet.dto.CustomerStaffAgencyDTO; import com.epmet.dto.IcBuildingDTO; import com.epmet.dto.form.IcBulidingFormDTO; import com.epmet.dto.form.ListIcNeighborHoodFormDTO; +import com.epmet.dto.result.BuildingResultDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.entity.*; import com.epmet.enums.BuildingTypeEnums; @@ -278,6 +279,12 @@ public class BuildingServiceImpl implements BuildingService { ExcelPoiUtils.exportExcel(templatePath ,map,"楼宇信息录入表",response); return ; } + + @Override + public List buildingListByIds(List buildingIdList) { + return icBuildingDao.buildingListByIds(buildingIdList); + } + private List searchAllBuilding(ListIcNeighborHoodFormDTO formDTO) { // QueryWrapper neighborHoodEntityQueryWrapper = new QueryWrapper<>(); diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml index 3d110df7bd..6be098c62c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml @@ -300,5 +300,25 @@ AND b.NEIGHBOR_HOOD_ID = #{neighborHoodId} + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigSortFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigSortFormDTO.java index b5e7347e4c..9e843dd7da 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigSortFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcResiCategoryStatsConfigSortFormDTO.java @@ -21,6 +21,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; @@ -44,7 +45,7 @@ public class IcResiCategoryStatsConfigSortFormDTO implements Serializable { /** * 排序 */ - @NotBlank(message = "排序不能为空") + @NotNull(message = "排序不能为空") private Integer sort; diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 7726abe6dd..519594fb62 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO; +import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; import com.epmet.dto.form.CustomerFormQueryDTO; @@ -101,4 +102,17 @@ public interface OperCustomizeOpenFeignClient { @PostMapping("/oper/customize/icresicategorystatsconfig/categorylist") Result> getCategoryList(@RequestBody IcResiCategoryStatsConfigDTO dto); + + + @PostMapping("/oper/customize/resicategorystatsconfig/resicategorystatslistshowd") + Result> resiCategoryStatsListShowd(); + + @PostMapping("/oper/customize/resicategorystatsconfig/resicategorywarnlist") + Result> resiCategoryWarnList(); + + @PostMapping("/oper/customize/resicategorystatsconfig/resicategorywarninfobyid") + Result resiCategoryWarnInfoById(@RequestBody IcResiCategoryWarnConfigDTO dto); + + + } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index c08fe76f86..cad357aca5 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.IcResiCategoryStatsConfigDTO; +import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.form.CheckFloatFootBarFormDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; import com.epmet.dto.form.CustomerFormQueryDTO; @@ -85,4 +86,19 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe public Result> getCategoryList(IcResiCategoryStatsConfigDTO dto) { return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCategoryList", dto); } + + @Override + public Result> resiCategoryStatsListShowd() { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryStatsListShowd"); + } + + @Override + public Result> resiCategoryWarnList() { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryWarnList"); + } + + @Override + public Result resiCategoryWarnInfoById(IcResiCategoryWarnConfigDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryWarnInfoById",dto); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java index be1a538f1b..c2639023d4 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/ResiCategoryStatsConfigController.java @@ -17,9 +17,11 @@ package com.epmet.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; @@ -27,17 +29,25 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dao.IcResiCategoryStatsConfigDao; +import com.epmet.dao.IcResiCategoryWarnConfigDao; import com.epmet.dto.IcResiCategoryStatsConfigDTO; +import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO; import com.epmet.dto.form.IcResiCategoryStatsConfigSortFormDTO; import com.epmet.dto.form.UpGovRoleFormDTO; import com.epmet.dto.result.IcResiCategoryStatsConfigResultDTO; +import com.epmet.entity.IcResiCategoryStatsConfigEntity; +import com.epmet.entity.IcResiCategoryWarnConfigEntity; import com.epmet.excel.IcResiCategoryStatsConfigExcel; import com.epmet.service.IcResiCategoryStatsConfigService; import com.epmet.service.ResiCategoryStatsConfigService; +import com.github.pagehelper.util.StringUtil; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; @@ -58,6 +68,10 @@ public class ResiCategoryStatsConfigController { @Autowired private ResiCategoryStatsConfigService resiCategoryStatsConfigService; + @Resource + private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao; + @Resource + private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao; /** * 居民类别配置列表 @@ -103,5 +117,34 @@ public class ResiCategoryStatsConfigController { return new Result().ok(resiCategoryStatsConfigService.info(formDTO.getId())); } + @PostMapping("resicategorystatslistshowd") + public Result> resiCategoryStatsListShowd(){ + //获取预警配置列表 + List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(new QueryWrapper() + .lambda() + .eq(IcResiCategoryStatsConfigEntity::getStatus,"show") + .orderByAsc(IcResiCategoryStatsConfigEntity::getSort)); + + return new Result>().ok(ConvertUtils.sourceToTarget(statsConfigEntityList, IcResiCategoryStatsConfigDTO.class)); + } + + @PostMapping("resicategorywarnlist") + public Result> resiCategoryWarnList(){ + //获取预警配置列表 + List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(new QueryWrapper() + .lambda() + .orderByAsc(IcResiCategoryWarnConfigEntity::getSort)); + + return new Result>().ok(ConvertUtils.sourceToTarget(warnConfigEntityList, IcResiCategoryWarnConfigDTO.class)); + } + @PostMapping("resicategorywarninfobyid") + public Result resiCategoryWarnInfoById(@RequestBody IcResiCategoryWarnConfigDTO dto){ + //获取预警配置列表 + if(StringUtils.isEmpty(dto.getId())){ + return new Result<>(); + } + return new Result().ok(ConvertUtils.sourceToTarget(icResiCategoryWarnConfigDao.selectById(dto.getId()),IcResiCategoryWarnConfigDTO.class)); + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java index a15c0c7958..f604689f81 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcResiCategoryWarnConfigEntity.java @@ -17,6 +17,7 @@ package com.epmet.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.epmet.commons.mybatis.entity.BaseEpmetEntity; @@ -66,16 +67,19 @@ public class IcResiCategoryWarnConfigEntity extends BaseEpmetEntity { /** * 等级1阈值 */ + @TableField(value = "LEVEL_1") private Integer level1; /** * 等级2阈值 */ + @TableField(value = "LEVEL_2") private Integer level2; /** * 等级3阈值 */ + @TableField(value = "LEVEL_3") private Integer level3; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java index c5003a5d78..25eb5eafd0 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/ResiCategoryStatsConfigServiceImpl.java @@ -54,7 +54,10 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf return new ArrayList<>(); } Set groupIds = icFormItemEntityList.stream().filter(item-> !"0".equals(item.getItemGroupId())).map(item->item.getItemGroupId()).collect(Collectors.toSet()); - List icFormItemGroupEntityList = icFormItemGroupDao.selectList(new QueryWrapper().lambda().in(IcFormItemGroupEntity::getId, groupIds)); + List icFormItemGroupEntityList = new ArrayList<>(); + if(!CollectionUtils.isEmpty(groupIds)){ + icFormItemGroupEntityList.addAll(icFormItemGroupDao.selectList(new QueryWrapper().lambda().in(IcFormItemGroupEntity::getId, groupIds))); + } //获取tableName和COLUMN_NAME Map tableColumnMap = new HashMap<>(); Map idTableMap = new HashMap<>(); @@ -202,6 +205,8 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf //更新配置预警 if(IcResiCategoryStatsConfigConstant.WARN_YES.equals(formDTO.getWarn())){ + //TODO 判断阈值范围 + //更新 IcResiCategoryWarnConfigEntity icResiCategoryWarnConfigEntity = icResiCategoryWarnConfigDao.selectOne(new QueryWrapper().lambda() .eq(IcResiCategoryWarnConfigEntity::getTableName, icResiCategoryStatsConfigDTO.getTableName()) @@ -259,6 +264,25 @@ public class ResiCategoryStatsConfigServiceImpl implements ResiCategoryStatsConf icResiCategoryStatsConfigEntity.setSort(formDTO.getSort()); entityList.add(icResiCategoryStatsConfigEntity); } + if(CollectionUtils.isEmpty(entityList)){ + return ; + } icResiCategoryStatsConfigService.updateBatchById(entityList); + //排序更新预警的 + List statsConfigEntityList = icResiCategoryStatsConfigDao.selectList(null); + List warnConfigEntityList = icResiCategoryWarnConfigDao.selectList(null); + if(CollectionUtils.isEmpty(warnConfigEntityList)){ + return ; + } + for (IcResiCategoryWarnConfigEntity warnConfigEntity : warnConfigEntityList) { + List collect = statsConfigEntityList.stream().filter(i -> i.getTableName().equals(warnConfigEntity.getTableName()) && i.getColumnName().equals(warnConfigEntity.getColumnName())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(collect)){ + continue; + } + warnConfigEntity.setSort(collect.get(0).getSort()); + } + icResiCategoryWarnConfigService.updateBatchById(warnConfigEntityList); + + } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcStatsResiWarnDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcStatsResiWarnDTO.java new file mode 100644 index 0000000000..006cf7fb67 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcStatsResiWarnDTO.java @@ -0,0 +1,111 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class IcStatsResiWarnDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * id + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 预警配置ID + */ + private String configId; + + /** + * 网格id + */ + private String gridId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织的所有上级组织id + */ + private String agencyPids; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 楼宇id + */ + private String buildingId; + + /** + * 该分类的居民数量 + */ + private Integer count; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private String revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private String createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java new file mode 100644 index 0000000000..1bb20c647a --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiListFormDTO.java @@ -0,0 +1,46 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class StatsResiListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 组织id + */ + @NotBlank(message = "id不能为空") + private String id; + + @NotBlank(message = "level不能为空") + private String level; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java new file mode 100644 index 0000000000..f14b15d409 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java @@ -0,0 +1,55 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class StatsResiWarnFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + public interface ListSelectedBuilding {}; + public interface ListSelectedUser {}; + + /** + * 组织id + */ + @NotBlank(message = "组织id不能为空",groups = {ListSelectedBuilding.class}) + private String agencyId; + + @NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class}) + private String configId; + @NotNull(message = "楼宇不能为空",groups = {ListSelectedUser.class}) + private List buildingIdList; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiResultDTO.java new file mode 100644 index 0000000000..4f670770f3 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiResultDTO.java @@ -0,0 +1,44 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class IcStatsResiResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + private String id; + private String label; + private Integer count; + private String managementIcon; + private String dataIcon; + private String houseShowIcon; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnBuildingResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnBuildingResultDTO.java new file mode 100644 index 0000000000..5a4369d6ba --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnBuildingResultDTO.java @@ -0,0 +1,58 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class IcStatsResiWarnBuildingResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + /** + * 预警配置ID + */ + private String configId; + + private String label; + + private Integer sort; + private Integer level1; + private Integer levelCount1; + private Integer level2; + private Integer levelCount2; + private Integer level3; + private Integer levelCount3; + + private List buildingIdList1; + private List buildingIdList2; + private List buildingIdList3; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java new file mode 100644 index 0000000000..4cd3332dca --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class IcStatsResiWarnUserResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 预警配置ID + */ + private String configId; + private String buildingId; + private String gridName; + private String neighborhoodName; + private String buildingName; + private String residentNames; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/LevelConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/LevelConstant.java new file mode 100644 index 0000000000..5cd985c11a --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/LevelConstant.java @@ -0,0 +1,8 @@ +package com.epmet.constant; + +public interface LevelConstant { + String AGENCY = "agency"; + String GRID = "grid"; + String NEIGHBORHOOD = "neighborHood"; + String BUILDING = "building"; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcStatsResiWarnController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcStatsResiWarnController.java new file mode 100644 index 0000000000..f0b9860e45 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcStatsResiWarnController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +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.dto.IcStatsResiWarnDTO; +import com.epmet.excel.IcStatsResiWarnExcel; +import com.epmet.service.IcStatsResiWarnService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@RestController +@RequestMapping("icstatsresiwarn") +public class IcStatsResiWarnController { + + @Autowired + private IcStatsResiWarnService icStatsResiWarnService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = icStatsResiWarnService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IcStatsResiWarnDTO data = icStatsResiWarnService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IcStatsResiWarnDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + icStatsResiWarnService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IcStatsResiWarnDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + icStatsResiWarnService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icStatsResiWarnService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = icStatsResiWarnService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IcStatsResiWarnExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java new file mode 100644 index 0000000000..6a872d078d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.common.token.annotation.Login; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.StatsResiListFormDTO; +import com.epmet.dto.form.StatsResiWarnFormDTO; +import com.epmet.dto.result.IcStatsResiResultDTO; +import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; +import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; +import com.epmet.service.IcStatsResiWarnService; +import com.epmet.service.StatsResiWarnService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@RestController +@RequestMapping("statsresiwarn") +public class StatsResiWarnController { + + @Autowired + private IcStatsResiWarnService icStatsResiWarnService; + + @Autowired + private StatsResiWarnService statsResiWarnService; + + @PostMapping("list") + public Result list(@RequestBody StatsResiListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + List icStatsResiResultDTOList = statsResiWarnService.list(formDTO.getId(),formDTO.getLevel()); + return new Result().ok(icStatsResiResultDTOList); + + } + + @PostMapping("buildingwarnlist") + public Result buildingWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedBuilding.class); + String agencyID = formDTO.getAgencyId(); + List icStatsResiWarnBuildingResultDTOS = statsResiWarnService.buildingwWarnList(agencyID); + return new Result().ok(icStatsResiWarnBuildingResultDTOS); + + } + @PostMapping("userwarnlist") + public Result userWarnList(@RequestBody StatsResiWarnFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.ListSelectedUser.class); + List buildingIdList = formDTO.getBuildingIdList(); + if(CollectionUtils.isEmpty(buildingIdList)){ + return new Result(); + } + List icStatsResiWarnUserResultDTOS = statsResiWarnService.userWarnList(formDTO.getConfigId(), formDTO.getBuildingIdList()); + return new Result().ok(icStatsResiWarnUserResultDTOS); + } + + /** + * 统计 + * @return + */ + @PostMapping("resiwarn") + public Result resiWarn(@LoginUser TokenDto tokenDto){ + statsResiWarnService.resiWarn(tokenDto.getCustomerId()); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java new file mode 100644 index 0000000000..0cd26050a0 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcStatsResiWarnDao.java @@ -0,0 +1,49 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcResiCategoryStatsConfigDTO; +import com.epmet.entity.IcStatsResiWarnEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Mapper +public interface IcStatsResiWarnDao extends BaseDao { + + List selectResiWarnByAgencyId(@Param("agencyId") String agencyId); + + List> userWarnList(@Param("buildingIdList") List buildingIdList, @Param("tableName") String tableName, @Param("columnName") String columnName); + + Integer countListByLevelAndCol( + @Param("tableName") String tableName, + @Param("columnName") String columnName, + @Param("id")String id, + @Param("level")String level); + + List resiWarn(@Param("tableName") String tableName,@Param("columnName") String columnName); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcStatsResiWarnEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcStatsResiWarnEntity.java new file mode 100644 index 0000000000..fd636c095b --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcStatsResiWarnEntity.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_stats_resi_warn") +public class IcStatsResiWarnEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 预警配置ID + */ + private String configId; + + /** + * 网格id + */ + private String gridId; + + /** + * 组织id + */ + private String agencyId; + + /** + * 组织的所有上级组织id + */ + private String agencyPids; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 楼宇id + */ + private String buildingId; + + /** + * 该分类的居民数量 + */ + private Integer count; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcStatsResiWarnExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcStatsResiWarnExcel.java new file mode 100644 index 0000000000..59983add12 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcStatsResiWarnExcel.java @@ -0,0 +1,80 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Data +public class IcStatsResiWarnExcel { + + @Excel(name = "id") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "预警配置ID") + private String configId; + + @Excel(name = "网格id") + private String gridId; + + @Excel(name = "组织id") + private String agencyId; + + @Excel(name = "组织的所有上级组织id") + private String agencyPids; + + @Excel(name = "小区id") + private String neighborHoodId; + + @Excel(name = "楼宇id") + private String buildingId; + + @Excel(name = "该分类的居民数量") + private Integer count; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private String revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private String createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcStatsResiWarnRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcStatsResiWarnRedis.java new file mode 100644 index 0000000000..6f143a4264 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/IcStatsResiWarnRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Component +public class IcStatsResiWarnRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcStatsResiWarnService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcStatsResiWarnService.java new file mode 100644 index 0000000000..6a0592adbe --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcStatsResiWarnService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.IcStatsResiWarnDTO; +import com.epmet.entity.IcStatsResiWarnEntity; + +import java.util.List; +import java.util.Map; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +public interface IcStatsResiWarnService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-11-04 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-11-04 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcStatsResiWarnDTO + * @author generator + * @date 2021-11-04 + */ + IcStatsResiWarnDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-04 + */ + void save(IcStatsResiWarnDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-11-04 + */ + void update(IcStatsResiWarnDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-11-04 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java new file mode 100644 index 0000000000..5192e27981 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.dto.result.IcStatsResiResultDTO; +import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; +import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; + +import java.util.List; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +public interface StatsResiWarnService{ + + List buildingwWarnList(String agencyID); + + List userWarnList(String configId, List buildingIdList); + + List list(String id, String level); + + void resiWarn(String customerId); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java new file mode 100644 index 0000000000..6d17d804ca --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcStatsResiWarnServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.IcStatsResiWarnDao; +import com.epmet.dto.IcStatsResiWarnDTO; +import com.epmet.entity.IcStatsResiWarnEntity; +import com.epmet.redis.IcStatsResiWarnRedis; +import com.epmet.service.IcStatsResiWarnService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 预警统计表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-11-04 + */ +@Service +public class IcStatsResiWarnServiceImpl extends BaseServiceImpl implements IcStatsResiWarnService { + + @Autowired + private IcStatsResiWarnRedis icStatsResiWarnRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcStatsResiWarnDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcStatsResiWarnDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IcStatsResiWarnDTO get(String id) { + IcStatsResiWarnEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcStatsResiWarnDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IcStatsResiWarnDTO dto) { + IcStatsResiWarnEntity entity = ConvertUtils.sourceToTarget(dto, IcStatsResiWarnEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IcStatsResiWarnDTO dto) { + IcStatsResiWarnEntity entity = ConvertUtils.sourceToTarget(dto, IcStatsResiWarnEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java new file mode 100644 index 0000000000..33d30a3212 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java @@ -0,0 +1,210 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IcStatsResiWarnDao; +import com.epmet.dto.IcResiCategoryStatsConfigDTO; +import com.epmet.dto.IcResiCategoryWarnConfigDTO; +import com.epmet.dto.result.BuildingResultDTO; +import com.epmet.dto.result.IcStatsResiResultDTO; +import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; +import com.epmet.dto.result.IcStatsResiWarnUserResultDTO; +import com.epmet.entity.IcStatsResiWarnEntity; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.service.IcStatsResiWarnService; +import com.epmet.service.StatsResiWarnService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; +import java.util.stream.Collectors; + +@Slf4j +@Service +public class StatsResiWarnServiceImpl implements StatsResiWarnService { + @Resource + private IcStatsResiWarnDao icStatsResiWarnDao; + + @Autowired + private IcStatsResiWarnService icStatsResiWarnService; + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; + + @Override + public List buildingwWarnList(String agencyID) { + List result = new ArrayList<>(); + //feign获取当前需要预警的配置信息以及阈值 + Result> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); + if (!warnResult.success() || null == warnResult.getData()) { + throw new RenException("预警配置查询失败:"+ warnResult.getMsg()); + } + List icResiCategoryWarnConfigDTOList = warnResult.getData(); + + if(CollectionUtils.isEmpty(icResiCategoryWarnConfigDTOList )){ + return result; + } + result = icResiCategoryWarnConfigDTOList.stream().map(item -> { + IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = new IcStatsResiWarnBuildingResultDTO(); + resiWarnBuildingResultDTO.setConfigId(item.getId()); + resiWarnBuildingResultDTO.setLabel(item.getLabel()); + resiWarnBuildingResultDTO.setLevel1(item.getLevel1()); + resiWarnBuildingResultDTO.setLevel2(item.getLevel2()); + resiWarnBuildingResultDTO.setLevel3(item.getLevel3()); + resiWarnBuildingResultDTO.setSort(item.getSort()); + resiWarnBuildingResultDTO.setLevelCount1(0); + resiWarnBuildingResultDTO.setLevelCount2(0); + resiWarnBuildingResultDTO.setLevelCount3(0); + resiWarnBuildingResultDTO.setBuildingIdList1(new ArrayList<>()); + resiWarnBuildingResultDTO.setBuildingIdList2(new ArrayList<>()); + resiWarnBuildingResultDTO.setBuildingIdList3(new ArrayList<>()); + return resiWarnBuildingResultDTO; + }).collect(Collectors.toList()); + //统计数量 + List icStatsResiWarnEntityList = icStatsResiWarnDao.selectResiWarnByAgencyId(agencyID); + if(CollectionUtils.isEmpty(icStatsResiWarnEntityList )){ + return result; + } + Map warnResultMap = result.stream().collect(Collectors.toMap(IcStatsResiWarnBuildingResultDTO::getConfigId, Function.identity(),(k1, k2)->k1)); + for (IcStatsResiWarnEntity item : icStatsResiWarnEntityList) { + //每栋楼的数量 + Integer count = Optional.ofNullable(item.getCount()).orElse(0); + IcStatsResiWarnBuildingResultDTO resiWarnBuildingResultDTO = warnResultMap.get(item.getConfigId()); + //判断数量 + Integer levle1= resiWarnBuildingResultDTO.getLevel1(); + Integer levle2= resiWarnBuildingResultDTO.getLevel2(); + Integer levle3= resiWarnBuildingResultDTO.getLevel3(); + if(0 == count){ + continue; + } + if(null!=levle1 && count>levle1){ + resiWarnBuildingResultDTO.setLevelCount1(resiWarnBuildingResultDTO.getLevelCount1()+1); + resiWarnBuildingResultDTO.getBuildingIdList1().add(item.getBuildingId()); + } + if(null!=levle1 && null!=levle2 && count<=levle1 && count>=levle2){ + resiWarnBuildingResultDTO.setLevelCount2(resiWarnBuildingResultDTO.getLevelCount2()+1); + resiWarnBuildingResultDTO.getBuildingIdList2().add(item.getBuildingId()); + } + if(null!=levle2 && null!=levle3 && count<=levle2 && count>=levle3){ + resiWarnBuildingResultDTO.setLevelCount3(resiWarnBuildingResultDTO.getLevelCount3()+1); + resiWarnBuildingResultDTO.getBuildingIdList3().add(item.getBuildingId()); + } + } + return result; + + } + + @Override + public List userWarnList(String configId, List buildingIdList) { + //feign根据buildingIdList 获取网格,小区,楼宇 信息 + Result> buildingList = govOrgOpenFeignClient.buildingListByIds(buildingIdList); + if (!buildingList.success() || null == buildingList.getData()) { + throw new RenException("楼宇信息查询失败,buildingList="+ JSON.toJSONString(buildingIdList)); + } + List buildingResultDTOList = buildingList.getData(); + + List result = ConvertUtils.sourceToTarget(buildingResultDTOList,IcStatsResiWarnUserResultDTO.class); + if(CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } + //获取configId预警配置信息 + IcResiCategoryWarnConfigDTO formDto = new IcResiCategoryWarnConfigDTO(); + formDto.setId(configId); + Result warnResult = operCustomizeOpenFeignClient.resiCategoryWarnInfoById(formDto); + if (!warnResult.success() || null == warnResult.getData()) { + throw new RenException("获取预警配置信息失败,configId="+ configId); + } + IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); + + //根据buildingID,tableName he columnName获取名字 + List> maps = icStatsResiWarnDao.userWarnList(buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); + result.forEach(item->{ + item.setConfigId(configId); + List> buildingIds = maps.stream().filter(map -> item.getBuildingId().equals(map.get("buildingId"))).collect(Collectors.toList()); + item.setResidentNames(CollectionUtils.isEmpty(buildingIds)?"":buildingIds.get(0).get("residentNames")); + }); + return result; + } + + @Override + public List list(String id, String level) { + //获取所有配置类项 getshow + Result> statsResult = operCustomizeOpenFeignClient.resiCategoryStatsListShowd(); + if (!statsResult.success() || null == statsResult.getData()) { + throw new RenException("获取配置类项失败"); + } + List icResiCategoryStatsConfigDTOList = statsResult.getData(); + //获取tableName 和columnName + List result = new ArrayList<>(); + icResiCategoryStatsConfigDTOList.forEach(item->{ + IcStatsResiResultDTO resultDTO = new IcStatsResiResultDTO(); + resultDTO.setId(item.getId()); + resultDTO.setLabel(item.getLabel()); + resultDTO.setDataIcon(item.getDataIcon()); + resultDTO.setHouseShowIcon(item.getHouseShowIcon()); + resultDTO.setManagementIcon(item.getManagementIcon()); + //根据id ,level 获取count + Integer count = icStatsResiWarnDao.countListByLevelAndCol(item.getTableName(),item.getColumnName(),id,level); + resultDTO.setCount(count); + result.add(resultDTO); + }); + return result; + } + + /** + * 统计 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void resiWarn(String customerId) { + // 获取预警配置项 + Result> warnResult = operCustomizeOpenFeignClient.resiCategoryWarnList(); + if (!warnResult.success() || null == warnResult.getData()) { + throw new RenException("预警配置查询失败:"+ warnResult.getMsg()); + } + List icResiCategoryWarnConfigDTOList = warnResult.getData(); + + //保存数据 + List icStatsResiWarnEntities = new ArrayList<>(); + for (IcResiCategoryWarnConfigDTO item : icResiCategoryWarnConfigDTOList) { + icStatsResiWarnDao.delete(new QueryWrapper().lambda().eq(IcStatsResiWarnEntity::getConfigId,item.getId())); + List maps = icStatsResiWarnDao.resiWarn(item.getTableName(), item.getColumnName()); + + + if(CollectionUtils.isEmpty(maps)){ + continue; + } + + maps.forEach(map->{ + IcStatsResiWarnEntity icStatsResiWarnEntity = new IcStatsResiWarnEntity(); + icStatsResiWarnEntity.setAgencyId(map.getAgencyId()); + icStatsResiWarnEntity.setAgencyPids(map.getAgencyPids()); + icStatsResiWarnEntity.setBuildingId(map.getBuildingId()); + icStatsResiWarnEntity.setConfigId(item.getId()); + icStatsResiWarnEntity.setCount(map.getCount()); + icStatsResiWarnEntity.setCustomerId(customerId); + icStatsResiWarnEntity.setGridId(map.getGridId()); + icStatsResiWarnEntity.setNeighborHoodId(map.getNeighborHoodId()); + icStatsResiWarnEntities.add(icStatsResiWarnEntity); + }); + + } + icStatsResiWarnService.insertBatch(icStatsResiWarnEntities,500); + + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml new file mode 100644 index 0000000000..4416ac2f2e --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 3f34a5b7acfbcd91f4039566e2698e952b9dbf48 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Sun, 7 Nov 2021 22:00:04 +0800 Subject: [PATCH 18/23] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/IcResiUserController.java | 57 +++++++++++++- .../service/IcResiUserImportService.java | 6 +- .../impl/IcResiUserImportServiceImpl.java | 74 +++++++++++++++++-- 3 files changed, 125 insertions(+), 12 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 760fd526eb..0428c20b84 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -22,6 +22,7 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; @@ -35,18 +36,26 @@ import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Workbook; import org.jetbrains.annotations.NotNull; 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.FileOutputStream; import java.io.IOException; import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.concurrent.atomic.AtomicInteger; @@ -62,12 +71,28 @@ import java.util.concurrent.atomic.AtomicInteger; public class IcResiUserController { private static final String BASE_TABLE_NAME = "ic_resi_user"; + private Path IC_RESI_UPLOAD_DIR; + @Autowired private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; @Autowired private IcResiUserService icResiUserService; @Autowired private IcResiUserImportService icResiUserImportService; + + { + // 初始化上传目录 + String home = System.getProperty("user.home"); + Path importDir = Paths.get(home, "epmet_files", "ic_user_import"); + if (Files.notExists(importDir)) { + try { + Files.createDirectories(importDir); + } catch (IOException e) { + log.error("创建数字赋能平台上传目录失败"); + } + } + IC_RESI_UPLOAD_DIR = importDir; + } @PostMapping("delete") public Result delete(@LoginUser TokenDto tokenDto,@RequestBody DelIcResiUserFormDTO formDTO){ @@ -228,9 +253,35 @@ public class IcResiUserController { * @return */ @PostMapping("import/excel") - public Result importExcelByEasyExcel() { - Object result = icResiUserImportService.importIcResiInfoFromExcel(); - return new Result().ok(result); + public void importExcelByEasyExcel(@RequestPart("file") MultipartFile file, HttpServletResponse response) { + if (file.isEmpty()) { + throw new RenException("请上传文件"); + } + + // 校验文件类型 + String extension = FilenameUtils.getExtension(file.getOriginalFilename()); + if (!"xls".equals(extension) && !"xlsx".equals(extension)) { + throw new RenException("文件类型不匹配"); + } + + Path savePath = null; + try { + String fileName = UUID.randomUUID().toString().concat(".").concat(extension); + savePath = IC_RESI_UPLOAD_DIR.resolve(fileName); + + IOUtils.copy(file.getInputStream(), new FileOutputStream(savePath.toString())); + icResiUserImportService.importIcResiInfoFromExcel(savePath.toString(), response); + } catch (IOException e) { + String errorMsg = ExceptionUtils.getErrorStackTrace(e); + log.error("【导入居民信息失败】导入失败:{}", errorMsg); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } finally { + try { + Files.delete(savePath); + } catch (IOException e) { + log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } + } } @PostMapping("test") diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java index be0d40187d..ba4d0c9458 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java @@ -1,5 +1,8 @@ package com.epmet.service; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + /** *@Description 居民信息导入service *@Author wangxianzhang @@ -7,6 +10,5 @@ package com.epmet.service; */ public interface IcResiUserImportService { - Object importIcResiInfoFromExcel(); - + void importIcResiInfoFromExcel(String excelPathName, HttpServletResponse response); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index e8fa1ffc79..6d4c874f59 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -1,5 +1,8 @@ package com.epmet.service.impl; +import cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.annotation.Excel; +import cn.afterturn.easypoi.excel.entity.ExportParams; import com.alibaba.excel.EasyExcelFactory; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -32,10 +35,14 @@ import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; import java.io.File; +import java.io.IOException; +import java.net.URLEncoder; import java.util.*; import java.util.stream.Collectors; @@ -114,15 +121,37 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res */ @Data public static class ErrorRow { + + @Excel(name = "工作表", width = 30) + private String sheetName; + + private String tableName; + + @Excel(name = "身份证号", width = 40) private String idCard; + + @Excel(name = "姓名", width = 25) private String name; + + @Excel(name = "错误信息", width = 40) private String errorInfo; } @Data public static class SkipedRow { + + @Excel(name = "工作表") + private String sheetName; + + private String tableName; + + @Excel(name = "身份证号") private String idCard; + + @Excel(name = "姓名") private String name; + + @Excel(name = "信息") private String info; } @@ -132,7 +161,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @return */ @Override - public Object importIcResiInfoFromExcel() { + public void importIcResiInfoFromExcel(String excelPathName, HttpServletResponse response) { String loginUserId = loginUserUtil.getLoginUserId(); String loginUserApp = loginUserUtil.getLoginUserApp(); String loginUserClient = loginUserUtil.getLoginUserClient(); @@ -145,7 +174,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res LoginUserDetailsResultDTO loginUserDetails = getResultDataOrThrowsException(epmetUserOpenFeignClient.getLoginUserDetails(userForm), ServiceConstant.EPMET_USER_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); String currUserAgencyId = loginUserDetails.getAgencyId(); - String excelPathName = "/opt/test/基础信息表/resi_info.xls"; + //String excelPathName = "/opt/test/基础信息表/resi_info.xls"; CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(currUserAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null); String customerId = agencyInfo.getCustomerId(); @@ -175,17 +204,20 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } String errors = JSON.toJSONString(errorRows.get()); - String skipeds = JSON.toJSONString(skipedRows.get()); + //String skipeds = JSON.toJSONString(skipedRows.get()); log.error(errors); - log.error(skipeds); + //log.error(skipeds); + try { + downLoadResults(response); + } catch (IOException e) { + log.error("【导入IC居民附加信息】下载导入结果信息失败:{}", ExceptionUtils.getErrorStackTrace(e)); + } } finally { skipedRows.remove(); errorRows.remove(); } - - return null; } /** @@ -344,6 +376,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res skipedRow.setName(columnAndValues.get("NAME")); skipedRow.setIdCard(idCard); skipedRow.setInfo("身份证号已存在,跳过导入"); + skipedRow.setTableName(tableName); skipedRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(skipedRow); continue; } @@ -362,6 +395,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res errorRow.setIdCard(columnAndValues.get("ID_CARD")); errorRow.setName(columnAndValues.get("NAME")); errorRow.setErrorInfo(errorMsg); + errorRow.setTableName(tableName); errorRows.get().get(IcResiUserTableEnums.IC_RESI_USER.getTableName()).add(errorRow); } finally { columnAndValues.clear(); @@ -414,6 +448,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res skipedRow.setName(columnAndValues.get("NAME")); skipedRow.setIdCard(columnAndValues.get("ID_CARD")); skipedRow.setInfo("信息已存在,跳过导入"); + skipedRow.setTableName(targetTableName); skipedRows.get().get(targetTableName).add(skipedRow); continue; @@ -444,6 +479,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res errorRow.setName(columnAndValues.get("NAME")); errorRow.setIdCard(columnAndValues.get("ID_CARD")); errorRow.setErrorInfo(errorMsg); + errorRow.setTableName(targetTableName); errorRows.get().get(targetTableName).add(errorRow); } finally { columnAndValues.clear(); @@ -852,5 +888,29 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res map.put(icResiUserTableEnum.getMainTableFlagColumnName(), true); icResiUserDao.upTable("ic_resi_user", resiUserId, map); } - + + /** + * 下载导入结果 + * @param response + * @throws IOException + */ + public void downLoadResults(HttpServletResponse response) throws IOException { + //public static final ThreadLocal>> errorRows = new ThreadLocal<>(); + + String fileName = "导入失败条目清单.xls"; + response.setHeader("content-Type", "application/vnd.ms-excel"); + response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8")); + + LinkedList list = new LinkedList<>(); + for (Map.Entry> entry : errorRows.get().entrySet()) { + list.addAll(entry.getValue()); + } + + list.forEach(row -> row.setSheetName(IcResiUserTableEnums.getObjectByTableName(row.tableName).getTableComment())); + + Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的条目列表","导入失败"), + ErrorRow.class, list); + + workbook.write(response.getOutputStream()); + } } From d1a1470997fdef5b49181a7d518545334e66be0e Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Sun, 7 Nov 2021 22:03:08 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E8=B0=83=E6=95=B4url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/controller/IcResiUserController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 0428c20b84..23d7cdfe47 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -252,7 +252,7 @@ public class IcResiUserController { * * @return */ - @PostMapping("import/excel") + @PostMapping("importExcel") public void importExcelByEasyExcel(@RequestPart("file") MultipartFile file, HttpServletResponse response) { if (file.isEmpty()) { throw new RenException("请上传文件"); From 0b01cbd9145d6caef6a3c4d14ec16c3f000bc255 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Nov 2021 09:19:35 +0800 Subject: [PATCH 20/23] =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../screen/impl/ScreenProjectServiceImpl.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index dc2be70ff0..3a3fe87591 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -267,16 +267,16 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { // 查询客户下的所有分类 List result = screenProjectCategoryOrgDailyDao.selectCategoryByCustomerId(tokenDto.getCustomerId()); List endCategoryList = new ArrayList<>(); - if (formDTO.getOrgType().equals(FactConstant.AGENCY)){ - Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, endTime, orgId); + if (formDTO.getOrgType().equals(FactConstant.GRID)){ + Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, endTime, orgId); endTotal = null == endTotal ? NumConstant.ZERO : endTotal; - endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,endTime,orgId); + endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,endTime,orgId); Integer total = endTotal; if (StringUtils.isNotBlank(startTime)){ - Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, startTime, orgId); + Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, startTime, orgId); startTotal = null == startTotal ? NumConstant.ZERO : startTotal; total = endTotal - startTotal; - List startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,startTime,orgId); + List startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,startTime,orgId); endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal())))); endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal())))); } @@ -286,15 +286,15 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal())); }); }else { - Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, endTime, orgId); + Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, endTime, orgId); endTotal = null == endTotal ? NumConstant.ZERO : endTotal; - endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,endTime,orgId); + endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,endTime,orgId); Integer total = endTotal; if (StringUtils.isNotBlank(startTime)){ - Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, startTime, orgId); + Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, startTime, orgId); startTotal = null == startTotal ? NumConstant.ZERO : startTotal; total = endTotal - startTotal; - List startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,startTime,orgId); + List startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,startTime,orgId); endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal())))); endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal())))); } From e2fd04117924f74bee7687a5dfe7d3066d9064c0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Nov 2021 10:14:34 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=BF=97=E6=84=BF?= =?UTF-8?q?=E8=80=85=E7=B1=BB=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/feign/OperCustomizeOpenFeignClient.java | 10 +++++++++- .../OperCustomizeOpenFeignClientFallback.java | 5 +++++ .../controller/IcFormItemOptionsController.java | 11 +++++++++++ .../java/com/epmet/dao/IcFormItemOptionsDao.java | 13 ++++++++++++- .../epmet/service/IcFormItemOptionsService.java | 8 ++++++++ .../impl/IcFormItemOptionsServiceImpl.java | 11 +++++++++++ .../resources/mapper/IcFormItemOptionsDao.xml | 15 +++++++++++++-- 7 files changed, 69 insertions(+), 4 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 519594fb62..ecfe051d35 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -16,6 +16,7 @@ import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; import java.util.List; import java.util.Set; @@ -113,6 +114,13 @@ public interface OperCustomizeOpenFeignClient { @PostMapping("/oper/customize/resicategorystatsconfig/resicategorywarninfobyid") Result resiCategoryWarnInfoById(@RequestBody IcResiCategoryWarnConfigDTO dto); - + /** + * @Description 查询志愿者类型 + * @param volunteers + * @author zxc + * @date 2021/11/8 10:02 上午 + */ + @PostMapping("/oper/customize/icformitemoptions/volunteerlabelbyvalues") + Result> volunteerLabelByValues(@RequestBody List volunteers,@RequestParam("customerId") String customerId); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index cad357aca5..b1cc198c20 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -101,4 +101,9 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe public Result resiCategoryWarnInfoById(IcResiCategoryWarnConfigDTO dto) { return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "resiCategoryWarnInfoById",dto); } + + @Override + public Result> volunteerLabelByValues(List volunteers,String customerId) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "volunteerLabelByValues",volunteers,customerId); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemOptionsController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemOptionsController.java index 5d70a901d7..262255826a 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemOptionsController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemOptionsController.java @@ -91,4 +91,15 @@ public class IcFormItemOptionsController { ExcelUtils.exportExcelToTarget(response, null, list, IcFormItemOptionsExcel.class); } + /** + * @Description 查询志愿者类型 + * @param volunteers + * @author zxc + * @date 2021/11/8 10:02 上午 + */ + @PostMapping("volunteerlabelbyvalues") + public Result> volunteerLabelByValues(@RequestBody List volunteers,@RequestParam("customerId") String customerId){ + return new Result>().ok(icFormItemOptionsService.volunteerLabelByValues(volunteers,customerId)); + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java index 3609c41f9e..d731505e3d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java @@ -20,6 +20,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.IcFormItemOptionsEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 表单项的选项 @@ -29,5 +32,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcFormItemOptionsDao extends BaseDao { - + + /** + * @Description 查询志愿者类型 + * @param volunteers + * @author zxc + * @date 2021/11/8 10:02 上午 + */ + List volunteerLabelByValues(@Param("volunteers") List volunteers,@Param("customerId")String customerId); + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemOptionsService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemOptionsService.java index 0ffe8fa5ea..387cc05412 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemOptionsService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemOptionsService.java @@ -92,4 +92,12 @@ public interface IcFormItemOptionsService extends BaseService volunteerLabelByValues(List volunteers, String customerId); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemOptionsServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemOptionsServiceImpl.java index c7ed24cd3d..144e56e568 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemOptionsServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemOptionsServiceImpl.java @@ -97,4 +97,15 @@ public class IcFormItemOptionsServiceImpl extends BaseServiceImpl volunteerLabelByValues(List volunteers,String customerId) { + return baseDao.volunteerLabelByValues(volunteers,customerId); + } + } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml index 910d1f833f..36daa2158d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml @@ -3,6 +3,17 @@ - - + + \ No newline at end of file From 9e3faebf7c1adfec72c7a4a49d0f8bab0737c4f0 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 8 Nov 2021 10:52:52 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/PersonDataResultDTO.java | 6 ++++ .../service/impl/IcResiUserServiceImpl.java | 33 ++++++++++++++++--- .../main/resources/mapper/IcResiUserDao.xml | 11 +++++-- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java index 9cc92f1a37..bde896c27c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PersonDataResultDTO.java @@ -78,4 +78,10 @@ public class PersonDataResultDTO implements Serializable { */ @JsonIgnore private String isVolunteer; + + @JsonIgnore + private String customerId; + + @JsonIgnore + private String gridId; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 18c8896477..ae1e48c735 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -31,7 +31,9 @@ import com.epmet.commons.tools.enums.HouseTypeEnum; import com.epmet.commons.tools.enums.RelationshipEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -496,12 +498,33 @@ public class IcResiUserServiceImpl extends BaseServiceImpl volunteers = baseDao.selectVolunteerByUserId(formDTO.getUserId()); - volunteers.forEach(v -> { - - }); + List volunteerList = baseDao.selectVolunteerByUserId(formDTO.getUserId()); + if (!CollectionUtils.isEmpty(volunteerList)){ + List volunteers = new ArrayList<>(); + List finalVolunteers = volunteers; + volunteerList.forEach(v -> { + List collect = Arrays.stream(v.split(",")).collect(Collectors.toList()); + finalVolunteers.addAll(collect); + }); + volunteers = volunteers.stream().distinct().collect(Collectors.toList()); + // 去customize 查询志愿者类别 + Result> volunteerResult = operCustomizeOpenFeignClient.volunteerLabelByValues(volunteers, personData.getCustomerId()); + if (!volunteerResult.success()){ + throw new RenException("查询志愿者类别失败..."); + } + personData.setVolunteerCategory(volunteerResult.getData()); + } } - // TODO + // 网格名 + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(personData.getGridId()); + if (null != gridInfo){ + personData.setGridName(gridInfo.getGridNamePath()); + } + /** + * 人员类别 + * 先查询customize配置的 + * 再根据配置去查询字段 + */ return personData; } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 319743fe3e..87ecaf57ca 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -153,6 +153,10 @@ + + + + @@ -160,11 +164,14 @@