Browse Source

机关工作人员查询,ext服务修改 url,添加 epmet

dev
zxc 5 years ago
parent
commit
c0f3654f2a
  1. 2
      epmet-gateway/src/main/resources/bootstrap.yml
  2. 31
      epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java
  3. 2
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/constant/ModuleConstant.java
  4. 21
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java
  5. 9
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java
  6. 60
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java
  7. 2
      epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml
  8. 20
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java
  9. 15
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java
  10. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java
  11. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java
  12. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java
  13. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java
  14. 18
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java
  15. 11
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  16. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinAgencyResultDTO.java

2
epmet-gateway/src/main/resources/bootstrap.yml

@ -318,7 +318,7 @@ spring:
uri: @gateway.routes.epmet-ext-server.url@
order: 34
predicates:
- Path=${server.servlet.context-path}/ext/**
- Path=${server.servlet.context-path}/epmet/ext/**
filters:
- StripPrefix=1
- CpAuth=true

31
epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/form/StaffSinAgencyFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/13 9:33 上午
*/
@Data
public class StaffSinAgencyFormDTO implements Serializable {
private static final long serialVersionUID = 1827402498483127629L;
//后端自己看
public interface StaffSinAgency{}
/**
* appId+customerId+时间戳加密secret
*/
// @NotBlank(message = "secret不能为空",groups = {StaffSinDept.class})
private String accessToken;
/**
* 机关Id
*/
@NotBlank(message = "机关Id不能为空",groups = {StaffSinAgency.class})
private String agencyId;
}

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

@ -10,6 +10,8 @@ public interface ModuleConstant {
String ERROR_GOV_ORG_DEPARTMENT = "调用gov_org服务查询【部门】下的所有工作人员失败";
String ERROR_GOV_ORG_AGENCY = "调用gov_org服务查询【机关】下的所有工作人员失败";
String ERROR_EPMET_USER = "调用epmet_user服务查询网格下的所有工作人员失败";
}

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

@ -2,14 +2,10 @@ package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.StaffSinDeptFormDTO;
import com.epmet.dto.form.StaffSinGridFormDTO;
import com.epmet.dto.form.UserIdsFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.OpenUpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -17,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
@ -55,4 +50,16 @@ public class OpenUpController {
return new Result<List<StaffSinDeptResultDTO>>().ok(openUpService.staffSinDept(formDTO));
}
/**
* @Description 机关工作人员 被禁用的未激活的不显示
* @param formDTO
* @author zxc
* @date 2020/8/17 9:59 上午
*/
@PostMapping("staffsinagency")
public Result<List<StaffSinAgencyResultDTO>> staffSinAgency(@RequestBody StaffSinAgencyFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, StaffSinAgencyFormDTO.StaffSinAgency.class);
return new Result<List<StaffSinAgencyResultDTO>>().ok(openUpService.staffSinAgency(formDTO));
}
}

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

@ -1,7 +1,9 @@
package com.epmet.service;
import com.epmet.dto.form.StaffSinAgencyFormDTO;
import com.epmet.dto.form.StaffSinDeptFormDTO;
import com.epmet.dto.form.StaffSinGridFormDTO;
import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
@ -29,4 +31,11 @@ public interface OpenUpService {
*/
List<StaffSinDeptResultDTO> staffSinDept(StaffSinDeptFormDTO formDTO);
/**
* @Description 机关工作人员 被禁用的未激活的不显示
* @param formDTO
* @author zxc
* @date 2020/8/17 9:59 上午
*/
List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO);
}

