Browse Source

/epmet/ext/staff/permissionv2 暂存

dev_shibei_match
yinzuomei 5 years ago
parent
commit
909d77a70a
  1. 34
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffPermissionFormDTO.java
  2. 53
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java
  3. 31
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/DeptNodeDTO.java
  4. 31
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/GridNodeDTO.java
  5. 23
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/StaffPermissionResultDTO.java
  6. 11
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java
  7. 8
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java
  8. 32
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java
  9. 9
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java
  10. 11
      epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java
  11. 19
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java
  12. 16
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java
  13. 8
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java
  14. 12
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java
  15. 12
      epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml

34
epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffPermissionFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* 008当前用户的数据权限(多客户版本) 入参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 21:08
*/
@Data
public class StaffPermissionFormDTO {
/**
* 当前登录用户
*/
@NotBlank(message = "staffId不能为空;")
private String staffId;
/**
* 当前工作人员所属customerId,接口入参传入
*/
@NotBlank(message = "当前工作人员所属customerId不能为空;")
private String customerId;
/**
* 当前工作人员所属agencyId,接口入参传入
*/
@NotBlank(message = "当前工作人员所属agencyId不能为空")
private String agencyId;
}

53
epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java

@ -0,0 +1,53 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 008当前用户的数据权限(多客户版本) 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 20:33
*/
@Data
public class AgencyNodeDTO implements Serializable {
private static final long serialVersionUID = -3745920378557792529L;
/**
* 直属机关Id
* */
private String agencyId;
/**
* 直属机关名称
* */
private String agencyName;
/**
* 机关级别社区级community 街道:street, 区县级: district, 市级: city 省级:province
* */
private String level;
/**
* 直属机关直属网格列表
* */
private List<GridNodeDTO> gridList = new ArrayList<>();
/**
* 直属机关直属部门列表
* */
private List<DeptNodeDTO> departmentList = new ArrayList<>();
/**
* 子集机关列表
* */
private List<AgencyNodeDTO> subAgencyList = new ArrayList<>();
/**
* 当前agencyId所属的客户id add02.03
* */
private String customerId;
}

31
epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/DeptNodeDTO.java

@ -0,0 +1,31 @@
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 DeptNodeDTO implements Serializable {
private static final long serialVersionUID = 1792371558965832432L;
/**
* 部门Id
* */
private String deptId;
/**
* 部门名称
* */
private String deptName;
/**
* 当前deptId所属的customerId add02.03
* */
private String customerId;
}

31
epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/GridNodeDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
/**
* 008当前用户的数据权限(多客户版本) 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 20:33
*/
@Data
public class GridNodeDTO implements Serializable {
private static final long serialVersionUID = -4531574240525562587L;
/**
* 网格Id
* */
private String gridId;
/**
* 网格名称
* */
private String gridName;
/**
* 当前gridId所属的客户id add02.03
* */
private String customerId;
}

23
epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/StaffPermissionResultDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.result;
import lombok.Data;
import java.util.List;
/**
* 008当前用户的数据权限(多客户版本) 返参DTO
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 20:33
*/
@Data
public class StaffPermissionResultDTO {
/**
* 当前用户拥有客户权限集合
*/
private List<String> customerIds;
/**
* 当前工作人员所属组织及下级
*/
private AgencyNodeDTO agencyTree;
}

11
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java

@ -136,5 +136,16 @@ public class OpenUpController {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
return new Result<CustomerInfoQueryResultDTO>().ok(openUpService.queryCustomerInfo(formDTO)); return new Result<CustomerInfoQueryResultDTO>().ok(openUpService.queryCustomerInfo(formDTO));
} }
/**
* @author yinzuomei
* @description 008当前用户的数据权限(多客户版本)
* @Date 2021/2/3 18:05
**/
@PostMapping("permissionv2")
public Result<StaffPermissionResultDTO> queryStaffPermissionV2(@RequestBody StaffPermissionFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO);
return new Result<StaffPermissionResultDTO>().ok(openUpService.queryStaffPermissionV2(formDTO));
}
} }

8
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java

