Browse Source

Merge branch 'dev_plugins' into dev_temp

master
sunyuchao 5 years ago
parent
commit
af3db1f56b
  1. 6
      epmet-module/epmet-ext/epmet-ext-client/pom.xml
  2. 6
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java
  3. 6
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinDeptFormDTO.java
  4. 6
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinGridFormDTO.java
  5. 31
      epmet-module/epmet-ext/epmet-ext-server/pom.xml
  6. 5
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java
  7. 31
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/UpdateCustomerParameterFormDTO.java
  8. 26
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtDeptResultDTO.java
  9. 26
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtGridResultDTO.java
  10. 26
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtRoleMapResultDTO.java
  11. 82
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffInfoResultDTO.java
  12. 43
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ExtStaffPermissionResultDTO.java
  13. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  14. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  15. 24
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  16. 37
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  17. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  18. 107
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  19. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/util/ModuleConstant.java
  20. 89
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  21. 38
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/UpdateCustomerFormDTO.java
  22. 10
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerInfoResultDTO.java
  23. 66
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/result/CustomerListResultDTO.java
  24. 8
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/constant/ModuleConstant.java
  25. 56
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  26. 14
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java
  27. 40
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java
  28. 131
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java
  29. 20
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml
  30. 2
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedDTO.java
  31. 36
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFunctionCollectFormDTO.java
  32. 36
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/updatedisplayorderListFormDTO.java
  33. 28
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerFunctionCustomizedListResultDTO.java
  34. 38
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/CustomerResultDTO.java
  35. 4
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionDetailResultDTO.java
  36. 74
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FunctionResultDTO.java
  37. 44
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java
  38. 25
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java
  39. 18
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedDao.java
  40. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedExcel.java
  41. 30
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java
  42. 119
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionDetailServiceImpl.java
  43. 4
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql
  44. 74
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml
  45. 32
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml
  46. 3
      epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/form/ResiTopicOperationFormDTO.java
  47. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/CommonStaffIdFormDTO.java
  48. 31
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UpdateRootManageFormDTO.java
  49. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  50. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  51. 26
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  52. 13
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StaffAgencyVisitedController.java
  53. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  54. 18
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  55. 9
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java
  56. 34
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  57. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java
  58. 60
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

6
epmet-module/epmet-ext/epmet-ext-client/pom.xml

@ -26,6 +26,12 @@
<version>3.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-user-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

6
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
*/

6
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
*/

6
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
*/

31
epmet-module/epmet-ext/epmet-ext-server/pom.xml

@ -26,6 +26,11 @@
<artifactId>epmet-ext-client</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-extapp-auth</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
@ -133,38 +138,12 @@
<version>3.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-common-clienttoken</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-crm-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-oss-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.1.12.RELEASE</version>
<scope>compile</scope>
</dependency>
<!-- 钉钉机器人 -->
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>

5
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<List<StaffSinGridResultDTO>> 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<List<StaffSinDeptResultDTO>> 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<List<StaffSinAgencyResultDTO>> staffSinAgency(@RequestBody StaffSinAgencyFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StaffSinAgencyFormDTO.StaffSinAgency.class);

31
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{}
}

26
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;
}

26
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;
}

26
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;
}

82
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<ExtRoleMapResultDTO> roleList;
}

43
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<ExtGridResultDTO> gridList = new ArrayList<>();
/**
* 直属机关直属部门列表
* */
private List<ExtDeptResultDTO> departmentList = new ArrayList<>();
/**
* 子集机关列表
* */
private List<ExtStaffPermissionResultDTO> subAgencyList = new ArrayList<>();
}

10
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<List<String>> 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<ExtStaffInfoResultDTO> staffInfoExt(@RequestBody ExtStaffInfoResultDTO result);
}

5
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<List<String>> getAgencyStaffs(AgencyIdFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyStaffs", formDTO);
}
@Override
public Result<ExtStaffInfoResultDTO> staffInfoExt(ExtStaffInfoResultDTO result) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "staffInfoExt", result);
}
}

