Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
d7347ca7
Commit
d7347ca7
authored
Aug 30, 2022
by
zhaji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"feature-zhaJi:移动EKP对接类的位置"
parent
a8060772
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
376 additions
and
0 deletions
+376
-0
EKPInsuranceUtil.java
...om/yifu.cloud.plus.v1/yifu/ekp/util/EKPInsuranceUtil.java
+245
-0
EKPInsurancePushParam.java
...yifu/cloud/plus/v1/yifu/ekp/vo/EKPInsurancePushParam.java
+131
-0
No files found.
yifu-common/yifu-common-ekp/src/main/java/com/yifu.cloud.plus.v1/yifu/ekp/util/EKPInsuranceUtil.java
0 → 100644
View file @
d7347ca7
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
util
;
import
cn.hutool.json.JSONObject
;
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.EkpSalaryProperties
;
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.TInsuranceSettlePushParam
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.boot.context.properties.EnableConfigurationProperties
;
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
javax.annotation.Resource
;
import
java.time.LocalDate
;
import
java.time.format.DateTimeFormatter
;
/**
* @author zhaji
* @description EKP交互工具类
*
* @date 2022-08-05 09:42:33
*/
@Slf4j
@EnableConfigurationProperties
(
EkpSalaryProperties
.
class
)
public
class
EKPInsuranceUtil
{
@Resource
private
EkpSalaryProperties
ekpProperties
;
/**
* 多层级的VO对象,且包含上传功能的样例
* 注意key的书写格式,类似EL表达式的方式,属性关系用'.', 列表和数组关系用[],Map关系用["xxx"]
*/
public
String
sendToEKP
(
EKPInteractiveParam
param
){
log
.
info
(
"推送EKP开始"
);
RestTemplate
yourRestTemplate
=
new
RestTemplate
();
EKPInsurancePushParam
pushParam
=
insuranceDetail2PushParam
(
param
);
try
{
String
formValues
=
new
ObjectMapper
().
writeValueAsString
(
pushParam
);
log
.
info
(
"formValues:"
+
formValues
);
//指向EKP的接口url
//把ModelingAppModelParameterAddForm转换成MultiValueMap
JSONObject
loginName
=
new
JSONObject
();
loginName
.
append
(
"LoginName"
,
ekpProperties
.
getInsuranceLoginName
());
String
loginData
=
new
ObjectMapper
().
writeValueAsString
(
loginName
);
MultiValueMap
<
String
,
Object
>
wholeForm
=
new
LinkedMultiValueMap
<>();
//wholeForm.add("docSubject", new String(docSubject.getBytes("UTF-8"),"ISO-8859-1") );
wholeForm
.
add
(
"docSubject"
,
ekpProperties
.
getInsuranceFocSubject
());
wholeForm
.
add
(
"docCreator"
,
"{\"LoginName\":\"admin\"}"
);
//wholeForm.add("docCreator", loginData);
wholeForm
.
add
(
"docStatus"
,
ekpProperties
.
getInsuranceDocStatus
());
wholeForm
.
add
(
"fdModelId"
,
ekpProperties
.
getInsuranceFdModelId
());
wholeForm
.
add
(
"fdFlowId"
,
ekpProperties
.
getInsuranceFdFlowId
());
//wholeForm.add("formValues", new String(formValues.getBytes("UTF-8"),"ISO-8859-1"));
wholeForm
.
add
(
"formValues"
,
formValues
);
//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
ResponseEntity
<
String
>
obj
=
yourRestTemplate
.
exchange
(
ekpProperties
.
getInsuranceUrl
(),
HttpMethod
.
POST
,
entity
,
String
.
class
);
log
.
info
(
"obj:"
+
obj
);
String
body
=
obj
.
getBody
();
if
(
StringUtils
.
isBlank
(
body
)){
log
.
error
(
"交易失败"
+
body
);
return
null
;
}
else
{
log
.
info
(
"交易成功:"
+
body
);
return
body
;
}
}
catch
(
Exception
e
){
log
.
error
(
"交易失败:"
,
e
);
return
null
;
}
}
/**
* 将类转换成EKP要求的格式
*
* @author zhaji
* @param param 转换类
* @return {@link TInsuranceSettlePushParam}
*/
public
static
EKPInsurancePushParam
insuranceDetail2PushParam
(
EKPInteractiveParam
param
){
String
format
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
EKPInsurancePushParam
pushParam
=
new
EKPInsurancePushParam
();
param
.
setHappenDate
(
format
);
//ekpId
if
(
null
!=
param
.
getDetailId
()
&&
null
!=
param
.
getDefaultSettleId
()){
pushParam
.
setFd_3afa8a70006bea
(
param
.
getDetailId
()+
CommonConstants
.
DOWN_LINE_STRING
+
param
.
getDefaultSettleId
());
}
else
{
pushParam
.
setFd_3afa8a70006bea
(
CommonConstants
.
EMPTY_STRING
);
}
//单据类型
if
(
null
!=
param
.
getSettleType
()){
pushParam
.
setFd_3adfe6af71a1cc
(
param
.
getSettleType
());
}
else
{
pushParam
.
setFd_3adfe6af71a1cc
(
CommonConstants
.
ZERO_INT
);
}
//项目编码
pushParam
.
setFd_3adfe658c6229e
(
param
.
getDeptNo
());
if
(
null
!=
param
.
getDeptNo
()){
pushParam
.
setFd_3adfe658c6229e
(
param
.
getDeptNo
());
}
else
{
pushParam
.
setFd_3adfe658c6229e
(
CommonConstants
.
EMPTY_STRING
);
}
//项目名称
pushParam
.
setFd_3adfe6592b4158
(
param
.
getDeptName
());
if
(
null
!=
param
.
getDeptName
()){
pushParam
.
setFd_3adfe6592b4158
(
param
.
getDeptName
());
}
else
{
pushParam
.
setFd_3adfe6592b4158
(
CommonConstants
.
EMPTY_STRING
);
}
//客户编码
pushParam
.
setFd_3adfe6598281e8
(
param
.
getCustomerCode
());
if
(
null
!=
param
.
getCustomerCode
()){
pushParam
.
setFd_3adfe6598281e8
(
param
.
getCustomerCode
());
}
else
{
pushParam
.
setFd_3adfe6598281e8
(
CommonConstants
.
EMPTY_STRING
);
}
//客户名称
pushParam
.
setFd_3adfe7a2688902
(
param
.
getCustomerName
());
if
(
null
!=
param
.
getCustomerName
()){
pushParam
.
setFd_3adfe7a2688902
(
param
.
getCustomerName
());
}
else
{
pushParam
.
setFd_3adfe7a2688902
(
CommonConstants
.
EMPTY_STRING
);
}
//发生日期
pushParam
.
setFd_3adfe67c24dace
(
param
.
getHappenDate
());
//姓名
pushParam
.
setFd_3adfe65d759650
(
param
.
getEmpName
());
if
(
null
!=
param
.
getEmpName
()){
pushParam
.
setFd_3adfe65d759650
(
param
.
getEmpName
());
}
else
{
pushParam
.
setFd_3adfe65d759650
(
CommonConstants
.
EMPTY_STRING
);
}
//身份证号
pushParam
.
setFd_3adfe65dbd9f68
(
param
.
getEmpIdcardNo
());
if
(
null
!=
param
.
getEmpIdcardNo
()){
pushParam
.
setFd_3adfe65dbd9f68
(
param
.
getEmpIdcardNo
());
}
else
{
pushParam
.
setFd_3adfe65dbd9f68
(
CommonConstants
.
EMPTY_STRING
);
}
//发票号
if
(
null
!=
param
.
getInvoiceNo
()){
pushParam
.
setFd_3adfe65e0cd094
(
param
.
getInvoiceNo
());
}
else
{
pushParam
.
setFd_3adfe65e0cd094
(
CommonConstants
.
EMPTY_STRING
);
}
//险种
if
(
null
!=
param
.
getInsuranceTypeName
()){
pushParam
.
setFd_3adfe65f6599e4
(
param
.
getInsuranceTypeName
());
}
else
{
pushParam
.
setFd_3adfe65f6599e4
(
CommonConstants
.
EMPTY_STRING
);
}
//保险公司
if
(
null
!=
param
.
getInsuranceCompanyName
()){
pushParam
.
setFd_3adfe65ea04728
(
param
.
getInsuranceCompanyName
());
}
else
{
pushParam
.
setFd_3adfe65ea04728
(
CommonConstants
.
EMPTY_STRING
);
}
//保单号
if
(
null
!=
param
.
getPolicyNo
()){
pushParam
.
setFd_3adfe65e60e110
(
param
.
getPolicyNo
());
}
else
{
pushParam
.
setFd_3adfe65e60e110
(
CommonConstants
.
EMPTY_STRING
);
}
//保险开始日期
if
(
null
!=
param
.
getPolicyStart
()){
pushParam
.
setFd_3adfe6b7e0ede8
(
param
.
getPolicyStart
().
toString
());
}
else
{
pushParam
.
setFd_3adfe6b7e0ede8
(
CommonConstants
.
EMPTY_STRING
);
}
//保险结束日期
if
(
null
!=
param
.
getPolicyEnd
()){
pushParam
.
setFd_3adfe6b847bfe6
(
param
.
getPolicyEnd
().
toString
());
}
else
{
pushParam
.
setFd_3adfe6b847bfe6
(
CommonConstants
.
EMPTY_STRING
);
}
//购买标准
pushParam
.
setFd_3adfe6d55384c6
(
param
.
getBuyStandard
());
if
(
null
!=
param
.
getBuyStandard
()){
pushParam
.
setFd_3adfe6d55384c6
(
param
.
getBuyStandard
());
}
else
{
pushParam
.
setFd_3adfe6d55384c6
(
CommonConstants
.
EMPTY_STRING
);
}
//实际保费
if
(
null
!=
param
.
getActualPremium
()){
pushParam
.
setFd_3adfe6610c0d2c
(
param
.
getActualPremium
().
toString
());
}
else
{
pushParam
.
setFd_3adfe6610c0d2c
(
CommonConstants
.
EMPTY_STRING
);
}
//医保
if
(
null
!=
param
.
getMedicalQuota
()){
pushParam
.
setFd_3adfe66041a996
(
param
.
getMedicalQuota
());
}
else
{
pushParam
.
setFd_3adfe66041a996
(
CommonConstants
.
EMPTY_STRING
);
}
//事故或残疾
if
(
null
!=
param
.
getDieDisableQuota
()){
pushParam
.
setFd_3adfe6609aa810
(
param
.
getDieDisableQuota
());
}
else
{
pushParam
.
setFd_3adfe6609aa810
(
CommonConstants
.
EMPTY_STRING
);
}
//预估保费
if
(
null
!=
param
.
getEstimatePremium
()){
pushParam
.
setFd_3adfe6e30f2a3c
(
param
.
getEstimatePremium
().
toString
());
}
else
{
pushParam
.
setFd_3adfe6e30f2a3c
(
CommonConstants
.
EMPTY_STRING
);
}
//结算月
if
(
null
!=
param
.
getSettleMonth
()){
pushParam
.
setFd_3aea2f0180eccc
(
param
.
getSettleMonth
());
}
else
{
pushParam
.
setFd_3aea2f0180eccc
(
CommonConstants
.
EMPTY_STRING
);
}
//交易类型
if
(
null
!=
param
.
getInteractiveType
()){
pushParam
.
setFd_3af9197b31071c
(
param
.
getInteractiveType
());
}
else
{
pushParam
.
setFd_3af9197b31071c
(
CommonConstants
.
ZERO_INT
);
}
//有无预估
if
(
null
!=
param
.
getEstimateStatus
()){
pushParam
.
setFd_3b0a5937928c8c
(
param
.
getEstimateStatus
());
}
else
{
pushParam
.
setFd_3b0a5937928c8c
(
CommonConstants
.
EMPTY_STRING
);
}
return
pushParam
;
}
}
yifu-common/yifu-common-ekp/src/main/java/com/yifu/cloud/plus/v1/yifu/ekp/vo/EKPInsurancePushParam.java
0 → 100644
View file @
d7347ca7
package
com
.
yifu
.
cloud
.
plus
.
v1
.
yifu
.
ekp
.
vo
;
import
lombok.Data
;
/**
* @author zhaji
* @description 结算信息推送类
* @date 2022-08-05 10:32:16
*/
@Data
public
class
EKPInsurancePushParam
{
/**
* 单据类型 200 单选(1,预估单,2,实缴单,3,差异单)
*/
private
Integer
fd_3adfe6af71a1cc
;
/**
* 交易类型 交易类型 1新增结算单,2作废结算信息,3更新保单信息
*/
private
Integer
fd_3af9197b31071c
;
/**
* 项目编码 200
*/
private
String
fd_3adfe658c6229e
;
/**
* 项目名称 200
*/
private
String
fd_3adfe6592b4158
;
/**
* 客户编码 200
*/
private
String
fd_3adfe6598281e8
;
/**
* 客户名称 200
*/
private
String
fd_3adfe7a2688902
;
/**
* 发生日期 "xxxx--xx--xx"
*/
private
String
fd_3adfe67c24dace
;
/**
* 姓名 200
*/
private
String
fd_3adfe65d759650
;
/**
* 身份证号 200
*/
private
String
fd_3adfe65dbd9f68
;
/**
* 发票号 200
*/
private
String
fd_3adfe65e0cd094
;
/**
* 险种
*/
private
String
fd_3adfe65f6599e4
;
/**
* 保险公司
*/
private
String
fd_3adfe65ea04728
;
/**
* 保单号
*/
private
String
fd_3adfe65e60e110
;
/**
* 保险开始日期 "xxxx--xx--xx"
*/
private
String
fd_3adfe6b7e0ede8
;
/**
* 保险结束日期 "xxxx--xx--xx"
*/
private
String
fd_3adfe6b847bfe6
;
/**
* 购买标准
*/
private
String
fd_3adfe6d55384c6
;
/**
* 实际保费
*/
private
String
fd_3adfe6610c0d2c
;
/**
* 医保 精确到小数点后两位
*/
private
String
fd_3adfe66041a996
;
/**
* 事故或残疾 200
*/
private
String
fd_3adfe6609aa810
;
/**
* 预估保费(应收) 精确到小数点后两位
*/
private
String
fd_3adfe6e30f2a3c
;
/**
* 结算月份 200
*/
private
String
fd_3aea2f0180eccc
;
/**
* 商险ID(商险id_结算id)
*/
private
String
fd_3afa8a70006bea
;
/**
* 有无预估(有,无)
*/
private
String
fd_3b0a5937928c8c
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment