Browse Source

/epmet/ext/staff/permissionv2 zancun

dev_shibei_match
yinzuomei 5 years ago
parent
commit
c105e98d55
  1. 5
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java
  2. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyNode.java
  3. 73
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyTreeUtils.java
  4. 50
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/AgencyNodeDTO.java
  5. 36
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/DeptNodeDTO.java
  6. 36
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/GridNodeDTO.java
  7. 27
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java
  8. 21
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java
  9. 16
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java
  10. 30
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  11. 8
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
  12. 29
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  13. 46
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  14. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql
  15. 7
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java
  16. 7
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/DeptNodeDTO.java
  17. 7
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/GridNodeDTO.java
  18. 6
      epmet-module/epmet-ext/epmet-ext-server/pom.xml
  19. 15
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java
  20. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  21. 26
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

5
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ServiceConstant.java

@ -119,6 +119,11 @@ public interface ServiceConstant {
*/ */
String DATA_STATISTICAL_SERVER = "data-statistical-server"; String DATA_STATISTICAL_SERVER = "data-statistical-server";
/**
* 数据统计结果查询
*/
String DATA_REPORT_SERVER="data-report-server";
/** /**
* 微信第三方平台 * 微信第三方平台
*/ */

26
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyNode.java

@ -0,0 +1,26 @@
package com.epmet.commons.tools.utils;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/4 20:49
*/
@Data
public class AgencyNode<T> implements Serializable {
private String areaCode;
private String parentAreaCode;
/**
* 子节点列表
*/
private List<T> subAgencyList = new ArrayList<>();
}

73
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AgencyTreeUtils.java

@ -0,0 +1,73 @@
package com.epmet.commons.tools.utils;
import com.epmet.commons.tools.validator.AssertUtils;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/4 20:49
*/
public class AgencyTreeUtils {
/**
* 根据pid构建树节点
*/
public static <T extends AgencyNode> List<T> build(List<T> agencyNodes, String parentAreaCode) {
//pid不能为空
AssertUtils.isNull(parentAreaCode, "parentAreaCode");
List<T> treeList = new ArrayList<>();
for (T agencyNode : agencyNodes) {
if (parentAreaCode.equals(agencyNode.getParentAreaCode())) {
treeList.add(findChildren(agencyNodes, agencyNode));
}
}
return treeList;
}
/**
* 查找子节点
*/
private static <T extends AgencyNode> T findChildren(List<T> agencyNodes, T rootNode) {
for (T agencyNode : agencyNodes) {
if (rootNode.getAreaCode().equals(agencyNode.getParentAreaCode())) {
rootNode.getSubAgencyList().add(findChildren(agencyNodes, agencyNode));
}
}
return rootNode;
}
/**
* 构建树节点
*/
public static <T extends AgencyNode> List<T> build(List<T> agencyNodes) {
List<T> result = new ArrayList<>();
//list转map
Map<String, T> nodeMap = new LinkedHashMap<>(agencyNodes.size());
for (T agencyNode : agencyNodes) {
nodeMap.put(agencyNode.getAreaCode(), agencyNode);
}
for (T node : nodeMap.values()) {
T parent = nodeMap.get(node.getParentAreaCode());
if (parent != null && !(node.getAreaCode().equals(parent.getAreaCode()))) {
parent.getSubAgencyList().add(node);
continue;
}
result.add(node);
}
return result;
}
}

50
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/AgencyNodeDTO.java

@ -0,0 +1,50 @@
package com.epmet.dto.result.plugins;
import com.epmet.commons.tools.utils.AgencyNode;
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 extends AgencyNode<AgencyNodeDTO> implements Serializable {
private static final long serialVersionUID = -3745920378557792529L;
/**
* 直属机关Id
* */
private String agencyId;
/**
* 直属机关名称
* */
private String agencyName;
/**
* 机关级别社区级community 街道:street, 区县级: district, 市级: city 省级:province
* */
private String level;
/**
* 当前agencyId所属的客户id add02.03
* */
private String customerId;
/**
* 直属机关直属网格列表
* */
private List<GridNodeDTO> gridList = new ArrayList<>();
/**
* 直属机关直属部门列表
* */
private List<DeptNodeDTO> departmentList = new ArrayList<>();
}

36
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/DeptNodeDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result.plugins;
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;
/**
* 当前deptId对应的地区编码 add02.03
* */
private String areaCode;
}

