Commit e097cfb7 authored by fangxinjiang's avatar fangxinjiang

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

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