|
|
@@ -32,6 +32,7 @@ import com.jzg.organization.state.listener.UserStateListener;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
import lombok.Setter;
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
import org.redisson.api.RedissonClient;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
@@ -452,8 +453,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public HttpResult addUserInfo(SysUserVo sysUserVo) {
|
|
|
+ public HttpResult<String> addUserInfo(SysUserVo sysUserVo) {
|
|
|
log.info("新增业务员信息。 sysUserVo=[{}]", JSONUtil.toJsonStr(sysUserVo));
|
|
|
+
|
|
|
SysUser sysUser = baseMapper.getUserByMobile(sysUserVo.getMobile());
|
|
|
String sysUserJzgInfoId = "", sysUserId = "";
|
|
|
SysUserJzgInfo sysUserJzgInfo = new SysUserJzgInfo();
|
|
|
@@ -475,7 +477,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
if (sysUserVo.getOrganizationId() != null && !sysUserVo.getOrganizationId().equals("")) {
|
|
|
saveOrganization(sysUserVo.getOrganizationId(), sysUserJzgInfo.getUserId());
|
|
|
}
|
|
|
- saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(), sysUserJzgInfo.getUserId());
|
|
|
+ this.updateUserBindFiles(sysUserVo.getFileList(),Long.parseLong(sysUser.getId()));
|
|
|
+ //saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(), sysUserJzgInfo.getUserId());
|
|
|
//系统中已存在业务员
|
|
|
// throw new SystemException("用户信息已存在,无法添加");
|
|
|
} else {
|
|
|
@@ -505,7 +508,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
if (sysUserVo.getOrganizationId() != null && !sysUserVo.getOrganizationId().equals("")) {
|
|
|
saveOrganization(sysUserVo.getOrganizationId(), sysUserJzgInfo.getUserId());
|
|
|
}
|
|
|
- saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(), sysUserJzgInfo.getId());
|
|
|
+ this.updateUserBindFiles(sysUserVo.getFileList(),Long.parseLong(sysUserId));
|
|
|
+ //saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(), sysUserJzgInfo.getId());
|
|
|
}
|
|
|
|
|
|
//如果表单输入的银行卡号和银行名不为空,则保存银行卡信息
|
|
|
@@ -926,20 +930,24 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return HttpResult.ok("添加银行卡成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改业务员信息接口
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/4/22 15:41
|
|
|
+ */
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public HttpResult<Boolean> updateUserInfo(SysUserVo sysUserVo) {
|
|
|
+ public HttpResult<String> updateUserInfo(SysUserVo sysUserVo) {
|
|
|
log.info("修改人员信息:sysUserVo=[{}]", JSONUtil.toJsonStr(sysUserVo));
|
|
|
SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getById(sysUserVo.getId());
|
|
|
if (Objects.isNull(sysUserJzgInfo)) {
|
|
|
log.info("id=[{}]的人员不存在", sysUserVo.getId());
|
|
|
throw new SystemException("该业务员不存在");
|
|
|
}
|
|
|
-// if (sysUserJzgInfo.getIsEnable() == 0) {
|
|
|
-// throw new SystemException("该业务员已被禁用");
|
|
|
-// }
|
|
|
BeanUtils.copyProperties(sysUserVo, sysUserJzgInfo);
|
|
|
- verifyFile(sysUserVo, sysUserJzgInfo.getId());
|
|
|
+ this.updateUserBindFiles(sysUserVo.getFileList(),Long.parseLong(sysUserJzgInfo.getUserId()));
|
|
|
+ // verifyFile(sysUserVo, sysUserJzgInfo.getId());
|
|
|
if (sysUserJzgInfo.getStatus() == 5) { // 如果状态为5 说明该业务员重新提交审核 进行业务员审核
|
|
|
StateResult stateResult = userStateListener.salesmanAuthIng(sysUserJzgInfo);
|
|
|
if (stateResult.isResult()) {
|
|
|
@@ -947,7 +955,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
sysUserJzgInfo.setStatus(stateResult.getCurrentState());
|
|
|
sysUserJzgInfo.setApprovalOpinion("");
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
// modify by lipf, 解决身份证信息没有更新的问题
|
|
|
SysUser originSysUser = sysUserService.getById(sysUserVo.getUserId());
|
|
|
@@ -1001,8 +1008,15 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return HttpResult.ok("修改业务员成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取业务员详细信息接口
|
|
|
+ * 包括相关的附件,合同,身份证图片等
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/4/22 15:37
|
|
|
+ */
|
|
|
@Override
|
|
|
- public HttpResult getUserInfoByUserId(String id) {
|
|
|
+ public HttpResult<SysUserJzgInfo> getUserInfoByUserId(String id) {
|
|
|
SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getUserByUserId(id);
|
|
|
log.info("根据id=[{}]查询用户信息sysUserJzgInfo=[{}]",id, JSONUtil.toJsonStr(sysUserJzgInfo));
|
|
|
if (sysUserJzgInfo == null) {
|
|
|
@@ -1018,23 +1032,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
if (!Objects.isNull(dept)) {
|
|
|
sysUserJzgInfo.setDeptName(dept.getName());
|
|
|
}
|
|
|
- List<String> areaList = new ArrayList<>();
|
|
|
- if (!Objects.isNull(sysUserJzgInfo.getProvince()) && !sysUserJzgInfo.getProvince().isEmpty()) {
|
|
|
- areaList.add(sysUserJzgInfo.getProvince());
|
|
|
- }
|
|
|
- if (!Objects.isNull(sysUserJzgInfo.getCity()) && !sysUserJzgInfo.getCity().isEmpty()) {
|
|
|
- areaList.add(sysUserJzgInfo.getCity());
|
|
|
- }
|
|
|
- if (!Objects.isNull(sysUserJzgInfo.getDistrict()) && !sysUserJzgInfo.getDistrict().isEmpty()) {
|
|
|
- areaList.add(sysUserJzgInfo.getDistrict());
|
|
|
- }
|
|
|
- if (areaList.size() == 0) {
|
|
|
+ List<String> areaList = getStrings(sysUserJzgInfo);
|
|
|
+ if (areaList.isEmpty()) {
|
|
|
sysUserJzgInfo.setRegion("");
|
|
|
} else {
|
|
|
List<SysArea> sysAreas = sysAreaService.queryAllByAreaCode(areaList);
|
|
|
String region = "";
|
|
|
- for (int i = 0; i < sysAreas.size(); i++) {
|
|
|
- region = region + sysAreas.get(i).getAreaCname() + "-";
|
|
|
+ for (SysArea sysArea : sysAreas) {
|
|
|
+ region = region + sysArea.getAreaCname() + "-";
|
|
|
}
|
|
|
sysUserJzgInfo.setRegion(region.substring(0, region.length() - 1));
|
|
|
}
|
|
|
@@ -1049,7 +1054,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
sysUserJzgInfo.setReferrerName(Objects.isNull(jzgInfo) ? "" : jzgInfo.getName());
|
|
|
}
|
|
|
String systemCode = baseController.getSystemCode();
|
|
|
- SysOrganizationUserLink sysOrganizationUserLink = sysOrganizationUserLinkService.getOrganizationUser( sysUserJzgInfo.getUserId(),systemCode);
|
|
|
+ Long userId = Long.parseLong(sysUserJzgInfo.getUserId());
|
|
|
+ SysOrganizationUserLink sysOrganizationUserLink = sysOrganizationUserLinkService.getOrganizationUser(userId,systemCode);
|
|
|
|
|
|
if (!Objects.isNull(sysOrganizationUserLink)) {
|
|
|
String organizationId = sysOrganizationUserLink.getOrganizationId();
|
|
|
@@ -1070,7 +1076,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
sysUserJzgInfo.setRoleNames(userRole.stream().map(SysRole::getName).collect(Collectors.toList()));
|
|
|
|
|
|
List<SysUserJzgInfoFile> sysUserJzgInfoFile = sysUserJzgInfoFileService.list
|
|
|
- (new LambdaQueryWrapper<SysUserJzgInfoFile>().eq(SysUserJzgInfoFile::getUserId, sysUserJzgInfo.getId()));
|
|
|
+ (new LambdaQueryWrapper<SysUserJzgInfoFile>().eq(SysUserJzgInfoFile::getUserId, sysUserJzgInfo.getUserId()));
|
|
|
sysUserJzgInfo.setFileList(sysUserJzgInfoFile);
|
|
|
List<SysUserJzgInfoBankCardDto> sysUserJzgInfoBankCardDto = sysUserJzgInfoBankCardService.getBankCardByUserId(sysUserJzgInfo.getId(), baseController.getUserSystemCode());
|
|
|
sysUserJzgInfo.setBankCardList(sysUserJzgInfoBankCardDto);
|
|
|
@@ -1081,6 +1087,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return HttpResult.ok(sysUserJzgInfo);
|
|
|
}
|
|
|
|
|
|
+ @NotNull
|
|
|
+ private static List<String> getStrings(SysUserJzgInfo sysUserJzgInfo) {
|
|
|
+ List<String> areaList = new ArrayList<>();
|
|
|
+ if (!Objects.isNull(sysUserJzgInfo.getProvince()) && !sysUserJzgInfo.getProvince().isEmpty()) {
|
|
|
+ areaList.add(sysUserJzgInfo.getProvince());
|
|
|
+ }
|
|
|
+ if (!Objects.isNull(sysUserJzgInfo.getCity()) && !sysUserJzgInfo.getCity().isEmpty()) {
|
|
|
+ areaList.add(sysUserJzgInfo.getCity());
|
|
|
+ }
|
|
|
+ if (!Objects.isNull(sysUserJzgInfo.getDistrict()) && !sysUserJzgInfo.getDistrict().isEmpty()) {
|
|
|
+ areaList.add(sysUserJzgInfo.getDistrict());
|
|
|
+ }
|
|
|
+ return areaList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public HttpResult getUserInfoById(String id) {
|
|
|
SysUserJzgInfo sysUserJzgInfo = sysUserJzgInfoService.getById(id);
|
|
|
@@ -1129,6 +1150,43 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
sysOrganizationUserLinkService.save(sysOrganizationUserLink);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存员工等的图片信息
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/4/22 15:06
|
|
|
+ */
|
|
|
+ public void updateUserBindFiles(List<SysUserJzgInfoFile> fileList, Long userId){
|
|
|
+ log.info("保存员工的身份证图片等信息:userId=[{}], fileList=[{}]", userId, JSONUtil.toJsonStr(fileList));
|
|
|
+ List<SysUserJzgInfoFile> existedFiles = sysUserJzgInfoFileService.queryJzgInfoFilesByUserId(userId);
|
|
|
+ if(CollUtil.isNotEmpty(existedFiles)){
|
|
|
+ sysUserJzgInfoFileService.removeByIds(existedFiles.stream().map(SysUserJzgInfoFile::getId).toList());
|
|
|
+ }
|
|
|
+ if(CollUtil.isNotEmpty(fileList)){
|
|
|
+ fileList = fileList.stream().peek(action->{
|
|
|
+ String fileId = action.getFileId();
|
|
|
+ SysUploadFiles sysUploadFiles = sysUploadFilesMapper.selectById(fileId);
|
|
|
+ if(sysUploadFiles != null){
|
|
|
+ action.setFileUrl(sysUploadFiles.getDownloadUrl());
|
|
|
+ action.setUserId(String.valueOf(userId));
|
|
|
+ //action.setFileType(sysUploadFiles.getFileType());
|
|
|
+ action.setFileName(sysUploadFiles.getFileName());
|
|
|
+ action.setFileUrl(MinioUtils.getPresignedObjectUrl("jzg", sysUploadFiles.getFileName()));
|
|
|
+ }else{
|
|
|
+ log.error("文件序号为[{}]的文件不存在",fileId);
|
|
|
+ }
|
|
|
+ }).toList();
|
|
|
+ sysUserJzgInfoFileService.saveBatch(fileList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 后期使用 com.jzg.organization.service.impl.SysUserServiceImpl#updateUserBindFiles(java.util.List, java.lang.Long) 进行替换
|
|
|
+ *
|
|
|
+ * @author lipf
|
|
|
+ * @date 2026/4/22 15:30
|
|
|
+ */
|
|
|
+ @Deprecated()
|
|
|
public void saveFile(String sfz1, String sfz2, String qualification, String contract, String applicant, String salaryTable, String leaveTable, String userId) {
|
|
|
saveSingleFile(sfz1, "sfz1", userId);
|
|
|
saveSingleFile(sfz2, "sfz2", userId);
|
|
|
@@ -1195,6 +1253,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Deprecated
|
|
|
public void verifyFile(SysUserVo sysUserVo, String userId) {
|
|
|
List<SysUserJzgInfoFile> fileList = sysUserJzgInfoFileService.list(new LambdaQueryWrapper<SysUserJzgInfoFile>()
|
|
|
.eq(SysUserJzgInfoFile::getUserId, userId));
|
|
|
@@ -1411,7 +1470,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
saveRole(userByUserId);
|
|
|
return HttpResult.ok("添加业务员成功");
|
|
|
}catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
+ log.error("添加业务员异常",e);
|
|
|
throw new RuntimeException("添加业务员失败:", e);
|
|
|
}
|
|
|
}
|
|
|
@@ -1454,7 +1513,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
sysUserId = sysUser1.getId();
|
|
|
sysUserJzgInfo.setStatus(UserState.UserStateEnum.ALREADY_EMPLOYEE.getValue());
|
|
|
sysUserJzgInfoService.save(sysUserJzgInfo);
|
|
|
- saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(), sysUserJzgInfo.getId());
|
|
|
+ this.updateUserBindFiles(sysUserVo.getFileList(),Long.parseLong(sysUser1.getId()));
|
|
|
+ //saveFile(sysUserVo.getSfz1(), sysUserVo.getSfz2(), sysUserVo.getQualification(), sysUserVo.getContract(), sysUserVo.getApplicant(), sysUserVo.getSalaryTable(), sysUserVo.getLeaveTable(), sysUserJzgInfo.getId());
|
|
|
//如果表单输入的银行卡号和银行名不为空,则保存银行卡信息
|
|
|
if (sysUserVo.getBankCardId() != null && sysUserVo.getBankName() != null) {
|
|
|
SysUserJzgInfoBankCard sysUserJzgInfoBankCard =
|