Commit 7020d160 authored by hongguangwu's avatar hongguangwu

MVP1.7.10-更新档案

parent 67ec906e
...@@ -568,4 +568,34 @@ public class TEmployeeInfoController { ...@@ -568,4 +568,34 @@ public class TEmployeeInfoController {
tEmployeeInfoService.exportEmployeeFile(id, response); tEmployeeInfoService.exportEmployeeFile(id, response);
} }
/**
* @param empName 姓名
* @param empIdCard 身份证
* @Description: 按姓名身份证查询档案-包括离职库
* @Author: hgw
* @Date: 2025-4-23 15:34:26
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "按姓名身份证查询档案-包括离职库", description = "按姓名身份证查询档案-包括离职库")
@SysLog("按姓名身份证查询档案-包括离职库")
@GetMapping("/getByEmpNameAndCard")
public R<TEmployeeInfo> getByEmpNameAndCard(@RequestParam String empName, @RequestParam String empIdCard) {
return tEmployeeInfoService.getByEmpNameAndCard(empName, empIdCard);
}
/**
* @param empPhoneOld 手机号-原先
* @param empPhoneNew 手机号-新
* @Description: 更新档案手机号-包括离职库
* @Author: hgw
* @Date: 2025-4-23 15:34:26
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(summary = "更新档案手机号-包括离职库", description = "更新档案手机号-包括离职库")
@SysLog("更新档案手机号-包括离职库")
@GetMapping("/updateEmpPhone")
public R<String> updateEmpPhone(@RequestParam String id, @RequestParam String empPhoneOld, @RequestParam String empPhoneNew) {
return tEmployeeInfoService.updateEmpPhone(id, empPhoneOld, empPhoneNew);
}
} }
...@@ -271,4 +271,24 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> { ...@@ -271,4 +271,24 @@ public interface TEmployeeInfoService extends IService<TEmployeeInfo> {
List<TEmployeeInfo> getListByDeptIdByLimit(String deptId, Integer limit1, Integer limit2); List<TEmployeeInfo> getListByDeptIdByLimit(String deptId, Integer limit1, Integer limit2);
/**
* @param empPhoneOld 手机号-原先
* @param empPhoneNew 手机号-新
* @Description: 更新档案手机号-包括离职库
* @Author: hgw
* @Date: 2025-4-23 15:34:26
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> updateEmpPhone(String id, String empPhoneOld, String empPhoneNew);
/**
* @param empName
* @param empIdCard
* @Description: 按姓名身份证查询档案
* @Author: hgw
* @Date: 2025/4/23 16:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo>
**/
R<TEmployeeInfo> getByEmpNameAndCard(String empName, String empIdCard);
} }
...@@ -26,6 +26,7 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder; ...@@ -26,6 +26,7 @@ import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
import com.alibaba.excel.util.ListUtils; import com.alibaba.excel.util.ListUtils;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.lock.annotation.Lock4j; import com.baomidou.lock.annotation.Lock4j;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -4214,4 +4215,70 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -4214,4 +4215,70 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
tEmpDisabilityInfoService.saveBatch(disabilityRecordList); tEmpDisabilityInfoService.saveBatch(disabilityRecordList);
} }
} }
/**
* @param empPhoneOld 手机号-原先
* @param empPhoneNew 手机号-新
* @Description: 更新档案手机号-包括离职库
* @Author: hgw
* @Date: 2025-4-23 15:34:26
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> updateEmpPhone(String id, String empPhoneOld, String empPhoneNew) {
if (empPhoneOld.equals(empPhoneNew)) {
return R.failed("手机号未发生变化");
}
// 1:判断姓名、身份证是否存在
// 2:如果不存在,返回提示语:无该员工信息
// 3:如果存在,判断手机号old对不对,不对则返回提示语:旧手机号错误
// 4:如果手机号old对,判断手机号new对不对,不对则返回提示语:新手机号校验不通过
// 5:如果手机号new校验通过,判断手机号new是否已存在,存在则返回提示语:手机号已被其他身份证使用
// 6:如果手机号new未被使用,则更新手机号,并返回提示语:更新成功
TEmployeeInfo emp = this.getById(id);
if (emp != null) {
TEmployeeInfo empExist = baseMapper.selectOne(new LambdaQueryWrapper<TEmployeeInfo>().eq(TEmployeeInfo::getEmpPhone, empPhoneNew));
if (empExist != null) {
return R.failed("手机号已被其他身份证使用");
}
TCheckMobile checkMobile = new TCheckMobile();
checkMobile.setMobile(empPhoneNew);
R<TCheckMobile> a = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckmobile/inner/checkOneMobile", checkMobile, TCheckMobile.class, SecurityConstants.FROM_IN);
if (a != null && a.getData() != null) {
checkMobile = a.getData();
if (checkMobile != null && Common.isNotNull(checkMobile.getStatus())) {
// 校验服务判断了1、4、5都返回为1,因此仅判断1即可
if (!CommonConstants.ONE_STRING.equals(checkMobile.getStatus())) {
return R.failed("手机号校验失败:" + checkMobile.getMessage());
}
} else {
return R.failed(EmployeeConstants.CHECK_ERROR);
}
} else {
return R.failed(EmployeeConstants.CHECK_ERROR);
}
// 可以更新:
emp.setEmpPhone(empPhoneNew);
baseMapper.updateById(emp);
return R.ok("更新成功!");
} else {
return R.failed("无该员工信息");
}
}
@Override
public R<TEmployeeInfo> getByEmpNameAndCard(String empName, String empIdCard) {
TEmployeeInfo emp = baseMapper.selectOne(new LambdaQueryWrapper<TEmployeeInfo>().eq(TEmployeeInfo::getEmpIdcard, empIdCard));
if (emp != null) {
if (empName.equals(emp.getEmpName())) {
return new R<>(emp);
} else {
return R.failed("姓名与身份证不匹配!");
}
} else {
return R.failed("无该员工信息");
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment