完善用户履职记录功能
parent
0489ce49dd
commit
0e5bf12b9b
|
|
@ -27,7 +27,7 @@ import java.util.ArrayList;
|
|||
* @Author zhangyue
|
||||
* @Date 2025-11-06 19:15:37
|
||||
*/
|
||||
@Api(tags = "用户资质信息")
|
||||
@Api(tags = "用户履职记录")
|
||||
@RequestMapping("/${application.gateway}/userEmploymentLog")
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@ package com.zcloud.basic.info.command;
|
|||
import com.alibaba.cola.exception.BizException;
|
||||
import com.jjb.saas.framework.auth.model.SSOUser;
|
||||
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||
import com.jjb.saas.system.client.role.facade.RoleFacade;
|
||||
import com.jjb.saas.system.client.user.facade.UserFacade;
|
||||
import com.jjb.saas.system.client.user.request.FacadeUserAddCmd;
|
||||
import com.zcloud.basic.info.command.convertor.UserCoConvertor;
|
||||
import com.zcloud.basic.info.domain.gateway.CorpInfoGateway;
|
||||
import com.zcloud.basic.info.domain.gateway.UserEmploymentLogGateway;
|
||||
import com.zcloud.basic.info.domain.gateway.UserGateway;
|
||||
import com.zcloud.basic.info.domain.model.UserE;
|
||||
import com.zcloud.basic.info.domain.model.UserEmploymentLogE;
|
||||
import com.zcloud.basic.info.dto.UserAddCmd;
|
||||
import com.zcloud.basic.info.dto.UserXgfAddCmd;
|
||||
import com.zcloud.basic.info.persistence.dataobject.CorpInfoDO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.UserEmploymentLogDO;
|
||||
import com.zcloud.basic.info.persistence.repository.CorpInfoRepository;
|
||||
import com.zcloud.gbscommon.utils.Tools;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
|
|
@ -22,8 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -37,12 +36,13 @@ public class UserAddExe {
|
|||
private final UserGateway userGateway;
|
||||
private UserCoConvertor userCoConvertor;
|
||||
private final UserEmploymentLogGateway userEmploymentLogGateway;
|
||||
private final CorpInfoRepository corpInfoRepository;
|
||||
// @Autowired
|
||||
// private RedisTemplate<String, Object> redisTemplate;
|
||||
@DubboReference(check = false)
|
||||
private UserFacade userFacade;
|
||||
@DubboReference
|
||||
private RoleFacade roleFacade;
|
||||
// @DubboReference(check = false)
|
||||
// private UserFacade userFacade;
|
||||
// @DubboReference
|
||||
// private RoleFacade roleFacade;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(UserAddCmd cmd) {
|
||||
|
|
@ -51,17 +51,18 @@ public class UserAddExe {
|
|||
UserE userE = new UserE();
|
||||
BeanUtils.copyProperties(cmd, userE);
|
||||
userE.initAdd(tenantId, userE);
|
||||
CorpInfoDO corpInfoDO = corpInfoRepository.getById(userE.getCorpinfoId());
|
||||
String corpName = null;
|
||||
UserEmploymentLogE userEmploymentLogE = new UserEmploymentLogE();
|
||||
BeanUtils.copyProperties(userE, userEmploymentLogE);
|
||||
userEmploymentLogE.initAdd(userEmploymentLogE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = userGateway.add(userE);
|
||||
if(corpInfoDO != null && !ObjectUtils.isEmpty(corpInfoDO.getCorpName())){
|
||||
corpName = corpInfoDO.getCorpName();
|
||||
}
|
||||
userEmploymentLogE.initAdd(userEmploymentLogE, corpName, userE.getId());
|
||||
userEmploymentLogGateway.add(userEmploymentLogE);
|
||||
// FacadeUserAddCmd facadeUserAddCmd = new FacadeUserAddCmd();
|
||||
// facadeUserAddCmd.setAccount(userE.getUsername());
|
||||
// FacadeUserAddCmd facadeUserAddCmd = userCoConvertor.converEToFacadeUserAddCmd(userE);
|
||||
// userFacade.addUser(facadeUserAddCmd);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
@ -77,14 +78,18 @@ public class UserAddExe {
|
|||
UserE userE = new UserE();
|
||||
BeanUtils.copyProperties(cmd, userE);
|
||||
userE.initAdd(tenantId, userE);
|
||||
|
||||
CorpInfoDO corpInfoDO = corpInfoRepository.getById(userE.getCorpinfoId());
|
||||
String corpName = null;
|
||||
UserEmploymentLogE userEmploymentLogE = new UserEmploymentLogE();
|
||||
BeanUtils.copyProperties(userE, userEmploymentLogE);
|
||||
boolean res = false;
|
||||
try {
|
||||
res = userGateway.add(userE);
|
||||
// FacadeUserAddCmd facadeUserAddCmd = new FacadeUserAddCmd();
|
||||
// facadeUserAddCmd.setAccount(userE.getUsername());
|
||||
// FacadeUserAddCmd facadeUserAddCmd = userCoConvertor.converEToFacadeUserAddCmd(userE);
|
||||
// userFacade.addUser(facadeUserAddCmd);
|
||||
if(corpInfoDO != null && !ObjectUtils.isEmpty(corpInfoDO.getCorpName())){
|
||||
corpName = corpInfoDO.getCorpName();
|
||||
}
|
||||
userEmploymentLogE.initAdd(userEmploymentLogE, corpName, userE.getId());
|
||||
userEmploymentLogGateway.add(userEmploymentLogE);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,15 @@
|
|||
package com.zcloud.basic.info.command;
|
||||
|
||||
import com.alibaba.cola.exception.BizException;
|
||||
import com.zcloud.basic.info.domain.gateway.UserEmploymentLogGateway;
|
||||
import com.zcloud.basic.info.domain.gateway.UserGateway;
|
||||
import com.zcloud.basic.info.domain.model.UserE;
|
||||
import com.zcloud.basic.info.domain.model.UserEmploymentLogE;
|
||||
import com.zcloud.basic.info.dto.UserUpdateCmd;
|
||||
import com.zcloud.basic.info.persistence.dataobject.CorpInfoDO;
|
||||
import com.zcloud.basic.info.persistence.dataobject.UserDO;
|
||||
import com.zcloud.basic.info.persistence.repository.CorpInfoRepository;
|
||||
import com.zcloud.basic.info.persistence.repository.UserRepository;
|
||||
import com.zcloud.gbscommon.utils.Const;
|
||||
import com.zcloud.gbscommon.utils.ZcloudRedisUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -11,8 +17,7 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -24,6 +29,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
@AllArgsConstructor
|
||||
public class UserUpdateExe {
|
||||
private final UserGateway userGateway;
|
||||
|
||||
private final UserRepository userRepository;
|
||||
|
||||
private final UserEmploymentLogGateway userEmploymentLogGateway;
|
||||
|
||||
private final UserEmploymentLogE userEmploymentLogE;
|
||||
|
||||
private final CorpInfoRepository corpInfoRepository;
|
||||
@Autowired
|
||||
private ZcloudRedisUtil zcloudRedisUtil;
|
||||
|
||||
|
|
@ -31,7 +44,28 @@ public class UserUpdateExe {
|
|||
public void execute(UserUpdateCmd userUpdateCmd) {
|
||||
UserE userE = new UserE();
|
||||
BeanUtils.copyProperties(userUpdateCmd, userE);
|
||||
boolean res = userGateway.update(userE);
|
||||
UserDO userDO = userRepository.getInfoById(userUpdateCmd.getId());
|
||||
UserE oldUserE = new UserE();
|
||||
BeanUtils.copyProperties(userDO, oldUserE);
|
||||
boolean transferPositionFlag = userE.verifyTransferPosition(oldUserE, userE);
|
||||
String corpName = null;
|
||||
|
||||
boolean res = false;
|
||||
try {
|
||||
res = userGateway.update(userE);
|
||||
if (transferPositionFlag) {
|
||||
|
||||
CorpInfoDO corpInfoDO = corpInfoRepository.getById(userE.getCorpinfoId());
|
||||
if(corpInfoDO != null && !ObjectUtils.isEmpty(corpInfoDO.getCorpName())){
|
||||
corpName = corpInfoDO.getCorpName();
|
||||
}
|
||||
userEmploymentLogE.initAdd(userEmploymentLogE, corpName, userE.getId());
|
||||
userEmploymentLogGateway.add(userEmploymentLogE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
if (!res) {
|
||||
throw new BizException("修改失败");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,5 +120,12 @@ public class UserAddCmd extends Command {
|
|||
@ApiModelProperty(value = "政治面貌名称", name = "politicalAffiliationName")
|
||||
private String politicalAffiliationName;
|
||||
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String corpinfoName;
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String departmentName;
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String postName;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,6 @@ import lombok.Data;
|
|||
@Data
|
||||
public class UserEmploymentLogQryCmd{
|
||||
|
||||
private String likeUserEmploymentLogId;
|
||||
private Long eqUserId;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ public class UserXgfAddCmd extends Command {
|
|||
private String userIdCard;
|
||||
|
||||
@ApiModelProperty(value = "人脸头像url", name = "userAvatarUrl", required = true)
|
||||
@NotEmpty(message = "人脸头像url不能为空")
|
||||
private String userAvatarUrl;
|
||||
|
||||
@ApiModelProperty(value = "现住址", name = "currentAddress", required = true)
|
||||
|
|
@ -128,5 +127,11 @@ public class UserXgfAddCmd extends Command {
|
|||
@NotEmpty(message = "政治面貌名称不能为空")
|
||||
private String politicalAffiliationName;
|
||||
|
||||
@ApiModelProperty(value = "企业名称")
|
||||
private String corpinfoName;
|
||||
@ApiModelProperty(value = "部门名称")
|
||||
private String departmentName;
|
||||
@ApiModelProperty(value = "岗位名称")
|
||||
private String postName;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,13 @@ public class UserE extends BaseE {
|
|||
private String phone;
|
||||
|
||||
private String rankLevelName;
|
||||
|
||||
//企业名称
|
||||
private String corpinfoName;
|
||||
//部门名称
|
||||
private String departmentName;
|
||||
//岗位名称
|
||||
private String postName;
|
||||
//人员在部门中的排序
|
||||
private Integer sort;
|
||||
//乐观锁
|
||||
|
|
@ -124,5 +131,27 @@ public class UserE extends BaseE {
|
|||
return Response.buildSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员修改过程中,是否存在转岗、入职离职
|
||||
* @param oldUserE
|
||||
* @param newUserE
|
||||
* @return
|
||||
*/
|
||||
public boolean verifyTransferPosition(UserE oldUserE, UserE newUserE) {
|
||||
if (oldUserE.getCorpinfoId() != newUserE.getCorpinfoId()){
|
||||
return true;
|
||||
}
|
||||
if (oldUserE.getDepartmentId() != newUserE.getDepartmentId()){
|
||||
return true;
|
||||
}
|
||||
if (oldUserE.getPostId() != newUserE.getPostId()){
|
||||
return true;
|
||||
}
|
||||
if(oldUserE.getEmploymentFlag() != newUserE.getEmploymentFlag()){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,10 @@ public class UserEmploymentLogE extends BaseE {
|
|||
//环境
|
||||
private String env;
|
||||
|
||||
public void initAdd(UserEmploymentLogE userEmploymentLogE) {
|
||||
public void initAdd(UserEmploymentLogE userEmploymentLogE, String corpinfoName, Long user_id) {
|
||||
userEmploymentLogE.setUserEmploymentLogId(Tools.get32UUID());
|
||||
userEmploymentLogE.setCorpinfoName(corpinfoName);
|
||||
userEmploymentLogE.setUserId(user_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ public class UserGatewayImpl implements UserGateway {
|
|||
UserDO d = new UserDO();
|
||||
BeanUtils.copyProperties(userE, d);
|
||||
userRepository.save(d);
|
||||
userE.setId(d.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue