Commit db0e9623 authored by zhaji's avatar zhaji

"feature-zhaJi:新增登记保单保费的商险办理地权限"

parent 8be268ea
...@@ -1274,5 +1274,9 @@ public class InsurancesConstants { ...@@ -1274,5 +1274,9 @@ public class InsurancesConstants {
*/ */
public static final String EKP_SEND_ERROR = "存在与ekp系统交互异常,请联系管理员处理后再操作"; public static final String EKP_SEND_ERROR = "存在与ekp系统交互异常,请联系管理员处理后再操作";
/**
* 当前登录人无任何商险办理地的操作权限
*/
public static final String NO_PERMISSION = "当前登录人无任何商险办理地的操作权限";
} }
...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil; ...@@ -25,6 +25,7 @@ import com.yifu.cloud.plus.v1.yifu.ekp.util.EkpInsuranceUtil;
import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants; import com.yifu.cloud.plus.v1.yifu.insurances.constants.InsurancesConstants;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.*; import com.yifu.cloud.plus.v1.yifu.insurances.entity.*;
import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceDetailMapper; import com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceDetailMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceAreaResService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService; import com.yifu.cloud.plus.v1.yifu.insurances.service.ekp.EkpSettleService;
import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.*; import com.yifu.cloud.plus.v1.yifu.insurances.service.insurance.*;
import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils; import com.yifu.cloud.plus.v1.yifu.insurances.util.BigDecimalUtils;
...@@ -117,7 +118,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -117,7 +118,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
private TInsurancePolicyService tInsurancePolicyService; private TInsurancePolicyService tInsurancePolicyService;
@Resource @Resource
private TBusinessOperateService tBusinessOperateService; private TBusinessOperateService tBusinessOperateService;
@Resource
private TInsuranceAreaResService tInsuranceAreaResService;
/***********************商险办理********************************/ /***********************商险办理********************************/
/** /**
* 每日定时刷新商险到期数据 * 每日定时刷新商险到期数据
...@@ -1735,7 +1737,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1735,7 +1737,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (user == null || Common.isEmpty(user.getId())) { if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN); return R.failed(CommonConstants.PLEASE_LOG_IN);
} }
List<InsuranceRegisterParam> operatList = registeredPolicyPremiumCheck(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<InsuranceRegisterParam> operatList = registeredPolicyPremiumCheck(paramList,insuranceAreaResList);
//保存到数据库中的结果 //保存到数据库中的结果
List<InsuranceRegisterParam> listSuccess = operatList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList()); List<InsuranceRegisterParam> listSuccess = operatList.stream().filter(e-> e.getErrorMessage().equals(CommonConstants.RESULT_DATA_SUCESS)).collect(Collectors.toList());
List<TInsuranceDetail> detailList = new ArrayList<>(); List<TInsuranceDetail> detailList = new ArrayList<>();
...@@ -3349,7 +3358,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3349,7 +3358,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param paramList * @param paramList
* @return {@link Map<String, List<InsuranceRegisterParam>>} * @return {@link Map<String, List<InsuranceRegisterParam>>}
*/ */
private List<InsuranceRegisterParam> registeredPolicyPremiumCheck(List<InsuranceRegisterParam> paramList){ private List<InsuranceRegisterParam> registeredPolicyPremiumCheck(List<InsuranceRegisterParam> paramList,List<TInsuranceAreaRes> insuranceAreaResList){
for (InsuranceRegisterParam param : paramList.stream().distinct().collect(Collectors.toList())) { for (InsuranceRegisterParam param : paramList.stream().distinct().collect(Collectors.toList())) {
// 必填校验 // 必填校验
if (StringUtils.isBlank(param.getEmpName())){ if (StringUtils.isBlank(param.getEmpName())){
...@@ -3425,6 +3434,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3425,6 +3434,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
param.setErrorMessage(InsurancesConstants.NOT_FOUND_INSERT_OR_BATCH_RECORD); param.setErrorMessage(InsurancesConstants.NOT_FOUND_INSERT_OR_BATCH_RECORD);
continue; continue;
}else { }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;
}
LambdaQueryWrapper<TInsuranceEkp> ekpLambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<TInsuranceEkp> ekpLambdaQueryWrapper = new LambdaQueryWrapper<>();
ekpLambdaQueryWrapper.eq(TInsuranceEkp :: getDetailId,detail.getId()).eq(TInsuranceEkp ::getResendFlag,CommonConstants.ZERO_INT); ekpLambdaQueryWrapper.eq(TInsuranceEkp :: getDetailId,detail.getId()).eq(TInsuranceEkp ::getResendFlag,CommonConstants.ZERO_INT);
List<TInsuranceEkp> ekpList = tInsuranceEkpService.list(ekpLambdaQueryWrapper); List<TInsuranceEkp> ekpList = tInsuranceEkpService.list(ekpLambdaQueryWrapper);
...@@ -6556,8 +6571,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -6556,8 +6571,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.failed("无可出险的保单"); return R.failed("无可出险的保单");
} }
List<TInsuranceOperate> operateList = new ArrayList<>(); List<TInsuranceOperate> operateList = new ArrayList<>();
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
for (TInsuranceDetail tInsuranceDetail : list) { for (TInsuranceDetail tInsuranceDetail : list) {
LambdaUpdateWrapper<TInsuranceDetail> updateWrapper = new LambdaUpdateWrapper<>();
TInsuranceOperate operate = new TInsuranceOperate(); TInsuranceOperate operate = new TInsuranceOperate();
updateWrapper.eq(TInsuranceDetail :: getId,tInsuranceDetail.getId()) updateWrapper.eq(TInsuranceDetail :: getId,tInsuranceDetail.getId())
.set(TInsuranceDetail :: getIsUse,CommonConstants.ONE_INT) .set(TInsuranceDetail :: getIsUse,CommonConstants.ONE_INT)
......
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