Commit fc7d6668 authored by 李灿灿's avatar 李灿灿

商险投保成功,投保退回接口调整

parent 5df2d239
...@@ -3,9 +3,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo; ...@@ -3,9 +3,8 @@ package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Size; import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @author licancan * @author licancan
...@@ -18,11 +17,11 @@ public class InsuranceHandleParam implements Serializable { ...@@ -18,11 +17,11 @@ public class InsuranceHandleParam implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 集合不能为空 * 商险明细id
*/ */
@Size(min = 1,message = "集合不能为空") @Schema(description = "商险明细id")
@Schema(description = "主键集合") @NotBlank(message = "商险明细id不能为空")
private List<String> idList; private String id;
/** /**
* 审批意见 * 审批意见
......
...@@ -2,9 +2,13 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller; ...@@ -2,9 +2,13 @@ package com.yifu.cloud.plus.v1.yifu.insurances.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog; import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept; import com.yifu.cloud.plus.v1.yifu.insurances.vo.Dept;
import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService; import com.yifu.cloud.plus.v1.yifu.insurances.service.TInsuranceDetailService;
...@@ -227,26 +231,34 @@ public class TInsuranceDetailController { ...@@ -227,26 +231,34 @@ public class TInsuranceDetailController {
* 投保退回 * 投保退回
* *
* @author licancan * @author licancan
* @param param * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
@Operation(summary = "投保退回", description = "投保退回") @Operation(summary = "投保退回", description = "投保退回")
@PostMapping("/rollBackInsurance") @PostMapping("/rollBackInsurance")
public R<List<InsuranceListVO>> rollBackInsurance(@RequestBody @Valid InsuranceHandleParam param){ public R<List<InsuranceListVO>> rollBackInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleParam> paramList){
return tInsuranceDetailService.rollBackInsurance(param.getIdList(),param.getRemark()); YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tInsuranceDetailService.rollBackInsurance(user,paramList);
} }
/** /**
* 办理成功 * 办理成功
* *
* @author licancan * @author licancan
* @param param * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
@Operation(summary = "办理成功", description = "办理成功") @Operation(summary = "办理成功", description = "办理成功")
@PostMapping("/successfulInsurance") @PostMapping("/successfulInsurance")
public R<List<InsuranceListVO>> successfulInsurance(@RequestBody @Valid InsuranceHandleParam param){ public R<List<InsuranceListVO>> successfulInsurance(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceHandleParam> paramList){
return tInsuranceDetailService.successfulInsurance(param.getIdList(),param.getRemark()); YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
return tInsuranceDetailService.successfulInsurance(user,paramList);
} }
/** /**
......
...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceDetail;
import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate; import com.yifu.cloud.plus.v1.yifu.insurances.entity.TInsuranceOperate;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.*; import com.yifu.cloud.plus.v1.yifu.insurances.vo.*;
...@@ -152,21 +153,21 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> { ...@@ -152,21 +153,21 @@ public interface TInsuranceDetailService extends IService<TInsuranceDetail> {
* 投保退回 * 投保退回
* *
* @author licancan * @author licancan
* @param idList * @param user
* @param remark * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
R<List<InsuranceListVO>> rollBackInsurance(List<String> idList,String remark); R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList);
/** /**
* 办理成功 * 办理成功
* *
* @author licancan * @author licancan
* @param idList * @param user
* @param remark * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
*/ */
R<List<InsuranceListVO>> successfulInsurance(List<String> idList,String remark); R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList);
/** /**
* 登记保单保费 * 登记保单保费
......
...@@ -956,20 +956,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -956,20 +956,18 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
/** /**
* 投保退回 * 投保退回
* *
* @param idList * @param user
* @param remark * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
* @author licancan * @author licancan
*/ */
@Override @Override
public R<List<InsuranceListVO>> rollBackInsurance(List<String> idList,String remark) { public R<List<InsuranceListVO>> rollBackInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
YifuUser user = SecurityUtils.getUser(); //解析参数里的商险id
if (user == null || Common.isEmpty(user.getId())) { List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
return R.failed(CommonConstants.PLEASE_LOG_IN); //操作日志对象
} List<InsuranceHandleParam> operateList = new ArrayList<>();
if (CollectionUtils.isEmpty(idList)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList); List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据 //返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>(); List<InsuranceListVO> errorList = new ArrayList<>();
...@@ -1057,6 +1055,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1057,6 +1055,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
} }
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
operateList.add(e);
}
});
} }
//更新状态 //更新状态
this.saveOrUpdateBatch(successList); this.saveOrUpdateBatch(successList);
...@@ -1064,28 +1069,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1064,28 +1069,27 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称 //根据项目编码获取项目名称
setProjectNameByDeptNo(errorList); setProjectNameByDeptNo(errorList);
//操作记录 //操作记录
addOperate(successList,user,InsurancesConstants.ROLLBACK,remark); addOperate(operateList,user,InsurancesConstants.ROLLBACK);
return R.ok(errorList,InsurancesConstants.OPERATE_SUCCESS); return R.ok(errorList,InsurancesConstants.OPERATE_SUCCESS);
} }
/** /**
* 办理成功 * 办理成功
* *
* @param idList * @param user
* @param remark * @param paramList
* @return {@link R<List<InsuranceListVO>>} * @return {@link R<List<InsuranceListVO>>}
* @author licancan * @author licancan
*/ */
@Override @Override
public R<List<InsuranceListVO>> successfulInsurance(List<String> idList,String remark) { public R<List<InsuranceListVO>> successfulInsurance(YifuUser user, List<InsuranceHandleParam> paramList) {
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10)); ThreadPoolExecutor threadPool = new ThreadPoolExecutor(50, 50, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<>(10));
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) { //解析参数里的商险id
return R.failed(CommonConstants.PLEASE_LOG_IN); List<String> idList = paramList.stream().map(e -> e.getId()).distinct().collect(Collectors.toList());
} //操作日志对象
if (CollectionUtils.isEmpty(idList)){ List<InsuranceHandleParam> operateList = new ArrayList<>();
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
}
List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList); List<TInsuranceDetail> detailList = baseMapper.selectBatchIds(idList);
//返回给前端的数据 //返回给前端的数据
List<InsuranceListVO> errorList = new ArrayList<>(); List<InsuranceListVO> errorList = new ArrayList<>();
...@@ -1225,7 +1229,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -1225,7 +1229,17 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//根据项目编码获取项目名称 //根据项目编码获取项目名称
setProjectNameByDeptNo(errorList); setProjectNameByDeptNo(errorList);
//操作记录 //操作记录
addOperate(successList,user,InsurancesConstants.SUCCESSFUL,remark); if (CollectionUtils.isNotEmpty(successList)){
for (TInsuranceDetail detail : successList) {
//获取成功数据的remark
paramList.stream().forEach(e ->{
if (detail.getId().equals(e.getId())){
operateList.add(e);
}
});
}
}
addOperate(operateList,user,InsurancesConstants.SUCCESSFUL);
return R.ok(errorList, InsurancesConstants.OPERATE_SUCCESS); return R.ok(errorList, InsurancesConstants.OPERATE_SUCCESS);
} }
...@@ -2679,7 +2693,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2679,7 +2693,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
/** /**
* 操作记录 * 操作记录(无审批remark)
* *
* @author licancan * @author licancan
* @param detailList 商险明细集合 * @param detailList 商险明细集合
...@@ -2708,6 +2722,36 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap ...@@ -2708,6 +2722,36 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
} }
} }
/**
* 操作记录(有审批remark)
*
* @author licancan
* @param paramList 操作集合
* @param user 登录用户
* @param operateDesc 操作描述
* @return void
*/
private void addOperate(List<InsuranceHandleParam> paramList,YifuUser user,String operateDesc){
if (CollectionUtils.isNotEmpty(paramList)){
try {
List<TInsuranceOperate> operateList = new ArrayList<>();
for (InsuranceHandleParam param : paramList) {
TInsuranceOperate operate = new TInsuranceOperate();
operate.setRemark(param.getRemark());
operate.setInsuranceDetailId(param.getId());
operate.setOperateDesc(operateDesc);
operate.setCreateBy(user.getId());
operate.setCreateName(user.getNickname());
operate.setCreateTime(LocalDateTime.now());
operateList.add(operate);
}
tInsuranceOperateService.saveBatch(operateList);
}catch (Exception e){
e.getStackTrace();
}
}
}
/** /**
* 将集合交叉合并,list1 是第一个顺序 list2 是第二个顺序 * 将集合交叉合并,list1 是第一个顺序 list2 是第二个顺序
* *
......
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