Commit 3dc9cf25 authored by 李灿灿's avatar 李灿灿

Merge branch 'feature-licancan' into 'develop'

商险办理导入接口

See merge request fangxinjiang/yifu!180
parents 1a4a4c13 6b523c3f
......@@ -868,10 +868,6 @@ public class InsurancesConstants {
* 当前为投保中状态,不可办理
*/
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 {
*/
@Operation(summary = "投保成功/退回办理导入", description = "投保成功/退回办理导入")
@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();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
......
......@@ -1084,9 +1084,41 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
@Override
public R<List<InsuranceHandleImportParam>> insuranceHandleImport(YifuUser user, List<InsuranceHandleImportParam> param) {
Map<String, List<InsuranceHandleImportParam>> map = insuranceChangeCheck(param, user,false);
//检验成功的数据
List<InsuranceHandleImportParam> successList = map.get("successList");
//校验失败的数据
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
}
}
tInsuranceOperateService.saveBatch(operateList);
return R.ok(errorList, "导入成功");
return R.ok(errorList, InsurancesConstants.IMPORT_SUCCESS);
}
/**
......@@ -4469,7 +4501,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//投保成功/退回办理
//商险不是投保中,无法办理
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);
continue;
}
......@@ -4482,6 +4515,37 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
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