24
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -193,4 +193,28 @@ public class CustomerAgencyController {
Result<ActSponsorResultDTO> querySponsorList(@PathVariable("staffId") String staffId){
return new Result<ActSponsorResultDTO>().ok(customerAgencyService.querySponsorList(staffId));
}
/**
* @Description 对外接口 获取工作人员基本信息
* @param result ExtStaffInfoResultDTO.class
* @return Result<ExtStaffInfoResultDTO>
* @author wangc
* @date 2020.08.17 13:52
**/
@PostMapping("staffinfoext")
Result<ExtStaffInfoResultDTO> staffInfoExt(@RequestBody ExtStaffInfoResultDTO result){
return new Result<ExtStaffInfoResultDTO>().ok(customerAgencyService.staffInfoExt(result));
}
/**
* @Description 根据staffId查询当前这个用户的数据权限对外接口
* @param staffId
* @return
* @author wangc
* @date 2020.08.17 17:30
**/
@PostMapping("permissionext/{staffId}")
Result<ExtStaffPermissionResultDTO> staffPermissionExt(@PathVariable(value = "staffId") String staffId){
return new Result<ExtStaffPermissionResultDTO>().ok(customerAgencyService.staffPermissionExt(staffId));
}
}

37
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -124,4 +124,41 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
* @Description 递归查询当前机关的下一级机关列表
**/
List<ArticleGridResultDTO> 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<ExtStaffPermissionResultDTO> selectSubAgencyByPid(@Param("pid") String pid);
/**
* @Description 根据agencyId查找指定机构直属的部门将grid与dept分开是因为grid与dept的数量可能不等造成重复数据无法去重
* @param agencyId
* @return
* @author wangc
* @date 2020.08.18 13:42
**/
List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId);
}

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -178,4 +178,22 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @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);
}

107
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<CustomerAgencyDao
}
/**
* @Description 查询工作人员的信息多客户/单客户epmet-plugin对外开放调用
* @param result
* @return
* @author wangc
* @date 2020.08.17 09:29
**/
@Override
public ExtStaffInfoResultDTO staffInfoExt(ExtStaffInfoResultDTO result) {
//1.查找对应的所属关系,通过最近一次登陆的网格,通过网格查找对应的机关和客户
ExtStaffInfoResultDTO orgInfo =
baseDao.selectAgencyAndGridInfoExt(result.getGridId());
mergeObject(orgInfo,result);
//2.查找客户名称
CustomerDTO customerParam = new CustomerDTO();
customerParam.setId(result.getCustomerId());
Result<CustomerDTO> 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<String> 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 <T> 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 <T> 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) {
}
}
}
}

2
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 = "";
}

