客户修改和删除BUG修改
This commit is contained in:
+49
-10
@@ -2112,13 +2112,22 @@ public class UserApplicationService {
|
||||
}
|
||||
}
|
||||
UserEntity userEntity = userDomainService.updateUser(userDO);
|
||||
//同步网货平台员工信息
|
||||
wlhyDomainService.addOrEditPlatformUser(userEntity);
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
Integer ordIsQueue = userMapper.getOrdIsQueue(organizationId);
|
||||
if (userEntity.getUserAccount()!=null&&ordIsQueue==1){
|
||||
//同步yms员工信息
|
||||
ymsDomainService.addOrEditYmsUser(userEntity);
|
||||
// 客户/供应商为 WMS 客户管理用户,不同步网货/YMS 平台员工
|
||||
if (!isCustomerManagementPresetRole(userEntity.getRoleCode())) {
|
||||
try {
|
||||
wlhyDomainService.addOrEditPlatformUser(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步网货平台员工信息失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
Integer ordIsQueue = userMapper.getOrdIsQueue(organizationId);
|
||||
if (userEntity.getUserAccount() != null && ordIsQueue == 1) {
|
||||
try {
|
||||
ymsDomainService.addOrEditYmsUser(userEntity);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步YMS平台员工信息失败,但不影响用户保存: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties(userPo, userEntity);
|
||||
@@ -2275,6 +2284,7 @@ public class UserApplicationService {
|
||||
if (ObjectUtil.isNull(loginUser)) {
|
||||
throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||
}
|
||||
List<Long> wlhySyncIds = new ArrayList<>();
|
||||
for (Long userId : ids) {
|
||||
UserPo userPo = userDomainService.selectByUserId(userId);
|
||||
UserDO userDO = new UserDO();
|
||||
@@ -2288,11 +2298,17 @@ public class UserApplicationService {
|
||||
userDO.setDelFlag(2);
|
||||
userDO.setUpdateTime(new Date());
|
||||
userDomainService.updateUser(userDO);
|
||||
if (!isCustomerManagementPresetRole(userPo.getRoleCode())) {
|
||||
wlhySyncIds.add(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
//同步删除网货的员工信息(只有当ids不为空时才调用)
|
||||
if (!ids.isEmpty()) {
|
||||
wlhyDomainService.deleteBatchPlatformUser(ids);
|
||||
if (!wlhySyncIds.isEmpty()) {
|
||||
try {
|
||||
wlhyDomainService.deleteBatchPlatformUser(wlhySyncIds);
|
||||
} catch (Exception e) {
|
||||
log.warn("同步删除网货用户失败,但不影响本地删除: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
return ids.size();
|
||||
}
|
||||
@@ -5089,10 +5105,33 @@ public class UserApplicationService {
|
||||
if (customerDO.getUserId() == null){
|
||||
throw new ServiceException("用户id不能为空");
|
||||
}
|
||||
UserPo userPo = userDomainService.selectByUserId(customerDO.getUserId());
|
||||
if (ObjectUtil.isNull(userPo)) {
|
||||
throw new ServiceException("用户不存在");
|
||||
}
|
||||
UserDO userDO = new UserDO();
|
||||
BeanUtils.copyProperties(customerDO, userDO);
|
||||
userDO.setUserPhone(customerDO.getEmergencyContactPhone());
|
||||
userDO.setBusinessType(1);
|
||||
// CustomerDTO 修改场景通常不传 roleCode/组织/账号,须沿用库中值,避免同步 YMS/网货时角色为空触发 selectOne 返回多条
|
||||
if (StringUtils.isEmpty(userDO.getRoleCode())) {
|
||||
userDO.setRoleCode(userPo.getRoleCode());
|
||||
userDO.setRoleName(userPo.getRoleName());
|
||||
userDO.setRoleId(userPo.getRoleId());
|
||||
}
|
||||
if (userDO.getOrganizationId() == null) {
|
||||
userDO.setOrganizationId(userPo.getOrganizationId());
|
||||
userDO.setOrganizationName(userPo.getOrganizationName());
|
||||
}
|
||||
if (userDO.getTopOrganizationId() == null) {
|
||||
userDO.setTopOrganizationId(userPo.getTopOrganizationId());
|
||||
}
|
||||
if (StringUtils.isEmpty(userDO.getUserAccount())) {
|
||||
userDO.setUserAccount(userPo.getUserAccount());
|
||||
}
|
||||
if (StringUtils.isEmpty(userDO.getUserMemberCode())) {
|
||||
userDO.setUserMemberCode(userPo.getUserMemberCode());
|
||||
}
|
||||
updateUser(userDO);
|
||||
if (isWT()){
|
||||
//开启仓配一体 同步托运人信息
|
||||
|
||||
Reference in New Issue
Block a user