Browse Source

联建单位、社会自组织校验工作人员信息使用

master
sunyuchao 3 years ago
parent
commit
7433f807bf
  1. 49
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckStaffInfoFormDTO.java
  2. 50
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckStaffInfoResultDTO.java
  3. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
  4. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java
  5. 69
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
  6. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  7. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  8. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  9. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  10. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

49
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckStaffInfoFormDTO.java

@ -0,0 +1,49 @@
/**
* 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.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
public class CheckStaffInfoFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Check extends CustomerClientShowGroup {}
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = Check.class)
private String mobile;
/**
* 人名姓名
*/
@NotBlank(message = "姓名不能为空", groups = Check.class)
private String personName;
private String customerId;
private String staffId;
}

50
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckStaffInfoResultDTO.java

@ -0,0 +1,50 @@
/**
* 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;
@Data
public class CheckStaffInfoResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 状态false为有问题
*/
private Boolean type = false;
/**
* 提示文案内容
*/
private String msg = "";
/**
* 数据库中工作人员姓名返参姓名有值的则需要更新工作人员信息
*/
private String personName;
/**
* 类型后端使用
*/
private Boolean key = true;
}

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

@ -161,4 +161,17 @@ public class DepartmentController {
List<DepartmentListResultDTO> deptList = departmentService.listDepartmentListByStaffId(staffId);
return new Result<List<DepartmentListResultDTO>>().ok(deptList);
}
/**
* @Author sun
* @Description 根据手机号姓名查询人员信息联建单位社会自组织新增使用
*/
@PostMapping("checkstaffinfo")
public Result<CheckStaffInfoResultDTO> checkStaffInfo(@LoginUser TokenDto tokenDTO, @RequestBody CheckStaffInfoFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, CheckStaffInfoFormDTO.Check.class);
formDTO.setCustomerId(tokenDTO.getCustomerId());
formDTO.setStaffId(tokenDTO.getUserId());
return new Result<CheckStaffInfoResultDTO>().ok(departmentService.checkStaffInfo(formDTO));
}
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java

@ -20,10 +20,7 @@ package com.epmet.service;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddDepartmentResultDTO;
import com.epmet.dto.result.DepartmentDetailResultDTO;
import com.epmet.dto.result.DepartmentInAgencyResultDTO;
import com.epmet.dto.result.DepartmentListResultDTO;
import com.epmet.dto.result.*;
import java.util.List;
@ -104,4 +101,6 @@ public interface DepartmentService {
* @return
*/
List<DepartmentListResultDTO> listDepartmentListByStaffId(String staffId);
CheckStaffInfoResultDTO checkStaffInfo(CheckStaffInfoFormDTO formDTO);
}

69
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java

