Browse Source

Merge remote-tracking branch 'origin/dev_five_coverage' into dev_five_coverage

master
yinzuomei 3 years ago
parent
commit
9a5a9273dd
  1. 15
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcCommunitySelfOrganizationDTO.java
  2. 15
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java
  3. 5
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java
  4. 6
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java
  5. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
  6. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java
  7. 15
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyUnitEntity.java
  8. 7
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
  9. 30
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  10. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AddDepartmentFormDTO.java
  11. 37
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/CheckStaffInfoFormDTO.java
  12. 6
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java
  13. 37
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/CheckStaffInfoResultDTO.java
  14. 17
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/DepartmentController.java
  15. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/DepartmentService.java
  16. 150
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/DepartmentServiceImpl.java
  17. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  18. 10
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  19. 12
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/CustomerStaffController.java
  20. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java
  21. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/CustomerStaffService.java
  22. 30
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java
  23. 11
      epmet-user/epmet-user-server/src/main/resources/mapper/CustomerStaffDao.xml

15
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcCommunitySelfOrganizationDTO.java

@ -104,6 +104,21 @@ public class IcCommunitySelfOrganizationDTO implements Serializable {
*/
private String latitude;
/**
* 同步状态已同步:sync 未同步:not_sync
*/
private String syncType;
/**
* 部门ID customer_department.id
*/
private String deptId;
/**
* 部门下工作人员Id
*/
private String deptStaffId;
/**
*
*/

15
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/IcPartyUnitDTO.java

@ -134,6 +134,21 @@ public class IcPartyUnitDTO implements Serializable {
*/
private String remark;
/**
* 同步状态已同步:sync 未同步:not_sync
*/
private String syncType;
/**
* 部门ID customer_department.id
*/
private String deptId;
/**
* 部门下工作人员Id
*/
private String deptStaffId;
/**
* 删除标识 0未删除1已删除
*/

5
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java

@ -16,6 +16,7 @@ import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.CheckStaffInfoResultDTO;
import com.epmet.dto.result.PartyUnitListResultDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.resi.PageVolunteerInfoResultDTO;
@ -166,4 +167,8 @@ public interface EpmetHeartOpenFeignClient {
*/
@PostMapping("/heart/policy/rules4ResiListAndExport/{ruleId}")
Result<ResisByPolicyRulesFormDTO.RuleList> listPolicyRules4QueryAndExport(@PathVariable("ruleId") String ruleId);
@PostMapping("/heart/icpartyunit/editpartyorcommunity")
Result editPartyOrCommunity(@RequestBody CheckStaffInfoResultDTO formDTO);
}

6
epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java

@ -18,6 +18,7 @@ import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.form.resi.ResisByPolicyRulesFormDTO;
import com.epmet.dto.form.resi.VolunteerCommonFormDTO;
import com.epmet.dto.result.CheckStaffInfoResultDTO;
import com.epmet.dto.result.PartyUnitListResultDTO;
import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO;
@ -166,4 +167,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli
public Result<ResisByPolicyRulesFormDTO.RuleList> listPolicyRules4QueryAndExport(String ruleId) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "listPolicyRules4QueryAndExport", ruleId);
}
@Override
public Result editPartyOrCommunity(CheckStaffInfoResultDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "editPartyOrCommunity", formDTO);
}
}

16
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java

@ -22,11 +22,7 @@ import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.excel.IcPartyUnitExcel;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -312,4 +308,14 @@ public class IcPartyUnitController {
return new Result<List<PartyUnitListResultDTO>>().ok(icPartyUnitService.getAssistanceUnitList(tokenDto));
}
/**
* Desc: 联建单位社会自组织同步/取消同步到通讯录部门后相应的修改业务数据
* @author sun
*/
@PostMapping("editpartyorcommunity")
public Result editPartyOrCommunity(@RequestBody CheckStaffInfoResultDTO formDTO){
icPartyUnitService.editPartyOrCommunity(formDTO);
return new Result();
}
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcCommunitySelfOrganizationEntity.java

@ -117,4 +117,19 @@ public class IcCommunitySelfOrganizationEntity extends BaseEpmetEntity {
*/
private String remark;
/**
* 同步状态已同步:sync 未同步:not_sync
*/
private String syncType;
/**
* 部门ID customer_department.id
*/
private String deptId;
/**
* 部门下工作人员Id
*/
private String deptStaffId;
}

