Browse Source

Merge branch 'develop' into release_temp

dev_shibei_match
sunyuchao 4 years ago
parent
commit
5fddcfed68
  1. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
  2. 7
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java
  3. 4
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java
  4. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java
  5. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffTransferRecordDTO.java
  6. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java
  7. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentStaffInfoFormDTO.java
  8. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffInfoFormDTO.java
  9. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffListFromDTO.java
  10. 27
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffTransferV2FormDTO.java
  11. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
  12. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  13. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/StaffController.java
  14. 16
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffTransferRecordEntity.java
  15. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffOrgRelationService.java
  16. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/StaffService.java
  17. 20
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  18. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  19. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
  20. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.java
  21. 146
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffServiceImpl.java
  22. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.6__add_staff_org_relation.sql
  23. 12
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml
  24. 9
      epmet-module/resi-home/resi-home-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java
  25. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberConfirmController.java
  26. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java

@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.PostMapping;
/**
* desc:通用工具包里的 agg feignClient
* @Description
* @Author sun
*/

7
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/EpmetUserController.java

@ -8,12 +8,6 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.GridMemberStatsFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.OpenStaffDetailFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolDateListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.PatrolRecordListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.StaffListFormDTO;
import com.epmet.dataaggre.dto.epmetuser.form.*;
import com.epmet.dataaggre.dto.epmetuser.result.*;
import com.epmet.dataaggre.dto.govorg.result.GridMemberDataAnalysisResultDTO;
@ -271,4 +265,5 @@ public class EpmetUserController {
return new Result<CustomerStaffResultDTO>().ok(epmetUserService.getStaffInfo(staffId));
}
}

4
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/InfoServiceImpl.java

