Commit 7536152e authored by hongguangwu's avatar hongguangwu

单个编辑,手机号校验

parent 29000779
...@@ -1231,9 +1231,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1231,9 +1231,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(excel.getIsCollege())) { if (Common.isNotNull(excel.getIsCollege())) {
if (CommonConstants.IS_TRUE.equals(excel.getIsCollege())) { if (CommonConstants.IS_TRUE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ONE_INT); saveEmp.setIsCollege(CommonConstants.ONE_INT);
if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
}
} else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())) { } else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ZERO_INT); saveEmp.setIsCollege(CommonConstants.ZERO_INT);
} else { } else {
...@@ -1745,9 +1742,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T ...@@ -1745,9 +1742,6 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
if (Common.isNotNull(excel.getIsCollege())) { if (Common.isNotNull(excel.getIsCollege())) {
if (CommonConstants.IS_TRUE.equals(excel.getIsCollege())) { if (CommonConstants.IS_TRUE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ONE_INT); saveEmp.setIsCollege(CommonConstants.ONE_INT);
if (Common.isEmpty(excel.getHignEducation())) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.ARCHIVES_IMPORT_EMP_HIGH_EDUCATION_ERROR, excel.getEmpIdcard()));
}
} else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())) { } else if (CommonConstants.IS_FALSE.equals(excel.getIsCollege())) {
saveEmp.setIsCollege(CommonConstants.ZERO_INT); saveEmp.setIsCollege(CommonConstants.ZERO_INT);
} else { } else {
......
...@@ -101,8 +101,8 @@ public class SysBaseSetInfoController { ...@@ -101,8 +101,8 @@ public class SysBaseSetInfoController {
@SysLog("新增基数设置表") @SysLog("新增基数设置表")
@PostMapping @PostMapping
@PreAuthorize("@pms.hasPermission('social_sysbasesetinfo_add')") @PreAuthorize("@pms.hasPermission('social_sysbasesetinfo_add')")
public R<Boolean> save(@RequestBody SysBaseSetInfo sysBaseSetInfo) { public R<String> save(@RequestBody SysBaseSetInfo sysBaseSetInfo) {
return R.ok(sysBaseSetInfoService.save(sysBaseSetInfo)); return sysBaseSetInfoService.saveSysBase(sysBaseSetInfo);
} }
/** /**
...@@ -115,8 +115,8 @@ public class SysBaseSetInfoController { ...@@ -115,8 +115,8 @@ public class SysBaseSetInfoController {
@SysLog("修改基数设置表") @SysLog("修改基数设置表")
@PutMapping @PutMapping
@PreAuthorize("@pms.hasPermission('social_sysbasesetinfo_edit')") @PreAuthorize("@pms.hasPermission('social_sysbasesetinfo_edit')")
public R<Boolean> updateById(@RequestBody SysBaseSetInfo sysBaseSetInfo) { public R<String> updateById(@RequestBody SysBaseSetInfo sysBaseSetInfo) {
return R.ok(sysBaseSetInfoService.updateById(sysBaseSetInfo)); return sysBaseSetInfoService.updateSysBase(sysBaseSetInfo);
} }
/** /**
......
...@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.social.service; ...@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
/** /**
...@@ -36,4 +37,23 @@ public interface SysBaseSetInfoService extends IService<SysBaseSetInfo> { ...@@ -36,4 +37,23 @@ public interface SysBaseSetInfoService extends IService<SysBaseSetInfo> {
* @return * @return
*/ */
IPage<SysBaseSetInfo> getSysBaseSetInfoPage(Page<SysBaseSetInfo> page, SysBaseSetInfo sysBaseSetInfo); IPage<SysBaseSetInfo> getSysBaseSetInfoPage(Page<SysBaseSetInfo> page, SysBaseSetInfo sysBaseSetInfo);
/**
* @param sysBaseSetInfo
* @Description: 新增
* @Author: hgw
* @Date: 2022/7/12 10:00
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> saveSysBase(SysBaseSetInfo sysBaseSetInfo);
/**
* @param sysBaseSetInfo
* @Description: 修改
* @Author: hgw
* @Date: 2022/7/12 10:00
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> updateSysBase(SysBaseSetInfo sysBaseSetInfo);
} }
...@@ -36,4 +36,18 @@ public interface TSocialLogService extends IService<TSocialLog> { ...@@ -36,4 +36,18 @@ public interface TSocialLogService extends IService<TSocialLog> {
* @return * @return
*/ */
IPage<TSocialLog> getTSocialLogPage(Page<TSocialLog> page, TSocialLog tSocialLog); IPage<TSocialLog> getTSocialLogPage(Page<TSocialLog> page, TSocialLog tSocialLog);
/**
* 生成修改记录
*
* @param type 类型:1社保基数配置;2公积金基数配置
* @param mainId 关联表id
* @param oldInfo
* @param newInfo
* @return
* @Author pwang
* @Date 2022-06-22 11:32
**/
<T> TSocialLog saveModificationRecord(Integer type, String mainId, T oldInfo, T newInfo);
} }
...@@ -19,9 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.social.service.impl; ...@@ -19,9 +19,15 @@ package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
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.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -30,8 +36,11 @@ import org.springframework.stereotype.Service; ...@@ -30,8 +36,11 @@ import org.springframework.stereotype.Service;
* @author hgw * @author hgw
* @date 2022-07-11 18:21:23 * @date 2022-07-11 18:21:23
*/ */
@RequiredArgsConstructor
@Service @Service
public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, SysBaseSetInfo> implements SysBaseSetInfoService { public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, SysBaseSetInfo> implements SysBaseSetInfoService {
private final TSocialLogService tSocialLogService;
/** /**
* 基数设置表简单分页查询 * 基数设置表简单分页查询
* *
...@@ -42,4 +51,24 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -42,4 +51,24 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
public IPage<SysBaseSetInfo> getSysBaseSetInfoPage(Page<SysBaseSetInfo> page, SysBaseSetInfo sysBaseSetInfo) { public IPage<SysBaseSetInfo> getSysBaseSetInfoPage(Page<SysBaseSetInfo> page, SysBaseSetInfo sysBaseSetInfo) {
return baseMapper.getSysBaseSetInfoPage(page, sysBaseSetInfo); return baseMapper.getSysBaseSetInfoPage(page, sysBaseSetInfo);
} }
@Override
public R<String> saveSysBase(SysBaseSetInfo sysBaseSetInfo) {
this.save(sysBaseSetInfo);
return R.ok();
}
@Override
public R<String> updateSysBase(SysBaseSetInfo sysBaseSetInfo) {
SysBaseSetInfo old = this.getById(sysBaseSetInfo.getId());
if (old == null || Common.isEmpty(old.getId())) {
return R.failed("根据id未找到基数配置!" + sysBaseSetInfo.getId());
}
this.updateById(sysBaseSetInfo);
// 记录变更日志
tSocialLogService.saveModificationRecord(CommonConstants.ONE_INT, old.getId(), old, sysBaseSetInfo);
return R.ok();
}
} }
...@@ -16,14 +16,22 @@ ...@@ -16,14 +16,22 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.social.service.impl; package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.equator.HrEquator;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialLog; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialLog;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialLogMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialLogMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import static com.alibaba.fastjson.serializer.SerializerFeature.*;
/** /**
* 社保变更记录表 * 社保变更记录表
* *
...@@ -42,4 +50,42 @@ public class TSocialLogServiceImpl extends ServiceImpl<TSocialLogMapper, TSocial ...@@ -42,4 +50,42 @@ public class TSocialLogServiceImpl extends ServiceImpl<TSocialLogMapper, TSocial
public IPage<TSocialLog> getTSocialLogPage(Page<TSocialLog> page, TSocialLog tSocialLog) { public IPage<TSocialLog> getTSocialLogPage(Page<TSocialLog> page, TSocialLog tSocialLog) {
return baseMapper.getTSocialLogPage(page, tSocialLog); return baseMapper.getTSocialLogPage(page, tSocialLog);
} }
/**
* @param type 类型:1社保基数配置;2公积金基数配置
* @param mainId
* @Description:
* @Author: hgw
* @Date: 2022/7/12 9:52
* @return: com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog
**/
@Override
public <T> TSocialLog saveModificationRecord(Integer type, String mainId, T oldInfo, T newInfo) {
try {
//比较记录不影响业务逻辑,用try套住
//比较差异
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if (!Common.isEmpty(differenceKey)) {
TSocialLog record = new TSocialLog();
record.setType(type);
record.setMainId(mainId);
record.setCreateTime(LocalDateTime.now());
record.setOldInfo(JSON.toJSONString(oldInfo, features));
record.setNewInfo(JSON.toJSONString(newInfo, features));
record.setDifferenceInfo(differenceKey);
baseMapper.insert(record);
return record;
}
} catch (Exception e) {
log.error(JSON.toJSON(oldInfo) + "【新增社保变更记录】报错>>>", e);
}
return null;
}
private SerializerFeature[] features = new SerializerFeature[]{
WriteMapNullValue, WriteNullNumberAsZero, WriteNullListAsEmpty,
WriteNullStringAsEmpty, WriteDateUseDateFormat
};
} }
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