|
|
@ -172,6 +172,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserDao, SysUserEntit |
|
|
|
if (entity.getUserTagKey().equals("offers")) { |
|
|
|
//插入customer_staff
|
|
|
|
CustomerStaffEntity customerStaffEntity = ConvertUtils.sourceToTarget(entity, CustomerStaffEntity.class); |
|
|
|
customerStaffEntity.setId(entity.getId().toString()); |
|
|
|
customerStaffEntity.setCustomerId(sysDictEntity.getDictValue()); |
|
|
|
customerStaffEntity.setUserId(userEntity.getId()); |
|
|
|
customerStaffEntity.setHeadPhoto(entity.getHeadUrl()); |
|
|
@ -256,30 +257,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())) { |
|
|
|