Commit 6b523c3f authored by 李灿灿's avatar 李灿灿

商险办理导入接口

parent 4fa52c95
...@@ -868,10 +868,6 @@ public class InsurancesConstants { ...@@ -868,10 +868,6 @@ public class InsurancesConstants {
* 当前为投保中状态,不可办理 * 当前为投保中状态,不可办理
*/ */
public static final String BUY_HANDLE_STATUS_TWO_HANDLE_ERROR = "当前为投保中状态,不可办理"; public static final String BUY_HANDLE_STATUS_TWO_HANDLE_ERROR = "当前为投保中状态,不可办理";
/**
* 当前为非投保中状态,不可办理
*/
public static final String BUY_HANDLE_STATUS_NOT_TWO_HANDLE_ERROR = "当前为非投保中状态,不可办理";
/** /**
* 当前为已投保状态,不可办理 * 当前为已投保状态,不可办理
*/ */
......
...@@ -253,7 +253,7 @@ public class TInsuranceDetailController { ...@@ -253,7 +253,7 @@ public class TInsuranceDetailController {
*/ */
@Operation(summary = "投保成功/退回办理导入", description = "投保成功/退回办理导入") @Operation(summary = "投保成功/退回办理导入", description = "投保成功/退回办理导入")
@PostMapping("/insuranceHandleImport") @PostMapping("/insuranceHandleImport")
public R<List<InsuranceHandleImportParam>> insuranceHandleImport(@RequestBody List<InsuranceHandleImportParam> param) { public R<List<InsuranceHandleImportParam>> insuranceHandleImport(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleImportParam> param) {
YifuUser user = SecurityUtils.getUser(); YifuUser user = SecurityUtils.getUser();
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);
......
...@@ -1084,9 +1084,41 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1084,9 +1084,41 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override @Override
public R<List<InsuranceHandleImportParam>> insuranceHandleImport(YifuUser user, List<InsuranceHandleImportParam> param) { public R<List<InsuranceHandleImportParam>> insuranceHandleImport(YifuUser user, List<InsuranceHandleImportParam> param) {
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(param, user,false); Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(param, user,false);
//检验成功的数据
List<InsuranceHandleImportParam> successList = map.get("successList"); List<InsuranceHandleImportParam> successList = map.get("successList");
//校验失败的数据
List<InsuranceHandleImportParam> errorList = map.get("errorList"); List<InsuranceHandleImportParam> errorList = map.get("errorList");
return R.ok(errorList,InsurancesConstants.ADD_SUCCESS); if (CollectionUtils.isNotEmpty(successList)){
//投保成功的数据
List<InsuranceHandleImportParam> collectSuccess = successList.stream().filter(e -> InsurancesConstants.SUCCESS.equals(e.getHandType())).collect(Collectors.toList());
//投保退回的数据
List<InsuranceHandleImportParam> collectRollBack = successList.stream().filter(e -> InsurancesConstants.FAILED.equals(e.getHandType())).collect(Collectors.toList());
//投保成功
if (CollectionUtils.isNotEmpty(collectSuccess)){
List<InsuranceHandleParam> list = new ArrayList<>();
collectSuccess.stream().forEach(e ->{
InsuranceHandleParam handleParam = new InsuranceHandleParam();
handleParam.setId(e.getId());
handleParam.setRemark(e.getRemark());
list.add(handleParam);
});
this.successfulInsurance(user,list);
}
//投保退回
if (CollectionUtils.isNotEmpty(collectRollBack)){
List<InsuranceHandleParam> list = new ArrayList<>();
collectRollBack.stream().forEach(e ->{
InsuranceHandleParam handleParam = new InsuranceHandleParam();
handleParam.setId(e.getId());
handleParam.setRemark(e.getRemark());
list.add(handleParam);
});
this.rollBackInsurance(user,list);
}
}
return R.ok(errorList,InsurancesConstants.IMPORT_SUCCESS);
} }
/** /**
...@@ -3244,7 +3276,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -3244,7 +3276,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
tInsuranceOperateService.saveBatch(operateList); tInsuranceOperateService.saveBatch(operateList);
return R.ok(errorList, "导入成功"); return R.ok(errorList, InsurancesConstants.IMPORT_SUCCESS);
} }
/** /**
...@@ -4469,7 +4501,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -4469,7 +4501,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//投保成功/退回办理 //投保成功/退回办理
//商险不是投保中,无法办理 //商险不是投保中,无法办理
if (CommonConstants.TWO_INT != insuranceDetail.getBuyHandleStatus()){ if (CommonConstants.TWO_INT != insuranceDetail.getBuyHandleStatus()){
param.setErrorMessage(InsurancesConstants.BUY_HANDLE_STATUS_NOT_TWO_HANDLE_ERROR); String buyHandleStatus = getBuyHandleStatus(insuranceDetail.getBuyHandleStatus());
param.setErrorMessage("当前为"+buyHandleStatus+"状态,不可办理");
errorList.add(param); errorList.add(param);
continue; continue;
} }
...@@ -4482,6 +4515,37 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -4482,6 +4515,37 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return map; return map;
} }
/**
* 获取投保状态的值
*
* @author licancan
* @param buyHandleStatus
* @return {@link String}
*/
private String getBuyHandleStatus(Integer buyHandleStatus){
String result;
switch (buyHandleStatus){
case 1:
result = "待投保";
break;
case 2:
result = "投保中";
break;
case 3:
result = "已投保";
break;
case 4:
result = "投保退回";
break;
case 5:
result = "已减员";
break;
default:
result = "";
}
return result;
}
/** /**
* 校验所属项目 * 校验所属项目
* *
......
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