Browse Source

新版增加

dev
zhangyuan 3 years ago
parent
commit
29a925e6ce
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java
  2. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
  3. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
  4. 66
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  5. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java
  6. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  7. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java

@ -100,6 +100,7 @@ public enum EpmetErrorCode {
EXIT_PEND_PROJECT(8408,"该工作人员有项目尚在处理,处理完毕方可操作"),
EXIT_PUBLISHED_ACTIVITY(8409,"该工作人员有活动尚在进行,等活动完成方可操作"),
CAN_NOT_SELF(8410,"无法对自己进行操作"),
ACCOUNT_USED(8411,"该手机号已注册"),
PATROL_IS_NOT_OVER(8520,"巡查尚未结束"),
ALREADY_EVALUATE(8501,"您已评价"),

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java

@ -212,13 +212,13 @@ public class StaffController {
* 通讯录人员添加-平阴
* @author zhy
*/
@PostMapping("addstaffpy")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_STAFF_CREATE)
public Result addStaffPy(@LoginUser TokenDto tokenDto, @RequestBody AddStaffPyFromDTO fromDTO){
ValidatorUtils.validateEntity(fromDTO, AddStaffPyFromDTO.AddStaff.class);
fromDTO.setCustomerId(tokenDto.getCustomerId());
fromDTO.setApp(tokenDto.getApp());
fromDTO.setClient(tokenDto.getClient());
public Result addStaffPy(@RequestBody StaffSubmitPyFromDTO fromDTO){
fromDTO.setApp("gov");
fromDTO.setClient("wxmp");
ValidatorUtils.validateEntity(fromDTO);
return staffService.addStaffPy(fromDTO);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java

@ -143,7 +143,7 @@ public interface StaffService {
* 通讯录人员添加-平阴
* @author zhy
*/
Result addStaffPy(AddStaffPyFromDTO fromDTO);
Result addStaffPy(StaffSubmitPyFromDTO fromDTO);
/**
* @Description 工作人员所属组织

66
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java

@ -603,73 +603,37 @@ public class StaffServiceImpl implements StaffService {
@Override
@Transactional(rollbackFor = Exception.class)
public Result addStaffPy(AddStaffPyFromDTO fromDTO) {
//1.根据新增人员类型判断查询机关信息
OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(fromDTO.getOrgId(), fromDTO.getOrgType());
if (null == orgDTO) {
logger.error(String.format("工作人员新增,根据新增人员组织类型未查询到相关组织信息,orgId->%s,orgType->%s", fromDTO.getOrgId(), fromDTO.getOrgType()));
throw new RenException("根据新增人员组织类型未查询到相关组织信息");
}
public Result addStaffPy(StaffSubmitPyFromDTO fromDTO) {
CustomerAgencyEntity customerAgencyEntity = customerAgencyService.selectById(fromDTO.getAgencyId());
//fromDTO.setApp(tokenDto.getApp());
//fromDTO.setClient(tokenDto.getClient());
fromDTO.setCustomerId(customerAgencyEntity.getCustomerId());
Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaffPy(fromDTO);
//2.调用user服务,新增用户信息
StaffSubmitPyFromDTO submitDTO = ConvertUtils.sourceToTarget(fromDTO, StaffSubmitPyFromDTO.class);
submitDTO.setAgencyId(orgDTO.getAgencyId());
Result<CustomerStaffDTO> result = epmetUserFeignClient.addStaffPy(submitDTO);
if (!result.success()) {
if (result.getCode() != EpmetErrorCode.SERVER_ERROR.getCode()) {
return new Result().error(result.getCode(), result.getMsg());
}
return new Result().error(EpmetErrorCode.STAFF_ADD_FAILED.getCode(), EpmetErrorCode.STAFF_ADD_FAILED.getMsg());
}
//3.人员机关表总人数加一、关系表新增关系数据
//人员机关关系表
CustomerStaffAgencyEntity customerStaffAgencyEntity = new CustomerStaffAgencyEntity();
customerStaffAgencyEntity.setCustomerId(fromDTO.getCustomerId());
customerStaffAgencyEntity.setCustomerId(customerAgencyEntity.getCustomerId());
customerStaffAgencyEntity.setUserId(result.getData().getUserId());
customerStaffAgencyEntity.setAgencyId(orgDTO.getAgencyId());
customerStaffAgencyEntity.setAgencyId(customerAgencyEntity.getId());
customerStaffAgencyService.insert(customerStaffAgencyEntity);
//机关总人数加一
CustomerAgencyEntity agencyEntity = new CustomerAgencyEntity();
agencyEntity.setId(orgDTO.getAgencyId());
agencyEntity.setTotalUser(orgDTO.getTotalUser() + 1);
customerAgencyService.updateById(agencyEntity);
//4.部门、网格主表、关系表修改、新增数据
if ("dept".equals(fromDTO.getOrgType())) {
CustomerStaffDepartmentEntity dept = new CustomerStaffDepartmentEntity();
dept.setCustomerId(fromDTO.getCustomerId());
dept.setUserId(result.getData().getUserId());
dept.setDepartmentId(fromDTO.getOrgId());
customerStaffDepartmentService.insert(dept);
CustomerDepartmentEntity departmentEntity = new CustomerDepartmentEntity();
departmentEntity.setId(fromDTO.getOrgId());
departmentEntity.setTotalUser(orgDTO.getDeptTotalUser() + 1);
customerDepartmentService.updateById(departmentEntity);
}
if ("grid".equals(fromDTO.getOrgType())) {
CustomerStaffGridEntity grid = new CustomerStaffGridEntity();
grid.setCustomerId(fromDTO.getCustomerId());
grid.setUserId(result.getData().getUserId());
grid.setGridId(fromDTO.getOrgId());
customerStaffGridService.insert(grid);
CustomerGridEntity gridEntity = new CustomerGridEntity();
gridEntity.setId(fromDTO.getOrgId());
gridEntity.setTotalUser(orgDTO.getGridTotalUser() + 1);
customerGridService.updateById(gridEntity);
}
customerAgencyEntity.setTotalUser(customerAgencyEntity.getTotalUser() + 1);
customerAgencyService.updateById(customerAgencyEntity);
//5.工作人员注册组织关系表新增数据
//2021.8.25 sun 新增一张工作人员注册组织关系表,所以旧接口新增人员时关系表赋值关系数据
//工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setCustomerId(fromDTO.getCustomerId());
if("agency".equals(fromDTO.getOrgType())){
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids()));
}else {
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids() + ":") + orgDTO.getAgencyId());
}
staffOrgRelationEntity.setPids(("".equals(customerAgencyEntity.getPids()) ? "" : customerAgencyEntity.getPids()));
staffOrgRelationEntity.setStaffId(result.getData().getUserId());
staffOrgRelationEntity.setOrgId(fromDTO.getOrgId());
staffOrgRelationEntity.setOrgType(fromDTO.getOrgType());
staffOrgRelationEntity.setOrgId(customerAgencyEntity.getId());
staffOrgRelationEntity.setOrgType("agency");
staffOrgRelationService.insert(staffOrgRelationEntity);
return new Result();

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/CustomerStaffDTO.java

@ -44,6 +44,11 @@ public class CustomerStaffDTO implements Serializable {
*/
private String userId;
/**
* 账户
*/
private String userAccount;
/**
* 真实姓名
*/

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

@ -278,7 +278,11 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
if (null == customerStaffDTO) {
log.warn("工作人员不存在");
}
if (StringUtils.isBlank(customerStaffDTO.getHeadPhoto())) {
customerStaffDTO.setHeadPhoto("");
}
resultDTO.setStaffId(customerStaffDTO.getUserId());
resultDTO.setUserAccount(customerStaffDTO.getUserAccount());
resultDTO.setName(customerStaffDTO.getRealName());
resultDTO.setGender(customerStaffDTO.getGender());
resultDTO.setMobile(customerStaffDTO.getMobile());
@ -378,6 +382,13 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
if (null != customerStaffDTO) {
return new Result<CustomerStaffDTO>().error(EpmetErrorCode.MOBILE_USED.getCode(), EpmetErrorCode.MOBILE_USED.getMsg());
}
CustomerStaffByAccountFormDTO customerStaffAccountFormDTO = new CustomerStaffByAccountFormDTO();
customerStaffAccountFormDTO.setCustomerId(fromDTO.getCustomerId());
customerStaffAccountFormDTO.setUserAccount(fromDTO.getUserAccount());
customerStaffDTO = baseDao.selectListCustomerStaffInfoByAccount(customerStaffAccountFormDTO);
if (null != customerStaffDTO) {
return new Result<CustomerStaffDTO>().error(EpmetErrorCode.ACCOUNT_USED.getCode(), EpmetErrorCode.ACCOUNT_USED.getMsg());
}
//USER表插入数据
UserEntity userEntity = new UserEntity();
userEntity.setFromApp(fromDTO.getApp());
@ -578,6 +589,9 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
StaffDetailResultDTO resultDTO = new StaffDetailResultDTO();
//获取工作人员信息
CustomerStaffDTO customerStaffDTO = baseDao.selectStaffInfo(fromDTO);
if (StringUtils.isBlank(customerStaffDTO.getHeadPhoto())) {
customerStaffDTO.setHeadPhoto("");
}
resultDTO.setStaffId(customerStaffDTO.getUserId());
resultDTO.setName(customerStaffDTO.getRealName());
resultDTO.setMobile(customerStaffDTO.getMobile());

10
epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

@ -141,15 +141,7 @@
</select>
<select id="selectStaffInfo" resultType="com.epmet.dto.CustomerStaffDTO" parameterType="com.epmet.dto.form.StaffInfoFromDTO">
SELECT
USER_ID,
REAL_NAME,
MOBILE,
GENDER,
IFNULL(HEAD_PHOTO, "") AS "headPhoto",
ENABLE_FLAG,
ACTIVE_FLAG,
ACTIVE_TIME,
WORK_TYPE
*
FROM
customer_staff
WHERE

Loading…
Cancel
Save