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.eq("USER_ID", dto.getId().toString());
CustomerStaffEntity customerStaffEntity = customerStaffDao.selectOne(queryWrapper);
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()));
if (customerStaffEntity == null) {
CustomerStaffEntity staffEntity = ConvertUtils.sourceToTarget(entity, CustomerStaffEntity.class);
staffEntity.setId(entity.getId().toString());
staffEntity.setCustomerId(sysDictEntity.getDictValue());
staffEntity.setUserId(entity.getId().toString());
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
QueryWrapper<StaffOrgRelationEntity> wrapper = new QueryWrapper<>();
wrapper.eq("STAFF_ID",dto.getId().toString());
wrapper.eq("STAFF_ID", dto.getId().toString());
StaffOrgRelationEntity staffOrgRelationEntity = staffOrgRelationDao.selectOne(wrapper);
String typeKey = deptEntity.getTypeKey();
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");
if(staffOrgRelationEntity==null){
StaffOrgRelationEntity orgRelationEntity = new StaffOrgRelationEntity();
orgRelationEntity.setId(entity.getId().toString());
orgRelationEntity.setCustomerId(sysDictEntity.getDictValue());
orgRelationEntity.setStaffId(entity.getId().toString());
orgRelationEntity.setPids(StringUtils.join(StringUtils.split(deptEntity.getPids(), ","), ":"));
orgRelationEntity.setOrgId(deptEntity.getId().toString());
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())) {

Loading…
Cancel
Save