36
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/plugins/GridNodeDTO.java

@ -0,0 +1,36 @@
package com.epmet.dto.result.plugins;
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;
/**
* 当前gridId对应的地区编码 add02.03
* */
private String areaCode;
}

27
epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/DataReportOpenFeignClient.java

@ -0,0 +1,27 @@
package com.epmet.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.feign.impl.DataReportOpenFeignClientFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* 本服务对外开放的API,其他服务通过引用此client调用该服务
*
* @author yinzuomei@elink-cn.com
* @date 2021/2/3 22:05
*/
// @FeignClient(name = ServiceConstant.DATA_REPORT_SERVER, fallback = DataReportOpenFeignClientFallBack.class,url = "localhost:8109")
@FeignClient(name = ServiceConstant.DATA_REPORT_SERVER, fallback = DataReportOpenFeignClientFallBack.class)
public interface DataReportOpenFeignClient {
/**
* @param agencyId
* @description 查询当前组织及下级组织树
* @Date 2021/2/3 22:05
**/
@GetMapping("/data/report/screen/agency/querystaffagencytree/{agencyId}")
Result<AgencyNodeDTO> queryStaffAgencyTree(@PathVariable("agencyId") String agencyId);
}

21
epmet-module/data-report/data-report-client/src/main/java/com/epmet/feign/impl/DataReportOpenFeignClientFallBack.java

@ -0,0 +1,21 @@
package com.epmet.feign.impl;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.feign.DataReportOpenFeignClient;
import org.springframework.stereotype.Component;
@Component
public class DataReportOpenFeignClientFallBack implements DataReportOpenFeignClient {
/**
* @param agencyId
* @description 查询当前组织及下级组织树
* @Date 2021/2/3 22:05
**/
@Override
public Result<AgencyNodeDTO> queryStaffAgencyTree(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_REPORT_SERVER, "queryStaffAgencyTree",agencyId);
}
}

16
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java

@ -5,11 +5,13 @@ import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.dto.form.AreaCodeDictFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -81,4 +83,18 @@ public class AgencyController {
return new Result<List<AreaCodeDictResultDTO>>().ok(agencyService.areaCodeDictTree(formDTO)); return new Result<List<AreaCodeDictResultDTO>>().ok(agencyService.areaCodeDictTree(formDTO));
} }
/**
* @param agencyId
* @author yinzuomei
* @description 查询当前组织及下级组织树
* @Date 2021/2/3 22:19
**/
@GetMapping("querystaffagencytree/{agencyId}")
public Result<AgencyNodeDTO> queryStaffAgencyTree(@PathVariable("agencyId") String agencyId) {
//todo 单独校验下此方法
if (StringUtils.isNotBlank(agencyId)) {
return new Result<AgencyNodeDTO>().ok(agencyService.queryStaffAgencyTree(agencyId));
}
return new Result<>();
}
} }

30
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -18,6 +18,9 @@
package com.epmet.datareport.dao.evaluationindex.screen; package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.dto.result.plugins.DeptNodeDTO;
import com.epmet.dto.result.plugins.GridNodeDTO;
import com.epmet.evaluationindex.screen.dto.result.*; import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -120,4 +123,31 @@ public interface ScreenCustomerAgencyDao {
* @description 查询组织基本信息 * @description 查询组织基本信息
**/ **/
ScreenCustomerAgencyDTO selectByAgencyId(@Param("agencyId") String agencyId); ScreenCustomerAgencyDTO selectByAgencyId(@Param("agencyId") String agencyId);
/**
* @param areaCode
* @author yinzuomei
* @description 根据areaCode查询组织机构
* @Date 2021/2/4 21:51
**/
List<AgencyNodeDTO> queryStaffAgencyTree(@Param("areaCode")String areaCode);
/**
* @param areaCode
* @param agencyId
* @author yinzuomei
* @description 查找组织下的部门
* @Date 2021/2/4 21:51
**/
List<DeptNodeDTO> selectDeptList(@Param("areaCode") String areaCode,@Param("agencyId") String agencyId);
/**
* @param areaCode
* @param agencyId
* @author yinzuomei
* @description 查找组织下的网格
* @Date 2021/2/4 21:52
**/
List<GridNodeDTO> selectGridList(@Param("areaCode") String areaCode,@Param("agencyId") String agencyId);
} }

