Browse Source

/data/report/screen/agency/agencydetail-multic

dev_shibei_match
yinzuomei 4 years ago
parent
commit
482379082f
  1. 34
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java
  2. 97
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java
  3. 46
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java
  4. 10
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java
  5. 19
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java
  6. 3
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  7. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java
  8. 83
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  9. 19
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  10. 10
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  11. 12
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  12. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

34
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java

@ -0,0 +1,34 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 工作端小程序-数据上面的 当前组织调用此接口
*
* @author yinzuomei@elink-cn.com
* @date 2021/6/24 15:26
*/
@Data
public class AgencyDetailMulticFormDTO implements Serializable {
private static final long serialVersionUID = 6603177626712295270L;
/**
* 内部错误分组
* */
public interface AddUserInternalGroup{}
/**
* 机关组织Id
*/
@NotBlank(message = "机关组织ID不能为空" , groups = {AddUserInternalGroup.class})
private String agencyId;
/**
* 当前登录用户所属的客户id
*/
private String customerId;
}

97
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java

@ -0,0 +1,97 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/6/24 15:31
*/
@Data
public class AgencyDetailMulticResultDTO implements Serializable {
/**
* 机关组织Id
*/
private String agencyId = "";
/**
* 组织名称
*/
private String agencyName = "";
/**
* 机关级别社区级community
* 街道:street,
* 区县级: district,
* 市级: city
* 省级:province 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level = "";
/**
* 地区编码
*/
private String areaCode = "";
/**
* 省份名称
*/
private String province = "";
/**
* 城市名称
*/
private String city = "";
/**
* 区县名称
*/
private String district = "";
/**
* 本机关的所有上级机关
*/
private List<ParentListResultDTO> parentList;
/**
* 街道
*/
private String street;
/**
* 社区
*/
private String community;
/**
* open: 选择地区编码必填closed: 无需选择地区编码;;0409新增返参
*/
private String areaCodeSwitch;
/**
* 组织区划的名称
*/
private String areaName;
/**
* 当前组织对应客户根组织级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String rootlevel;
//以下参数是06.24新增
private String parentAreaCode;
/**
* 是否有字客户
*/
private Boolean haveSubCustomer;
/**
* 子客户列表
*/
private List<String> subCustomerIds;
}

46
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java

@ -0,0 +1,46 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.result;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 组织首页-获取组织机构信息接口-本机关的所有上级机关信息
*
* @author sun
*/
@Data
public class ParentListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 机关组织Id
*/
private String id = "";
/**
* 机关组织名称
*/
private String name = "";
}

10
epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java

@ -46,4 +46,14 @@ public class ScreenCustomerAgencyDTO implements Serializable {
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
/**
* 父级id ,顶级此列为0
*/
private String pid;
/**
* 所有上级ID用逗号英文分开
*/
private String pids;
}

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

@ -1,10 +1,14 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
import com.epmet.dto.form.AgencyDetailMulticFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AgencyDetailMulticResultDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
@ -110,4 +114,19 @@ public class AgencyController {
}
return new Result<>();
}
/**
* @return com.epmet.commons.tools.utils.Result
* @param
* @author yinzuomei
* @description 工作端小程序-数据上面的 当前组织调用此接口
* @Date 2021/6/24 15:29
**/
@PostMapping("agencydetail-multic")
public Result<AgencyDetailMulticResultDTO> queryAgencyDetailMultiC(@LoginUser TokenDto tokenDto, @RequestBody AgencyDetailMulticFormDTO formDTO){
// formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, AgencyDetailMulticFormDTO.AddUserInternalGroup.class);
return new Result<AgencyDetailMulticResultDTO>().ok(agencyService.queryAgencyDetailMultiC(formDTO));
}
}

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

@ -18,6 +18,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.result.ParentListResultDTO;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.dto.result.plugins.DeptNodeDTO;
@ -189,4 +190,6 @@ public interface ScreenCustomerAgencyDao {
* @return java.util.List<com.epmet.dto.result.ScreenCustomerAgencyDTO>
*/
List<ScreenCustomerGridDTO> selectGridDTOList(@Param("areaCode") String areaCode, @Param("parentAgencyId") String parentAgencyId);
List<ParentListResultDTO> selectPAgencyById(@Param("listStr")List<String> pidList);
}

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