15
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/IcPartyUnitEntity.java

@ -105,4 +105,19 @@ public class IcPartyUnitEntity extends BaseEpmetEntity {
*/
private String remark;
/**
* 同步状态已同步:sync 未同步:not_sync
*/
private String syncType;
/**
* 部门ID customer_department.id
*/
private String deptId;
/**
* 部门下工作人员Id
*/
private String deptStaffId;
}

7
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java

@ -12,10 +12,7 @@ import com.epmet.dto.form.PartyUnitFormDTO;
import com.epmet.dto.form.PartyUnitListFormDTO;
import com.epmet.dto.form.PartyUnitListbriefFormDTO;
import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.PartyTypepercentResultDTO;
import com.epmet.dto.result.PartyUnitDistributionResultDTO;
import com.epmet.dto.result.PartyUnitListResultDTO;
import com.epmet.dto.result.PartyUnitListbrieResultDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcPartyUnitEntity;
import org.springframework.web.multipart.MultipartFile;
@ -182,4 +179,6 @@ public interface IcPartyUnitService extends BaseService<IcPartyUnitEntity> {
* @param form
*/
List<PartyTypepercentResultDTO> getTypepercent(PartyTypepercentFormDTO form);
void editPartyOrCommunity(CheckStaffInfoResultDTO formDTO);
}

30
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java

@ -55,6 +55,7 @@ import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.demand.ServiceStatDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity;
import com.epmet.entity.IcPartyUnitEntity;
import com.epmet.excel.IcPartyUnitImportExcel;
import com.epmet.excel.IcPartyUnitImportFailedExcel;
@ -62,6 +63,7 @@ import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.EpmetHeartOpenFeignClient;
import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcCommunitySelfOrganizationService;
import com.epmet.service.IcPartyUnitService;
import com.epmet.service.IcServiceItemDictService;
import com.epmet.service.IcUserDemandRecService;
@ -111,6 +113,8 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient;
@Resource
private EpmetHeartOpenFeignClient heartOpenFeignClient;
@Resource
private IcCommunitySelfOrganizationService icCommunitySelfOrganizationService;
@Override
public PageData<IcPartyUnitDTO> search(PartyUnitFormDTO formDTO) {
@ -711,4 +715,30 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl<IcPartyUnitDao, IcPa
return StringUtils.join(list, StrConstant.COMMA);
}
@Override
public void editPartyOrCommunity(CheckStaffInfoResultDTO formDTO) {
//联建单位
if("party_unit".equals(formDTO.getDeptType())){
IcPartyUnitEntity partyUnitEntity = new IcPartyUnitEntity();
partyUnitEntity.setId(formDTO.getId());
partyUnitEntity.setSyncType(formDTO.getSyncType());
partyUnitEntity.setDeptId(formDTO.getDeptId());
partyUnitEntity.setDeptStaffId(formDTO.getDeptStaffId());
partyUnitEntity.setUpdatedBy(formDTO.getUserId());
partyUnitEntity.setUpdatedTime(new Date());
updateById(partyUnitEntity);
}
//社会自组织
if("community_org".equals(formDTO.getDeptType())){
IcCommunitySelfOrganizationEntity communityEntity = new IcCommunitySelfOrganizationEntity();
communityEntity.setId(formDTO.getId());
communityEntity.setSyncType(formDTO.getSyncType());
communityEntity.setDeptId(formDTO.getDeptId());
communityEntity.setDeptStaffId(formDTO.getDeptStaffId());
communityEntity.setUpdatedBy(formDTO.getUserId());
communityEntity.setUpdatedTime(new Date());
icCommunitySelfOrganizationService.updateById(communityEntity);
}
}
}

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

@ -67,5 +67,10 @@ public class AddDepartmentFormDTO implements Serializable {
*/
private String mobile;
/**
* 总人数
*/
private Integer totalUser;
}

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

