Commit 4577cd95 authored by huyuchen's avatar huyuchen

huych-含风险项目商险不购买申请提交

parent 08a3c6aa
......@@ -164,156 +164,159 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
}
try {
//获取明细当日最大申请编号
String applyDetail = baseMapper.getMaxInusuranceDetailCode();
//暂存不做校验
if (CommonConstants.ONE_STRING.equals(tInsuranceUnpurchaseApply.getSaveFlag())) {
if (Common.isEmpty(tInsuranceUnpurchaseApply.getId())) {
String applyDetail;
synchronized (this) {
applyDetail = baseMapper.getMaxInusuranceDetailCode();
//暂存不做校验
if (CommonConstants.ONE_STRING.equals(tInsuranceUnpurchaseApply.getSaveFlag())) {
if (Common.isEmpty(tInsuranceUnpurchaseApply.getId())) {
// tInsuranceUnpurchaseApply.setApplyNo(applyNo);
tInsuranceUnpurchaseApply.setCreateBy(user.getId());
tInsuranceUnpurchaseApply.setCreateName(user.getNickname());
tInsuranceUnpurchaseApply.setCreateUserDeptName(user.getDeptName());
tInsuranceUnpurchaseApply.setCreateUserDeptId(user.getDeptId().toString());
baseMapper.insert(tInsuranceUnpurchaseApply);
}else {
baseMapper.updateById(tInsuranceUnpurchaseApply);
}
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
//先删除明细表数据再重新生成
if (Common.isNotNull(tInsuranceUnpurchaseApply.getId())) {
personService.remove(Wrappers.<TInsuranceUnpurchasePerson>lambdaQuery()
.eq(TInsuranceUnpurchasePerson::getParnetId, tInsuranceUnpurchaseApply.getId()));
}
List<TInsuranceUnpurchasePerson> personList = new ArrayList<>();
if (Common.isNotNull(tInsuranceUnpurchaseApply.getPersonList()) && !tInsuranceUnpurchaseApply.getPersonList().isEmpty()) {
for (TInsuranceUnpurchasePersonAddVo vo : tInsuranceUnpurchaseApply.getPersonList()) {
TInsuranceUnpurchasePerson person = new TInsuranceUnpurchasePerson();
person.setEmpIdcardNo(vo.getEmpIdcardNo());
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail,vo.getRowIndex()));
initValue(tInsuranceUnpurchaseApply, person);
personList.add(person);
tInsuranceUnpurchaseApply.setCreateBy(user.getId());
tInsuranceUnpurchaseApply.setCreateName(user.getNickname());
tInsuranceUnpurchaseApply.setCreateUserDeptName(user.getDeptName());
tInsuranceUnpurchaseApply.setCreateUserDeptId(user.getDeptId().toString());
baseMapper.insert(tInsuranceUnpurchaseApply);
} else {
baseMapper.updateById(tInsuranceUnpurchaseApply);
}
personService.saveBatch(personList);
}
return R.ok();
} else if (CommonConstants.TWO_STRING.equals(tInsuranceUnpurchaseApply.getSaveFlag())) {
//校验若该项目&该人员身份证号是否已经有过“已购买社保”的不购买商险明细,若有也会禁止重复提交!提示:姓名+身份证号、姓名+身份证号、已有申请记录,无需重复提交,可删除后再提交;
//校验该身份证&姓名组合的数据能否找到在途或在保的社保-工伤险数据,即是否为-“工伤”险正常参保的人员,不受项目限制,若“工伤”险皆正常在保或有在途“待审核、待办理”,则可正常提交,若未正常参保或无在途的参保数据,则提示“姓名+身份证号、姓名+身份证号无正常参保或派单中的数据,禁止提交!”
List<TInsuranceUnpurchasePersonAddVo> personList = addAndUpdCheck(tInsuranceUnpurchaseApply);
if (Common.isNotNull(personList) && !personList.isEmpty() &&
personList.stream().noneMatch(e -> CommonConstants.ONE_STRING.equals(e.getCode()))) {
//申请编号
String applyNo = getCode();
tInsuranceUnpurchaseApply.setUnbuyNum(String.valueOf(personList.size()));
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
//先删除明细表数据再重新生成
if (Common.isNotNull(tInsuranceUnpurchaseApply.getId())) {
if (Common.isEmpty(tInsuranceUnpurchaseApply.getApplyNo())) {
tInsuranceUnpurchaseApply.setApplyNo(applyNo);
}
//申请人是否属于子分公司和该项目是否有审批通过记录赋值
setValue(tInsuranceUnpurchaseApply,user,tInsuranceUnpurchaseApply.getApplyNo());
tInsuranceUnpurchaseApply.setCreateTimeZc(LocalDateTime.now());
baseMapper.updateById(tInsuranceUnpurchaseApply);
if (tInsuranceUnpurchaseApply.getAuditFlag().equals(CommonConstants.ZERO_STRING)) {
// 记录提交审核日志
TAuditRecord submitAuditRecord = new TAuditRecord();
submitAuditRecord.setDomainId(tInsuranceUnpurchaseApply.getId());
submitAuditRecord.setFlowId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setNodeId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setApprovalMan(user.getId());
submitAuditRecord.setApprovalManName(user.getNickname());
// 审批结果为“提交”
submitAuditRecord.setApprovalResult(CommonConstants.dingleDigitStrArray[3]);
submitAuditRecord.setDeleteFlag(CommonConstants.NOT_DELETE_FLAG);
submitAuditRecord.setApprovalTime(LocalDateTime.now());
// 审核记录标识 1当前审核记录
submitAuditRecord.setPreFlag(CommonConstants.ONE_STRING);
submitAuditRecord.setSubmitMan(user.getId());
submitAuditRecord.setSubmitManName(user.getNickname());
// 申请原因
// submitAuditRecord.setReason(reason);
// 审核类型
submitAuditRecord.setAuditType(CommonConstants.ZERO_STRING);
submitAuditRecord.setCreateTime(LocalDateTime.now());
// 提交节点名称
submitAuditRecord.setNodeName("提交即审核通过");
submitAuditRecord.setSubmitCreateTime(LocalDateTime.now());
submitAuditRecord.setEntityName(applyNo);
auditRecordService.save(submitAuditRecord);
}
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
//先删除明细表数据再重新生成
personService.remove(Wrappers.<TInsuranceUnpurchasePerson>lambdaQuery()
.eq(TInsuranceUnpurchasePerson::getParnetId, tInsuranceUnpurchaseApply.getId()));
List<TInsuranceUnpurchasePerson> personInfoList = new ArrayList<>();
for (TInsuranceUnpurchasePersonAddVo vo : personList) {
}
List<TInsuranceUnpurchasePerson> personList = new ArrayList<>();
if (Common.isNotNull(tInsuranceUnpurchaseApply.getPersonList()) && !tInsuranceUnpurchaseApply.getPersonList().isEmpty()) {
for (TInsuranceUnpurchasePersonAddVo vo : tInsuranceUnpurchaseApply.getPersonList()) {
TInsuranceUnpurchasePerson person = new TInsuranceUnpurchasePerson();
person.setEmpIdcardNo(vo.getEmpIdcardNo());
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail, vo.getRowIndex()));
person.setCreateTime(tInsuranceUnpurchaseApply.getCreateTimeZc());
initValue(tInsuranceUnpurchaseApply, person);
personInfoList.add(person);
personList.add(person);
}
personService.saveBatch(personInfoList);
} else {
//申请人是否属于子分公司和该项目是否有审批通过记录赋值
setValue(tInsuranceUnpurchaseApply,user,applyNo);
tInsuranceUnpurchaseApply.setCreateTimeZc(LocalDateTime.now());
tInsuranceUnpurchaseApply.setCreateBy(user.getId());
tInsuranceUnpurchaseApply.setCreateName(user.getNickname());
tInsuranceUnpurchaseApply.setCreateUserDeptName(user.getDeptName());
tInsuranceUnpurchaseApply.setCreateUserDeptId(user.getDeptId().toString());
tInsuranceUnpurchaseApply.setApplyNo(applyNo);
baseMapper.insert(tInsuranceUnpurchaseApply);
if (tInsuranceUnpurchaseApply.getAuditFlag().equals(CommonConstants.ZERO_STRING)) {
// 记录提交审核日志
TAuditRecord submitAuditRecord = new TAuditRecord();
submitAuditRecord.setDomainId(tInsuranceUnpurchaseApply.getId());
submitAuditRecord.setFlowId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setNodeId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setApprovalMan(user.getId());
submitAuditRecord.setApprovalManName(user.getNickname());
// 审批结果为“提交”
submitAuditRecord.setApprovalResult(CommonConstants.dingleDigitStrArray[3]);
submitAuditRecord.setDeleteFlag(CommonConstants.NOT_DELETE_FLAG);
submitAuditRecord.setApprovalTime(LocalDateTime.now());
// 审核记录标识 1当前审核记录
submitAuditRecord.setPreFlag(CommonConstants.ONE_STRING);
submitAuditRecord.setSubmitMan(user.getId());
submitAuditRecord.setSubmitManName(user.getNickname());
// 申请原因
personService.saveBatch(personList);
}
return R.ok();
} else if (CommonConstants.TWO_STRING.equals(tInsuranceUnpurchaseApply.getSaveFlag())) {
//校验若该项目&该人员身份证号是否已经有过“已购买社保”的不购买商险明细,若有也会禁止重复提交!提示:姓名+身份证号、姓名+身份证号、已有申请记录,无需重复提交,可删除后再提交;
//校验该身份证&姓名组合的数据能否找到在途或在保的社保-工伤险数据,即是否为-“工伤”险正常参保的人员,不受项目限制,若“工伤”险皆正常在保或有在途“待审核、待办理”,则可正常提交,若未正常参保或无在途的参保数据,则提示“姓名+身份证号、姓名+身份证号无正常参保或派单中的数据,禁止提交!”
List<TInsuranceUnpurchasePersonAddVo> personList = addAndUpdCheck(tInsuranceUnpurchaseApply);
if (Common.isNotNull(personList) && !personList.isEmpty() &&
personList.stream().noneMatch(e -> CommonConstants.ONE_STRING.equals(e.getCode()))) {
//申请编号
String applyNo = getCode();
tInsuranceUnpurchaseApply.setUnbuyNum(String.valueOf(personList.size()));
if (Common.isNotNull(tInsuranceUnpurchaseApply.getId())) {
if (Common.isEmpty(tInsuranceUnpurchaseApply.getApplyNo())) {
tInsuranceUnpurchaseApply.setApplyNo(applyNo);
}
//申请人是否属于子分公司和该项目是否有审批通过记录赋值
setValue(tInsuranceUnpurchaseApply, user, tInsuranceUnpurchaseApply.getApplyNo());
tInsuranceUnpurchaseApply.setCreateTimeZc(LocalDateTime.now());
baseMapper.updateById(tInsuranceUnpurchaseApply);
if (tInsuranceUnpurchaseApply.getAuditFlag().equals(CommonConstants.ZERO_STRING)) {
// 记录提交审核日志
TAuditRecord submitAuditRecord = new TAuditRecord();
submitAuditRecord.setDomainId(tInsuranceUnpurchaseApply.getId());
submitAuditRecord.setFlowId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setNodeId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setApprovalMan(user.getId());
submitAuditRecord.setApprovalManName(user.getNickname());
// 审批结果为“提交”
submitAuditRecord.setApprovalResult(CommonConstants.dingleDigitStrArray[3]);
submitAuditRecord.setDeleteFlag(CommonConstants.NOT_DELETE_FLAG);
submitAuditRecord.setApprovalTime(LocalDateTime.now());
// 审核记录标识 1当前审核记录
submitAuditRecord.setPreFlag(CommonConstants.ONE_STRING);
submitAuditRecord.setSubmitMan(user.getId());
submitAuditRecord.setSubmitManName(user.getNickname());
// 申请原因
// submitAuditRecord.setReason(reason);
// 审核类型
submitAuditRecord.setAuditType(CommonConstants.ZERO_STRING);
submitAuditRecord.setCreateTime(LocalDateTime.now());
// 提交节点名称
submitAuditRecord.setNodeName("提交即审核通过");
submitAuditRecord.setSubmitCreateTime(LocalDateTime.now());
submitAuditRecord.setEntityName(applyNo);
auditRecordService.save(submitAuditRecord);
}
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
List<TInsuranceUnpurchasePerson> personInfoList = new ArrayList<>();
for (TInsuranceUnpurchasePersonAddVo vo : personList) {
TInsuranceUnpurchasePerson person = new TInsuranceUnpurchasePerson();
person.setEmpIdcardNo(vo.getEmpIdcardNo());
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail, vo.getRowIndex()));
person.setCreateTime(tInsuranceUnpurchaseApply.getCreateTimeZc());
initValue(tInsuranceUnpurchaseApply, person);
personInfoList.add(person);
// 审核类型
submitAuditRecord.setAuditType(CommonConstants.ZERO_STRING);
submitAuditRecord.setCreateTime(LocalDateTime.now());
// 提交节点名称
submitAuditRecord.setNodeName("提交即审核通过");
submitAuditRecord.setSubmitCreateTime(LocalDateTime.now());
submitAuditRecord.setEntityName(applyNo);
auditRecordService.save(submitAuditRecord);
}
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
//先删除明细表数据再重新生成
personService.remove(Wrappers.<TInsuranceUnpurchasePerson>lambdaQuery()
.eq(TInsuranceUnpurchasePerson::getParnetId, tInsuranceUnpurchaseApply.getId()));
List<TInsuranceUnpurchasePerson> personInfoList = new ArrayList<>();
for (TInsuranceUnpurchasePersonAddVo vo : personList) {
TInsuranceUnpurchasePerson person = new TInsuranceUnpurchasePerson();
person.setEmpIdcardNo(vo.getEmpIdcardNo());
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail, vo.getRowIndex()));
person.setCreateTime(tInsuranceUnpurchaseApply.getCreateTimeZc());
initValue(tInsuranceUnpurchaseApply, person);
personInfoList.add(person);
}
personService.saveBatch(personInfoList);
} else {
//申请人是否属于子分公司和该项目是否有审批通过记录赋值
setValue(tInsuranceUnpurchaseApply, user, applyNo);
tInsuranceUnpurchaseApply.setCreateTimeZc(LocalDateTime.now());
tInsuranceUnpurchaseApply.setCreateBy(user.getId());
tInsuranceUnpurchaseApply.setCreateName(user.getNickname());
tInsuranceUnpurchaseApply.setCreateUserDeptName(user.getDeptName());
tInsuranceUnpurchaseApply.setCreateUserDeptId(user.getDeptId().toString());
tInsuranceUnpurchaseApply.setApplyNo(applyNo);
baseMapper.insert(tInsuranceUnpurchaseApply);
if (tInsuranceUnpurchaseApply.getAuditFlag().equals(CommonConstants.ZERO_STRING)) {
// 记录提交审核日志
TAuditRecord submitAuditRecord = new TAuditRecord();
submitAuditRecord.setDomainId(tInsuranceUnpurchaseApply.getId());
submitAuditRecord.setFlowId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setNodeId(CommonConstants.EMPTY_STRING);
submitAuditRecord.setApprovalMan(user.getId());
submitAuditRecord.setApprovalManName(user.getNickname());
// 审批结果为“提交”
submitAuditRecord.setApprovalResult(CommonConstants.dingleDigitStrArray[3]);
submitAuditRecord.setDeleteFlag(CommonConstants.NOT_DELETE_FLAG);
submitAuditRecord.setApprovalTime(LocalDateTime.now());
// 审核记录标识 1当前审核记录
submitAuditRecord.setPreFlag(CommonConstants.ONE_STRING);
submitAuditRecord.setSubmitMan(user.getId());
submitAuditRecord.setSubmitManName(user.getNickname());
// 申请原因
// submitAuditRecord.setReason(reason);
// 审核类型
submitAuditRecord.setAuditType(CommonConstants.ZERO_STRING);
submitAuditRecord.setCreateTime(LocalDateTime.now());
// 提交节点名称
submitAuditRecord.setNodeName("提交即审核通过");
submitAuditRecord.setSubmitCreateTime(LocalDateTime.now());
submitAuditRecord.setEntityName(applyNo);
auditRecordService.save(submitAuditRecord);
}
//更新附件
updateFileId(tInsuranceUnpurchaseApply);
List<TInsuranceUnpurchasePerson> personInfoList = new ArrayList<>();
for (TInsuranceUnpurchasePersonAddVo vo : personList) {
TInsuranceUnpurchasePerson person = new TInsuranceUnpurchasePerson();
person.setEmpIdcardNo(vo.getEmpIdcardNo());
person.setEmpName(vo.getEmpName());
person.setPost(vo.getPost());
person.setApplyNoDetail(getDetailCode(applyDetail, vo.getRowIndex()));
person.setCreateTime(tInsuranceUnpurchaseApply.getCreateTimeZc());
initValue(tInsuranceUnpurchaseApply, person);
personInfoList.add(person);
}
personService.saveBatch(personInfoList);
}
personService.saveBatch(personInfoList);
} else {
return R.failed(personList);
}
} else {
return R.failed(personList);
}
}
} catch (Exception e) {
......@@ -350,8 +353,7 @@ public class TInsuranceUnpurchaseApplyServiceImpl extends ServiceImpl<TInsurance
public List<TInsuranceUnpurchasePersonAddVo> addAndUpdCheck(TInsuranceUnpurchaseApply tInsuranceUnpurchaseApply) {
Map<String,String> sameCheckMap = new HashMap<>();
TInsuranceUnpurchaseApply exitApply;
TInsuranceUnpurchasePerson exit;
List<TInsuranceUnpurchasePersonAddVo> personList = tInsuranceUnpurchaseApply.getPersonList();
if (Common.isNotNull(personList) && !personList.isEmpty()) {
R<Boolean> flagSocial;
......
......@@ -125,7 +125,7 @@
inner join t_insurance_unpurchase_person b
on a.id = b.PARNET_ID
where
1=1 and a.DELETE_FLAG = '0' and a.reason_type = '1' and a.status != '0'
1=1 and a.DELETE_FLAG = '0' and a.reason_type = '1' and a.status in ('2','3')
<if test="id != null ">
AND a.id != #{id}
</if>
......@@ -139,7 +139,7 @@
inner join t_insurance_unpurchase_person b
on a.id = b.PARNET_ID
where
1=1 and a.DELETE_FLAG = '0' and a.reason_type = '2' and a.status != '0' and b.SALARY_NUM = 0
1=1 and a.DELETE_FLAG = '0' and a.reason_type = '2' and a.status in ('2','3') and b.SALARY_NUM = 0
<if test="id != null ">
AND a.id != #{id}
</if>
......
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