Commit 645db83a authored by zhaji's avatar zhaji

"feature-zhaJi:新增与EKP交互流程(调试中)"

parent 2e760999
......@@ -789,5 +789,10 @@ public class InsurancesConstants {
*/
public static final String NO_UPDATE_DETAIL_JURISDICTION = "无更新当前保单信息的权限";
/**
* 保单信息已过期,不能进行出险操作
*/
public static final String INSURANCES_DETAIL_IS_OVERDUE_ERROR = "保单信息已过期,不能进行出险操作";
}
package com.yifu.cloud.plus.v1.yifu.insurances.util;
import cn.hutool.json.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.EKPInteractiveParam;
import com.yifu.cloud.plus.v1.yifu.insurances.vo.TInsuranceSettlePushParam;
import org.springframework.core.io.FileSystemResource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.*;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.io.File;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
/**
* @author zhaji
......@@ -16,39 +25,158 @@ import java.io.File;
*
* @date 2022-08-05 09:42:33
*/
@Slf4j
@Component
public class EKPUtil {
@Getter
public static String url;
@Getter
public static String LoginName;
@Getter
private static String fdModelId;
@Getter
private static String fdFlowId;
@Getter
private static String docStatus;
@Getter
private static String docSubject;
@Value("${ekp.url}")
public void setUrl(String db) {
url = db;
}
@Value("${ekp.LoginName}")
public void setLoginName(String db) {
LoginName = db;
}
@Value("${ekp.fdModelId}")
public void setFdModelId(String db) {
fdModelId = db;
}
@Value("${ekp.fdFlowId}")
public void setFdFlowId(String db) {
fdFlowId = db;
}
@Value("${ekp.docStatus}")
public void setDocStatus(String db) {
docStatus = db;
}
@Value("${ekp.docSubject}")
public void setDocSubject(String db) {
docSubject = db;
}
/**
* 多层级的VO对象,且包含上传功能的样例
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"]
*/
public static void testAddNewsInRestTemplate() throws Exception{
public static String sendToEKP(EKPInteractiveParam param){
System.out.println("开始推送EKP");
RestTemplate yourRestTemplate = new RestTemplate();
TInsuranceSettlePushParam formValues = new TInsuranceSettlePushParam();
String jsonObject = new ObjectMapper().writeValueAsString(formValues);
TInsuranceSettlePushParam pushParam = InsuranceDetail2PushParam(param);
try{
String formValues = new ObjectMapper().writeValueAsString(pushParam);
//指向EKP的接口url
String url = "http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel";
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject loginName = new JSONObject();
loginName.append("LoginName",LoginName);
String loginData = new ObjectMapper().writeValueAsString(loginName);
MultiValueMap<String,Object> wholeForm = new LinkedMultiValueMap<>();
wholeForm.add("docSubject", new String("接口发起流程".getBytes("UTF-8"),"ISO-8859-1") );
wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docStatus", 20);
wholeForm.add("fdModelId", "181d73279372e5a55438a47d7436ab7e");
wholeForm.add("fdFlowId", "18267f206233f29cbd3c5ee425c9408a");
wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") );
//wholeForm.add("docCreator", "{\"LoginName\":\"admin\"}");
wholeForm.add("docCreator", loginData);
wholeForm.add("docStatus", docStatus);
wholeForm.add("fdModelId", fdModelId);
wholeForm.add("fdFlowId", fdFlowId);
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
//wholeForm.add("formValues", new String("{\"fd_3adfe6af71a1cc\":\"王五\", \"fd_3adfe658c6229e\":\"2019-03-26\", \"fd_3adfe6592b4158\":\"这里内容\"}".getBytes("UTF-8"),"ISO-8859-1") );
System.out.println("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
System.out.println("交易开始");
ResponseEntity<String> obj = yourRestTemplate.exchange(url, HttpMethod.POST, entity, String.class);
System.out.println("交易结束");
System.out.println("obj"+obj);
String body = obj.getBody();
System.out.println(body);
if (StringUtils.isBlank(body)){
System.out.println("交易失败"+body);
return body;
}else{
System.out.println("交易成功"+body);
return body;
}
}catch (Exception e){
log.info(e.toString());
return e.getMessage();
}
}
public static TInsuranceSettlePushParam InsuranceDetail2PushParam(EKPInteractiveParam param){
String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
TInsuranceSettlePushParam pushParam = new TInsuranceSettlePushParam();
//单据类型
pushParam.setFd_3adfe6af71a1cc(param.getSettleType());
//项目编码
pushParam.setFd_3adfe658c6229e(param.getDeptNo());
//项目名称
pushParam.setFd_3adfe6592b4158(param.getDeptName());
//客户编码
pushParam.setFd_3adfe6598281e8(param.getCustomerCode());
//客户名称
pushParam.setFd_3adfe7a2688902(param.getCustomerName());
//发生日期
pushParam.setFd_3adfe67c24dace(format);
//姓名
pushParam.setFd_3adfe65d759650(param.getEmpName());
//身份证号
pushParam.setFd_3adfe65dbd9f68(param.getEmpIdcardNo());
//发票号
pushParam.setFd_3adfe65e0cd094(param.getInvoiceNo());
//险种
pushParam.setFd_3adfe65f6599e4(param.getInsuranceTypeName());
//保险公司
pushParam.setFd_3adfe65ea04728(param.getInsuranceCompanyName());
//保单号
pushParam.setFd_3adfe65e60e110(param.getPolicyNo());
//保险开始日期
pushParam.setFd_3adfe6b7e0ede8(param.getPolicyStart().toString());
//保险结束日期
pushParam.setFd_3adfe6b847bfe6(param.getPolicyEnd().toString());
//购买标准
pushParam.setFd_3adfe6d55384c6(param.getBuyStandard());
//实际保费
pushParam.setFd_3adfe6610c0d2c(param.getActualPremium());
//医保
pushParam.setFd_3adfe66041a996(param.getMedicalQuota());
//事故或残疾
pushParam.setFd_3adfe6609aa810(param.getDieDisableQuota());
//预估保费
pushParam.setFd_3adfe6e30f2a3c(param.getEstimatePremium());
//结算月
pushParam.setFd_3aea2f0180eccc(param.getSettleMonth());
return pushParam;
}
}
}
......@@ -14,7 +14,7 @@ import java.io.Serializable;
@Data
@Tag(name = "项目类")
public class Dept implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 项目编码
*/
......
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
/**
* @author zhaji
* @description TODO
* @date 2022-08-08 17:59:20
*/
@Data
public class EKP {
@Value("${ekp.url}")
private String url;
@Value("${ekp.fdModelId}")
private String fdModelId;
@Value("${ekp.fdFlowId}")
private String fdFlowId;
@Value("${ekp.docStatus}")
private String docStatus;
@Value("${ekp.docSubject}")
private String docSubject;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* @author zhaji
* @description EKP交互类
* @date 2022-08-09 11:09:12
*/
@Data
public class EKPInteractiveParam implements Serializable {
private static final long serialVersionUID = -2689686777914935788L;
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
@Schema(description = "主键")
private String id;
/**
* 单据类型 (0、与薪资合并结算 1、单独结算)
*/
@Schema(description = "单据类型 (0、预估单 1、实缴单)")
private Integer settleType;
/**
* 项目编码
*/
@Schema(description = "项目编码")
private String deptNo;
/**
* 项目名称
*/
@Schema(description = "项目名称")
private String deptName;
/**
* 客户名称
*/
@Schema(description = "客户名称")
private String customerName;
/**
* 客户编码
*/
@Schema(description = "客户编码")
private String customerCode;
/**
* 员工姓名
*/
@Schema(description = "员工姓名")
private String empName;
/**
* 员工身份证号
*/
@Schema(description = "员工身份证号")
private String empIdcardNo;
/**
* 发票号
*/
@Schema(description = "发票号")
private String invoiceNo;
/**
* 发生日期
*/
@Schema(description = "发生日期")
private Date happenDate;
/**
* 保单编号
*/
@Schema(description = "保单编号")
private String policyNo;
/**
* 保险公司名称(冗余字段)
*/
@Schema(description = "保险公司名称")
private String insuranceCompanyName;
/**
* 险种名称
*/
@Schema(description = "险种名称")
private String insuranceTypeName;
/**
* 保单开始时间
*/
@Schema(description = "保单开始时间")
private LocalDate policyStart;
/**
* 保单结束时间
*/
@Schema(description = "保单结束时间")
private LocalDate policyEnd;
/**
* 购买标准
*/
@Schema(description = "购买标准")
private String buyStandard;
/**
* 医疗额度
*/
@Schema(description = "医疗额度")
private String medicalQuota;
/**
* 身故或残疾额度
*/
@Schema(description = "身故或残疾额度")
private String dieDisableQuota;
/**
* 实际保费
*/
@Schema(description = "实际保费")
private BigDecimal actualPremium;
/**
* 预估保费
*/
@Schema(description = "预估保费")
private BigDecimal estimatePremium;
/**
* 结算月
*/
@Schema(description = "结算月")
private String settleMonth;
/**
* 单据状态
*/
@Schema(description = "状态:1新增结算单,2作废结算信息,3更新保单信息")
private Integer interactiveType;
}
package com.yifu.cloud.plus.v1.yifu.insurances.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.cglib.core.Local;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
/**
* @author zhaji
......@@ -11,160 +18,200 @@ import java.time.LocalDate;
* @date 2022-08-05 10:32:16
*/
@Data
public class TInsuranceSettlePushParam {
public class TInsuranceSettlePushParam{
/**
* ID主键 36位
*/
private String fd_id ;
/**
* 单据类型 200 单选(预估单,实缴单,差异单)
* 单据类型 200 单选(1,预估单,2,实缴单,3,差异单)
*/
private String fd_3adfe6af71a1cc;
@Schema(description = "单据类型")
private Integer fd_3adfe6af71a1cc;
/**
* 项目编码 200
*/
@Schema(description = "项目编码")
private String fd_3adfe658c6229e;
/**
* 项目名称 200
*/
@Schema(description = "项目名称")
private String fd_3adfe6592b4158;
/**
* 单号 200
*/
@Schema(description = "单号")
private String fd_3adfe67a9f6364;
/**
* 客户编码 200
*/
@Schema(description = "客户编码")
private String fd_3adfe6598281e8;
/**
* 客户名称 200
*/
@Schema(description = "客户名称")
private String fd_3adfe7a2688902;
/**
* 发生日期 "xxxx--xx--xx"
*/
private LocalDate fd_3adfe67c24dace;
@Schema(description = "发生日期")
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
private String fd_3adfe67c24dace;
/**
* 姓名 200
*/
@Schema(description = "姓名")
private String fd_3adfe65d759650;
/**
* 身份证号 200
*/
@Schema(description = "身份证号")
private String fd_3adfe65dbd9f68;
/**
* 发票号 200
*/
@Schema(description = "发票号")
private String fd_3adfe65e0cd094;
/**
* 险种 200
*/
@Schema(description = "险种")
private String fd_3adfe65f6599e4;
/**
* 保险公司 200
*/
@Schema(description = "保险公司")
private String fd_3adfe65ea04728;
/**
* 保单号 200
*/
@Schema(description = "保单号")
private String fd_3adfe65e60e110;
/**
* 保险开始日期 "xxxx--xx--xx"
*/
private LocalDate fd_3adfe6b7e0ede8;
@Schema(description = "保险开始日期")
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
private String fd_3adfe6b7e0ede8;
/**
* 保险结束日期 "xxxx--xx--xx"
*/
private LocalDate fd_3adfe6b847bfe6;
@Schema(description = "保险结束日期")
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
private String fd_3adfe6b847bfe6;
/**
* 购买标准 精确到小数点后两位
*/
private Double fd_3adfe6d55384c6;
@Schema(description = "购买标准")
private String fd_3adfe6d55384c6;
/**
* 实际保费 精确到小数点后两位
*/
private Double fd_3adfe6610c0d2c;
@Schema(description = "实际保费")
private BigDecimal fd_3adfe6610c0d2c;
/**
* 医保 精确到小数点后两位
*/
private Double fd_3adfe66041a996;
@Schema(description = "医保")
private String fd_3adfe66041a996;
/**
* 事故或残疾 200
*/
@Schema(description = "事故或残疾")
private String fd_3adfe6609aa810;
/**
* 应收 精确到小数点后两位
* 预估保费(应收) 精确到小数点后两位
*/
private Double fd_3adfe6e30f2a3c;
@Schema(description = "预估保费")
private BigDecimal fd_3adfe6e30f2a3c;
/**
* 应收 200 单选(已结算,结算中,未结算)
* 结算状态 200 单选(1未结算,2结算中,3已结算)
*/
@Schema(description = "结算状态")
private String fd_3adfe6ec6a8cbe;
/**
* 收款状态 200 单选(已收,未收)
* 收款状态 200 单选(1未收,2已收)
*/
@Schema(description = "收款状态")
private String fd_3adfe6ef5dfaac;
/**
* 收入结算单号 200
*/
@Schema(description = "收入结算单号")
private String fd_3adfe79fd04606;
/**
* 收款认领单号 200
*/
@Schema(description = "收款认领单号")
private String fd_3adfe7a117f086;
/**
* 应支出 精确到小数点后两位
*/
@Schema(description = "应支出")
private Double fd_3adfe6e3911ffe;
/**
* 支出结算状态 200 单选(已结算,结算中,未结算)
*/
@Schema(description = "支出结算状态")
private String fd_3adfe6eda67236;
/**
* 付款状态 200 单选(已收,未收)
*/
@Schema(description = "付款状态")
private String fd_3adfe6f05531ec;
/**
* 支出结算单号 200
*/
@Schema(description = "支出结算单号")
private String fd_3adfe7a035849c;
/**
* 付款单号 200
*/
@Schema(description = "付款单号")
private String fd_3adfe7a08eba96;
/**
* 结算月份 200
*/
@Schema(description = "结算月份")
private String fd_3aea2f0180eccc;
/**
* 状态 200
*/
@Schema(description = "状态1新增结算单,2作废结算信息,3更新保单信息")
private String fd_3af9197b31071c;
}
......@@ -442,8 +442,8 @@ public class TInsuranceDetailController {
*/
@Operation(summary = "查询项目列表", description = "查询项目列表")
@GetMapping("/deptList")
public R getDeptList() {
return tInsuranceDetailService.getDeptListByUser();
public R getDeptList(){
return tInsuranceDetailService.getDeptList();
}
/**
......
......@@ -15,3 +15,10 @@ spring:
username: root
password: yf_zsk
url: jdbc:mysql://192.168.1.65:22306/mvp_insurances?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
ekp:
url: http://119.96.227.251:8080/api/sys-modeling/appModelRestService/addModel
fdModelId: '181d73279372e5a55438a47d7436ab7e'
fdFlowId: '18267f206233f29cbd3c5ee425c9408a'
docStatus: '20'
LoginName: 'admin'
docSubject : '接口发起流程'
\ No newline at end of file
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