From 248e615fbc8f50eaf48d6e556d96980e5abbea47 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 31 Dec 2021 15:26:22 +0800 Subject: [PATCH 01/25] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmetuser/impl/EpmetUserServiceImpl.java | 2 +- .../controller/CustomerStaffController.java | 28 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index c38bf062a9..a15d303bda 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -342,7 +342,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { re.setTotalTime(totalTime == "" ? "0分钟" : totalTime); //re.setTotalTime(re.getTimeNum() < 1 ? BigDecimal.ZERO + "h" : new BigDecimal(numberFormat.format((float) re.getTimeNum() / (float) 3600)) + "h"); //re.setTotalTime(re.getTimeNum() / 60 + "分钟"); - list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); + //list.stream().filter(l -> re.getGridId().equals(l.getId())).forEach(s -> re.setGridName(s.getGridName())); }); return resultList; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java index 4be5398b9e..2e0df8c89b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java @@ -218,12 +218,14 @@ public class CustomerStaffController { Result result = customerStaffService.addStaff(fromDTO); //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(fromDTO.getCustomerId()); - mq.setOrgId(result.getData().getUserId()); - mq.setOrgType("staff"); - mq.setType("staff_create"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(result.getData().getUserId()); + mq.setOrgType("staff"); + mq.setType("staff_create"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } //2021-10-18 end return result; @@ -240,12 +242,14 @@ public class CustomerStaffController { Result result = customerStaffService.editStaff(fromDTO); //2021-10-18 推送mq,数据同步到中介库 start - OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); - mq.setCustomerId(fromDTO.getCustomerId()); - mq.setOrgId(fromDTO.getStaffId()); - mq.setOrgType("staff"); - mq.setType("staff_change"); - SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + if (result.success()) { + OrgOrStaffMQMsg mq = new OrgOrStaffMQMsg(); + mq.setCustomerId(fromDTO.getCustomerId()); + mq.setOrgId(fromDTO.getStaffId()); + mq.setOrgType("staff"); + mq.setType("staff_change"); + SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendOrgStaffMqMsg(mq); + } //2021-10-18 end return result; From ae19eea8e203adf14fc12bf6c5f3c3ea9d11d931 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 6 Jan 2022 18:21:05 +0800 Subject: [PATCH 02/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=201.=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E4=BA=BA=E5=91=98=E5=B7=A5=E4=BD=9C=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=EF=BC=9A=E5=AF=BC=E5=87=BAexcel=EF=BC=8Cbean=E4=B8=AD=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B1=BB=E5=9E=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/GridMemberDataAnalysisExcelExportBean.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/GridMemberDataAnalysisExcelExportBean.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/GridMemberDataAnalysisExcelExportBean.java index 091c17c4c4..f4cc0d57ad 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/GridMemberDataAnalysisExcelExportBean.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/beans/GridMemberDataAnalysisExcelExportBean.java @@ -47,8 +47,8 @@ public class GridMemberDataAnalysisExcelExportBean { @ExcelProperty(value = {"巡查次数"}) private int patrolTimes; - @ExcelProperty(value = {"巡查时长(小时)"}) - private double totalTime; + @ExcelProperty(value = {"巡查时长"}) + private String totalTime; @ExcelProperty(value = {"例行工作次数"}) private int patrolRoutineWorkTimes; From 47c9e92540894be6cff5b47779eae7f197ef30a8 Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Thu, 6 Jan 2022 18:33:23 +0800 Subject: [PATCH 03/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=201.CustomerO?= =?UTF-8?q?rgRedis=E4=B8=AD=E6=9C=AA=E6=89=BE=E5=88=B0=E7=BD=91=E6=A0=BC?= =?UTF-8?q?=E4=B8=8D=E6=8A=9B=E5=BC=82=E5=B8=B8=EF=BC=8C=E6=94=B9=E7=94=B1?= =?UTF-8?q?=E4=B8=9A=E5=8A=A1=E4=BB=A3=E7=A0=81=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/redis/common/CustomerOrgRedis.java | 3 ++- .../dataaggre/service/impl/AggreGridServiceImpl.java | 7 +++++++ .../screen/impl/ScreenProjectServiceImpl.java | 5 +++++ .../service/impl/IcPartymemberStyleServiceImpl.java | 8 ++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) 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 index 9cf82c29d6..449a90116a 100644 --- 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 @@ -59,7 +59,8 @@ public class CustomerOrgRedis { throw new RenException("查询网格信息失败..."); } if (null == gridInfoResult.getData()){ - throw new RenException("没有此网格信息..."); + //throw new RenException("没有此网格信息..."); + return null; } Map map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true); customerOrgRedis.redisUtils.hMSet(key, map); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java index 89d865ae98..972d686151 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/AggreGridServiceImpl.java @@ -19,11 +19,14 @@ import com.epmet.dataaggre.service.epmetuser.StatsStaffPatrolRecordDailyService; import com.epmet.dataaggre.service.govorg.GovOrgService; import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import sun.rmi.runtime.Log; import java.util.*; +@Slf4j @Service public class AggreGridServiceImpl implements AggreGridService { @@ -101,6 +104,10 @@ public class AggreGridServiceImpl implements AggreGridService { for (GridMemberDataAnalysisResultDTO data : datas) { // 填充gridName GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(data.getGridId()); + if (gridInfo == null) { + log.warn("未找到网格信息:{}", data.getGridId()); + continue; + } Optional.ofNullable(gridInfo).ifPresent((d) -> data.setOrgName(d.getGridName())); // 生成结构化map 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 a40da16683..c665eed455 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 @@ -42,6 +42,7 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import sun.jvm.hotspot.memory.ContiguousSpace; import java.math.BigDecimal; import java.util.ArrayList; @@ -397,6 +398,10 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { l.setGridName(agencyInfo.getOrganizationName()); }else { GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getOrgId()); + if (gridInfo == null) { + log.warn("未找到网格信息:{}", l.getOrgId()); + return; + } l.setGridName(gridInfo.getGridNamePath()); } }); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java index f67b2fd1cf..f02233a520 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java @@ -100,6 +100,10 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl { if (StringUtils.isNotBlank(item.getGridId())) { GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getGridId()); + if(gridInfo == null) { + log.warn("未找到网格信息:{}", item.getGridId()); + return; + } item.setGridName(gridInfo.getGridName()); } }); @@ -191,6 +195,10 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl { if (StringUtils.isNotBlank(item.getGridId())) { GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getGridId()); + if (gridInfo == null) { + log.warn("未找到网格信息:{}", item.getGridId()); + return; + } item.setGridName(gridInfo.getGridName()); } }); From a6829ccbc1b65902c3de1c6bef3413ba08390dfb Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Fri, 7 Jan 2022 09:27:37 +0800 Subject: [PATCH 04/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=201=E3=80=82?= =?UTF-8?q?=E7=BD=91=E6=A0=BC=E5=91=98=E6=95=B0=E6=8D=AE=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?-=E5=88=86=E9=A1=B5=E8=A2=AB=E6=89=8B=E8=AF=AF=E7=9A=84?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataaggre/service/datastats/impl/DataStatsServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java index 5055a01925..201f8a39b6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java @@ -2172,6 +2172,7 @@ public class DataStatsServiceImpl implements DataStatsService, ResultDataResolve // throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "【pcwork查询网格员数据统计列表】传入时间条件有误"); //} + PageHelper.startPage(pageNo, pageSize, needCount); return factGridMemberStatisticsDailyDao.listGridMemberDataStatsIncr(pids, gridId, startDateID, endDateID); } } From 20aa12201dd9aa103720568015be44b9ab3f28bc Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 7 Jan 2022 10:07:49 +0800 Subject: [PATCH 05/25] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StaffPatrolRecordServiceImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java index 6e0e2d5580..9ddd74e7aa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffPatrolRecordServiceImpl.java @@ -491,6 +491,11 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl map = new HashMap<>(); for (PcworkRecordListResultDTO.StaffPatrol r : result.getList()) { + //秒变小时分钟 + Integer minutes = r.getTotalTimeNum() / 60; + String patrolDuration = (minutes / 60 > 0 ? minutes / 60 + "小时" : "") + (minutes % 60 > 0 ? minutes % 60 + "分钟" : "0分钟"); + r.setTotalTime(patrolDuration); + if (map.containsKey(r.getGridId())) { r.setGridName(map.get(r.getGridId()).getGridName()); continue; @@ -512,12 +517,6 @@ public class StaffPatrolRecordServiceImpl extends BaseServiceImpl 0 ? minutes / 60 + "小时" : "") + (minutes % 60 > 0 ? minutes % 60 + "分钟" : "0分钟"); - r.setTotalTime(patrolDuration); - } //3.封装数据并返回 resultDTO.setTotal((int)result.getTotal()); From 4f70907f034428fecf789e127a1aceca149c46d0 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 7 Jan 2022 10:54:21 +0800 Subject: [PATCH 06/25] =?UTF-8?q?=E5=BA=94=E4=BA=A7=E5=93=81=E8=A6=81?= =?UTF-8?q?=E6=B1=82=20=E9=9C=80=E6=B1=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java | 2 ++ .../java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java | 4 +++- .../src/main/resources/mapper/IcSocietyOrgDao.xml | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java index c04a76dc77..9f0357a1d7 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/GetListSocietyOrgFormDTO.java @@ -54,5 +54,7 @@ public class GetListSocietyOrgFormDTO implements Serializable { private String staffId; //token中userId所属组织的pid private String pids; + //token中userId所属组织Id + private String agencyId; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java index 52193bb4df..8c4768b2bc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcSocietyOrgServiceImpl.java @@ -117,7 +117,9 @@ public class IcSocietyOrgServiceImpl extends BaseServiceImpl result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> baseDao.getList(formDTO)); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml index 56daf5dc2b..74031c3426 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcSocietyOrgDao.xml @@ -24,8 +24,11 @@ AND customer_id = #{customerId} - + + + AND agency_id = #{agencyId} AND society_name LIKE CONCAT('%', #{societyName}, '%') From 3f7bc9a8cd46022ba887e0a557a46add84456a30 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 7 Jan 2022 13:35:43 +0800 Subject: [PATCH 07/25] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/DateUtils.java | 123 ++++++++++++++++++ .../dto/result/AppointmentTimeResultDTO.java | 3 + .../constant/PartyServiceCenterConstant.java | 4 + .../impl/IcPartyServiceCenterServiceImpl.java | 18 +++ 4 files changed, 148 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index db6abec6aa..f956423f3a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -945,4 +945,127 @@ public class DateUtils { return result; } + /** + * @Description 获取工作日时间【没有排除节假日】 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:51 上午 + */ + public static Date getWorkDay(Date startDate, int num) { + Date tomorrow = null; + int delay = 1; + while (delay <= num) { + tomorrow = getTomorrow(startDate); + if (!isWeekend(tomorrow)) { + delay++; + } + startDate = tomorrow; + } + return startDate; + } + + /** + * @Description 根据开始时间计算出 当前日期后n个工作日【没有排除节假日】包括今天 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:20 上午 + */ + public static List getWorkDayList(Date startDate, int num) { + List result = new ArrayList<>(); + Calendar rightNow = Calendar.getInstance(); + rightNow.setTime(startDate); + rightNow.add(Calendar.DATE,-1); + startDate = rightNow.getTime(); + Date tomorrow; + Integer tag = 1; + while (tag <= num){ + tomorrow = getTomorrow(startDate); + // 返回工作日 + if (!isWeekend(tomorrow)) { + result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow)); + tag++; + } + startDate = tomorrow; + } + return result; + } + + /** + * @Description 根据开始时间计算出 当前日期后n个周末【没有排除节假日】包括今天 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:20 上午 + */ + public static List getWeekendDayList(Date startDate, int num) { + List result = new ArrayList<>(); + Calendar rightNow = Calendar.getInstance(); + rightNow.setTime(startDate); + rightNow.add(Calendar.DATE,-1); + startDate = rightNow.getTime(); + Date tomorrow; + Integer tag = 1; + while (tag <= num){ + tomorrow = getTomorrow(startDate); + // 返回周末 + if (isWeekend(tomorrow)) { + result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow)); + tag++; + } + startDate = tomorrow; + } + return result; + } + + /** + * @Description 根据开始时间计算出 当前日期后n天【没有排除节假日】包括今天 + * @param startDate + * @param num + * @author zxc + * @date 2022/1/7 10:20 上午 + */ + public static List getEveryDayList(Date startDate, int num) { + List result = new ArrayList<>(); + Calendar rightNow = Calendar.getInstance(); + rightNow.setTime(startDate); + rightNow.add(Calendar.DATE,-1); + startDate = rightNow.getTime(); + Date tomorrow; + Integer tag = 1; + while (tag <= num){ + tomorrow = getTomorrow(startDate); + result.add(new SimpleDateFormat(DATE_PATTERN).format(tomorrow)); + tag++; + startDate = tomorrow; + } + return result; + } + + /** + * @Description 判断日期字符串是否为周末 + * @param date eg:yyyy-MM-dd + * @author zxc + * @date 2022/1/7 10:50 上午 + */ + private static boolean isWeekend(Date date) { + Calendar cal = Calendar.getInstance(); + cal.setTime(date); + return cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY; + } + + /** + * @Description 获取tomorrow的日期 + * @param startDate + * @author zxc + * @date 2022/1/7 10:50 上午 + */ + private static Date getTomorrow(Date startDate) { + Calendar cal = Calendar.getInstance(); + cal.setTime(startDate); + cal.add(Calendar.DAY_OF_MONTH, +1); + return cal.getTime(); + } + } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java index b37e4e913a..017d37afae 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AppointmentTimeResultDTO.java @@ -27,8 +27,11 @@ public class AppointmentTimeResultDTO implements Serializable { */ private List timeDetail; + private List dateList; + public AppointmentTimeResultDTO() { this.appointmentType = ""; this.timeDetail = new ArrayList<>(); + this.dateList = new ArrayList<>(); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java index a733afaa2f..50f6baed7e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/constant/PartyServiceCenterConstant.java @@ -13,4 +13,8 @@ public interface PartyServiceCenterConstant { String APPOINTMENT_STATUS_APPOINTING = "appointing"; String APPOINTMENT_STATUS_CANCEL = "cancel"; + String APPOINTMENT_TYPE_EVERY_DAY = "everyDay"; + String APPOINTMENT_TYPE_WORK_DAY = "workDay"; + String APPOINTMENT_TYPE_WEEKEND = "weekend"; + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java index 8522e229fb..4bd7fdc3bb 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java @@ -423,6 +423,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl l = new LambdaQueryWrapper<>(); l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) .eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getDate()) @@ -487,6 +488,23 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl getDateList(String type) { + List result = new ArrayList<>(); + if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_EVERY_DAY)){ + result = DateUtils.getEveryDayList(new Date(),NumConstant.SEVEN); + }else if (type.equals(PartyServiceCenterConstant.APPOINTMENT_TYPE_WORK_DAY)){ + result = DateUtils.getWorkDayList(new Date(),NumConstant.SEVEN); + }else { + result = DateUtils.getWeekendDayList(new Date(),NumConstant.SEVEN); + } + return result; + } + + public static void main(String[] args) { + Date date = DateUtils.addDateDays(new Date(), 2); + + } + /** * @Description 【党群服务中心】预约记录 * @param formDTO From a82c13469f11f5f11cc999950b7838a7c7b58ce7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 13:39:05 +0800 Subject: [PATCH 08/25] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=EF=BC=8C=E6=AF=8F=E5=A4=A9=EF=BC=9AeveryDay=EF=BC=8C=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E6=97=A5=EF=BC=9AworkDay=EF=BC=8C=E5=91=A8=E6=9C=AB?= =?UTF-8?q?=EF=BC=9Aweekend?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/result/AllMattersResultDTO.java | 6 ++++++ .../src/main/resources/mapper/IcPartyServiceCenterDao.xml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java index cdd4d8d7d6..f229cc1d37 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AllMattersResultDTO.java @@ -47,6 +47,11 @@ public class AllMattersResultDTO implements Serializable { @JsonIgnore private String endTime; + /** + * 预约类型,每天:everyDay,工作日:workDay,周末:weekend + */ + private String appointmentType; + public AllMattersResultDTO() { this.matterName = ""; this.allowTime = ""; @@ -55,5 +60,6 @@ public class AllMattersResultDTO implements Serializable { this.address = ""; this.workPhone = ""; this.centerName = ""; + this.appointmentType=""; } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml index 97f5e43cbf..f159698f7f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPartyServiceCenterDao.xml @@ -64,7 +64,8 @@ IFNULL(cm.MATTER_IMG,'') AS matterImg, c.ADDRESS, c.WORK_PHONE, - c.CENTER_NAME + c.CENTER_NAME, + cm.APPOINTMENT_TYPE as appointmentType FROM ic_party_service_center c INNER JOIN ic_party_service_center_matter cm ON (cm.PARTY_SERVICE_CENTER_ID = c.ID AND cm.DEL_FLAG = 0) AND c.DEL_FLAG = 0 From 7e9cc572a87728bb1a6dd8acfb5568d91fdae5be Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 7 Jan 2022 14:07:58 +0800 Subject: [PATCH 09/25] =?UTF-8?q?=E9=A2=84=E7=BA=A6=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 1 + .../impl/IcPartyServiceCenterServiceImpl.java | 33 ++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 47079e14a8..0b6f4d9e72 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -157,6 +157,7 @@ public enum EpmetErrorCode { COMMUNITY_SELF_ORGANIZATION_LIST_REPART_ERROR(8530, "%s社区自组织名称已存在"), MATTER_NAME_EXISTS_APPOINTMENT_ERROR(8532, "存在重复预约事项"), + ERROR_DATE(8533, "不合理日期"), // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java index 4bd7fdc3bb..8c313c780f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPartyServiceCenterServiceImpl.java @@ -275,6 +275,20 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl dateList = getDateList(entity.getAppointmentType()); + Boolean s = false; + for (String d : dateList) { + if (d.equals(formDTO.getAppointmentDate())){ + s = true; + } + } + if (!s){ + throw new EpmetException(EpmetErrorCode.ERROR_DATE.getCode()); + } String customerId = tokenDto.getCustomerId(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) @@ -322,6 +336,20 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl dateList = getDateList(entity.getAppointmentType()); + Boolean s = false; + for (String d : dateList) { + if (d.equals(formDTO.getAppointmentDate())){ + s = true; + } + } + if (!s){ + throw new EpmetException(EpmetErrorCode.ERROR_DATE.getCode()); + } String customerId = tokenDto.getCustomerId(); LambdaQueryWrapper l = new LambdaQueryWrapper<>(); l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) @@ -500,11 +528,6 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl Date: Fri, 7 Jan 2022 15:04:56 +0800 Subject: [PATCH 10/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dao/CustomerAgencyDao.java | 2 ++ .../com/epmet/service/impl/AgencyServiceImpl.java | 7 ++++++- .../src/main/resources/mapper/CustomerAgencyDao.xml | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) 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 d8f8d5a671..4aa6a38b2d 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 @@ -304,5 +304,7 @@ public interface CustomerAgencyDao extends BaseDao { OrgMobileResultDTO getAgencyMobile(@Param("gridId") String gridId); int updateSubAgencyAreaCode(@Param("customerId") String customerId, @Param("originalParentAreaCode")String originalParentAreaCode,@Param("operateUserId") String operateUserId); + + int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("userId") String userId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index ba1434749a..fe065b35f3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -154,7 +154,12 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setMobile(formDTO.getMobile()); if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { //如果修改了areaCode。 - customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); + if(StringUtils.isNotBlank(originalEntity.getAreaCode())){ + //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。 + customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); + }else{ + customerAgencyDao.updateSubAgencyAreaCodeById(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); + } //判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码 if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { 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 8621a77243..df5702d6db 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 @@ -732,4 +732,16 @@ AND CUSTOMER_ID = #{customerId} AND PARENT_AREA_CODE LIKE concat( #{originalParentAreaCode}, '%' ) + + + UPDATE customer_agency + SET AREA_CODE = '', + PARENT_AREA_CODE = '', + UPDATED_BY=#{operateUserId}, + UPDATED_TIME = NOW() + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} + AND pids LIKE concat('%',#{agencyId}, '%' ) + From 6700e048e7df927c829886b70152273c10c5f5b5 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 15:25:41 +0800 Subject: [PATCH 11/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E7=9A=84areaCode=EF=BC=8C=20=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E5=92=8C=E7=BD=91=E6=A0=BC=E7=9A=84=E7=BD=AE=E4=B8=BA=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dao/CustomerAgencyDao.java | 2 +- .../java/com/epmet/dao/CustomerDepartmentDao.java | 4 ++++ .../main/java/com/epmet/dao/CustomerGridDao.java | 4 ++++ .../com/epmet/service/impl/AgencyServiceImpl.java | 14 +++++++++++--- .../resources/mapper/CustomerDepartmentDao.xml | 9 +++++++++ .../src/main/resources/mapper/CustomerGridDao.xml | 8 ++++++++ 6 files changed, 37 insertions(+), 4 deletions(-) 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 4aa6a38b2d..9f036ff234 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 @@ -305,6 +305,6 @@ public interface CustomerAgencyDao extends BaseDao { int updateSubAgencyAreaCode(@Param("customerId") String customerId, @Param("originalParentAreaCode")String originalParentAreaCode,@Param("operateUserId") String operateUserId); - int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("userId") String userId); + int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index eedb383a94..4d3d2668e8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java @@ -101,4 +101,8 @@ public interface CustomerDepartmentDao extends BaseDao * @Date 2020/12/15 10:05 **/ int delDeptById(@Param("deptId")String deptId,@Param("operateUserId") String operateUserId); + + int updateSubDeptAreaCode(@Param("customerId") String customerId, + @Param("areaCode")String areaCode, + @Param("operateUserId") String operateUserId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 48dacdf82d..3bf28b37a9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -351,4 +351,8 @@ public interface CustomerGridDao extends BaseDao { * @Description 网格组织信息 **/ CustomerGridDTO gridAgencyByGrid(@Param("gridId") String gridId); + + int updateSubGridAreaCode(@Param("customerId") String customerId, + @Param("agencyId")String agencyId, + @Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index fe065b35f3..150bce1041 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -33,6 +33,7 @@ import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.OrgInfoConstant; import com.epmet.constant.RoleKeyConstants; import com.epmet.dao.CustomerAgencyDao; +import com.epmet.dao.CustomerDepartmentDao; import com.epmet.dao.CustomerGridDao; import com.epmet.dao.IcBuildingDao; import com.epmet.dto.CustomerAgencyDTO; @@ -93,7 +94,8 @@ public class AgencyServiceImpl implements AgencyService { private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private IcBuildingDao icBuildingDao; - + @Autowired + private CustomerDepartmentDao customerDepartmentDao; /** * @param formDTO @@ -153,12 +155,16 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setContacts(formDTO.getContacts()); originalEntity.setMobile(formDTO.getMobile()); if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { + CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); //如果修改了areaCode。 if(StringUtils.isNotBlank(originalEntity.getAreaCode())){ //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。 - customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); - }else{ + // customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); customerAgencyDao.updateSubAgencyAreaCodeById(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); + //网格的 + customerGridDao.updateSubGridAreaCode(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); + //部门的 + customerDepartmentDao.updateSubDeptAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); } //判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码 @@ -171,6 +177,7 @@ public class AgencyServiceImpl implements AgencyService { throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); } originalEntity.setAreaCode(formDTO.getAreaCode()); + originalEntity.setParentAreaCode(parent.getAreaCode()); }else{ //如果选择的是other,需要自定义一个编码 AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); @@ -182,6 +189,7 @@ public class AgencyServiceImpl implements AgencyService { throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); } originalEntity.setAreaCode(addAreaCodeResult.getData()); + originalEntity.setParentAreaCode(parent.getAreaCode()); } } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index 9bbe9e96b7..a3a5f3317d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -87,4 +87,13 @@ UPDATED_TIME=NOW() where id=#{deptId} + + + update customer_department + SET AREA_CODE = '', + UPDATED_BY=#{operateUserId}, + UPDATED_TIME = NOW() + where customer_id=#{customerId} + AND AREA_CODE LIKE concat(#{areaCode}, '%' ) + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index 4c34ea5bed..ef9e5ca8c3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -755,4 +755,12 @@ AND cg.id = #{gridId} + + update customer_grid + SET AREA_CODE = '', + UPDATED_BY=#{operateUserId}, + UPDATED_TIME = NOW() + where customer_id=#{customerId} + AND pids LIKE concat('%',#{agencyId}, '%' ) + From f8fb7fe8955e7124217033464ee79425e280b46c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 15:42:55 +0800 Subject: [PATCH 12/25] bugfix --- .../main/java/com/epmet/dao/CustomerDepartmentDao.java | 2 ++ .../src/main/java/com/epmet/dao/CustomerGridDao.java | 2 ++ .../java/com/epmet/service/impl/AgencyServiceImpl.java | 2 ++ .../src/main/resources/mapper/CustomerDepartmentDao.xml | 8 ++++++++ .../src/main/resources/mapper/CustomerGridDao.xml | 8 ++++++++ 5 files changed, 22 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index 4d3d2668e8..ba20e72fab 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java @@ -105,4 +105,6 @@ public interface CustomerDepartmentDao extends BaseDao int updateSubDeptAreaCode(@Param("customerId") String customerId, @Param("areaCode")String areaCode, @Param("operateUserId") String operateUserId); + + int updateDeptAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 3bf28b37a9..6bee86b049 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -355,4 +355,6 @@ public interface CustomerGridDao extends BaseDao { int updateSubGridAreaCode(@Param("customerId") String customerId, @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); + + int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 150bce1041..230bf6ee68 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -192,6 +192,8 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setParentAreaCode(parent.getAreaCode()); } } + customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode()); + customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode()); } //1:更新当前组织信息 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index a3a5f3317d..1fe7e9f906 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -96,4 +96,12 @@ where customer_id=#{customerId} AND AREA_CODE LIKE concat(#{areaCode}, '%' ) + + + update customer_department + SET AREA_CODE = #{areaCode}, + UPDATED_TIME = NOW() + where del_flag='0' + and agency_id=#{agencyId} + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index ef9e5ca8c3..ef2845201c 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -763,4 +763,12 @@ where customer_id=#{customerId} AND pids LIKE concat('%',#{agencyId}, '%' ) + + + update customer_grid + SET AREA_CODE = #{areaCode}, + UPDATED_TIME = NOW() + where del_flag='0' + and pid=#{agencyId} + From 0dfa97a374181f2c23c168b8b1a43a124900d34e Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 7 Jan 2022 15:47:35 +0800 Subject: [PATCH 13/25] pageNo+1 --- .../epmet/dataaggre/controller/GovOrgController.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 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 2101914c08..83fb682360 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 @@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.RequirePermission; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; @@ -15,7 +16,6 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dataaggre.beans.GridMemberDataAnalysisExcelExportBean; @@ -30,7 +30,6 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpStatus; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; @@ -41,7 +40,6 @@ import java.net.URLEncoder; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicReference; @@ -302,11 +300,11 @@ public class GovOrgController { PageData page; - int pageNo = 0; - int pageSize = 1000; + int pageNo = NumConstant.ZERO; + int pageSize = NumConstant.ONE_THOUSAND; do { - page = aggreGridService.getGridMemberDataAnalysis4PcWork(orgId, orgType, pageNo, pageSize, startTime, endTime, false); + page = aggreGridService.getGridMemberDataAnalysis4PcWork(orgId, orgType, pageNo++, pageSize, startTime, endTime, false); List pageList = page.getList(); List exportBeans = ConvertUtils.sourceToTarget(pageList, GridMemberDataAnalysisExcelExportBean.class); From 3f2323b1d8ae814f27ab953e7555ac0d8c1ee626 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 7 Jan 2022 16:10:40 +0800 Subject: [PATCH 14/25] pageNo+1 --- .../java/com/epmet/dataaggre/controller/GovOrgController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 83fb682360..6011344b15 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 @@ -300,7 +300,7 @@ public class GovOrgController { PageData page; - int pageNo = NumConstant.ZERO; + int pageNo = NumConstant.ONE; int pageSize = NumConstant.ONE_THOUSAND; do { From 2d4c0c8641f1aa6ae6b9006bc2e3472e7b930491 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 16:39:32 +0800 Subject: [PATCH 15/25] =?UTF-8?q?=E7=BC=96=E8=BE=91=EF=BC=8C=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=85=B6=E4=BB=96=EF=BC=8C=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/CustomerDepartmentDao.java | 4 +++- .../src/main/java/com/epmet/dao/CustomerGridDao.java | 2 +- .../java/com/epmet/service/impl/AgencyServiceImpl.java | 7 ++++--- .../src/main/resources/mapper/CustomerDepartmentDao.xml | 1 + .../src/main/resources/mapper/CustomerGridDao.xml | 1 + 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index ba20e72fab..802b67efd3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java @@ -106,5 +106,7 @@ public interface CustomerDepartmentDao extends BaseDao @Param("areaCode")String areaCode, @Param("operateUserId") String operateUserId); - int updateDeptAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode); + int updateDeptAreaCode(@Param("agencyId")String agencyId, + @Param("areaCode")String areaCode, + @Param("operateUserId") String operateUserId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index 6bee86b049..f8772354e0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -356,5 +356,5 @@ public interface CustomerGridDao extends BaseDao { @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); - int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode); + int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode,@Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 230bf6ee68..71d4aa057a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -182,7 +182,7 @@ public class AgencyServiceImpl implements AgencyService { //如果选择的是other,需要自定义一个编码 AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); - addAreaCodeFormDTO.setParentAreaCode(formDTO.getAreaCode()); + addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode()); addAreaCodeFormDTO.setName(formDTO.getAgencyName()); Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { @@ -192,8 +192,9 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setParentAreaCode(parent.getAreaCode()); } } - customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode()); - customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode()); + //更新直属部门和直属网格的areaCode + customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); + customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); } //1:更新当前组织信息 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index 1fe7e9f906..6eef0b4cc2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -100,6 +100,7 @@ update customer_department SET AREA_CODE = #{areaCode}, + UPDATED_BY=#{operateUserId}, UPDATED_TIME = NOW() where del_flag='0' and agency_id=#{agencyId} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index ef2845201c..c809cc8bfe 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -767,6 +767,7 @@ update customer_grid SET AREA_CODE = #{areaCode}, + UPDATED_BY=#{operateUserId}, UPDATED_TIME = NOW() where del_flag='0' and pid=#{agencyId} From 9e1ac20c36a0a4f296f9bcf33af89ce9f3bcb016 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 16:51:33 +0800 Subject: [PATCH 16/25] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E5=8C=BA=E5=88=92=E4=BB=A3=E7=A0=81=E4=B8=8D=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/AgencyServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 71d4aa057a..c0be7c1b31 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; @@ -154,6 +155,12 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setCode(formDTO.getCode()); originalEntity.setContacts(formDTO.getContacts()); originalEntity.setMobile(formDTO.getMobile()); + if (StringUtils.isNotBlank(originalEntity.getAreaCode()) + && originalEntity.getAreaCode().contains("UD") + && StringUtils.isNotBlank(formDTO.getAreaCode()) + && "other".equals(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); + } if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); //如果修改了areaCode。 From 30cba2794b00a4096583f6e9d8e08fc2bb750f15 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 17:18:43 +0800 Subject: [PATCH 17/25] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E7=BC=96?= =?UTF-8?q?=E7=A0=81=EF=BC=8C=E5=90=8D=E7=A7=B0=E5=B7=B2=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E7=A4=BA=E7=BB=99=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/impl/AreaCodeServiceImpl.java | 4 +++- .../main/java/com/epmet/service/impl/AgencyServiceImpl.java | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index 9a793cc0d2..0de5ddac2b 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -25,6 +25,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -616,7 +618,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl list = childDao.selectByPCodeAndName(formDTO.getParentAreaCode().trim(), formDTO.getName().trim()); if (CollUtil.isNotEmpty(list)) { - throw new RenException("name已存在"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "name已存在", "组织名称已存在"); } AreaCodeChildDTO areaCodeChildDTO = new AreaCodeChildDTO(); areaCodeChildDTO.setName(formDTO.getName().trim()); diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index c0be7c1b31..ba3c33876a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -193,7 +193,11 @@ public class AgencyServiceImpl implements AgencyService { addAreaCodeFormDTO.setName(formDTO.getAgencyName()); Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { - throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + if (addAreaCodeResult.getCode() > 8000) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } else { + throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } } originalEntity.setAreaCode(addAreaCodeResult.getData()); originalEntity.setParentAreaCode(parent.getAreaCode()); From f4279b481be15cb0e20a3247a55cac939cead0ae Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 17:27:51 +0800 Subject: [PATCH 18/25] msg --- .../src/main/java/com/epmet/service/impl/AgencyServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index ba3c33876a..6db47fbf17 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -194,7 +194,7 @@ public class AgencyServiceImpl implements AgencyService { Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { if (addAreaCodeResult.getCode() > 8000) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getMsg()); } else { throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); } From 8b8a682740df54da4c6ec0fc7359171cff6536b3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 17:46:59 +0800 Subject: [PATCH 19/25] =?UTF-8?q?+->,=E7=9C=BC=E8=81=8B=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/AgencyServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 6db47fbf17..7644a53690 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -194,7 +194,7 @@ public class AgencyServiceImpl implements AgencyService { Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { if (addAreaCodeResult.getCode() > 8000) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常"+addAreaCodeResult.getInternalMsg() , addAreaCodeResult.getMsg()); } else { throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); } From 281a0c9bc9690bc4ce80d44f1e503026e6a0d260 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 7 Jan 2022 20:23:17 +0800 Subject: [PATCH 20/25] test --- .../epmet/dto/result/AgencyListResultDTO.java | 3 +- .../dto/result/DepartmentListResultDTO.java | 1 + .../dto/result/GridBaseInfoResultDTO.java | 1 + .../java/com/epmet/dao/CustomerAgencyDao.java | 2 - .../com/epmet/dao/CustomerDepartmentDao.java | 4 - .../java/com/epmet/dao/CustomerGridDao.java | 1 - .../epmet/service/impl/AgencyServiceImpl.java | 174 +++++++++++++----- .../resources/mapper/CustomerAgencyDao.xml | 16 +- .../mapper/CustomerDepartmentDao.xml | 11 +- .../main/resources/mapper/CustomerGridDao.xml | 11 +- 10 files changed, 135 insertions(+), 89 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java index 499219f9eb..52f09a0a48 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyListResultDTO.java @@ -58,5 +58,6 @@ public class AgencyListResultDTO implements Serializable { * 联系电话 */ private String mobile = ""; - + private String areaCode; + private String parentAreaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java index 8e3b3ce418..9b2cf82cc3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/DepartmentListResultDTO.java @@ -58,4 +58,5 @@ public class DepartmentListResultDTO implements Serializable { * 联系电话 */ private String mobile = ""; + private String areaCode; } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java index 4bc56543a1..62a52464dc 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/GridBaseInfoResultDTO.java @@ -49,4 +49,5 @@ public class GridBaseInfoResultDTO implements Serializable { * 联系电话 */ private String mobile = ""; + private String areaCode; } 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 9f036ff234..8a7e8f57ce 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 @@ -303,8 +303,6 @@ public interface CustomerAgencyDao extends BaseDao { **/ OrgMobileResultDTO getAgencyMobile(@Param("gridId") String gridId); - int updateSubAgencyAreaCode(@Param("customerId") String customerId, @Param("originalParentAreaCode")String originalParentAreaCode,@Param("operateUserId") String operateUserId); - int updateSubAgencyAreaCodeById(@Param("customerId")String customerId, @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java index 802b67efd3..4d3d2668e8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerDepartmentDao.java @@ -105,8 +105,4 @@ public interface CustomerDepartmentDao extends BaseDao int updateSubDeptAreaCode(@Param("customerId") String customerId, @Param("areaCode")String areaCode, @Param("operateUserId") String operateUserId); - - int updateDeptAreaCode(@Param("agencyId")String agencyId, - @Param("areaCode")String areaCode, - @Param("operateUserId") String operateUserId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java index f8772354e0..7ae8f23367 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java @@ -356,5 +356,4 @@ public interface CustomerGridDao extends BaseDao { @Param("agencyId")String agencyId, @Param("operateUserId") String operateUserId); - int updateGridAreaCode(@Param("agencyId")String agencyId, @Param("areaCode")String areaCode,@Param("operateUserId") String operateUserId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 7644a53690..15cb3746a9 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -19,6 +19,7 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; @@ -42,6 +43,7 @@ import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerAgencyEntity; +import com.epmet.entity.CustomerDepartmentEntity; import com.epmet.entity.CustomerGridEntity; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetMessageOpenFeignClient; @@ -62,6 +64,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Arrays; +import java.util.Date; import java.util.List; /** @@ -155,57 +158,26 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setCode(formDTO.getCode()); originalEntity.setContacts(formDTO.getContacts()); originalEntity.setMobile(formDTO.getMobile()); - if (StringUtils.isNotBlank(originalEntity.getAreaCode()) - && originalEntity.getAreaCode().contains("UD") - && StringUtils.isNotBlank(formDTO.getAreaCode()) - && "other".equals(formDTO.getAreaCode())) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); - } - if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { - CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); - //如果修改了areaCode。 - if(StringUtils.isNotBlank(originalEntity.getAreaCode())){ - //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。 - // customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); - customerAgencyDao.updateSubAgencyAreaCodeById(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); - //网格的 - customerGridDao.updateSubGridAreaCode(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); - //部门的 - customerDepartmentDao.updateSubDeptAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); - } - //判断areaCodeSwitch:open: 选择地区编码必填;closed: 无需选择地区编码 - if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { - //校验areaCode是否被使用过 - if (!"other".equals(formDTO.getAreaCode())) { - List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(formDTO.getAreaCode(),formDTO.getAgencyId()); - if (CollectionUtils.isNotEmpty(agencyIds)) { - //已经被占用,提示 - throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); - } - originalEntity.setAreaCode(formDTO.getAreaCode()); - originalEntity.setParentAreaCode(parent.getAreaCode()); - }else{ - //如果选择的是other,需要自定义一个编码 - AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); - addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); - addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode()); - addAreaCodeFormDTO.setName(formDTO.getAgencyName()); - Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); - if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { - if (addAreaCodeResult.getCode() > 8000) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常"+addAreaCodeResult.getInternalMsg() , addAreaCodeResult.getMsg()); - } else { - throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); - } - } - originalEntity.setAreaCode(addAreaCodeResult.getData()); - originalEntity.setParentAreaCode(parent.getAreaCode()); - } + //当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码 + if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { + //开关开启后,areaCode必填 + String originalAreaCode =originalEntity.getAreaCode(); + checkEditAgencyFormDTO(formDTO,originalAreaCode); + // 1、之前当前组织没有编码,本次修改设置了编码 + // 2、之前已经有编码,本次修改为了其他编码 + if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { + CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); + String newAreaCode=getAgencyNewAreaCode(formDTO,parent); + originalEntity.setAreaCode(newAreaCode); + originalEntity.setParentAreaCode(parent.getAreaCode()); + formDTO.setAreaCode(newAreaCode); + } + //什么时候要全部置为空呢?原来没有现在有 || 原来与现在不一致 + if ((StringUtils.isBlank(originalAreaCode) && StringUtils.isNotBlank(formDTO.getAreaCode())) + || (!formDTO.getAreaCode().equals(originalAreaCode))) { + updateSubOrg(originalEntity.getCustomerId(),formDTO,originalAreaCode); } - //更新直属部门和直属网格的areaCode - customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); - customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); } //1:更新当前组织信息 @@ -252,6 +224,104 @@ public class AgencyServiceImpl implements AgencyService { return result; } + /** + * 所有下家组织、网格、部门的area_code,parent_area_code置为空 + * 直属组织parent_area_code、直属网格+直属部门的area_code更新为最新值 + * @param customerId + * @param formDTO + * @param originalAreaCode + */ + private void updateSubOrg(String customerId, EditAgencyFormDTO formDTO,String originalAreaCode) { + //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。 + customerAgencyDao.updateSubAgencyAreaCodeById(customerId, formDTO.getAgencyId(), formDTO.getUserId()); + //网格的 + customerGridDao.updateSubGridAreaCode(customerId, formDTO.getAgencyId(), formDTO.getUserId()); + //部门的 + customerDepartmentDao.updateSubDeptAreaCode(customerId, originalAreaCode, formDTO.getUserId()); + + //1、更新直属网格的areaCode + LambdaUpdateWrapper updateGridWrapper = new LambdaUpdateWrapper<>(); + updateGridWrapper.eq(CustomerGridEntity::getPid,formDTO.getAgencyId()) + .set(CustomerGridEntity::getAreaCode, formDTO.getAreaCode()) + .set(CustomerGridEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerGridEntity::getUpdatedTime,new Date()); + int subGridRows=customerGridDao.update(null,updateGridWrapper); + log.info(String.format("更新了%s个直属网格的area_code",subGridRows)); + + // 2、更新直属部门的area_code + LambdaUpdateWrapper updateDeptWrapper = new LambdaUpdateWrapper<>(); + updateDeptWrapper.eq(CustomerDepartmentEntity::getAgencyId,formDTO.getAgencyId()) + .set(CustomerDepartmentEntity::getAreaCode, formDTO.getAreaCode()) + .set(CustomerDepartmentEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerDepartmentEntity::getUpdatedTime,new Date()); + int gridRows=customerDepartmentDao.update(null,updateDeptWrapper); + log.info(String.format("更新了%s个直属部门的area_code",gridRows)); + + // 3、更新下级组织的parent_area_code + LambdaUpdateWrapper updateAgencyWrapper = new LambdaUpdateWrapper<>(); + updateAgencyWrapper.eq(CustomerAgencyEntity::getPid,formDTO.getAgencyId()) + .set(CustomerAgencyEntity::getParentAreaCode, formDTO.getAreaCode()) + .set(CustomerAgencyEntity::getUpdatedBy,formDTO.getUserId()) + .set(CustomerAgencyEntity::getUpdatedTime,new Date()); + Integer rows = customerAgencyDao.update(null, updateAgencyWrapper); + log.info(String.format("更新了%s个下级组织的parent_area_code",rows)); + } + + /** + * + * @param formDTO 编辑组织入参 + * @param parent 当前编辑组织的上级组织 + * @return 返回组织区划编码 + */ + private String getAgencyNewAreaCode(EditAgencyFormDTO formDTO, CustomerAgencyEntity parent) { + String newAreaCode=""; + if (!"other".equals(formDTO.getAreaCode())) { + //校验除了当前组织外,areaCode是否被使用过 + List agencyIds = customerAgencyDao.selectAgencyIdsByAreaCode(formDTO.getAreaCode(), formDTO.getAgencyId()); + if (CollectionUtils.isNotEmpty(agencyIds)) { + //已经被占用,提示 + throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); + } + newAreaCode=formDTO.getAreaCode(); + } else { + //如果选择的是other,需要自定义一个编码 + AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); + addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); + addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode()); + addAreaCodeFormDTO.setName(formDTO.getAgencyName()); + Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); + if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { + if (addAreaCodeResult.getCode() > 8000) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg(), addAreaCodeResult.getMsg()); + } else { + throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } + } + newAreaCode=addAreaCodeResult.getData(); + } + return newAreaCode; + } + + /** + * 如果当前客户开启了areaCode,校验参数逼单 + * @param formDTO + */ + private void checkEditAgencyFormDTO(EditAgencyFormDTO formDTO,String originalAreaCode) { + if (StringUtils.isBlank(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open areaCode不能为空", "组织区划不能为空"); + } + if (StringUtils.isBlank(formDTO.getParentAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open parentAreaCode不能为空", "请先设置上级组织的组织区划"); + } + //如果当前组织已经使用了自定义编码,不允许在选择其他。 + if (StringUtils.isNotBlank(originalAreaCode) + && originalAreaCode.contains("UD") + && StringUtils.isNotBlank(formDTO.getAreaCode()) + && "other".equals(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); + } + } + /** * @param formDTO * @return @@ -546,7 +616,11 @@ public class AgencyServiceImpl implements AgencyService { addAreaCodeFormDTO.setName(formDTO.getAgencyName()); Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { - throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + if (addAreaCodeResult.getCode() > 8000) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义area_code异常" + addAreaCodeResult.getInternalMsg(), addAreaCodeResult.getMsg()); + } else { + throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); + } } insertEntity.setAreaCode(addAreaCodeResult.getData()); } 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 df5702d6db..37e07c9547 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 @@ -131,7 +131,9 @@ total_user AS 'totalUser', IFNULL(code,'')AS 'code', IFNULL(contacts,'')AS 'contacts', - IFNULL(mobile,'')AS 'mobile' + IFNULL(mobile,'')AS 'mobile', + IFNULL(AREA_CODE,'') AS areaCode, + IFNULL(PARENT_AREA_CODE,'') parentAreaCode FROM customer_agency WHERE del_flag = '0' AND pid = #{pId} @@ -721,18 +723,6 @@ AND cg.id = #{gridId} - - UPDATE customer_agency - SET AREA_CODE = '', - PARENT_AREA_CODE = '', - UPDATED_BY=#{operateUserId}, - UPDATED_TIME = NOW() - WHERE - DEL_FLAG = '0' - AND CUSTOMER_ID = #{customerId} - AND PARENT_AREA_CODE LIKE concat( #{originalParentAreaCode}, '%' ) - - UPDATE customer_agency SET AREA_CODE = '', diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml index 6eef0b4cc2..3e1e4f50c2 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerDepartmentDao.xml @@ -26,7 +26,8 @@ total_user AS 'totalUser', IFNULL(code,'')AS 'code', IFNULL(contacts,'')AS 'contacts', - IFNULL(mobile,'')AS 'mobile' + IFNULL(mobile,'')AS 'mobile', + IFNULL(AREA_CODE,'')AS areaCode FROM customer_department WHERE del_flag = '0' AND agency_id = #{agencyId} @@ -97,12 +98,4 @@ AND AREA_CODE LIKE concat(#{areaCode}, '%' ) - - update customer_department - SET AREA_CODE = #{areaCode}, - UPDATED_BY=#{operateUserId}, - UPDATED_TIME = NOW() - where del_flag='0' - and agency_id=#{agencyId} - \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml index c809cc8bfe..701573e942 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml @@ -291,7 +291,8 @@ IFNULL(code,'')AS 'code', IFNULL(grid_type,'')AS 'gridType', IFNULL(contacts,'')AS 'contacts', - IFNULL(mobile,'')AS 'mobile' + IFNULL(mobile,'')AS 'mobile', + IFNULL(AREA_CODE,'') as areaCode FROM CUSTOMER_GRID @@ -764,12 +765,4 @@ AND pids LIKE concat('%',#{agencyId}, '%' ) - - update customer_grid - SET AREA_CODE = #{areaCode}, - UPDATED_BY=#{operateUserId}, - UPDATED_TIME = NOW() - where del_flag='0' - and pid=#{agencyId} - From 5cf2ba01a44c0078f70759a4c2bb5f65494b81e3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 10 Jan 2022 10:30:19 +0800 Subject: [PATCH 21/25] stats ext 3g --- .../data-statistical-server/deploy/docker-compose-prod.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml index 3cd9ff7c01..91bf6acfca 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml @@ -9,10 +9,10 @@ services: volumes: - "/opt/epmet-cloud-logs/prod:/logs" environment: - RUN_INSTRUCT: "java -Xms256m -Xmx1524m -jar ./data-stats.jar" + RUN_INSTRUCT: "java -Xms256m -Xmx3000m -jar ./data-stats.jar" restart: "unless-stopped" deploy: resources: limits: cpus: '0.1' - memory: 1600M + memory: 3200M From ffcfcd9409966c17200387dda44b5a533db9bfcf Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 10 Jan 2022 10:30:53 +0800 Subject: [PATCH 22/25] =?UTF-8?q?=E6=A0=B9=E7=BB=84=E7=BB=87=E4=B8=8D?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/AgencyServiceImpl.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 15cb3746a9..3b5a284777 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -163,7 +163,7 @@ public class AgencyServiceImpl implements AgencyService { if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { //开关开启后,areaCode必填 String originalAreaCode =originalEntity.getAreaCode(); - checkEditAgencyFormDTO(formDTO,originalAreaCode); + checkEditAgencyFormDTO(formDTO,originalEntity); // 1、之前当前组织没有编码,本次修改设置了编码 // 2、之前已经有编码,本次修改为了其他编码 if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { @@ -306,19 +306,22 @@ public class AgencyServiceImpl implements AgencyService { * 如果当前客户开启了areaCode,校验参数逼单 * @param formDTO */ - private void checkEditAgencyFormDTO(EditAgencyFormDTO formDTO,String originalAreaCode) { - if (StringUtils.isBlank(formDTO.getAreaCode())) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open areaCode不能为空", "组织区划不能为空"); - } - if (StringUtils.isBlank(formDTO.getParentAreaCode())) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open parentAreaCode不能为空", "请先设置上级组织的组织区划"); - } - //如果当前组织已经使用了自定义编码,不允许在选择其他。 - if (StringUtils.isNotBlank(originalAreaCode) - && originalAreaCode.contains("UD") - && StringUtils.isNotBlank(formDTO.getAreaCode()) - && "other".equals(formDTO.getAreaCode())) { - throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); + private void checkEditAgencyFormDTO(EditAgencyFormDTO formDTO,CustomerAgencyEntity originalEntity) { + //根组织不允许修改 + if (StringUtils.isNotBlank(originalEntity.getPid()) && !NumConstant.ZERO_STR.equals(originalEntity.getPid())) { + if (StringUtils.isBlank(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open areaCode不能为空", "组织区划不能为空"); + } + if (StringUtils.isBlank(formDTO.getParentAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "area_code_switch is open parentAreaCode不能为空", "请先设置上级组织的组织区划"); + } + //如果当前组织已经使用了自定义编码,不允许在选择其他。 + if (StringUtils.isNotBlank(originalEntity.getAreaCode()) + && originalEntity.getAreaCode().contains("UD") + && StringUtils.isNotBlank(formDTO.getAreaCode()) + && "other".equals(formDTO.getAreaCode())) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); + } } } @@ -398,7 +401,7 @@ public class AgencyServiceImpl implements AgencyService { } //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end //2:查询本机关的所有上级机关,按自上而下层级顺序 - if (null == entity.getPids()) { + if (StringUtils.isBlank(entity.getPids())) { agencysResultDTO.setParentList(parentList); return new Result().ok(agencysResultDTO); } From 2b8e09929d922c44b82cc49fec00b0bae72a3367 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 10 Jan 2022 11:09:21 +0800 Subject: [PATCH 23/25] /gov/org/agency/agencydetail --- .../epmet/service/impl/AgencyServiceImpl.java | 80 +++++++++---------- 1 file changed, 39 insertions(+), 41 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index 3b5a284777..d85d65bfd5 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -161,22 +161,24 @@ public class AgencyServiceImpl implements AgencyService { //当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码 if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { - //开关开启后,areaCode必填 - String originalAreaCode =originalEntity.getAreaCode(); - checkEditAgencyFormDTO(formDTO,originalEntity); - // 1、之前当前组织没有编码,本次修改设置了编码 - // 2、之前已经有编码,本次修改为了其他编码 - if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { - CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); - String newAreaCode=getAgencyNewAreaCode(formDTO,parent); - originalEntity.setAreaCode(newAreaCode); - originalEntity.setParentAreaCode(parent.getAreaCode()); - formDTO.setAreaCode(newAreaCode); - } - //什么时候要全部置为空呢?原来没有现在有 || 原来与现在不一致 - if ((StringUtils.isBlank(originalAreaCode) && StringUtils.isNotBlank(formDTO.getAreaCode())) - || (!formDTO.getAreaCode().equals(originalAreaCode))) { - updateSubOrg(originalEntity.getCustomerId(),formDTO,originalAreaCode); + CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); + if (null != parent) { + //开关开启后,areaCode必填 + String originalAreaCode = originalEntity.getAreaCode(); + checkEditAgencyFormDTO(formDTO, originalEntity); + // 1、之前当前组织没有编码,本次修改设置了编码 + // 2、之前已经有编码,本次修改为了其他编码 + if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { + String newAreaCode = getAgencyNewAreaCode(formDTO, parent); + originalEntity.setAreaCode(newAreaCode); + originalEntity.setParentAreaCode(parent.getAreaCode()); + formDTO.setAreaCode(newAreaCode); + } + //什么时候要全部置为空呢?原来没有现在有 || 原来与现在不一致 + if ((StringUtils.isBlank(originalAreaCode) && StringUtils.isNotBlank(formDTO.getAreaCode())) + || (!formDTO.getAreaCode().equals(originalAreaCode))) { + updateSubOrg(originalEntity.getCustomerId(), formDTO, originalAreaCode); + } } } @@ -387,27 +389,6 @@ public class AgencyServiceImpl implements AgencyService { agencysResultDTO.setCode(entity.getCode()); agencysResultDTO.setContacts(entity.getContacts()); agencysResultDTO.setMobile(entity.getMobile()); - //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start - if (null != entity) { - if (null == entity.getPids() || "".equals(entity.getPids())) { - agencysResultDTO.setRootlevel(entity.getLevel()); - } else { - String id = Arrays.asList(entity.getPids().split(":")).get(0); - CustomerAgencyEntity rootEntity = customerAgencyDao.selectById(id); - if (null != rootEntity) { - agencysResultDTO.setRootlevel(rootEntity.getLevel()); - } - } - } - //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end - //2:查询本机关的所有上级机关,按自上而下层级顺序 - if (StringUtils.isBlank(entity.getPids())) { - agencysResultDTO.setParentList(parentList); - return new Result().ok(agencysResultDTO); - } - List listStr = Arrays.asList(entity.getPids().split(":")); - parentList = customerAgencyDao.selectPAgencyById(listStr); - agencysResultDTO.setParentList(parentList); agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId())); agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); agencysResultDTO.setAreaCode(StringUtils.isNotBlank(entity.getAreaCode())?entity.getAreaCode():StrConstant.EPMETY_STR); @@ -433,13 +414,30 @@ public class AgencyServiceImpl implements AgencyService { agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); } } + //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start + if (null != entity) { + if (null == entity.getPids() || "".equals(entity.getPids())) { + agencysResultDTO.setRootlevel(entity.getLevel()); + } else { + String id = Arrays.asList(entity.getPids().split(":")).get(0); + CustomerAgencyEntity rootEntity = customerAgencyDao.selectById(id); + if (null != rootEntity) { + agencysResultDTO.setRootlevel(rootEntity.getLevel()); + } + } + } + //2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end + //2:查询本机关的所有上级机关,按自上而下层级顺序 + if (StringUtils.isBlank(entity.getPids())) { + agencysResultDTO.setParentList(parentList); + return new Result().ok(agencysResultDTO); + } + List listStr = Arrays.asList(entity.getPids().split(":")); + parentList = customerAgencyDao.selectPAgencyById(listStr); + agencysResultDTO.setParentList(parentList); return new Result().ok(agencysResultDTO); } - public static void main(String[] args) { - String m="1234"; - System.out.println(m.equals("1234") ? "yes" : "no"); - } /** * @param formDTO * @return From 726b5a45e2d236b5449efad4b14f05f0428725ee Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 10 Jan 2022 14:15:32 +0800 Subject: [PATCH 24/25] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java index a1a12c71e6..2a5e81f0c3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java @@ -22,6 +22,7 @@ import lombok.Data; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; @@ -73,11 +74,13 @@ public class AddSocietyOrgFormDTO implements Serializable { /** * 起始服务时间 */ + @NotNull(message = "起始服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class }) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date serviceStartTime; /** * 终止服务时间 */ + @NotNull(message = "终止服务时间不能为空", groups = { AddSocietyOrgFormDTO.Add.class }) @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") private Date serviceEndTime; /** From 492a6a06b2216a625b5a8e82edc2ad68e133dc73 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 10 Jan 2022 14:24:28 +0800 Subject: [PATCH 25/25] . --- .../src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java index 2a5e81f0c3..1217c647c5 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/AddSocietyOrgFormDTO.java @@ -17,6 +17,7 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -103,6 +104,6 @@ public class AddSocietyOrgFormDTO implements Serializable { //token中userId private String staffId; - public interface Add {} + public interface Add extends CustomerClientShowGroup {} } \ No newline at end of file