Commit 3ebe60be authored by huyuchen's avatar huyuchen

法大大代码提交

parent 09697b0e
......@@ -384,7 +384,7 @@ public class EmployeeProjectExportVO{
* 项目档案来源(字典:4人员档案新建、5项目档案新建、1社保/公积金、3商险、2薪酬)
*/
@ExcelProperty(value ="项目档案来源")
@ExcelAttribute(name = "项目档案来源", readConverterExp = "1=社保/公积金,2=薪酬,3=商险,4=人员档案新建,5=项目档案新建")
@ExcelAttribute(name = "项目档案来源", isDataId = true,dataType = ExcelAttributeConstants.PROJECT_EMP_SOURCE)
private String projectSource;
/**
......
......@@ -168,6 +168,7 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
Enumeration<?> entries = zipFile.entries();
Map<String,String> insMap = new HashMap<>();
Map<String,String> map = new HashMap<>();
while (entries.hasMoreElements()) {
ZipEntry entry = (ZipEntry) entries.nextElement();
//添加进filesName
......@@ -195,6 +196,8 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
fos.write(buf, 0, len);
}
TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo();
List<String> list = new ArrayList<>();
if (empInfo.length() > empInfo.lastIndexOf("/") + 1) {
String idCard = empInfo.substring(0,empInfo.indexOf("/"));
String dataType = empInfo.substring(empInfo.indexOf("/") +1,empInfo.lastIndexOf("/"));
......@@ -208,7 +211,6 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
return R.failed("未找到身份证对应的档案信息,身份证号:" + idCard);
}
TElecEmployeeInfo tElecEmployeeInfo = new TElecEmployeeInfo();
tElecEmployeeInfo.setEmpIdcard(idCard);
tElecEmployeeInfo.setEmpName(empName);
if (Common.isNotNull(elecTypeMap)) {
......@@ -218,23 +220,22 @@ public class TElecEmployeeInfoServiceImpl extends ServiceImpl<TElecEmployeeInfoM
return R.failed("资料类型错误:" + dataType);
}
}
if (!elecTypeMap.get(dataType).equals(insMap.get(idCard))) {
insMap.put(idCard, elecTypeMap.get(dataType));
String id = insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType);
//if (!elecTypeMap.get(dataType).equals(insMap.get(idCard))) {
if (Common.isEmpty(id)) {
this.save(tElecEmployeeInfo);
insMap.put(idCard + CommonConstants.DOWN_LINE_STRING + dataType, tElecEmployeeInfo.getId());
}
//文件上传并保存附件信息
R<FileVo> fileVo =fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,"");
String id = fileVo.getData().getUid();
attaInfoMapper.updateDomainId(tElecEmployeeInfo.getId(), Arrays.asList(id));
fileUploadService.uploadImg(fileCovertMultipartFile(targetFile),"", CommonConstants.EIGHT_INT,insMap.get(idCard + CommonConstants.DOWN_LINE_STRING + dataType));
}
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(destDirPath);
// 关流顺序,先打开的后关闭
fos.close();
is.close();
}
}
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(destDirPath);
} catch (Exception e) {
throw new RuntimeException("unzip error from ZipUtils", e);
} finally {
......
......@@ -28,6 +28,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.check.entity.TCheckBankNo;
import com.yifu.cloud.plus.v1.yifu.archives.constants.EmployeeConstants;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TCustomerInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
......@@ -46,7 +48,6 @@ import com.yifu.cloud.plus.v1.yifu.common.core.exception.ErrorCodes;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.dapr.config.DaprCheckProperties;
import com.yifu.cloud.plus.v1.yifu.common.dapr.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;
......@@ -56,7 +57,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
......@@ -76,7 +76,7 @@ import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Log4j2
@EnableConfigurationProperties(DaprUpmsProperties.class)
@EnableConfigurationProperties(DaprCheckProperties.class)
public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMapper, TEmployeeProject> implements TEmployeeProjectService {
@Autowired
......@@ -96,13 +96,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
private DoJointTask doJointTask;
@Autowired
private DaprUpmsProperties daprUpmsProperties;
private DaprCheckProperties daprCheckProperties;
@Override
public R addCheck(TEmployeeProject tEmployeeProject) {
Map<String, Object> map = new HashMap<>();
//身份证系统中是否已有
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, tEmployeeProject.getEmpIdcard())
......@@ -171,6 +172,23 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (Common.isNotNull(tEmployeeInfo)) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(tEmployeeProject.getBankNo());
check.setIdNum(tEmployeeProject.getEmpIdcard());
check.setName(tEmployeeProject.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
return R.failed(EmployeeConstants.CHECK_NO_RESPONSE);
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
return R.failed(check.getMessage());
}
} else {
return R.failed(EmployeeConstants.CHECK_NO_RESPONSE);
}
TEmployeeInfo tEmployeeInfoCompare = tEmployeeInfoMapper.selectById(tEmployeeInfo.getId());
String empNO = getEmpNo(tEmployeeProject.getDeptNo());
tEmployeeProject.setEmpNo(empNO);
......@@ -381,7 +399,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
code = CommonConstants.ONE_STRING;
} else {
//从剩下的项目档案中查找员工类型并更新
if (Common.isNotNull(list)) {
Set<String> empNatrue = list.stream().map(TEmployeeProject::getEmpNatrue).collect(Collectors.toSet());
......@@ -690,8 +707,24 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(在档人员),项目无
} else if (Common.isNotNull(tEmployeeInfo) && Common.isEmpty(tEmployeeProject)
&& CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getMessage()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
}
updateExcelPost(excel, updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList);
insertExcelPro(excel, proInsList,tEmployeeInfo);
//档案有(在档人员),项目有(草稿/已审核);
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[0] == tEmployeeProject.getProjectStatus()) {
......@@ -709,8 +742,24 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//档案有(离职库),项目无;
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[1] == tEmployeeInfo.getFileStatus()
&& Common.isEmpty(tEmployeeProject)) {
TCheckBankNo check = new TCheckBankNo();
check.setBankNo(excel.getBankNo());
check.setIdNum(excel.getEmpIdcard());
check.setName(excel.getEmpName());
R<TCheckBankNo> checkListR = HttpDaprUtil.invokeMethodPost(daprCheckProperties.getAppUrl(), daprCheckProperties.getAppId()
, "/tcheckbankno/inner/checkBankNo", check, TCheckBankNo.class, SecurityConstants.FROM_IN);
if (checkListR != null && checkListR.getData() != null) {
check = checkListR.getData();
if (check == null || Common.isEmpty(check.getResult())) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
} else if (check.getResult().equals(CommonConstants.ZERO_STRING)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), check.getMessage()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), EmployeeConstants.CHECK_NO_RESPONSE));
}
updateExcelPost(excel, updateList, tEmployeeInfo);
insertExcelPro(excel, proInsList);
insertExcelPro(excel, proInsList, tEmployeeInfo);
//档案有(在档人员),项目(已减档)
} else if (Common.isNotNull(tEmployeeInfo) && CommonConstants.dingleDigitIntArray[0] == tEmployeeInfo.getFileStatus()
&& Common.isNotNull(tEmployeeProject) && CommonConstants.dingleDigitIntArray[1] == tEmployeeProject.getProjectStatus()) {
......@@ -741,9 +790,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.insertExcelEmpProject(proInsList);
List<String> idList = proInsList.stream().map(TEmployeeProject::getEmpIdcard).collect(Collectors.toList());
List<TEmployeeInfo> updList = tEmployeeInfoMapper.selectList(Wrappers.<TEmployeeInfo>query().lambda().in(TEmployeeInfo::getEmpIdcard, idList));
baseMapper.updateEmpIdById(updList);
}
if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.updateExcelEmpProject(proupdateList);
......@@ -907,15 +953,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
/**
* 插入excel Pro
*/
private void insertExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proInsList) {
private void insertExcelPro(EmployeeProjectVO excel, List<TEmployeeProject> proInsList,TEmployeeInfo tEmployeeInfo) {
TEmployeeProject insTEmployeePro = new TEmployeeProject();
BeanUtil.copyProperties(excel, insTEmployeePro);
insTEmployeePro.setId(String.valueOf(UUID.randomUUID()).replaceAll("-", ""));
insTEmployeePro.setDeleteFlag(CommonConstants.STATUS_NORMAL);
insTEmployeePro.setStatus(CommonConstants.dingleDigitIntArray[0]);
//人员档案主表id先设置成空,后面更新id
insTEmployeePro.setEmpId(CommonConstants.EMPTY_STRING);
//获取项目和单位信息
TSettleDomain tSettleDomain = tSettleDomainService.getOne(Wrappers.<TSettleDomain>query().lambda()
......@@ -935,14 +979,13 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
String empNO = getEmpNo(insTEmployeePro.getDeptNo());
insTEmployeePro.setEmpNo(empNO);
//员工编码生成规则
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectOne(Wrappers.<TEmployeeInfo>query().lambda()
.eq(TEmployeeInfo::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeInfo::getDeleteFlag, CommonConstants.STATUS_NORMAL));
insTEmployeePro.setEmpCode(tEmployeeInfo.getEmpCode());
YifuUser user = SecurityUtils.getUser();
insTEmployeePro.setCreateBy(user.getId());
insTEmployeePro.setEmpName(tEmployeeInfo.getEmpName());
insTEmployeePro.setCreateName(user.getNickname());
insTEmployeePro.setProjectSource(CommonConstants.dingleDigitStrArray[6]);
insTEmployeePro.setEmpId(tEmployeeInfo.getId());
proInsList.add(insTEmployeePro);
}
......
......@@ -518,13 +518,6 @@
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
......
......@@ -114,4 +114,6 @@ public class ExcelAttributeConstants {
public static final String FAMILY_RELATION = "family_relation";
// 工作类型---工具履历
public static final String WORKINFO_TYPE = "workinfo_type";
// 项目档案来源
public static final String PROJECT_EMP_SOURCE = "project_emp_source";
}
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