89
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -169,4 +169,93 @@
ORDER BY created_time DESC
</select>
<!-- 查询一个工作人员最近登录的网格以及机关信息 -->
<select id="selectAgencyAndGridInfoExt" resultType="com.epmet.dto.result.ExtStaffInfoResultDTO">
SELECT
gridd.GRID_NAME,
agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,
agency.PID AS agencyIdPath,
agency.ALL_PARENT_NAME AS agencyNamePath,
agency.CUSTOMER_ID AS customerId
FROM
CUSTOMER_GRID gridd
LEFT JOIN CUSTOMER_AGENCY agency ON gridd.PID = agency.ID
AND agency.DEL_FLAG = '0'
WHERE
gridd.DEL_FLAG = '0'
AND gridd.ID = #{gridId}
</select>
<resultMap id="treeMap" type="com.epmet.dto.result.ExtStaffPermissionResultDTO">
<id column="agencyId" property="agencyId" />
<result column="agencyName" property="agencyName"/>
<collection property="gridList" ofType="com.epmet.dto.result.ExtGridResultDTO">
<id column="gridId" property="gridId" />
<result column="gridName" property="gridName" />
</collection>
<collection property="departmentList" column="agencyId" ofType="com.epmet.dto.result.ExtDeptResultDTO" select="selectDeptList">
<id column="deptId" property="deptId" />
<result column="deptName" property="deptName" />
</collection>
<collection property="subAgencyList" column="agencyId"
ofType="com.epmet.dto.result.ExtStaffPermissionResultDTO" select="selectSubAgencyByPid">
<!-- <collection property="gridList" ofType="com.epmet.dto.result.ExtGridResultDTO">
<id column="ID" property="gridId" />
<result column="GRID_NAME" property="gridName" />
</collection>
<collection property="departmentList" ofType="com.epmet.dto.result.ExtDeptResultDTO" select="selectDeptList">
<id column="ID" property="deptId" />
<result column="DEPARTMENT_ID" property="deptName" />
</collection>-->
</collection>
</resultMap>
<select id="selectAgencyById" resultMap="treeMap">
SELECT
agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,
grid.ID AS gridId,
grid.GRID_NAME AS gridName
FROM
CUSTOMER_AGENCY agency
LEFT JOIN CUSTOMER_GRID grid ON agency.ID = grid.PID
AND grid.DEL_FLAG = '0'
WHERE
agency.DEL_FLAG = '0'
AND agency.ID = #{agencyId}
</select>
<select id="selectDeptList" resultType="com.epmet.dto.result.ExtDeptResultDTO">
SELECT
ID AS deptId,
DEPARTMENT_NAME AS deptName
FROM
CUSTOMER_DEPARTMENT dept
WHERE
DEL_FLAG = '0'
AND AGENCY_ID = #{agencyId}
</select>
<select id="selectSubAgencyByPid" resultMap="treeMap">
SELECT
agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName,
grid.ID AS gridId,
grid.GRID_NAME AS gridName
FROM
CUSTOMER_AGENCY agency
LEFT JOIN CUSTOMER_GRID grid ON agency.ID = grid.PID
AND grid.DEL_FLAG = '0'
WHERE
agency.DEL_FLAG = '0'
AND agency.PID = #{pid}
</select>
</mapper>

38
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;
}

10
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;
}

66
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.乡镇街道级 字典表keyorganizationlevel
*/
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;
}

8
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 = "更新客户基本信息失败";
}

56
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<CustomerInfoResultDTO>().ok(customerService.getCustomer(formDTO));
}
/**
* 获取crm客户列表
* @author zhaoqifeng
* @date 2020/8/19 10:46
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.CustomerListResultDTO>>
*/
@PostMapping("customerlist")
public Result<List<CustomerListResultDTO>> customerList(@RequestBody PageQueryFormDTO formDTO) {
List<CustomerListResultDTO> result = customerService.customerList(formDTO);
return new Result<List<CustomerListResultDTO>>().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<CustomerInfoResultDTO> getCustomerParameter(@RequestBody CustomerIdFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, CustomerIdFormDTO.Customer.class);
return new Result<CustomerInfoResultDTO>().ok(customerService.getCustomerParameter(formDTO));
}
/**
* @param formDTO
* @Description 修改客户网格数和有效期
* @author sun
*/
@PostMapping("updatecustomerparameter")
public Result<CustomerInfoResultDTO> updateCustomerParameter(@RequestBody UpdateCustomerParameterFormDTO formDTO) throws ParseException {
ValidatorUtils.validateEntity(formDTO, UpdateCustomerParameterFormDTO.Customer.class);
customerService.updateCustomerParameter(formDTO);
return new Result();
}
}

14
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<CustomerEntity> {
*/
CustomerInfoResultDTO selectCustomerBasicInfo(@Param("customerId")String customerId);
/**
* 获取crm客户列表
* @author zhaoqifeng
* @date 2020/8/19 10:17
* @param customerName
* @return java.util.List<com.epmet.dto.result.CustomerListResultDTO>
*/
List<CustomerListResultDTO> selectAllCustomerList(@Param("customerName") String customerName);
}

40
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<CustomerEntity> {
* @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<CustomerListResultDTO> 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;
}

131
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<CustomerDao, CustomerEn
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private CustomerDao customerDao;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Override
public PageData<CustomerDTO> page(Map<String, Object> params) {
@ -572,8 +573,128 @@ public class CustomerServiceImpl extends BaseServiceImpl<CustomerDao, CustomerEn
if (!result.success()){
throw new RenException(ModuleConstant.ERROR_GOV_ORG_COUNT);
}
customerInfoResultDTO.setCreateGridNum(result.getData().getGridCount());
customerInfoResultDTO.setCreateGridNumber(result.getData().getGridCount());
return customerInfoResultDTO;
}
@Override
public List<CustomerListResultDTO> customerList(PageQueryFormDTO formDTO) {
PageInfo<CustomerListResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
.doSelectPageInfo(() -> baseDao.selectAllCustomerList(formDTO.getCustomerName()));
List<CustomerListResultDTO> list = pageInfo.getList();
if(null != list) {
list.forEach(dto -> {
// 根级组织
Result<CustomerAgencyDTO> 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<List<GovStaffRoleResultDTO>> 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<CustomerAgencyDTO> 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<CustomerGridCountResultDTO> 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);
}
}
}

20
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}
</select>
<select id="selectAllCustomerList" resultType="com.epmet.dto.result.CustomerListResultDTO">
SELECT
ID AS "customerId",
CUSTOMER_NAME,
TITLE,
VALIDITY_TIME,
ORGANIZATION_LEVELS,
LOGO,
GRID_NUMBER
FROM customer
WHERE
DEL_FLAG = '0'
<if test='customerName != "" and customerName != null'>
AND customer_name LIKE concat('%', trim(#{customerName}), '%')
</if>
</select>
</mapper>

2
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)

36
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 {}
}

36
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 {}
}

28
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<CustomerResultDTO> customerList = new ArrayList<>();
/**
* 定制功能列表
*/
private List<FunctionResultDTO> functionList = new ArrayList<>();
}

38
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;
}

4
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;
}

74
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;
}

44
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<CustomerFunctionCustomizedListResultDTO> customerFunctionList(@LoginUser TokenDto tokenDto, @RequestBody CustomerFunctionListFormDTO formDTO) {
return new Result<CustomerFunctionCustomizedListResultDTO>().ok(customerFunctionDetailService.customerFunctionList(formDTO.getCustomerId()));
}
/**
* @param formDTO
* @return
* @Author sun
* @Description 客户定制功能顺序修改
**/
@PostMapping("updatedisplayorder")
//public Result updateDisplayOrder(@LoginUser TokenDto tokenDto, @RequestParam("formDTO") List<updatedisplayorderListFormDTO> formDTO) {
public Result updateDisplayOrder(@LoginUser TokenDto tokenDto, @RequestBody(required = true) List<updatedisplayorderListFormDTO> 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();
}
}

25
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<CustomerFunctionDetai
* @Date 10:00 2020-08-17
**/
void updateCustomerFunction(UpdateCustomerFunctionFormDTO formDTO);
/**
* @param customerId
* @return
* @Author sun
* @Description 获取客户已有定制功能列表信息
**/
List<CustomerResultDTO> selectCustomerFunction(@Param("customerId") String customerId);
/**
* @param list
* @return
* @Author sun
* @Description 批量更新客户定制功能排序号信息
**/
void updateFunctionDetailList(@Param("list") List<CustomerFunctionDetailEntity> list);
/**
* @param customerId
* @return
* @Author sun
* @Description .查询客户当前已有定制功能最大排序号
**/
CustomerFunctionDetailDTO selectOrderByCustomerId(@Param("customerId") String customerId);
}

18
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<FunctionCustomizedEntity>
* @Date 13:26 2020-08-14
**/
void updateFunctionCustomized(FunctionCustomizedEntity entity);
/**
* @param functionIds
* @return
* @Author sun
* @Description 获取不包含的定制功能列表
**/
List<FunctionResultDTO> selectFunctionCustomizedList(@Param("functionIds") List<String> functionIds);
/**
* @param functionId
* @return
* @Author sun
* @Description 查询定制功能信息
**/
FunctionCustomizedDTO selectByFunctionId(@Param("functionId") String functionId);
}

2
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;