8
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java

@ -2,6 +2,7 @@ package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.dto.form.AreaCodeDictFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.TreeByTypeFormDTO;
@ -47,4 +48,11 @@ public interface AgencyService {
*/ */
List<AreaCodeDictResultDTO> areaCodeDictTree(AreaCodeDictFormDTO formDTO); List<AreaCodeDictResultDTO> areaCodeDictTree(AreaCodeDictFormDTO formDTO);
/**
* @param agencyId
* @author yinzuomei
* @description 查询当前组织及下级组织树
* @Date 2021/2/3 22:19
**/
AgencyNodeDTO queryStaffAgencyTree(String agencyId);
} }

29
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java

@ -1,8 +1,10 @@
package com.epmet.datareport.service.evaluationindex.screen.impl; package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.AgencyTreeUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
@ -10,6 +12,8 @@ import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.dto.form.AreaCodeDictFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO; import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO; import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
@ -18,6 +22,8 @@ import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO; import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO; import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.exceptions.TooManyResultsException; import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -32,6 +38,7 @@ import java.util.List;
* @author yinzuomei@elink-cn.com * @author yinzuomei@elink-cn.com
* @date 2020/8/18 10:18 * @date 2020/8/18 10:18
*/ */
@Slf4j
@Service @Service
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
public class AgencyServiceImpl implements AgencyService { public class AgencyServiceImpl implements AgencyService {
@ -248,4 +255,26 @@ public class AgencyServiceImpl implements AgencyService {
} }
return new ArrayList<>(); return new ArrayList<>();
} }
/**
* @param agencyId
* @author yinzuomei
* @description 查询当前组织及下级组织树
* @Date 2021/2/3 22:19
**/
@Override
public AgencyNodeDTO queryStaffAgencyTree(String agencyId) {
ScreenCustomerAgencyDTO agencyDTO = screenCustomerAgencyDao.selectByAgencyId(agencyId);
if (null == agencyDTO || StringUtils.isBlank(agencyDTO.getAreaCode())) {
throw new RenException(String.format("当前agencyId%s所属的area_code为空", agencyId));
}
List<AgencyNodeDTO> list = screenCustomerAgencyDao.queryStaffAgencyTree(agencyDTO.getAreaCode());
for (AgencyNodeDTO agencyNodeDTO : list) {
agencyNodeDTO.setGridList(screenCustomerAgencyDao.selectGridList(agencyNodeDTO.getAreaCode(), agencyNodeDTO.getAgencyId()));
agencyNodeDTO.setDepartmentList(screenCustomerAgencyDao.selectDeptList(agencyNodeDTO.getAreaCode(), agencyNodeDTO.getAgencyId()));
}
List<AgencyNodeDTO> treeList = AgencyTreeUtils.build(list);
log.info(JSON.toJSONString(treeList));
return treeList.get(NumConstant.ZERO);
}
} }