@ -28,22 +28,47 @@ import java.io.Serializable;
public class CheckStaffInfoFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
public interface Check extends CustomerClientShowGroup {}
public interface CheckAdd extends CustomerClientShowGroup {}
public interface CheckEdit extends CustomerClientShowGroup {}
/**
* 联建单位社会自组织Id
*/
@NotBlank(message = "id不能为空", groups = CheckAdd.class)
private String id;
/**
* 部门名称
*/
@NotBlank(message = "部门名称不能为空", groups = CheckAdd.class)
private String deptName;
/**
* 手机号
*/
@NotBlank(message = "手机号不能为空", groups = Check.class)
@NotBlank(message = "手机号不能为空", groups = CheckAdd.class)
private String mobile;
/**
* 人名姓名
*/
@NotBlank(message = "姓名不能为空", groups = Check.class)
@NotBlank(message = "姓名不能为空", groups = CheckAdd.class)
private String personName;
/**
* 联建单位: party_unit
* 社会自组织: community_org
*/
@NotBlank(message = "部门类型不能为空", groups = CheckAdd.class)
private String deptType;
/**
* 部门Id [取消同步时必填]
*/
@NotBlank(message = "部门类型不能为空", groups = CheckEdit.class)
private String deptId;
/**
* 部门下工作人员Id
*/
private String deptStaffId;
//token中信息
private String customerId;
private String staffId;
private String userId;
}

6
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/StaffSubmitFromDTO.java

@ -68,4 +68,10 @@ public class StaffSubmitFromDTO implements Serializable {
private String client;
private List<String> newRoles;
/**
* 部门类型
* 联建单位: party_unit
* 社会自组织: community_org
*/
private String deptType;
}

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

@ -17,8 +17,10 @@
package com.epmet.dto.result;
import com.epmet.dto.form.CheckStaffInfoFormDTO;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@ -41,10 +43,41 @@ public class CheckStaffInfoResultDTO implements Serializable {
* 数据库中工作人员姓名返参姓名有值的则需要更新工作人员信息
*/
private String personName;
/**
* 联建单位社会自组织Id
*/
private String id;
/**
* 部门Id
*/
private String deptId;
/**
* 联建单位: party_unit
* 社会自组织: community_org
*/
private String deptType;
/**
* 部门下工作人员Id
*/
private String deptStaffId;
/**
* 已同步:sync 未同步:not_sync
*/
private String syncType;
//token中信息
private String customerId;
private String userId;
/**
* 类型后端使用
* 后端使用
*/
private Boolean key = true;
//工作人员添加入口Id(agencyId;deptId;gridId)
private String orgId = "";
//工作人员添加入口类型(组织:agency;部门:dept;网格:gridId)
private String orgType = "";
//工作人员Id,后端使用
private String staffId = "";
}

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

@ -162,16 +162,27 @@ public class DepartmentController {
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);
ValidatorUtils.validateEntity(formDTO, CheckStaffInfoFormDTO.CheckAdd.class);
formDTO.setCustomerId(tokenDTO.getCustomerId());
formDTO.setStaffId(tokenDTO.getUserId());
formDTO.setUserId(tokenDTO.getUserId());
return new Result<CheckStaffInfoResultDTO>().ok(departmentService.checkStaffInfo(formDTO));
}
/**
* @Author sun
* @Description 联建单位社会自组织同步到通讯录操作
*/
@PostMapping("addoreditdeptorstaff")
public Result<CheckStaffInfoResultDTO> addOrEditDeptOrStaff(@RequestBody CheckStaffInfoFormDTO formDTO) {
return new Result<CheckStaffInfoResultDTO>().ok(departmentService.addOrEditDeptOrStaff(formDTO));
}
}

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

@ -103,4 +103,6 @@ public interface DepartmentService {
List<DepartmentListResultDTO> listDepartmentListByStaffId(String staffId);
CheckStaffInfoResultDTO checkStaffInfo(CheckStaffInfoFormDTO formDTO);
CheckStaffInfoResultDTO addOrEditDeptOrStaff(CheckStaffInfoFormDTO formDTO);
}

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

