Commit f16d14ba authored by huyuchen's avatar huyuchen

fdd 代码修改

parent e4236267
......@@ -172,18 +172,22 @@ public class FddContractAttachInfoController {
} else {
if (null != util1.getEntityList()) {
List<ErrorMessage> errorInfo = fddContractAttachInfoService.batchAdd(util1.getEntityList());
Map<String,Object> variableMap = new HashMap<>();
Map<Integer,Object> map = new HashMap<>();
boolean allExitContract = errorInfo.stream().allMatch(e-> e.getMessage().equals("存在“在用”的合同"));
if (errorInfo.size() > CommonConstants.ZERO_INT) {
Map<String, Object> variableMap = new HashMap<>();
Map<Integer, Object> map = new HashMap<>();
boolean allExitContract = errorInfo.stream().allMatch(e -> e.getMessage().equals("存在“在用”的合同"));
if (allExitContract) {
variableMap.put("allMatch","true");
for (ErrorMessage errorMessage :errorInfo){
map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2));
variableMap.put("allMatch", "true");
for (ErrorMessage errorMessage : errorInfo) {
map.put(errorMessage.getLineNum(), util1.getEntityList().get(errorMessage.getLineNum() - 2));
}
variableMap.put("data",map);
return R.ok(variableMap,"存在“在用”的合同");
variableMap.put("data", map);
return R.ok(variableMap, "存在“在用”的合同");
}
return R.failed(errorInfo);
} else {
return R.ok(null,"保存成功");
}
return R.failed(errorInfo,"");
} else {
return R.ok(null,"无数据可导入");
}
......@@ -271,6 +275,9 @@ public class FddContractAttachInfoController {
return R.failed("数据为空!");
}
List<ErrorMessage> errorInfo = fddContractAttachInfoService.sendTask(entityList);
return R.ok(errorInfo);
if (errorInfo.size() > CommonConstants.ZERO_INT) {
return R.failed(errorInfo);
}
return R.ok(null,"保存成功");
}
}
......@@ -18,6 +18,7 @@
package com.yifu.cloud.plus.v1.yifu.archives.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -54,4 +55,17 @@ public interface TEmployeeLogService extends IService<TEmployeeLog> {
* @return
**/
<T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo, YifuUser user);
/**
* 生成修改记录
* @Author pwang
* @Date 2022-06-22 11:32
* @param type 类型:0人员档案;1项目档案;2人员和项目档案;3员工合同更新
* @param empId 档案id
* @param projectId 项目id
* @param oldInfo
* @param newInfo
* @return
**/
<T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo, FddContractAttachInfo fddContractAttachInfo);
}
......@@ -197,7 +197,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
});
}
i++;
errorList.add(new ErrorMessage(i, "保存成功", CommonConstants.GREEN));
}
return errorList;
}
......@@ -286,7 +285,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo2);
}
doJointTask.doUpdateEmployeeInfo(updateList, user);
doJointTask.updateFddEmployeeInfo(updateList, fddContractAttachInfo);
} else {
//判断人员档案是否存在,不存在就新增人员档案,存在则判断档案状态,如果是减档就复档
if (Common.isNotNull(tEmployeeInfo)) {
......@@ -312,7 +311,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, project);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
doJointTask.doUpdateEmployeeInfo(updateList, user);
doJointTask.updateFddEmployeeInfo(updateList, fddContractAttachInfo);
} else {
//新增人员档案
TEmployeeInfo newEmployeeInfo = new TEmployeeInfo();
......@@ -479,7 +478,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
}
});
}
errorList.add(new ErrorMessage(i, "保存成功", CommonConstants.GREEN));
}
} else {
errorList.add(new ErrorMessage(i, "无数据保存"));
......
......@@ -586,7 +586,7 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
// 1:保存为
TAttaInfo attaInfo = initUnitAttaForInsert(name, key, (long)rspData.getFileBytes().length);
attaInfo.setRelationType(CommonConstants.FOUR_STRING);
attaInfo.setDomainId(fddContractInfo.getId());
attaInfo.setDomainId(entity.getContractId());
tAttaInfoService.save(attaInfo);
FddContractAttachInfo fddContractAttachInfo = fddContractAttachInfoMapper.selectOne(Wrappers.<FddContractAttachInfo>query().lambda()
......
......@@ -19,6 +19,7 @@ package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeLog;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeLogMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
......@@ -94,6 +95,36 @@ public class TEmployeeLogServiceImpl extends ServiceImpl<TEmployeeLogMapper, TEm
return null;
}
@Override
public <T> TEmployeeLog saveModificationRecord(Integer type, String empId, String projectId, T oldInfo, T newInfo, FddContractAttachInfo fddContractAttachInfo) {
try{
//比较记录不影响业务逻辑,用try套住
//比较差异
String differenceKey = HrEquator.comparisonValue(oldInfo, newInfo);
//如果有差异保存差异
if(!Common.isEmpty(differenceKey)){
TEmployeeLog employeeLog = new TEmployeeLog();
employeeLog.setProjectId(projectId);
employeeLog.setType(type);
employeeLog.setEmpId(empId);
employeeLog.setCreateTime(LocalDateTime.now());
if (Common.isNotNull(fddContractAttachInfo)) {
employeeLog.setCreateBy(fddContractAttachInfo.getCreateBy());
employeeLog.setCreateName(fddContractAttachInfo.getCreateName());
employeeLog.setUpdateBy(fddContractAttachInfo.getUpdateBy());
}
employeeLog.setOldInfo(JSON.toJSONString(oldInfo,features));
employeeLog.setNewInfo(JSON.toJSONString(newInfo,features));
employeeLog.setDifferenceInfo(differenceKey);
baseMapper.insert(employeeLog);
return employeeLog;
}
}catch (Exception e){
log.error(JSON.toJSON(oldInfo)+"插入修改记录报错>>>",e);
}
return null;
}
private SerializerFeature[] features = new SerializerFeature[] {
WriteMapNullValue, WriteNullNumberAsZero, WriteNullListAsEmpty,
WriteNullStringAsEmpty,WriteDateUseDateFormat
......
package com.yifu.cloud.plus.v1.yifu.archives.utils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
......@@ -77,4 +78,44 @@ public class DoJointTask {
log.info("档案-批量更新人员档案结束");
}
/**
* @Description: 合同-批量更换负责人
* @Author: huyc
* @Date: 2022-7-8
* @return: void
**/
@Async
public void updateFddEmployeeInfo(List<TEmployeeInfo> tEmployeeInfoList, FddContractAttachInfo fddContractAttachInfo) {
log.info("法大大档案-批量更新人员档案-线程开始");
try {
for(TEmployeeInfo tEmployeeInfo:tEmployeeInfoList) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoService.getById(tEmployeeInfo.getId());
//查询该人员所有的项目档案
List<TEmployeeProject> list = tEmployeeProjectService.list(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
if (Common.isNotNull(list)) {
Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ZERO_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ZERO_STRING);
} else if (empNatrue.stream().anyMatch(e -> e.equals(CommonConstants.ONE_STRING))) {
tEmployeeInfo.setEmpNatrue(CommonConstants.ONE_STRING);
} else {
tEmployeeInfo.setEmpNatrue(CommonConstants.TWO_STRING);
}
tEmployeeInfo.setProjectNum(list.size());
} else {
tEmployeeInfo.setProjectNum(CommonConstants.ZERO_INT);
}
tEmployeeInfoService.updateById(tEmployeeInfo);
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0]
, tEmployeeInfo.getId(), "", tEmployeeInfoOld, tEmployeeInfo,fddContractAttachInfo);
}
} catch (Exception e) {
log.error("法大大档案-批量更新人员档案错误", e);
}
log.info("法大大档案-批量更新人员档案结束");
}
}
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