@ -3,10 +3,12 @@ package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.dto.AgencyInfoDTO;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
import com.epmet.dto.form.AgencyDetailMulticFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AgencyDetailMulticResultDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO;
import com.epmet.dto.result.ScreenCustomerAgencyDTO;
import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO;
import com.epmet.dto.result.plugins.AgencyNodeDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentByBizTypeFormDTO;
import com.epmet.evaluationindex.screen.dto.form.CompartmentFormDTO;
@ -92,4 +94,12 @@ public interface AgencyService {
* @return java.util.List<com.epmet.dto.result.ScreenCustomerAgencyDTO>
*/
List<ScreenCustomerGridDTO> queryGridList(String areaCode, String parentAgencyId);
/**
* 工作端小程序-数据上面的 当前组织调用此接口
*
* @param formDTO
* @return com.epmet.dto.result.AgencyDetailMulticResultDTO
*/
AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO);
}

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

@ -3,8 +3,10 @@ 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.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.AgencyTreeUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
@ -13,10 +15,10 @@ import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.dto.AgencyInfoDTO;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.form.AddAreaCodeDictFormDTO;
import com.epmet.dto.form.AgencyDetailMulticFormDTO;
import com.epmet.dto.form.AreaCodeDictFormDTO;
import com.epmet.dto.result.AreaCodeDictResultDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.commonservice.AddAreaCodeDictResultDTO;
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.dto.form.CompartmentByBizTypeFormDTO;
@ -26,6 +28,8 @@ import com.epmet.evaluationindex.screen.dto.result.AgencyDistributionResultDTO;
import com.epmet.evaluationindex.screen.dto.result.CompartmentResultDTO;
import com.epmet.evaluationindex.screen.dto.result.TreeResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.exceptions.TooManyResultsException;
@ -34,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@ -53,6 +58,10 @@ public class AgencyServiceImpl implements AgencyService {
private ScreenCustomerGridDao screenCustomerGridDao;
@Autowired
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient;
/**
* @Description 1组织机构树
@ -347,4 +356,74 @@ public class AgencyServiceImpl implements AgencyService {
public List<ScreenCustomerGridDTO> queryGridList(String areaCode, String parentAgencyId) {
return screenCustomerAgencyDao.selectGridDTOList(areaCode,parentAgencyId);
}
/**
* 工作端小程序-数据上面的 当前组织调用此接口
*
* @param formDTO
* @return com.epmet.dto.result.AgencyDetailMulticResultDTO
*/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO) {
AgencyDetailMulticResultDTO agencysResultDTO = new AgencyDetailMulticResultDTO();
List<ParentListResultDTO> parentList = new ArrayList<>();
agencysResultDTO.setParentList(parentList);
//1:查询本机关详细信息
ScreenCustomerAgencyDTO customerAgencyDTO = screenCustomerAgencyDao.selectByAgencyId(formDTO.getAgencyId());
if (null == customerAgencyDTO) {
return agencysResultDTO;
}
agencysResultDTO = ConvertUtils.sourceToTarget(customerAgencyDTO, AgencyDetailMulticResultDTO.class);
agencysResultDTO.setAreaCodeSwitch(govOrgOpenFeignClient.getAreaCodeSwitch(customerAgencyDTO.getCustomerId()).getData());
//如果当前客户不存在子客户则areaCode置为空
Result<List<String>> crmRes=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId());
if (crmRes.success() &&CollectionUtils.isEmpty(crmRes.getData())) {
agencysResultDTO.setAreaCode(StrConstant.EPMETY_STR);
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR);
agencysResultDTO.setParentAreaCode(StrConstant.EPMETY_STR);
agencysResultDTO.setHaveSubCustomer(false);
agencysResultDTO.setSubCustomerIds(new ArrayList<>());
}else{
agencysResultDTO.setAreaName(agencysResultDTO.getAgencyName());
agencysResultDTO.setHaveSubCustomer(true);
agencysResultDTO.setSubCustomerIds(crmRes.getData());
}
//2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start
if (null != customerAgencyDTO) {
if ("0".equals(customerAgencyDTO.getPid())||StringUtils.isBlank(customerAgencyDTO.getPid())) {
agencysResultDTO.setRootlevel(customerAgencyDTO.getLevel());
} else {
String rootAgencyId ="";
if(customerAgencyDTO.getPids().contains(StrConstant.COLON)){
rootAgencyId= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COLON)).get(NumConstant.ZERO);
}else if(customerAgencyDTO.getPids().contains(StrConstant.COMMA)){
rootAgencyId= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COMMA)).get(NumConstant.ZERO);
}
ScreenCustomerAgencyDTO rootEntity = screenCustomerAgencyDao.selectByAgencyId(rootAgencyId);
if (null != rootEntity) {
agencysResultDTO.setRootlevel(rootEntity.getLevel());
}
}
}
//2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end
//2:查询本机关的所有上级机关,按自上而下层级顺序
if (StringUtils.isBlank(customerAgencyDTO.getPids())) {
agencysResultDTO.setParentList(parentList);
return agencysResultDTO;
}
List<String> pidList =new ArrayList<>();
if(customerAgencyDTO.getPids().contains(StrConstant.COLON)){
pidList= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COLON));
}else if(customerAgencyDTO.getPids().contains(StrConstant.COMMA)){
pidList= Arrays.asList(customerAgencyDTO.getPids().split(StrConstant.COMMA));
}
agencysResultDTO.setParentList(screenCustomerAgencyDao.selectPAgencyById(pidList));
return agencysResultDTO;
}
}

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

