Commit 905cd3bf authored by huyuchen's avatar huyuchen

fdd 代码修改

parent f469fcf2
......@@ -174,16 +174,16 @@ public class FddContractAttachInfoController {
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-> checkInfo(e));
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("data",map);
return R.ok(variableMap);
return R.ok(variableMap,"存在“在用”的合同");
}
return new R<>(CommonConstants.dingleDigitIntArray[1], "", errorInfo);
return R.failed(errorInfo,"");
} else {
return R.ok(null,"无数据可导入");
}
......@@ -273,9 +273,4 @@ public class FddContractAttachInfoController {
List<ErrorMessage> errorInfo = fddContractAttachInfoService.sendTask(entityList);
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 {
@Operation(summary = "异步通知", description = "异步通知")
@RequestMapping(value = "/notifyUrl")
public R<String> notifyUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
YifuUser user = SecurityUtils.getUser();
checkSign(request);
String fddEvent = request.getHeader(FDD_EVENT);
String fddBizContent = request.getParameter(FDD_BIZ_CONTENT);
......@@ -159,7 +160,6 @@ public class FddController {
if (StringUtils.equals(CommonConstants.TWO_STRING, jsonObject.getString("status"))) {
//成功
FddPersonAccount entity = fddPersonAccountService.getById(clientId);
YifuUser user = SecurityUtils.getUser();
if (entity != null) {
entity.setRealStatus(CommonConstants.ONE_STRING);
entity.setUnionid(unionId);
......@@ -221,7 +221,7 @@ public class FddController {
e.printStackTrace();
}
});
return R.ok(null,"success");
return R.ok(null,"成功");
}
}
} else if (StringUtils.equals(fddEvent, "sign")) {
......@@ -254,7 +254,7 @@ public class FddController {
// 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态:
if (CommonConstants.TWO_STRING.equals(fddContractInfo.getSendSignStatus())
&& CommonConstants.TWO_STRING.equals(fddContractInfo.getReceiveSignStatus())) {
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo);
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo,user);
TEmployeeContractInfo ec = employeeContractInfoService.getById(fddContractInfo.getContractId());
// 如果合同的状态是待电子签,则变更为已电子签
......@@ -263,7 +263,7 @@ public class FddController {
employeeContractInfoService.updateById(ec);
}
}
return R.ok(null,"success");
return R.ok(null,"成功");
}else if (StringUtils.equals(fddEvent, "notifyUrlVerify")) {
return R.ok(null,"success");
}
......
......@@ -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.common.core.util.ErrorMessage;
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;
/**
......@@ -53,7 +53,7 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach
List<ErrorMessage> sendTask(List<FddContractAttachInfo> entityList);
R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo);
R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo, YifuUser user);
List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList);
......
......@@ -16,8 +16,6 @@
*/
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.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -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.entity.*;
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.TEmployeeProjectMapper;
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.utils.DoJointTask;
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.DaprUpmsProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.HttpDaprUtil;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
......@@ -47,10 +45,15 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
......@@ -80,7 +83,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
private TEmployeeProjectMapper tEmployeeProjectMapper;
@Autowired
private TEmployeeContractInfoService employeeContractInfoService;
private TEmployeeContractInfoMapper employeeContractInfoMapper;
@Autowired
private TSettleDomainService tSettleDomainService;
......@@ -91,9 +94,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Autowired
private FddContractTemplateService fddContractTemplateService;
@Autowired
private DaprUpmsProperties daprUpmsProperties;
@Autowired
private TEmployeeInfoService employeeInfoService;
......@@ -107,12 +107,17 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Autowired
private CacheManager cacheManager;
@Autowired
@Lazy
private DoJointTask doJointTask;
ExecutorService executorService = Executors.newFixedThreadPool(10);
public static final String NO_VALID_CONTRACT_FOUND = "未获取到有效在用合同,请确认存在对应姓名、身份证、合同起始时间的合同数据";
/**
* 法大大合同附属信息表简单分页查询
*
* @param fddContractAttachInfo 法大大合同附属信息表
* @return
*/
......@@ -123,6 +128,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
/**
* 获取有附属信息但是没有法大大电子合同的数据
*
* @param empIdcard
* @return
*/
......@@ -175,7 +181,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
try {
//如果已经实名发送电子合同
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.getCode() == CommonConstants.SUCCESS) {
......@@ -197,25 +203,28 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
}
/**
*
* @Author hyc
* @Date 2022-06-02
* @param fddContractInfo
* @return R
* @Author hyc
* @Date 2022-06-02
**/
@Override
@Transactional
public R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo) {
public R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo,YifuUser user) {
List<TEmployeeInfo> updateList = new ArrayList();
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())) {
FddContractTemplate fddContractTemplate = fddContractTemplateService.getOne(Wrappers.<FddContractTemplate>query().lambda()
.eq(FddContractTemplate::getId, fddContractInfo.getFddTemplateId()));
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()));
TSettleDomain settleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda().eq(TSettleDomain::getDepartNo, fddContractAttachInfo.getDepartNo())
.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())
.eq(TEmployeeProject::getDeptNo,settleDomain.getDepartNo())
TEmployeeProject tEmployeeProject = employeeProjectMapper.selectOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getDeptNo, settleDomain.getDepartNo())
.eq(TEmployeeProject::getEmpIdcard, fddContractAttachInfo.getEmpIdcard()).eq(TEmployeeProject::getDeleteFlag, CommonConstants.ZERO_STRING));
//查询人员档案
......@@ -228,79 +237,99 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
TEmployeeProject tEmployeeProjectCompare = employeeProjectMapper.selectById(tEmployeeProject.getId());
if (CommonConstants.ONE_INT == tEmployeeProject.getProjectStatus()) {
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()) {
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.setContractStatus(CommonConstants.ONE_INT);
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.setEmpNatrue(fddContractTemplate.getType());
employeeInfoService.updateById(tEmployeeInfo);
//保存操作记录
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],tEmployeeProject.getId(),"",tEmployeeInfoCompare,tEmployeeInfo);
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
updateList.add(tEmployeeInfo);
TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda()
TEmployeeContractInfo employeeContractInfo = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.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) {
//新增合同
TEmployeeContractInfo newEmployeeContractInfo = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo, tEmployeeProject);
saveTEmployeeContractInfo(newEmployeeContractInfo, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo);
} else {
//已有合同设置状态为不在用
employeeContractInfo.setInUse(CommonConstants.ONE_STRING);
employeeContractInfoService.updateById(employeeContractInfo);
employeeContractInfoMapper.updateById(employeeContractInfo);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo2 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo2, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo, tEmployeeProject);
saveTEmployeeContractInfo(newEmployeeContractInfo2, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo, tCustomerInfo, tEmployeeProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo2);
}
doJointTask.doUpdateEmployeeInfo(updateList, user);
} else {
//判断人员档案是否存在,不存在就新增人员档案,存在则判断档案状态,如果是减档就复档
if (Common.isNotNull(tEmployeeInfo)) {
TEmployeeInfo employeeInfoCompare = employeeInfoService.getById(tEmployeeProject.getEmpId());
if (CommonConstants.ONE_INT == tEmployeeInfo.getFileStatus()) {
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.setEmpNatrue(fddContractTemplate.getType());
tEmployeeInfo.setProjectNum(CommonConstants.ONE_INT + employeeInfoCompare.getProjectNum());
employeeInfoService.updateById(tEmployeeInfo);
//保存操作记录
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[0],tEmployeeProject.getId(),"",employeeInfoCompare,tEmployeeInfo);
tEmployeeInfo.setContractStatus(CommonConstants.ONE_INT);
updateList.add(tEmployeeInfo);
//新增项目档案
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 {
//新增人员档案
TEmployeeInfo newEmployeeInfo = new TEmployeeInfo();
newEmployeeInfo.setEmpName(fddContractAttachInfo.getEmpName());
newEmployeeInfo.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
newEmployeeInfo.setEmpPhone(fddContractAttachInfo.getEmpPhone());
newEmployeeInfo.setEmpNatrue(fddContractTemplate.getType());
newEmployeeInfo.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
newEmployeeInfo.setEmpCode(getCode());
newEmployeeInfo.setFileStatus(CommonConstants.ZERO_INT);
newEmployeeInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
newEmployeeInfo.setStatus(CommonConstants.ZERO_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());
if (null != date) {
......@@ -313,17 +342,18 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新增项目档案
TEmployeeProject newTEmpProject = new TEmployeeProject();
saveEmployeeproject(fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo,tCustomerInfo, tEmployeeProject);
saveEmployeeproject(fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo, tCustomerInfo, newTEmpProject);
//新增合同
TEmployeeContractInfo newEmployeeContractInfo1 = new TEmployeeContractInfo();
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, tEmployeeInfo,tCustomerInfo,newTEmpProject);
saveTEmployeeContractInfo(newEmployeeContractInfo1, fddContractAttachInfo, settleDomain, fddContractTemplate, newEmployeeInfo, tCustomerInfo, newTEmpProject);
//更新合同id
updateContractId(fddContractInfo, fddContractAttachInfo, newEmployeeContractInfo1);
}
}
}
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
log.error("保存异常:" + e.getMessage());
return R.failed("保存异常:" + e.getMessage());
}
......@@ -333,7 +363,6 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
@Override
public List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList) {
List<ErrorMessage> errorList = new ArrayList<>();
Set<String> errorMsg;
YifuUser user = SecurityUtils.getUser();
Map<String, Integer> sameCheck = new HashMap<>();
......@@ -341,52 +370,57 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
try {
if (null != entityList && !entityList.isEmpty()) {
for (FddContractAttachInfo attachInfo : entityList) {
errorMsg = new HashSet<>();
i++;
String sameInfo = attachInfo.getEmpNatrue() + "_" + attachInfo.getDepartNo()
String sameInfo = attachInfo.getEmpIdcard() + "_" + attachInfo.getDepartNo()
+ "_" + attachInfo.getFddTemplateId() + "_" + attachInfo.getContractStart()
+ "_" + attachInfo.getContractEnd();
if (sameCheck.get(sameInfo) != null) {
errorMsg.add("第" + (i) + "行与第" + sameCheck.get(sameInfo) + "行重复!");
errorList.add(new ErrorMessage(i, "第" + (i) + "行与第" + sameCheck.get(sameInfo) + "行重复!", CommonConstants.RED));
continue;
} else {
sameCheck.put(sameInfo, i);
}
//判断计时计件工资必填
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())) {
errorMsg.add("计件工资不能为空");
errorList.add(new ErrorMessage(i, "计件工资不能为空", CommonConstants.RED));
continue;
}
//结算主体编码是否准确
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));
if (Common.isEmpty(settleDomain)) {
errorMsg.add("项目编码有误");
} else {
//查询员工合同
TEmployeeContractInfo employeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (employeeContractInfo != null) {
long count = this.count(Wrappers.<FddContractAttachInfo>query().lambda().eq(FddContractAttachInfo::getContractId, employeeContractInfo.getId()));
if (count > CommonConstants.ZERO_INT && attachInfo.getContractStart().before(employeeContractInfo.getContractEnd())) {
errorMsg.add("已导入合同相关基础数据");
}
errorList.add(new ErrorMessage(i, "项目编码有误", CommonConstants.RED));
continue;
}
//查询员工合同
TEmployeeContractInfo employeeContractInfo = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getEmpIdcard, attachInfo.getEmpIdcard()).eq(TEmployeeContractInfo::getSettleDomain, settleDomain.getId())
.eq(TEmployeeContractInfo::getInUse, CommonConstants.ZERO_STRING).eq(TEmployeeContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (employeeContractInfo != null) {
long count = this.count(Wrappers.<FddContractAttachInfo>query().lambda().eq(FddContractAttachInfo::getContractId, employeeContractInfo.getId()));
if (count > CommonConstants.ZERO_INT && attachInfo.getContractStart().before(employeeContractInfo.getContractEnd())) {
errorList.add(new ErrorMessage(i, "已导入合同相关基础数据", CommonConstants.RED));
continue;
}
List<FddContractTemplate> fddContractTemplateList = fddContractTemplateService.list(Wrappers.<FddContractTemplate>query().lambda()
.eq(FddContractTemplate::getFddTemplateId, attachInfo.getFddTemplateId())
.eq(FddContractTemplate::getModifyUploadStatus, CommonConstants.dingleDigitStrArray[1]));
//如果模板存在则生成法大大电子合同数据
if (fddContractTemplateList.size() == CommonConstants.ZERO_INT) {
errorMsg.add("未获取到有效的合同模板");
}
if (fddContractTemplateList.size() != CommonConstants.ONE_INT) {
errorMsg.add("法大大合同有效合同模板存在多条");
} else {
errorMsg.add("存在“在用”的合同");
}
List<FddContractTemplate> fddContractTemplateList = fddContractTemplateService.list(Wrappers.<FddContractTemplate>query().lambda()
.eq(FddContractTemplate::getFddTemplateId, attachInfo.getFddTemplateId())
.eq(FddContractTemplate::getModifyUploadStatus, CommonConstants.dingleDigitStrArray[1]));
//如果模板存在则生成法大大电子合同数据
if (fddContractTemplateList.size() == CommonConstants.ZERO_INT) {
errorList.add(new ErrorMessage(i, "未获取到有效的合同模板", CommonConstants.RED));
continue;
}
if (fddContractTemplateList.size() != CommonConstants.ONE_INT) {
errorList.add(new ErrorMessage(i, "法大大合同有效合同模板存在多条", CommonConstants.RED));
continue;
} else {
errorList.add(new ErrorMessage(i, "存在“在用”的合同", CommonConstants.RED));
continue;
}
}
......@@ -395,68 +429,64 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
//新签
employeeParamR = fddContractInfoService.generalEmployeeParam(attachInfo, false);
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.setCreateTime(LocalDateTime.now());
//保存数据
this.save(attachInfo);
attachInfo.setContractId(attachInfo.getId());
this.updateById(attachInfo);
//判断员工是否有实名数据,如果没有插入是实名数据
long fddPersonCount = fddPersonAccountService.count(Wrappers.<FddPersonAccount>query().lambda().eq(FddPersonAccount::getMoblie, attachInfo.getEmpPhone())
.eq(FddPersonAccount::getIdCard, attachInfo.getEmpIdcard()).eq(FddPersonAccount::getName, attachInfo.getEmpName())
.eq(FddPersonAccount::getSystemFlag, CommonConstants.ONE_STRING));
if (fddPersonCount == CommonConstants.ZERO_INT) {
FddPersonAccount fddPersonAccount = new FddPersonAccount();
fddPersonAccount.setMoblie(attachInfo.getEmpPhone());
fddPersonAccount.setName(attachInfo.getEmpName());
fddPersonAccount.setIdCard(attachInfo.getEmpIdcard());
fddPersonAccount.setSystemFlag(CommonConstants.ONE_STRING);
fddPersonAccount.setRealStatus(CommonConstants.ZERO_STRING);
fddPersonAccountService.save(fddPersonAccount);
executorService.submit(() -> {
try {
fddPersonAccountService.sendAuthMessage(fddPersonAccount.getId());
} catch (Exception e) {
log.error("执行异常", e);
}
});
} else {
executorService.submit(() -> {
try {
//如果已经实名发送电子合同
FddContractAttachInfo fddContractAttachInfo = this.getById(attachInfo.getId());
R<String> returnR = fddContractInfoService.saveEmpContract(fddContractAttachInfo, user);
if (returnR != null) {
//记录返回信息
if (returnR.getCode() == CommonConstants.SUCCESS) {
fddContractAttachInfo.setRemark("成功");
} else {
fddContractAttachInfo.setRemark(returnR.getMsg());
}
this.updateById(fddContractAttachInfo);
//保存合同数据
attachInfo.setContractId(CommonConstants.EMPTY_STRING);
attachInfo.setCreateTime(LocalDateTime.now());
//保存数据
this.save(attachInfo);
attachInfo.setContractId(attachInfo.getId());
this.updateById(attachInfo);
//判断员工是否有实名数据,如果没有插入是实名数据
long fddPersonCount = fddPersonAccountService.count(Wrappers.<FddPersonAccount>query().lambda().eq(FddPersonAccount::getMoblie, attachInfo.getEmpPhone())
.eq(FddPersonAccount::getIdCard, attachInfo.getEmpIdcard()).eq(FddPersonAccount::getName, attachInfo.getEmpName())
.eq(FddPersonAccount::getSystemFlag, CommonConstants.ONE_STRING));
if (fddPersonCount == CommonConstants.ZERO_INT) {
FddPersonAccount fddPersonAccount = new FddPersonAccount();
fddPersonAccount.setMoblie(attachInfo.getEmpPhone());
fddPersonAccount.setName(attachInfo.getEmpName());
fddPersonAccount.setIdCard(attachInfo.getEmpIdcard());
fddPersonAccount.setSystemFlag(CommonConstants.ONE_STRING);
fddPersonAccount.setRealStatus(CommonConstants.ZERO_STRING);
fddPersonAccountService.save(fddPersonAccount);
executorService.submit(() -> {
try {
fddPersonAccountService.sendAuthMessage(fddPersonAccount.getId());
} catch (Exception e) {
log.error("执行异常", e);
}
});
} else {
executorService.submit(() -> {
try {
//如果已经实名发送电子合同
FddContractAttachInfo fddContractAttachInfo = this.getById(attachInfo.getId());
R<String> returnR = fddContractInfoService.saveEmpContract(fddContractAttachInfo, user);
if (returnR != null) {
//记录返回信息
if (returnR.getCode() == CommonConstants.SUCCESS) {
fddContractAttachInfo.setRemark("成功");
} else {
fddContractAttachInfo.setRemark(returnR.getMsg());
}
} catch (Exception e) {
e.printStackTrace();
this.updateById(fddContractAttachInfo);
}
});
}
errorList.add(new ErrorMessage(i, "保存成功", CommonConstants.GREEN));
} catch (Exception e) {
e.printStackTrace();
}
});
}
errorList.add(new ErrorMessage(i, "保存成功", CommonConstants.GREEN));
}
} else {
errorList.add(new ErrorMessage(i, "无数据保存"));
}
} catch (Exception e) {
log.error("合同数据批量新增异常" + e.getMessage());
errorList.add(new ErrorMessage(i, "合同数据批量新增异常:" + e.getMessage()));
return errorList;
}
return errorList;
......@@ -470,22 +500,22 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
if (null != entityList && !entityList.isEmpty()) {
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::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()));
if(employeeContractInfoValid==null){
if (employeeContractInfoValid == null) {
errorList.add(new ErrorMessage(i, NO_VALID_CONTRACT_FOUND, CommonConstants.RED));
continue;
}
if(StringUtils.equals(CommonConstants.ONE_STRING,employeeContractInfoValid.getContractType())){
if(employeeContractInfoValid.getContractEnd()==null){
if (StringUtils.equals(CommonConstants.ONE_STRING, employeeContractInfoValid.getContractType())) {
if (employeeContractInfoValid.getContractEnd() == null) {
errorList.add(new ErrorMessage(i, "员工合同结束时间为空", CommonConstants.RED));
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::getInUse, CommonConstants.ZERO_STRING)
.and(wrapper -> wrapper.and(wrapper2 -> wrapper2.eq(TEmployeeContractInfo::getContractStart, attachInfo.getContractStart())
......@@ -526,7 +556,7 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
* @Description: 更新合同id
* @return:
**/
public void updateContractId (FddContractInfo fddContractInfo, FddContractAttachInfo fddContractAttachInfo,TEmployeeContractInfo newEmployeeContractInfo) {
public void updateContractId(FddContractInfo fddContractInfo, FddContractAttachInfo fddContractAttachInfo, TEmployeeContractInfo newEmployeeContractInfo) {
//更新合同id
fddContractAttachInfo.setContractId(newEmployeeContractInfo.getId());
this.updateById(fddContractAttachInfo);
......@@ -547,11 +577,11 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
* @Description: 新增合同
* @return:
**/
public void saveTEmployeeContractInfo (TEmployeeContractInfo newEmployeeContractInfo, FddContractAttachInfo fddContractAttachInfo,TSettleDomain settleDomain,FddContractTemplate fddContractTemplate,
TEmployeeInfo tEmployeeInfo, TCustomerInfo tCustomerInfo, TEmployeeProject tEmployeeProject) {
TEmployeeContractInfo employeeContractCount = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda()
public void saveTEmployeeContractInfo(TEmployeeContractInfo newEmployeeContractInfo, FddContractAttachInfo fddContractAttachInfo, TSettleDomain settleDomain, FddContractTemplate fddContractTemplate,
TEmployeeInfo tEmployeeInfo, TCustomerInfo tCustomerInfo, TEmployeeProject tEmployeeProject) {
TEmployeeContractInfo employeeContractCount = employeeContractInfoMapper.selectOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.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) {
newEmployeeContractInfo.setEmpName(fddContractAttachInfo.getEmpName());
......@@ -574,22 +604,50 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
newEmployeeContractInfo.setFileProvince(tEmployeeInfo.getFileProvince());
newEmployeeContractInfo.setFileTown(tEmployeeInfo.getFileTown());
newEmployeeContractInfo.setInUse(CommonConstants.ZERO_STRING);
//远程接口传参
JSONObject jsonObject = new JSONObject();
jsonObject.put("value",fddContractTemplate.getType());
jsonObject.put("type","personnel_type");
R<String> res = HttpDaprUtil.invokeMethodPost(daprUpmsProperties.getAppUrl(), daprUpmsProperties.getAppId()
, "/dict/inner/getLableFronValue", jsonObject, Map.class, SecurityConstants.FROM_IN);
if (res != null) {
//电子合同模板对应的“员工类型”
newEmployeeContractInfo.setContractName(res.getData());
} else {
newEmployeeContractInfo.setContractName("");
newEmployeeContractInfo.setIsSign(CommonConstants.dingleDigitIntArray[1]);
newEmployeeContractInfo.setAuditStatus(CommonConstants.dingleDigitIntArray[2]);
newEmployeeContractInfo.setAuditTimeLast(LocalDateTime.now());
newEmployeeContractInfo.setCustomerId(tCustomerInfo.getId());
newEmployeeContractInfo.setDeptNo(fddContractAttachInfo.getDepartNo());
newEmployeeContractInfo.setUnitNo(tCustomerInfo.getCustomerCode());
newEmployeeContractInfo.setFddFlag(CommonConstants.ONE_STRING);
newEmployeeContractInfo.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
newEmployeeContractInfo.setCreateBy(fddContractAttachInfo.getCreateBy());
newEmployeeContractInfo.setCreateName(fddContractAttachInfo.getCreateName());
newEmployeeContractInfo.setUpdateBy(fddContractAttachInfo.getUpdateBy());
if (Common.isNotNull(fddContractAttachInfo.getPeriodStart())) {
newEmployeeContractInfo.setPeriodStart(localDate2Date(fddContractAttachInfo.getPeriodStart()));
}
if (Common.isNotNull(fddContractAttachInfo.getPeriodEnd())) {
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());
}
//设置状态为在用
newEmployeeContractInfo.setInUse(CommonConstants.ONE_STRING);
employeeContractInfoService.save(newEmployeeContractInfo);
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
* @Description: 新增项目档案
* @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) {
//新增项目档案
newTEmpProject.setEmpName(fddContractAttachInfo.getEmpName());
newTEmpProject.setEmpId(newEmployeeInfo.getId());
newTEmpProject.setEmpIdcard(fddContractAttachInfo.getEmpIdcard());
newTEmpProject.setEmpPhone(fddContractAttachInfo.getEmpPhone());
newTEmpProject.setDeptId(settleDomain.getId());
......@@ -621,9 +679,16 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
newTEmpProject.setUnitNo(tCustomerInfo.getCustomerCode());
newTEmpProject.setContractType(fddContractTemplate.getType());
newTEmpProject.setStatus(CommonConstants.dingleDigitIntArray[0]);
newTEmpProject.setPost(fddContractAttachInfo.getPost());
newTEmpProject.setEmpNatrue(newEmployeeInfo.getEmpNatrue());
newTEmpProject.setEmpNatrue(fddContractAttachInfo.getEmpNatrue());
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 = "";
empNO = getEmpNo(newTEmpProject.getDeptNo());
newTEmpProject.setEmpNo(empNO);
......@@ -673,4 +738,56 @@ public class FddContractAttachInfoServiceImpl extends ServiceImpl<FddContractAtt
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;
import java.io.InputStream;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
......@@ -118,9 +119,16 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
private OSSUtil ossUtil;
@Autowired
private TSettleDomainService tSettleDomainService;
@Autowired
private TAttaInfoService tAttaInfoService;
@Override
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())) {
return R.failed("当前用户不是电子合同导入用户,不能操作");
}
......@@ -576,17 +584,25 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
String key = name + ".zip";
ossUtil.uploadFileByStream(bis, key, null);
// 1:保存为
// TEmpAtta empAtta = BasicServiceUtil.initTEmpAttaForInsert(name, key, (long) rspData.getFileBytes().length);
// empAttaService.save(empAtta);
// MEmpContractAtta contractAtta = new MEmpContractAtta();
// contractAtta.setAttaId(empAtta.getId());
// contractAtta.setContractId(employeeContractInfo.getId());
// mempContractAttaService.save(contractAtta);
TAttaInfo attaInfo = initUnitAttaForInsert(name, key, (long)rspData.getFileBytes().length);
attaInfo.setRelationType(CommonConstants.FOUR_STRING);
attaInfo.setDomainId(fddContractInfo.getId());
tAttaInfoService.save(attaInfo);
FddContractAttachInfo fddContractAttachInfo = fddContractAttachInfoMapper.selectOne(Wrappers.<FddContractAttachInfo>query().lambda()
.eq(FddContractAttachInfo::getContractId,entity.getContractId()).last(CommonConstants.LAST_ONE_SQL));
if (fddContractAttachInfo != null) {
fddContractAttachInfo.setIsMove(CommonConstants.ONE_INT);
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();
} finally {
......@@ -921,4 +937,24 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
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;
}
}
......@@ -119,6 +119,6 @@
1=1
<include refid="fddPersonAccount_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>
</mapper>
......@@ -124,6 +124,8 @@ public interface CommonConstants {
String FOUR_STRING = "4";
String FIVE_STRING = "5";
/**
* number 0
*/
......
package com.yifu.cloud.plus.v1.yifu.common.core.util;
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.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -950,4 +951,23 @@ public class ExcelUtil <T> implements Serializable {
this.setErrorInfo(errorList);
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 {
return flag;
}
//获取指定时间的指定格式
public static String formatTime(LocalDate time, String pattern) {
return time.format(DateTimeFormatter.ofPattern(pattern));
}
public static void main(String[] args) {
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