60
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.utils.Result;
import com.epmet.constant.ModuleConstant;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.StaffSinAgencyResultDTO;
import com.epmet.dto.result.StaffSinDeptResultDTO;
import com.epmet.dto.result.StaffSinGridResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
@ -47,14 +48,7 @@ public class OpenUpServiceImpl implements OpenUpService {
if (!gridStaffs.success()){
throw new RenException(ModuleConstant.ERROR_GOV_ORG_GRID);
}
List<String> userIds = gridStaffs.getData();
UserIdsFormDTO userIdsForm = new UserIdsFormDTO();
userIdsForm.setUserIds(userIds);
Result<List<StaffSinGridResultDTO>> staffInfoList = epmetUserOpenFeignClient.getStaffInfoList(userIdsForm);
if (!staffInfoList.success()){
throw new RenException(ModuleConstant.ERROR_EPMET_USER);
}
return staffInfoList.getData();
return this.getStaffList(gridStaffs.getData());
}
/**
@ -71,14 +65,7 @@ public class OpenUpServiceImpl implements OpenUpService {
if (!departmentStaffs.success()){
throw new RenException(ModuleConstant.ERROR_GOV_ORG_DEPARTMENT);
}
List<String> userIds = departmentStaffs.getData();
UserIdsFormDTO userIdsForm = new UserIdsFormDTO();
userIdsForm.setUserIds(userIds);
Result<List<StaffSinGridResultDTO>> staffInfoList = epmetUserOpenFeignClient.getStaffInfoList(userIdsForm);
if (!staffInfoList.success()){
throw new RenException(ModuleConstant.ERROR_EPMET_USER);
}
List<StaffSinGridResultDTO> data = staffInfoList.getData();
List<StaffSinGridResultDTO> data = this.getStaffList(departmentStaffs.getData());
List<StaffSinDeptResultDTO> result = new ArrayList<>();
data.forEach(staff -> {
StaffSinDeptResultDTO dept = new StaffSinDeptResultDTO();
@ -87,4 +74,45 @@ public class OpenUpServiceImpl implements OpenUpService {
});
return result;
}
/**
* @Description 机关工作人员 被禁用的未激活的不显示
* @param formDTO
* @author zxc
* @date 2020/8/17 9:59 上午
*/
@Override
public List<StaffSinAgencyResultDTO> staffSinAgency(StaffSinAgencyFormDTO formDTO) {
AgencyIdFormDTO agencyId = new AgencyIdFormDTO();
agencyId.setAgencyId(formDTO.getAgencyId());
Result<List<String>> agencyStaffs = govOrgOpenFeignClient.getAgencyStaffs(agencyId);
if (!agencyStaffs.success()){
throw new RenException(ModuleConstant.ERROR_GOV_ORG_AGENCY);
}
List<StaffSinGridResultDTO> staffList = this.getStaffList(agencyStaffs.getData());
List<StaffSinAgencyResultDTO> result = new ArrayList<>();
staffList.forEach(staff -> {
StaffSinAgencyResultDTO agency = new StaffSinAgencyResultDTO();
BeanUtils.copyProperties(staff,agency);
result.add(agency);
});
return result;
}
/**
* @Description 获取工作人员信息
* @param userIds
* @author zxc
* @date 2020/8/17 1:30 下午
*/
public List<StaffSinGridResultDTO> getStaffList(List<String> userIds){
UserIdsFormDTO userIdsForm = new UserIdsFormDTO();
userIdsForm.setUserIds(userIds);
Result<List<StaffSinGridResultDTO>> staffInfoList = epmetUserOpenFeignClient.getStaffInfoList(userIdsForm);
if (!staffInfoList.success()){
throw new RenException(ModuleConstant.ERROR_EPMET_USER);
}
return staffInfoList.getData();
}
}

2
epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml

@ -1,7 +1,7 @@
server:
port: @server.port@
servlet:
context-path: /ext
context-path: /epmet/ext
spring:
main:

20
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencyIdFormDTO.java

@ -0,0 +1,20 @@
package com.epmet.dto.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/8/17 10:37 上午
*/
@Data
public class AgencyIdFormDTO implements Serializable {
private static final long serialVersionUID = -1719033407335647411L;
/**
* 部门Id
*/
private String agencyId;
}

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

