Commit cf2a7065 authored by fangxinjiang's avatar fangxinjiang

员工修改记录

parent 403cebde
......@@ -475,6 +475,10 @@ public class ExcelUtil <T> implements Serializable {
return (String)RedisUtil.redis.opsForValue().get(CacheConstants.AREA_LABEL + c);
}
public String getAreaLabelPublic(String c) {
return (String)RedisUtil.redis.opsForValue().get(CacheConstants.AREA_LABEL + c);
}
private String getAreaValue(String c, String tempStr, ExcelAttribute attr,Integer rowNum, ErrorMessage errorTemp) {
tempStr = String.valueOf(RedisUtil.redis.opsForValue().get(CacheConstants.AREA_VALUE + c));
if (Common.isEmpty(tempStr)){
......
......@@ -90,7 +90,6 @@ public class TSalaryEmpModLogController {
@Operation(summary = "新增薪资人员档案变更记录", description = "新增薪资人员档案变更记录:hasPermission('demo_tsalaryempmodlog_add')")
@SysLog("新增薪资人员档案变更记录" )
@PostMapping
@PreAuthorize("@pms.hasPermission('demo_tsalaryempmodlog_add')" )
public R<Boolean> save(@RequestBody TSalaryEmpModLog tSalaryEmpModLog) {
return R.ok(tSalaryEmpModLogService.save(tSalaryEmpModLog));
}
......@@ -103,7 +102,6 @@ public class TSalaryEmpModLogController {
@Operation(summary = "修改薪资人员档案变更记录", description = "修改薪资人员档案变更记录:hasPermission('demo_tsalaryempmodlog_edit')")
@SysLog("修改薪资人员档案变更记录" )
@PutMapping
@PreAuthorize("@pms.hasPermission('demo_tsalaryempmodlog_edit')" )
public R<Boolean> updateById(@RequestBody TSalaryEmpModLog tSalaryEmpModLog) {
return R.ok(tSalaryEmpModLogService.updateById(tSalaryEmpModLog));
}
......@@ -116,7 +114,6 @@ public class TSalaryEmpModLogController {
@Operation(summary = "通过id删除薪资人员档案变更记录", description = "通过id删除薪资人员档案变更记录:hasPermission('demo_tsalaryempmodlog_del')")
@SysLog("通过id删除薪资人员档案变更记录" )
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('demo_tsalaryempmodlog_del')" )
public R<Boolean> removeById(@PathVariable String id) {
return R.ok(tSalaryEmpModLogService.removeById(id));
}
......
......@@ -128,7 +128,7 @@ public class TSalaryEmployeeController {
@PutMapping
@PreAuthorize("@pms.hasPermission('salary_tsalaryemployee_edit')")
public R<Boolean> updateById(@RequestBody TSalaryEmployee tSalaryEmployee) {
return R.ok(tSalaryEmployeeService.updateById(tSalaryEmployee));
return tSalaryEmployeeService.updateByIdDiy(tSalaryEmployee);
}
/**
......
......@@ -21,8 +21,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmpModLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmpModLogSearchVo;
import javax.servlet.http.HttpServletResponse;
......@@ -44,4 +46,6 @@ public interface TSalaryEmpModLogService extends IService<TSalaryEmpModLog> {
IPage<TSalaryEmpModLog> getTSalaryEmpModLogPage(Page<TSalaryEmpModLog> page, TSalaryEmpModLogSearchVo tSalaryEmpModLog);
List<TSalaryEmpModLog> noPageDiy(TSalaryEmpModLogSearchVo searchVo);
void initModLog(TSalaryEmployee newEntity, TSalaryEmployee oldEntity, String type, String userName, ExcelUtil<TSalaryEmployee> util);
}
......@@ -123,4 +123,7 @@ public interface TSalaryEmployeeService extends IService<TSalaryEmployee> {
R updateEmployeeFromEkp(TSalaryEmployeeEkpUpdateVo vo);
List<TSalaryEmpRosterVo> getSalaryEmpRoster(List<String> idCardList);
R<Boolean> updateByIdDiy(TSalaryEmployee tSalaryEmployee);
}
......@@ -22,9 +22,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmpModLog;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmpModLogMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmpModLogService;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryEmpModLogSearchVo;
......@@ -64,6 +68,117 @@ public class TSalaryEmpModLogServiceImpl extends ServiceImpl<TSalaryEmpModLogMap
wrapper.orderByDesc(BaseEntity::getCreateTime);
return baseMapper.selectList(wrapper);
}
/**
* @Author fxj
* @Description 记录变更日志
* @Date 17:59 2023/10/24
* @Param type 0 编辑 1 批量更新 3 EKP 更新
* @return
**/
@Override
public void initModLog(TSalaryEmployee newEntity, TSalaryEmployee oldEntity, String type,String userName,ExcelUtil<TSalaryEmployee> util) {
if (Common.isNotNull(newEntity) && Common.isNotNull(oldEntity)){
TSalaryEmpModLog log = new TSalaryEmpModLog();
log.setIdNum(newEntity.getEmpIdcard());
log.setParentId(newEntity.getId());
log.setType(type);
log.setCreateName(userName);
StringBuilder str = new StringBuilder();
//编辑
if (Common.isEmpty(util)){
util = new ExcelUtil<>(TSalaryEmployee.class);
}
extracted(newEntity, oldEntity, str);
//计税月份
if (Common.isNotNull(newEntity.getTaxMonth()) && !oldEntity.getTaxMonth().equals(newEntity.getTaxMonth())){
str.append("计税月份:");
str.append(oldEntity.getTaxMonth());
str.append("->");
str.append(newEntity.getTaxMonth());
str.append(" /n ");
}
//开户行省
if (Common.isNotNull(newEntity.getBankProvince())
&& !oldEntity.getBankProvince().equals(newEntity.getBankProvince())){
str.append("开户行省:");
str.append(Common.isEmpty(oldEntity.getBankProvince())?"":util.getAreaLabelPublic(oldEntity.getBankProvince()));
str.append("->");
str.append(Common.isEmpty(newEntity.getBankProvince())?"":util.getAreaLabelPublic(newEntity.getBankProvince()));
str.append(" /n ");
}
//开户行市
if (Common.isNotNull(newEntity.getBankCity()) && !oldEntity.getBankCity().equals(newEntity.getBankCity())){
str.append("开户行市:");
str.append(Common.isEmpty(oldEntity.getBankCity())?"":util.getAreaLabelPublic(oldEntity.getBankCity()));
str.append("->");
str.append(Common.isEmpty(newEntity.getBankCity())?"":util.getAreaLabelPublic(newEntity.getBankCity()));
str.append(" /n ");
}
log.setContent(str.toString());
if (Common.isNotNull(log.getContent())){
baseMapper.insert(log);
}
}
}
private void extracted(TSalaryEmployee newEntity, TSalaryEmployee oldEntity, StringBuilder str) {
//姓名
if (Common.isNotNull(newEntity.getEmpName())
&& !oldEntity.getEmpName().equals(newEntity.getEmpName())){
str.append("员工姓名:");
str.append(oldEntity.getEmpName());
str.append("->");
str.append(newEntity.getEmpName());
str.append(" /n ");
}
//开户行
if (Common.isNotNull(newEntity.getBankName())
&& !oldEntity.getBankName().equals(newEntity.getBankName())){
str.append("开户行:");
str.append(oldEntity.getBankName());
str.append("->");
str.append(newEntity.getBankName());
str.append(" /n ");
}
//银行卡号
if (Common.isNotNull(newEntity.getBankNo())
&& !oldEntity.getBankNo().equals(newEntity.getBankNo())){
str.append("银行卡号:");
str.append(oldEntity.getBankNo());
str.append("->");
str.append(newEntity.getBankNo());
str.append(" /n ");
}
//开户行支行
if ((Common.isEmpty(oldEntity.getBankSubName())
&& Common.isNotNull(newEntity.getBankSubName()))
|| (Common.isNotNull(newEntity.getBankSubName())
&& !newEntity.getBankSubName().equals(oldEntity.getBankSubName()))){
str.append("开户行支行:");
str.append(oldEntity.getBankSubName());
str.append("->");
str.append(newEntity.getBankSubName());
str.append(" /n ");
}
//在职状态
if (Common.isNotNull(newEntity.getFileStatus())
&& !oldEntity.getFileStatus().equals(newEntity.getFileStatus())){
str.append("在职状态:");
str.append(CommonConstants.ZERO_STRING.equals(oldEntity.getFileStatus())?"在职":"离职");
str.append("->");
str.append(CommonConstants.ZERO_STRING.equals(newEntity.getFileStatus())?"在职":"离职");
str.append(" /n ");
}
//手机号码
if (Common.isNotNull(newEntity.getEmpPhone())
&& !oldEntity.getEmpPhone().equals(newEntity.getEmpPhone())){
str.append("手机号码:");
str.append(oldEntity.getEmpPhone());
str.append("->");
str.append(newEntity.getEmpPhone());
str.append(" /n ");
}
}
private LambdaQueryWrapper buildQueryWrapper(TSalaryEmpModLogSearchVo entity){
LambdaQueryWrapper<TSalaryEmpModLog> wrapper = Wrappers.lambdaQuery();
......
......@@ -36,23 +36,28 @@ import com.yifu.cloud.plus.v1.check.entity.TCheckIdCard;
import com.yifu.cloud.plus.v1.check.entity.TCheckMobile;
import com.yifu.cloud.plus.v1.check.vo.CheckBankNoVo;
import com.yifu.cloud.plus.v1.check.vo.CheckBatchVo;
import com.yifu.cloud.plus.v1.yifu.admin.api.entity.SysUser;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TSettleDomain;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryAccountItem;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryEmployee;
import com.yifu.cloud.plus.v1.yifu.salary.mapper.TSalaryEmployeeMapper;
import com.yifu.cloud.plus.v1.yifu.salary.service.TBankSetService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmpModLogService;
import com.yifu.cloud.plus.v1.yifu.salary.service.TSalaryEmployeeService;
import com.yifu.cloud.plus.v1.yifu.salary.util.SalaryConstants;
import com.yifu.cloud.plus.v1.yifu.salary.vo.*;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -82,6 +87,9 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
@Autowired
private TBankSetService tBankSetService;
@Autowired
private TSalaryEmpModLogService logService;
/**
* 薪酬人员表简单分页查询
*
......@@ -531,6 +539,11 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
* @return: void
**/
public void updateTSalaryEmployee(List<TSalaryEmployeeUpdateVo> excelVOList, List<ErrorMessage> errorMessageList) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
errorMessageList.add(new ErrorMessage(CommonConstants.ONE_INT_NEGATE, CommonConstants.USER_FAIL));
return;
}
/// 个性化校验逻辑
TSalaryEmployeeUpdateVo excel;
List<String> idCardList = new ArrayList<>();
......@@ -549,11 +562,15 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
String areaStr;
boolean curTaxMonth;
Map<String, String> bankMap = tBankSetService.getBankMap(null);
ExcelUtil<TSalaryEmployee> util = new ExcelUtil<>(TSalaryEmployee.class);
TSalaryEmployee old =null;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (excel != null) {
if (Common.isNotNull(excel.getEmpIdcard())) {
emp = empMap.get(excel.getEmpIdcard());
old = new TSalaryEmployee();
BeanUtil.copyProperties(emp,old);
if (Common.isNotNull(emp)) {
curTaxMonth = false;
if (Common.isNotNull(emp.getTaxMonth()) && Common.isNotNull(excel.getTaxMonth()) && emp.getTaxMonth().length()==6) {
......@@ -599,6 +616,8 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
if (Common.isNotNull(excel.getEmpName())) {
emp.setEmpName(excel.getEmpName());
}
// 变更日志 fxj 2023-10-24
logService.initModLog(old,emp,CommonConstants.ONE_STRING,user.getNickname(),util);
baseMapper.updateById(emp);
if (curTaxMonth) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), SalaryConstants.CUR_TAX_INFO));
......@@ -691,6 +710,7 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
+ "行:-上次代发户未校验【姓名与卡号】,本次校验结果:不匹配。请去薪酬人员查询处更新卡号信息!"));
return false;
}
}
this.saveOrUpdateBatch(empList);
}
......@@ -908,12 +928,15 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
TSalaryEmployee one = baseMapper.selectOne(Wrappers.<TSalaryEmployee>query().lambda()
.eq(TSalaryEmployee::getEmpIdcard, vo.getEmpIdcard())
.last(CommonConstants.LAST_ONE_SQL));
TSalaryEmployee old = new TSalaryEmployee();
BeanUtil.copyProperties(one,old);
if (Common.isNotNull(one)) {
one.setBankNo(vo.getBankNo());
one.setEmpName(vo.getEmpName());
one.setBankName(vo.getBankName());
baseMapper.updateById(one);
}
logService.initModLog(old,one,CommonConstants.TWO_STRING, "ekp",null);
return R.ok();
}
/**
......@@ -930,4 +953,24 @@ public class TSalaryEmployeeServiceImpl extends ServiceImpl<TSalaryEmployeeMappe
}
return null;
}
@Override
public R<Boolean> updateByIdDiy(TSalaryEmployee tSalaryEmployee) {
if (Common.isEmpty(tSalaryEmployee.getId())){
return R.failed(CommonConstants.PARAM_INFO_ERROR);
}
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)){
return R.failed(CommonConstants.USER_FAIL);
}
// 变更日志 fxj 2023-10-24
TSalaryEmployee old = baseMapper.selectById(tSalaryEmployee.getId());
logService.initModLog(old,tSalaryEmployee,CommonConstants.ZERO_STRING,user.getNickname(),null);
int res = baseMapper.updateById(tSalaryEmployee);
if (res >= CommonConstants.ZERO_INT){
return R.ok();
}else {
return R.failed(CommonConstants.UPDATE_DATA_FAIL);
}
}
}
......@@ -53,7 +53,7 @@
AND a.id = #{tSalaryEmpModLog.id}
</if>
<if test="tSalaryEmpModLog.content != null and tSalaryEmpModLog.content.trim() != ''">
AND a.content like concat('%',tSalaryEmpModLog.content,'%')
AND a.content like concat('%',#{tSalaryEmpModLog.content},'%')
</if>
<if test="tSalaryEmpModLog.type != null and tSalaryEmpModLog.type.trim() != ''">
AND a.type = #{tSalaryEmpModLog.type}
......
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