Commit e6e857a5 authored by 李灿灿's avatar 李灿灿

Merge branch 'develop' into feature-licancan

parents 70f7ffd1 905cd3bf
...@@ -174,16 +174,16 @@ public class FddContractAttachInfoController { ...@@ -174,16 +174,16 @@ public class FddContractAttachInfoController {
List<ErrorMessage> errorInfo = fddContractAttachInfoService.batchAdd(util1.getEntityList()); List<ErrorMessage> errorInfo = fddContractAttachInfoService.batchAdd(util1.getEntityList());
Map<String,Object> variableMap = new HashMap<>(); Map<String,Object> variableMap = new HashMap<>();
Map<Integer,Object> map = new HashMap<>(); Map<Integer,Object> map = new HashMap<>();
boolean allExitContract = errorInfo.stream().allMatch(e-> checkInfo(e)); boolean allExitContract = errorInfo.stream().allMatch(e-> e.getMessage().equals("存在“在用”的合同"));
if (allExitContract) { if (allExitContract) {
variableMap.put("allMatch","true"); variableMap.put("allMatch","true");
for (ErrorMessage errorMessage :errorInfo){ for (ErrorMessage errorMessage :errorInfo){
map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2)); map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2));
} }
variableMap.put("data",map); variableMap.put("data",map);
return R.ok(variableMap); return R.ok(variableMap,"存在“在用”的合同");
} }
return new R<>(CommonConstants.dingleDigitIntArray[1], "", errorInfo); return R.failed(errorInfo,"");
} else { } else {
return R.ok(null,"无数据可导入"); return R.ok(null,"无数据可导入");
} }
...@@ -273,9 +273,4 @@ public class FddContractAttachInfoController { ...@@ -273,9 +273,4 @@ public class FddContractAttachInfoController {
List<ErrorMessage> errorInfo = fddContractAttachInfoService.sendTask(entityList); List<ErrorMessage> errorInfo = fddContractAttachInfoService.sendTask(entityList);
return R.ok(errorInfo); return R.ok(errorInfo);
} }
public boolean checkInfo(ErrorMessage errorMessage) {
Set<String> set = errorMessage.getErrors();
return set.stream().allMatch(e-> e.equals("存在“在用”的合同"));
}
} }
...@@ -147,6 +147,7 @@ public class FddController { ...@@ -147,6 +147,7 @@ public class FddController {
@Operation(summary = "异步通知", description = "异步通知") @Operation(summary = "异步通知", description = "异步通知")
@RequestMapping(value = "/notifyUrl") @RequestMapping(value = "/notifyUrl")
public R<String> notifyUrl(HttpServletRequest request, HttpServletResponse response) throws Exception { public R<String> notifyUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
YifuUser user = SecurityUtils.getUser();
checkSign(request); checkSign(request);
String fddEvent = request.getHeader(FDD_EVENT); String fddEvent = request.getHeader(FDD_EVENT);
String fddBizContent = request.getParameter(FDD_BIZ_CONTENT); String fddBizContent = request.getParameter(FDD_BIZ_CONTENT);
...@@ -159,7 +160,6 @@ public class FddController { ...@@ -159,7 +160,6 @@ public class FddController {
if (StringUtils.equals(CommonConstants.TWO_STRING, jsonObject.getString("status"))) { if (StringUtils.equals(CommonConstants.TWO_STRING, jsonObject.getString("status"))) {
//成功 //成功
FddPersonAccount entity = fddPersonAccountService.getById(clientId); FddPersonAccount entity = fddPersonAccountService.getById(clientId);
YifuUser user = SecurityUtils.getUser();
if (entity != null) { if (entity != null) {
entity.setRealStatus(CommonConstants.ONE_STRING); entity.setRealStatus(CommonConstants.ONE_STRING);
entity.setUnionid(unionId); entity.setUnionid(unionId);
...@@ -221,7 +221,7 @@ public class FddController { ...@@ -221,7 +221,7 @@ public class FddController {
e.printStackTrace(); e.printStackTrace();
} }
}); });
return R.ok(null,"success"); return R.ok(null,"成功");
} }
} }
} else if (StringUtils.equals(fddEvent, "sign")) { } else if (StringUtils.equals(fddEvent, "sign")) {
...@@ -254,7 +254,7 @@ public class FddController { ...@@ -254,7 +254,7 @@ public class FddController {
// 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态: // 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态:
if (CommonConstants.TWO_STRING.equals(fddContractInfo.getSendSignStatus()) if (CommonConstants.TWO_STRING.equals(fddContractInfo.getSendSignStatus())
&& CommonConstants.TWO_STRING.equals(fddContractInfo.getReceiveSignStatus())) { && CommonConstants.TWO_STRING.equals(fddContractInfo.getReceiveSignStatus())) {
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo); fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo,user);
TEmployeeContractInfo ec = employeeContractInfoService.getById(fddContractInfo.getContractId()); TEmployeeContractInfo ec = employeeContractInfoService.getById(fddContractInfo.getContractId());
// 如果合同的状态是待电子签,则变更为已电子签 // 如果合同的状态是待电子签,则变更为已电子签
...@@ -263,7 +263,7 @@ public class FddController { ...@@ -263,7 +263,7 @@ public class FddController {
employeeContractInfoService.updateById(ec); employeeContractInfoService.updateById(ec);
} }
} }
return R.ok(null,"success"); return R.ok(null,"成功");
}else if (StringUtils.equals(fddEvent, "notifyUrlVerify")) { }else if (StringUtils.equals(fddEvent, "notifyUrlVerify")) {
return R.ok(null,"success"); return R.ok(null,"success");
} }
......
...@@ -25,8 +25,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo; ...@@ -25,8 +25,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage; import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import java.io.InputStream;
import java.util.List; import java.util.List;
/** /**
...@@ -53,7 +53,7 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach ...@@ -53,7 +53,7 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach
List<ErrorMessage> sendTask(List<FddContractAttachInfo> entityList); List<ErrorMessage> sendTask(List<FddContractAttachInfo> entityList);
R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo); R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo, YifuUser user);
List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList); List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList);
......
...@@ -16,8 +16,6 @@ ...@@ -16,8 +16,6 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.archives.service.impl; package com.yifu.cloud.plus.v1.yifu.archives.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONObject;
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;
...@@ -25,17 +23,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -25,17 +23,17 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants; import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.*; import com.yifu.cloud.plus.v1.yifu.archives.entity.*;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractAttachInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.FddContractAttachInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeContractInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeInfoMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper; import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.*; import com.yifu.cloud.plus.v1.yifu.archives.service.*;
import com.yifu.cloud.plus.v1.yifu.archives.util.IdCardUtil; import com.yifu.cloud.plus.v1.yifu.archives.util.IdCardUtil;
import com.yifu.cloud.plus.v1.yifu.archives.utils.DoJointTask;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.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.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties; import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprUpmsProperties;
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.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
...@@ -47,10 +45,15 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties ...@@ -47,10 +45,15 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cache.Cache; import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager; import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper; import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
...@@ -80,7 +83,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -80,7 +83,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
private TEmployeeProjectMapper tEmployeeProjectMapper; private TEmployeeProjectMapper tEmployeeProjectMapper;
@Autowired @Autowired
private TEmployeeContractInfoService employeeContractInfoService; private TEmployeeContractInfoMapper employeeContractInfoMapper;
@Autowired @Autowired
private TSettleDomainService tSettleDomainService; private TSettleDomainService tSettleDomainService;
...@@ -91,9 +94,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -91,9 +94,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Autowired @Autowired
private FddContractTemplateService fddContractTemplateService; private FddContractTemplateService fddContractTemplateService;
@Autowired
private DaprUpmsProperties daprUpmsProperties;
@Autowired @Autowired
private TEmployeeInfoService employeeInfoService; private TEmployeeInfoService employeeInfoService;
...@@ -107,12 +107,17 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -107,12 +107,17 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Autowired @Autowired
private CacheManager cacheManager; private CacheManager cacheManager;
@Autowired
@Lazy
private DoJointTask doJointTask;
ExecutorService executorService = Executors.newFixedThreadPool(10); ExecutorService executorService = Executors.newFixedThreadPool(10);
public static final String NO_VALID_CONTRACT_FOUND = "未获取到有效在用合同,请确认存在对应姓名、身份证、合同起始时间的合同数据"; public static final String NO_VALID_CONTRACT_FOUND = "未获取到有效在用合同,请确认存在对应姓名、身份证、合同起始时间的合同数据";
/** /**
* 法大大合同附属信息表简单分页查询 * 法大大合同附属信息表简单分页查询
*
* @param fddContractAttachInfo 法大大合同附属信息表 * @param fddContractAttachInfo 法大大合同附属信息表
* @return * @return
*/ */
...@@ -123,6 +128,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -123,6 +128,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
/** /**
* 获取有附属信息但是没有法大大电子合同的数据 * 获取有附属信息但是没有法大大电子合同的数据
*
* @param empIdcard * @param empIdcard
* @return * @return
*/ */
...@@ -175,7 +181,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -175,7 +181,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
try { try {
//如果已经实名发送电子合同 //如果已经实名发送电子合同
FddContractAttachInfo fddContractAttachInfo = this.getById(attachInfo.getId()); FddContractAttachInfo fddContractAttachInfo = this.getById(attachInfo.getId());
R<String> returnR = fddContractInfoService.saveEmpContract(fddContractAttachInfo,user); R<String> returnR = fddContractInfoService.saveEmpContract(fddContractAttachInfo, user);
if (returnR != null) { if (returnR != null) {
//记录返回信息 //记录返回信息
if (returnR.getCode() == CommonConstants.SUCCESS) { if (returnR.getCode() == CommonConstants.SUCCESS) {
...@@ -197,25 +203,28 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -197,25 +203,28 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
} }
/** /**
*
* @Author hyc
* @Date 2022-06-02
* @param fddContractInfo * @param fddContractInfo
* @return R * @return R
* @Author hyc
* @Date 2022-06-02
**/ **/
@Override @Override
@Transactional @Transactional
public R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo) { public R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo,YifuUser user) {
List<TEmployeeInfo> updateList = new ArrayList();
try { try {
FddContractAttachInfo fddContractAttachInfo = this.getOne(Wrappers.<FddContractAttachInfo>query().lambda().eq(FddContractAttachInfo::getContractId, fddContractInfo.getContractId())); FddContractAttachInfo fddContractAttachInfo = this.getOne(Wrappers.<FddContractAttachInfo>query().lambda().eq(FddContractAttachInfo::getContractId, fddContractInfo.getContractId())
.eq(FddContractAttachInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (fddContractAttachInfo != null && fddContractAttachInfo.getContractId().equals(fddContractAttachInfo.getId())) { if (fddContractAttachInfo != null && fddContractAttachInfo.getContractId().equals(fddContractAttachInfo.getId())) {
FddContractTemplate fddContractTemplate = fddContractTemplateService.getOne(Wrappers.<FddContractTemplate>query().lambda() FddContractTemplate fddContractTemplate = fddContractTemplateService.getOne(Wrappers.<FddContractTemplate>query().lambda()
.eq(FddContractTemplate::getId, fddContractInfo.getFddTemplateId())); .eq(FddContractTemplate::getId, fddContractInfo.getFddTemplateId()));
TSettleDomain settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDepartNo, fddContractAttachInfo.getDepartNo())); TSettleDomain settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDepartNo, fddContractAttachInfo.getDepartNo())
TCustomerInfo tCustomerInfo = tCustomerInfoService.getOne(Wrappers.<TCustomerInfo>query().lambda().eq(TCustomerInfo::getId, settleDomain.getCustomerId())); .eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING).eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING));
TCustomerInfo tCustomerInfo = tCustomerInfoService.getOne(Wrappers.<TCustomerInfo>query().lambda().eq(TCustomerInfo::getId, settleDomain.getCustomerId())
.eq(TCustomerInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
//查询项目档案 //查询项目档案
TEmployeeProject tEmployeeProject = employeeProjectMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda().eq(TEmployeeProject::getDeptId, settleDomain.getId()) TEmployeeProject tEmployeeProject = employeeProjectMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeptNo,settleDomain.getDepartNo()) .eq(TEmployeeProject::getDeptNo, settleDomain.getDepartNo())
.eq(TEmployeeProject::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING)); .eq(TEmployeeProject::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING));
//查询人员档案 //查询人员档案
...@@ -228,79 +237,99 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -228,79 +237,99 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
TEmployeeProject tEmployeeProjectCompare = employeeProjectMapper.selectById(tEmployeeProject.getId()); TEmployeeProject tEmployeeProjectCompare = employeeProjectMapper.selectById(tEmployeeProject.getId());
if (CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) { if (CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) {
tEmployeeProject.setProjectStatus(CommonConstants.ZERO_INT); tEmployeeProject.setProjectStatus(CommonConstants.ZERO_INT);
tEmployeeProject.setLeaveReason(CommonConstants.EMPTY_STRING);
tEmployeeProject.setLeaveTime(null);
tEmployeeProject.setLeaveRemark(CommonConstants.EMPTY_STRING);
tEmployeeProject.setLeaveUser(CommonConstants.EMPTY_STRING);
} }
//判断人员档案的状态,如果是减档状态就复档 //判断人员档案的状态,如果是减档状态就复档
TEmployeeInfo tEmployeeInfoCompare = employeeInfoService.getById(tEmployeeProject.getEmpId());
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) { if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) {
tEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT); tEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT);
tEmployeeInfo.setLeaveReason(CommonConstants.EMPTY_STRING);
tEmployeeInfo.setLeaveTime(null);
tEmployeeInfo.setLeaveRemark(CommonConstants.EMPTY_STRING);
tEmployeeInfo.setLeaveUser(CommonConstants.EMPTY_STRING);
tEmployeeInfo.setLeaveUserName(CommonConstants.EMPTY_STRING);
} }
//更新项目档案 //更新项目档案
tEmployeeProject.setEmpNatrue(fddContractTemplate.getType()); tEmployeeProject.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
tEmployeeProject.setPost(fddContractAttachInfo.getPost()); tEmployeeProject.setPost(fddContractAttachInfo.getPost());
tEmployeeProject.setContractStatus(CommonConstants.ONE_INT);
employeeProjectMapper.updateById(tEmployeeProject); employeeProjectMapper.updateById(tEmployeeProject);
//保存操作记录 //保存操作记录
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1],"",tEmployeeProject.getId(),tEmployeeProjectCompare,tEmployeeProject); tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1], "", tEmployeeProject.getId(), tEmployeeProjectCompare, tEmployeeProject);
//更新人员档案 //更新人员档案
tEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone()); tEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
tEmployeeInfo.setEmpNatrue(fddContractTemplate.getType()); tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
employeeInfoService.updateById(tEmployeeInfo); updateList.add(tEmployeeInfo);
//保存操作记录
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],tEmployeeProject.getId(),"",tEmployeeInfoCompare,tEmployeeInfo);
TEmployeeContractInfo employeeContractInfo = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId()) .eq(TEmployeeContractInfo::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
//无可用合同 //无可用合同
if (null == employeeContractInfo) { if (null == employeeContractInfo) {
//新增合同 //新增合同
TEmployeeContractInfo newEmployeeContractInfo = new TEmployeeContractInfo(); TEmployeeContractInfo newEmployeeContractInfo = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo, tEmployeeProject); saveTEmployeeContractInfo(newEmployeeContractInfo, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id //更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo); updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo);
} else { } else {
//已有合同设置状态为不在用 //已有合同设置状态为不在用
employeeContractInfo.setInUse(CommonConstants.ONE_STRING); employeeContractInfo.setInUse(CommonConstants.ONE_STRING);
employeeContractInfoService.updateById(employeeContractInfo); employeeContractInfoMapper.updateById(employeeContractInfo);
//新增合同 //新增合同
TEmployeeContractInfo newEmployeeContractInfo2 = new TEmployeeContractInfo(); TEmployeeContractInfo newEmployeeContractInfo2 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo2, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo, tEmployeeProject); saveTEmployeeContractInfo(newEmployeeContractInfo2, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id //更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo2); updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo2);
} }
doJointTask.doUpdateEmployeeInfo(updateList, user);
} else { } else {
//判断人员档案是否存在,不存在就新增人员档案,存在则判断档案状态,如果是减档就复档 //判断人员档案是否存在,不存在就新增人员档案,存在则判断档案状态,如果是减档就复档
if (Common.isNotNull(tEmployeeInfo)) { if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo employeeInfoCompare = employeeInfoService.getById(tEmployeeProject.getEmpId());
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) { if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) {
tEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT); tEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT);
tEmployeeInfo.setLeaveReason(CommonConstants.EMPTY_STRING);
tEmployeeInfo.setLeaveTime(null);
tEmployeeInfo.setLeaveRemark(CommonConstants.EMPTY_STRING);
tEmployeeInfo.setLeaveUser(CommonConstants.EMPTY_STRING);
tEmployeeInfo.setLeaveUserName(CommonConstants.EMPTY_STRING);
} }
//更新人员档案 //更新人员档案
tEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone()); tEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
tEmployeeInfo.setEmpNatrue(fddContractTemplate.getType()); tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
tEmployeeInfo.setProjectNum(CommonConstants.ONE_INT + employeeInfoCompare.getProjectNum()); updateList.add(tEmployeeInfo);
employeeInfoService.updateById(tEmployeeInfo);
//保存操作记录
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],tEmployeeProject.getId(),"",employeeInfoCompare,tEmployeeInfo);
//新增项目档案 //新增项目档案
TEmployeeProject project = new TEmployeeProject(); TEmployeeProject project = new TEmployeeProject();
saveEmployeeproject(fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo, project); saveEmployeeproject(fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, project);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, project);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
doJointTask.doUpdateEmployeeInfo(updateList, user);
} else { } else {
//新增人员档案 //新增人员档案
TEmployeeInfo newEmployeeInfo = new TEmployeeInfo(); TEmployeeInfo newEmployeeInfo = new TEmployeeInfo();
newEmployeeInfo.setEmpName(fddContractAttachInfo.getEmpName()); newEmployeeInfo.setEmpName(fddContractAttachInfo.getEmpName());
newEmployeeInfo.setEmpIdcard(fddContractAttachInfo.getEmpIdcard()); newEmployeeInfo.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
newEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone()); newEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
newEmployeeInfo.setEmpNatrue(fddContractTemplate.getType()); newEmployeeInfo.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
newEmployeeInfo.setEmpCode(getCode()); newEmployeeInfo.setEmpCode(getCode());
newEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT); newEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT);
newEmployeeInfo.setDeleteFlag(CommonConstants.ZERO_STRING); newEmployeeInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
newEmployeeInfo.setStatus(CommonConstants.ZERO_INT); newEmployeeInfo.setStatus(CommonConstants.ZERO_INT);
newEmployeeInfo.setProjectNum(CommonConstants.ONE_INT); newEmployeeInfo.setProjectNum(CommonConstants.ONE_INT);
newEmployeeInfo.setFileSource(CommonConstants.dingleDigitStrArray[4]); newEmployeeInfo.setFileSource(CommonConstants.dingleDigitStrArray[6]);
newEmployeeInfo.setCreateBy(fddContractAttachInfo.getCreateBy());
newEmployeeInfo.setCreateName(fddContractAttachInfo.getCreateName());
newEmployeeInfo.setUpdateBy(fddContractAttachInfo.getUpdateBy());
newEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard()); Date date = IdCardUtil.getBirthdate(fddContractAttachInfo.getEmpIdcard());
if (null != date) { if (null != date) {
...@@ -313,17 +342,18 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -313,17 +342,18 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新增项目档案 //新增项目档案
TEmployeeProject newTEmpProject = new TEmployeeProject(); TEmployeeProject newTEmpProject = new TEmployeeProject();
saveEmployeeproject(fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo,tCustomerInfo, tEmployeeProject); saveEmployeeproject(fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo, tCustomerInfo, newTEmpProject);
//新增合同 //新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo(); TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo,newTEmpProject); saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo, tCustomerInfo, newTEmpProject);
//更新合同id //更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1); updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
} }
} }
} }
}catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
log.error("保存异常:" + e.getMessage()); log.error("保存异常:" + e.getMessage());
return R.failed("保存异常:" + e.getMessage()); return R.failed("保存异常:" + e.getMessage());
} }
...@@ -333,7 +363,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -333,7 +363,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Override @Override
public List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList) { public List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList) {
List<ErrorMessage> errorList = new ArrayList<>(); List<ErrorMessage> errorList = new ArrayList<>();
Set<String> errorMsg;
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
Map<String, Integer> sameCheck = new HashMap<>(); Map<String, Integer> sameCheck = new HashMap<>();
...@@ -341,38 +370,41 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -341,38 +370,41 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
try { try {
if (null != entityList && !entityList.isEmpty()) { if (null != entityList && !entityList.isEmpty()) {
for (FddContractAttachInfo attachInfo : entityList) { for (FddContractAttachInfo attachInfo : entityList) {
errorMsg = new HashSet<>();
i++; i++;
String sameInfo = attachInfo.getEmpIdcard() + "_" + attachInfo.getDepartNo()
String sameInfo = attachInfo.getEmpNatrue() + "_" + attachInfo.getDepartNo()
+ "_" + attachInfo.getFddTemplateId() + "_" + attachInfo.getContractStart() + "_" + attachInfo.getFddTemplateId() + "_" + attachInfo.getContractStart()
+ "_" + attachInfo.getContractEnd(); + "_" + attachInfo.getContractEnd();
if (sameCheck.get(sameInfo) != null) { if (sameCheck.get(sameInfo) != null) {
errorMsg.add("第" + (i) + "行与第" + sameCheck.get(sameInfo) + "行重复!"); errorList.add(new ErrorMessage(i, "第" + (i) + "行与第" + sameCheck.get(sameInfo) + "行重复!", CommonConstants.RED));
continue;
} else { } else {
sameCheck.put(sameInfo, i); sameCheck.put(sameInfo, i);
} }
//判断计时计件工资必填 //判断计时计件工资必填
if (CommonConstants.ONE_STRING.equals(attachInfo.getSalaryType()) && Common.isEmpty(attachInfo.getSalaryStandardPerHour())) { if (CommonConstants.ONE_STRING.equals(attachInfo.getSalaryType()) && Common.isEmpty(attachInfo.getSalaryStandardPerHour())) {
errorMsg.add("计时工资不能为空"); errorList.add(new ErrorMessage(i, "计时工资不能为空", CommonConstants.RED));
continue;
} }
if (CommonConstants.TWO_STRING.equals(attachInfo.getSalaryType()) && Common.isEmpty(attachInfo.getSalaryStandardPerPiece())) { if (CommonConstants.TWO_STRING.equals(attachInfo.getSalaryType()) && Common.isEmpty(attachInfo.getSalaryStandardPerPiece())) {
errorMsg.add("计件工资不能为空"); errorList.add(new ErrorMessage(i, "计件工资不能为空", CommonConstants.RED));
continue;
} }
//结算主体编码是否准确 //结算主体编码是否准确
TSettleDomain settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDepartNo, attachInfo.getDepartNo()) TSettleDomain settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDepartNo, attachInfo.getDepartNo())
.eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING).eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING)); .eq(TSettleDomain::getDeleteFlag, CommonConstants.ZERO_STRING).eq(TSettleDomain::getStopFlag, CommonConstants.ZERO_STRING));
if (Common.isEmpty(settleDomain)) { if (Common.isEmpty(settleDomain)) {
errorMsg.add("项目编码有误"); errorList.add(new ErrorMessage(i, "项目编码有误", CommonConstants.RED));
} else { continue;
}
//查询员工合同 //查询员工合同
TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda() TEmployeeContractInfo employeeContractInfo = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId()) .eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (employeeContractInfo != null) { if (employeeContractInfo != null) {
long count = this.count(Wrappers.<FddContractAttachInfo>query().lambda().eq(FddContractAttachInfo::getContractId, employeeContractInfo.getId())); long count = this.count(Wrappers.<FddContractAttachInfo>query().lambda().eq(FddContractAttachInfo::getContractId, employeeContractInfo.getId()));
if (count > CommonConstants.ZERO_INT && attachInfo.getContractStart().before(employeeContractInfo.getContractEnd())) { if (count > CommonConstants.ZERO_INT && attachInfo.getContractStart().before(employeeContractInfo.getContractEnd())) {
errorMsg.add("已导入合同相关基础数据"); errorList.add(new ErrorMessage(i, "已导入合同相关基础数据", CommonConstants.RED));
continue;
} }
List<FddContractTemplate> fddContractTemplateList = fddContractTemplateService.list(Wrappers.<FddContractTemplate>query().lambda() List<FddContractTemplate> fddContractTemplateList = fddContractTemplateService.list(Wrappers.<FddContractTemplate>query().lambda()
...@@ -380,13 +412,15 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -380,13 +412,15 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
.eq(FddContractTemplate::getModifyUploadStatus, CommonConstants.dingleDigitStrArray[1])); .eq(FddContractTemplate::getModifyUploadStatus, CommonConstants.dingleDigitStrArray[1]));
//如果模板存在则生成法大大电子合同数据 //如果模板存在则生成法大大电子合同数据
if (fddContractTemplateList.size() == CommonConstants.ZERO_INT) { if (fddContractTemplateList.size() == CommonConstants.ZERO_INT) {
errorMsg.add("未获取到有效的合同模板"); errorList.add(new ErrorMessage(i, "未获取到有效的合同模板", CommonConstants.RED));
continue;
} }
if (fddContractTemplateList.size() != CommonConstants.ONE_INT) { if (fddContractTemplateList.size() != CommonConstants.ONE_INT) {
errorMsg.add("法大大合同有效合同模板存在多条"); errorList.add(new ErrorMessage(i, "法大大合同有效合同模板存在多条", CommonConstants.RED));
continue;
} else { } else {
errorMsg.add("存在“在用”的合同"); errorList.add(new ErrorMessage(i, "存在“在用”的合同", CommonConstants.RED));
} continue;
} }
} }
...@@ -395,13 +429,9 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -395,13 +429,9 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新签 //新签
employeeParamR = fddContractInfoService.generalEmployeeParam(attachInfo, false); employeeParamR = fddContractInfoService.generalEmployeeParam(attachInfo, false);
if (CommonConstants.FAIL == employeeParamR.getCode()) { if (CommonConstants.FAIL == employeeParamR.getCode()) {
errorMsg.add(employeeParamR.getMsg()); errorList.add(new ErrorMessage(i, employeeParamR.getMsg(), CommonConstants.RED));
continue;
} }
// 数据合法情况
if (!CollUtil.isEmpty(errorMsg)) {
// 数据不合法
errorList.add(new ErrorMessage(i, errorMsg));
} else {
//保存合同数据 //保存合同数据
attachInfo.setContractId(CommonConstants.EMPTY_STRING); attachInfo.setContractId(CommonConstants.EMPTY_STRING);
...@@ -451,12 +481,12 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -451,12 +481,12 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
} }
errorList.add(new ErrorMessage(i, "保存成功", CommonConstants.GREEN)); errorList.add(new ErrorMessage(i, "保存成功", CommonConstants.GREEN));
} }
}
} else { } else {
errorList.add(new ErrorMessage(i, "无数据保存")); errorList.add(new ErrorMessage(i, "无数据保存"));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("合同数据批量新增异常" + e.getMessage()); log.error("合同数据批量新增异常" + e.getMessage());
errorList.add(new ErrorMessage(i, "合同数据批量新增异常:" + e.getMessage()));
return errorList; return errorList;
} }
return errorList; return errorList;
...@@ -470,22 +500,22 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -470,22 +500,22 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
if (null != entityList && !entityList.isEmpty()) { if (null != entityList && !entityList.isEmpty()) {
for (FddContractAttachInfo attachInfo : entityList) { for (FddContractAttachInfo attachInfo : entityList) {
//查询员工合同 //查询员工合同
TEmployeeContractInfo employeeContractInfoValid = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda() TEmployeeContractInfo employeeContractInfoValid = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpName, attachInfo.getEmpName()).eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard()) .eq(TEmployeeContractInfo::getEmpName, attachInfo.getEmpName()).eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getIsObsolete,CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getIsObsolete, CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getContractStart, attachInfo.getContractStart())); .eq(TEmployeeContractInfo::getContractStart, attachInfo.getContractStart()));
if(employeeContractInfoValid==null){ if (employeeContractInfoValid == null) {
errorList.add(new ErrorMessage(i, NO_VALID_CONTRACT_FOUND, CommonConstants.RED)); errorList.add(new ErrorMessage(i, NO_VALID_CONTRACT_FOUND, CommonConstants.RED));
continue; continue;
} }
if(StringUtils.equals(CommonConstants.ONE_STRING,employeeContractInfoValid.getContractType())){ if (StringUtils.equals(CommonConstants.ONE_STRING, employeeContractInfoValid.getContractType())) {
if(employeeContractInfoValid.getContractEnd()==null){ if (employeeContractInfoValid.getContractEnd() == null) {
errorList.add(new ErrorMessage(i, "员工合同结束时间为空", CommonConstants.RED)); errorList.add(new ErrorMessage(i, "员工合同结束时间为空", CommonConstants.RED));
continue; continue;
} }
} }
//查询员工合同是否存在 //查询员工合同是否存在
TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda() TEmployeeContractInfo employeeContractInfo = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpName, attachInfo.getEmpName()).eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard()) .eq(TEmployeeContractInfo::getEmpName, attachInfo.getEmpName()).eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING) .eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)
.and(wrapper -> wrapper.and(wrapper2 -> wrapper2.eq(TEmployeeContractInfo::getContractStart, attachInfo.getContractStart()) .and(wrapper -> wrapper.and(wrapper2 -> wrapper2.eq(TEmployeeContractInfo::getContractStart, attachInfo.getContractStart())
...@@ -526,7 +556,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -526,7 +556,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
* @Description: 更新合同id * @Description: 更新合同id
* @return: * @return:
**/ **/
public void updateContractId (FddContractInfo fddContractInfo, FddContractAttachInfo fddContractAttachInfo,TEmployeeContractInfo newEmployeeContractInfo) { public void updateContractId(FddContractInfo fddContractInfo, FddContractAttachInfo fddContractAttachInfo, TEmployeeContractInfo newEmployeeContractInfo) {
//更新合同id //更新合同id
fddContractAttachInfo.setContractId(newEmployeeContractInfo.getId()); fddContractAttachInfo.setContractId(newEmployeeContractInfo.getId());
this.updateById(fddContractAttachInfo); this.updateById(fddContractAttachInfo);
...@@ -547,11 +577,11 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -547,11 +577,11 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
* @Description: 新增合同 * @Description: 新增合同
* @return: * @return:
**/ **/
public void saveTEmployeeContractInfo (TEmployeeContractInfo newEmployeeContractInfo, FddContractAttachInfo fddContractAttachInfo,TSettleDomain settleDomain,FddContractTemplate fddContractTemplate, public void saveTEmployeeContractInfo(TEmployeeContractInfo newEmployeeContractInfo, FddContractAttachInfo fddContractAttachInfo, TSettleDomain settleDomain, FddContractTemplate fddContractTemplate,
TEmployeeInfo tEmployeeInfo, TCustomerInfo tCustomerInfo, TEmployeeProject tEmployeeProject) { TEmployeeInfo tEmployeeInfo, TCustomerInfo tCustomerInfo, TEmployeeProject tEmployeeProject) {
TEmployeeContractInfo employeeContractCount = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda() TEmployeeContractInfo employeeContractCount = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId()) .eq(TEmployeeContractInfo::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING)); .eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_INT));
//合同表里没有在用的合同 //合同表里没有在用的合同
if (null == employeeContractCount) { if (null == employeeContractCount) {
newEmployeeContractInfo.setEmpName(fddContractAttachInfo.getEmpName()); newEmployeeContractInfo.setEmpName(fddContractAttachInfo.getEmpName());
...@@ -574,22 +604,50 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -574,22 +604,50 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
newEmployeeContractInfo.setFileProvince(tEmployeeInfo.getFileProvince()); newEmployeeContractInfo.setFileProvince(tEmployeeInfo.getFileProvince());
newEmployeeContractInfo.setFileTown(tEmployeeInfo.getFileTown()); newEmployeeContractInfo.setFileTown(tEmployeeInfo.getFileTown());
newEmployeeContractInfo.setInUse(CommonConstants.ZERO_STRING); newEmployeeContractInfo.setInUse(CommonConstants.ZERO_STRING);
newEmployeeContractInfo.setIsSign(CommonConstants.dingleDigitIntArray[1]);
//远程接口传参 newEmployeeContractInfo.setAuditStatus(CommonConstants.dingleDigitIntArray[2]);
JSONObject jsonObject = new JSONObject(); newEmployeeContractInfo.setAuditTimeLast(LocalDateTime.now());
jsonObject.put("value",fddContractTemplate.getType()); newEmployeeContractInfo.setCustomerId(tCustomerInfo.getId());
jsonObject.put("type","personnel_type"); newEmployeeContractInfo.setDeptNo(fddContractAttachInfo.getDepartNo());
R<String> res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId() newEmployeeContractInfo.setUnitNo(tCustomerInfo.getCustomerCode());
, "/dict/inner/getLableFronValue", jsonObject, Map.class, SecurityConstants.FROM_IN); newEmployeeContractInfo.setFddFlag(CommonConstants.ONE_STRING);
if (res != null) { newEmployeeContractInfo.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
//电子合同模板对应的“员工类型” newEmployeeContractInfo.setCreateBy(fddContractAttachInfo.getCreateBy());
newEmployeeContractInfo.setContractName(res.getData()); newEmployeeContractInfo.setCreateName(fddContractAttachInfo.getCreateName());
} else { newEmployeeContractInfo.setUpdateBy(fddContractAttachInfo.getUpdateBy());
newEmployeeContractInfo.setContractName(""); if (Common.isNotNull(fddContractAttachInfo.getPeriodStart())) {
} newEmployeeContractInfo.setPeriodStart(localDate2Date(fddContractAttachInfo.getPeriodStart()));
//设置状态为在用 }
newEmployeeContractInfo.setInUse(CommonConstants.ONE_STRING); if (Common.isNotNull(fddContractAttachInfo.getPeriodEnd())) {
employeeContractInfoService.save(newEmployeeContractInfo); newEmployeeContractInfo.setPeriodEnd(localDate2Date(fddContractAttachInfo.getPeriodEnd()));
}
if (Common.isNotNull(fddContractAttachInfo.getPeriodSalaryPerMonth())) {
newEmployeeContractInfo.setPeriodSalaryPerMonth(fddContractAttachInfo.getPeriodSalaryPerMonth());
}
newEmployeeContractInfo.setSalaryType(fddContractAttachInfo.getSalaryType());
if (Common.isNotNull(fddContractAttachInfo.getSalaryStandardPerHour())) {
newEmployeeContractInfo.setSalaryStandardPerHour(fddContractAttachInfo.getSalaryStandardPerHour());
}
if (Common.isNotNull(fddContractAttachInfo.getSalaryStandardPerPiece())) {
newEmployeeContractInfo.setSalaryStandardPerPiece(fddContractAttachInfo.getSalaryStandardPerPiece());
}
String contractName = "";
// 渲染字典值
Map<String, String> dicObj = (Map<String, String>) RedisUtil.redis.opsForValue()
.get(CacheConstants.DICT_DETAILS
+ CommonConstants.COLON_STRING
+ "personnel_type");
if (Common.isNotNull(dicObj)) {
contractName = dicObj.get(fddContractTemplate.getType());
}
newEmployeeContractInfo.setContractName(contractName);
int monthDiff = DateUtil.getMonthDiff(fddContractAttachInfo.getContractStart(), fddContractAttachInfo.getContractEnd());
BigDecimal b = new BigDecimal(String.valueOf(monthDiff / 12.0));
b = b.setScale(1, BigDecimal.ROUND_HALF_UP);
newEmployeeContractInfo.setContractTerm(String.valueOf(b));
newEmployeeContractInfo.setApplyNo(this.getSqCode());
employeeContractInfoMapper.insert(newEmployeeContractInfo);
} }
} }
...@@ -605,11 +663,11 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -605,11 +663,11 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
* @Description: 新增项目档案 * @Description: 新增项目档案
* @return: * @return:
**/ **/
public void saveEmployeeproject(FddContractAttachInfo fddContractAttachInfo,TSettleDomain settleDomain,FddContractTemplate fddContractTemplate, public void saveEmployeeproject(FddContractAttachInfo fddContractAttachInfo, TSettleDomain settleDomain, FddContractTemplate fddContractTemplate,
TEmployeeInfo newEmployeeInfo, TCustomerInfo tCustomerInfo, TEmployeeProject newTEmpProject) { TEmployeeInfo newEmployeeInfo, TCustomerInfo tCustomerInfo, TEmployeeProject newTEmpProject) {
//新增项目档案 //新增项目档案
newTEmpProject.setEmpName(fddContractAttachInfo.getEmpName()); newTEmpProject.setEmpName(fddContractAttachInfo.getEmpName());
newTEmpProject.setEmpId(newEmployeeInfo.getId());
newTEmpProject.setEmpIdcard(fddContractAttachInfo.getEmpIdcard()); newTEmpProject.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
newTEmpProject.setEmpPhone(fddContractAttachInfo.getEmpPhone()); newTEmpProject.setEmpPhone(fddContractAttachInfo.getEmpPhone());
newTEmpProject.setDeptId(settleDomain.getId()); newTEmpProject.setDeptId(settleDomain.getId());
...@@ -621,9 +679,16 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -621,9 +679,16 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
newTEmpProject.setUnitNo(tCustomerInfo.getCustomerCode()); newTEmpProject.setUnitNo(tCustomerInfo.getCustomerCode());
newTEmpProject.setContractType(fddContractTemplate.getType()); newTEmpProject.setContractType(fddContractTemplate.getType());
newTEmpProject.setStatus(CommonConstants.dingleDigitIntArray[0]); newTEmpProject.setStatus(CommonConstants.dingleDigitIntArray[0]);
newTEmpProject.setPost(fddContractAttachInfo.getPost()); newTEmpProject.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
newTEmpProject.setEmpNatrue(newEmployeeInfo.getEmpNatrue());
newTEmpProject.setEmpCode(newEmployeeInfo.getEmpCode()); newTEmpProject.setEmpCode(newEmployeeInfo.getEmpCode());
newTEmpProject.setBusinessPrimaryType(settleDomain.getBusinessPrimaryType());
newTEmpProject.setBusinessSecondType(settleDomain.getBusinessSecondType());
newTEmpProject.setBusinessThirdType(settleDomain.getBusinessThirdType());
newTEmpProject.setProjectSource(CommonConstants.dingleDigitStrArray[7]);
newTEmpProject.setContractStatus(CommonConstants.ONE_INT);
newTEmpProject.setCreateBy(fddContractAttachInfo.getCreateBy());
newTEmpProject.setCreateName(fddContractAttachInfo.getCreateName());
newTEmpProject.setUpdateBy(fddContractAttachInfo.getUpdateBy());
String empNO = ""; String empNO = "";
empNO = getEmpNo(newTEmpProject.getDeptNo()); empNO = getEmpNo(newTEmpProject.getDeptNo());
newTEmpProject.setEmpNo(empNO); newTEmpProject.setEmpNo(empNO);
...@@ -673,4 +738,56 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt ...@@ -673,4 +738,56 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
return zeroArr[num] + nowNums; return zeroArr[num] + nowNums;
} }
/**
* @param
* @Description: 获取 申请编码
* @Author: hgw
* @Date: 2022/6/22 17:52
* @return: java.lang.String
**/
private synchronized String getSqCode() {
String nowDay = DateUtil.getThisDay();
Cache cache = cacheManager.getCache(CacheConstants.EVERYDAY_EMP_CONTRACT_CODE);
Object nowNumObj = cache.get(nowDay);
int nowNums = 1;
if (Common.isNotNull(nowNumObj)) {
SimpleValueWrapper value = (SimpleValueWrapper) nowNumObj;
nowNums = (Integer) value.get() + 1;
} else {
String empCode = null;
try {
empCode = employeeContractInfoMapper.getMaxContractCode();
nowNums = Integer.parseInt(empCode) + 1;
} catch (NumberFormatException e) {
log.error("获取人员合同当日最大编码时出错:" + empCode);
nowNums = 1;
}
}
cache.put(nowDay, nowNums);
return "HT" + nowDay + this.getFourNum(String.valueOf(nowNums));
}
/**
* @param nowNums 数字
* @Description: 获取四位字符型数字
* @Author: hgw
* @Date: 2022-6-30 16:05:25
* @return: 五位字符型数字
**/
private String getFourNum(String nowNums) {
if (nowNums.length() >= 4) {
return nowNums.substring(0, 4);
}
String[] zeroArr = {"0", "00", "000"};
int num = 3 - nowNums.length();
return zeroArr[num] + nowNums;
}
public static Date localDate2Date(LocalDate localDate) {
if (null == localDate) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}
} }
...@@ -74,6 +74,7 @@ import java.io.IOException; ...@@ -74,6 +74,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.*; import java.util.*;
...@@ -118,9 +119,16 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe ...@@ -118,9 +119,16 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
private OSSUtil ossUtil; private OSSUtil ossUtil;
@Autowired @Autowired
private TSettleDomainService tSettleDomainService; private TSettleDomainService tSettleDomainService;
@Autowired
private TAttaInfoService tAttaInfoService;
@Override @Override
public R<String> saveEmpContract(FddContractAttachInfo fddContractAttachInfo,YifuUser user) throws ApiException { public R<String> saveEmpContract(FddContractAttachInfo fddContractAttachInfo,YifuUser user) throws ApiException {
long haveFddConCount = this.count(Wrappers.<FddContractInfo>query().lambda().eq(FddContractInfo::getContractId, fddContractAttachInfo.getContractId())
.eq(FddContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (haveFddConCount > CommonConstants.ZERO_INT) {
return R.failed("已存在法大大电子合同");
}
if (!user.getId().equals(fddContractAttachInfo.getCreateBy())) { if (!user.getId().equals(fddContractAttachInfo.getCreateBy())) {
return R.failed("当前用户不是电子合同导入用户,不能操作"); return R.failed("当前用户不是电子合同导入用户,不能操作");
} }
...@@ -576,17 +584,25 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe ...@@ -576,17 +584,25 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
String key = name + ".zip"; String key = name + ".zip";
ossUtil.uploadFileByStream(bis, key, null); ossUtil.uploadFileByStream(bis, key, null);
// 1:保存为 // 1:保存为
// TEmpAtta empAtta = BasicServiceUtil.initTEmpAttaForInsert(name, key, (long) rspData.getFileBytes().length); TAttaInfo attaInfo = initUnitAttaForInsert(name, key, (long)rspData.getFileBytes().length);
// empAttaService.save(empAtta); attaInfo.setRelationType(CommonConstants.FOUR_STRING);
// MEmpContractAtta contractAtta = new MEmpContractAtta(); attaInfo.setDomainId(fddContractInfo.getId());
// contractAtta.setAttaId(empAtta.getId()); tAttaInfoService.save(attaInfo);
// contractAtta.setContractId(employeeContractInfo.getId());
// mempContractAttaService.save(contractAtta);
FddContractAttachInfo fddContractAttachInfo = fddContractAttachInfoMapper.selectOne(Wrappers.<FddContractAttachInfo>query().lambda() FddContractAttachInfo fddContractAttachInfo = fddContractAttachInfoMapper.selectOne(Wrappers.<FddContractAttachInfo>query().lambda()
.eq(FddContractAttachInfo::getContractId,entity.getContractId()).last(CommonConstants.LAST_ONE_SQL)); .eq(FddContractAttachInfo::getContractId,entity.getContractId()).last(CommonConstants.LAST_ONE_SQL));
if (fddContractAttachInfo != null) { if (fddContractAttachInfo != null) {
fddContractAttachInfo.setIsMove(CommonConstants.ONE_INT); fddContractAttachInfo.setIsMove(CommonConstants.ONE_INT);
fddContractAttachInfoMapper.updateById(fddContractAttachInfo); fddContractAttachInfoMapper.updateById(fddContractAttachInfo);
TEmployeeContractInfo tEmployeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getId,fddContractAttachInfo.getContractId())
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
employeeContractInfoService.updateById(tEmployeeContractInfo);
} }
return R.ok(); return R.ok();
} finally { } finally {
...@@ -921,4 +937,24 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe ...@@ -921,4 +937,24 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
return R.failed(rsp.getMsg()); return R.failed(rsp.getMsg());
} }
} }
/**
* 对象初始化
* @param fileName
* @param key
* @param fileSize
* @return
*/
private TAttaInfo initUnitAttaForInsert(String fileName, String key, long fileSize) {
TAttaInfo unitAtta = new TAttaInfo();
char point = '.';
unitAtta.setAttaName(fileName);
unitAtta.setAttaSize(fileSize);
unitAtta.setAttaSrc(key);
if (key.lastIndexOf(point) >= 0) {
unitAtta.setAttaType(key.substring(key.lastIndexOf(point)));
}
unitAtta.setCreateTime(LocalDateTime.now());
return unitAtta;
}
} }
...@@ -437,7 +437,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -437,7 +437,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
tEmployeeProjectService.updateById(tEmployeeProject); tEmployeeProjectService.updateById(tEmployeeProject);
} }
// 更新档案、项目合同状态为(1在用) // 更新档案、项目合同状态为(1在用)
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeContractInfo.getEmpId()); TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(contractInfo.getEmpId());
if (tEmployeeInfo != null) { if (tEmployeeInfo != null) {
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT); tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
tEmployeeInfoService.updateById(tEmployeeInfo); tEmployeeInfoService.updateById(tEmployeeInfo);
...@@ -457,7 +457,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr ...@@ -457,7 +457,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
} }
// 更新档案、项目合同状态为(0无合同 1在用 2不在用) // 更新档案、项目合同状态为(0无合同 1在用 2不在用)
TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(tEmployeeContractInfo.getEmpId()); TEmployeeInfo tEmployeeInfo = tEmployeeInfoService.getById(contractInfo.getEmpId());
if (tEmployeeInfo != null) { if (tEmployeeInfo != null) {
// 判断人员有无审核通过的其他合同 // 判断人员有无审核通过的其他合同
TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query() TEmployeeContractInfo contractInfoInUse = this.getOne(Wrappers.<TEmployeeContractInfo>query()
......
...@@ -119,6 +119,6 @@ ...@@ -119,6 +119,6 @@
1=1 1=1
<include refid="fddPersonAccount_where"/> <include refid="fddPersonAccount_where"/>
</where> </where>
GROUP BY a.ID_CARD ORDER BY a.CREATE_TIME desc GROUP BY a.ID_CARD,a.MOBLIE ORDER BY a.CREATE_TIME desc
</select> </select>
</mapper> </mapper>
...@@ -124,6 +124,8 @@ public interface CommonConstants { ...@@ -124,6 +124,8 @@ public interface CommonConstants {
String FOUR_STRING = "4"; String FOUR_STRING = "4";
String FIVE_STRING = "5";
/** /**
* number 0 * number 0
*/ */
......
package com.yifu.cloud.plus.v1.yifu.common.core.util; package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants; 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.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute; import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
...@@ -950,4 +951,23 @@ public class ExcelUtil <T> implements Serializable { ...@@ -950,4 +951,23 @@ public class ExcelUtil <T> implements Serializable {
this.setErrorInfo(errorList); this.setErrorInfo(errorList);
this.setErrorMessageHashMap(errorMessageHashMap); this.setErrorMessageHashMap(errorMessageHashMap);
} }
/**
* @param clazz
* @Author: wangan
* @Date: 2020/9/28
* @Description: 获取导出中文字段
* @return: com.yifu.cloud.v1.common.core.util.R
**/
public static R<List<String>> getExportfieldsName(Class<?> clazz){
ArrayList<String> exportfieldsName = Lists.newArrayList();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
ExcelAttribute annotation = field.getAnnotation(ExcelAttribute.class);
if (annotation != null && Common.isNotNull(annotation.name()) && annotation.needExport()) {
exportfieldsName.add(annotation.name());
}
}
return R.ok(exportfieldsName,"成功");
}
} }
...@@ -149,6 +149,11 @@ public class LocalDateUtil { ...@@ -149,6 +149,11 @@ public class LocalDateUtil {
return flag; return flag;
} }
//获取指定时间的指定格式
public static String formatTime(LocalDate time, String pattern) {
return time.format(DateTimeFormatter.ofPattern(pattern));
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(isCurrentOrFutureMonth("2023-1")); System.out.println(isCurrentOrFutureMonth("2023-1"));
} }
......
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