@ -17,6 +17,7 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
@ -39,14 +40,11 @@ import com.epmet.dto.CustomerStaffDTO;
import com.epmet.dto.CustomerStaffDepartmentDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerAgencyEntity;
import com.epmet.entity.CustomerDepartmentEntity;
import com.epmet.entity.CustomerStaffDepartmentEntity;
import com.epmet.entity.*;
import com.epmet.feign.EpmetHeartOpenFeignClient;
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;
import com.epmet.service.*;
import com.epmet.util.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@ -55,6 +53,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.ArrayList;
import java.util.List;
@ -86,6 +85,15 @@ public class DepartmentServiceImpl implements DepartmentService {
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@Autowired
private StaffOrgRelationDao staffOrgRelationDao;
@Autowired
private CustomerStaffAgencyService customerStaffAgencyService;
@Autowired
private CustomerAgencyService customerAgencyService;
@Autowired
private StaffOrgRelationService staffOrgRelationService;
@Autowired
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
/**
* @param formDTO
* @return
@ -294,6 +302,13 @@ public class DepartmentServiceImpl implements DepartmentService {
@Override
public CheckStaffInfoResultDTO checkStaffInfo(CheckStaffInfoFormDTO formDTO) {
CheckStaffInfoResultDTO resultDTO = new CheckStaffInfoResultDTO();
resultDTO.setCustomerId(formDTO.getCustomerId());
resultDTO.setUserId(formDTO.getUserId());
//座机号的直接返回
if(formDTO.getMobile().startsWith("0")){
resultDTO.setMsg("座机账号无法创建账号,建议使用填写手机号,否则将无法获取通知信息");
return resultDTO;
}
//1.根据手机号查询客户下工作人员信息
CustomerStaffFormDTO user = new CustomerStaffFormDTO();
user.setCustomerId(formDTO.getCustomerId());
@ -314,29 +329,29 @@ public class DepartmentServiceImpl implements DepartmentService {
if (CollectionUtils.isEmpty(list)) {
return resultDTO;
}
resultDTO.setOrgId(list.get(0).getOrgId());
resultDTO.setOrgType(list.get(0).getOrgType());
resultDTO.setStaffId(list.get(0).getStaffId());
//3.校验工作人员的注册关系【从哪里新增进来的工作人员】
//获取当前操作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getStaffId()));
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//所属组织信息不同的给提示【所属组织不同时则不新增部门、不新增工作人员】
if (!list.get(0).getAgencyId().equals(staffInfo.getAgencyId())) {
resultDTO.setMsg("联系电话已存在其他组织工作账号中,请使用其他手机号,否则将无法获取通知信息");
resultDTO.setKey(false);
return resultDTO;
}
//从网格下添加的人给提示【网格下加的人时则不新增部门、不新增工作人员】
if ("gridId".equals(list.get(0).getOrgType())) {
if (!"agency".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;
}
//姓名不一样的给反馈
@ -348,5 +363,116 @@ public class DepartmentServiceImpl implements DepartmentService {
return resultDTO;
}
@Override
public CheckStaffInfoResultDTO addOrEditDeptOrStaff(CheckStaffInfoFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//1.校验当前数据是否允许操作
CheckStaffInfoResultDTO resultDTO = checkStaffInfo(formDTO);
if(!resultDTO.getType()){
return resultDTO;
}
//2.根据校验结果操作数据
//2-1.没查到人的直接新增部门、人员
if(StringUtils.isBlank(resultDTO.getOrgType())){
//一、新增工作人员
StaffSubmitFromDTO submitDTO = ConvertUtils.sourceToTarget(formDTO, StaffSubmitFromDTO.class);
submitDTO.setName(formDTO.getPersonName());
submitDTO.setAgencyId(staffInfo.getAgencyId());
submitDTO.setGender(0);
submitDTO.setWorkType("fulltime");
Result<CustomerStaffDTO> staffResult = epmetUserOpenFeignClient.deptToAddStaff(submitDTO);
if (!staffResult.success()) {
throw new RenException("人员添加失败" + staffResult.getMsg());
}
//二、新增部门
AddDepartmentFormDTO deptDTO = new AddDepartmentFormDTO();
deptDTO.setAgencyId(staffInfo.getAgencyId());
deptDTO.setDepartmentDuty("");
deptDTO.setDepartmentName(formDTO.getDeptName());
deptDTO.setTotalUser(1);
Result<AddDepartmentResultDTO> deptResult = addDepartment(deptDTO);
//三、新增组织人员关系数据
//人员机关关系表
CustomerStaffAgencyEntity customerStaffAgencyEntity = new CustomerStaffAgencyEntity();
customerStaffAgencyEntity.setCustomerId(formDTO.getCustomerId());
customerStaffAgencyEntity.setUserId(staffResult.getData().getUserId());
customerStaffAgencyEntity.setAgencyId(staffInfo.getAgencyId());
customerStaffAgencyService.insert(customerStaffAgencyEntity);
//机关总人数加一
OrgResultDTO orgDTO = customerAgencyDao.selectAgencyDetail(staffInfo.getAgencyId(), "agency");
CustomerAgencyEntity agencyEntity = new CustomerAgencyEntity();
agencyEntity.setId(staffInfo.getAgencyId());
agencyEntity.setTotalUser(orgDTO.getTotalUser() + 1);
customerAgencyService.updateById(agencyEntity);
//工作人员注册组织关系表新增数据
StaffOrgRelationEntity staffOrgRelationEntity = new StaffOrgRelationEntity();
staffOrgRelationEntity.setCustomerId(formDTO.getCustomerId());
staffOrgRelationEntity.setPids(("".equals(orgDTO.getPids()) ? "" : orgDTO.getPids()));
staffOrgRelationEntity.setStaffId(staffResult.getData().getUserId());
staffOrgRelationEntity.setOrgId(staffInfo.getAgencyId());
staffOrgRelationEntity.setOrgType("agency");
staffOrgRelationService.insert(staffOrgRelationEntity);
//四、部门下新增人员关系数据
CustomerStaffDepartmentEntity dept = new CustomerStaffDepartmentEntity();
dept.setCustomerId(formDTO.getCustomerId());
dept.setUserId(staffResult.getData().getUserId());
dept.setDepartmentId(deptResult.getData().getDepartmentId());
customerStaffDepartmentService.insert(dept);
//修改联建单位/社会自组织业务数据
resultDTO.setId(formDTO.getId());
resultDTO.setDeptId(deptResult.getData().getDepartmentId());
resultDTO.setDeptType(formDTO.getDeptType());
resultDTO.setDeptStaffId(staffResult.getData().getUserId());
resultDTO.setSyncType("sync");
Result heartResult = epmetHeartOpenFeignClient.editPartyOrCommunity(resultDTO);
if (!heartResult.success()) {
throw new RenException("修改联建单位/社会自组织业务数据失败" + heartResult.getMsg());
}
}
//2-2.查到是组织下的人,新增部门,绑定部门人员关系
if(("agency".equals(resultDTO.getOrgType()))){
//一、更新人员基础数据[姓名 手机号信息]
CustomerStaffDTO staffDTO = new CustomerStaffDTO();
staffDTO.setUserId(resultDTO.getStaffId());
staffDTO.setRealName(formDTO.getPersonName());
staffDTO.setMobile(formDTO.getMobile());
staffDTO.setUpdatedBy(resultDTO.getUserId());
Result result = epmetUserOpenFeignClient.editToStaff(staffDTO);
if (!result.success()) {
throw new RenException("更新工作人员基础信息失败" + result.getMsg());
}
//二、新增部门数据
AddDepartmentFormDTO deptDTO = new AddDepartmentFormDTO();
deptDTO.setAgencyId(staffInfo.getAgencyId());
deptDTO.setDepartmentDuty("");
deptDTO.setDepartmentName(formDTO.getDeptName());
deptDTO.setTotalUser(1);
Result<AddDepartmentResultDTO> deptResult = addDepartment(deptDTO);
//三、部门下新增人员关系数据
CustomerStaffDepartmentEntity dept = new CustomerStaffDepartmentEntity();
dept.setCustomerId(formDTO.getCustomerId());
dept.setUserId(resultDTO.getStaffId());
dept.setDepartmentId(deptResult.getData().getDepartmentId());
customerStaffDepartmentService.insert(dept);
//修改联建单位/社会自组织业务数据
resultDTO.setId(formDTO.getId());
resultDTO.setDeptId(deptResult.getData().getDepartmentId());
resultDTO.setDeptType(formDTO.getDeptType());
resultDTO.setDeptStaffId(resultDTO.getStaffId());
resultDTO.setSyncType("sync");
Result heartResult = epmetHeartOpenFeignClient.editPartyOrCommunity(resultDTO);
if (!heartResult.success()) {
throw new RenException("修改联建单位/社会自组织业务数据失败" + heartResult.getMsg());
}
}
return resultDTO;
}
}

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

@ -859,4 +859,10 @@ public interface EpmetUserOpenFeignClient {
@PostMapping("/epmetuser/customerstaff/staffdetailinfo")
Result<CustomerStaffDTO> staffDetailInfo(@RequestBody CustomerStaffFormDTO formDTO);
@PostMapping("/epmetuser/customerstaff/depttoaddstaff")
Result<CustomerStaffDTO> deptToAddStaff(@RequestBody StaffSubmitFromDTO fromDTO);
@PostMapping("/epmetuser/customerstaff/edittostaff")
Result editToStaff(@RequestBody CustomerStaffDTO formDTO);
}

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

@ -651,4 +651,14 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "staffDetailInfo", formDTO);
}
@Override
public Result<CustomerStaffDTO> deptToAddStaff(StaffSubmitFromDTO fromDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "deptToAddStaff", fromDTO);
}
@Override
public Result editToStaff(CustomerStaffDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "editToStaff", formDTO);
}
}

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

@ -498,5 +498,17 @@ public class CustomerStaffController {
return new Result<CustomerStaffDTO>().ok(customerStaffService.staffDetailInfo(formDTO));
}
@PostMapping("depttoaddstaff")
public Result<CustomerStaffDTO> dedittostaffeptToAddStaff(@RequestBody StaffSubmitFromDTO fromDTO){
Result<CustomerStaffDTO> result = customerStaffService.deptToAddStaff(fromDTO);
return result;
}
@PostMapping(value = "edittostaff")
public Result editToStaff(@RequestBody CustomerStaffDTO formDTO) {
customerStaffService.editToStaff(formDTO);
return new Result();
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/CustomerStaffDao.java

@ -229,4 +229,6 @@ public interface CustomerStaffDao extends BaseDao<CustomerStaffEntity> {
* @Description 工作人员基本信息
**/
List<GridMobileListResultDTO> gridStaffMobileList(List<String> staffIdList);
void edit(CustomerStaffDTO formDTO);
}

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

