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-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-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/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; 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..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 @@ -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.ONE; + 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); 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); } } 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 815b196c51..7f9809a052 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-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/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 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/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..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,11 +17,13 @@ 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; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.Date; @@ -73,11 +75,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; /** @@ -100,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 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}, '%') 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/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-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-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/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/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index f8fd02161d..fafb2d474d 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 { **/ 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 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..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 @@ -351,4 +351,9 @@ 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 9124e079b4..ac4e5a87ae 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,10 +19,12 @@ 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; 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; @@ -33,6 +35,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; @@ -40,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; @@ -60,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; /** @@ -93,7 +98,8 @@ public class AgencyServiceImpl implements AgencyService { private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private IcBuildingDao icBuildingDao; - + @Autowired + private CustomerDepartmentDao customerDepartmentDao; /** * @param formDTO @@ -152,31 +158,26 @@ public class AgencyServiceImpl implements AgencyService { originalEntity.setCode(formDTO.getCode()); originalEntity.setContacts(formDTO.getContacts()); originalEntity.setMobile(formDTO.getMobile()); - if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { - //如果修改了areaCode。 - customerAgencyDao.updateSubAgencyAreaCode(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()); - }else{ - //如果选择的是other,需要自定义一个编码 - AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); - addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); - addAreaCodeFormDTO.setParentAreaCode(formDTO.getAreaCode()); - addAreaCodeFormDTO.setName(formDTO.getAgencyName()); - Result addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); - if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { - throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); - } - originalEntity.setAreaCode(addAreaCodeResult.getData()); + + //当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码 + if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { + 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); } } } @@ -225,6 +226,107 @@ 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,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(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); + } + } + } + /** * @param formDTO * @return @@ -287,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 (null == 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); @@ -333,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 @@ -519,7 +617,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/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..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()) @@ -423,6 +451,7 @@ public class IcPartyServiceCenterServiceImpl extends BaseServiceImpl l = new LambdaQueryWrapper<>(); l.eq(IcMatterAppointmentRecordEntity::getMatterId,formDTO.getMatterId()) .eq(IcMatterAppointmentRecordEntity::getAppointmentDate,formDTO.getDate()) @@ -487,6 +516,18 @@ 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; + } + /** * @Description 【党群服务中心】预约记录 * @param formDTO 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 65d7306a07..a85367052d 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} @@ -731,7 +733,7 @@ AND PID = #{orgId} - + UPDATE customer_agency SET AREA_CODE = '', PARENT_AREA_CODE = '', @@ -740,6 +742,6 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - AND PARENT_AREA_CODE LIKE concat( #{originalParentAreaCode}, '%' ) + AND pids LIKE concat('%',#{agencyId}, '%' ) 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..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} @@ -87,4 +88,14 @@ 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..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 @@ -755,4 +756,13 @@ 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}, '%' ) + + 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 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()); } }); 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 60e935497e..274cb8ed87 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; 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());