46
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -225,4 +225,50 @@
del_flag = 0 del_flag = 0
AND agency_id = #{agencyId} AND agency_id = #{agencyId}
</select> </select>
<!-- 根据areaCode查询组织机构 -->
<select id="queryStaffAgencyTree" resultType="com.epmet.dto.result.plugins.AgencyNodeDTO">
SELECT
agency.AGENCY_ID AS agencyId,
agency.AGENCY_NAME AS agencyName,
agency.LEVEL AS LEVEL,
agency.CUSTOMER_ID AS customerId,
agency.AREA_CODE AS areaCode
FROM
screen_customer_agency agency
WHERE
agency.DEL_FLAG = '0'
AND agency.AREA_CODE like concat(#{areaCode},'%')
</select>
<!-- 查找组织下的部门 -->
<select id="selectDeptList" resultType="com.epmet.dto.result.plugins.DeptNodeDTO">
SELECT
DEPT_ID AS deptId,
DEPT_NAME AS deptName,
CUSTOMER_ID as customerId,
AREA_CODE AS areaCode
FROM
screen_customer_dept dept
WHERE
DEL_FLAG = '0'
AND AREA_CODE like concat(#{areaCode},'%')
and PARENT_AGENCY_ID =#{agencyId}
</select>
<!-- 查找组织下的网格 -->
<select id="selectGridList" resultType="com.epmet.dto.result.plugins.GridNodeDTO">
SELECT
grid.GRID_ID AS gridId,
grid.GRID_NAME AS gridName,
grid.CUSTOMER_ID AS customerId,
grid.AREA_CODE AS areaCode
FROM
screen_customer_grid grid
WHERE
grid.DEL_FLAG = '0'
and grid.AREA_CODE like CONCAT(#{areaCode},'%')
and grid.PARENT_AGENCY_ID=#{agencyId}
</select>
</mapper> </mapper>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.8__add_plugins_table.sql

@ -64,7 +64,7 @@ CREATE TABLE `screen_list_info` (
PRIMARY KEY (`ID`) PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='146:一张清单列表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='146:一张清单列表';
-- 2、工作日志新增张表 -- 2、工作日志新增3张表
drop table if EXISTS screen_work_record_grid_monthly; drop table if EXISTS screen_work_record_grid_monthly;
CREATE TABLE `screen_work_record_grid_monthly` ( CREATE TABLE `screen_work_record_grid_monthly` (
`ID` varchar(64) NOT NULL COMMENT 'ID 主键', `ID` varchar(64) NOT NULL COMMENT 'ID 主键',

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

@ -50,4 +50,11 @@ public class AgencyNodeDTO implements Serializable {
* 当前agencyId所属的客户id add02.03 * 当前agencyId所属的客户id add02.03
* */ * */
private String customerId; private String customerId;
/**
* 当前agencyId对应的地区编码 add02.03
* */
private String areaCode;
private String parentCode;
} }

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

@ -1,5 +1,6 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -28,4 +29,10 @@ public class DeptNodeDTO implements Serializable {
* 当前deptId所属的customerId add02.03 * 当前deptId所属的customerId add02.03
* */ * */
private String customerId; private String customerId;
/**
* 当前deptId对应的地区编码 add02.03
* */
@JsonIgnore
private String areaCode;
} }

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

@ -1,5 +1,6 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -28,4 +29,10 @@ public class GridNodeDTO implements Serializable {
* 当前gridId所属的客户id add02.03 * 当前gridId所属的客户id add02.03
* */ * */
private String customerId; private String customerId;
/**
* 当前gridId对应的地区编码 add02.03
* */
@JsonIgnore
private String areaCode;
} }

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

@ -150,6 +150,12 @@
<version>2.0.0</version> <version>2.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>data-report-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

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

@ -8,6 +8,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.ModuleConstant; import com.epmet.constant.ModuleConstant;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.feign.DataReportOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient; 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;
@ -37,7 +38,8 @@ public class OpenUpServiceImpl implements OpenUpService {
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient; private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private DataReportOpenFeignClient dataReportOpenFeignClient;
/** /**
* @Description 网格工作人员 被禁用的未激活的不显示 * @Description 网格工作人员 被禁用的未激活的不显示
* @param formDTO * @param formDTO
@ -186,12 +188,19 @@ public class OpenUpServiceImpl implements OpenUpService {
} }
//如果有子客户,根据area_code构造权限树 //如果有子客户,根据area_code构造权限树
if (!CollectionUtils.isEmpty(crmResult.getData())) { if (!CollectionUtils.isEmpty(crmResult.getData())) {
//todo Result<com.epmet.dto.result.plugins.AgencyNodeDTO> dataStatResult=dataReportOpenFeignClient.queryStaffAgencyTree(formDTO.getAgencyId());
if (!dataStatResult.success() && null == dataStatResult) {
throw new RenException("调用data-stats服务的XXX接口异常"+dataStatResult.getInternalMsg());
}
StaffPermissionResultDTO resultDTO = new StaffPermissionResultDTO();
resultDTO.setCustomerIds(Arrays.asList());
resultDTO.setAgencyTree(ConvertUtils.sourceToTarget(dataStatResult.getData(), AgencyNodeDTO.class));
return resultDTO;
} }
//不包含子客户走原来的接口 //不包含子客户走原来的接口
Result<ExtStaffPermissionResultDTO> permissionRes = govOrgOpenFeignClient.staffPermissionExt(formDTO.getStaffId()); Result<ExtStaffPermissionResultDTO> permissionRes = govOrgOpenFeignClient.staffPermissionExt(formDTO.getStaffId());
if (!permissionRes.success() && null == permissionRes) { if (!permissionRes.success() && null == permissionRes) {
throw new RenException("/epmet/ext/staff/permission接口调用失败"); throw new RenException("调用/epmet/ext/staff/permission接口异常"+permissionRes.getInternalMsg());
} }
StaffPermissionResultDTO resultDTO = new StaffPermissionResultDTO(); StaffPermissionResultDTO resultDTO = new StaffPermissionResultDTO();
resultDTO.setCustomerIds(Arrays.asList()); resultDTO.setCustomerIds(Arrays.asList());

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

@ -168,6 +168,14 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
**/ **/
List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId); List<ExtDeptResultDTO> selectDeptList(@Param("agencyId") String agencyId);
/**
* @param agencyId
* @author yinzuomei
* @description 根据组织查询网格列表
* @Date 2021/2/4 21:54
**/
List<ExtGridResultDTO> selectGridList(@Param("agencyId") String agencyId);
/** /**
* @param staffId * @param staffId
* @return * @return

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

@ -209,7 +209,7 @@
<result column="agencyName" property="agencyName"/> <result column="agencyName" property="agencyName"/>
<result column="level" property="level" /> <result column="level" property="level" />
<result column="customerId" property="customerId"/> <result column="customerId" property="customerId"/>
<collection property="gridList" ofType="com.epmet.dto.result.ExtGridResultDTO"> <collection property="gridList" column="agencyId" ofType="com.epmet.dto.result.ExtGridResultDTO" select="selectGridList">
<id column="gridId" property="gridId" /> <id column="gridId" property="gridId" />
<result column="gridName" property="gridName" /> <result column="gridName" property="gridName" />
<result column="customerId" property="customerId"/> <result column="customerId" property="customerId"/>
@ -243,14 +243,9 @@
agency.ID AS agencyId, agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName, agency.ORGANIZATION_NAME AS agencyName,
agency.LEVEL AS level, agency.LEVEL AS level,
agency.CUSTOMER_ID as customerId, agency.CUSTOMER_ID as customerId
grid.ID AS gridId,
grid.GRID_NAME AS gridName,
grid.CUSTOMER_ID as customerId
FROM FROM
CUSTOMER_AGENCY agency CUSTOMER_AGENCY agency
LEFT JOIN CUSTOMER_GRID grid ON agency.ID = grid.PID
AND grid.DEL_FLAG = '0'
WHERE WHERE
agency.DEL_FLAG = '0' agency.DEL_FLAG = '0'
AND agency.ID = #{agencyId} AND agency.ID = #{agencyId}
@ -268,17 +263,26 @@
AND AGENCY_ID = #{agencyId} AND AGENCY_ID = #{agencyId}
</select> </select>
<select id="selectGridList" parameterType="map" resultType="com.epmet.dto.result.ExtGridResultDTO">
SELECT
cg.id AS gridId,
cg.GRID_NAME AS gridName,
cg.CUSTOMER_ID AS customerId
FROM
customer_grid cg
WHERE
cg.DEL_FLAG = '0'
AND cg.PID =#{agencyId}
</select>
<select id="selectSubAgencyByPid" resultMap="treeMap"> <select id="selectSubAgencyByPid" resultMap="treeMap">
SELECT SELECT
agency.ID AS agencyId, agency.ID AS agencyId,
agency.ORGANIZATION_NAME AS agencyName, agency.ORGANIZATION_NAME AS agencyName,
agency.LEVEL AS level, agency.LEVEL AS level,
grid.ID AS gridId, agency.CUSTOMER_ID as customerId
grid.GRID_NAME AS gridName
FROM FROM
CUSTOMER_AGENCY agency CUSTOMER_AGENCY agency
LEFT JOIN CUSTOMER_GRID grid ON agency.ID = grid.PID
AND grid.DEL_FLAG = '0'
WHERE WHERE
agency.DEL_FLAG = '0' agency.DEL_FLAG = '0'
AND agency.PID = #{pid} AND agency.PID = #{pid}

Loading…
Cancel
Save