Browse Source

对外接口-查询组织基本信息

dev_shibei_match
sunyuchao 5 years ago
parent
commit
800cc1ffe0
  1. 2
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java
  2. 16
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java
  3. 8
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java
  4. 14
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java
  5. 21
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java
  6. 66
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java
  7. 9
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  8. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  9. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  10. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  11. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

2
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java

@ -14,4 +14,6 @@ public interface ModuleConstant {
String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败"; String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败";
String ERROR_AGENCY = "调用gov_org服务查询组织基本信息失败";
} }

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

@ -11,8 +11,10 @@ import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.OpenUpService; import com.epmet.service.OpenUpService;
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.PostMapping;
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; import java.util.List;
@ -100,5 +102,15 @@ public class OpenUpController {
return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId()); return govOrgOpenFeignClient.staffPermissionExt(commonStaffIdFormDTO.getStaffId());
} }
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@PostMapping("agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AgencyInfoFormDTO.StaffIdGroup.class);
return new Result<AgencyInfoResultDTO>().ok(openUpService.agencyInfo(formDTO));
}
} }

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

@ -1,8 +1,10 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.dto.form.AgencyInfoFormDTO;
import com.epmet.dto.form.StaffSinAgencyFormDTO; import com.epmet.dto.form.StaffSinAgencyFormDTO;
import com.epmet.dto.form.StaffSinDeptFormDTO; import com.epmet.dto.form.StaffSinDeptFormDTO;
import com.epmet.dto.form.StaffSinGridFormDTO; import com.epmet.dto.form.StaffSinGridFormDTO;
import com.epmet.dto.result.AgencyInfoResultDTO;
import com.epmet.dto.result.StaffSinAgencyResultDTO; import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO;
@ -38,4 +40,10 @@ public interface OpenUpService {
* @date 2020/8/17 9:59 上午 * @date 2020/8/17 9:59 上午
*/ */
List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO); List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
} }

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

@ -6,6 +6,7 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result; 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.AgencyInfoResultDTO;
import com.epmet.dto.result.StaffSinAgencyResultDTO; import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO; import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO; import com.epmet.dto.result.StaffSinGridResultDTO;
@ -123,4 +124,17 @@ public class OpenUpServiceImpl implements OpenUpService {
return staffInfoList.getData(); return staffInfoList.getData();
} }
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@Override
public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) {
Result<AgencyInfoResultDTO> result = govOrgOpenFeignClient.agencyInfo(formDTO);
if (!result.success()){
throw new RenException(ModuleConstant.ERROR_AGENCY);
}
return result.getData();
}
} }

21
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyInfoFormDTO.java

@ -0,0 +1,21 @@
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;
/**
* @Author zxc
* @DateTime 2020/8/17 10:37 上午
*/
@Data
public class AgencyInfoFormDTO implements Serializable {
private static final long serialVersionUID = -1719033407335647411L;
@NotBlank(message = "组织Id不能为空" , groups = StaffIdGroup.class)
private String agencyId;
public interface StaffIdGroup extends CustomerClientShowGroup {}
}

66
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyInfoResultDTO.java

@ -0,0 +1,66 @@
/**
* 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 java.io.Serializable;
/**
* 组织信息
*
* @author sun
*/
@Data
public class AgencyInfoResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 机关组织Id
*/
private String agencyId;
/**
* 机关组织名称
*/
private String agencyName;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 地区编码
*/
private String areaCode;
}

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

@ -259,4 +259,13 @@ public interface GovOrgOpenFeignClient {
*/ */
@PostMapping("/gov/org/agency/subagencylist") @PostMapping("/gov/org/agency/subagencylist")
Result<SubAgencyResultDTO> subAgencyList(@RequestBody SubAgencyFormDTO formDTO); Result<SubAgencyResultDTO> subAgencyList(@RequestBody SubAgencyFormDTO formDTO);
/**
* @param formDTO
* @return
* @Author sun
* @Description 根据组织Id获取组织信息
*/
@PostMapping("/gov/org/customeragency/agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO);
} }

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

@ -151,4 +151,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO) { public Result<SubAgencyResultDTO> subAgencyList(SubAgencyFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "subAgencyList", formDTO); return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "subAgencyList", formDTO);
} }
@Override
public Result<AgencyInfoResultDTO> agencyInfo(AgencyInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "agencyInfo", formDTO);
}
} }

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

@ -242,4 +242,13 @@ public class CustomerAgencyController {
public Result<StaffInAgencyListResultDTO> staffInAgencyList(@LoginUser TokenDto tokenDTO) { public Result<StaffInAgencyListResultDTO> staffInAgencyList(@LoginUser TokenDto tokenDTO) {
return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId())); return new Result<StaffInAgencyListResultDTO>().ok(customerAgencyService.staffInAgencyList(tokenDTO.getUserId()));
} }
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@PostMapping("agencyinfo")
Result<AgencyInfoResultDTO> agencyInfo(@RequestBody AgencyInfoFormDTO formDTO) {
return new Result<AgencyInfoResultDTO>().ok(customerAgencyService.agencyInfo(formDTO));
}
} }

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

@ -213,4 +213,10 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @Description 工作端-查询当前人员所属组织及所有下级组织 * @Description 工作端-查询当前人员所属组织及所有下级组织
**/ **/
StaffInAgencyListResultDTO staffInAgencyList(String staffId); StaffInAgencyListResultDTO staffInAgencyList(String staffId);
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO);
} }

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -994,4 +994,20 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return resultDTO; return resultDTO;
} }
/**
* @Description 对外接口-根据组织Id获取组织信息
* @author sun
**/
@Override
public AgencyInfoResultDTO agencyInfo(AgencyInfoFormDTO formDTO) {
AgencyInfoResultDTO resultDTO = new AgencyInfoResultDTO();
CustomerAgencyEntity entity = baseDao.selectById(formDTO.getAgencyId());
if(entity!=null){
resultDTO = ConvertUtils.sourceToTarget(entity, AgencyInfoResultDTO.class);
resultDTO.setAgencyId(entity.getId());
resultDTO.setAgencyName(entity.getOrganizationName());
}
return resultDTO;
}
} }
Loading…
Cancel
Save