@ -191,7 +191,7 @@ public interface GovOrgOpenFeignClient {
* @author zxc
* @date 2020/8/13 10:46 上午
*/
@PostMapping(value = "/gov/org/customerstaffgrid/getgridstaffs")
@PostMapping(value = "/gov/org/customerstaffgrid/getgridstaffs",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<String>> getGridStaffs(@RequestBody CommonGridIdFormDTO gridIdFormDTO);
/**
@ -200,7 +200,7 @@ public interface GovOrgOpenFeignClient {
* @author zxc
* @date 2020/8/13 2:46 下午
*/
@PostMapping("/gov/org/customerstaffdepartment/getdepartmentstaffs")
@PostMapping(value = "/gov/org/customerstaffdepartment/getdepartmentstaffs",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<String>> getDepartmentStaffs(@RequestBody DepartmentIdFormDTO formDTO);
/**
@ -209,6 +209,15 @@ public interface GovOrgOpenFeignClient {
* @author zxc
* @date 2020/8/14 9:31 上午
*/
@PostMapping("/gov/org/customergrid/gridcount")
@PostMapping(value = "/gov/org/customergrid/gridcount",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<CustomerGridCountResultDTO> selectGridCount(@RequestBody CustomerIdFormDTO customerIdFormDTO);
/**
* @Description 查询机关下工作人员
* @param formDTO
* @author zxc
* @date 2020/8/17
*/
@PostMapping(value = "/gov/org/customerstaffagency/getagencystaffs",consumes = MediaType.APPLICATION_JSON_VALUE)
Result<List<String>> getAgencyStaffs(@RequestBody AgencyIdFormDTO formDTO);
}

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

@ -126,4 +126,9 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient {
public Result<CustomerGridCountResultDTO> selectGridCount(CustomerIdFormDTO customerIdFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectGridCount", customerIdFormDTO);
}
@Override
public Result<List<String>> getAgencyStaffs(AgencyIdFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getAgencyStaffs", formDTO);
}
}

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerStaffAgencyController.java

@ -28,6 +28,7 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.form.AgencyIdFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
@ -111,7 +112,15 @@ public class CustomerStaffAgencyController {
return customerStaffAgencyService.getLatestCustomer(userId);
}
/**
* @Description 查询机关下工作人员
* @param agencyIdFormDTO
* @author zxc
* @date 2020/8/17 10:14 上午
*/
@PostMapping("getagencystaffs")
public Result<List<String>> getAgencyStaffs(@RequestBody AgencyIdFormDTO agencyIdFormDTO){
return new Result<List<String>>().ok(customerStaffAgencyService.getAgencyStaffs(agencyIdFormDTO));
}
}

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

@ -100,4 +100,12 @@ public interface CustomerStaffAgencyDao extends BaseDao<CustomerStaffAgencyEntit
* @Date 2020/7/23 21:10
**/
CustomerAgencyDTO selectMyAgency(String staffId);
/**
* @Description 查询机关下工作人员的 userId
* @param agencyId
* @author zxc
* @date 2020/8/17 10:19 上午
*/
List<String> getAgencyStaffList(@Param("agencyId")String agencyId);
}

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerStaffAgencyService.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerStaffAgencyDTO;
import com.epmet.dto.form.AgencyIdFormDTO;
import com.epmet.dto.form.CommonDepartmentFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
@ -142,4 +143,12 @@ public interface CustomerStaffAgencyService extends BaseService<CustomerStaffAge
* @return com.epmet.dto.CustomerStaffAgencyDTO
*/
CustomerStaffAgencyDTO getInfoByUserId(String userId);
/**
* @Description 查询机关下工作人员
* @param agencyIdFormDTO
* @author zxc
* @date 2020/8/17 10:14 上午
*/
List<String> getAgencyStaffs(AgencyIdFormDTO agencyIdFormDTO);
}

18
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerStaffAgencyServiceImpl.java

@ -27,10 +27,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.CustomerStaffAgencyDao;
import com.epmet.dto.*;
import com.epmet.dto.form.CommonDepartmentFormDTO;
import com.epmet.dto.form.CommonGridIdFormDTO;
import com.epmet.dto.form.CommonUserIdListFormDTO;
import com.epmet.dto.form.StaffsInAgencyFromDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.CommonStaffInfoResultDTO;
import com.epmet.dto.result.LatestCustomerResultDTO;
import com.epmet.entity.CustomerStaffAgencyEntity;
@ -72,6 +69,8 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl<CustomerStaf
private CustomerGridService customerGridService;
@Autowired
private CustomerDepartmentService customerDepartmentService;
@Autowired
private CustomerStaffAgencyDao customerStaffAgencyDao;
@Override
public PageData<CustomerStaffAgencyDTO> page(Map<String, Object> params) {
@ -213,4 +212,15 @@ public class CustomerStaffAgencyServiceImpl extends BaseServiceImpl<CustomerStaf
return ConvertUtils.sourceToTarget(entity, CustomerStaffAgencyDTO.class);
}
/**
* @Description 查询机关下工作人员
* @param agencyIdFormDTO
* @author zxc
* @date 2020/8/17 10:14 上午
*/
@Override
public List<String> getAgencyStaffs(AgencyIdFormDTO agencyIdFormDTO) {
return customerStaffAgencyDao.getAgencyStaffList(agencyIdFormDTO.getAgencyId());
}
}

11
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml

@ -141,4 +141,15 @@
csa.DEL_FLAG = '0'
AND csa.USER_ID = #{staffId}
</select>
<!-- 查询机关下工作人员的 userId -->
<select id="getAgencyStaffList" resultType="java.lang.String">
SELECT
user_id AS userId
FROM
customer_staff_agency
WHERE
del_flag = '0'
AND agency_id = #{agencyId}
</select>
</mapper>

42
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffSinAgencyResultDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/8/17 9:25 上午
*/
@Data
public class StaffSinAgencyResultDTO implements Serializable {
private static final long serialVersionUID = -3440415906710443002L;
/**
* 工作人员Id
*/
private String staffId;
/**
* 工作人员名称
*/
private String staffName;
/**
* 头像
*/
private String headPhoto;
/**
* 性别1男2女0未知
*/
private Integer gender;
/**
* 角色列表
*/
private List<RoleResultDTO> roleList;
}
Loading…
Cancel
Save