Commit 01ba9887 authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'feature/insurance-1.3.0'

Feature licancan

See merge request !305
parents c499925c 4473d93d
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
......@@ -80,4 +82,10 @@ public class InsuranceRegisterParam implements Serializable {
*/
@Schema(description = "错误信息")
private String errorMessage;
/**
* 数据传递对象,校验通过后不需要再查数据库
*/
@JsonIgnore
private TInsuranceDetail detail = new TInsuranceDetail();
}
......@@ -1727,6 +1727,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R<List<InsuranceRegisterParam>> registeredPolicyPremium(List<InsuranceRegisterParam> paramList) {
long l = System.currentTimeMillis();
if (CollectionUtils.isEmpty(paramList)){
return R.failed(CommonConstants.DATA_CAN_NOT_EMPTY);
}
......@@ -1756,20 +1757,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
for (InsuranceRegisterParam success : listSuccess) {
//登记保单保费
//查数据:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间 + 购买标准
TInsuranceDetail detail = 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)
);
TInsuranceDetail detail = success.getDetail();
actualMoney = detail.getActualPremium();
if (StringUtils.isNotBlank(success.getInvoiceNo())){
detail.setInvoiceNo(success.getInvoiceNo());
......@@ -2010,6 +1998,9 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (operatList.stream().allMatch(e->e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS))) {
operatList = null;
}
long e = System.currentTimeMillis();
long r = e-l;
log.info("共耗时:",r);
return R.ok(operatList,InsurancesConstants.OPERATE_SUCCESS);
}
......@@ -2033,7 +2024,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<InsuranceRegisterInvoiceNoParam> operateList = registeredInvoiceNoCheck(paramList);
//获取当前登录人的商险办理地权限
LambdaQueryWrapper<TInsuranceAreaRes> areaQuery = new LambdaQueryWrapper<>();
areaQuery.eq(TInsuranceAreaRes::getUserId,user.getId()).eq(TInsuranceAreaRes::getStatus,CommonConstants.ZERO_INT);
List<TInsuranceAreaRes> insuranceAreaResList = tInsuranceAreaResService.list(areaQuery);
if(CollectionUtils.isEmpty(insuranceAreaResList)) {
return R.failed(InsurancesConstants.NO_PERMISSION);
}
List<InsuranceRegisterInvoiceNoParam> operateList = registeredInvoiceNoCheck(paramList,insuranceAreaResList);
//需要修改的结果
List<InsuranceRegisterInvoiceNoParam> listSuccess = operateList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
......@@ -2141,7 +2139,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
List<InsuranceInsuredParam> operateList = updateInsuranceInsuredCheck(paramList);
//获取当前登录人的商险办理地权限
LambdaQueryWrapper<TInsuranceAreaRes> areaQuery = new LambdaQueryWrapper<>();
areaQuery.eq(TInsuranceAreaRes::getUserId,user.getId()).eq(TInsuranceAreaRes::getStatus,CommonConstants.ZERO_INT);
List<TInsuranceAreaRes> insuranceAreaResList = tInsuranceAreaResService.list(areaQuery);
if(CollectionUtils.isEmpty(insuranceAreaResList)) {
return R.failed(InsurancesConstants.NO_PERMISSION);
}
List<InsuranceInsuredParam> operateList = updateInsuranceInsuredCheck(paramList,insuranceAreaResList);
//需要修改的结果
List<InsuranceInsuredParam> listSuccess = operateList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>();
......@@ -3599,6 +3604,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
//数据传递对象,校验通过后不需要再查数据库
BeanCopyUtils.copyProperties(detail,param.getDetail());
}
return paramList.stream().distinct().collect(Collectors.toList());
}
......@@ -3608,9 +3615,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*
* @author licancan
* @param paramList
* @param insuranceAreaResList 办理地权限
* @return {@link List<InsuranceRegisterInvoiceNoParam>}
*/
private List<InsuranceRegisterInvoiceNoParam> registeredInvoiceNoCheck(List<InsuranceRegisterInvoiceNoParam> paramList){
private List<InsuranceRegisterInvoiceNoParam> registeredInvoiceNoCheck(List<InsuranceRegisterInvoiceNoParam> paramList, List<TInsuranceAreaRes> insuranceAreaResList){
List<InsuranceRegisterInvoiceNoParam> collect = paramList.stream().distinct().collect(Collectors.toList());
for (InsuranceRegisterInvoiceNoParam param : collect) {
// 必填校验
......@@ -3675,6 +3683,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.NOT_FOUND_INSERT_OR_BATCH_RECORD);
continue;
}else {
//商险办理地权限校验
boolean b = insuranceAreaResList.stream().anyMatch(s -> detail.getInsuranceHandleCity().equals(s.getCity()) && detail.getInsuranceHandleProvince().equals(s.getProvince()));
if(!b){
param.setErrorMessage(InsurancesConstants.NO_DETAIL_JURISDICTION);
continue;
}
if (detail.getBuyHandleStatus() != CommonConstants.THREE_INT && detail.getBuyHandleStatus() != CommonConstants.FIVE_INT){
param.setErrorMessage(InsurancesConstants.CURRENT_STATUS_NOT_REGISTER_INVOICE_NO);
continue;
......@@ -3692,9 +3706,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*
* @author licancan
* @param paramList
* @param insuranceAreaResList 办理地权限
* @return {@link List<InsuranceInsuredParam>}
*/
private List<InsuranceInsuredParam> updateInsuranceInsuredCheck(List<InsuranceInsuredParam> paramList){
private List<InsuranceInsuredParam> updateInsuranceInsuredCheck(List<InsuranceInsuredParam> paramList, List<TInsuranceAreaRes> insuranceAreaResList){
List<InsuranceInsuredParam> collect = paramList.stream().distinct().collect(Collectors.toList());
for (InsuranceInsuredParam param : collect) {
// 必填校验
......@@ -3796,6 +3811,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.NOT_FOUND_INSURANCE_RECORD);
continue;
}else {
//商险办理地权限校验
boolean b = insuranceAreaResList.stream().anyMatch(s -> detail.getInsuranceHandleCity().equals(s.getCity()) && detail.getInsuranceHandleProvince().equals(s.getProvince()));
if(!b){
param.setErrorMessage(InsurancesConstants.NO_DETAIL_JURISDICTION);
continue;
}
//判断是否是已投保状态或已减员
if (detail.getBuyHandleStatus() != CommonConstants.THREE_INT && detail.getBuyHandleStatus() != CommonConstants.FIVE_INT){
param.setErrorMessage(InsurancesConstants.CURRENT_STATUS_NOT_CHANGE_INSURANCE_RECORD);
......
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