30
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<CustomerFunct
* @Date 10:00 2020-08-17
**/
Result updateCustomerFunction(UpdateCustomerFunctionFormDTO formDTO);
/**
* @param customerId
* @return
* @Author sun
* @Description 客户定制功能列表
**/
CustomerFunctionCustomizedListResultDTO customerFunctionList(String customerId);
/**
* @param formDTO
* @return
* @Author sun
* @Description 客户定制功能顺序修改
**/
void updateDisplayOrder(TokenDto tokenDto, List<updatedisplayorderListFormDTO> formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 定制功能采集
**/
void customerFunctionCollect(CustomerFunctionCollectFormDTO formDTO);
}

119
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<CustomerF
private Logger logger = LogManager.getLogger(CustomerFunctionDetailServiceImpl.class);
@Autowired
private CustomerFunctionDetailRedis customerFunctionDetailRedis;
@Autowired
private FunctionShoppingHistoryService functionShoppingHistoryService;
@Autowired
private FunctionCustomizedDao functionCustomizedDao;
@Autowired
private FunctionShoppingHistoryDao functionShoppingHistoryDao;
@Override
public PageData<CustomerFunctionDetailDTO> page(Map<String, Object> params) {
@ -125,6 +136,16 @@ public class CustomerFunctionDetailServiceImpl extends BaseServiceImpl<CustomerF
//根据客户Id和所属端查询客户定制功能列表数据
logger.info(String.format("根据客户Id和所属端查询客户定制功能列表,对应客户Id->%s,所属端->%s", formDTO.getCustomerId(), formDTO.getClientType()));
List<FunctionDetailResultDTO> 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<CustomerF
return new Result();
}
/**
* @param customerId
* @return
* @Author sun
* @Description 客户定制功能列表
**/
@Override
public CustomerFunctionCustomizedListResultDTO customerFunctionList(String customerId) {
CustomerFunctionCustomizedListResultDTO resultDTO = new CustomerFunctionCustomizedListResultDTO();
//1.获取客户已有定制功能列表,按排序号排序
List<CustomerResultDTO> customerList = baseDao.selectCustomerFunction(customerId);
resultDTO.setCustomerList(customerList);
//2.获取客户未有定制功能列表
List<String> functionIds = customerList.stream().map(CustomerResultDTO::getFunctionId).collect(Collectors.toList());
List<FunctionResultDTO> 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<updatedisplayorderListFormDTO> formDTO) {
//批量更新客户定制功能排序号信息
List<CustomerFunctionDetailEntity> 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);
}
}