@ -107,6 +107,10 @@ public class InfoServiceImpl extends BaseServiceImpl<InfoDao, InfoEntity> implem
totalReceiver.addAll(orgStaffIds);
totalReceiver.addAll(roleStaffIds);
totalReceiver.addAll(groupStaffIds);
if (CollectionUtils.isNotEmpty(totalReceiver) && totalReceiver.contains(formDTO.getUserId())) {
log.info("接收人列表包含自己,移除");
totalReceiver.remove(formDTO.getUserId());
}
if(CollectionUtils.isEmpty(totalReceiver)){
throw new RenException(EpmetErrorCode.PLEASE_CHOOSE_RECEIVER.getCode(), EpmetErrorCode.PLEASE_CHOOSE_RECEIVER.getMsg());
}

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@ -176,6 +177,7 @@ public class IssueManageController {
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@NoRepeatSubmit
@PostMapping("shiftproject-v2")
public Result shiftProjectV2(@LoginUser TokenDto tokenDTO, @RequestBody ShiftProjectFormDTO formDTO) {
formDTO.setStaffId(tokenDTO.getUserId());

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/StaffTransferRecordDTO.java

@ -57,12 +57,15 @@ public class StaffTransferRecordDTO implements Serializable {
* 调动前组织Id
*/
private String oldAgencyId;
private String oldOrgType;
private String oldOrgId;
/**
* 调动后组织Id
*/
private String agencyId;
private String orgType;
private String orgId;
/**
* 备注说明
*/

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentStaffFormDTO.java

@ -28,4 +28,7 @@ public class AddDepartmentStaffFormDTO implements Serializable {
@NotBlank(message = "选中人员不能为空")
private List<String> selectedList;
//token中客户Id
private String customerId;
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonDepartmentStaffInfoFormDTO.java

@ -32,4 +32,7 @@ public class CommonDepartmentStaffInfoFormDTO implements Serializable {
* */
@NotBlank(message = "用户Id不能为空")
private String userId;
//token中客户Id
private String customerId;
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffInfoFormDTO.java

@ -32,4 +32,7 @@ public class CommonGridStaffInfoFormDTO implements Serializable{
* */
@NotBlank(message = "用户Id不能为空")
private String userId;
//token中客户Id
private String customerId;
}

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CommonGridStaffListFromDTO.java

@ -35,4 +35,7 @@ public class CommonGridStaffListFromDTO implements Serializable{
@NotBlank(message = "用户Id不能为空")
private String userId;
//token中客户Id
private String customerId;
}

27
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffTransferV2FormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2021/8/20 15:26
*/
@NoArgsConstructor
@Data
public class StaffTransferV2FormDTO implements Serializable {
private static final long serialVersionUID = 1217329965082876795L;
@NotBlank(message = "组织ID不能为空")
private String orgId;
@NotBlank(message = "组织类型不能为空")
private String orgType;
@NotBlank(message = "工作人员ID不能为空")
private String staffId;
@NotBlank(message = "备注说明不能为空")
private String remarks;
}

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

@ -39,6 +39,7 @@ public class DepartmentController {
@PostMapping(value = "adddepartmentstaff")
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_DEPARTMENT_STAFF_ADD)
public Result addDepartmentStaff(@LoginUser TokenDto tokenDto, @RequestBody AddDepartmentStaffFormDTO addDepartmentStaffFormDTO){
addDepartmentStaffFormDTO.setCustomerId(tokenDto.getCustomerId());
return departmentService.addDepartmentStaff(tokenDto,addDepartmentStaffFormDTO);
}
@ -147,6 +148,7 @@ public class DepartmentController {
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_DEPARTMENT_STAFF_REMOVE)
public Result removeStaff(@LoginUser TokenDto tokenDto,@RequestBody CommonDepartmentStaffInfoFormDTO departmentStaffInfoFormDTO){
departmentStaffInfoFormDTO.setUserId(tokenDto.getUserId());
departmentStaffInfoFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(departmentStaffInfoFormDTO);
return departmentService.removeStaff(departmentStaffInfoFormDTO);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -125,6 +125,7 @@ public class GridController {
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_STAFF_ADD)
public Result addGridStaffs(@LoginUser TokenDto tokenDto, @RequestBody CommonGridStaffListFromDTO commonGridStaffListFromDTO){
commonGridStaffListFromDTO.setUserId(tokenDto.getUserId());
commonGridStaffListFromDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(tokenDto);
return customerGridService.addGridStaffs(commonGridStaffListFromDTO);
}
@ -141,6 +142,7 @@ public class GridController {
@RequirePermission(requirePermission = RequirePermissionEnum.ORG_GRID_STAFF_REMOVE)
public Result removeGridStaff(@LoginUser TokenDto tokenDto, @RequestBody CommonGridStaffInfoFormDTO commonGridStaffInfoFormDTO){
commonGridStaffInfoFormDTO.setUserId(tokenDto.getUserId());
commonGridStaffInfoFormDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(tokenDto);
return customerGridService.removeGridStaff(commonGridStaffInfoFormDTO);
}

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

@ -145,6 +145,21 @@ public class StaffController {
return new Result();
}
/**
* 工作人员调动V2
*
* @author zhaoqifeng
* @date 2020/8/27 16:12
* @param tokenDto
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@PostMapping("stafftransferv2")
public Result staffTransferV2(@LoginUser TokenDto tokenDto, @RequestBody StaffTransferV2FormDTO formDTO){
staffService.staffTransferV2(tokenDto, formDTO);
return new Result();
}
/**
* 根据staffId查询用户基本信息
* @author sun

16
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/StaffTransferRecordEntity.java

@ -53,15 +53,19 @@ public class StaffTransferRecordEntity extends BaseEpmetEntity {
*/
private String operatedStaffId;
/**
* 调动前组织Id
*/
/**
* 调动前组织Id
*/
private String oldAgencyId;
private String oldOrgType;
private String oldOrgId;
/**
* 调动后组织Id
*/
/**
* 调动后组织Id
*/
private String agencyId;
private String orgType;
private String orgId;
/**
* 备注说明

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

@ -92,4 +92,13 @@ public interface StaffOrgRelationService extends BaseService<StaffOrgRelationEnt
* @date 2021-08-19
*/
void delete(String[] ids);
/**
* @Description 获取工作人员注册组织关系
* @Param staffId
* @Return {@link StaffOrgRelationDTO}
* @Author zhaoqifeng
* @Date 2021/8/20 16:46
*/
StaffOrgRelationDTO getByStaffId(String staffId);
}

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

@ -100,6 +100,16 @@ public interface StaffService {
*/
void staffTransfer(TokenDto tokenDto, StaffTransferFormDTO fromDTO);
/**
* 工作人员调动
* @author zhaoqifeng
* @date 2020/8/27 16:13
* @param tokenDto
* @param fromDTO
* @return void
*/
void staffTransferV2(TokenDto tokenDto, StaffTransferV2FormDTO fromDTO);
/**
* 根据staffId查询用户基本信息
* @author sun

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

@ -195,6 +195,9 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
//根据组织Id查询该组织的工作人员(带单位领导角色)列表;该组织的部门列表、部门下人员(带部门领导角色)列表;该组织的网格列表、网格下人员(带网格长角色)列表。人员都不做去重处理。
DepartmentStaffListResultDTO resultDTO = new DepartmentStaffListResultDTO();
//1:根据组织Id查询该组织下工作人员列表
/*2021.8.23 sun 应产品要求工作人员可以在组织部门网格下新增对于部门网格下添加的人在选人时不在组织层级展示
对于在组织添加的人即使有加入部门网格也要在选人的组织层级上展示组织添加的人不在做去重处理
程序的调整是查询组织下人员时只查询在组织层级添加的同时下边程序对部门网格有的人要在组织去重的程序做屏蔽处理*/
List<StaffListResultDTO> agencyStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId());
//2:根据组织Id查询该组织下部门、人员列表
//2.1:查询组织下部门列表
@ -257,8 +260,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
//5:循环数据,将人员数据放到对应数据结构下
List<StaffListResultDTO> staffList = dto.getStaffList();
List<CustomerStaffRoleResultDTO> roleList = dto.getRoleList();
//有时间再优化成jdk8的遍历方式
//5.0:先把在部门或网格下存在的人员在组织中去掉,组织中只展示在部门、网格下不存在的人员
//2021.8.23 sun 表述同上,屏蔽此处程序,组织下的人不做去重处理 start
/*//5.0:先把在部门或网格下存在的人员在组织中去掉,组织中只展示在部门、网格下不存在的人员
//部门
Iterator<StaffListResultDTO> itDept = agencyStaffList.iterator();
while (itDept.hasNext()) {
@ -280,7 +283,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
break;
}
}
}
}*/
//2021.8.23 sun 表述同上,屏蔽此处程序,组织下的人不做去重处理 end
//5.1装载组织下人员数据
agencyStaffList.forEach(sf->{
//人员信息
@ -357,6 +361,9 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
DepartmentStaffListResultDTO resultDTO = new DepartmentStaffListResultDTO();
List<ProjectStaffDTO> projectStaffList = canTick.getProjectStaffList();
//1:根据组织Id查询该组织下工作人员列表(去除组织下已经在项目节点上的人员)
/*2021.8.23 sun 应产品要求工作人员可以在组织部门网格下新增对于部门网格下添加的人在选人时不在组织层级展示
对于在组织添加的人即使有加入部门网格也要在选人的组织层级上展示组织添加的人不在做去重处理
程序的调整是查询组织下人员时只查询在组织层级添加的同时下边程序对部门网格有的人要在组织去重的程序做屏蔽处理*/
List<StaffListResultDTO> agencyAllStaffList = customerStaffAgencyDao.selectAgencyStaffList(canTick.getAgencyId());
List<StaffListResultDTO> agencyStaffList = new ArrayList<>();
//1.1:去除组织下已在项目节点上的人员
@ -451,8 +458,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
//5:循环数据,将人员数据放到对应数据结构下
List<StaffListResultDTO> staffList = dto.getStaffList();
List<CustomerStaffRoleResultDTO> roleList = dto.getRoleList();
//有时间再优化成jdk8的遍历方式
//5.0:先把在部门或网格下存在的人员在组织中去掉,组织中只展示在部门、网格下不存在的人员
//2021.8.23 sun 表述同上,屏蔽此处程序,组织下的人不做去重处理 start
/*//5.0:先把在部门或网格下存在的人员在组织中去掉,组织中只展示在部门、网格下不存在的人员
//部门
Iterator<StaffListResultDTO> itDept = agencyStaffList.iterator();
while (itDept.hasNext()) {
@ -474,7 +481,8 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
break;
}
}
}
}*/
//2021.8.23 sun 表述同上,屏蔽此处程序,组织下的人不做去重处理 end
//5.1装载组织下人员数据
agencyStaffList.forEach(sf->{
//人员信息

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

@ -26,6 +26,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -364,6 +365,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
? 0 : (authResult.getData().getTotalUser() - 1));
update(grid);
//2021.8.24 sun 网格移除工作人员时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(staffInfoFormDTO.getCustomerId(), staffInfoFormDTO.getStaffId());
return new Result();
}
@ -426,6 +429,10 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
validStaffIds.size() : authResult.getData().getTotalUser() + validStaffIds.size()
);
update(grid2Update);
//2021.8.24 sun 网格添加工作人员时删除工作人员的缓存信息
validStaffIds.forEach(staffId -> {
CustomerStaffRedis.delStaffInfoFormCache(staffListFormDTO.getCustomerId(), staffId);
});
return new Result();
}

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

@ -21,6 +21,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -233,6 +234,8 @@ public class DepartmentServiceImpl implements DepartmentService {
customerStaffDepartmentEntity.setCustomerId(customerIdDTO.getCustomerId());
customerStaffDepartmentEntity.setUserId(userId);
customerStaffDepartmentDao.insert(customerStaffDepartmentEntity);
//2021.8.24 sun 部门添加工作人员时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(addDepartmentStaffFormDTO.getCustomerId(), userId);
}
customerStaffDepartmentDao.updateDepartmentStaffCount(addDepartmentStaffFormDTO.getSelectedList().size(),addDepartmentStaffFormDTO.getDepartmentId());
return new Result();
@ -266,6 +269,9 @@ public class DepartmentServiceImpl implements DepartmentService {
? 0 : dept.getTotalUser() - NumConstant.ONE);
dept2Update.setUpdatedBy(departmentStaffInfoFormDTO.getUserId());
customerDepartmentService.update(dept2Update);
//2021.8.24 sun 部门移除工作人员时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(departmentStaffInfoFormDTO.getCustomerId(), departmentStaffInfoFormDTO.getStaffId());
return new Result();
}
log.warn(ModuleConstant.DEPT_INFO_NOT_FOUND);

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/StaffOrgRelationServiceImpl.java

@ -17,10 +17,12 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.StaffOrgRelationDao;
@ -97,4 +99,21 @@ public class StaffOrgRelationServiceImpl extends BaseServiceImpl<StaffOrgRelatio
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* @param staffId
* @Description 获取工作人员注册组织关系
* @Param staffId
* @Return {@link StaffOrgRelationDTO}
* @Author zhaoqifeng
* @Date 2021/8/20 16:46
*/
@Override
public StaffOrgRelationDTO getByStaffId(String staffId) {
LambdaQueryWrapper<StaffOrgRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StaffOrgRelationEntity::getStaffId, staffId);
wrapper.eq(StaffOrgRelationEntity::getDelFlag, NumConstant.ZERO_STR);
return ConvertUtils.sourceToTarget(baseDao.selectOne(wrapper), StaffOrgRelationDTO.class);
}
}

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

@ -1,14 +1,17 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.dao.CustomerAgencyDao;
import com.epmet.dao.CustomerStaffAgencyDao;
import com.epmet.dto.*;
@ -24,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@ -68,6 +72,8 @@ public class StaffServiceImpl implements StaffService {
private CustomerStaffGridService customerStaffGridService;
@Autowired
private StaffOrgRelationService staffOrgRelationService;
@Resource
private CustomerStaffRedis customerStaffRedis;
@Override
public Result<StaffsInAgencyResultDTO> getStaffInfoForHome(StaffsInAgencyFromDTO fromDTO) {
@ -169,6 +175,8 @@ public class StaffServiceImpl implements StaffService {
}
return new Result().error(EpmetErrorCode.STAFF_EDIT_FAILED.getCode(), EpmetErrorCode.STAFF_EDIT_FAILED.getMsg());
}
//2021.8.24 sun 人员信息编辑时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(fromDTO.getCustomerId(), fromDTO.getStaffId());
return result;
}
@ -243,6 +251,7 @@ public class StaffServiceImpl implements StaffService {
if (null != actInfoResult.getData() && actInfoResult.getData().size() > NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.EXIT_PUBLISHED_ACTIVITY.getCode());
}
//4.修改人员所属组织
CustomerStaffAgencyDTO staffAgency = new CustomerStaffAgencyDTO();
staffAgency.setId(staffAgencyDTO.getId());
@ -283,6 +292,143 @@ public class StaffServiceImpl implements StaffService {
//2021.6.7 添加逻辑-人员调动删除token sun end
}
/**
* 工作人员调动
*
* @param tokenDto
* @param fromDTO
* @return void
* @author zhaoqifeng
* @date 2020/8/27 16:13
*/
@Override
public void staffTransferV2(TokenDto tokenDto, StaffTransferV2FormDTO fromDTO) {
if (tokenDto.getUserId().equals(fromDTO.getStaffId())) {
throw new RenException(EpmetErrorCode.CAN_NOT_SELF.getCode());
}
//1.获取工作人员与机关关系
CustomerStaffAgencyDTO staffAgencyDTO = customerStaffAgencyService.getInfoByUserId(fromDTO.getStaffId());
String oldAgency = staffAgencyDTO.getAgencyId();
//2.查询是否有未处理项目
ProjectListFromDTO projectFromDTO = new ProjectListFromDTO();
projectFromDTO.setCustomerId(staffAgencyDTO.getCustomerId());
projectFromDTO.setUserId(fromDTO.getStaffId());
projectFromDTO.setPageNo(1);
projectFromDTO.setPageSize(10);
Result<List<PendProjectListResultDTO>> pendResult = govProjectOpenFeignClient.getPendProjectList(projectFromDTO);
if (!pendResult.success()) {
throw new RenException(pendResult.getCode(), pendResult.getMsg());
}
if (null != pendResult.getData() && pendResult.getData().size() > NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.EXIT_PEND_PROJECT.getCode());
}
//3.查询是否有活动未结束
Result<List<ActInfoDTO>> actInfoResult = epmetHeartOpenFeignClient.getPublishedAct(fromDTO.getStaffId());
if (!actInfoResult.success()) {
throw new RenException(actInfoResult.getCode(), actInfoResult.getMsg());
}
if (null != actInfoResult.getData() && actInfoResult.getData().size() > NumConstant.ZERO) {
throw new RenException(EpmetErrorCode.EXIT_PUBLISHED_ACTIVITY.getCode());
}
//4.修改人员所属组织
String agencyId = null;
String orgType = null;
String orgId = null;
if (OrgInfoConstant.AGENCY.equals(fromDTO.getOrgType())) {
agencyId = fromDTO.getOrgId();
} else if (OrgInfoConstant.DEPT.equals(fromDTO.getOrgType())) {
orgType = fromDTO.getOrgType();
orgId = fromDTO.getOrgId();
CustomerDepartmentDTO departmentDTO = customerDepartmentService.get(orgId);
agencyId = departmentDTO.getAgencyId();
} else {
orgType = fromDTO.getOrgType();
orgId = fromDTO.getOrgId();
CustomerGridDTO gridDTO = customerGridService.get(orgId);
agencyId = gridDTO.getPid();
}
CustomerStaffAgencyDTO staffAgency = new CustomerStaffAgencyDTO();
staffAgency.setId(staffAgencyDTO.getId());
staffAgency.setAgencyId(agencyId);
customerStaffAgencyService.update(staffAgency);
//原来组织总人数减一
CustomerAgencyDTO oldAgencyDTO = customerAgencyService.get(oldAgency);
oldAgencyDTO.setTotalUser(oldAgencyDTO.getTotalUser() - NumConstant.ONE);
customerAgencyService.update(oldAgencyDTO);
//新组织总人数加一
CustomerAgencyDTO newAgencyDTO = customerAgencyService.get(agencyId);
newAgencyDTO.setTotalUser(newAgencyDTO.getTotalUser() + NumConstant.ONE);
customerAgencyService.update(newAgencyDTO);
//逻辑删除工作人员原组织加入的部门、网格,部门、网格总人数减1
customerDepartmentService.updateDepartment(fromDTO.getStaffId());
customerGridService.updateGrid(fromDTO.getStaffId());
if (OrgInfoConstant.DEPT.equals(orgType)) {
//添加新的部门关系
CustomerStaffDepartmentDTO staffDepartmentDTO = new CustomerStaffDepartmentDTO();
staffDepartmentDTO.setCustomerId(tokenDto.getCustomerId());
staffDepartmentDTO.setDepartmentId(orgId);
staffDepartmentDTO.setUserId(fromDTO.getStaffId());
customerStaffDepartmentService.save(staffDepartmentDTO);
//新部门总人数+1
CustomerDepartmentDTO departmentDTO = customerDepartmentService.get(orgId);
departmentDTO.setTotalUser(departmentDTO.getTotalUser() + NumConstant.ONE);
departmentDTO.setUpdatedBy(null);
departmentDTO.setUpdatedTime(null);
customerDepartmentService.update(departmentDTO);
}
if (OrgInfoConstant.GRID.equals(orgType)) {
//添加新的网格关系
CustomerStaffGridDTO staffGridDTO = new CustomerStaffGridDTO();
staffGridDTO.setCustomerId(tokenDto.getCustomerId());
staffGridDTO.setGridId(orgId);
staffGridDTO.setUserId(fromDTO.getStaffId());
customerStaffGridService.save(staffGridDTO);
//新网格总人数+1
CustomerGridDTO gridDTO = customerGridService.get(orgId);
gridDTO.setTotalUser(gridDTO.getTotalUser() + NumConstant.ONE);
gridDTO.setUpdatedBy(null);
gridDTO.setUpdatedTime(null);
customerGridService.update(gridDTO);
}
//6.更改工作人员组织角色
StaffRoleDTO staffRoleDTO = new StaffRoleDTO();
staffRoleDTO.setOrgId(agencyId);
staffRoleDTO.setStaffId(fromDTO.getStaffId());
Result result = epmetUserOpenFeignClient.changeRoleOrg(staffRoleDTO);
if (!result.success()) {
throw new RenException(result.getCode(), result.getMsg());
}
//7.操作记录表新增调动记录
//获取工作人员注册组织关系
StaffOrgRelationDTO staffOrgRelation = staffOrgRelationService.getByStaffId(fromDTO.getStaffId());
StaffTransferRecordDTO staffTransferRecordDTO = new StaffTransferRecordDTO();
staffTransferRecordDTO.setCustomerId(tokenDto.getCustomerId());
staffTransferRecordDTO.setOperateStaffId(tokenDto.getUserId());
staffTransferRecordDTO.setOperatedStaffId(fromDTO.getStaffId());
staffTransferRecordDTO.setOldAgencyId(oldAgency);
if (!OrgInfoConstant.AGENCY.equals(staffOrgRelation.getOrgType())) {
staffTransferRecordDTO.setOldOrgType(staffOrgRelation.getOrgType());
staffTransferRecordDTO.setOldOrgId(staffOrgRelation.getOrgId());
}
staffTransferRecordDTO.setAgencyId(agencyId);
staffTransferRecordDTO.setOrgType(orgType);
staffTransferRecordDTO.setOrgId(orgId);
staffTransferRecordDTO.setRemarks(fromDTO.getRemarks());
staffTransferRecordService.save(staffTransferRecordDTO);
//8.更改注册关系
staffOrgRelation.setOrgId(fromDTO.getOrgId());
staffOrgRelation.setOrgType(fromDTO.getOrgType());
staffOrgRelation.setUpdatedBy(null);
staffOrgRelation.setUpdatedTime(null);
staffOrgRelationService.update(staffOrgRelation);
//9..清除可能存在的工作人员登陆token
String key = RedisKeys.getCpUserKey("gov", "wxmp", fromDTO.getStaffId());
redisUtils.delete(key);
//10 清除工作人员缓存
customerStaffRedis.delStaffInfoFormCache(tokenDto.getCustomerId(), fromDTO.getStaffId());
}
/**
* 根据staffId查询用户基本信息
* @author sun

2
epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.6__add_staff_org_relation.sql

@ -12,7 +12,7 @@ CREATE TABLE `staff_org_relation` (
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`) USING BTREE,
KEY `staffid` (`STAFF_ID`) USING BTREE
UNIQUE KEY `unq_staff_id` (`STAFF_ID`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='工作人员注册组织关系表';
INSERT INTO staff_org_relation SELECT

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

@ -96,13 +96,17 @@
</select>
<select id="selectAgencyStaffList" resultType="com.epmet.dto.result.StaffListResultDTO">
<!-- 2021.8.23 sun 需求调整,工作人员可以分别在组织、部门、网格下添加,这里改成只查询从组织下添加的人员 -->
SELECT
user_id AS "staffId"
csa.user_id AS "staffId"
FROM
customer_staff_agency
customer_staff_agency csa
LEFT JOIN staff_org_relation sor ON csa.user_id = sor.staff_id
WHERE
del_flag = '0'
AND agency_id =#{agencyId}
csa.del_flag = '0'
AND sor.del_flag = '0'
AND sor.org_type = 'agency'
AND csa.agency_id = #{agencyId}
</select>
<select id="selectByStaffId" resultType="com.epmet.dto.CustomerStaffAgencyDTO">

9
epmet-module/resi-home/resi-home-server/src/main/java/com/epmet/service/impl/ResiEventServiceImpl.java

@ -13,6 +13,7 @@ import com.epmet.enums.OrgLevelEnums;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ResiEventService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -44,11 +45,18 @@ public class ResiEventServiceImpl implements ResiEventService, ResultDataResolve
//String parentAgencyId = gridInfoData.getParentAgencyId();
//String pids = gridInfoData.getPids();
List<ResiEventNpcResultDTO> npcResultList = new ArrayList<>();
//查询人大代表列表
ListUserByBadgeFormDTO npcForm = new ListUserByBadgeFormDTO(customerId, BadgeConstant.BADGE_KEY_NPC);
Result<List<ListUserByBadgeResultDTO>> npcResult = epmetUserOpenFeignClient.listUsersByBadge(npcForm);
List<ListUserByBadgeResultDTO> npcData = getResultDataOrThrowsException(npcResult, ServiceConstant.EPMET_USER_SERVER, null, null);
if(CollectionUtils.isEmpty(npcData)) {
// 没有人大代表,直接返回空列表即可
return npcResultList;
}
//批量查询人大代表所在的网格信息
List<String> npcGridIds = npcData.stream().map(d -> d.getGridId()).collect(Collectors.toList());
OrgInfoFormDTO form = new OrgInfoFormDTO(OrgInfoConstant.GRID, npcGridIds);
@ -57,7 +65,6 @@ public class ResiEventServiceImpl implements ResiEventService, ResultDataResolve
Map<String, OrgInfoResultDTO> npcGridInfoMap = convertNpcGridInfos2Map(npcGridInfos);
List<ResiEventNpcResultDTO> npcResultList = new ArrayList<>();
npcData.stream().forEach(npc -> {
if (StringUtils.isBlank(excludeUserId) || !npc.getUserId().equals(excludeUserId)) {
OrgInfoResultDTO gridInfo = npcGridInfoMap.get(npc.getGridId());

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/PartyMemberConfirmController.java

@ -1,5 +1,6 @@
package com.epmet.modules.partymember.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.partymember.service.PartyMemberConfirmService;
import com.epmet.resi.mine.dto.from.PartyMemberInitFromDTO;
@ -65,6 +66,7 @@ public class PartyMemberConfirmController {
* @date 2020/3/31 10:50
*/
@PostMapping("submit")
@NoRepeatSubmit
public Result submit(@RequestBody PartymemberInfoDTO partyMemberInfoDTO) {
return partyMemberConfirmService.submit(partyMemberInfoDTO);
}

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

@ -446,6 +446,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
staffEntity.setId(customerStaffEntity.getId());
staffEntity.setEnableFlag(CustomerStaffConstant.DISABLED);
baseDao.updateById(staffEntity);
//2021.8.24 sun 人员禁用时删除工作人员的缓存信息
CustomerStaffRedis.delStaffInfoFormCache(fromDTO.getCustomerId(), fromDTO.getStaffId());
return new Result();
}

Loading…
Cancel
Save