Commit 24b8fc97 authored by 李灿灿's avatar 李灿灿

feat:登记发票号(缺少推送ekp)

parent 1726357e
......@@ -59,6 +59,10 @@ public class InsurancesConstants {
* 登记保单保费
*/
public static final String REGISTERED = "登记保单保费";
/**
* 登记发票号
*/
public static final String REGISTERED_INVOICE = "登记发票号";
/**
* 新增投保成功
*/
......@@ -349,6 +353,10 @@ public class InsurancesConstants {
* 保单号长度超过50字符限制
*/
public static final String POLICY_NO_MORE_THAN_50 = "保单号长度超过50字符限制";
/**
* 发票号不能为空
*/
public static final String INVOICE_NO_EMPTY = "发票号不能为空";
/**
* 发票号长度超过50字符限制
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description 登记发票号入参
* @date 2022-12-08 16:33:57
*/
@Data
@Schema(description = "登记发票号入参")
public class InsuranceRegisterInvoiceNoParam implements Serializable {
private static final long serialVersionUID = 7450858109465027195L;
/**
* 员工姓名
*/
@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 buyStandard;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 错误信息
*/
@Schema(description = "错误信息")
private String errorMessage;
}
......@@ -297,6 +297,20 @@ public class TInsuranceDetailController {
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterParam> paramList){
return tInsuranceDetailService.registeredPolicyPremium(paramList);
}
/**
* 登记发票号
*
* @author licancan
* @param paramList
* @return {@link R< List<InsuranceRegisterInvoiceNoParam>>}
*/
@Operation(summary = "登记发票号", description = "登记发票号")
@PostMapping("/registeredInvoiceNo")
//@PreAuthorize("@pms.hasPermission('handle_insure_invoice')")
public R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterInvoiceNoParam> paramList){
return tInsuranceDetailService.registeredInvoiceNo(paramList);
}
/***********************减员办理********************************/
/**
* 导入减员校验
......
......@@ -180,6 +180,15 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
*/
R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList);
/**
* 登记发票号
*
* @author licancan
* @param paramList
* @return {@link R< List<InsuranceRegisterInvoiceNoParam>>}
*/
R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(List<InsuranceRegisterInvoiceNoParam> paramList);
/***********************减员办理********************************/
/**
......
......@@ -1997,6 +1997,71 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(operatList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 登记发票号
*
* @param paramList
* @return {@link R< List<InsuranceRegisterInvoiceNoParam>>}
* @author licancan
*/
@Override
@Transactional(value = "insurancesTransactionManager" ,rollbackFor = {Exception.class})
public R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(List<InsuranceRegisterInvoiceNoParam> paramList) {
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
if(paramList.size() > CommonConstants.IMPORT_TWENTY_THOUSAND){
return R.failed(InsurancesConstants.IMPORT_TOO_LONG);
}
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<InsuranceRegisterInvoiceNoParam> operateList = registeredInvoiceNoCheck(paramList);
//需要修改的结果
List<InsuranceRegisterInvoiceNoParam> listSuccess = operateList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(listSuccess)){
for (InsuranceRegisterInvoiceNoParam 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::getBuyStandard,success.getBuyStandard())
//排除替换类型
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
//当两次发票号不一致时才更新
if (!success.getInvoiceNo().equals(detail.getInvoiceNo())){
TInsuranceDetail oldDetail = detail;
//设置发票号
detail.setInvoiceNo(success.getInvoiceNo());
detailList.add(detail);
//变更记录
tBusinessOperateService.saveModificationRecord(detail.getId(),oldDetail,detail,null);
}
}
}
if (CollectionUtils.isNotEmpty(detailList)){
this.updateBatchById(detailList);
//todo 推给EKP
}
//操作记录
addOperate(detailList,user,InsurancesConstants.REGISTERED_INVOICE,null,CommonConstants.ZERO_INT);
if (operateList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) {
operateList = null;
}
return R.ok(operateList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 商险新增校验
*
......@@ -3277,6 +3342,80 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return paramList;
}
/**
* 登记发票号校验
*
* @author licancan
* @param paramList
* @return {@link List<InsuranceRegisterInvoiceNoParam>}
*/
private List<InsuranceRegisterInvoiceNoParam> registeredInvoiceNoCheck(List<InsuranceRegisterInvoiceNoParam> paramList){
for (InsuranceRegisterInvoiceNoParam param : paramList.stream().distinct().collect(Collectors.toList())) {
// 必填校验
if (StringUtils.isBlank(param.getEmpName())){
param.setErrorMessage(InsurancesConstants.EMP_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getEmpIdcardNo())){
param.setErrorMessage(InsurancesConstants.EMP_IDCARD_NO_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInsuranceCompanyName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_COMPANY_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInsuranceTypeName())){
param.setErrorMessage(InsurancesConstants.INSURANCE_TYPE_NAME_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyStart())){
param.setErrorMessage(InsurancesConstants.POLICY_START_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getPolicyEnd())){
param.setErrorMessage(InsurancesConstants.POLICY_END_NOT_EMPTY);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyStart(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_START_PARSE_ERROR);
continue;
}
if(!LocalDateUtil.isDate(param.getPolicyEnd(),LocalDateUtil.NORM_DATE_PATTERN)){
param.setErrorMessage(InsurancesConstants.POLICY_END_PARSE_ERROR);
continue;
}
if (StringUtils.isBlank(param.getBuyStandard())){
param.setErrorMessage(InsurancesConstants.BUY_STANDARD_NOT_EMPTY);
continue;
}
if (StringUtils.isBlank(param.getInvoiceNo())){
param.setErrorMessage(InsurancesConstants.INVOICE_NO_EMPTY);
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::getBuyStandard,param.getBuyStandard())
//排除替换类型
.ne(TInsuranceDetail::getBuyType,CommonConstants.FOUR_INT)
.eq(TInsuranceDetail::getDeleteFlag, CommonConstants.ZERO_INT)
.orderByDesc(TInsuranceDetail::getUpdateTime)
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
continue;
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
}
return paramList;
}
/**
* 根据区域名称获取区域id
*
......
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