@ -372,4 +372,23 @@
AND scg.PARENT_AGENCY_ID = #{parentAgencyId}
</if>
</select>
<!-- 按照foreach中遍历的Id顺序排序(按组织机构自上而下排序) -->
<select id="selectPAgencyById" resultType="com.epmet.dto.result.ParentListResultDTO">
SELECT
sca.AGENCY_ID as id,
sca.AGENCY_NAME AS 'name'
from screen_customer_agency sca
WHERE del_flag = '0'
AND AGENCY_ID IN
<foreach item="id" collection="listStr" open="(" separator="," close=")" index="">
#{id}
</foreach>
ORDER BY field(
AGENCY_ID,
<foreach item="id" collection="listStr" separator=",">
#{id}
</foreach>
)
</select>
</mapper>

10
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java

@ -342,4 +342,14 @@ public interface GovOrgOpenFeignClient {
*/
@PostMapping("/gov/org/customerstaffgrid/gridstaff")
Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(@RequestBody List<String> gridIds);
/**
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @param customerId
* @author yinzuomei
* @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填closed: 无需选择地区编码;;0409新增返参;没配置,返回closed
* @Date 2021/6/24 16:11
**/
@PostMapping(value = "getAreaCodeSwitch/{customerId}")
Result<String> getAreaCodeSwitch(@PathVariable("customerId")String customerId);
}

12
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java

@ -197,4 +197,16 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<List<GridStaffResultDTO>> selectGridStaffByGridIds(List<String> gridIds) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds);
}
/**
* @param customerId
* @return com.epmet.commons.tools.utils.Result<java.lang.String>
* @author yinzuomei
* @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填closed: 无需选择地区编码;;0409新增返参;没配置,返回closed
* @Date 2021/6/24 16:11
**/
@Override
public Result<String> getAreaCodeSwitch(String customerId) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAreaCodeSwitch", customerId);
}
}

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

@ -17,7 +17,6 @@
package com.epmet.controller;
import com.baomidou.mybatisplus.extension.api.R;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
@ -34,13 +33,12 @@ import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.excel.CustomerAgencyExcel;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerOrgParameterService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -58,6 +56,8 @@ public class CustomerAgencyController {
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private CustomerOrgParameterService customerOrgParameterService;
@GetMapping("page")
public Result<PageData<CustomerAgencyDTO>> page(@RequestParam Map<String, Object> params) {
@ -297,4 +297,9 @@ public class CustomerAgencyController {
Result<OrganizeTreeResultDTO> organizeTree(@PathVariable("agencyId") String agencyId) {
return new Result<OrganizeTreeResultDTO>().ok(customerAgencyService.organizeTree(agencyId));
}
@PostMapping("getAreaCodeSwitch/{customerId}")
public Result<String> getAreaCodeSwitch(@PathVariable("customerId")String customerId){
return new Result<String>().ok(customerOrgParameterService.getAreaCodeSwitch(customerId));
}
}
Loading…
Cancel
Save