From 03af4c982a583e0382e7e1849bf089fb27250f71 Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 17 Aug 2020 14:50:32 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-ext/epmet-ext-client/pom.xml | 6 ++ .../epmet/dto/result/ExtRoleMapResultDTO.java | 26 ++++++ .../dto/result/ExtStaffInfoResultDTO.java | 82 +++++++++++++++++++ .../epmet/feign/GovOrgOpenFeignClient.java | 10 +++ .../GovOrgOpenFeignClientFallback.java | 5 ++ .../controller/CustomerAgencyController.java | 12 +++ .../java/com/epmet/dao/CustomerAgencyDao.java | 9 ++ .../epmet/service/CustomerAgencyService.java | 9 ++ .../impl/CustomerAgencyServiceImpl.java | 72 ++++++++++++++++ .../java/com/epmet/util/ModuleConstant.java | 2 + .../resources/mapper/CustomerAgencyDao.xml | 17 ++++ .../epmet/dto/form/CommonStaffIdFormDTO.java | 24 ++++++ .../controller/CustomerStaffController.java | 13 +++ .../java/com/epmet/dao/CustomerStaffDao.java | 9 ++ .../epmet/service/CustomerStaffService.java | 9 ++ .../impl/CustomerStaffServiceImpl.java | 23 ++++++ .../resources/mapper/CustomerStaffDao.xml | 46 +++++++++++ 17 files changed, 374 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java diff --git a/epmet-module/epmet-ext/epmet-ext-client/pom.xml b/epmet-module/epmet-ext/epmet-ext-client/pom.xml index edb8fb13a1..925703ab91 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/pom.xml +++ b/epmet-module/epmet-ext/epmet-ext-client/pom.xml @@ -26,6 +26,12 @@ 3.6.0 compile + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java new file mode 100644 index 0000000000..fc2083b935 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName ExtRoleMapResultDTO + * @Auth wangc + * @Date 2020-08-17 09:19 + */ +@Data +public class ExtRoleMapResultDTO implements Serializable { + private static final long serialVersionUID = 4988555173286922503L; + + /** + * 角色key + * */ + private String roleKey; + + /** + * 角色名称 + * */ + private String roleName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java new file mode 100644 index 0000000000..a0f76c8787 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @ClassName ExtStaffInfoResultDTO + * @Auth wangc + * @Date 2020-08-17 09:14 + */ +@Data +public class ExtStaffInfoResultDTO implements Serializable { + private static final long serialVersionUID = 3874334777882476292L; + + /** + * 工作人员昵称 + * */ + private String nickname; + + /** + * 工作人员头像 + * */ + private String profile; + + /** + * + * */ + private String realName; + + /** + * 客户Id + * */ + private String customerId; + + /** + * 客户名称 + * */ + private String customerName; + + /** + * 机关Id + * */ + private String agencyId; + + /** + * 机关名称 + * */ + private String agencyName; + + /** + * 机关路径Id + * */ + private String agencyIdPath; + + /** + * 机关路径名称 + * */ + private String agencyNamePath; + + /** + * 网格Id + * */ + private String gridId; + + /** + * 网格名称 + * */ + private String gridName; + + /** + * 是否管理员标识 1是0否 + * */ + private String adminFlag; + + /** + * 用户角色列表 + * */ + private List roleList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index dbd11097bd..1694033b41 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -220,4 +220,14 @@ public interface GovOrgOpenFeignClient { */ @PostMapping(value = "/gov/org/customerstaffagency/getagencystaffs",consumes = MediaType.APPLICATION_JSON_VALUE) Result> getAgencyStaffs(@RequestBody AgencyIdFormDTO formDTO); + + /** + * @Description User模块调用gov-org查询工作人员所在机关的信息以及客户信息 + * @param result + * @return + * @author wangc + * @date 2020.08.17 14:11 + **/ + @PostMapping("/gov/org/customeragency/staffinfoext") + Result staffInfoExt(@RequestBody ExtStaffInfoResultDTO result); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 1394cb2146..c845039399 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -131,4 +131,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> getAgencyStaffs(AgencyIdFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyStaffs", formDTO); } + + @Override + public Result staffInfoExt(ExtStaffInfoResultDTO result) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "staffInfoExt", result); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 83250c4c17..c4cf4008e0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -193,4 +193,16 @@ public class CustomerAgencyController { Result querySponsorList(@PathVariable("staffId") String staffId){ return new Result().ok(customerAgencyService.querySponsorList(staffId)); } + + /** + * @Description 对外接口 获取工作人员基本信息 + * @param result ExtStaffInfoResultDTO.class + * @return Result + * @author wangc + * @date 2020.08.17 13:52 + **/ + @PostMapping("staffinfoext") + Result staffInfoExt(@RequestBody ExtStaffInfoResultDTO result){ + return new Result().ok(customerAgencyService.staffInfoExt(result)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 8a51d3ad19..4b22c60245 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 @@ -124,4 +124,13 @@ public interface CustomerAgencyDao extends BaseDao { * @Description 递归查询当前机关的下一级机关列表 **/ List selectAllSubAgency(@Param("subAgencyPids") String subAgencyPids); + + /** + * @Description 查询一个工作人员最近登录的网格以及机关信息 + * @param gridId + * @return + * @author wangc + * @date 2020.08.17 09:50 + **/ + ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index cacba8512e..b6746c59f3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -178,4 +178,13 @@ public interface CustomerAgencyService extends BaseService * @Date 2020/7/23 20:50 **/ ActSponsorResultDTO querySponsorList(String staffId); + + /** + * @Description 查询工作人员的信息,多客户/单客户,epmet-plugin,对外开放调用 + * @param result + * @return + * @author wangc + * @date 2020.08.17 09:29 + **/ + ExtStaffInfoResultDTO staffInfoExt(ExtStaffInfoResultDTO result); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index e399d29b85..344e947135 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -39,6 +39,7 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerAgencyRedis; import com.epmet.service.CustomerAgencyService; +import com.epmet.util.ModuleConstant; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,6 +47,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.lang.reflect.Field; import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.stream.Collectors; @@ -834,4 +836,74 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl customerResult = + operCrmFeignClient.getCustomerInfo(customerParam); + if(customerResult.success() && null != customerResult.getData()){ + result.setCustomerName(customerResult.getData().getCustomerName()); + } + checkFieldAndSetDefault(result); + return result; + } + + + + public void mergeObject(T origin, T destination) { + if (origin == null || destination == null) + return; + if (!origin.getClass().equals(destination.getClass())) + return; + + Field[] fields = origin.getClass().getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + try { + fields[i].setAccessible(true); + Object value = fields[i].get(origin); + if (null != value) { + fields[i].set(destination, value); + } + fields[i].setAccessible(false); + } catch (Exception e) { + + } + } + } + + + + public void checkFieldAndSetDefault(T origin) { + if (origin == null) + return; + Field[] fields = origin.getClass().getDeclaredFields(); + for (int i = 0; i < fields.length; i++) { + try { + fields[i].setAccessible(true); + Object value = fields[i].get(origin); + if (null == value && value.getClass().getName().equals("java.lang.String")) { + fields[i].set(origin, ModuleConstant.EMPTY_STR); + } + fields[i].setAccessible(false); + } catch (Exception e) { + + } + } + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java index a1539be232..143d496aec 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java @@ -71,4 +71,6 @@ public interface ModuleConstant { * 组织类型:网格 * */ String ORG_TYPE_GRID = "grid"; + + String EMPTY_STR = ""; } 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 61b9011343..ffcb626923 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 @@ -169,4 +169,21 @@ ORDER BY created_time DESC + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java new file mode 100644 index 0000000000..95d8b74e9d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 工作人员Id + * @ClassName CommonStaffIdFormDTO + * @Auth wangc + * @Date 2020-08-17 10:28 + */ +@Data +public class CommonStaffIdFormDTO implements Serializable { + + private static final long serialVersionUID = -5093758817860808310L; + + public interface StaffIdGroup extends CustomerClientShowGroup{} + + @NotBlank(message = "工作人员Id不能为空" , groups = StaffIdGroup.class) + private String staffId; +} 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 8ed7c0727d..8d94810e84 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 @@ -333,4 +333,17 @@ public class CustomerStaffController { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(customerStaffService.getStaffInfoList(formDTO)); } + + /** + * @Description 查找工作人员的信息 - 对外开放接口 + * @param staffParam + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + @PostMapping("extstaffinfo") + public Result extStaffInfo(CommonStaffIdFormDTO staffParam){ + ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class); + return new Result().ok(customerStaffService.extStaffInfo(staffParam)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index ce0ff406c7..fefa18a1d7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -153,4 +153,13 @@ public interface CustomerStaffDao extends BaseDao { * @date 2020/8/13 1:45 下午 */ List getStaffInfoList(@Param("userIds")List userIds); + + /** + * @Description 查询工作人员信息 (对外接口) + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 13:26 + **/ + ExtStaffInfoResultDTO selectStaffInfoExt(@Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 1eb5e070e4..055d456159 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -266,4 +266,13 @@ public interface CustomerStaffService extends BaseService { * @date 2020/8/13 1:45 下午 */ List getStaffInfoList( UserIdsFormDTO formDTO); + + /** + * @Description 查找工作人员的信息 - 对外开放接口 + * @param staffParam + * @return + * @author wangc + * @date 2020.08.17 10:30 + **/ + ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 2ff38361cb..162299581e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -576,4 +576,27 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl govOrgResult = + govOrgOpenFeignClient.staffInfoExt(result); + if(govOrgResult.success() && null != govOrgResult.getData()){ + return govOrgResult.getData(); + } + } + return null; + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml index bcd20d8b96..5a8bc1743f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml @@ -235,4 +235,50 @@ cs.user_id = #{userId} + + + + + + + + + + + + + + + + + \ No newline at end of file From f963928a0e6dd214f6b5cae8ba4925f82e26659c Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 17 Aug 2020 16:08:05 +0800 Subject: [PATCH 02/10] =?UTF-8?q?ext=20=E6=8F=90=E4=BA=A4=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/ExtGridResultDTO.java | 20 ++++++++++++++++ .../result/ExtStaffPermissionResultDTO.java | 23 +++++++++++++++++++ .../impl/CustomerAgencyServiceImpl.java | 8 +++++++ 3 files changed, 51 insertions(+) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java new file mode 100644 index 0000000000..ed36458a9f --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @ClassName ExtGridResultDTO + * @Auth wangc + * @Date 2020-08-17 15:28 + */ +@Data +public class ExtGridResultDTO implements Serializable { + private static final long serialVersionUID = -4531574240525562587L; + + private String gridId; + + private String gridName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java new file mode 100644 index 0000000000..b74504ddcf --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @ClassName ExtStaffPermissionResultDTO + * @Auth wangc + * @Date 2020-08-17 15:24 + */ +@Data +public class ExtStaffPermissionResultDTO implements Serializable { + private static final long serialVersionUID = 2513553862809278219L; + + private String agencyId; + + private String agencyName; + + private List gridList; +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 344e947135..ba856bda8b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -860,6 +860,14 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl { + if(StringUtils.equals("root_manager",o.getRoleKey())){ + result.setAdminFlag(NumConstant.ONE_STR); + } + }); + } return result; } From 4182141e1a6ba662fc96301ad5a9c5ba81b5b445 Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 18 Aug 2020 09:15:09 +0800 Subject: [PATCH 03/10] plugin staffINfo --- .../epmet/dto/result/ExtDeptResultDTO.java | 26 +++++++++++++++++++ .../epmet/dto/result/ExtGridResultDTO.java | 8 +++++- .../result/ExtStaffPermissionResultDTO.java | 21 ++++++++++++++- .../epmet/service/CustomerAgencyService.java | 9 +++++++ .../impl/CustomerAgencyServiceImpl.java | 17 ++++++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 10 +++++++ .../EpmetUserOpenFeignClientFallback.java | 5 ++++ .../StaffAgencyVisitedController.java | 13 ++++++++++ .../service/StaffAgencyVisitedService.java | 9 +++++++ .../impl/StaffAgencyVisitedServiceImpl.java | 16 ++++++++++++ 10 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java new file mode 100644 index 0000000000..4b0d67ca35 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 部门信息 + * @ClassName ExtDeptResultDTO + * @Auth wangc + * @Date 2020-08-17 17:16 + */ +@Data +public class ExtDeptResultDTO implements Serializable { + private static final long serialVersionUID = 1792371558965832432L; + + /** + * 部门Id + * */ + private String deptId; + + /** + * 部门名称 + * */ + private String deptName; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java index ed36458a9f..018c298c50 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import java.io.Serializable; /** - * @Description + * @Description 网格信息 * @ClassName ExtGridResultDTO * @Auth wangc * @Date 2020-08-17 15:28 @@ -14,7 +14,13 @@ import java.io.Serializable; public class ExtGridResultDTO implements Serializable { private static final long serialVersionUID = -4531574240525562587L; + /** + * 网格Id + * */ private String gridId; + /** + * 网格名称 + * */ private String gridName; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java index b74504ddcf..1083e7b8be 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java @@ -6,7 +6,7 @@ import java.io.Serializable; import java.util.List; /** - * @Description + * @Description 工作人员数据权限 * @ClassName ExtStaffPermissionResultDTO * @Auth wangc * @Date 2020-08-17 15:24 @@ -15,9 +15,28 @@ import java.util.List; public class ExtStaffPermissionResultDTO implements Serializable { private static final long serialVersionUID = 2513553862809278219L; + /** + * 直属机关Id + * */ private String agencyId; + /** + * 直属机关名称 + * */ private String agencyName; + /** + * 直属机关直属网格列表 + * */ private List gridList; + + /** + * 直属机关直属部门列表 + * */ + private List departmentList; + + /** + * 子集机关列表 + * */ + private List subAgencyList; } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index b6746c59f3..62b527e6ba 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -187,4 +187,13 @@ public interface CustomerAgencyService extends BaseService * @date 2020.08.17 09:29 **/ ExtStaffInfoResultDTO staffInfoExt(ExtStaffInfoResultDTO result); + + /** + * @Description 根据staffId,查询当前这个用户的数据权限 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + ExtStaffPermissionResultDTO staffPermissionExt(String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index ba856bda8b..f069bfcf2f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -871,6 +871,23 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agency = + epmetUserOpenFeignClient.latestAgency(staffId); + + //2.根据此agencyId查询数据权限 + + return null; + } public void mergeObject(T origin, T destination) { diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index e627d868a9..993ce13ae6 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -268,4 +268,14 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping("epmetuser/customerstaff/getstaffinfolist") Result> getStaffInfoList(@RequestBody UserIdsFormDTO formDTO); + + /** + * @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:45 + **/ + @GetMapping("/epmet/staffagencyvisited/latestagency/{staffId}") + Result latestAgency(@PathVariable("staffId") String staffId); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index f434996933..25203c9549 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -188,4 +188,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> getStaffInfoList(UserIdsFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoList", formDTO); } + + @Override + public Result latestAgency(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestAgency", staffId); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java index 488a103ef0..69ffa0ebd8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java @@ -62,4 +62,17 @@ public class StaffAgencyVisitedController { return staffAgencyVisitedService.saveStaffLoginRecord(formDTO); } + + /** + * @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:45 + **/ + @GetMapping(value = "latestagency/{staffId}") + public Result latestAgency(@PathVariable("staffId") String staffId){ + return new Result().ok(staffAgencyVisitedService.getLatestStaffAgencyId(staffId)); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java index 71622dfa4a..d70addb077 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java @@ -114,4 +114,13 @@ public interface StaffAgencyVisitedService extends BaseService Date: Tue, 18 Aug 2020 14:30:39 +0800 Subject: [PATCH 04/10] =?UTF-8?q?=E5=AF=B9=E5=A4=96=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9D=83=E9=99=90=EF=BC=8C=E6=97=A2=E6=89=80=E5=9C=A8=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E4=BB=A5=E5=8F=8A=E4=B8=8B=E7=BA=A7=20ResiTopicOperat?= =?UTF-8?q?ionFormDTO=E5=8E=BB=E6=8E=89=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84@NotBlank?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/ExtStaffPermissionResultDTO.java | 7 +- .../controller/CustomerAgencyController.java | 12 ++++ .../java/com/epmet/dao/CustomerAgencyDao.java | 28 ++++++++ .../impl/CustomerAgencyServiceImpl.java | 14 +++- .../resources/mapper/CustomerAgencyDao.xml | 72 +++++++++++++++++++ .../topic/form/ResiTopicOperationFormDTO.java | 2 +- 6 files changed, 129 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java index 1083e7b8be..8408c42dbf 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -28,15 +29,15 @@ public class ExtStaffPermissionResultDTO implements Serializable { /** * 直属机关直属网格列表 * */ - private List gridList; + private List gridList = new ArrayList<>(); /** * 直属机关直属部门列表 * */ - private List departmentList; + private List departmentList = new ArrayList<>(); /** * 子集机关列表 * */ - private List subAgencyList; + private List subAgencyList = new ArrayList<>(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index c4cf4008e0..eda5db2edf 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -205,4 +205,16 @@ public class CustomerAgencyController { Result staffInfoExt(@RequestBody ExtStaffInfoResultDTO result){ return new Result().ok(customerAgencyService.staffInfoExt(result)); } + + /** + * @Description 根据staffId,查询当前这个用户的数据权限,对外接口 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + @PostMapping("permissionext/{staffId}") + Result staffPermissionExt(@PathVariable(value = "staffId") String staffId){ + return new Result().ok(customerAgencyService.staffPermissionExt(staffId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java index 4b22c60245..26ec50ed8e 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 @@ -133,4 +133,32 @@ public interface CustomerAgencyDao extends BaseDao { * @date 2020.08.17 09:50 **/ ExtStaffInfoResultDTO selectAgencyAndGridInfoExt(@Param("gridId") String gridId); + + /** + * @Description 根据agencyId查找指定机构的信息,直属网格、部门 + * @param agencyId + * @return + * @author wangc + * @date 2020.08.18 13:41 + **/ + ExtStaffPermissionResultDTO selectAgencyById(@Param("agencyId")String agencyId); + + /** + * @Description 根绝agencyId查找其下属机构的信息 + * @param pid + * @return + * @author wangc + * @date 2020.08.18 13:42 + **/ + List selectSubAgencyByPid(@Param("pid") String pid); + + /** + * @Description 根据agencyId查找指定机构直属的部门,将grid与dept分开是因为grid与dept的数量可能不等,造成重复数据无法去重 + * @param agencyId + * @return + * @author wangc + * @date 2020.08.18 13:42 + **/ + List selectDeptList(@Param("agencyId") String agencyId); + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index f069bfcf2f..69b292364e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -880,13 +880,23 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl agency = epmetUserOpenFeignClient.latestAgency(staffId); - + if(agency.success() && StringUtils.isNotBlank(agency.getData())){ //2.根据此agencyId查询数据权限 + ExtStaffPermissionResultDTO res = baseDao.selectAgencyById(agency.getData()); + return res; + }else{ + logger.error("com.epmet.service.impl.CustomerAgencyServiceImpl.staffPermissionExt,没有找到工作人员最近一次登陆的Agency信息,用户Id:{}",staffId); + ExtStaffPermissionResultDTO emptyResult = new ExtStaffPermissionResultDTO(); + checkFieldAndSetDefault(emptyResult); + return emptyResult; + } + + - return null; } 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 ffcb626923..93136b2e1a 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 @@ -186,4 +186,76 @@ gridd.DEL_FLAG = '0' AND gridd.ID = #{gridId} + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java index 3dffb22abe..de32937a93 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java @@ -29,7 +29,7 @@ public class ResiTopicOperationFormDTO implements Serializable { /** * 是否解决(已解决 resolved,未解决 unresolved) */ - @NotBlank(message = "解决状态不能为空") + //@NotBlank(message = "解决状态不能为空") private String closedStatus; From 082250cb7dd335776a4fdfb825685c92bc53e7dd Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Tue, 18 Aug 2020 15:05:05 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=BF=94=E5=8F=82?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/FunctionDetailResultDTO.java | 4 ++-- .../impl/CustomerFunctionDetailServiceImpl.java | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java index debdfc6016..ebbcd3ea9b 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java @@ -44,7 +44,7 @@ public class FunctionDetailResultDTO implements Serializable { private String dispalyOrder; /** - * 自定义json(目前是空值) + * 自定义json(目前是空值)【集合对象经过urlencode转化】 */ - private ArrayList customerParameter; + private String customerParameter; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java index faa4fa72df..c1b20c5f75 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java @@ -21,6 +21,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; @@ -42,6 +44,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -125,6 +128,16 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl%s,所属端->%s", formDTO.getCustomerId(), formDTO.getClientType())); List list = baseDao.selectFunctionDetailList(formDTO); + try { + String join = String.join(",", new ArrayList<>()); + String customerParameter = java.net.URLEncoder.encode(join, "utf-8"); + list.forEach(l->{ + l.setCustomerParameter(customerParameter); + }); + } catch (Exception e) { + logger.error("CustomerFunctionDetailServiceImpl.resiAndWorkFunctionDetail->集合参数URLEncode失败"); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } return list; } From 098605dae6d02feb077b28a854daf7c775a31a81 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 19 Aug 2020 10:14:55 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/controller/OpenUpController.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 68f854f8dc..1f29c98390 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + import java.util.List; /** From 2d62693687e1ca310d82cddac5ae8e4e5fd37de3 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 19 Aug 2020 15:50:50 +0800 Subject: [PATCH 07/10] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/UpdateCustomerFormDTO.java | 38 ++++++++++ .../dto/result/CustomerListResultDTO.java | 66 +++++++++++++++++ .../epmet/controller/CustomerController.java | 31 ++++++-- .../main/java/com/epmet/dao/CustomerDao.java | 14 ++-- .../com/epmet/service/CustomerService.java | 23 ++++-- .../service/impl/CustomerServiceImpl.java | 70 +++++++++++++++++-- .../src/main/resources/mapper/CustomerDao.xml | 17 +++++ .../dto/form/UpdateRootManageFormDTO.java | 31 ++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 10 +++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../controller/CustomerStaffController.java | 13 ++++ .../java/com/epmet/dao/CustomerStaffDao.java | 10 +++ .../epmet/service/CustomerStaffService.java | 9 +++ .../impl/CustomerStaffServiceImpl.java | 11 +++ .../resources/mapper/CustomerStaffDao.xml | 14 ++++ 15 files changed, 346 insertions(+), 16 deletions(-) create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java new file mode 100644 index 0000000000..e4627c7134 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 10:53 + */ +@NoArgsConstructor +@Data +public class UpdateCustomerFormDTO implements Serializable { + + private static final long serialVersionUID = 1296290251616658023L; + /** + * 客户ID + */ + private String customerId; + /** + * 客户名 + */ + private String customerName; + /** + * logo + */ + private String logo; + /** + * 根管理员姓名 + */ + private String rootManageName; + /** + * 根管理员电话 + */ + private String rootManagePhone; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java new file mode 100644 index 0000000000..3d08316bb9 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java @@ -0,0 +1,66 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 9:53 + */ +@NoArgsConstructor +@Data +public class CustomerListResultDTO implements Serializable { + + private static final long serialVersionUID = -2167406082548134982L; + /** + * 客户id + */ + private String customerId; + /** + * 客户名称 + */ + private String customerName; + /** + * 产品标题 显示在产品顶端的标题 + */ + private String title; + /** + * 有效期 + */ + private String validityTime; + /** + * 客户组织级别:0.省级,1市级,2.区县级,3.乡镇街道级 字典表key:organizationlevel + */ + private String organizationLevels; + /** + * 客户logo + */ + private String logo; + /** + * 客户允许创建的网格数 + */ + private Integer gridNumber; + /** + * 跟管理员姓名 + */ + private String rootManageName; + /** + * 跟管理员电话 + */ + private String rootManagePhone; + /** + * 省份 + */ + private String province; + /** + * 城市 + */ + private String city; + /** + * 区县 + */ + private String county; +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index 0369274a34..a1ef57aaab 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -31,10 +31,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CustomerDetailResultDTO; -import com.epmet.dto.result.CustomerInfoResultDTO; -import com.epmet.dto.result.GridCountResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.excel.CustomerExcel; import com.epmet.feign.GovOrgFeignClient; import com.epmet.service.CustomerService; @@ -279,4 +276,30 @@ public class CustomerController { ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class); return new Result().ok(customerService.getCustomer(formDTO)); } + + /** + * 获取crm客户列表 + * @author zhaoqifeng + * @date 2020/8/19 10:46 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("customerlist") + public Result> customerList(@RequestBody PageQueryFormDTO formDTO) { + List result = customerService.customerList(formDTO); + return new Result>().ok(result); + } + + /** + * 修改客户信息 + * @author zhaoqifeng + * @date 2020/8/19 15:23 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("updatecustomer") + public Result updateCustomer(@RequestBody UpdateCustomerFormDTO formDTO) { + customerService.updateCustomer(formDTO); + return new Result(); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index 6c21743bbb..b7aed8f55a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -19,10 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomerDTO; -import com.epmet.dto.result.CustomerInfoResultDTO; -import com.epmet.dto.result.CustomerResultDTO; -import com.epmet.dto.result.GridCountResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -92,4 +89,13 @@ public interface CustomerDao extends BaseDao { */ CustomerInfoResultDTO selectCustomerBasicInfo(@Param("customerId")String customerId); + /** + * 获取crm客户列表 + * @author zhaoqifeng + * @date 2020/8/19 10:17 + * @param customerName + * @return java.util.List + */ + List selectAllCustomerList(@Param("customerName") String customerName); + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index cf32a13308..5953f53e64 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -22,10 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CustomerDetailResultDTO; -import com.epmet.dto.result.CustomerInfoResultDTO; -import com.epmet.dto.result.GridCountResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; import org.springframework.web.bind.annotation.RequestBody; @@ -189,4 +186,22 @@ public interface CustomerService extends BaseService { * @date 2020/8/14 9:08 上午 */ CustomerInfoResultDTO getCustomer( CustomerIdFormDTO formDTO); + + /** + * 获取crm客户列表 + * @author zhaoqifeng + * @date 2020/8/19 10:12 + * @param formDTO + * @return com.epmet.dto.result.CustomerListResultDTO + */ + List customerList(PageQueryFormDTO formDTO); + + /** + * 客户基本信息修改 + * @author zhaoqifeng + * @date 2020/8/19 10:58 + * @param formDTO + * @return void + */ + void updateCustomer(UpdateCustomerFormDTO formDTO); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 51364b48d9..a85bbadc5a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -38,10 +38,7 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; -import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.GovOrgFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.OperCustomizeFeignClient; +import com.epmet.feign.*; import com.epmet.redis.CustomerRedis; import com.epmet.service.CustomerService; import com.github.pagehelper.PageHelper; @@ -79,6 +76,8 @@ public class CustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -576,4 +575,67 @@ public class CustomerServiceImpl extends BaseServiceImpl customerList(PageQueryFormDTO formDTO) { + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()) + .doSelectPageInfo(() -> baseDao.selectAllCustomerList(formDTO.getCustomerName())); + List list = pageInfo.getList(); + if(null != list) { + list.forEach(dto -> { + // 根级组织 + Result customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(dto.getCustomerId()); + if (!customerRootAgencyRst.success()) { + throw new RenException("查询客户详情:查询客户根级组织失败:".concat(customerRootAgencyRst.toString())); + } + CustomerAgencyDTO agency = customerRootAgencyRst.getData(); + + // 管理员 + GovStaffRoleResultDTO manager = new GovStaffRoleResultDTO(); + if (agency != null) { + StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO(); + staffsInRoleForm.setOrgId(agency.getId()); + staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); + Result> managersResult = epmetUserFeignClient.getStaffsInRole(staffsInRoleForm); + if (!managersResult.success() || null == managersResult.getData() || managersResult.getData().size() == NumConstant.ZERO) { + throw new RenException("查询客户详情:查询客户管理员失败:".concat(managersResult.toString())); + } + manager = managersResult.getData().get(NumConstant.ZERO); + dto.setProvince(agency.getProvince()); + dto.setCity(agency.getCity()); + dto.setCounty(agency.getDistrict()); + dto.setRootManageName(manager.getRealName()); + dto.setRootManagePhone(manager.getMobile()); + } + }); + } + return list; + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void updateCustomer(UpdateCustomerFormDTO formDTO) { + CustomerEntity entity = new CustomerEntity(); + entity.setId(formDTO.getCustomerId()); + entity.setCustomerName(formDTO.getCustomerName()); + entity.setLogo(formDTO.getLogo()); + baseDao.updateById(entity); + if (StringUtils.isNotBlank(formDTO.getRootManageName()) || StringUtils.isNotBlank(formDTO.getRootManagePhone())) { + // 根级组织 + Result customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(formDTO.getCustomerId()); + if (!customerRootAgencyRst.success() || null == customerRootAgencyRst.getData()) { + throw new RenException("客户基本信息修改:查询客户根级组织失败:".concat(customerRootAgencyRst.toString())); + } + CustomerAgencyDTO agency = customerRootAgencyRst.getData(); + UpdateRootManageFormDTO updateRootManageFormDTO = new UpdateRootManageFormDTO(); + updateRootManageFormDTO.setOrgId(agency.getId()); + updateRootManageFormDTO.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); + updateRootManageFormDTO.setRootManageName(formDTO.getRootManageName()); + updateRootManageFormDTO.setRootManagePhone(formDTO.getRootManagePhone()); + Result rootManageResult = epmetUserOpenFeignClient.updateRootManage(updateRootManageFormDTO); + if (!rootManageResult.success()) { + throw new RenException("客户基本信息修改:修改根管理员信息失败:".concat(rootManageResult.toString())); + } + } + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index 33c0dd52e2..46e35aa218 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -102,4 +102,21 @@ del_flag = 0 AND id = #{customerId} + + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java new file mode 100644 index 0000000000..9f30b5e4eb --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/8/19 14:20 + */ +@Data +public class UpdateRootManageFormDTO implements Serializable { + private static final long serialVersionUID = 3954225931981940018L; + /** + * 根组织ID + */ + private String orgId; + /** + * 角色key + */ + private String roleKey; + /** + * 根管理员姓名 + */ + private String rootManageName; + /** + * 根管理员电话 + */ + private String rootManagePhone; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 993ce13ae6..52de280ea0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -278,4 +278,14 @@ public interface EpmetUserOpenFeignClient { **/ @GetMapping("/epmet/staffagencyvisited/latestagency/{staffId}") Result latestAgency(@PathVariable("staffId") String staffId); + + /** + * 修改根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:31 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("epmetuser/customerstaff/updaterootmanage") + Result updateRootManage(@RequestBody UpdateRootManageFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 25203c9549..55856e42ea 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -193,4 +193,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result latestAgency(String staffId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "latestAgency", staffId); } + + @Override + public Result updateRootManage(UpdateRootManageFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateRootManage", formDTO); + } } 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 8d94810e84..a752e8b884 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 @@ -346,4 +346,17 @@ public class CustomerStaffController { ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class); return new Result().ok(customerStaffService.extStaffInfo(staffParam)); } + + /** + * 修改根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:31 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("updaterootmanage") + public Result updateRootManage(@RequestBody UpdateRootManageFormDTO formDTO) { + customerStaffService.updateRootManage(formDTO); + return new Result(); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index fefa18a1d7..41c7a550e6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java @@ -162,4 +162,14 @@ public interface CustomerStaffDao extends BaseDao { * @date 2020.08.17 13:26 **/ ExtStaffInfoResultDTO selectStaffInfoExt(@Param("staffId") String staffId); + + /** + * 获取根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:14 + * @param orgId + * @param roleKey + * @return com.epmet.dto.CustomerStaffDTO + */ + CustomerStaffDTO selectRootManage(@Param("orgId") String orgId, @Param("roleKey") String roleKey); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java index 055d456159..3a49fc6f2d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java @@ -275,4 +275,13 @@ public interface CustomerStaffService extends BaseService { * @date 2020.08.17 10:30 **/ ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam); + + /** + * 修改根管理员信息 + * @author zhaoqifeng + * @date 2020/8/19 14:11 + * @param formDTO + * @return com.epmet.dto.CustomerStaffDTO + */ + void updateRootManage(UpdateRootManageFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 162299581e..0ebbbc0afa 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -599,4 +599,15 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl + + \ No newline at end of file From b6cff2739e37a6e0be58d1f01cc01ff56b324746 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 19 Aug 2020 16:21:26 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E9=89=B4=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java | 6 ------ .../main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java | 6 ------ .../main/java/com/epmet/dto/form/StaffSinGridFormDTO.java | 6 ------ .../main/java/com/epmet/controller/OpenUpController.java | 4 ++++ 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java index 5e166ac342..0403bf52b1 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java @@ -17,12 +17,6 @@ public class StaffSinAgencyFormDTO implements Serializable { //后端自己看 public interface StaffSinAgency{} - /** - * appId+customerId+时间戳加密secret - */ -// @NotBlank(message = "secret不能为空",groups = {StaffSinDept.class}) - private String accessToken; - /** * 机关Id */ diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java index b66de79686..3e69297c27 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java @@ -17,12 +17,6 @@ public class StaffSinDeptFormDTO implements Serializable { //后端自己看 public interface StaffSinDept{} - /** - * appId+customerId+时间戳加密secret - */ -// @NotBlank(message = "secret不能为空",groups = {StaffSinDept.class}) - private String accessToken; - /** * 部门Id */ diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java index a694dfddb1..8b93d60979 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java @@ -18,12 +18,6 @@ public class StaffSinGridFormDTO implements Serializable { //后端自己看 public interface StaffSinGrid{} - /** - * appId+customerId+时间戳加密secret - */ -// @NotBlank(message = "secret不能为空",groups = {StaffSinGrid.class}) - private String accessToken; - /** * 网格Id */ diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 1f29c98390..b5849f78dc 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.*; @@ -33,6 +34,7 @@ public class OpenUpController { * @author zxc * @date 2020/8/13 9:42 上午 */ + @ExternalAppRequestAuth @PostMapping("staffsingrid") public Result> staffSinGrid(@RequestBody StaffSinGridFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StaffSinGridFormDTO.StaffSinGrid.class); @@ -45,6 +47,7 @@ public class OpenUpController { * @author zxc * @date 2020/8/13 9:51 上午 */ + @ExternalAppRequestAuth @PostMapping("staffsindept") public Result> staffSinDept(@RequestBody StaffSinDeptFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StaffSinDeptFormDTO.StaffSinDept.class); @@ -57,6 +60,7 @@ public class OpenUpController { * @author zxc * @date 2020/8/17 9:59 上午 */ + @ExternalAppRequestAuth @PostMapping("staffsinagency") public Result> staffSinAgency(@RequestBody StaffSinAgencyFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, StaffSinAgencyFormDTO.StaffSinAgency.class); From db5ffbe1633a91efd6d9e1c9974aea55ba75d97d Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Wed, 19 Aug 2020 16:24:08 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E9=89=B4=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-ext/epmet-ext-server/pom.xml | 31 +++---------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/epmet-module/epmet-ext/epmet-ext-server/pom.xml b/epmet-module/epmet-ext/epmet-ext-server/pom.xml index 5a9047f096..f6ffa2b775 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/pom.xml +++ b/epmet-module/epmet-ext/epmet-ext-server/pom.xml @@ -26,6 +26,11 @@ epmet-ext-client 2.0.0 + + com.epmet + epmet-commons-extapp-auth + 2.0.0 + com.epmet epmet-commons-tools @@ -133,38 +138,12 @@ 3.6.0 compile - - com.epmet - epmet-common-clienttoken - 2.0.0 - compile - - - com.epmet - oper-crm-client - 2.0.0 - compile - - - com.epmet - epmet-oss-client - 2.0.0 - compile - org.springframework spring-test 5.1.12.RELEASE compile - - - - com.aliyun - alibaba-dingtalk-service-sdk - 1.0.1 - - From 038aa4044132de698a9cc0e40116ab76942c6a99 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 19 Aug 2020 16:59:01 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E8=BF=90=E8=90=A5=E7=AB=AF=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=AE=9A=E5=88=B6=E5=8C=96=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/UpdateCustomerParameterFormDTO.java | 31 +++++ .../dto/result/CustomerInfoResultDTO.java | 10 +- .../com/epmet/constant/ModuleConstant.java | 8 ++ .../epmet/controller/CustomerController.java | 25 ++++ .../com/epmet/service/CustomerService.java | 17 ++- .../service/impl/CustomerServiceImpl.java | 61 +++++++++- .../src/main/resources/mapper/CustomerDao.xml | 3 +- .../com/epmet/dto/FunctionCustomizedDTO.java | 2 +- .../form/CustomerFunctionCollectFormDTO.java | 36 ++++++ .../form/updatedisplayorderListFormDTO.java | 36 ++++++ ...stomerFunctionCustomizedListResultDTO.java | 28 +++++ .../epmet/dto/result/CustomerResultDTO.java | 38 ++++++ .../epmet/dto/result/FunctionResultDTO.java | 74 ++++++++++++ .../CustomerFunctionDetailController.java | 44 ++++++- .../epmet/dao/CustomerFunctionDetailDao.java | 25 ++++ .../com/epmet/dao/FunctionCustomizedDao.java | 18 +++ .../epmet/excel/FunctionCustomizedExcel.java | 2 +- .../CustomerFunctionDetailService.java | 30 ++++- .../CustomerFunctionDetailServiceImpl.java | 108 ++++++++++++++++-- .../V0.0.4__add_customer_function_detail.sql | 4 +- .../mapper/CustomerFunctionDetailDao.xml | 74 ++++++++++++ .../mapper/FunctionCustomizedDao.xml | 32 ++++++ 22 files changed, 683 insertions(+), 23 deletions(-) create mode 100644 epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java new file mode 100644 index 0000000000..f522bfab50 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 修改客户网格数和有效期-接口入参 + * @Author sun + */ +@Data +public class UpdateCustomerParameterFormDTO implements Serializable { + + private static final long serialVersionUID = 4512080710854617599L; + /** + * 客户Id + */ + @NotBlank(message = "customerId不能为空",groups = {Customer.class}) + private String customerId; + /** + * 有效期 + */ + private String validityTime; + /** + * 最大允许创建网格数 + */ + private Integer gridNumber; + + public interface Customer{} +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java index c47b3514c2..95047cf9e9 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.result; import lombok.Data; import java.io.Serializable; +import java.util.Date; /** * @Author zxc @@ -23,14 +24,19 @@ public class CustomerInfoResultDTO implements Serializable { */ private String customerName; + /** + * 有效期 + */ + private Date validityTime; + /** * 已创建网格数 */ - private Integer createGridNum; + private Integer createGridNumber; /** * 最大允许创建数 */ - private Integer maxGridNum; + private Integer maxGridNumber; } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java index 3363344d1a..c78e0e799e 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -8,4 +8,12 @@ public interface ModuleConstant { String ERROR_GOV_ORG_COUNT = "调用gov_org服务【查询客户下网格数量】失败"; + String SELECT_CUSTOMER_ERROR = "根据客户Id查询客户基本信息失败"; + + String GRID_NUMBER_ERROR = "最大网格数不能小于之前设定数"; + + String VALIDITY_TIME_ERROR = "客户有效期不能早于之前设定值"; + + String UPDATE_CUSTOMER_ERROR = "更新客户基本信息失败"; + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index a1ef57aaab..6ad634df60 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -41,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; +import java.text.ParseException; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -302,4 +303,28 @@ public class CustomerController { customerService.updateCustomer(formDTO); return new Result(); } + + /** + * @param formDTO + * @Description 获取客户最大网格数和有效期 + * @author sun + */ + @PostMapping("getcustomerparameter") + public Result getCustomerParameter(@RequestBody CustomerIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class); + return new Result().ok(customerService.getCustomerParameter(formDTO)); + } + + /** + * @param formDTO + * @Description 修改客户网格数和有效期 + * @author sun + */ + @PostMapping("updatecustomerparameter") + public Result updateCustomerParameter(@RequestBody UpdateCustomerParameterFormDTO formDTO) throws ParseException { + ValidatorUtils.validateEntity(formDTO, UpdateCustomerParameterFormDTO.Customer.class); + customerService.updateCustomerParameter(formDTO); + return new Result(); + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index 5953f53e64..b194421d06 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -24,8 +24,8 @@ import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; -import org.springframework.web.bind.annotation.RequestBody; +import java.text.ParseException; import java.util.List; import java.util.Map; @@ -204,4 +204,19 @@ public interface CustomerService extends BaseService { * @return void */ void updateCustomer(UpdateCustomerFormDTO formDTO); + + /** + * @param formDTO + * @Description 获取客户最大网格数和有效期 + * @author sun + */ + CustomerInfoResultDTO getCustomerParameter( CustomerIdFormDTO formDTO); + + /** + * @param formDTO + * @Description 修改客户网格数和有效期 + * @author sun + */ + void updateCustomerParameter(UpdateCustomerParameterFormDTO formDTO) throws ParseException; + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index a85bbadc5a..673f676fd9 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -51,6 +51,8 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @@ -571,7 +573,7 @@ public class CustomerServiceImpl extends BaseServiceImpl result = govOrgOpenFeignClient.selectGridCount(formDTO); + if (!result.success()){ + throw new RenException(ModuleConstant.ERROR_GOV_ORG_COUNT); + } + CustomerGridCountResultDTO resultDTO = result.getData(); + customerInfoResultDTO.setCreateGridNumber(resultDTO.getGridCount()); + + return customerInfoResultDTO; + } + + + /** + * @param formDTO + * @Description 修改客户网格数和有效期 + * @author sun + */ + @Override + public void updateCustomerParameter(UpdateCustomerParameterFormDTO formDTO) throws ParseException { + //1.查询客户基本信息 + CustomerEntity entity = baseDao.selectById(formDTO.getCustomerId()); + if (null == entity) { + throw new RenException(ModuleConstant.SELECT_CUSTOMER_ERROR); + } + //2.校验数据合格性 + if (entity.getGridNumber() > formDTO.getGridNumber()) { + throw new RenException(ModuleConstant.GRID_NUMBER_ERROR); + } + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + Date dt1 = df.parse(formDTO.getValidityTime()); + Date dt2 = entity.getValidityTime(); + if (dt1.getTime() < dt2.getTime()) { + throw new RenException(ModuleConstant.VALIDITY_TIME_ERROR); + } + //3.更新数据 + CustomerEntity customerEntity = new CustomerEntity(); + customerEntity.setId(formDTO.getCustomerId()); + customerEntity.setGridNumber(formDTO.getGridNumber()); + customerEntity.setValidityTime(dt1); + if (baseDao.updateById(customerEntity) < NumConstant.ONE) { + throw new RenException(ModuleConstant.UPDATE_CUSTOMER_ERROR); + } + } + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index 46e35aa218..b1d219013a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -95,7 +95,8 @@ SELECT id AS customerId, customer_name AS customerName, - IFNULL( grid_number, 0 ) AS maxGridNum + IFNULL( grid_number, 0 ) AS maxGridNumber, + validity_time AS validityTime FROM customer WHERE diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java index cd924cc5c5..9fb059d520 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java @@ -96,7 +96,7 @@ public class FunctionCustomizedDTO implements Serializable { /** * 业务域名 */ - private String realmName; + private String domainName; /** * 来源app(政府端:gov、居民端:resi) diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java new file mode 100644 index 0000000000..b29c199c3a --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 运营端-定制功能采集-接口入参 + * @Author sun + */ +@Data +public class CustomerFunctionCollectFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + /** + * 功能ID + */ + @NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class}) + private String functionId; + /** + * 上架理由 + */ + @NotBlank(message = "上架理由不能为空", groups = {AddUserShowGroup.class}) + private String reason; + + public interface AddUserInternalGroup {} + + public interface AddUserShowGroup extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java new file mode 100644 index 0000000000..c36d1b609e --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java @@ -0,0 +1,36 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 运营端-客户定制功能顺序修改-接口入参 + * @Author sun + */ +@Data +public class updatedisplayorderListFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 客户Id + */ + @NotBlank(message = "客户ID不能为空", groups = {AddUserInternalGroup.class}) + private String customerId; + /** + * 功能ID + */ + @NotBlank(message = "功能ID不能为空", groups = {AddUserInternalGroup.class}) + private String functionId; + /** + * 排序号 + */ + @NotBlank(message = "排序号不能为空", groups = {AddUserShowGroup.class}) + private Integer displayOrder; + + public interface AddUserInternalGroup {} + + public interface AddUserShowGroup extends CustomerClientShowGroup {} + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java new file mode 100644 index 0000000000..4c38302f8d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 运营端-客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class CustomerFunctionCustomizedListResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + + /** + * 默认功能列表 + */ + private List customerList = new ArrayList<>(); + + /** + * 定制功能列表 + */ + private List functionList = new ArrayList<>(); + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java new file mode 100644 index 0000000000..bab2b06442 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 运营端-客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class CustomerResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 客户Id + */ + private String customerId; + /** + * 定制功能Id + */ + private String functionId; + /** + * 默认功能名称 + */ + private String customizedName; + /** + * 功能所属端(居民端:resi 工作端:work) + */ + private String fromApp; + /** + * 功能说明 + */ + private String functionExplain; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java new file mode 100644 index 0000000000..0fc6777bc1 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 运营端-客户定制功能列表-接口返参 + * @Author sun + */ +@Data +public class FunctionResultDTO implements Serializable { + private static final long serialVersionUID = 2971689193155710437L; + + /** + * 客户Id + */ + private String customerId; + /** + * 定制功能Id + */ + private String functionId; + /** + * 默认功能名称 + */ + private String customizedName; + /** + * 自定义功能名称 + */ + private String functionName; + /** + * 功能所属端(居民端:resi 工作端:work) + */ + private String fromApp; + /** + * 默认大图标 + */ + private String defaultLargeImg; + /** + * 自定义大图标 + */ + private String iconLargeImg; + /** + * 默认小图标 + */ + private String defaultSmallImg; + /** + * 自定义小图标 + */ + private String iconSmallImg; + /** + * 上下架(0:下架、1:上架) + */ + private Integer shoppingStatus; + /** + * 业务域名 + */ + private String domainName; + /** + * 外链地址 + */ + private String targetLink; + /** + * 排序 + */ + private Integer displayOrder; + /** + * 功能说明 + */ + private String functionExplain; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java index 2c174d1c24..42f69d00e2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java @@ -28,9 +28,8 @@ import com.epmet.commons.tools.validator.group.AddGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerFunctionDetailDTO; -import com.epmet.dto.form.FunctionDetailFromDTO; -import com.epmet.dto.form.UpdateCustomerFunctionFormDTO; -import com.epmet.dto.form.UpdateShoppingStatusFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; import com.epmet.dto.result.FunctionDetailResultDTO; import com.epmet.excel.CustomerFunctionDetailExcel; import com.epmet.service.CustomerFunctionDetailService; @@ -155,4 +154,43 @@ public class CustomerFunctionDetailController { formDTO.setUserId(tokenDto.getUserId()); return customerFunctionDetailService.updateCustomerFunction(formDTO); } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能列表 + **/ + @PostMapping("customerfunctionlist") + public Result customerFunctionList(@LoginUser TokenDto tokenDto, @RequestBody CustomerFunctionListFormDTO formDTO) { + return new Result().ok(customerFunctionDetailService.customerFunctionList(formDTO.getCustomerId())); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能顺序修改 + **/ + @PostMapping("updatedisplayorder") + //public Result updateDisplayOrder(@LoginUser TokenDto tokenDto, @RequestParam("formDTO") List formDTO) { + public Result updateDisplayOrder(@LoginUser TokenDto tokenDto, @RequestBody(required = true) List formDTO) { + customerFunctionDetailService.updateDisplayOrder(tokenDto, formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 定制功能采集 + **/ + @PostMapping("customerfunctioncollect") + public Result customerFunctionCollect(@LoginUser TokenDto tokenDto, @RequestBody CustomerFunctionCollectFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, CustomerFunctionCollectFormDTO.AddUserInternalGroup.class, CustomerFunctionCollectFormDTO.AddUserShowGroup.class); + customerFunctionDetailService.customerFunctionCollect(formDTO); + return new Result(); + } + + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java index 7ee1a99567..1a6572179d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java @@ -22,6 +22,7 @@ import com.epmet.dto.CustomerFunctionDetailDTO; import com.epmet.dto.form.FunctionDetailFromDTO; import com.epmet.dto.form.UpdateCustomerFunctionFormDTO; import com.epmet.dto.form.UpdateShoppingStatusFormDTO; +import com.epmet.dto.result.CustomerResultDTO; import com.epmet.dto.result.FunctionDetailResultDTO; import com.epmet.entity.CustomerFunctionDetailEntity; import org.apache.ibatis.annotations.Mapper; @@ -76,4 +77,28 @@ public interface CustomerFunctionDetailDao extends BaseDao selectCustomerFunction(@Param("customerId") String customerId); + + /** + * @param list + * @return + * @Author sun + * @Description 批量更新客户定制功能排序号信息 + **/ + void updateFunctionDetailList(@Param("list") List list); + + /** + * @param customerId + * @return + * @Author sun + * @Description .查询客户当前已有定制功能最大排序号 + **/ + CustomerFunctionDetailDTO selectOrderByCustomerId(@Param("customerId") String customerId); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java index 34b32e48f1..907bfd1595 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java @@ -19,10 +19,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.CustomizedDTO; +import com.epmet.dto.FunctionCustomizedDTO; import com.epmet.dto.form.CommonFunctionIdFormDTO; import com.epmet.dto.form.FunctionCustomizedListFormDTO; import com.epmet.dto.result.FunctionCustomizedDetailResultDTO; import com.epmet.dto.result.FunctionCustomizedListDTO; +import com.epmet.dto.result.FunctionResultDTO; import com.epmet.entity.FunctionCustomizedEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -98,4 +100,20 @@ public interface FunctionCustomizedDao extends BaseDao * @Date 13:26 2020-08-14 **/ void updateFunctionCustomized(FunctionCustomizedEntity entity); + + /** + * @param functionIds + * @return + * @Author sun + * @Description 获取不包含的定制功能列表 + **/ + List selectFunctionCustomizedList(@Param("functionIds") List functionIds); + + /** + * @param functionId + * @return + * @Author sun + * @Description 查询定制功能信息 + **/ + FunctionCustomizedDTO selectByFunctionId(@Param("functionId") String functionId); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java index 786705a763..42cc63eaa9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java @@ -68,7 +68,7 @@ public class FunctionCustomizedExcel { private Date updatedTime; @Excel(name = "业务域名") - private String realmName; + private String domainName; @Excel(name = "来源app(政府端:gov、居民端:resi)") private String fromApp; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java index 3dc099b9ca..7729d60bcd 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java @@ -19,11 +19,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFunctionDetailDTO; -import com.epmet.dto.form.FunctionDetailFromDTO; -import com.epmet.dto.form.UpdateCustomerFunctionFormDTO; -import com.epmet.dto.form.UpdateShoppingStatusFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; import com.epmet.dto.result.FunctionDetailResultDTO; import com.epmet.entity.CustomerFunctionDetailEntity; @@ -127,4 +127,28 @@ public interface CustomerFunctionDetailService extends BaseService formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 定制功能采集 + **/ + void customerFunctionCollect(CustomerFunctionCollectFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java index c1b20c5f75..6a1cf4b69e 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java @@ -21,19 +21,26 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.CustomerFunctionDetailDao; +import com.epmet.dao.FunctionCustomizedDao; +import com.epmet.dao.FunctionShoppingHistoryDao; import com.epmet.dto.CustomerFunctionDetailDTO; +import com.epmet.dto.FunctionCustomizedDTO; import com.epmet.dto.FunctionShoppingHistoryDTO; -import com.epmet.dto.form.FunctionDetailFromDTO; -import com.epmet.dto.form.UpdateCustomerFunctionFormDTO; -import com.epmet.dto.form.UpdateShoppingStatusFormDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerFunctionCustomizedListResultDTO; +import com.epmet.dto.result.CustomerResultDTO; import com.epmet.dto.result.FunctionDetailResultDTO; +import com.epmet.dto.result.FunctionResultDTO; import com.epmet.entity.CustomerFunctionDetailEntity; +import com.epmet.entity.FunctionShoppingHistoryEntity; import com.epmet.redis.CustomerFunctionDetailRedis; import com.epmet.service.CustomerFunctionDetailService; import com.epmet.service.FunctionShoppingHistoryService; @@ -44,10 +51,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 客户定制功能详情表 @@ -61,9 +66,12 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl page(Map params) { @@ -159,4 +167,88 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl customerList = baseDao.selectCustomerFunction(customerId); + resultDTO.setCustomerList(customerList); + + //2.获取客户未有定制功能列表 + List functionIds = customerList.stream().map(CustomerResultDTO::getFunctionId).collect(Collectors.toList()); + List functionList = functionCustomizedDao.selectFunctionCustomizedList(functionIds); + resultDTO.setFunctionList(functionList); + functionList.forEach(fl->{ + fl.setCustomerId(customerId); + }); + + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 客户定制功能顺序修改 + **/ + @Override + public void updateDisplayOrder(TokenDto tokenDto, List formDTO) { + //批量更新客户定制功能排序号信息 + List list = ConvertUtils.sourceToTarget(formDTO, CustomerFunctionDetailEntity.class); + list.forEach(l->{ + l.setUpdatedBy(tokenDto.getUserId()); + }); + baseDao.updateFunctionDetailList(list); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 定制功能采集 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void customerFunctionCollect(CustomerFunctionCollectFormDTO formDTO) { + //1.查询定制功能详细信息 + FunctionCustomizedDTO functionDTO = functionCustomizedDao.selectByFunctionId(formDTO.getFunctionId()); + if(functionDTO == null){ + throw new RenException("根据定制功能Id未查询到定制功能详细信息"); + } + + //2.查询客户当前已有定制功能最大排序号 + CustomerFunctionDetailDTO detailDTO = baseDao.selectOrderByCustomerId(formDTO.getCustomerId()); + int displayOrder = NumConstant.ONE; + if(null!=detailDTO&&null!=detailDTO.getDisplayOrder()){ + displayOrder += detailDTO.getDisplayOrder(); + } + //3.给客户初始定制功能数据 + CustomerFunctionDetailEntity entity = new CustomerFunctionDetailEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setFunctionId(formDTO.getFunctionId()); + entity.setFunctionName(functionDTO.getFunctionId()); + entity.setIconLargeImg(functionDTO.getIconLargeImg()); + entity.setIconSmallImg(functionDTO.getIconSmallImg()); + entity.setDomainName(functionDTO.getDomainName()); + entity.setTargetLink(functionDTO.getTargetLink()); + entity.setShoppingStatus(NumConstant.ONE); + entity.setDisplayOrder(displayOrder); + baseDao.insert(entity); + + //4.记录上下架操作日志 + FunctionShoppingHistoryEntity historyEntity = new FunctionShoppingHistoryEntity(); + historyEntity.setCustomerId(formDTO.getCustomerId()); + historyEntity.setFunctionId(functionDTO.getFunctionId()); + historyEntity.setShoppingStatus(NumConstant.ONE); + historyEntity.setReason(formDTO.getReason()); + functionShoppingHistoryDao.insert(historyEntity); + + } + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql index 5e61ca48a2..1c40bddd4c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql @@ -6,7 +6,7 @@ CREATE TABLE `customer_function_detail` ( `FUNCTION_NAME` varchar(128) NOT NULL COMMENT ''自定义功能名称'', `ICON_LARGE_IMG` varchar(128) NOT NULL COMMENT ''自定义大图标'', `ICON_SMALL_IMG` varchar(128) NOT NULL COMMENT ''自定义小图标'', - `DOMAIN_NAME` varchar(32) NOT NULL COMMENT ''自定义业务域名'', + `DOMAIN_NAME` varchar(32) NOT NULL COMMENT ''自定义业务域名(可设置多个 用分号分隔)'', `TARGET_LINK` varchar(128) NOT NULL COMMENT ''外链地址'', `SHOPPING_STATUS` int(11) NOT NULL COMMENT ''上架状态(0.下架 1.上架)'', `DISPLAY_ORDER` int(11) NOT NULL COMMENT ''自定义排序'', @@ -22,7 +22,7 @@ CREATE TABLE `customer_function_detail` ( ALTER TABLE `function_customized` ADD COLUMN `DOMAIN_NAME` VARCHAR (128) CHARACTER -SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务域名' AFTER `UPDATED_TIME`, +SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务域名(可设置多个 用分号分隔)' AFTER `UPDATED_TIME`, ADD COLUMN `FROM_APP` VARCHAR (32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源app(政府端:gov、居民端:resi)' AFTER `REALM_NAME`; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml index f215a0d80e..ded8b1514d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml @@ -49,6 +49,55 @@ cfd.display_order ASC + + + + UPDATE customer_function_detail SET @@ -80,4 +129,29 @@ AND CUSTOMER_ID = #{customerId} AND FUNCTION_ID = #{functionId} + + + UPDATE customer_function_detail + + + + + when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.displayOrder} + + + + + + when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.updatedBy} + + + + updated_time = now() + + WHERE + del_flag = '0' + + (customer_id = #{item.customerId} and function_id = #{item.functionId}) + + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml index f862114288..99cbf17b15 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml @@ -88,6 +88,38 @@ + + + + UPDATE function_customized SET