Commit 8c5ccdee authored by hongguangwu's avatar hongguangwu

合同优化

parent fcef4a63
......@@ -156,11 +156,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
return R.failed(validity.getErrorInfo(), ResultConstants.VALIDITY_FAIL);
}
if (this.saveContractAndAtta(tEmployeeContractInfo)) {
return R.ok(null,"保存成功");
} else {
return R.failed();
}
return this.saveContractAndAtta(tEmployeeContractInfo);
}
@Override
......@@ -187,12 +183,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
if (null != validity.getErrorInfo() && !validity.getErrorInfo().isEmpty()) {
return R.failed(validity.getErrorInfo(), ResultConstants.VALIDITY_FAIL);
}
if (this.saveContractAndAtta(tEmployeeContractInfo)) {
return R.ok();
} else {
return R.failed();
}
return this.saveContractAndAtta(tEmployeeContractInfo);
} catch (Exception e) {
log.error("员工合同保存异常:" + e.getMessage());
return R.failed("员工合同保存系统异常!");
......@@ -286,7 +277,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
* @Author fxj
* @Date 2019-09-09
**/
private boolean saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo) {
private R<List<ErrorMessage>> saveContractAndAtta(TEmployeeContractInfo tEmployeeContractInfo) {
//档案柜存在就自动归档
if (Common.isNotNull(tEmployeeContractInfo.getAttaList())) {
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
......@@ -316,7 +307,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
String code = this.getCode();
isCur = baseMapper.getContractByApplyNo(tEmployeeContractInfo.getApplyNo());
if (Common.isNotNull(isCur)) {
return false;
return R.failed("编码已被占用,请稍后再新增:" + code);
}
tEmployeeContractInfo.setApplyNo(code);
}
......@@ -342,7 +333,7 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
// 更新档案合同状态
this.updateEmployeeContractStatus(tEmployeeContractInfo.getEmpId());
return true;
return R.ok(null, CommonConstants.SAVE_SUCCESS);
}
/**
......@@ -688,16 +679,9 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
@Transactional
public void importContract(List<EmployeeContractVO> excelVOList, List<ErrorMessage> errorMessageList) {
/// 个性化校验逻辑
Map<Integer, Integer> errorMsgMap = new HashMap<>();
if (Common.isNotNull(errorMessageList)) {
errorMessageList.forEach(errorMessage -> errorMsgMap.put(errorMessage.getLineNum(), CommonConstants.ONE_INT));
}
EmployeeContractVO excel;
// 执行数据插入操作 组装
for (int i = 0; i < excelVOList.size(); i++) {
if (errorMsgMap.get(i+2) != null) {
continue;
}
excel = excelVOList.get(i);
// 存储
this.insertExcel(excel, errorMessageList);
......@@ -733,7 +717,6 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
errorInfo.append(EmployeeConstants.CONTRACT_NO_IN_USE);
}
}
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorInfo.toString()));
if (Common.isEmpty(errorInfo.toString())) {
TEmployeeProject project = tEmployeeProjectService.getOne(Wrappers.<TEmployeeProject>query().lambda()
.eq(TEmployeeProject::getEmpIdcard, insert.getEmpIdcard())
......@@ -759,6 +742,8 @@ public class TEmployeeContractInfoServiceImpl extends ServiceImpl<TEmployeeContr
R<List<ErrorMessage>> info = this.setBaseInfo(insert);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), info.getMsg()));
}
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), errorInfo.toString()));
}
} catch (Exception e) {
log.error("员工合同保存异常:" + e.getMessage());
......
......@@ -449,7 +449,7 @@
<!-- 获取当日最大的编码 -->
<select id="getMaxContractCode" resultType="java.lang.String">
SELECT ifnull(max(right(e.APPLY_NO,5)),0) APPLY_NO FROM t_employee_contract_info e where e.DELETE_FLAG = 0 and e.CREATE_TIME>DATE_FORMAT(now(),'%Y-%m-%d')
SELECT ifnull(max(right(e.APPLY_NO,4)),0) APPLY_NO FROM t_employee_contract_info e where e.DELETE_FLAG = 0 and e.CREATE_TIME>DATE_FORMAT(now(),'%Y-%m-%d')
</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