Commit b181cbef authored by zhaji's avatar zhaji

"feature-zhaJi:新增退保费用登记的办理地权限"

parent 8357c994
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;
/**
* @ClassName: InsuranceRefundVo
* @Description: 减员退费校验类
* @Author: Administrator
* @Date: 2022/12/15 9:38
*/
@Data
public class InsuranceRefundVo implements Serializable {
/**
* 主键id
*/
@Schema(description = "主键")
private String id;
/**
* 保单信息主键
*/
@Schema(description = "保单信息主键")
private String insDetailId;
/**
* 退费金额
*/
@Schema(description = "退费金额")
private BigDecimal refundMoney;
/**
* 商险办理城市code
*/
@Schema(description = "商险办理城市code")
private Integer insuranceHandleCity;
/**
* 商险办理省code
*/
@Schema(description = "商险办理省code")
private Integer insuranceHandleProvince;
}
...@@ -199,7 +199,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> { ...@@ -199,7 +199,7 @@ public interface TInsuranceDetailMapper extends BaseMapper<TInsuranceDetail> {
* @param param 查询参数 * @param param 查询参数
* @return {@link String} * @return {@link String}
*/ */
TInsuranceRefund selectRefundDetailId(@Param("param") RefundMoneyUpdateParam param); InsuranceRefundVo selectRefundDetailId(@Param("param") RefundMoneyUpdateParam param);
/** /**
* 根据ID导出减员办理列表 * 根据ID导出减员办理列表
......
...@@ -5492,7 +5492,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5492,7 +5492,14 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override @Override
public R updateRefundMoney(List<RefundMoneyUpdateParam> paramList) { public R updateRefundMoney(List<RefundMoneyUpdateParam> paramList) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
Map<String, List<RefundMoneyUpdateParam>> map = refundMoneyCheck(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);
}
Map<String, List<RefundMoneyUpdateParam>> map = refundMoneyCheck(paramList,insuranceAreaResList);
List<RefundMoneyUpdateParam> successList = map.get(InsurancesConstants.SUCCESS_LIST); List<RefundMoneyUpdateParam> successList = map.get(InsurancesConstants.SUCCESS_LIST);
List<TInsuranceOperate> insuranceOperateList = new ArrayList<>(); List<TInsuranceOperate> insuranceOperateList = new ArrayList<>();
...@@ -5718,7 +5725,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5718,7 +5725,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param paramList 变更列表 * @param paramList 变更列表
* @return {@link R} * @return {@link R}
*/ */
public Map<String,List<RefundMoneyUpdateParam>> refundMoneyCheck(List<RefundMoneyUpdateParam> paramList){ public Map<String,List<RefundMoneyUpdateParam>> refundMoneyCheck(List<RefundMoneyUpdateParam> paramList,List<TInsuranceAreaRes> insuranceAreaResList){
Map<String,List<RefundMoneyUpdateParam>> map = new HashMap<>(16); Map<String,List<RefundMoneyUpdateParam>> map = new HashMap<>(16);
List<RefundMoneyUpdateParam> errorList = new ArrayList<>(); List<RefundMoneyUpdateParam> errorList = new ArrayList<>();
...@@ -5797,17 +5804,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -5797,17 +5804,25 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
//必填格式校通过后查询对应的保单信息 //必填格式校通过后查询对应的保单信息
TInsuranceRefund insuranceRefund = this.baseMapper.selectRefundDetailId(param); InsuranceRefundVo insuranceRefund = this.baseMapper.selectRefundDetailId(param);
if(Common.isEmpty(insuranceRefund)){ if(Common.isEmpty(insuranceRefund)){
param.setErrorMessage(InsurancesConstants.REFUND_IS_NULL); param.setErrorMessage(InsurancesConstants.REFUND_IS_NULL);
errorList.add(param); errorList.add(param);
continue; continue;
}else{
//商险办理地权限校验
boolean b = insuranceAreaResList.stream().anyMatch(s -> insuranceRefund.getInsuranceHandleCity().equals(s.getCity()) && insuranceRefund.getInsuranceHandleProvince().equals(s.getProvince()));
if(!b){
param.setErrorMessage(InsurancesConstants.NO_DETAIL_JURISDICTION);
continue;
}else{ }else{
String refundMoney = param.getRefundMoney(); String refundMoney = param.getRefundMoney();
if(!BigDecimalUtils.isNullOrZero(insuranceRefund.getRefundMoney()) && insuranceRefund.getRefundMoney().compareTo(new BigDecimal(refundMoney)) == CommonConstants.ZERO_INT){ if(!BigDecimalUtils.isNullOrZero(insuranceRefund.getRefundMoney()) && insuranceRefund.getRefundMoney().compareTo(new BigDecimal(refundMoney)) == CommonConstants.ZERO_INT){
continue; continue;
} }
} }
}
param.setId(insuranceRefund.getId()); param.setId(insuranceRefund.getId());
param.setInsDetailId(insuranceRefund.getInsDetailId()); param.setInsDetailId(insuranceRefund.getInsDetailId());
successList.add(param); successList.add(param);
......
...@@ -933,11 +933,13 @@ ...@@ -933,11 +933,13 @@
</select> </select>
<!-- 查询保单减员退费信息--> <!-- 查询保单减员退费信息-->
<select id="selectRefundDetailId" resultType="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceRefund"> <select id="selectRefundDetailId" resultType="com.yifu.cloud.plus.v1.yifu.insurances.vo.InsuranceRefundVo">
select select
refund.ID as id, refund.ID as id,
refund.INS_DETAIL_ID as insDetailId, refund.INS_DETAIL_ID as insDetailId,
refund.REFUND_MONEY as refundMoney refund.REFUND_MONEY as refundMoney,
a.INSURANCE_HANDLE_PROVINCE as insuranceHandleProvince,
a.INSURANCE_HANDLE_CITY as insuranceHandleCity
from from
t_insurance_detail a, t_insurance_detail a,
t_insurance_refund refund t_insurance_refund refund
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceEnclosureMapper"> <mapper namespace="com.yifu.cloud.plus.v1.yifu.insurances.mapper.insurances.TInsuranceEnclosureMapper">
<resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEnclosure"> <resultMap id="BaseResultMap" type="com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceEnclosure">
<id property="id" column="ID" jdbcType="INTEGER"/> <id property="id" column="ID" jdbcType="VARCHAR"/>
<result property="enclosureName" column="ENCLOSURE_NAME" jdbcType="VARCHAR"/> <result property="enclosureName" column="ENCLOSURE_NAME" jdbcType="VARCHAR"/>
<result property="remark" column="REMARK" jdbcType="VARCHAR"/> <result property="remark" column="REMARK" jdbcType="VARCHAR"/>
<result property="deleteFlag" column="DELETE_FLAG" jdbcType="VARCHAR"/> <result property="deleteFlag" column="DELETE_FLAG" jdbcType="VARCHAR"/>
......
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