From 4683157e5ae9f89cd9869c908fd631aaa4788fe3 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 22 May 2020 01:11:09 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/RoleOperationDefaultDTO.java | 51 ++++++++++++ .../com/epmet/controller/RoleController.java | 3 +- .../epmet/dao/RoleOperationDefaultDao.java | 33 ++++++++ .../entity/RoleOperationDefaultEntity.java | 41 ++++++++++ .../mapper/RoleOperationDefaultDao.xml | 19 +++++ .../com/epmet/dto/form/CustomerFormDTO.java | 8 +- .../dto/result/CustomerDetailResultDTO.java | 17 ++++ .../com/epmet/dto/result/CustomerInfoDTO.java | 9 +++ .../java/com/epmet/dto/result/ManagerDTO.java | 12 +++ .../com/epmet/dto/result/RootAgencyDTO.java | 13 +++ .../epmet/controller/CustomerController.java | 14 ++++ .../com/epmet/service/CustomerService.java | 3 + .../service/impl/CustomerServiceImpl.java | 80 ++++++++++++++++++- .../dto/result/GovStaffRoleResultDTO.java | 8 ++ .../main/resources/mapper/StaffRoleDao.xml | 3 +- 15 files changed, 307 insertions(+), 7 deletions(-) create mode 100755 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java create mode 100755 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java create mode 100755 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java create mode 100755 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java new file mode 100755 index 0000000000..d39f405e29 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/result/RoleOperationDefaultDTO.java @@ -0,0 +1,51 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 角色默认的可操作功能列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-21 + */ +@Data +public class RoleOperationDefaultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String id; + + /** + * 角色KEY + */ + private String roleKey; + + /** + * 操作key + */ + private String operationKey; + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java index 8e9778734b..0cf13fdfb8 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/RoleController.java @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.RoleOperationResultDTO; import com.epmet.service.RoleOperationService; +import oracle.jdbc.proxy.annotation.Post; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -28,6 +29,4 @@ public class RoleController { List roleOperationResultDTOS = roleOperationService.listOperationsByRoleId(roleId); return new Result>().ok(roleOperationResultDTOS); } - - } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java new file mode 100755 index 0000000000..0417991bb5 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/RoleOperationDefaultDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.RoleOperationDefaultEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 角色默认的可操作功能列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-21 + */ +@Mapper +public interface RoleOperationDefaultDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java new file mode 100755 index 0000000000..b19c7e08e0 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/RoleOperationDefaultEntity.java @@ -0,0 +1,41 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +public class RoleOperationDefaultEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 角色KEY + */ + private String roleKey; + + /** + * 操作key + */ + private String operationKey; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml new file mode 100755 index 0000000000..d7d7532ca6 --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/RoleOperationDefaultDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java index 3d0c210087..daab4602dc 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java @@ -17,6 +17,9 @@ public class CustomerFormDTO implements Serializable { public interface AddCustomerGroup { } + public interface GetCustomerDetailGroup { + } + /** * 客户id集合 */ @@ -31,7 +34,10 @@ public class CustomerFormDTO implements Serializable { /** * 组织级别 */ - @NotBlank(message = "客户的级别", groups = {AddCustomerGroup.class}) + @NotBlank(message = "客户的组织级别", groups = {AddCustomerGroup.class}) private String organizationLevel; + + @NotBlank(message = "客户ID", groups = {GetCustomerDetailGroup.class}) + private String customerId; } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java new file mode 100644 index 0000000000..cb2730f9aa --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerDetailResultDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class CustomerDetailResultDTO { + + private RootAgencyDTO rootAgencyDTO; + + private CustomerInfoDTO customerInfoDTO; + + private List managers = new ArrayList<>(); + +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java new file mode 100644 index 0000000000..6c2bd282bf --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoDTO.java @@ -0,0 +1,9 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class CustomerInfoDTO { + private String customerName; + private String organizationLevel; +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java new file mode 100644 index 0000000000..6b0cfb619d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/ManagerDTO.java @@ -0,0 +1,12 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class ManagerDTO { + + private String realName; + private String gender; + private String mobile; + +} diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java new file mode 100644 index 0000000000..27a924084e --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/RootAgencyDTO.java @@ -0,0 +1,13 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class RootAgencyDTO { + private String agencyName; + private String level; + private String areaCode; + private String province; + private String city; + private String district; +} 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 5132a84c38..be507662b6 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,6 +31,7 @@ import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.AddRootAgencyFormDTO; import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.CustomerManagerFormDTO; +import com.epmet.dto.result.CustomerDetailResultDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.excel.CustomerExcel; import com.epmet.feign.GovOrgFeignClient; @@ -209,4 +210,17 @@ public class CustomerController { customerService.addManager(form); return new Result(); } + + /** + * + * 客户详情 + * @param form + * @return + */ + @PostMapping("detail") + public Result getCustomerDetail(@RequestBody CustomerFormDTO form) { + ValidatorUtils.validateEntity(form, CustomerFormDTO.GetCustomerDetailGroup.class); + CustomerDetailResultDTO customerDetailResultDto = customerService.getcustomerDetail(form.getCustomerId()); + return new Result().ok(customerDetailResultDto); + } } 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 03ec98b7b2..28b47d4af0 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 @@ -23,6 +23,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerDTO; import com.epmet.dto.form.CustomerFormDTO; import com.epmet.dto.form.CustomerManagerFormDTO; +import com.epmet.dto.result.CustomerDetailResultDTO; import com.epmet.dto.result.ValidCustomerResultDTO; import com.epmet.entity.CustomerEntity; @@ -145,4 +146,6 @@ public interface CustomerService extends BaseService { * @param form */ void addManager(CustomerManagerFormDTO form); + + CustomerDetailResultDTO getcustomerDetail(String customerId); } 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 33a9ee0781..14f5ff4bcb 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 @@ -20,7 +20,6 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -34,8 +33,7 @@ import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerDTO; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.ValidCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.CustomerEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.GovOrgFeignClient; @@ -274,6 +272,82 @@ public class CustomerServiceImpl extends BaseServiceImpl customerRootAgencyRst = govOrgFeignClient.getCustomerRootAgency(customerId); + if (!customerRootAgencyRst.success()) { + throw new RenException("查询客户详情:查询客户根级组织失败:".concat(customerRootAgencyRst.toString())); + } + + CustomerAgencyDTO customerRootAgency = customerRootAgencyRst.getData(); + + // 管理员 + List managers = new ArrayList<>(); + if (customerRootAgency != null) { + StaffRoleFormDTO staffsInRoleForm = new StaffRoleFormDTO(); + staffsInRoleForm.setOrgId(customerRootAgency.getId()); + staffsInRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_MANAGER); + Result> managersResult = epmetUserFeignClient.getStaffsInRole(staffsInRoleForm); + if (!managersResult.success()) { + throw new RenException("查询客户详情:查询客户管理员失败:".concat(managersResult.toString())); + } + managers = managersResult.getData(); + } + + + + return constructCustomerDetail(customerInfo, customerRootAgency, managers); + } + + /** + * 构造客户详情dto + * @param customerInfo + * @param customerRootAgency + * @param managers + * @return + */ + public CustomerDetailResultDTO constructCustomerDetail(CustomerInfoDTO customerInfo, + CustomerAgencyDTO customerRootAgency, + List managers) { + + CustomerDetailResultDTO customerDetail = new CustomerDetailResultDTO(); + // 构造管理员 + if (!CollectionUtils.isEmpty(managers)) { + for (GovStaffRoleResultDTO manager : managers) { + ManagerDTO managerDTO = new ManagerDTO(); + managerDTO.setRealName(manager.getRealName()); + managerDTO.setMobile(manager.getMobile()); + managerDTO.setGender(manager.getGender()); + customerDetail.getManagers().add(managerDTO); + } + } + + // 客户信息 + customerDetail.setCustomerInfoDTO(customerInfo); + + // 根级组织 + if (customerRootAgency != null) { + RootAgencyDTO rootAgencyDTO = new RootAgencyDTO(); + rootAgencyDTO.setAgencyName(customerRootAgency.getOrganizationName()); + rootAgencyDTO.setAreaCode(customerRootAgency.getAreaCode()); + rootAgencyDTO.setCity(customerRootAgency.getCity()); + rootAgencyDTO.setDistrict(customerRootAgency.getDistrict()); + rootAgencyDTO.setLevel(customerRootAgency.getLevel()); + rootAgencyDTO.setProvince(customerRootAgency.getProvince()); + customerDetail.setRootAgencyDTO(rootAgencyDTO); + } + return customerDetail; + } + /** * 获取客户的有效时长 * @return diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java index 6123f16677..51586242da 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/GovStaffRoleResultDTO.java @@ -53,4 +53,12 @@ public class GovStaffRoleResultDTO implements Serializable { * 角色名称 */ private String roleName; + + /** + * 姓名 + */ + private String realName; + + private String mobile; + private String gender; } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index e7a2ce2fa9..808b7669e1 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -27,10 +27,11 @@