diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/AgencyDetailMulticFormDTO.java new file mode 100644 index 0000000000..003e925379 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/AgencyDetailMulticResultDTO.java new file mode 100644 index 0000000000..26cf12fa71 --- /dev/null +++ b/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 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 subCustomerIds; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ParentListResultDTO.java new file mode 100644 index 0000000000..60683bf779 --- /dev/null +++ b/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 + *

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

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result; + +import 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 = ""; + + +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java index 5ceeca49a7..a07fa65053 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/ScreenCustomerAgencyDTO.java +++ b/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; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java index 1eba0b727c..628157c757 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/AgencyController.java +++ b/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 queryAgencyDetailMultiC(@LoginUser TokenDto tokenDto, @RequestBody AgencyDetailMulticFormDTO formDTO){ + // formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AgencyDetailMulticFormDTO.AddUserInternalGroup.class); + return new Result().ok(agencyService.queryAgencyDetailMultiC(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index 3c1e1a05c8..d31eee8700 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/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 */ List selectGridDTOList(@Param("areaCode") String areaCode, @Param("parentAgencyId") String parentAgencyId); + + List selectPAgencyById(@Param("listStr")List pidList); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java index 48e8e8946b..e780570be1 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java +++ b/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 */ List queryGridList(String areaCode, String parentAgencyId); + + /** + * 工作端小程序-数据上面的 当前组织调用此接口 + * + * @param formDTO + * @return com.epmet.dto.result.AgencyDetailMulticResultDTO + */ + AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 8e9ebf8fe5..722673691b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/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 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 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> 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 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; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index e590de142d..8c71f82568 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -372,4 +372,23 @@ AND scg.PARENT_AGENCY_ID = #{parentAgencyId} + + + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 4e28d10dc1..2e13dde7fb 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/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> selectGridStaffByGridIds(@RequestBody List gridIds); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param customerId + * @author yinzuomei + * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed + * @Date 2021/6/24 16:11 + **/ + @PostMapping(value = "getAreaCodeSwitch/{customerId}") + Result getAreaCodeSwitch(@PathVariable("customerId")String customerId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 4976297323..0d13438885 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/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> selectGridStaffByGridIds(List gridIds) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridStaffByGridIds", gridIds); } + + /** + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 根据customerId查询参数(area_code_switch)值open: 选择地区编码必填;closed: 无需选择地区编码;;0409新增返参;没配置,返回closed + * @Date 2021/6/24 16:11 + **/ + @Override + public Result getAreaCodeSwitch(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAreaCodeSwitch", customerId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index b88368a11d..96145dbe81 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/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> page(@RequestParam Map params) { @@ -297,4 +297,9 @@ public class CustomerAgencyController { Result organizeTree(@PathVariable("agencyId") String agencyId) { return new Result().ok(customerAgencyService.organizeTree(agencyId)); } + + @PostMapping("getAreaCodeSwitch/{customerId}") + public Result getAreaCodeSwitch(@PathVariable("customerId")String customerId){ + return new Result().ok(customerOrgParameterService.getAreaCodeSwitch(customerId)); + } } \ No newline at end of file