@ -349,4 +349,8 @@ public interface CustomerStaffService extends BaseService<CustomerStaffEntity> {
List<GridMobileListResultDTO> gridMobileList(String gridId, String userId);
CustomerStaffDTO staffDetailInfo(CustomerStaffFormDTO formDTO);
Result<CustomerStaffDTO> deptToAddStaff(StaffSubmitFromDTO fromDTO);
void editToStaff(CustomerStaffDTO formDTO);
}

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

@ -60,12 +60,14 @@ import com.epmet.service.UserService;
import com.epmet.util.ModuleConstant;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.*;
import java.util.stream.Collectors;
@ -874,4 +876,32 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl<CustomerStaffDao,
return baseDao.selectListCustomerStaffInfo(formDTO);
}
@Override
public Result<CustomerStaffDTO> deptToAddStaff(StaffSubmitFromDTO fromDTO) {
//1.查询客户小程序端'工作人员'角色
GovStaffRoleDTO govRole = govStaffRoleDao.getRoleByCustomerIdAndRoleKey(fromDTO.getCustomerId(), "staff");
List<String> roles = new ArrayList<>();
roles.add(govRole.getId());
fromDTO.setRoles(roles);
//2.查询客户管理平台对应角色【联建单位负责人、社区自组织负责人】
GovRoleListDTO roleDTO = new GovRoleListDTO();
roleDTO.setName("party_unit".equals(fromDTO.getDeptType())?"联建单位负责人":"社区自组织负责人");
Result<GovRoleDTO> resultRole = govAccessFeignClient.getGovRole(roleDTO);
if (!resultRole.success()) {
throw new RenException("人员添加失败" + resultRole.getMsg());
}
List<String> newRoles = new ArrayList<>();
newRoles.add(resultRole.getData().getId());
//3.新增工作人员
Result<CustomerStaffDTO> result = addStaff(fromDTO);
return result;
}
@Override
public void editToStaff(CustomerStaffDTO formDTO) {
baseDao.edit(formDTO);
}
}

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

@ -456,4 +456,15 @@
</select>
<select id="gridStaffMobileList" resultType="com.epmet.dto.result.GridMobileListResultDTO"></select>
<update id="edit">
UPDATE customer_staff
SET real_name = #{realName},
mobile = #{mobile},
updated_time = NOW(),
updated_by = #{updatedBy}
WHERE
del_flag = '0'
AND user_id = #{userId}
</update>
</mapper>

Loading…
Cancel
Save