@ -54,4 +54,12 @@ public interface OpenUpService {
* @Date 2021/2/2 22:30 * @Date 2021/2/2 22:30
**/ **/
CustomerInfoQueryResultDTO queryCustomerInfo(CustomerInfoQueryFormDTO formDTO); CustomerInfoQueryResultDTO queryCustomerInfo(CustomerInfoQueryFormDTO formDTO);
/**
* @param formDTO
* @author yinzuomei
* @description 008当前用户的数据权限(多客户版本)
* @Date 2021/2/3 20:59
**/
StaffPermissionResultDTO queryStaffPermissionV2(StaffPermissionFormDTO formDTO);
} }

32
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java

@ -12,11 +12,14 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.service.OpenUpService; import com.epmet.service.OpenUpService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -24,6 +27,7 @@ import java.util.UUID;
* @Author zxc * @Author zxc
* @DateTime 2020/8/13 9:18 上午 * @DateTime 2020/8/13 9:18 上午
*/ */
@Slf4j
@Service @Service
public class OpenUpServiceImpl implements OpenUpService { public class OpenUpServiceImpl implements OpenUpService {
@ -167,4 +171,32 @@ public class OpenUpServiceImpl implements OpenUpService {
return ConvertUtils.sourceToTarget(crmResult.getData(), CustomerInfoQueryResultDTO.class); return ConvertUtils.sourceToTarget(crmResult.getData(), CustomerInfoQueryResultDTO.class);
} }
/**
* @param formDTO
* @author yinzuomei
* @description 008当前用户的数据权限(多客户版本)
* @Date 2021/2/3 20:59
**/
@Override
public StaffPermissionResultDTO queryStaffPermissionV2(StaffPermissionFormDTO formDTO) {
//查询当前客户是否有子客户
Result<List<String>> crmResult = operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId());
if (!crmResult.success()) {
throw new RenException("获取当前客户所有子客户异常");
}
//如果有子客户,根据area_code构造权限树
if (!CollectionUtils.isEmpty(crmResult.getData())) {
//todo
}
//不包含子客户走原来的接口
Result<ExtStaffPermissionResultDTO> permissionRes = govOrgOpenFeignClient.staffPermissionExt(formDTO.getStaffId());
if (!permissionRes.success() && null == permissionRes) {
throw new RenException("/epmet/ext/staff/permission接口调用失败");
}
StaffPermissionResultDTO resultDTO = new StaffPermissionResultDTO();
resultDTO.setCustomerIds(Arrays.asList());
resultDTO.setAgencyTree(ConvertUtils.sourceToTarget(permissionRes.getData(), AgencyNodeDTO.class));
return resultDTO;
}
} }

9
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java

@ -106,4 +106,13 @@ public interface OperCrmOpenFeignClient {
**/ **/
@GetMapping("/oper/crm/customer/querycustomerinfobycustomerid/{customerId}") @GetMapping("/oper/crm/customer/querycustomerinfobycustomerid/{customerId}")
Result<CustomerRelationInfoResultDTO> queryCustomerInfoByCustomerId(@PathVariable("customerId") String customerId); Result<CustomerRelationInfoResultDTO> queryCustomerInfoByCustomerId(@PathVariable("customerId") String customerId);
/**
* @param customerId
* @author yinzuomei
* @description 根据customerId查询其所有下级子客户id
* @Date 2021/2/3 21:34
**/
@GetMapping("/oper/crm/customer/getallsubcustomerids/{customerId}")
Result<List<String>> getAllSubCustomerIds(@PathVariable("customerId") String customerId);
} }

11
epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java

@ -81,4 +81,15 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient {
public Result<CustomerRelationInfoResultDTO> queryCustomerInfoByCustomerId(String customerId) { public Result<CustomerRelationInfoResultDTO> queryCustomerInfoByCustomerId(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "queryCustomerInfoByCustomerId", customerId); return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "queryCustomerInfoByCustomerId", customerId);
} }
/**
* @param customerId
* @author yinzuomei
* @description 根据customerId查询其所有下级子客户id
* @Date 2021/2/3 21:34
**/
@Override
public Result<List<String>> getAllSubCustomerIds(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getAllSubCustomerIds", customerId);
}
} }

19
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java

