Commit 69a49880 authored by 李灿灿's avatar 李灿灿

feat:登记保单保费、修改已投保信息 添加办理地权限

parent c499925c
......@@ -2033,7 +2033,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 +2148,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<>();
......@@ -3608,9 +3622,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 +3690,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 +3713,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 +3818,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