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/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/pom.xml b/epmet-module/epmet-ext/epmet-ext-server/pom.xml index ab999ea3dc..7548f528d1 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 - - 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..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.*; @@ -13,6 +14,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; /** @@ -32,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); @@ -44,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); @@ -56,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); 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/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 new file mode 100644 index 0000000000..018c298c50 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java @@ -0,0 +1,26 @@ +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; + + /** + * 网格Id + * */ + private String gridId; + + /** + * 网格名称 + * */ + private String gridName; +} 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/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..8408c42dbf --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java @@ -0,0 +1,43 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +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; + + /** + * 直属机关Id + * */ + private String agencyId; + + /** + * 直属机关名称 + * */ + private String agencyName; + + /** + * 直属机关直属网格列表 + * */ + private List gridList = new ArrayList<>(); + + /** + * 直属机关直属部门列表 + * */ + private List departmentList = new ArrayList<>(); + + /** + * 子集机关列表 + * */ + private List subAgencyList = new ArrayList<>(); +} 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 2ada6a69a3..2311670af0 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") 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..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 @@ -193,4 +193,28 @@ 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)); + } + + /** + * @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 8a51d3ad19..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 @@ -124,4 +124,41 @@ 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); + + /** + * @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/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index cacba8512e..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 @@ -178,4 +178,22 @@ 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); + + /** + * @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 e399d29b85..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 @@ -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,109 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl customerResult = + operCrmFeignClient.getCustomerInfo(customerParam); + if(customerResult.success() && null != customerResult.getData()){ + result.setCustomerName(customerResult.getData().getCustomerName()); + } + checkFieldAndSetDefault(result); + result.setAdminFlag(NumConstant.ZERO_STR); + if(null != result.getRoleList() && !result.getRoleList().isEmpty()){ + result.getRoleList().forEach(o -> { + if(StringUtils.equals("root_manager",o.getRoleKey())){ + result.setAdminFlag(NumConstant.ONE_STR); + } + }); + } + return result; + } + + /** + * @Description 根据staffId,查询当前这个用户的数据权限 + * @param staffId + * @return + * @author wangc + * @date 2020.08.17 17:30 + **/ + @Override + public ExtStaffPermissionResultDTO staffPermissionExt(String staffId) { + + //1.通过staffId去user服务查询最近一次登陆的agencyId + Result 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; + } + + + + } + + + 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..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 @@ -169,4 +169,93 @@ ORDER BY created_time DESC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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/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-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/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 0369274a34..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 @@ -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; @@ -44,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; @@ -279,4 +277,54 @@ 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(); + } + + /** + * @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/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..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 @@ -22,13 +22,10 @@ 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; +import java.text.ParseException; import java.util.List; import java.util.Map; @@ -189,4 +186,37 @@ 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); + + /** + * @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 51364b48d9..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 @@ -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; @@ -54,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; @@ -79,6 +78,8 @@ public class CustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -572,8 +573,128 @@ 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())); + } + } + } + + /** + * @param formDTO + * @Description 获取客户最大网格数和有效期 + * @author sun + */ + @Override + public CustomerInfoResultDTO getCustomerParameter(CustomerIdFormDTO formDTO) { + //1.查询客户基本信息 + CustomerInfoResultDTO customerInfoResultDTO = customerDao.selectCustomerBasicInfo(formDTO.getCustomerId()); + if (null == customerInfoResultDTO) { + throw new RenException(ModuleConstant.SELECT_CUSTOMER_ERROR); + } + + //2.查询客户实际网格数 + Result 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 33c0dd52e2..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,11 +95,29 @@ 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 del_flag = 0 AND id = #{customerId} + + 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/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-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 faa4fa72df..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,17 +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; @@ -42,9 +51,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 客户定制功能详情表 @@ -58,9 +66,12 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl page(Map params) { @@ -125,6 +136,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; } @@ -146,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 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 47ca98ae7b..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,6 +29,9 @@ public class ResiTopicOperationFormDTO implements Serializable { /** * 是否解决(已解决 resolved,未解决 unresolved) */ + //@NotBlank(message = "解决状态不能为空") private String closedStatus; + + } 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-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 e627d868a9..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 @@ -268,4 +268,24 @@ 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); + + /** + * 修改根管理员信息 + * @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 f434996933..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 @@ -188,4 +188,14 @@ 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); + } + + @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 8ed7c0727d..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 @@ -333,4 +333,30 @@ 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)); + } + + /** + * 修改根管理员信息 + * @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/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/dao/CustomerStaffDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java index ce0ff406c7..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 @@ -153,4 +153,23 @@ 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); + + /** + * 获取根管理员信息 + * @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 1eb5e070e4..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 @@ -266,4 +266,22 @@ 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); + + /** + * 修改根管理员信息 + * @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/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 govOrgResult = + govOrgOpenFeignClient.staffInfoExt(result); + if(govOrgResult.success() && null != govOrgResult.getData()){ + return govOrgResult.getData(); + } + } + return null; + } + + @Override + public void updateRootManage(UpdateRootManageFormDTO formDTO) { + CustomerStaffDTO dto = baseDao.selectRootManage(formDTO.getOrgId(), formDTO.getRoleKey()); + if (null == dto) { + throw new RenException("查询客户管理员失败"); + } + dto.setRealName(formDTO.getRootManageName()); + dto.setMobile(formDTO.getRootManagePhone()); + update(dto); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java index 11fb4702ca..7e2e2fd706 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java @@ -127,4 +127,20 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + + \ No newline at end of file