Browse Source

用户管理修改bug

feature/dangjian
mkh 4 years ago
parent
commit
89d4c761d1
  1. 71
      esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java

71
esua-epdc/epdc-admin/epdc-admin-server/src/main/java/com/elink/esua/epdc/service/impl/SysUserServiceImpl.java

@ -256,30 +256,65 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit
QueryWrapper<CustomerStaffEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<CustomerStaffEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("USER_ID", dto.getId().toString()); queryWrapper.eq("USER_ID", dto.getId().toString());
CustomerStaffEntity customerStaffEntity = customerStaffDao.selectOne(queryWrapper); CustomerStaffEntity customerStaffEntity = customerStaffDao.selectOne(queryWrapper);
customerStaffEntity.setRealName(dto.getRealName()); if (customerStaffEntity == null) {
customerStaffEntity.setGender(dto.getGender()); CustomerStaffEntity staffEntity = ConvertUtils.sourceToTarget(entity, CustomerStaffEntity.class);
customerStaffEntity.setEmail(dto.getEmail()); staffEntity.setId(entity.getId().toString());
customerStaffEntity.setMobile(dto.getMobile()); staffEntity.setCustomerId(sysDictEntity.getDictValue());
if (StringUtils.isNotEmpty(dto.getPassword())) { staffEntity.setUserId(entity.getId().toString());
customerStaffEntity.setPassword(PasswordUtils.encode(dto.getPassword())); staffEntity.setHeadPhoto(entity.getHeadUrl());
staffEntity.setWorkType("fulltime");
staffEntity.setActiveFlag("active");
staffEntity.setActiveTime(new Date());
staffEntity.setEnableFlag("enable");
if(StringUtils.isEmpty(entity.getPassword())){
staffEntity.setPassword(PasswordUtils.encode(sysUserEntity.getPassword()));
}else {
staffEntity.setPassword(PasswordUtils.encode(entity.getPassword()));
}
customerStaffDao.insert(staffEntity);
} else {
customerStaffEntity.setRealName(dto.getRealName());
customerStaffEntity.setGender(dto.getGender());
customerStaffEntity.setEmail(dto.getEmail());
customerStaffEntity.setMobile(dto.getMobile());
if (StringUtils.isNotEmpty(dto.getPassword())) {
customerStaffEntity.setPassword(PasswordUtils.encode(dto.getPassword()));
}
customerStaffEntity.setHeadPhoto(dto.getHeadUrl());
customerStaffDao.updateById(customerStaffEntity);
} }
customerStaffEntity.setHeadPhoto(dto.getHeadUrl());
customerStaffDao.updateById(customerStaffEntity);
//同步更新staff_org_relation //同步更新staff_org_relation
QueryWrapper<StaffOrgRelationEntity> wrapper = new QueryWrapper<>(); QueryWrapper<StaffOrgRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq("STAFF_ID",dto.getId().toString()); wrapper.eq("STAFF_ID", dto.getId().toString());
StaffOrgRelationEntity staffOrgRelationEntity = staffOrgRelationDao.selectOne(wrapper); StaffOrgRelationEntity staffOrgRelationEntity = staffOrgRelationDao.selectOne(wrapper);
String typeKey = deptEntity.getTypeKey(); String typeKey = deptEntity.getTypeKey();
staffOrgRelationEntity.setPids(StringUtils.join(StringUtils.split(deptEntity.getPids(), ","), ":")); if(staffOrgRelationEntity==null){
staffOrgRelationEntity.setOrgId(deptEntity.getId().toString()); StaffOrgRelationEntity orgRelationEntity = new StaffOrgRelationEntity();
if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(typeKey)) { orgRelationEntity.setId(entity.getId().toString());
staffOrgRelationEntity.setOrgType("grid"); orgRelationEntity.setCustomerId(sysDictEntity.getDictValue());
} else if (OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT.equals(typeKey) || OrganizationTypeConstant.ORG_TYPE_STREET_DEPT.equals(typeKey)) { orgRelationEntity.setStaffId(entity.getId().toString());
staffOrgRelationEntity.setOrgType("dept"); orgRelationEntity.setPids(StringUtils.join(StringUtils.split(deptEntity.getPids(), ","), ":"));
} else { orgRelationEntity.setOrgId(deptEntity.getId().toString());
staffOrgRelationEntity.setOrgType("agency"); if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(typeKey)) {
orgRelationEntity.setOrgType("grid");
} else if (OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT.equals(typeKey) || OrganizationTypeConstant.ORG_TYPE_STREET_DEPT.equals(typeKey)) {
orgRelationEntity.setOrgType("dept");
} else {
orgRelationEntity.setOrgType("agency");
}
staffOrgRelationDao.insert(orgRelationEntity);
}else {
staffOrgRelationEntity.setPids(StringUtils.join(StringUtils.split(deptEntity.getPids(), ","), ":"));
staffOrgRelationEntity.setOrgId(deptEntity.getId().toString());
if (OrganizationTypeConstant.ORG_TYPE_GRID_PARTY.equals(typeKey)) {
staffOrgRelationEntity.setOrgType("grid");
} else if (OrganizationTypeConstant.ORG_TYPE_DISTRICT_DEPT.equals(typeKey) || OrganizationTypeConstant.ORG_TYPE_STREET_DEPT.equals(typeKey)) {
staffOrgRelationEntity.setOrgType("dept");
} else {
staffOrgRelationEntity.setOrgType("agency");
}
staffOrgRelationDao.updateById(staffOrgRelationEntity);
} }
staffOrgRelationDao.updateById(staffOrgRelationEntity);
} }
if (!sysUserEntity.getDeptId().equals(entity.getDeptId())) { if (!sysUserEntity.getDeptId().equals(entity.getDeptId())) {

Loading…
Cancel
Save