Commit 739a5365 authored by huyuchen's avatar huyuchen

项目档案批量操作速度优化

parent d86713fe
......@@ -40,6 +40,8 @@ public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> {
void updateExcelEmpProject(@Param("list") List<TEmployeeProject> list);
void updateReduceEmpProject(@Param("list") List<TEmployeeProject> list);
int insertExcelEmpProject(@Param("list") List<TEmployeeProject> list);
void updateEmpIdById(@Param("list") List<TEmployeeInfo> list);
......
......@@ -582,7 +582,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
} else {
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
tEmployeeProject.setLeaveTime(LocalDateTime.now());
......@@ -607,17 +606,17 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
return R.failed(errorMessageList);
} else {
//更新项目档案
if (updProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
this.updateBatchById(updProjectList);
if (!updProjectList.isEmpty()) {
baseMapper.updateReduceEmpProject(updProjectList);
}
//更新人员档案
if (updList.size() > CommonConstants.dingleDigitIntArray[0]) {
if (!updList.isEmpty()) {
List<TEmployeeInfo> updEmpInfoList = updList.stream().distinct().collect(Collectors.toList());
YifuUser user = SecurityUtils.getUser();
doJointTask.doUpdateEmployeeInfo(updEmpInfoList, user);
}
// 记录变更日志
if (updateProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
if (!updateProjectList.isEmpty()) {
for (EmployeeProjectNewOldVO newOldVO : updateProjectList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1]
, "", newOldVO.getNewProjectEmployee().getId()
......@@ -727,7 +726,8 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
}
}
if (idCardMap.get(idCard.concat(deptNo)) != null) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex()) + "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!"));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "第" + (excel.getRowIndex())
+ "行身份证号+项目编码与第" + idCardMap.get(idCard) + "行重复!"));
} else {
idCardMap.put(idCard.concat(deptNo), i + 2);
}
......@@ -849,14 +849,14 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CollUtil.isEmpty(errorMessageList)) {
try {
if (updateList.size() > CommonConstants.dingleDigitIntArray[0]) {
if (!updateList.isEmpty()) {
YifuUser user = SecurityUtils.getUser();
doJointTask.doUpdateEmployeeInfo(updateList, user);
}
if (proInsList.size() > CommonConstants.dingleDigitIntArray[0]) {
baseMapper.insertExcelEmpProject(proInsList);
if (!proInsList.isEmpty()) {
doJointTask.insertExcelEmpProject(proInsList);
}
if (proupdateList.size() > CommonConstants.dingleDigitIntArray[0]) {
if (!proupdateList.isEmpty()) {
baseMapper.updateExcelEmpProject(proupdateList);
}
} catch (Exception e) {
......@@ -1107,12 +1107,12 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (CollUtil.isNotEmpty(errorList)) {
return R.failed(errorList);
} else {
if (updList.size() > CommonConstants.dingleDigitIntArray[0]) {
if (!updList.isEmpty()) {
for (TEmployeeProject tEmployeeProject : updList) {
baseMapper.updateById(tEmployeeProject);
}
}
if (infoUpdList.size() > CommonConstants.dingleDigitIntArray[0]) {
if (!infoUpdList.isEmpty()) {
YifuUser user = SecurityUtils.getUser();
doJointTask.doUpdateEmployeeInfo(infoUpdList, user);
}
......@@ -1240,18 +1240,6 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
baseMapper.insert(tEmployeeProject);
}
/**
* 获取导出的项目档案列表
*/
private List<EmployeeProjectExportVO> gettEmpProInfoExportVos(String idstr, EmployeeProjectExportParamVO projectDTO) {
List<EmployeeProjectExportVO> list;
if (!Common.isEmpty(idstr)) {
projectDTO.setIdList(Common.initStrToList(idstr, CommonConstants.COMMA_STRING));
}
list = baseMapper.getTEmployeeProjectExportPage(projectDTO);
return list;
}
/**
* 更新人员档案
*/
......
......@@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TEmployeeProjectMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeInfoService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TEmployeeProjectService;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
......@@ -33,7 +33,7 @@ public class DoJointTask {
private TEmployeeInfoService tEmployeeInfoService;
@Autowired
private TEmployeeProjectService tEmployeeProjectService;
private TEmployeeProjectMapper tEmployeeProjectMapper;
@Autowired
private TEmployeeLogService tEmployeeLogService;
......@@ -51,7 +51,7 @@ public class DoJointTask {
for(TEmployeeInfo tEmployeeInfo:tEmployeeInfoList) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoService.getById(tEmployeeInfo.getId());
//查询该人员所有的项目档案
List<TEmployeeProject> list = tEmployeeProjectService.list(Wrappers.<TEmployeeProject>query().lambda()
List<TEmployeeProject> list = tEmployeeProjectMapper.selectList(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
......@@ -93,7 +93,7 @@ public class DoJointTask {
for(TEmployeeInfo tEmployeeInfo:tEmployeeInfoList) {
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoService.getById(tEmployeeInfo.getId());
//查询该人员所有的项目档案
List<TEmployeeProject> list = tEmployeeProjectService.list(Wrappers.<TEmployeeProject>query().lambda()
List<TEmployeeProject> list = tEmployeeProjectMapper.selectList(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, tEmployeeInfo.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
......@@ -120,4 +120,18 @@ public class DoJointTask {
log.info("法大大档案-批量更新人员档案结束");
}
/**
* @Description: 批量插入项目档案
* @Author: huyc
* @Date: 2022-11-22
* @return: void
**/
@Async
public void insertExcelEmpProject(List<TEmployeeProject> proInsList) {
try {
tEmployeeProjectMapper.insertExcelEmpProject(proInsList);
} catch (Exception e) {
log.error("档案-批量插入项目档案错误", e);
}
}
}
......@@ -727,7 +727,39 @@
)
</foreach>
</insert>
<update id="updateReduceEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="LEAVE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="LEAVE_REASON =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.leaveReason!=null">
when ID=#{i.id} then #{i.leaveReason}
</if>
</foreach>
</trim>
<trim prefix="LEAVE_REMARK =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.leaveRemark!=null">
when ID=#{i.id} then #{i.leaveRemark}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 1
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<!--查询部门编码和最大员工数-->
<select id="findEmployeeMaxOnlyNoByDepId" resultType="java.lang.String">
SELECT
......
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