Commit eda86978 authored by 查济's avatar 查济

Merge branch 'feature-zhaji' into 'develop'

Feature zhaji

See merge request fangxinjiang/yifu!144
parents 97d94711 b01f0170
......@@ -564,7 +564,12 @@ public class InsurancesConstants {
/**
* 替换项目不存在
*/
public static final String DEPT_NO_CHANGE_IS_NOT_EXIST = "替换项目不存在";
public static final String DEPT_NO_CHANGE_NEW_IS_NOT_EXIST = "替换项目不存在";
/**
* 被替换的项目不存在
*/
public static final String DEPT_NO_CHANGE_OLD_IS_NOT_EXIST = "被替换的项目不存在";
/**
......@@ -775,5 +780,10 @@ public class InsurancesConstants {
*/
public static final String NOT_CREATE_USER_DELETE_ERROR = "非创建人无法删除保单信息";
/**
* 无更新当前保单信息的权限
*/
public static final String NO_UPDATE_DETAIL_JURISDICTION = "无更新当前保单信息的权限";
}
......@@ -69,4 +69,10 @@ public class InsuranceListParam implements Serializable {
*/
@Schema(description = "办理地分流sql")
private String regionSql;
/**
* 保单办理人
*/
@Schema(description = "保单办理人")
private String updateBy;
}
......@@ -235,6 +235,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return iPage;
}
param.setRegionSql(regionSQL);
Integer buyHandleStatus = param.getBuyHandleStatus();
if(buyHandleStatus == CommonConstants.TWO_INT || buyHandleStatus == CommonConstants.THREE_INT){
param.setUpdateBy(user.getId());
}
IPage<InsuranceListVO> insuranceList = baseMapper.getInsuranceHandleListPage(page,param);
//根据项目编码获取项目名称
setProjectNameByDeptNo(insuranceList.getRecords());
......@@ -1144,7 +1148,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
Map<String, List<InsuranceRegisterParam>> map = registeredPolicyPremiumCheck(paramList);
Map<String, List<InsuranceRegisterParam>> map = registeredPolicyPremiumCheck(paramList,user);
//返回给前端的结果
List<InsuranceRegisterParam> listResult = map.get("listResult");
//保存到数据库中的结果
......@@ -1356,12 +1360,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
listResult.add(param);
continue;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for (int j = 0; j < distinctList.size(); j++) {
InsuranceAddParam repeat = distinctList.get(j);
......@@ -1418,7 +1417,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
listResult.add(param);
continue;
}
//省市区域校验是否正确并设置对应id
String redisProvinceName = getRedisAreaValue(param.getInsuranceProvinceName());
if (Common.isEmpty(redisProvinceName)){
......@@ -1716,12 +1720,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
listResult.add(param);
continue;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种
for (int j = 0; j < distinctList.size(); j++) {
InsuranceBatchParam repeat = distinctList.get(j);
......@@ -1777,7 +1775,12 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.DEPT_NO_NOT_IN_USER_DEPT_LIST);
listResult.add(param);
continue;
}
//省市区域校验是否正确并设置对应id
String redisProvinceName = getRedisAreaValue(param.getInsuranceProvinceName());
if (Common.isEmpty(redisProvinceName)){
......@@ -2078,18 +2081,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getReplaceDeptNo()))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
listResult.add(param);
continue;
}
//表内数据重复 员工姓名、员工身份证号码、保险公司、险种、起止时间(有交叉)
for (int j = 0; j < distinctList.size(); j++) {
InsuranceReplaceParam repeat = distinctList.get(j);
......@@ -2124,7 +2115,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}
//根据项目编码查询项目是否存在
R<SetInfoVo> setInfoByCodes = archivesDaprUtil.getSetInfoByCodes(Arrays.asList(param.getReplaceDeptNo()));
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
......@@ -2152,7 +2142,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getDeptNo()))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
listResult.add(param);
continue;
}
//校验当前项目是否在权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(param.getReplaceDeptNo()))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
listResult.add(param);
continue;
}
//原数据查重校验:姓名 + 身份证号 + 项目编码 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detail = this.baseMapper.selectOne(Wrappers.<TInsuranceDetail>query().lambda()
.eq(TInsuranceDetail::getEmpName, param.getEmpName())
......@@ -2307,10 +2308,11 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
* @param paramList
* @return {@link Map<String, List<InsuranceRegisterParam>>}
*/
private Map<String,List<InsuranceRegisterParam>> registeredPolicyPremiumCheck(List<InsuranceRegisterParam> paramList){
private Map<String,List<InsuranceRegisterParam>> registeredPolicyPremiumCheck(List<InsuranceRegisterParam> paramList,YifuUser user){
Map<String,List<InsuranceRegisterParam>> map = new HashMap<>();
List<InsuranceRegisterParam> listResult = new ArrayList<>();
List<InsuranceRegisterParam> listSuccess = new ArrayList<>();
String regionSQL = getRegionSQL(user);
for (InsuranceRegisterParam param : paramList.stream().distinct().collect(Collectors.toList())) {
// 必填校验
if (StringUtils.isBlank(param.getEmpName())){
......@@ -2392,6 +2394,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
listResult.add(param);
continue;
}else {
//查数据是否存在:姓名 + 身份证号 + 保险公司 + 险种名称 + 保单开始时间 + 保单结束时间
TInsuranceDetail detailByRegionSQL = 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::getDeleteFlag, CommonConstants.ZERO_INT)
.last(regionSQL+CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detailByRegionSQL).isPresent()){
param.setErrorMessage(InsurancesConstants.NO_UPDATE_DETAIL_JURISDICTION);
listResult.add(param);
continue;
}
// 如果保费不存在,保单号、保费必填
if (detail.getActualPremium() == null){
if (StringUtils.isBlank(param.getPolicyNo())){
......@@ -2907,6 +2925,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
tInsuranceDetail.setUpdateBy(user.getId());
tInsuranceDetail.setReduceHandleStatus(refundType);
if(CommonConstants.FOUR_INT == refundType){
tInsuranceDetail.setIsOverdue(null);
tInsuranceDetail.setBuyHandleStatus(CommonConstants.FIVE_INT);
}else {
tInsuranceDetail.setBuyHandleStatus(CommonConstants.THREE_INT);
......@@ -3948,11 +3967,6 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
if(!deptNoList.stream().anyMatch(u ->u.equals(newDeptNo))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//员工姓名
String empName = param.getEmpName();
if(StringUtils.isBlank(empName)){
......@@ -3974,11 +3988,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
errorList.add(param);
continue;
}
if(!deptNoList.stream().anyMatch(u ->u.equals(oldDeptNo))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//保险公司名称
String insuranceCompanyName = param.getInsuranceCompanyName();
if(StringUtils.isBlank(insuranceCompanyName)){
......@@ -4037,13 +4047,23 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (null != setInfoByCodes && setInfoByCodes.getCode() == CommonConstants.SUCCESS) {
Map<String, ProjectSetInfoVo> data = setInfoByCodes.getData().getProjectSetInfoVoMap();
if (MapUtils.isEmpty(data)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_IS_NOT_EXIST);
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_NEW_IS_NOT_EXIST);
errorList.add(param);
continue;
}else {
//结算类型,根据项目编码获取,并冗余到明细记录中
ProjectSetInfoVo jsonObject = data.get(newDeptNo);
if(Common.isEmpty(jsonObject)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_NEW_IS_NOT_EXIST);
errorList.add(param);
continue;
}
ProjectSetInfoVo oldJsonObject = data.get(oldDeptNo);
if(Common.isEmpty(oldJsonObject)){
param.setErrorMessage(InsurancesConstants.DEPT_NO_CHANGE_OLD_IS_NOT_EXIST);
errorList.add(param);
continue;
}
param.setOldDeptName(oldJsonObject.getDepartName());
param.setNewDeptName(jsonObject.getDepartName());
String settleType = jsonObject.getInsuranceSettleType();
......@@ -4056,6 +4076,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
//旧项目ID不在当前权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(oldDeptNo))){
param.setErrorMessage(InsurancesConstants.OLD_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//新项目ID不在当前权限范围内
if(!deptNoList.stream().anyMatch(u ->u.equals(newDeptNo))){
param.setErrorMessage(InsurancesConstants.NEW_DEPT_NO_NOT_IN_DEPT_LIST);
errorList.add(param);
continue;
}
//必填格式校通过后查询对应的保单信息
LambdaQueryWrapper<TInsuranceDetail> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TInsuranceDetail :: getDeleteFlag,CommonConstants.ZERO_INT)
......
......@@ -171,6 +171,9 @@
<if test="param.regionSql != null and param.regionSql.trim() != ''">
and ${param.regionSql}
</if>
<if test="param.updateBy != null and param.updateBy.trim() != ''">
and detail.UPDATE_BY = #{param.updateBy}
</if>
ORDER BY detail.BUY_HANDLE_STATUS,detail.CREATE_TIME DESC
</select>
......
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