@ -19,7 +19,9 @@ package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
@ -30,8 +32,10 @@ import com.epmet.constant.CustomerDepartmentConstant;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerDepartmentDao;
import com.epmet.dao.CustomerStaffDepartmentDao;
import com.epmet.dao.StaffOrgRelationDao;
import com.epmet.dto.CustomerDepartmentDTO;
import com.epmet.dto.CustomerIdDTO;
import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffDepartmentDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
@ -39,6 +43,7 @@ import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerDepartmentEntity;
import com.epmet.entity.CustomerStaffDepartmentEntity;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.CustomerDepartmentService;
import com.epmet.service.CustomerStaffDepartmentService;
import com.epmet.service.DepartmentService;
@ -49,6 +54,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@ -76,6 +82,10 @@ public class DepartmentServiceImpl implements DepartmentService {
private EpmetUserFeignClient epmetUserFeignClient;
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private StaffOrgRelationDao staffOrgRelationDao;
/**
* @param formDTO
* @return
@ -280,4 +290,63 @@ public class DepartmentServiceImpl implements DepartmentService {
public List<DepartmentListResultDTO> listDepartmentListByStaffId(String staffId) {
return customerDepartmentDao.listDepartmentListByStaffId(staffId);
}
@Override
public CheckStaffInfoResultDTO checkStaffInfo(CheckStaffInfoFormDTO formDTO) {
CheckStaffInfoResultDTO resultDTO = new CheckStaffInfoResultDTO();
//1.根据手机号查询客户下工作人员信息
CustomerStaffFormDTO user = new CustomerStaffFormDTO();
user.setCustomerId(formDTO.getCustomerId());
user.setMobile(formDTO.getMobile());
Result<CustomerStaffDTO> userResult = epmetUserOpenFeignClient.staffDetailInfo(user);
if (!userResult.success()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取工作人员信息失败", "获取工作人员信息失败");
}
//查不到工作人员就直接返回
if (null == userResult.getData()) {
return resultDTO;
}
//2.查询工作人员注册组织关系数据
List<String> staffIdList = new ArrayList<>();
staffIdList.add(userResult.getData().getUserId());
List<StaffOrgNameResultDTO> list = staffOrgRelationDao.selelctStaffOrg(staffIdList);
if (CollectionUtils.isEmpty(list)) {
return resultDTO;
}
//3.校验工作人员的注册关系【从哪里新增进来的工作人员】
//获取当前操作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId()));
}
//所属组织信息不同的给提示【所属组织不同时则不新增部门、不新增工作人员】
if (!list.get(0).getAgencyId().equals(staffInfo.getAgencyId())) {
resultDTO.setMsg("联系电话已存在其他组织工作账号中,请使用其他手机号,否则将无法获取通知信息");
resultDTO.setKey(false);
return resultDTO;
}
//从网格下添加的人给提示【网格下加的人时则不新增部门、不新增工作人员】
if ("gridId".equals(list.get(0).getOrgType())) {
resultDTO.setMsg("联系电话已存在其他部门工作账号中,请先将该工作人员调动至本组织下,再次添加");
resultDTO.setKey(false);
return resultDTO;
}
//账号被禁用的给提示【人员被禁用的则不新增部门、不新增工作人员】
if ("disabled".equals(userResult.getData().getEnableFlag())) {
resultDTO.setMsg("该工作人员账号已被禁用,请使用其他联系电话,否则将无法获取通知信息");
resultDTO.setKey(false);
return resultDTO;
}
//姓名不一样的给反馈
if (!formDTO.getPersonName().equals(userResult.getData().getRealName())) {
resultDTO.setPersonName(userResult.getData().getRealName());
}
resultDTO.setType(true);
return resultDTO;
}
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -855,4 +855,8 @@ public interface EpmetUserOpenFeignClient {
*/
@PostMapping("/epmetuser/staffrole/getIsRootManager")
Result<Boolean> getIsRootManager(@RequestParam("userId") String userId);
@PostMapping("/epmetuser/customerstaff/staffdetailinfo")
Result<CustomerStaffDTO> staffDetailInfo(@RequestBody CustomerStaffFormDTO formDTO);
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -646,4 +646,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getIsRootManager", userId);
}
@Override
public Result<CustomerStaffDTO> staffDetailInfo(CustomerStaffFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffDetailInfo", formDTO);
}
}

5
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java

@ -493,5 +493,10 @@ public class CustomerStaffController {
return new Result<List<GridMobileListResultDTO>>().ok(customerStaffService.gridMobileList(formDTO.getGridId(), tokenDto.getUserId()));
}
@PostMapping(value = "staffdetailinfo")
public Result<CustomerStaffDTO> staffDetailInfo(@RequestBody CustomerStaffFormDTO formDTO) {
return new Result<CustomerStaffDTO>().ok(customerStaffService.staffDetailInfo(formDTO));
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java

@ -347,4 +347,6 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
* @Description 事件网格员服务电话
**/
List<GridMobileListResultDTO> gridMobileList(String gridId, String userId);
CustomerStaffDTO staffDetailInfo(CustomerStaffFormDTO formDTO);
}

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

@ -45,7 +45,6 @@ import com.epmet.dao.StaffRoleDao;
import com.epmet.dto.*;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.dto.result.NewUserRoleResultDTO;
import com.epmet.entity.CustomerStaffEntity;
import com.epmet.entity.GovStaffRoleEntity;
import com.epmet.entity.StaffRoleEntity;
@ -870,4 +869,9 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return resultList;
}
@Override
public CustomerStaffDTO staffDetailInfo(CustomerStaffFormDTO formDTO) {
return baseDao.selectListCustomerStaffInfo(formDTO);
}
}

Loading…
Cancel
Save