4
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`;

74
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml

@ -49,6 +49,55 @@
cfd.display_order ASC
</select>
<select id="selectCustomerFunction" resultType="com.epmet.dto.result.CustomerResultDTO">
SELECT
cfd.customer_id AS "customerId",
cfd.function_id AS "functionId",
cfd.function_name AS "functionName",
cfd.icon_large_img AS "iconLargeImg",
cfd.icon_small_img AS "iconSmallImg",
cfd.display_order AS "displayOrder",
fc.customized_name AS "customizedName",
fc.from_app AS "fromApp",
fc.icon_large_img AS "defaultLargeImg",
fc.icon_small_img AS "defaultSmallImg ",
fc.domain_name AS "domainName",
fc.target_link AS "targetLink",
f.shopping_status AS "shoppingStatus",
f.function_explain AS "functionExplain"
FROM
customer_function_detail cfd
INNER JOIN function_customized fc ON cfd.function_id = fc.function_id
INNER JOIN `function` f ON cfd.function_id = f.id
WHERE
cfd.del_flag = '0'
AND fc.del_flag = '0'
AND f.del_flag = '0'
AND cfd.customer_id = #{customerId}
ORDER BY
cfd.DISPLAY_ORDER ASC
</select>
<select id="selectOrderByCustomerId" resultType="com.epmet.dto.CustomerFunctionDetailDTO">
SELECT
customer_id,
function_id,
function_name,
icon_large_img,
icon_small_img,
domain_name,
target_link,
shopping_status,
IFNULL(display_order, 0) AS displayOrder
FROM
customer_function_detail
WHERE
del_flag = '0'
AND customer_id = #{customerId}
ORDER BY display_order DESC
LIMIT 1
</select>
<update id="updateShoppingStatus" parameterType="com.epmet.dto.form.UpdateShoppingStatusFormDTO">
UPDATE customer_function_detail
SET
@ -80,4 +129,29 @@
AND CUSTOMER_ID = #{customerId}
AND FUNCTION_ID = #{functionId}
</update>
<update id="updateFunctionDetailList">
UPDATE customer_function_detail
<trim prefix="set" suffixOverrides=",">
<trim prefix="display_order =(case" suffix="end),">
<foreach collection="list" item="item">
when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.displayOrder}
</foreach>
</trim>
<trim prefix="updated_by =(case" suffix="end),">
<foreach collection="list" item="item">
when customer_id = #{item.customerId} and function_id = #{item.functionId} then #{item.updatedBy}
</foreach>
</trim>
updated_time = now()
</trim>
WHERE
del_flag = '0'
<foreach collection="list" item="item" open="AND( " separator=" OR " index="index" close=")">
(customer_id = #{item.customerId} and function_id = #{item.functionId})
</foreach>
</update>
</mapper>

32
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml

@ -88,6 +88,38 @@
</if>
</select>
<select id="selectFunctionCustomizedList" resultType="com.epmet.dto.result.FunctionResultDTO">
SELECT
fc.FUNCTION_ID AS "functionId",
fc.CUSTOMIZED_NAME AS "customizedName",
fc.FROM_APP AS "fromApp",
f.FUNCTION_EXPLAIN AS "functionExplain"
FROM
function_customized fc
INNER JOIN `function` f ON fc.FUNCTION_ID = f.ID
WHERE
fc.DEL_FLAG = '0'
AND f.DEL_FLAG = '0'
<foreach collection="functionIds" item="functionId" index="index" open="AND ( " separator=" AND " close=")">
fc.FUNCTION_ID != #{functionId}
</foreach>
</select>
<select id="selectByFunctionId" resultType="com.epmet.dto.FunctionCustomizedDTO">
SELECT
function_id,
customized_name,
icon_large_img,
icon_small_img,
domain_name,
target_link
FROM
function_customized
WHERE
del_flag = '0'
AND function_id = #{functionId}
</select>
<update id="updateFunctionCustomized" parameterType="com.epmet.entity.FunctionCustomizedEntity">
UPDATE function_customized
SET

3
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;
}

24
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;
}

31
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;
}

20
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<List<StaffSinGridResultDTO>> getStaffInfoList(@RequestBody UserIdsFormDTO formDTO);
/**
* @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId
* @param staffId
* @return
* @author wangc
* @date 2020.08.17 17:45
**/
@GetMapping("/epmet/staffagencyvisited/latestagency/{staffId}")
Result<String> 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);
}

10
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<List<StaffSinGridResultDTO>> getStaffInfoList(UserIdsFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getStaffInfoList", formDTO);
}
@Override
public Result<String> 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);
}
}

26
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<List<StaffSinGridResultDTO>>().ok(customerStaffService.getStaffInfoList(formDTO));
}
/**
* @Description 查找工作人员的信息 - 对外开放接口
* @param staffParam
* @return
* @author wangc
* @date 2020.08.17 10:30
**/
@PostMapping("extstaffinfo")
public Result<ExtStaffInfoResultDTO> extStaffInfo(CommonStaffIdFormDTO staffParam){
ValidatorUtils.validateEntity(staffParam, CommonStaffIdFormDTO.StaffIdGroup.class);
return new Result<ExtStaffInfoResultDTO>().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();
}
}

13
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<String> latestAgency(@PathVariable("staffId") String staffId){
return new Result<String>().ok(staffAgencyVisitedService.getLatestStaffAgencyId(staffId));
}
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -153,4 +153,23 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @date 2020/8/13 1:45 下午
*/
List<StaffSinGridResultDTO> getStaffInfoList(@Param("userIds")List<String> 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);
}

18
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -266,4 +266,22 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @date 2020/8/13 1:45 下午
*/
List<StaffSinGridResultDTO> 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);
}

9
epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffAgencyVisitedService.java

@ -114,4 +114,13 @@ public interface StaffAgencyVisitedService extends BaseService<StaffAgencyVisite
**/
Result saveStaffLoginRecord(StaffLoginAgencyRecordFormDTO formDTO);
/**
* @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId
* @param staffId
* @return
* @author wangc
* @date 2020.08.17 17:45
**/
String getLatestStaffAgencyId(String staffId);
}

34
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -576,4 +576,38 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return staffInfoList;
}
/**
* @Description 查找工作人员的信息 - 对外开放接口
* @param staffParam
* @return
* @author wangc
* @date 2020.08.17 10:30
**/
@Override
public ExtStaffInfoResultDTO extStaffInfo(CommonStaffIdFormDTO staffParam) {
//查找工作人员信息
//最近一次登陆的而网格、人员信息、权限
ExtStaffInfoResultDTO result = baseDao.selectStaffInfoExt(staffParam.getStaffId());
if(null != result) {
Result<ExtStaffInfoResultDTO> 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);
}
}

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffAgencyVisitedServiceImpl.java

@ -127,4 +127,20 @@ public class StaffAgencyVisitedServiceImpl extends BaseServiceImpl<StaffAgencyVi
return new Result();
}
/**
* @Description 根绝staffId查询最近一次(既当前)登录到的AgencyId
* @param staffId
* @return
* @author wangc
* @date 2020.08.17 17:45
**/
@Override
public String getLatestStaffAgencyId(String staffId) {
StaffLatestAgencyResultDTO latestAgency =
baseDao.selectLatestCustomer(staffId);
if(null != latestAgency)
return latestAgency.getAgencyId();
return null;
}
}

60
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -235,4 +235,64 @@
cs.user_id = #{userId}
</foreach>
</select>
<!-- 工作人员信息Map -->
<resultMap id="StaffInfoAndRoleMap" type="com.epmet.dto.result.ExtStaffInfoResultDTO">
<result property="nickname" column="nickname"/>
<result property="profile" column="profile"/>
<result property="realName" column="realName"/>
<result property="gridId" column="GRID_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<collection property="roleList" ofType="com.epmet.dto.result.ExtRoleMapResultDTO">
<result property="roleKey" column="ROLE_KEY" />
<result property="roleName" column="ROLE_NAME" />
</collection>
</resultMap>
<!-- 查询工作人员信息 (对外接口) -->
<select id="selectStaffInfoExt" resultMap="StaffInfoAndRoleMap">
SELECT
staff.REAL_NAME AS nickname,
'' AS PROFILE,
staff.REAL_NAME AS realName,
role.ROLE_KEY,
role.ROLE_NAME,
vis.GRID_ID
FROM
CUSTOMER_STAFF staff
LEFT JOIN (
SELECT
role.STAFF_ID,
rolename.CUSTOMER_ID,
rolename.ROLE_KEY,
rolename.ROLE_NAME
FROM
STAFF_ROLE role
LEFT JOIN GOV_STAFF_ROLE rolename ON role.ROLE_ID = rolename.ID
AND rolename.DEL_FLAG = '0'
WHERE
role.DEL_FLAG = '0'
AND role.STAFF_ID = #{staffId}
) role ON staff.USER_ID = role.STAFF_ID
LEFT JOIN ( SELECT GRID_ID, CUSTOMER_ID, STAFF_ID FROM STAFF_GRID_VISITED WHERE DEL_FLAG = '0' AND STAFF_ID = #{staffId} ORDER BY UPDATED_TIME DESC LIMIT 1 ) vis ON staff.USER_ID = vis.STAFF_ID
AND vis.CUSTOMER_ID = role.CUSTOMER_ID
WHERE
DEL_FLAG = '0'
AND USER_ID = #{staffId}
</select>
<select id="selectRootManage" resultType="com.epmet.dto.CustomerStaffDTO">
SELECT s.ID
FROM
staff_role sr
INNER JOIN gov_staff_role r ON ( sr.ROLE_ID = r.ID )
INNER JOIN customer_staff s ON (sr.STAFF_ID = s.USER_ID)
WHERE
r.ROLE_KEY = #{roleKey}
AND sr.ORG_ID = #{orgId}
AND sr.DEL_FLAG = '0'
AND r.DEL_FLAG = '0'
AND S.DEL_FLAG = '0'
</select>
</mapper>
Loading…
Cancel
Save