Commit b2f7b4c9 authored by huyuchen's avatar huyuchen

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

parents afafb123 e47165bd
...@@ -175,6 +175,10 @@ public class InsurancesConstants { ...@@ -175,6 +175,10 @@ public class InsurancesConstants {
* 保单号不能为空 * 保单号不能为空
*/ */
public static final String POLICY_NO_EMPTY = "保单号不能为空"; public static final String POLICY_NO_EMPTY = "保单号不能为空";
/**
* 保费不能为空
*/
public static final String ACTUAL_PREMIUM_NO_EMPTY = "保费不能为空";
/** /**
* 保单号不存在 * 保单号不存在
*/ */
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @author licancan
* @description 登记保单保费入参
* @date 2022-07-21 17:03:31
*/
@Data
@Schema(description = "登记保单保费入参")
public class InsuranceRegisterParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 保险公司名称
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private String policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private String policyEnd;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 实际保费
*/
@Schema(description = "实际保费")
private String actualPremium;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 错误信息
*/
@Schema(description = "错误信息")
private String errorMessage;
}
...@@ -180,6 +180,18 @@ public class TInsuranceDetailController { ...@@ -180,6 +180,18 @@ public class TInsuranceDetailController {
return tInsuranceDetailService.successfulInsurance(idList); return tInsuranceDetailService.successfulInsurance(idList);
} }
/**
* 登记保单保费
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceRegisterParam>>}
*/
@Operation(summary = "登记保单保费", description = "登记保单保费")
@PostMapping("/registeredPolicyPremium")
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterParam> paramList){
return tInsuranceDetailService.registeredPolicyPremium(paramList);
}
/***********************减员办理********************************/ /***********************减员办理********************************/
/** /**
* 导入减员校验 * 导入减员校验
......
...@@ -117,6 +117,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -117,6 +117,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/ */
R<String> successfulInsurance(List<String> idList); R<String> successfulInsurance(List<String> idList);
/**
* 登记保单保费
*
* @author licancan
* @param paramList
* @return {@link R<List<InsuranceRegisterParam>>}
*/
R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList);
/***********************减员办理********************************/ /***********************减员办理********************************/
/** /**
* 减员导入校验 * 减员导入校验
......
...@@ -56,6 +56,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -56,6 +56,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private TInsuranceReplaceService tInsuranceReplaceService; private TInsuranceReplaceService tInsuranceReplaceService;
@Resource @Resource
private ArchivesDaprUtil archivesDaprUtil; private ArchivesDaprUtil archivesDaprUtil;
@Resource
private TInsuranceSettleService tInsuranceSettleService;
/***********************商险办理********************************/ /***********************商险办理********************************/
/** /**
...@@ -523,6 +525,56 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -523,6 +525,56 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(InsurancesConstants.OPERATE_SUCCESS); return R.ok(InsurancesConstants.OPERATE_SUCCESS);
} }
/**
* 登记保单保费
*
* @param paramList
* @return {@link R<List<InsuranceRegisterParam>>}
* @author licancan
*/
@Override
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
Map<String, List<InsuranceRegisterParam>> map = registeredPolicyPremiumCheck(paramList);
//返回给前端的结果
List<InsuranceRegisterParam> listResult = map.get("listResult");
//保存到数据库中的结果
List<InsuranceRegisterParam> listSuccess = map.get("listSuccess");
if (CollectionUtils.isNotEmpty(listSuccess)){
for (InsuranceRegisterParam success : listSuccess) {
//登记保单保费
//查数据:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, success.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, success.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, success.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, success.getInsuranceTypeName())
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(success.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(success.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (detail.getActualPremium() != null){
// 已推送过,只更新发票号
detail.setInvoiceNo(success.getInvoiceNo());
detail.setUpdateBy(user.getId());
detail.setUpdateTime(LocalDateTime.now());
this.updateById(detail);
}else {
// todo 根据结算类型判断推送ekp
}
}
}
//todo 操作记录
return R.ok(listResult,InsurancesConstants.OPERATE_SUCCESS);
}
/** /**
* 商险新增校验 * 商险新增校验
* *
...@@ -1093,6 +1145,101 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1093,6 +1145,101 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return map; return map;
} }
/**
* 登记保单保费校验
*
* @author licancan
* @param paramList
* @return {@link Map<String, List<InsuranceRegisterParam>>}
*/
private Map<String,List<InsuranceRegisterParam>> registeredPolicyPremiumCheck(List<InsuranceRegisterParam> paramList){
Map<String,List<InsuranceRegisterParam>> map = new HashMap<>();
List<InsuranceRegisterParam> listResult = new ArrayList<>();
List<InsuranceRegisterParam> listSuccess = new ArrayList<>();
for (InsuranceRegisterParam param : paramList) {
// 必填校验
if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getPolicyEnd())){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
listResult.add(param);
continue;
}
// 身份证号位数校验(18 位合法)
if (ValidityUtil.validateIDCard(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_LEGITIMATE);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
listResult.add(param);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
listResult.add(param);
continue;
}
//查数据是否存在:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
.eq(TInsuranceDetail::getEmpIdcardNo, param.getEmpIdcardNo())
.eq(TInsuranceDetail::getInsuranceCompanyName, param.getInsuranceCompanyName())
.eq(TInsuranceDetail::getInsuranceTypeName, param.getInsuranceTypeName())
.eq(TInsuranceDetail::getPolicyStart, LocalDateUtil.parseLocalDate(param.getPolicyStart()))
.eq(TInsuranceDetail::getPolicyEnd, LocalDateUtil.parseLocalDate(param.getPolicyEnd()))
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
);
if (!Optional.ofNullable(detail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
listResult.add(param);
continue;
}else {
// 如果保费不存在,保单号、保费必填
if (detail.getActualPremium() == null){
if (StringUtils.isBlank(param.getPolicyNo())){
param.setErrorMessage(InsurancesConstants.POLICY_NO_EMPTY);
listResult.add(param);
continue;
}
if (StringUtils.isBlank(param.getActualPremium())){
param.setErrorMessage(InsurancesConstants.ACTUAL_PREMIUM_NO_EMPTY);
listResult.add(param);
continue;
}
}
}
listSuccess.add(param);
}
map.put("listResult",listResult);
map.put("listSuccess",listSuccess);
return map;
}
/***********************减员办理********************************/ /***********************减员办理********************************/
@Override @Override
public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) { public R checkInsuranceRefundList(List<InsuranceRefundCheck> insuranceRefundCheckList) {
......
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