@ -34,6 +34,7 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.excel.CustomerExcel; import com.epmet.excel.CustomerExcel;
import com.epmet.feign.GovOrgFeignClient; import com.epmet.feign.GovOrgFeignClient;
import com.epmet.service.CustomerRelationService;
import com.epmet.service.CustomerService; import com.epmet.service.CustomerService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -61,7 +62,8 @@ public class CustomerController {
@Autowired @Autowired
private CustomerService customerService; private CustomerService customerService;
@Autowired
private CustomerRelationService customerRelationService;
@Autowired @Autowired
private GovOrgFeignClient govOrgFeignClient; private GovOrgFeignClient govOrgFeignClient;
@ -342,4 +344,19 @@ public class CustomerController {
} }
return new Result<>(); return new Result<>();
} }
/**
* @param customerId
* @author yinzuomei
* @description 根据customerId查询其所有下级子客户id
* @Date 2021/2/3 21:37
**/
@GetMapping("getallsubcustomerids/{customerId}")
public Result<List<String>> getAllSubCustomerIds(@PathVariable("customerId") String customerId){
if(StringUtils.isNotBlank(customerId)){
List<String> subCustomerIds=customerRelationService.getAllSubCustomerIds(customerId);
return new Result<List<String>>().ok(subCustomerIds);
}
return new Result<>();
}
} }

16
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerRelationDao.java

@ -22,6 +22,8 @@ import com.epmet.dto.CustomerRelationDTO;
import com.epmet.entity.CustomerRelationEntity; import com.epmet.entity.CustomerRelationEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 客户关系表(01.14 add) * 客户关系表(01.14 add)
* *
@ -31,5 +33,19 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> { public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
/**
* 根据客户id查询客户关系表
*
* @param customerId
* @return com.epmet.dto.CustomerRelationDTO
*/
CustomerRelationDTO selectByCustomerId(String customerId); CustomerRelationDTO selectByCustomerId(String customerId);
/**
* 根据customerId查询其所有下级子客户id
*
* @param customerId
* @return java.util.List<java.lang.String>
*/
List<String> selectAllSubCustomerIds(String customerId);
} }

8
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerRelationService.java

@ -113,4 +113,12 @@ public interface CustomerRelationService extends BaseService<CustomerRelationEnt
*/ */
String getRootCustomerId(String customerId); String getRootCustomerId(String customerId);
/**
* @return java.util.List<java.lang.String>
* @param customerId
* @author yinzuomei
* @description 根据customerId查询其所有下级子客户id
* @Date 2021/2/3 21:37
**/
List<String> getAllSubCustomerIds(String customerId);
} }

12
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java

@ -137,4 +137,16 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
return customerRelationDTO.getCustomerId(); return customerRelationDTO.getCustomerId();
} }
/**
* @param customerId
* @return java.util.List<java.lang.String>
* @author yinzuomei
* @description 根据customerId查询其所有下级子客户id
* @Date 2021/2/3 21:37
**/
@Override
public List<String> getAllSubCustomerIds(String customerId) {
return baseDao.selectAllSubCustomerIds(customerId);
}
} }

12
epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerRelationDao.xml

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.CustomerRelationDao"> <mapper namespace="com.epmet.dao.CustomerRelationDao">
<!-- 根据客户id,查询客户关系表 -->
<select id="selectByCustomerId" resultType="com.epmet.dto.CustomerRelationDTO" parameterType="java.lang.String"> <select id="selectByCustomerId" resultType="com.epmet.dto.CustomerRelationDTO" parameterType="java.lang.String">
SELECT SELECT
cr.* cr.*
@ -13,4 +13,14 @@
AND cr.CUSTOMER_ID =#{customerId} AND cr.CUSTOMER_ID =#{customerId}
</select> </select>
<!-- 根据customerId查询其所有下级子客户id -->
<select id="selectAllSubCustomerIds" parameterType="java.lang.String" resultType="java.lang.String">
SELECT
cr.CUSTOMER_ID
FROM
customer_relation cr
WHERE
cr.DEL_FLAG = '0'
AND cr.PIDS like CONCAT(#{customerId},'%')
</select>
</mapper> </mapper>
Loading…
Cancel
Save