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

Merge branch 'feature-licancan' into 'feature/insurance-1.3.0'

Feature licancan

See merge request !287
parents a9a79e93 b55d7780
......@@ -26,5 +26,19 @@ public class EkpInsuranceProperties {
String insuranceLoginName;
String insuranceFocSubject;
String insuranceDocSubject;
/**
* ekp修改接口描述
*/
String insuranceUpdateDocSubject;
/**
* ekp修改FdModelId
*/
String insuranceUpdateFdModelId;
/**
* ekp修改FdFlowId
*/
String insuranceUpdateFdFlowId;
}
......@@ -3,8 +3,10 @@ package com.yifu.cloud.plus.v1.yifu.ekp.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.config.EkpInsuranceProperties;
import com.yifu.cloud.plus.v1.yifu.ekp.constant.EkpConstants;
import com.yifu.cloud.plus.v1.yifu.ekp.vo.EKPInsurancePushParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EkpUpdateParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceSettlePushParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
......@@ -44,7 +46,7 @@ public class EkpInsuranceUtil {
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceFocSubject());
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceFdModelId());
......@@ -73,6 +75,50 @@ public class EkpInsuranceUtil {
}
}
/**
* 商险修改信息推送ekp
*
* @author licancan
* @param param
* @return {@link String}
*/
public String sendUpdateToEkp(EkpUpdateParam param){
log.info("推送EKP开始--商险修改");
RestTemplate yourRestTemplate = new RestTemplate();
try{
String formValues = new ObjectMapper().writeValueAsString(param);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject",ekpInsuranceProperties.getInsuranceUpdateDocSubject());
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", ekpInsuranceProperties.getInsuranceDocStatus());
wholeForm.add("fdModelId", ekpInsuranceProperties.getInsuranceUpdateFdModelId());
wholeForm.add("fdFlowId", ekpInsuranceProperties.getInsuranceUpdateFdFlowId());
wholeForm.add("formValues", formValues);
log.info("wholeForm:" + wholeForm);
HttpHeaders headers = new HttpHeaders();
//如果EKP对该接口启用了Basic认证,那么客户端需要加入
//addAuth(headers,"yourAccount"+":"+"yourPassword");是VO,则使用APPLICATION_JSON
headers.setContentType(MediaType.MULTIPART_FORM_DATA);
//必须设置上传类型,如果入参是字符串,使用MediaType.TEXT_PLAIN;如果
HttpEntity<MultiValueMap<String,Object>> entity = new HttpEntity<MultiValueMap<String,Object>>(wholeForm,headers);
//有返回值的情况 VO可以替换成具体的JavaBean
ResponseEntity<String> obj = yourRestTemplate.exchange(ekpInsuranceProperties.getInsuranceUrl(), HttpMethod.POST, entity, String.class);
String body = obj.getBody();
if (StringUtils.isBlank(body)){
log.error(EkpConstants.SEND_FAILED);
return null;
}else{
log.info(EkpConstants.SEND_SUCCESS + body);
return body;
}
}catch (Exception e){
log.error(EkpConstants.SEND_FAILED +":", e);
return null;
}
}
/**
* 将类转换成EKP要求的格式
*
......
......@@ -4,6 +4,10 @@ insurance.insuranceFdModelId=181d73279372e5a55438a47d7436ab7e
insurance.insuranceFdFlowId=18267f206233f29cbd3c5ee425c9408a
insurance.insuranceDocStatus=20
insurance.insuranceLoginName=admin
insurance.insuranceFocSubject=\u85AA\u8D44\u8BA2\u5355\u660E\u7EC6\u6570\u636E\u63A5\u53E3
insurance.insuranceDocSubject=\u5546\u9669\u63a8\u9001\u0065\u006b\u0070\u63a5\u53e3
insurance.insuranceUpdateDocSubject=\u5546\u9669\u63a8\u9001\u0065\u006b\u0070\u4fee\u6539\u63a5\u53e3
insurance.insuranceUpdateFdModelId=1850416f69cc813f128474e478b83794
insurance.insuranceUpdateFdFlowId=185041a4d264c3892a0543e43be925eb
......@@ -108,6 +108,14 @@ public class InsurancesConstants {
* 投保记录不存在
*/
public static final String DATA_IS_NOT_EXIST = "投保记录不存在";
/**
* 未找到符合条件的参保记录
*/
public static final String NOT_FOUND_INSURANCE_RECORD = "未找到符合条件的参保记录";
/**
* 当前投保状态无法登记发票号
*/
public static final String CURRENT_STATUS_NOT_REGISTER_INVOICE_NO = "当前投保状态无法登记发票号";
/**
* 结算信息不存在
*/
......@@ -442,9 +450,9 @@ public class InsurancesConstants {
*/
public static final String POLICY_NO_EXIST = "保单号不存在或已过期";
/**
* 保单号被禁用
* 保单禁用
*/
public static final String POLICY_NO_FORBIDDEN = "保单号被禁用";
public static final String POLICY_NO_FORBIDDEN = "保单禁用";
/**
* 保单号不存在
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import java.io.Serializable;
/**
* @author licancan
* @description ekp更新请求参数
* @date 2022-12-12 14:09:35
*/
@Data
public class EkpUpdateParam implements Serializable {
private static final long serialVersionUID = 581367013151512283L;
/**
* 保单开始时间
**/
private String fd_3b5bf02d3b8fc4;
/**
* 保单结束时间
**/
private String fd_3b5bf02e1d47cc;
/**
* 投保类型
*/
private String fd_3b5bf02fa14596;
/**
* 发票号
*/
private String fd_3b5bf030ab1a56;
/**
* 购买标准
*/
private String fd_3b5bf031b52314;
/**
* 商险ID
*/
private String fd_3b5bf032d7a822;
/**
* 商险变更ID
*/
private String fd_3b5bf033da86b2;
/**
* 变更记录
*/
private String fd_3b5bf0b7b4c058;
}
......@@ -80,4 +80,16 @@ public class InsuranceExportListParam extends BaseEntity implements Serializable
*/
@Schema(description = "派单结束时间")
private String endDate;
/**
* 购买标准开始
*/
@Schema(description = "购买标准开始")
private String buyStandardMin;
/**
* 购买标准结束
*/
@Schema(description = "购买标准结束")
private String buyStandardMax;
}
......@@ -94,4 +94,16 @@ public class InsuranceListParam extends BaseEntity {
@Schema(description = "减员状态 1待减员 2减员中3减员退回,4减员成功")
private Integer reduceHandleStatus;
/**
* 购买标准开始
*/
@Schema(description = "购买标准开始")
private String buyStandardMin;
/**
* 购买标准结束
*/
@Schema(description = "购买标准结束")
private String buyStandardMax;
}
......@@ -67,12 +67,12 @@ public class RefundExportListParam extends BaseEntity implements Serializable {
* 购买标准开始
*/
@Schema(description = "购买标准开始")
private String buyStandardStart;
private String buyStandardMin;
/**
* 购买标准结束
*/
@Schema(description = "购买标准结束")
private String buyStandardEnd;
private String buyStandardMax;
}
......@@ -307,7 +307,7 @@ public class TInsuranceDetailController {
*/
@Operation(summary = "登记发票号", description = "登记发票号")
@PostMapping("/registeredInvoiceNo")
//@PreAuthorize("@pms.hasPermission('handle_insure_invoice')")
@PreAuthorize("@pms.hasPermission('handle_insure_invoice')")
public R<List<InsuranceRegisterInvoiceNoParam>> registeredInvoiceNo(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceRegisterInvoiceNoParam> paramList){
return tInsuranceDetailService.registeredInvoiceNo(paramList);
}
......@@ -321,7 +321,7 @@ public class TInsuranceDetailController {
*/
@Operation(summary = "已投保信息修改", description = "已投保信息修改")
@PostMapping("/updateInsuranceInsured")
//@PreAuthorize("@pms.hasPermission('handle_insured')")
@PreAuthorize("@pms.hasPermission('handle_insured')")
public R<List<InsuranceInsuredParam>> updateInsuranceInsured(@RequestBody @Valid @Size(min = 1,message = "集合不能为空") List<InsuranceInsuredParam> paramList){
return tInsuranceDetailService.updateInsuranceInsured(paramList);
}
......@@ -335,7 +335,7 @@ public class TInsuranceDetailController {
*/
@PostMapping("/updateInsuranceInsuredById")
@Operation(summary = "已投保信息修改", description = "已投保信息修改")
//@PreAuthorize("@pms.hasPermission('handle_insured_by_id')")
@PreAuthorize("@pms.hasPermission('handle_insured_by_id')")
public R<String> updateInsuranceInsuredById(@RequestBody InsuranceInsuredDetailParam param) {
return tInsuranceDetailService.updateInsuranceInsuredById(param);
}
......
......@@ -13,6 +13,7 @@ import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
......@@ -56,6 +57,7 @@ public class TInsurancePolicyController {
*/
@Operation(summary = "保单号对应起止保时间列表(不分页)", description = "保单号对应起止保时间(不分页)")
@GetMapping("/list")
@PreAuthorize("@pms.hasPermission('insurancePolicy_list')")
public R<List<TInsurancePolicy>> getInsurancePolicyList(InsurancePolicyListParam param) {
return R.ok(tInsurancePolicyService.getInsurancePolicyList(param));
}
......@@ -69,6 +71,7 @@ public class TInsurancePolicyController {
*/
@GetMapping("/{id}")
@Operation(summary = "通过id查询详情", description = "通过id查询详情")
@PreAuthorize("@pms.hasPermission('insurancePolicy_getById')")
public R<TInsurancePolicyDetailVO> getDetailById(@PathVariable("id" ) String id) {
return tInsurancePolicyService.getDetailById(id);
}
......@@ -82,6 +85,7 @@ public class TInsurancePolicyController {
*/
@Operation(summary = "修改保单号对应起止保时间", description = "修改保单号对应起止保时间)")
@PostMapping("/update")
@PreAuthorize("@pms.hasPermission('insurancePolicy_update')")
public R update(@RequestBody @Valid InsurancePolicyListEditParam param) {
return tInsurancePolicyService.updateInsurancePolicy(param);
}
......@@ -95,6 +99,7 @@ public class TInsurancePolicyController {
*/
@Operation(summary = "删除保单号对应起止保时间", description = "删除保单号对应起止保时间")
@DeleteMapping("/{id}" )
@PreAuthorize("@pms.hasPermission('insurancePolicy_delete')")
public R deleteById(@PathVariable("id") String id) {
return tInsurancePolicyService.deleteInsurancePolicy(id);
}
......
......@@ -71,6 +71,7 @@ public class TInsuranceRefundController {
*/
@Operation(summary = "更新减员退费", description = "更新减员退费")
@PostMapping("/updateRefundMoney")
@PreAuthorize("@pms.hasPermission('insurance_custserve_reduction_money')")
public R updateRefundMoney(@RequestBody @Valid @Size(min = 1,message = "更新减员退费不能为空") List<RefundMoneyUpdateParam> paramList) {
return tInsuranceDetailService.updateRefundMoney(paramList);
}
......
......@@ -54,6 +54,7 @@ import java.math.RoundingMode;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
......@@ -2049,13 +2050,22 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//设置发票号
detail.setInvoiceNo(success.getInvoiceNo());
detailList.add(detail);
//推送修改信息
EkpUpdateParam ekpUpdateParam = new EkpUpdateParam();
ekpUpdateParam.setFd_3b5bf02d3b8fc4(success.getPolicyStart());
ekpUpdateParam.setFd_3b5bf02e1d47cc(success.getPolicyEnd());
ekpUpdateParam.setFd_3b5bf02fa14596(getBuyType(detail.getBuyType()));
ekpUpdateParam.setFd_3b5bf030ab1a56(success.getInvoiceNo());
ekpUpdateParam.setFd_3b5bf031b52314(detail.getBuyStandard());
ekpUpdateParam.setFd_3b5bf032d7a822(detail.getId());
ekpUpdateParam.setFd_3b5bf0b7b4c058("操作人:"+user.getNickname() + ";操作时间:"+LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + ";变更前发票号:" + detail.getInvoiceNo() + ";变更后发票号:" + success.getInvoiceNo());
eKPInsuranceUtil.sendUpdateToEkp(ekpUpdateParam);
}
}
}
if (CollectionUtils.isNotEmpty(detailList)){
this.updateBatchById(detailList);
//todo 推给EKP
}
//操作记录
......@@ -2066,6 +2076,31 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
return R.ok(operateList,InsurancesConstants.OPERATE_SUCCESS);
}
/**
* 购买类型转换
*
* @author licancan
* @param buyType
* @return {@link String}
*/
private String getBuyType(Integer buyType){
String result;
switch (buyType){
case 1:
result = "新增";
break;
case 3:
result = "批增";
break;
case 4:
result = "替换";
break;
default:
result = "";
}
return result;
}
/**
* 已投保信息修改
*
......@@ -2116,6 +2151,26 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
//变更记录
tBusinessOperateService.saveModificationRecord(detail.getId(),oldDetail,detail,success.getReason());
//推送修改信息
StringBuilder sb = new StringBuilder();
sb.append("操作人:"+user.getNickname() + ";操作时间:"+LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
if (!detail.getPolicyStart().toString().equals(success.getPolicyStart())){
sb.append(";变更前保单开始时间:" + detail.getPolicyStart() + ";变更后保单开始时间:" + success.getPolicyStart());
}
if (!detail.getPolicyEnd().toString().equals(success.getPolicyEnd())){
sb.append(";变更前保单结束时间:" + detail.getPolicyEnd() + ";变更后保单结束时间:" + success.getPolicyEnd());
}
if (!detail.getBuyType().equals(success.getBuyType())){
sb.append(";变更前投保类型:" + getBuyType(detail.getBuyType()) + ";变更后投保类型:" + getBuyType(success.getBuyType()));
}
EkpUpdateParam ekpUpdateParam = new EkpUpdateParam();
ekpUpdateParam.setFd_3b5bf02d3b8fc4(success.getPolicyStart());
ekpUpdateParam.setFd_3b5bf02e1d47cc(success.getPolicyEnd());
ekpUpdateParam.setFd_3b5bf02fa14596(getBuyType(success.getBuyType()));
ekpUpdateParam.setFd_3b5bf031b52314(detail.getBuyStandard());
ekpUpdateParam.setFd_3b5bf032d7a822(detail.getId());
ekpUpdateParam.setFd_3b5bf0b7b4c058(sb.toString());
eKPInsuranceUtil.sendUpdateToEkp(ekpUpdateParam);
}
}
......@@ -2140,6 +2195,10 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
*/
@Override
public R<String> updateInsuranceInsuredById(InsuranceInsuredDetailParam param) {
YifuUser user = SecurityUtils.getUser();
if (user == null || Common.isEmpty(user.getId())) {
return R.failed(CommonConstants.PLEASE_LOG_IN);
}
if (StringUtils.isBlank(param.getId())){
R.failed(InsurancesConstants.ID_IS_EMPTY);
}
......@@ -2185,7 +2244,28 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Objects.nonNull(param.getBuyType())){
byId.setBuyType(param.getBuyType());
}
//变更记录
tBusinessOperateService.saveModificationRecord(byId.getId(),old,byId,param.getReason());
//推送修改信息
StringBuilder sb = new StringBuilder();
sb.append("操作人:"+user.getNickname() + ";操作时间:"+LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
if (!byId.getPolicyStart().toString().equals(param.getPolicyStart())){
sb.append(";变更前保单开始时间:" + byId.getPolicyStart() + ";变更后保单开始时间:" + param.getPolicyStart());
}
if (!byId.getPolicyEnd().toString().equals(param.getPolicyEnd())){
sb.append(";变更前保单结束时间:" + byId.getPolicyEnd() + ";变更后保单结束时间:" + param.getPolicyEnd());
}
if (!byId.getBuyType().equals(param.getBuyType())){
sb.append(";变更前投保类型:" + getBuyType(byId.getBuyType()) + ";变更后投保类型:" + getBuyType(param.getBuyType()));
}
EkpUpdateParam ekpUpdateParam = new EkpUpdateParam();
ekpUpdateParam.setFd_3b5bf02d3b8fc4(param.getPolicyStart());
ekpUpdateParam.setFd_3b5bf02e1d47cc(param.getPolicyEnd());
ekpUpdateParam.setFd_3b5bf02fa14596(getBuyType(param.getBuyType()));
ekpUpdateParam.setFd_3b5bf031b52314(byId.getBuyStandard());
ekpUpdateParam.setFd_3b5bf032d7a822(byId.getId());
ekpUpdateParam.setFd_3b5bf0b7b4c058(sb.toString());
eKPInsuranceUtil.sendUpdateToEkp(ekpUpdateParam);
this.updateById(byId);
return R.ok(InsurancesConstants.OPERATE_SUCCESS);
}
......@@ -3536,8 +3616,13 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
.last(CommonConstants.LAST_ONE_SQL)
);
if (!Optional.ofNullable(detail).isPresent()){
param.setErrorMessage(InsurancesConstants.DATA_IS_NOT_EXIST);
param.setErrorMessage(InsurancesConstants.NOT_FOUND_INSURANCE_RECORD);
continue;
}else {
if (detail.getBuyHandleStatus() != CommonConstants.THREE_INT && detail.getBuyHandleStatus() != CommonConstants.FIVE_INT){
param.setErrorMessage(InsurancesConstants.CURRENT_STATUS_NOT_REGISTER_INVOICE_NO);
continue;
}
}
param.setErrorMessage(CommonConstants.RESULT_DATA_SUCESS);
}
......
......@@ -278,6 +278,12 @@
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
<if test="param.buyStandardMin != null and param.buyStandardMin.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ >= ]]> #{param.buyStandardMin}
</if>
<if test="param.buyStandardMax != null and param.buyStandardMax.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ <= ]]> #{param.buyStandardMax}
</if>
ORDER BY a.BUY_HANDLE_STATUS,a.CREATE_TIME DESC
</select>
<!--通过id查询商险信息-->
......@@ -421,6 +427,12 @@
<if test="param.authSql != null and param.authSql.trim() != ''">
${param.authSql}
</if>
<if test="param.buyStandardMin != null and param.buyStandardMin.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ >= ]]> #{param.buyStandardMin}
</if>
<if test="param.buyStandardMax != null and param.buyStandardMax.trim() != ''">
AND a.BUY_STANDARD <![CDATA[ <= ]]> #{param.buyStandardMax}
</if>
ORDER BY a.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