Commit 342a47c6 authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/develop' into develop

parents eed3ae1a 850e2b87
...@@ -324,90 +324,65 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -324,90 +324,65 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
// 新老项目档案List // 新老项目档案List
List<EmployeeProjectNewOldVO> updateProjectList = new ArrayList<>(); List<EmployeeProjectNewOldVO> updateProjectList = new ArrayList<>();
List<EmployeeXProjectVO> selectList = excelVOList.stream().filter(e -> e.getIsLeaveEmployee().equals(CommonConstants.IS_TRUE)).collect(Collectors.toList());
List<TEmployeeProject> checkList = new ArrayList<>();
// 执行数据插入操作 组装 PostDto // 执行数据插入操作 组装 PostDto
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
EmployeeXProjectVO excel = excelVOList.get(i); EmployeeXProjectVO excel = excelVOList.get(i);
List<TEmployeeProject> idList = new ArrayList<>();
//根据身份证和项目编码获取项目档案 //根据身份证和项目编码获取项目档案
TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda() TEmployeeProject tEmployeeProject = this.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard()) .eq(TEmployeeProject::getEmpIdcard, excel.getEmpIdcard())
.eq(TEmployeeProject::getDeptNo, excel.getDeptNo()) .eq(TEmployeeProject::getDeptNo, excel.getDeptNo())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)); .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.STATUS_NORMAL));
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
if (Common.isNotNull(tEmployeeProject)) { if (Common.isNotNull(tEmployeeProject)) {
if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] || if (tEmployeeProject.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeProject.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] ||
tEmployeeProject.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) { tEmployeeProject.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
} else if (CommonConstants.IS_TRUE.equals(excel.getIsLeaveEmployee())) {
//查询该人员其他的项目档案 idList.add(tEmployeeProject);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.ARCHIVES_PROJECT_CHANGE_NOT_EXIST)));
} else {
TEmployeeProject tEmployeeProjectOld = this.getById(tEmployeeProject.getId());
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
tEmployeeProject.setLeaveTime(LocalDateTime.now());
updProjectList.add(tEmployeeProject);
newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
//查询该人员所有的项目档案
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda() List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.ne(TEmployeeProject::getDeptNo, tEmployeeProject.getDeptNo())
.eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard()) .eq(TEmployeeProject::getEmpIdcard, tEmployeeProject.getEmpIdcard())
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)); .eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
if (Common.isNotNull(list)) { if (Common.isNotNull(list)) {
boolean flag = false;
for (TEmployeeProject tEmployeeProject1 : list) { for (TEmployeeProject tEmployeeProject1 : list) {
if (!selectList.stream().anyMatch(e -> saveCheck(e, tEmployeeProject1))) { if (!excelVOList.stream().anyMatch(e -> saveCheck(e, tEmployeeProject1))) {
checkList.add(tEmployeeProject1); idList.add(tEmployeeProject1);
flag = true;
} }
} }
if (flag) {
boolean checkUpd = false;
for (TEmployeeProject tEmployeeCheck : checkList) {
if (tEmployeeCheck.getInsuranceStatus() != CommonConstants.dingleDigitIntArray[0] || tEmployeeCheck.getSocialStatus() != CommonConstants.dingleDigitIntArray[0] ||
tEmployeeCheck.getFundStatus() != CommonConstants.dingleDigitIntArray[0]) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.QT_PROJECT_CHANGE_NOT_EXIST)));
checkUpd = true;
break;
}
}
if (!checkUpd) {
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveReason(excel.getLeaveReason());
tEmployeeInfo.setLeaveRemark(excel.getLeaveRemark());
tEmployeeInfo.setLeaveTime(LocalDateTime.now());
List<String> idList = list.stream().map(TEmployeeProject::getId).collect(Collectors.toList());
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(), tEmployeeInfo, idList);
updList.add(tEmployeeInfo);
}
}
} else {
tEmployeeInfo.setFileStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeInfo.setLeaveReason(excel.getLeaveReason());
tEmployeeInfo.setLeaveRemark(excel.getLeaveRemark());
tEmployeeInfo.setLeaveTime(LocalDateTime.now());
updList.add(tEmployeeInfo);
} }
newOld = new EmployeeNewOldVO();
newOld.setOldEmployee(tEmployeeInfoOld);
newOld.setNewEmployee(tEmployeeInfo);
updateList.add(newOld);
} }
tEmployeeProject.setProjectStatus(CommonConstants.dingleDigitIntArray[1]);
tEmployeeProject.setLeaveReason(excel.getLeaveReason());
tEmployeeProject.setLeaveRemark(excel.getLeaveRemark());
tEmployeeProject.setLeaveTime(LocalDateTime.now());
updProjectList.add(tEmployeeProject);
newOldProject = new EmployeeProjectNewOldVO();
newOldProject.setOldProjectEmployee(tEmployeeProjectOld);
newOldProject.setNewProjectEmployee(tEmployeeProject);
updateProjectList.add(newOldProject);
} else { } else {
idList.add(tEmployeeProject);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT))); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.PROJECT_PERSON_SEARCH_EXIT)));
} }
TEmployeeInfo tEmployeeInfoOld = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
TEmployeeInfo tEmployeeInfo = tEmployeeInfoMapper.selectById(tEmployeeProject.getEmpId());
List<String> projectIdList = idList.stream().map(TEmployeeProject::getId).collect(Collectors.toList());
//从剩下的项目档案中查找员工类型并更新
setEmpNature(tEmployeeProject.getEmpIdcard(), tEmployeeInfo, projectIdList);
updList.add(tEmployeeInfo);
newOld = new EmployeeNewOldVO();
newOld.setOldEmployee(tEmployeeInfoOld);
newOld.setNewEmployee(tEmployeeInfo);
updateList.add(newOld);
} }
if (errorMessageList.size() > CommonConstants.ZERO_INT) { if (errorMessageList.size() > CommonConstants.ZERO_INT) {
return R.failed(errorMessageList); return R.failed(errorMessageList);
...@@ -433,7 +408,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -433,7 +408,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
if (updateProjectList.size() > CommonConstants.dingleDigitIntArray[0]) { if (updateProjectList.size() > CommonConstants.dingleDigitIntArray[0]) {
for (EmployeeProjectNewOldVO newOldVO : updateProjectList) { for (EmployeeProjectNewOldVO newOldVO : updateProjectList) {
tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1] tEmployeeLogService.saveModificationRecord(CommonConstants.dingleDigitIntArray[1]
, "", newOldVO.getNewProjectEmployee().getId() ,"", newOldVO.getNewProjectEmployee().getId()
, newOldVO.getOldProjectEmployee(), newOldVO.getNewProjectEmployee()); , newOldVO.getOldProjectEmployee(), newOldVO.getNewProjectEmployee());
} }
} }
...@@ -1075,7 +1050,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap ...@@ -1075,7 +1050,7 @@ public class TEmployeeProjectServiceImpl extends ServiceImpl<TEmployeeProjectMap
//从剩下的项目档案中查找员工类型 //从剩下的项目档案中查找员工类型
public void setEmpNature(String empIdcard, TEmployeeInfo tEmployeeInfo, List<String> idlist) { public void setEmpNature(String empIdcard, TEmployeeInfo tEmployeeInfo, List<String> idlist) {
List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda() List<TEmployeeProject> list = this.list(Wrappers.<TEmployeeProject>query().lambda()
.notIn(TEmployeeProject::getId, idlist) .in(TEmployeeProject::getId, idlist)
.eq(TEmployeeProject::getEmpIdcard, empIdcard) .eq(TEmployeeProject::getEmpIdcard, empIdcard)
.eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL) .eq(TEmployeeProject::getDeleteFlag, CommonConstants.STATUS_NORMAL)
.eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT)); .eq(TEmployeeProject::getProjectStatus, CommonConstants.ZERO_INT));
......
...@@ -44,10 +44,6 @@ ...@@ -44,10 +44,6 @@
a.ID, a.ID,
a.EMP_NAME, a.EMP_NAME,
a.EMP_IDCARD, a.EMP_IDCARD,
b.EMP_NO,
b.UNIT_NAME,
b.DEPT_NO,
b.DEPT_NAME,
a.DATA_TYPE, a.DATA_TYPE,
a.DELETE_FLAG, a.DELETE_FLAG,
a.UPDATE_BY, a.UPDATE_BY,
...@@ -104,13 +100,14 @@ ...@@ -104,13 +100,14 @@
<!--tElecEmployeeInfo简单分页查询--> <!--tElecEmployeeInfo简单分页查询-->
<select id="getTElecEmployeeInfoPage" resultMap="tElecEmployeeInfoMap"> <select id="getTElecEmployeeInfoPage" resultMap="tElecEmployeeInfoMap">
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>,GROUP_CONCAT(distinct b.DEPT_NAME) as DEPT_NAME,GROUP_CONCAT(distinct b.UNIT_NAME) as UNIT_NAME,GROUP_CONCAT(distinct b.DEPT_NO) as DEPT_NO,GROUP_CONCAT(distinct b.EMP_NO) as EMP_NO
FROM t_elec_employee_info a FROM t_elec_employee_info a
left join t_employee_project b on a.EMP_IDCARD = b.EMP_IDCARD left join t_employee_project b on a.EMP_IDCARD = b.EMP_IDCARD
<where> <where>
1=1 AND a.DELETE_FLAG = '0' AND b.DELETE_FLAG = '0' 1=1 AND a.DELETE_FLAG = '0' AND b.DELETE_FLAG = '0'
<include refid="tElecEmployeeInfo_where"/> <include refid="tElecEmployeeInfo_where"/>
</where> </where>
order by a.CREATE_TIME desc GROUP BY a.EMP_IDCARD
ORDER BY a.CREATE_TIME desc
</select> </select>
</mapper> </mapper>
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