Commit 826581b80a2a1f8206c009d085b7aa50892f07db
1 parent
be4a63f3
金蝶收款单提交 修复应收单 结算方式明细缺失的问题
Showing
22 changed files
with
968 additions
and
177 deletions
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/component/TransferComponent.java
@@ -4,6 +4,7 @@ package com.diligrp.etrade.thirdparty.component; | @@ -4,6 +4,7 @@ package com.diligrp.etrade.thirdparty.component; | ||
4 | import com.diligrp.etrade.core.Constants; | 4 | import com.diligrp.etrade.core.Constants; |
5 | import com.diligrp.etrade.thirdparty.domain.co.basic.BaseSourceCo; | 5 | import com.diligrp.etrade.thirdparty.domain.co.basic.BaseSourceCo; |
6 | import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo; | 6 | import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo; |
7 | +import com.diligrp.etrade.thirdparty.domain.co.rec.BaseRecCo; | ||
7 | import com.diligrp.etrade.thirdparty.domain.model.*; | 8 | import com.diligrp.etrade.thirdparty.domain.model.*; |
8 | import com.diligrp.etrade.thirdparty.mapper.TransMapper; | 9 | import com.diligrp.etrade.thirdparty.mapper.TransMapper; |
9 | import com.diligrp.etrade.thirdparty.type.ProcessType; | 10 | import com.diligrp.etrade.thirdparty.type.ProcessType; |
@@ -31,24 +32,63 @@ public class TransferComponent { | @@ -31,24 +32,63 @@ public class TransferComponent { | ||
31 | private TransMapper transMapper; | 32 | private TransMapper transMapper; |
32 | 33 | ||
33 | /** | 34 | /** |
35 | + * 转换数据recCo | ||
36 | + * | ||
37 | + * @param co CO | ||
38 | + * @param marketId 市场 ID | ||
39 | + * @param systemCode 系统代码 | ||
40 | + */ | ||
41 | + public void transRecCo(BaseRecCo co, Long marketId, String systemCode) { | ||
42 | + co.setFDATE(LocalDateTime.now().format(DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT))); | ||
43 | + co.setFCURRENCYID(new FCURRENCYID()); | ||
44 | + co.setFPAYORGID(new FPAYORGID()); | ||
45 | + co.setFSALEORGID(new FSALEORGID()); | ||
46 | + co.setFSETTLEORGID(new FSETTLEORGID()); | ||
47 | + co.setFSETTLEMAINBOOKID(new FSETTLEMAINBOOKID()); | ||
48 | + co.getFRECEIVEBILLENTRY().forEach(e-> e.setFPURPOSEID(new FPURPOSEID())); | ||
49 | + if (!ObjectUtils.isEmpty(co.getFCONTACTUNIT())) { | ||
50 | + this.transFCONTACTUNIT(co.getFCONTACTUNIT()); | ||
51 | + } | ||
52 | + if (!ObjectUtils.isEmpty(co.getFPAYUNIT())) { | ||
53 | + this.transFPAYUNIT(co.getFPAYUNIT()); | ||
54 | + } | ||
55 | + if (!ObjectUtils.isEmpty(co.getFSALEDEPTID())) { | ||
56 | + var fNumber = this.transDepId(co.getFSALEDEPTID()); | ||
57 | + if (!ObjectUtils.isEmpty(fNumber)) { | ||
58 | + FCOSTDEPARTMENTID fCOSTDEPARTMENTID = new FCOSTDEPARTMENTID(); | ||
59 | + fCOSTDEPARTMENTID.setFNUMBER(fNumber); | ||
60 | + co.getFRECEIVEBILLENTRY().forEach(e -> e.setFCOSTDEPARTMENTID(fCOSTDEPARTMENTID)); | ||
61 | + } | ||
62 | + } | ||
63 | + this.transPayOrgId(co.getFPAYORGID(), marketId, systemCode); | ||
64 | + this.transSaleOrgId(co.getFSALEORGID(), marketId, systemCode); | ||
65 | + this.transSettleOrgId(co.getFSETTLEORGID(), marketId, systemCode); | ||
66 | + this.transCurrency(co.getFCURRENCYID(), marketId, systemCode); | ||
67 | + this.transSettleMainBookCurrency(co.getFSETTLEMAINBOOKID(), marketId, systemCode); | ||
68 | + } | ||
69 | + | ||
70 | + /** | ||
34 | * 转换数据baseCo | 71 | * 转换数据baseCo |
35 | * | 72 | * |
36 | * @param co CO | 73 | * @param co CO |
37 | * @param marketId 市场 ID | 74 | * @param marketId 市场 ID |
38 | * @param systemCode 系统代码 | 75 | * @param systemCode 系统代码 |
39 | */ | 76 | */ |
40 | - public void transBaseCo(BaseBillCo co, Long marketId, String systemCode) { | ||
41 | - co.setF_ZDB_Text1(ObjectUtils.isEmpty(co.getF_ZDB_Text())?null:co.getF_ZDB_Text()); | 77 | + public void transBillCo(BaseBillCo co, Long marketId, String systemCode) { |
78 | + co.setF_ZDB_Text1(ObjectUtils.isEmpty(co.getF_ZDB_Text()) ? null : co.getF_ZDB_Text()); | ||
42 | co.setF_PZCW_Text(null); | 79 | co.setF_PZCW_Text(null); |
43 | co.setF_PZCW_Text1(null); | 80 | co.setF_PZCW_Text1(null); |
44 | co.setF_ZDB_Text(null); | 81 | co.setF_ZDB_Text(null); |
45 | - co.setF_ZDB_Text667(ObjectUtils.isEmpty(co.getF_ZDB_Text667())?null:ProcessType.fromCode(co.getF_ZDB_Text667()).name); | 82 | + co.setF_ZDB_Text667(ObjectUtils.isEmpty(co.getF_ZDB_Text667()) ? null : ProcessType.fromCode(co.getF_ZDB_Text667()).name); |
46 | co.setFDATE(LocalDateTime.now().format(DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT))); | 83 | co.setFDATE(LocalDateTime.now().format(DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT))); |
47 | co.setFCURRENCYID(new FCURRENCYID()); | 84 | co.setFCURRENCYID(new FCURRENCYID()); |
48 | co.setFMAINBOOKSTDCURRID(new FMAINBOOKSTDCURRID()); | 85 | co.setFMAINBOOKSTDCURRID(new FMAINBOOKSTDCURRID()); |
49 | co.setFPAYORGID(new FPAYORGID()); | 86 | co.setFPAYORGID(new FPAYORGID()); |
50 | co.setFSALEORGID(new FSALEORGID()); | 87 | co.setFSALEORGID(new FSALEORGID()); |
51 | co.setFSETTLEORGID(new FSETTLEORGID()); | 88 | co.setFSETTLEORGID(new FSETTLEORGID()); |
89 | + if (!ObjectUtils.isEmpty(co.getFSettleTypeID())){ | ||
90 | + co.getFEntityDetail().forEach(e-> e.setFSettleTypeID(co.getFSettleTypeID())); | ||
91 | + } | ||
52 | if (!ObjectUtils.isEmpty(co.getFORDERID())) { | 92 | if (!ObjectUtils.isEmpty(co.getFORDERID())) { |
53 | this.transOrderId(co.getFORDERID()); | 93 | this.transOrderId(co.getFORDERID()); |
54 | } | 94 | } |
@@ -60,10 +100,10 @@ public class TransferComponent { | @@ -60,10 +100,10 @@ public class TransferComponent { | ||
60 | } | 100 | } |
61 | if (!ObjectUtils.isEmpty(co.getFSALEDEPTID())) { | 101 | if (!ObjectUtils.isEmpty(co.getFSALEDEPTID())) { |
62 | var fNumber = this.transDepId(co.getFSALEDEPTID()); | 102 | var fNumber = this.transDepId(co.getFSALEDEPTID()); |
63 | - if (!ObjectUtils.isEmpty(fNumber)){ | 103 | + if (!ObjectUtils.isEmpty(fNumber)) { |
64 | FCOSTDEPARTMENTID fCOSTDEPARTMENTID = new FCOSTDEPARTMENTID(); | 104 | FCOSTDEPARTMENTID fCOSTDEPARTMENTID = new FCOSTDEPARTMENTID(); |
65 | fCOSTDEPARTMENTID.setFNUMBER(fNumber); | 105 | fCOSTDEPARTMENTID.setFNUMBER(fNumber); |
66 | - co.getFEntityDetail().forEach(e->e.setFCOSTDEPARTMENTID(fCOSTDEPARTMENTID)); | 106 | + co.getFEntityDetail().forEach(e -> e.setFCOSTDEPARTMENTID(fCOSTDEPARTMENTID)); |
67 | } | 107 | } |
68 | } | 108 | } |
69 | this.transPayOrgId(co.getFPAYORGID(), marketId, systemCode); | 109 | this.transPayOrgId(co.getFPAYORGID(), marketId, systemCode); |
@@ -75,14 +115,14 @@ public class TransferComponent { | @@ -75,14 +115,14 @@ public class TransferComponent { | ||
75 | 115 | ||
76 | public void transFeeItem(List<FEntityDetail> fEntityDetail) { | 116 | public void transFeeItem(List<FEntityDetail> fEntityDetail) { |
77 | fEntityDetail.forEach(e -> { | 117 | fEntityDetail.forEach(e -> { |
78 | - if (!ObjectUtils.isEmpty(e.getFCOSTID())){ | 118 | + if (!ObjectUtils.isEmpty(e.getFCOSTID())) { |
79 | this.transFCOSTID(e.getFCOSTID()); | 119 | this.transFCOSTID(e.getFCOSTID()); |
80 | } | 120 | } |
81 | }); | 121 | }); |
82 | } | 122 | } |
83 | 123 | ||
84 | private void transFCOSTID(FCOSTID fcostid) { | 124 | private void transFCOSTID(FCOSTID fcostid) { |
85 | - if (!ObjectUtils.isEmpty(fcostid.getFNUMBER())){ | 125 | + if (!ObjectUtils.isEmpty(fcostid.getFNUMBER())) { |
86 | fcostid.setFNUMBER(transMapper.getChargeItem(Long.valueOf(fcostid.getFNUMBER())).getChargeItemCode()); | 126 | fcostid.setFNUMBER(transMapper.getChargeItem(Long.valueOf(fcostid.getFNUMBER())).getChargeItemCode()); |
87 | } | 127 | } |
88 | } | 128 | } |
@@ -128,6 +168,17 @@ public class TransferComponent { | @@ -128,6 +168,17 @@ public class TransferComponent { | ||
128 | } | 168 | } |
129 | 169 | ||
130 | /** | 170 | /** |
171 | + * Trans Main Book 货币 | ||
172 | + * | ||
173 | + * @param fsettlemainbookid fsettlemainbookid | ||
174 | + * @param marketId 市场 ID | ||
175 | + * @param systemCode 系统代码 | ||
176 | + */ | ||
177 | + public void transSettleMainBookCurrency(FSETTLEMAINBOOKID fsettlemainbookid, Long marketId, String systemCode) { | ||
178 | + fsettlemainbookid.setFNUMBER(transMapper.getBaseConfig(systemCode, marketId).getCurrency()); | ||
179 | + } | ||
180 | + | ||
181 | + /** | ||
131 | * 跨性别客户 | 182 | * 跨性别客户 |
132 | * | 183 | * |
133 | * @param fcustomerid fcustomerid | 184 | * @param fcustomerid fcustomerid |
@@ -140,6 +191,30 @@ public class TransferComponent { | @@ -140,6 +191,30 @@ public class TransferComponent { | ||
140 | } | 191 | } |
141 | 192 | ||
142 | /** | 193 | /** |
194 | + * 跨性别客户 | ||
195 | + * | ||
196 | + * @param fcontactunit fcontactunit | ||
197 | + */ | ||
198 | + public void transFCONTACTUNIT(FCONTACTUNIT fcontactunit) { | ||
199 | + if (ObjectUtils.isEmpty(fcontactunit.getFNumber())) { | ||
200 | + return; | ||
201 | + } | ||
202 | + fcontactunit.setFNumber(transMapper.getCustomer(Long.valueOf(fcontactunit.getFNumber())).getCode()); | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * 跨性别客户 | ||
207 | + * | ||
208 | + * @param fpayunit fpayunit | ||
209 | + */ | ||
210 | + public void transFPAYUNIT(FPAYUNIT fpayunit) { | ||
211 | + if (ObjectUtils.isEmpty(fpayunit.getFNumber())) { | ||
212 | + return; | ||
213 | + } | ||
214 | + fpayunit.setFNumber(transMapper.getCustomer(Long.valueOf(fpayunit.getFNumber())).getCode()); | ||
215 | + } | ||
216 | + | ||
217 | + /** | ||
143 | * 交易订单 ID | 218 | * 交易订单 ID |
144 | * | 219 | * |
145 | * @param forderid forderid | 220 | * @param forderid forderid |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/demarcate/AbstractBillHandler.java
1 | package com.diligrp.etrade.thirdparty.demarcate; | 1 | package com.diligrp.etrade.thirdparty.demarcate; |
2 | 2 | ||
3 | +import com.diligrp.etrade.core.util.JsonUtils; | ||
3 | import com.diligrp.etrade.thirdparty.component.TransferComponent; | 4 | import com.diligrp.etrade.thirdparty.component.TransferComponent; |
4 | import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo; | 5 | import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo; |
5 | import com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto; | 6 | import com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto; |
6 | import com.diligrp.etrade.thirdparty.domain.dto.BusinessDto; | 7 | import com.diligrp.etrade.thirdparty.domain.dto.BusinessDto; |
7 | import com.diligrp.etrade.thirdparty.domain.dto.ClientDto; | 8 | import com.diligrp.etrade.thirdparty.domain.dto.ClientDto; |
9 | +import com.diligrp.etrade.thirdparty.domain.model.FEntityDetail; | ||
8 | import com.diligrp.etrade.thirdparty.error.ThirdPartyException; | 10 | import com.diligrp.etrade.thirdparty.error.ThirdPartyException; |
9 | import com.diligrp.etrade.thirdparty.mapper.TransMapper; | 11 | import com.diligrp.etrade.thirdparty.mapper.TransMapper; |
10 | import com.diligrp.etrade.thirdparty.type.*; | 12 | import com.diligrp.etrade.thirdparty.type.*; |
13 | +import com.diligrp.etrade.thirdparty.utils.PurchaseOrderApiUtils; | ||
11 | import com.kingdee.bos.webapi.entity.IdentifyInfo; | 14 | import com.kingdee.bos.webapi.entity.IdentifyInfo; |
12 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
13 | import org.springframework.util.ObjectUtils; | 16 | import org.springframework.util.ObjectUtils; |
14 | 17 | ||
18 | +import java.math.BigDecimal; | ||
15 | import java.util.ArrayList; | 19 | import java.util.ArrayList; |
16 | import java.util.HashMap; | 20 | import java.util.HashMap; |
17 | import java.util.List; | 21 | import java.util.List; |
@@ -24,7 +28,7 @@ import java.util.stream.Collectors; | @@ -24,7 +28,7 @@ import java.util.stream.Collectors; | ||
24 | * @author zhangmeiyang | 28 | * @author zhangmeiyang |
25 | * @date 2024/09/26 | 29 | * @date 2024/09/26 |
26 | */ | 30 | */ |
27 | -public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeMarkInterface<BusinessEnum> { | 31 | +public abstract class AbstractBillHandler<T extends BaseBillCo> implements Handler { |
28 | 32 | ||
29 | @Resource | 33 | @Resource |
30 | protected TransferComponent transferComponent; | 34 | protected TransferComponent transferComponent; |
@@ -32,13 +36,13 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -32,13 +36,13 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
32 | @Resource | 36 | @Resource |
33 | protected TransMapper transMapper; | 37 | protected TransMapper transMapper; |
34 | 38 | ||
35 | - protected static final Map<String, TransferFunctionSingle> TRANSFER_FUNCTION_SINGLE_MAP = new HashMap<>(); | ||
36 | - protected static final Map<String, TransferFunctionMulti> TRANSFER_FUNCTION_MULTI_MAP = new HashMap<>(); | ||
37 | - protected static final TransferFunctionSingle DEPT = AbstractBillHandler::transferDynamicDept; | ||
38 | - protected static final TransferFunctionSingle CUSTOMER = AbstractBillHandler::transferDynamicCustomer; | ||
39 | - protected static final TransferFunctionSingle SETTLE_TYPE = AbstractBillHandler::transferDynamicSettleType; | ||
40 | - protected static final TransferFunctionSingle BUSINESS_TYPE = AbstractBillHandler::transferDynamicBusinessType; | ||
41 | - protected static final TransferFunctionMulti CHARGE_ITEM = AbstractBillHandler::transferDynamicChargeItem; | 39 | + protected static final Map<String, TransferFunctionSingle<BaseBillCo>> TRANSFER_FUNCTION_SINGLE_MAP = new HashMap<>(); |
40 | + protected static final Map<String, TransferFunctionMulti<BaseBillCo>> TRANSFER_FUNCTION_MULTI_MAP = new HashMap<>(); | ||
41 | + protected static final TransferFunctionSingle<BaseBillCo> DEPT = AbstractBillHandler::transferDynamicDept; | ||
42 | + protected static final TransferFunctionSingle<BaseBillCo> CUSTOMER = AbstractBillHandler::transferDynamicCustomer; | ||
43 | + protected static final TransferFunctionSingle<BaseBillCo> SETTLE_TYPE = AbstractBillHandler::transferDynamicSettleType; | ||
44 | + protected static final TransferFunctionSingle<BaseBillCo> BUSINESS_TYPE = AbstractBillHandler::transferDynamicBusinessType; | ||
45 | + protected static final TransferFunctionMulti<BaseBillCo> CHARGE_ITEM = AbstractBillHandler::transferDynamicChargeItem; | ||
42 | 46 | ||
43 | static { | 47 | static { |
44 | TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.DEPARTMENT_TO_LOWER.code, DEPT); | 48 | TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.DEPARTMENT_TO_LOWER.code, DEPT); |
@@ -49,16 +53,6 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -49,16 +53,6 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
49 | } | 53 | } |
50 | 54 | ||
51 | /** | 55 | /** |
52 | - * 处理 | ||
53 | - * | ||
54 | - * @param json JSON 格式 | ||
55 | - * @param marketId 市场 ID | ||
56 | - * @param systemCode 系统代码 | ||
57 | - * @throws Exception 例外 | ||
58 | - */ | ||
59 | - public abstract void handle(String json, Long marketId, String systemCode) throws Exception; | ||
60 | - | ||
61 | - /** | ||
62 | * 获取动态数据 | 56 | * 获取动态数据 |
63 | * | 57 | * |
64 | * @param marketId 市场 ID | 58 | * @param marketId 市场 ID |
@@ -82,19 +76,13 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -82,19 +76,13 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
82 | } | 76 | } |
83 | 77 | ||
84 | /** | 78 | /** |
85 | - * 传输数据列表 | 79 | + * 转移动态结算类型 |
86 | * | 80 | * |
87 | - * @param ts 茨 | ||
88 | - * @param marketId 市场 ID | ||
89 | - * @param systemCode 系统代码 | 81 | + * @param t t |
82 | + * @param data 数据 | ||
90 | */ | 83 | */ |
91 | - protected void transferDataListWithOutFeeItem(List<T> ts, Long marketId, String systemCode) { | ||
92 | - ts.forEach(e -> { | ||
93 | - DynamicType dynamicType = DynamicType.fromCode(e.getSystemDynamicCode()); | ||
94 | - transfer(e, marketId, systemCode); | ||
95 | - getFilteredDynamicDataSingle(dynamicType, marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_SINGLE_MAP.get(k).transferDynamic(e, v)); | ||
96 | - getFilteredDynamicDataMulti(dynamicType, marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_MULTI_MAP.get(k).transferDynamic(e, v)); | ||
97 | - }); | 84 | + protected static <T extends BaseBillCo> void transferDynamicSettleType(T t, BusinessDetailDto data) { |
85 | + t.getFEntityDetail().forEach(e -> e.getFSettleTypeID().setFNumber(data.getItemValue())); | ||
98 | } | 86 | } |
99 | 87 | ||
100 | /** | 88 | /** |
@@ -126,16 +114,6 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -126,16 +114,6 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
126 | } | 114 | } |
127 | 115 | ||
128 | /** | 116 | /** |
129 | - * 转移动态结算类型 | ||
130 | - * | ||
131 | - * @param t t | ||
132 | - * @param data 数据 | ||
133 | - */ | ||
134 | - protected static <T extends BaseBillCo> void transferDynamicSettleType(T t, BusinessDetailDto data) { | ||
135 | - t.getFSettleTypeID().setFNumber(data.getItemValue()); | ||
136 | - } | ||
137 | - | ||
138 | - /** | ||
139 | * Transfer Dynamic Charge 项目 | 117 | * Transfer Dynamic Charge 项目 |
140 | * | 118 | * |
141 | * @param data 数据 | 119 | * @param data 数据 |
@@ -152,8 +130,8 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -152,8 +130,8 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
152 | codeMap.put(dto.getItemCode(), dto.getItemValue()); | 130 | codeMap.put(dto.getItemCode(), dto.getItemValue()); |
153 | } | 131 | } |
154 | } | 132 | } |
155 | - entity.getFEntityDetail().forEach(e->{ | ||
156 | - if (!ObjectUtils.isEmpty(e.getFCOSTID())){ | 133 | + entity.getFEntityDetail().forEach(e -> { |
134 | + if (!ObjectUtils.isEmpty(e.getFCOSTID())) { | ||
157 | var costId = e.getFCOSTID().getFNUMBER(); | 135 | var costId = e.getFCOSTID().getFNUMBER(); |
158 | if (relationMap.containsKey(costId)) { | 136 | if (relationMap.containsKey(costId)) { |
159 | e.getFCOSTID().setFNUMBER(relationMap.get(costId)); | 137 | e.getFCOSTID().setFNUMBER(relationMap.get(costId)); |
@@ -164,37 +142,13 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -164,37 +142,13 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
164 | }); | 142 | }); |
165 | } | 143 | } |
166 | 144 | ||
167 | - /** | ||
168 | - * 有效数据同步 | ||
169 | - * | ||
170 | - * @param ts 茨 | ||
171 | - * @param marketId 市场 ID | ||
172 | - * @param systemCode 系统代码 | ||
173 | - * @return {@link List}<{@link T}> | ||
174 | - */ | ||
175 | - protected <T extends BaseBillCo> List<T> validDataSync(List<T> ts, Long marketId, String systemCode) { | ||
176 | - return ts.stream().filter(t -> isSync(marketId, systemCode, DynamicType.fromCode(t.getSystemDynamicCode()))).collect(Collectors.toList()); | ||
177 | - } | ||
178 | - | ||
179 | - | ||
180 | - /** | ||
181 | - * 固定转换 | ||
182 | - * | ||
183 | - * @param t t | ||
184 | - * @param marketId 市场 ID | ||
185 | - * @param systemCode 系统代码 | ||
186 | - */ | ||
187 | - protected void transfer(T t, Long marketId, String systemCode) { | ||
188 | - transferComponent.transBaseCo(t, marketId, systemCode); | ||
189 | - } | ||
190 | - | ||
191 | - /** | ||
192 | - * 转账手续费项目 | ||
193 | - * | ||
194 | - * @param t t | ||
195 | - */ | ||
196 | - protected void transferFeeItem(T t) { | ||
197 | - transferComponent.transFeeItem(t.getFEntityDetail()); | 145 | + private static <T extends BaseBillCo> String getAllAmountFor(T e) { |
146 | + var allAmountFor = BigDecimal.ZERO; | ||
147 | + for (FEntityDetail f : e.getFEntityDetail()) { | ||
148 | + BigDecimal single = f.getFPrice().multiply(f.getFPriceQty()); | ||
149 | + allAmountFor = allAmountFor.add(single); | ||
150 | + } | ||
151 | + return allAmountFor.toString(); | ||
198 | } | 152 | } |
199 | 153 | ||
200 | /** | 154 | /** |
@@ -223,8 +177,37 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -223,8 +177,37 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
223 | } | 177 | } |
224 | 178 | ||
225 | /** | 179 | /** |
226 | - * 传输数据列表 | 180 | + * 获取动态数据 |
181 | + * | ||
182 | + * @param marketId 市场 ID | ||
183 | + * @param systemCode 系统代码 | ||
184 | + * @param dynamicType 动态型 | ||
185 | + * @return {@link Map}<{@link String}, {@link BusinessDetailDto}> | ||
186 | + */ | ||
187 | + protected Map<String, List<BusinessDetailDto>> getFilteredDynamicDataMulti(DynamicType dynamicType, Long marketId, String systemCode) { | ||
188 | + var queryArrays = new String[]{BasicEnum.CHARGE_ITEM_TO_LOWER.code}; | ||
189 | + var dynamicParam = transMapper.getFixedWithQueryArrays(systemCode, dynamicType.code, marketId, SelectType.FIXED.getCode(), queryArrays); | ||
190 | + Map<String, List<BusinessDetailDto>> map = new HashMap<>(); | ||
191 | + if (!ObjectUtils.isEmpty(dynamicParam)) { | ||
192 | + dynamicParam.forEach(e -> map.computeIfAbsent(e.getCode(), k -> new ArrayList<>()).add(e)); | ||
193 | + } | ||
194 | + return map; | ||
195 | + } | ||
196 | + | ||
197 | + /** | ||
198 | + * 有效数据同步 | ||
227 | * | 199 | * |
200 | + * @param ts 茨 | ||
201 | + * @param marketId 市场 ID | ||
202 | + * @param systemCode 系统代码 | ||
203 | + * @return {@link List}<{@link T}> | ||
204 | + */ | ||
205 | + protected <T extends BaseBillCo> List<T> validDataSync(List<T> ts, Long marketId, String systemCode) { | ||
206 | + return ts.stream().filter(t -> isSync(marketId, systemCode, DynamicType.fromCode(t.getSystemDynamicCode()))).collect(Collectors.toList()); | ||
207 | + } | ||
208 | + | ||
209 | + /** | ||
210 | + * 传输数据列表 | ||
228 | * | 211 | * |
229 | * @param ts 茨 | 212 | * @param ts 茨 |
230 | * @param marketId 市场 ID | 213 | * @param marketId 市场 ID |
@@ -241,21 +224,30 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -241,21 +224,30 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
241 | } | 224 | } |
242 | 225 | ||
243 | /** | 226 | /** |
244 | - * 获取动态数据 | 227 | + * 固定转换 |
245 | * | 228 | * |
246 | - * @param marketId 市场 ID | ||
247 | - * @param systemCode 系统代码 | ||
248 | - * @param dynamicType 动态型 | ||
249 | - * @return {@link Map}<{@link String}, {@link BusinessDetailDto}> | 229 | + * @param t t |
230 | + * @param marketId 市场 ID | ||
231 | + * @param systemCode 系统代码 | ||
250 | */ | 232 | */ |
251 | - protected Map<String, List<BusinessDetailDto>> getFilteredDynamicDataMulti(DynamicType dynamicType, Long marketId, String systemCode) { | ||
252 | - var queryArrays = new String[]{BasicEnum.CHARGE_ITEM_TO_LOWER.code}; | ||
253 | - var dynamicParam = transMapper.getFixedWithQueryArrays(systemCode, dynamicType.code, marketId, SelectType.FIXED.getCode(), queryArrays); | ||
254 | - Map<String, List<BusinessDetailDto>> map = new HashMap<>(); | ||
255 | - if (!ObjectUtils.isEmpty(dynamicParam)) { | ||
256 | - dynamicParam.forEach(e -> map.computeIfAbsent(e.getCode(), k -> new ArrayList<>()).add(e)); | ||
257 | - } | ||
258 | - return map; | 233 | + protected void transfer(T t, Long marketId, String systemCode) { |
234 | + transferComponent.transBillCo(t, marketId, systemCode); | ||
235 | + } | ||
236 | + | ||
237 | + /** | ||
238 | + * 传输数据列表 | ||
239 | + * | ||
240 | + * @param ts 茨 | ||
241 | + * @param marketId 市场 ID | ||
242 | + * @param systemCode 系统代码 | ||
243 | + */ | ||
244 | + protected void transferDataListWithOutFeeItem(List<T> ts, Long marketId, String systemCode) { | ||
245 | + ts.forEach(e -> { | ||
246 | + DynamicType dynamicType = DynamicType.fromCode(e.getSystemDynamicCode()); | ||
247 | + transfer(e, marketId, systemCode); | ||
248 | + getFilteredDynamicDataSingle(dynamicType, marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_SINGLE_MAP.get(k).transferDynamic(e, v)); | ||
249 | + getFilteredDynamicDataMulti(dynamicType, marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_MULTI_MAP.get(k).transferDynamic(e, v)); | ||
250 | + }); | ||
259 | } | 251 | } |
260 | 252 | ||
261 | /** | 253 | /** |
@@ -277,13 +269,18 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -277,13 +269,18 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
277 | } | 269 | } |
278 | var fixedBusinessType = e.getFixedBusinessType(); | 270 | var fixedBusinessType = e.getFixedBusinessType(); |
279 | //业务类型固定的情况下 | 271 | //业务类型固定的情况下 |
280 | - if (!ObjectUtils.isEmpty(fixedBusinessType)){ | 272 | + if (!ObjectUtils.isEmpty(fixedBusinessType)) { |
281 | e.getFBillTypeID().setFNUMBER(fixedBusinessType); | 273 | e.getFBillTypeID().setFNUMBER(fixedBusinessType); |
282 | } | 274 | } |
283 | - BillType.getBillType(documentType).handle(e,identifyInfo); | 275 | + var util = new PurchaseOrderApiUtils(identifyInfo); |
276 | + boolean purchaseOrder = util.getPurchaseOrder(e.getFBillTypeID().getFNUMBER(), e.getF_ZDB_Text1(), getAllAmountFor(e), e.getF_ZDB_Text667()); | ||
277 | + if (purchaseOrder) { | ||
278 | + util.createOnePurchaseOrder(JsonUtils.toJsonString(e), BillType.RECEIVABLES.value); | ||
279 | + } | ||
284 | } | 280 | } |
285 | } | 281 | } |
286 | 282 | ||
283 | + | ||
287 | /** | 284 | /** |
288 | * 获取文档类型 | 285 | * 获取文档类型 |
289 | * | 286 | * |
@@ -298,21 +295,21 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -298,21 +295,21 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
298 | } | 295 | } |
299 | 296 | ||
300 | /** | 297 | /** |
298 | + * 转账手续费项目 | ||
299 | + * | ||
300 | + * @param t t | ||
301 | + */ | ||
302 | + protected void transferFeeItem(T t) { | ||
303 | + transferComponent.transFeeItem(t.getFEntityDetail()); | ||
304 | + } | ||
305 | + | ||
306 | + /** | ||
301 | * 传递函数 Single | 307 | * 传递函数 Single |
302 | * | 308 | * |
303 | * @author zhangmeiyang | 309 | * @author zhangmeiyang |
304 | * @date 2024/11/20 | 310 | * @date 2024/11/20 |
305 | */ | 311 | */ |
306 | - @FunctionalInterface | ||
307 | - protected interface TransferFunctionSingle { | ||
308 | - /** | ||
309 | - * Transfer Dynamic (传输动态) | ||
310 | - * | ||
311 | - * @param baseBillCo Base Bill 公司 | ||
312 | - * @param data 数据 | ||
313 | - */ | ||
314 | - void transferDynamic(BaseBillCo baseBillCo, BusinessDetailDto data); | ||
315 | - } | 312 | + |
316 | 313 | ||
317 | private IdentifyInfo getIdentifyInfo(Long marketId, String systemCode) { | 314 | private IdentifyInfo getIdentifyInfo(Long marketId, String systemCode) { |
318 | var identifyInfo = new IdentifyInfo(); | 315 | var identifyInfo = new IdentifyInfo(); |
@@ -325,20 +322,5 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | @@ -325,20 +322,5 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM | ||
325 | return identifyInfo; | 322 | return identifyInfo; |
326 | } | 323 | } |
327 | 324 | ||
328 | - /** | ||
329 | - * 传递函数 Multi | ||
330 | - * | ||
331 | - * @author zhangmeiyang | ||
332 | - * @date 2024/11/20 | ||
333 | - */ | ||
334 | - @FunctionalInterface | ||
335 | - protected interface TransferFunctionMulti { | ||
336 | - /** | ||
337 | - * Transfer Dynamic (传输动态) | ||
338 | - * | ||
339 | - * @param baseBillCo Base Bill 公司 | ||
340 | - * @param data 数据 | ||
341 | - */ | ||
342 | - void transferDynamic(BaseBillCo baseBillCo, List<BusinessDetailDto> data); | ||
343 | - } | 325 | + |
344 | } | 326 | } |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/demarcate/AbstractRecHandler.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.demarcate; | ||
2 | + | ||
3 | +import com.diligrp.etrade.core.util.JsonUtils; | ||
4 | +import com.diligrp.etrade.thirdparty.component.TransferComponent; | ||
5 | +import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo; | ||
6 | +import com.diligrp.etrade.thirdparty.domain.co.rec.BaseRecCo; | ||
7 | +import com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto; | ||
8 | +import com.diligrp.etrade.thirdparty.domain.dto.BusinessDto; | ||
9 | +import com.diligrp.etrade.thirdparty.domain.dto.ClientDto; | ||
10 | +import com.diligrp.etrade.thirdparty.domain.model.FRECEIVEBILLENTRY; | ||
11 | +import com.diligrp.etrade.thirdparty.error.ThirdPartyException; | ||
12 | +import com.diligrp.etrade.thirdparty.mapper.TransMapper; | ||
13 | +import com.diligrp.etrade.thirdparty.type.*; | ||
14 | +import com.diligrp.etrade.thirdparty.utils.ReceiptsOrderApiUtils; | ||
15 | +import com.kingdee.bos.webapi.entity.IdentifyInfo; | ||
16 | +import jakarta.annotation.Resource; | ||
17 | +import org.springframework.util.ObjectUtils; | ||
18 | + | ||
19 | +import java.math.BigDecimal; | ||
20 | +import java.util.ArrayList; | ||
21 | +import java.util.HashMap; | ||
22 | +import java.util.List; | ||
23 | +import java.util.Map; | ||
24 | +import java.util.stream.Collectors; | ||
25 | + | ||
26 | +/** | ||
27 | + * @Author: zhangmeiyang | ||
28 | + * @CreateTime: 2024-11-25 12:53 | ||
29 | + * @Version: todo | ||
30 | + */ | ||
31 | +public abstract class AbstractRecHandler<T extends BaseRecCo> implements Handler { | ||
32 | + | ||
33 | + protected static final Map<String, TransferFunctionSingle<BaseRecCo>> TRANSFER_FUNCTION_SINGLE_MAP = new HashMap<>(); | ||
34 | + protected static final Map<String, TransferFunctionMulti<BaseRecCo>> TRANSFER_FUNCTION_MULTI_MAP = new HashMap<>(); | ||
35 | + protected static final TransferFunctionSingle<BaseRecCo> DEPT = AbstractRecHandler::transferDynamicDept; | ||
36 | + protected static final TransferFunctionSingle<BaseRecCo> CUSTOMER = AbstractRecHandler::transferDynamicCustomer; | ||
37 | + protected static final TransferFunctionSingle<BaseRecCo> SETTLE_TYPE = AbstractRecHandler::transferDynamicSettleType; | ||
38 | + protected static final TransferFunctionSingle<BaseRecCo> BUSINESS_TYPE = AbstractRecHandler::transferDynamicBusinessType; | ||
39 | + protected static final TransferFunctionMulti<BaseRecCo> CHARGE_ITEM = AbstractRecHandler::transferDynamicChargeItem; | ||
40 | + | ||
41 | + static { | ||
42 | + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.DEPARTMENT_TO_LOWER.code, DEPT); | ||
43 | + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.CUSTOMER_TO_LOWER.code, CUSTOMER); | ||
44 | + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.FINANCIAL_CHANNEL_TYPE_TO_LOWER.code, SETTLE_TYPE); | ||
45 | + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.FINANCIAL_BUSINESS_TYPE_TO_LOWER.code, BUSINESS_TYPE); | ||
46 | + TRANSFER_FUNCTION_MULTI_MAP.put(BasicEnum.CHARGE_ITEM_TO_LOWER.code, CHARGE_ITEM); | ||
47 | + } | ||
48 | + | ||
49 | + @Resource | ||
50 | + protected TransferComponent transferComponent; | ||
51 | + @Resource | ||
52 | + protected TransMapper transMapper; | ||
53 | + | ||
54 | + /** | ||
55 | + * 转换动态配置部门 | ||
56 | + * | ||
57 | + * @param t t | ||
58 | + * @param data 数据 | ||
59 | + */ | ||
60 | + protected static <T extends BaseRecCo> void transferDynamicDept(T t, BusinessDetailDto data) { | ||
61 | + t.getFSALEDEPTID().setFNumber(data.getItemValue()); | ||
62 | + } | ||
63 | + | ||
64 | + /** | ||
65 | + * Transfer Dynamic 客户 | ||
66 | + * | ||
67 | + * @param t t | ||
68 | + * @param data 数据 | ||
69 | + */ | ||
70 | + protected static <T extends BaseRecCo> void transferDynamicCustomer(T t, BusinessDetailDto data) { | ||
71 | + if (!ObjectUtils.isEmpty(t.getFCONTACTUNIT())) { | ||
72 | + t.getFCONTACTUNIT().setFNumber(data.getItemValue()); | ||
73 | + } | ||
74 | + if (!ObjectUtils.isEmpty(t.getFPAYUNIT())) { | ||
75 | + t.getFPAYUNIT().setFNumber(data.getItemValue()); | ||
76 | + } | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * 转移动态结算类型 | ||
81 | + * | ||
82 | + * @param t t | ||
83 | + * @param data 数据 | ||
84 | + */ | ||
85 | + protected static <T extends BaseRecCo> void transferDynamicSettleType(T t, BusinessDetailDto data) { | ||
86 | + t.getFRECEIVEBILLENTRY().forEach(e -> e.getFSETTLETYPEID().setFNumber(data.getItemValue())); | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Transfer Dynamic Charge 项目 | ||
91 | + * | ||
92 | + * @param data 数据 | ||
93 | + * @param entity 实体 | ||
94 | + */ | ||
95 | + protected static <T extends BaseRecCo> void transferDynamicChargeItem(T entity, List<BusinessDetailDto> data) { | ||
96 | + Map<String, String> relationMap = new HashMap<>(); | ||
97 | + Map<String, String> codeMap = new HashMap<>(); | ||
98 | + for (BusinessDetailDto dto : data) { | ||
99 | + if (!ObjectUtils.isEmpty(dto.getItemRelationId())) { | ||
100 | + relationMap.put(String.valueOf(dto.getItemRelationId()), dto.getItemValue()); | ||
101 | + } | ||
102 | + if (!ObjectUtils.isEmpty(dto.getItemCode())) { | ||
103 | + codeMap.put(dto.getItemCode(), dto.getItemValue()); | ||
104 | + } | ||
105 | + } | ||
106 | + entity.getFRECEIVEBILLENTRY().forEach(e -> { | ||
107 | + if (!ObjectUtils.isEmpty(e.getFCOSTID())) { | ||
108 | + var costId = e.getFCOSTID().getFNUMBER(); | ||
109 | + if (relationMap.containsKey(costId)) { | ||
110 | + e.getFCOSTID().setFNUMBER(relationMap.get(costId)); | ||
111 | + } else if (codeMap.containsKey(costId)) { | ||
112 | + e.getFCOSTID().setFNUMBER(codeMap.get(costId)); | ||
113 | + } | ||
114 | + } | ||
115 | + }); | ||
116 | + } | ||
117 | + | ||
118 | + /** | ||
119 | + * Transfer Dynamic 业务类型 | ||
120 | + * | ||
121 | + * @param t t | ||
122 | + * @param data 数据 | ||
123 | + */ | ||
124 | + protected static <T extends BaseRecCo> void transferDynamicBusinessType(T t, BusinessDetailDto data) { | ||
125 | + t.setFixedBusinessType(data.getItemValue()); | ||
126 | + } | ||
127 | + | ||
128 | + private static <T extends BaseRecCo> String getAllAmountFor(T e) { | ||
129 | + var allAmountFor = BigDecimal.ZERO; | ||
130 | + for (FRECEIVEBILLENTRY f : e.getFRECEIVEBILLENTRY()) { | ||
131 | + BigDecimal single = f.getFRECTOTALAMOUNTFOR().multiply(f.getFRECTOTALAMOUNTFOR()); | ||
132 | + allAmountFor = allAmountFor.add(single); | ||
133 | + } | ||
134 | + return allAmountFor.toString(); | ||
135 | + } | ||
136 | + | ||
137 | + /** | ||
138 | + * 获取动态数据 | ||
139 | + * | ||
140 | + * @param marketId 市场 ID | ||
141 | + * @param systemCode 系统代码 | ||
142 | + * @param dynamicType 动态型 | ||
143 | + * @return {@link Map}<{@link String}, {@link BusinessDetailDto}> | ||
144 | + */ | ||
145 | + protected Map<String, BusinessDetailDto> getFilteredDynamicDataSingle(DynamicType dynamicType, Long marketId, String systemCode) { | ||
146 | + var queryArrays = new String[]{ | ||
147 | + BasicEnum.DEPARTMENT_TO_LOWER.code, | ||
148 | + BasicEnum.CUSTOMER_TO_LOWER.code, | ||
149 | + BasicEnum.FINANCIAL_CHANNEL_TYPE_TO_LOWER.code, | ||
150 | + BasicEnum.FINANCIAL_BUSINESS_TYPE_TO_LOWER.code | ||
151 | + }; | ||
152 | + var dynamicParam = transMapper.getFixedWithQueryArrays(systemCode, dynamicType.code, marketId, SelectType.FIXED.getCode(), queryArrays); | ||
153 | + Map<String, BusinessDetailDto> map = new HashMap<>(); | ||
154 | + if (!ObjectUtils.isEmpty(dynamicParam)) { | ||
155 | + dynamicParam.forEach(e -> map.computeIfAbsent(e.getCode(), k -> e)); | ||
156 | + } | ||
157 | + return map; | ||
158 | + } | ||
159 | + | ||
160 | + /** | ||
161 | + * 获取动态数据 | ||
162 | + * | ||
163 | + * @param marketId 市场 ID | ||
164 | + * @param systemCode 系统代码 | ||
165 | + * @param dynamicType 动态型 | ||
166 | + * @return {@link Map}<{@link String}, {@link BusinessDetailDto}> | ||
167 | + */ | ||
168 | + protected Map<String, List<BusinessDetailDto>> getFilteredDynamicDataMulti(DynamicType dynamicType, Long marketId, String systemCode) { | ||
169 | + var queryArrays = new String[]{BasicEnum.CHARGE_ITEM_TO_LOWER.code}; | ||
170 | + var dynamicParam = transMapper.getFixedWithQueryArrays(systemCode, dynamicType.code, marketId, SelectType.FIXED.getCode(), queryArrays); | ||
171 | + Map<String, List<BusinessDetailDto>> map = new HashMap<>(); | ||
172 | + if (!ObjectUtils.isEmpty(dynamicParam)) { | ||
173 | + dynamicParam.forEach(e -> map.computeIfAbsent(e.getCode(), k -> new ArrayList<>()).add(e)); | ||
174 | + } | ||
175 | + return map; | ||
176 | + } | ||
177 | + | ||
178 | + /** | ||
179 | + * 是否同步 | ||
180 | + * | ||
181 | + * @param marketId 市场 ID | ||
182 | + * @param systemCode 系统代码 | ||
183 | + * @return boolean | ||
184 | + */ | ||
185 | + protected boolean isSync(Long marketId, String systemCode, DynamicType dynamicType) { | ||
186 | + BusinessDto businessConfig = transMapper.getBusinessConfig(systemCode, marketId, dynamicType.code); | ||
187 | + if (ObjectUtils.isEmpty(businessConfig)) { | ||
188 | + return false; | ||
189 | + } | ||
190 | + return ObjectUtils.nullSafeEquals(businessConfig.getSyncType(), SyncType.SYNC.code); | ||
191 | + } | ||
192 | + | ||
193 | + /** | ||
194 | + * 有效数据同步 | ||
195 | + * | ||
196 | + * @param ts 茨 | ||
197 | + * @param marketId 市场 ID | ||
198 | + * @param systemCode 系统代码 | ||
199 | + * @return {@link List}<{@link T}> | ||
200 | + */ | ||
201 | + protected <T extends BaseBillCo> List<T> validDataSync(List<T> ts, Long marketId, String systemCode) { | ||
202 | + return ts.stream().filter(t -> isSync(marketId, systemCode, DynamicType.fromCode(t.getSystemDynamicCode()))).collect(Collectors.toList()); | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * 固定转换 | ||
207 | + * | ||
208 | + * @param t t | ||
209 | + * @param marketId 市场 ID | ||
210 | + * @param systemCode 系统代码 | ||
211 | + */ | ||
212 | + protected void transfer(T t, Long marketId, String systemCode) { | ||
213 | + transferComponent.transRecCo(t, marketId, systemCode); | ||
214 | + } | ||
215 | + | ||
216 | + /** | ||
217 | + * 传输数据列表 | ||
218 | + * | ||
219 | + * @param ts 茨 | ||
220 | + * @param marketId 市场 ID | ||
221 | + * @param systemCode 系统代码 | ||
222 | + */ | ||
223 | + protected void transferDataListWithOutFeeItem(List<T> ts, Long marketId, String systemCode) { | ||
224 | + ts.forEach(e -> { | ||
225 | + DynamicType dynamicType = DynamicType.fromCode(e.getSystemDynamicCode()); | ||
226 | + transfer(e, marketId, systemCode); | ||
227 | + getFilteredDynamicDataSingle(dynamicType, marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_SINGLE_MAP.get(k).transferDynamic(e, v)); | ||
228 | + getFilteredDynamicDataMulti(dynamicType, marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_MULTI_MAP.get(k).transferDynamic(e, v)); | ||
229 | + }); | ||
230 | + } | ||
231 | + | ||
232 | + /** | ||
233 | + * 发送采购订单 | ||
234 | + * | ||
235 | + * @param marketId 市场 ID | ||
236 | + * @param systemCode 系统代码 | ||
237 | + * @param ts 茨 | ||
238 | + * @throws Exception 例外 | ||
239 | + */ | ||
240 | + protected void sendPurchaseOrder(List<T> ts, Long marketId, String systemCode) throws Exception { | ||
241 | + var identifyInfo = getIdentifyInfo(marketId, systemCode); | ||
242 | + for (T e : ts) { | ||
243 | + var billId = e.getFBillTypeID().getFNUMBER(); | ||
244 | + //获取单据类型 | ||
245 | + String documentType = getDocumentType(marketId, systemCode, billId); | ||
246 | + if (ObjectUtils.isEmpty(documentType)) { | ||
247 | + throw new ThirdPartyException("未配置业务映射"); | ||
248 | + } | ||
249 | + var fixedBusinessType = e.getFixedBusinessType(); | ||
250 | + //业务类型固定的情况下 | ||
251 | + if (!ObjectUtils.isEmpty(fixedBusinessType)) { | ||
252 | + e.getFBillTypeID().setFNUMBER(fixedBusinessType); | ||
253 | + } | ||
254 | + var util = new ReceiptsOrderApiUtils(identifyInfo); | ||
255 | + boolean purchaseOrder = util.getReceiptsOrder(e.getFBillTypeID().getFNUMBER(), getAllAmountFor(e)); | ||
256 | + if (purchaseOrder) { | ||
257 | + util.createOnePurchaseOrder(JsonUtils.toJsonString(e), BillType.RECEIPTS.value); | ||
258 | + } | ||
259 | + } | ||
260 | + } | ||
261 | + | ||
262 | + /** | ||
263 | + * 获取文档类型 | ||
264 | + * | ||
265 | + * @param marketId 市场 ID | ||
266 | + * @param systemCode 系统代码 | ||
267 | + * @param billTypeId 账单类型 ID | ||
268 | + * @return {@link String} | ||
269 | + */ | ||
270 | + private String getDocumentType(Long marketId, String systemCode, String billTypeId) { | ||
271 | + var res = transMapper.getMappingDict(BasicEnum.FINANCIAL_BUSINESS_TYPE_TO_LOWER.code, systemCode, marketId, billTypeId); | ||
272 | + return ObjectUtils.isEmpty(res) ? null : res.getMapType(); | ||
273 | + } | ||
274 | + | ||
275 | + /** | ||
276 | + * 传递函数 Single | ||
277 | + * | ||
278 | + * @author zhangmeiyang | ||
279 | + * @date 2024/11/20 | ||
280 | + */ | ||
281 | + | ||
282 | + | ||
283 | + private IdentifyInfo getIdentifyInfo(Long marketId, String systemCode) { | ||
284 | + var identifyInfo = new IdentifyInfo(); | ||
285 | + ClientDto clientParam = transMapper.getClientParam(systemCode, marketId); | ||
286 | + identifyInfo.setAppId(clientParam.getApplyId()); | ||
287 | + identifyInfo.setUserName(clientParam.getUsername()); | ||
288 | + identifyInfo.setServerUrl(clientParam.getServiceAddress()); | ||
289 | + identifyInfo.setAppSecret(clientParam.getSecurityKey()); | ||
290 | + identifyInfo.setdCID(clientParam.getDataCentreId()); | ||
291 | + return identifyInfo; | ||
292 | + } | ||
293 | + | ||
294 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/demarcate/Handler.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.demarcate; | ||
2 | + | ||
3 | +import com.diligrp.etrade.thirdparty.type.BusinessEnum; | ||
4 | + | ||
5 | +public interface Handler extends TypeMarkInterface<BusinessEnum>{ | ||
6 | + | ||
7 | + /** | ||
8 | + * 处理 | ||
9 | + * | ||
10 | + * @param json JSON 格式 | ||
11 | + * @param marketId 市场 ID | ||
12 | + * @param systemCode 系统代码 | ||
13 | + * @throws Exception 例外 | ||
14 | + */ | ||
15 | + void handle(String json, Long marketId, String systemCode) throws Exception; | ||
16 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/demarcate/TransferFunctionMulti.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.demarcate; | ||
2 | + | ||
3 | +import com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +/** | ||
8 | + * 传递函数 Multi | ||
9 | + * | ||
10 | + * @author zhangmeiyang | ||
11 | + * @date 2024/11/20 | ||
12 | + */ | ||
13 | +@FunctionalInterface | ||
14 | +public interface TransferFunctionMulti<T> { | ||
15 | + /** | ||
16 | + * Transfer Dynamic (传输动态) | ||
17 | + * | ||
18 | + * @param t Base Bill 公司 | ||
19 | + * @param data 数据 | ||
20 | + */ | ||
21 | + void transferDynamic(T t, List<BusinessDetailDto> data); | ||
22 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/demarcate/TransferFunctionSingle.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.demarcate; | ||
2 | + | ||
3 | +import com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto; | ||
4 | + | ||
5 | +@FunctionalInterface | ||
6 | +public interface TransferFunctionSingle<T> { | ||
7 | + /** | ||
8 | + * Transfer Dynamic (传输动态) | ||
9 | + * | ||
10 | + * @param t Base Bill 公司 | ||
11 | + * @param data 数据 | ||
12 | + */ | ||
13 | + void transferDynamic(T t, BusinessDetailDto data); | ||
14 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/rec/BaseRecCo.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.co.rec; | ||
2 | + | ||
3 | +import com.diligrp.etrade.thirdparty.domain.model.*; | ||
4 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
5 | + | ||
6 | +import java.io.Serializable; | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * @Author: zhangmeiyang | ||
11 | + * @CreateTime: 2024-11-25 12:54 | ||
12 | + * @Version: todo | ||
13 | + */ | ||
14 | +public class BaseRecCo implements Serializable { | ||
15 | + private String systemDynamicCode; | ||
16 | + private String fixedBusinessType; | ||
17 | + private String FDATE; | ||
18 | + private FBillTypeID FBillTypeID; | ||
19 | + private FSETTLEMAINBOOKID FSETTLEMAINBOOKID; | ||
20 | + private FSALEDEPTID FSALEDEPTID; | ||
21 | + private FSETTLEORGID FSETTLEORGID; | ||
22 | + private FCURRENCYID FCURRENCYID; | ||
23 | + private FSALEORGID FSALEORGID; | ||
24 | + private FPAYORGID FPAYORGID; | ||
25 | + private String FCONTACTUNITTYPE; | ||
26 | + private FCONTACTUNIT FCONTACTUNIT; | ||
27 | + private String FPAYUNITTYPE; | ||
28 | + private FPAYUNIT FPAYUNIT; | ||
29 | + private List<FRECEIVEBILLENTRY> FRECEIVEBILLENTRY; | ||
30 | + | ||
31 | + @JsonProperty("systemDynamicCode") | ||
32 | + public String getSystemDynamicCode() { | ||
33 | + return systemDynamicCode; | ||
34 | + } | ||
35 | + | ||
36 | + public void setSystemDynamicCode(String systemDynamicCode) { | ||
37 | + this.systemDynamicCode = systemDynamicCode; | ||
38 | + } | ||
39 | + | ||
40 | + @JsonProperty("fixedBusinessType") | ||
41 | + public String getFixedBusinessType() { | ||
42 | + return fixedBusinessType; | ||
43 | + } | ||
44 | + | ||
45 | + public void setFixedBusinessType(String fixedBusinessType) { | ||
46 | + this.fixedBusinessType = fixedBusinessType; | ||
47 | + } | ||
48 | + | ||
49 | + @JsonProperty("FDATE") | ||
50 | + public String getFDATE() { | ||
51 | + return FDATE; | ||
52 | + } | ||
53 | + | ||
54 | + public void setFDATE(String FDATE) { | ||
55 | + this.FDATE = FDATE; | ||
56 | + } | ||
57 | + | ||
58 | + @JsonProperty("FBillTypeID") | ||
59 | + public FBillTypeID getFBillTypeID() { | ||
60 | + return FBillTypeID; | ||
61 | + } | ||
62 | + | ||
63 | + public void setFBillTypeID(FBillTypeID FBillTypeID) { | ||
64 | + this.FBillTypeID = FBillTypeID; | ||
65 | + } | ||
66 | + | ||
67 | + @JsonProperty("FSETTLEMAINBOOKID") | ||
68 | + public FSETTLEMAINBOOKID getFSETTLEMAINBOOKID() { | ||
69 | + return FSETTLEMAINBOOKID; | ||
70 | + } | ||
71 | + | ||
72 | + public void setFSETTLEMAINBOOKID(FSETTLEMAINBOOKID FSETTLEMAINBOOKID) { | ||
73 | + this.FSETTLEMAINBOOKID = FSETTLEMAINBOOKID; | ||
74 | + } | ||
75 | + | ||
76 | + @JsonProperty("FSALEDEPTID") | ||
77 | + public FSALEDEPTID getFSALEDEPTID() { | ||
78 | + return FSALEDEPTID; | ||
79 | + } | ||
80 | + | ||
81 | + public void setFSALEDEPTID(FSALEDEPTID FSALEDEPTID) { | ||
82 | + this.FSALEDEPTID = FSALEDEPTID; | ||
83 | + } | ||
84 | + | ||
85 | + @JsonProperty("FSETTLEORGID") | ||
86 | + public FSETTLEORGID getFSETTLEORGID() { | ||
87 | + return FSETTLEORGID; | ||
88 | + } | ||
89 | + | ||
90 | + public void setFSETTLEORGID(FSETTLEORGID FSETTLEORGID) { | ||
91 | + this.FSETTLEORGID = FSETTLEORGID; | ||
92 | + } | ||
93 | + | ||
94 | + @JsonProperty("FCURRENCYID") | ||
95 | + public FCURRENCYID getFCURRENCYID() { | ||
96 | + return FCURRENCYID; | ||
97 | + } | ||
98 | + | ||
99 | + public void setFCURRENCYID(FCURRENCYID FCURRENCYID) { | ||
100 | + this.FCURRENCYID = FCURRENCYID; | ||
101 | + } | ||
102 | + | ||
103 | + @JsonProperty("FSALEORGID") | ||
104 | + public FSALEORGID getFSALEORGID() { | ||
105 | + return FSALEORGID; | ||
106 | + } | ||
107 | + | ||
108 | + public void setFSALEORGID(FSALEORGID FSALEORGID) { | ||
109 | + this.FSALEORGID = FSALEORGID; | ||
110 | + } | ||
111 | + | ||
112 | + @JsonProperty("FPAYORGID") | ||
113 | + public FPAYORGID getFPAYORGID() { | ||
114 | + return FPAYORGID; | ||
115 | + } | ||
116 | + | ||
117 | + public void setFPAYORGID(FPAYORGID FPAYORGID) { | ||
118 | + this.FPAYORGID = FPAYORGID; | ||
119 | + } | ||
120 | + | ||
121 | + @JsonProperty("FCONTACTUNITTYPE") | ||
122 | + public String getFCONTACTUNITTYPE() { | ||
123 | + return FCONTACTUNITTYPE; | ||
124 | + } | ||
125 | + | ||
126 | + public void setFCONTACTUNITTYPE(String FCONTACTUNITTYPE) { | ||
127 | + this.FCONTACTUNITTYPE = FCONTACTUNITTYPE; | ||
128 | + } | ||
129 | + | ||
130 | + @JsonProperty("FCONTACTUNIT") | ||
131 | + public FCONTACTUNIT getFCONTACTUNIT() { | ||
132 | + return FCONTACTUNIT; | ||
133 | + } | ||
134 | + | ||
135 | + public void setFCONTACTUNIT(FCONTACTUNIT FCONTACTUNIT) { | ||
136 | + this.FCONTACTUNIT = FCONTACTUNIT; | ||
137 | + } | ||
138 | + | ||
139 | + @JsonProperty("FPAYUNITTYPE") | ||
140 | + public String getFPAYUNITTYPE() { | ||
141 | + return FPAYUNITTYPE; | ||
142 | + } | ||
143 | + | ||
144 | + public void setFPAYUNITTYPE(String FPAYUNITTYPE) { | ||
145 | + this.FPAYUNITTYPE = FPAYUNITTYPE; | ||
146 | + } | ||
147 | + | ||
148 | + @JsonProperty("FPAYUNIT") | ||
149 | + public FPAYUNIT getFPAYUNIT() { | ||
150 | + return FPAYUNIT; | ||
151 | + } | ||
152 | + | ||
153 | + public void setFPAYUNIT(FPAYUNIT FPAYUNIT) { | ||
154 | + this.FPAYUNIT = FPAYUNIT; | ||
155 | + } | ||
156 | + | ||
157 | + @JsonProperty("FRECEIVEBILLENTRY") | ||
158 | + public List<FRECEIVEBILLENTRY> getFRECEIVEBILLENTRY() { | ||
159 | + return FRECEIVEBILLENTRY; | ||
160 | + } | ||
161 | + | ||
162 | + public void setFRECEIVEBILLENTRY(List<FRECEIVEBILLENTRY> FRECEIVEBILLENTRY) { | ||
163 | + this.FRECEIVEBILLENTRY = FRECEIVEBILLENTRY; | ||
164 | + } | ||
165 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/rec/DepositAndWithdrawBillCo.java
0 → 100644
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FACCOUNTID.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +/** | ||
6 | + * @Author: zhangmeiyang | ||
7 | + * @CreateTime: 2024-11-25 15:27 | ||
8 | + * @Version: todo | ||
9 | + */ | ||
10 | +public class FACCOUNTID { | ||
11 | + | ||
12 | + private String FNumber; | ||
13 | + | ||
14 | + @JsonProperty("FNumber") | ||
15 | + public String getFNumber() { | ||
16 | + return FNumber; | ||
17 | + } | ||
18 | + | ||
19 | + public void setFNumber(String FNumber) { | ||
20 | + this.FNumber = FNumber; | ||
21 | + } | ||
22 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FCONTACTUNIT.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +/** | ||
6 | + * @Author: zhangmeiyang | ||
7 | + * @CreateTime: 2024-10-23 15:15 | ||
8 | + * @Version: todo | ||
9 | + */ | ||
10 | +public class FCONTACTUNIT { | ||
11 | + private String FNumber; | ||
12 | + | ||
13 | + @JsonProperty("FNumber") | ||
14 | + public String getFNumber() { | ||
15 | + return FNumber; | ||
16 | + } | ||
17 | + | ||
18 | + public void setFNumber(String FNumber) { | ||
19 | + this.FNumber = FNumber; | ||
20 | + } | ||
21 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FEntityDetail.java
@@ -16,6 +16,7 @@ public class FEntityDetail { | @@ -16,6 +16,7 @@ public class FEntityDetail { | ||
16 | private BigDecimal FTaxPrice; | 16 | private BigDecimal FTaxPrice; |
17 | private BigDecimal FPrice; | 17 | private BigDecimal FPrice; |
18 | private BigDecimal FNoTaxAmountFor_D; | 18 | private BigDecimal FNoTaxAmountFor_D; |
19 | + private FSettleTypeID FSettleTypeID; | ||
19 | private FCOSTDEPARTMENTID FCOSTDEPARTMENTID; | 20 | private FCOSTDEPARTMENTID FCOSTDEPARTMENTID; |
20 | 21 | ||
21 | @JsonProperty("FCOSTID") | 22 | @JsonProperty("FCOSTID") |
@@ -72,6 +73,15 @@ public class FEntityDetail { | @@ -72,6 +73,15 @@ public class FEntityDetail { | ||
72 | this.FNoTaxAmountFor_D = FNoTaxAmountFor_D; | 73 | this.FNoTaxAmountFor_D = FNoTaxAmountFor_D; |
73 | } | 74 | } |
74 | 75 | ||
76 | + @JsonProperty("FSettleTypeID") | ||
77 | + public FSettleTypeID getFSettleTypeID() { | ||
78 | + return FSettleTypeID; | ||
79 | + } | ||
80 | + | ||
81 | + public void setFSettleTypeID(FSettleTypeID FSettleTypeID) { | ||
82 | + this.FSettleTypeID = FSettleTypeID; | ||
83 | + } | ||
84 | + | ||
75 | @JsonProperty("FCOSTDEPARTMENTID") | 85 | @JsonProperty("FCOSTDEPARTMENTID") |
76 | public FCOSTDEPARTMENTID getFCOSTDEPARTMENTID() { | 86 | public FCOSTDEPARTMENTID getFCOSTDEPARTMENTID() { |
77 | return FCOSTDEPARTMENTID; | 87 | return FCOSTDEPARTMENTID; |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FPAYUNIT.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +/** | ||
6 | + * @Author: zhangmeiyang | ||
7 | + * @CreateTime: 2024-10-23 15:15 | ||
8 | + * @Version: todo | ||
9 | + */ | ||
10 | +public class FPAYUNIT { | ||
11 | + private String FNumber; | ||
12 | + | ||
13 | + @JsonProperty("FNumber") | ||
14 | + public String getFNumber() { | ||
15 | + return FNumber; | ||
16 | + } | ||
17 | + | ||
18 | + public void setFNumber(String FNumber) { | ||
19 | + this.FNumber = FNumber; | ||
20 | + } | ||
21 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FPURPOSEID.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +/** | ||
6 | + * @Author: zhangmeiyang | ||
7 | + * @CreateTime: 2024-10-23 15:15 | ||
8 | + * @Version: todo | ||
9 | + */ | ||
10 | +public class FPURPOSEID { | ||
11 | + private String FNumber; | ||
12 | + | ||
13 | + @JsonProperty("FNumber") | ||
14 | + public String getFNumber() { | ||
15 | + return FNumber; | ||
16 | + } | ||
17 | + | ||
18 | + public void setFNumber(String FNumber) { | ||
19 | + this.FNumber = FNumber; | ||
20 | + } | ||
21 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FRECEIVEBILLENTRY.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +import java.math.BigDecimal; | ||
6 | + | ||
7 | +/** | ||
8 | + * @Author: zhangmeiyang | ||
9 | + * @CreateTime: 2024-11-25 10:10 | ||
10 | + * @Version: todo | ||
11 | + */ | ||
12 | +public class FRECEIVEBILLENTRY { | ||
13 | + private FCOSTID FCOSTID; | ||
14 | + private FASSETID FASSETID; | ||
15 | + private FSETTLETYPE FSETTLETYPEID; | ||
16 | + private BigDecimal FRECTOTALAMOUNTFOR; | ||
17 | + private FPURPOSEID FPURPOSEID; | ||
18 | + private FACCOUNTID FACCOUNTID; | ||
19 | + private FCOSTDEPARTMENTID FCOSTDEPARTMENTID; | ||
20 | + | ||
21 | + @JsonProperty("FCOSTID") | ||
22 | + public FCOSTID getFCOSTID() { | ||
23 | + return FCOSTID; | ||
24 | + } | ||
25 | + | ||
26 | + public void setFCOSTID(FCOSTID FCOSTID) { | ||
27 | + this.FCOSTID = FCOSTID; | ||
28 | + } | ||
29 | + | ||
30 | + @JsonProperty("FASSETID") | ||
31 | + public FASSETID getFASSETID() { | ||
32 | + return FASSETID; | ||
33 | + } | ||
34 | + | ||
35 | + public void setFASSETID(FASSETID FASSETID) { | ||
36 | + this.FASSETID = FASSETID; | ||
37 | + } | ||
38 | + | ||
39 | + @JsonProperty("FSETTLETYPEID") | ||
40 | + public FSETTLETYPE getFSETTLETYPEID() { | ||
41 | + return FSETTLETYPEID; | ||
42 | + } | ||
43 | + | ||
44 | + public void setFSETTLETYPEID(FSETTLETYPE FSETTLETYPEID) { | ||
45 | + this.FSETTLETYPEID = FSETTLETYPEID; | ||
46 | + } | ||
47 | + | ||
48 | + @JsonProperty("FRECTOTALAMOUNTFOR") | ||
49 | + public BigDecimal getFRECTOTALAMOUNTFOR() { | ||
50 | + return FRECTOTALAMOUNTFOR; | ||
51 | + } | ||
52 | + | ||
53 | + public void setFRECTOTALAMOUNTFOR(BigDecimal FRECTOTALAMOUNTFOR) { | ||
54 | + this.FRECTOTALAMOUNTFOR = FRECTOTALAMOUNTFOR; | ||
55 | + } | ||
56 | + | ||
57 | + @JsonProperty("FPURPOSEID") | ||
58 | + public FPURPOSEID getFPURPOSEID() { | ||
59 | + return FPURPOSEID; | ||
60 | + } | ||
61 | + | ||
62 | + public void setFPURPOSEID(FPURPOSEID FPURPOSEID) { | ||
63 | + this.FPURPOSEID = FPURPOSEID; | ||
64 | + } | ||
65 | + | ||
66 | + @JsonProperty("FACCOUNTID") | ||
67 | + public FACCOUNTID getFACCOUNTID() { | ||
68 | + return FACCOUNTID; | ||
69 | + } | ||
70 | + | ||
71 | + public void setFACCOUNTID(FACCOUNTID FACCOUNTID) { | ||
72 | + this.FACCOUNTID = FACCOUNTID; | ||
73 | + } | ||
74 | + @JsonProperty("FCOSTDEPARTMENTID") | ||
75 | + public FCOSTDEPARTMENTID getFCOSTDEPARTMENTID() { | ||
76 | + return FCOSTDEPARTMENTID; | ||
77 | + } | ||
78 | + | ||
79 | + public void setFCOSTDEPARTMENTID(FCOSTDEPARTMENTID FCOSTDEPARTMENTID) { | ||
80 | + this.FCOSTDEPARTMENTID = FCOSTDEPARTMENTID; | ||
81 | + } | ||
82 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FSETTLEMAINBOOKID.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +/** | ||
6 | + * @Author: zhangmeiyang | ||
7 | + * @CreateTime: 2024-10-10 10:03 | ||
8 | + * @Version: todo | ||
9 | + */ | ||
10 | +public class FSETTLEMAINBOOKID { | ||
11 | + private String FNUMBER; | ||
12 | + | ||
13 | + @JsonProperty("FNUMBER") | ||
14 | + public String getFNUMBER() { | ||
15 | + return FNUMBER; | ||
16 | + } | ||
17 | + | ||
18 | + public void setFNUMBER(String FNUMBER) { | ||
19 | + this.FNUMBER = FNUMBER; | ||
20 | + } | ||
21 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FSETTLETYPE.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.domain.model; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonProperty; | ||
4 | + | ||
5 | +/** | ||
6 | + * @Author: zhangmeiyang | ||
7 | + * @CreateTime: 2024-11-25 15:29 | ||
8 | + * @Version: todo | ||
9 | + */ | ||
10 | +public class FSETTLETYPE { | ||
11 | + | ||
12 | + private String FNumber; | ||
13 | + | ||
14 | + @JsonProperty("FNumber") | ||
15 | + public String getFNumber() { | ||
16 | + return FNumber; | ||
17 | + } | ||
18 | + | ||
19 | + public void setFNumber(String FNumber) { | ||
20 | + this.FNumber = FNumber; | ||
21 | + } | ||
22 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/exec/Holder.java
1 | package com.diligrp.etrade.thirdparty.exec; | 1 | package com.diligrp.etrade.thirdparty.exec; |
2 | 2 | ||
3 | import com.diligrp.etrade.thirdparty.demarcate.AbstractBasicHandler; | 3 | import com.diligrp.etrade.thirdparty.demarcate.AbstractBasicHandler; |
4 | -import com.diligrp.etrade.thirdparty.demarcate.AbstractBillHandler; | 4 | +import com.diligrp.etrade.thirdparty.demarcate.Handler; |
5 | import com.diligrp.etrade.thirdparty.type.BasicEnum; | 5 | import com.diligrp.etrade.thirdparty.type.BasicEnum; |
6 | import com.diligrp.etrade.thirdparty.type.BusinessEnum; | 6 | import com.diligrp.etrade.thirdparty.type.BusinessEnum; |
7 | import jakarta.annotation.Resource; | 7 | import jakarta.annotation.Resource; |
@@ -24,12 +24,12 @@ public class Holder implements InitializingBean, DisposableBean { | @@ -24,12 +24,12 @@ public class Holder implements InitializingBean, DisposableBean { | ||
24 | /** | 24 | /** |
25 | * 上下文 | 25 | * 上下文 |
26 | */ | 26 | */ |
27 | - public final static Map<BusinessEnum, AbstractBillHandler<?>> BUSINESS_CONTEXT = new ConcurrentHashMap<>(); | 27 | + public final static Map<BusinessEnum, Handler> BUSINESS_CONTEXT = new ConcurrentHashMap<>(); |
28 | public final static Map<BasicEnum, AbstractBasicHandler<?>> BASIC_CONTEXT = new ConcurrentHashMap<>(); | 28 | public final static Map<BasicEnum, AbstractBasicHandler<?>> BASIC_CONTEXT = new ConcurrentHashMap<>(); |
29 | 29 | ||
30 | 30 | ||
31 | @Resource | 31 | @Resource |
32 | - private List<AbstractBillHandler<?>> businessHandlers; | 32 | + private List<Handler> businessHandlers; |
33 | 33 | ||
34 | @Resource | 34 | @Resource |
35 | private List<AbstractBasicHandler<?>> basicHandlers; | 35 | private List<AbstractBasicHandler<?>> basicHandlers; |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/rec/DepositAndWithdrawRecHandler.java
0 → 100644
1 | +package com.diligrp.etrade.thirdparty.handler.rec; | ||
2 | + | ||
3 | +import com.diligrp.etrade.core.util.JsonUtils; | ||
4 | +import com.diligrp.etrade.thirdparty.demarcate.AbstractRecHandler; | ||
5 | +import com.diligrp.etrade.thirdparty.domain.co.rec.DepositAndWithdrawBillCo; | ||
6 | +import com.diligrp.etrade.thirdparty.type.BusinessEnum; | ||
7 | +import com.fasterxml.jackson.core.type.TypeReference; | ||
8 | +import org.springframework.stereotype.Component; | ||
9 | + | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +/** | ||
13 | + * @Author: zhangmeiyang | ||
14 | + * @CreateTime: 2024-11-25 09:34 | ||
15 | + * @Version: todo | ||
16 | + */ | ||
17 | +@Component | ||
18 | +public class DepositAndWithdrawRecHandler extends AbstractRecHandler<DepositAndWithdrawBillCo> { | ||
19 | + @Override | ||
20 | + public void handle(String json, Long marketId, String systemCode) throws Exception { | ||
21 | + List<DepositAndWithdrawBillCo> depositAndWithdrawBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {}); | ||
22 | + transferDataListWithOutFeeItem(depositAndWithdrawBillCos, marketId, systemCode); | ||
23 | + depositAndWithdrawBillCos.forEach(e->{ | ||
24 | + e.setFCONTACTUNITTYPE("BD_Customer"); | ||
25 | + e.setFPAYUNITTYPE("BD_Customer"); | ||
26 | + e.getFRECEIVEBILLENTRY().forEach(f->{ | ||
27 | + f.getFPURPOSEID().setFNumber("SFKYT02_SYS"); | ||
28 | + }); | ||
29 | + }); | ||
30 | + sendPurchaseOrder(depositAndWithdrawBillCos, marketId, systemCode); | ||
31 | + } | ||
32 | + | ||
33 | + @Override | ||
34 | + public BusinessEnum getType() { | ||
35 | + return BusinessEnum.DEPOSIT_AND_WITHDRAW; | ||
36 | + } | ||
37 | +} |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/type/BillType.java
1 | package com.diligrp.etrade.thirdparty.type; | 1 | package com.diligrp.etrade.thirdparty.type; |
2 | 2 | ||
3 | -import com.diligrp.etrade.core.util.JsonUtils; | ||
4 | -import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo; | ||
5 | -import com.diligrp.etrade.thirdparty.domain.model.FEntityDetail; | ||
6 | import com.diligrp.etrade.thirdparty.error.ThirdPartyException; | 3 | import com.diligrp.etrade.thirdparty.error.ThirdPartyException; |
7 | -import com.diligrp.etrade.thirdparty.utils.PurchaseOrderApiUtils; | ||
8 | -import com.diligrp.etrade.thirdparty.utils.ReceiptsOrderApiUtils; | ||
9 | -import com.diligrp.etrade.thirdparty.utils.ReceiptsRefundOrderApiUtils; | ||
10 | -import com.kingdee.bos.webapi.entity.IdentifyInfo; | ||
11 | - | ||
12 | -import java.math.BigDecimal; | ||
13 | 4 | ||
14 | public enum BillType { | 5 | public enum BillType { |
15 | 6 | ||
16 | - RECEIVABLES("AR_receivable") { | ||
17 | - @Override | ||
18 | - public <T extends BaseBillCo> void handle(T t, IdentifyInfo identifyInfo) throws Exception { | ||
19 | - var util = new PurchaseOrderApiUtils(identifyInfo); | ||
20 | - boolean purchaseOrder = util.getPurchaseOrder(t.getFBillTypeID().getFNUMBER(), t.getF_ZDB_Text1(), getAllAmountFor(t), t.getF_ZDB_Text667()); | ||
21 | - if (purchaseOrder) { | ||
22 | - util.createOnePurchaseOrder(JsonUtils.toJsonString(t), this.value); | ||
23 | - } | ||
24 | - } | ||
25 | - }, | ||
26 | - RECEIPTS("AR_RECEIVEBILL") { | ||
27 | - @Override | ||
28 | - public <T extends BaseBillCo> void handle(T t, IdentifyInfo identifyInfo) throws Exception { | ||
29 | - var util = new ReceiptsOrderApiUtils(identifyInfo); | ||
30 | - boolean purchaseOrder = util.getReceiptsOrder(t.getFBillTypeID().getFNUMBER(), t.getF_ZDB_Text1(), getAllAmountFor(t), t.getF_ZDB_Text667()); | ||
31 | - if (purchaseOrder) { | ||
32 | - util.createOnePurchaseOrder(JsonUtils.toJsonString(t), this.value); | ||
33 | - } | ||
34 | - } | ||
35 | - }, | ||
36 | - RECEIPT_AND_REFUND_FORM("AR_REFUNDBILL") { | ||
37 | - @Override | ||
38 | - public <T extends BaseBillCo> void handle(T t, IdentifyInfo identifyInfo) throws Exception { | ||
39 | - var util = new ReceiptsRefundOrderApiUtils(identifyInfo); | ||
40 | - boolean purchaseOrder = util.getReceiptsRefundOrder(t.getFBillTypeID().getFNUMBER(), t.getF_ZDB_Text1(), getAllAmountFor(t), t.getF_ZDB_Text667()); | ||
41 | - if (purchaseOrder) { | ||
42 | - util.createOnePurchaseOrder(JsonUtils.toJsonString(t), this.value); | ||
43 | - } | ||
44 | - } | ||
45 | - }, | 7 | + RECEIVABLES("AR_receivable"), |
8 | + RECEIPTS("AR_RECEIVEBILL"), | ||
9 | + RECEIPT_AND_REFUND_FORM("AR_REFUNDBILL"), | ||
46 | ; | 10 | ; |
47 | 11 | ||
48 | public final String value; | 12 | public final String value; |
@@ -60,14 +24,4 @@ public enum BillType { | @@ -60,14 +24,4 @@ public enum BillType { | ||
60 | throw new ThirdPartyException("未实现的业务类型"); | 24 | throw new ThirdPartyException("未实现的业务类型"); |
61 | } | 25 | } |
62 | 26 | ||
63 | - private static <T extends BaseBillCo> String getAllAmountFor(T e) { | ||
64 | - var allAmountFor = BigDecimal.ZERO; | ||
65 | - for (FEntityDetail f : e.getFEntityDetail()) { | ||
66 | - BigDecimal single = f.getFPrice().multiply(f.getFPriceQty()); | ||
67 | - allAmountFor = allAmountFor.add(single); | ||
68 | - } | ||
69 | - return allAmountFor.toString(); | ||
70 | - } | ||
71 | - | ||
72 | - public abstract <T extends BaseBillCo> void handle(T t, IdentifyInfo identifyInfo) throws Exception; | ||
73 | } | 27 | } |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/type/BusinessEnum.java
@@ -13,7 +13,8 @@ public enum BusinessEnum { | @@ -13,7 +13,8 @@ public enum BusinessEnum { | ||
13 | CARD("CARD"), | 13 | CARD("CARD"), |
14 | WEIGHING("WEIGHING"), | 14 | WEIGHING("WEIGHING"), |
15 | BILL("BILL"), | 15 | BILL("BILL"), |
16 | - DEPOSIT("DEPOSIT"); | 16 | + DEPOSIT("DEPOSIT"), |
17 | + DEPOSIT_AND_WITHDRAW("DEPOSIT_AND_WITHDRAW"); | ||
17 | public final String code; | 18 | public final String code; |
18 | 19 | ||
19 | BusinessEnum(String code) { | 20 | BusinessEnum(String code) { |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/type/DynamicType.java
@@ -35,6 +35,7 @@ public enum DynamicType { | @@ -35,6 +35,7 @@ public enum DynamicType { | ||
35 | TRADE("5502"), | 35 | TRADE("5502"), |
36 | REFUND("5503"), | 36 | REFUND("5503"), |
37 | DEPOSIT("201"), | 37 | DEPOSIT("201"), |
38 | + DEPOSIT_AND_WITHDRAW("DEPOSIT_AND_WITHDRAW"), | ||
38 | ; | 39 | ; |
39 | public final String code; | 40 | public final String code; |
40 | 41 |
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/utils/ReceiptsOrderApiUtils.java
@@ -24,10 +24,10 @@ public class ReceiptsOrderApiUtils extends BaseApiUtils { | @@ -24,10 +24,10 @@ public class ReceiptsOrderApiUtils extends BaseApiUtils { | ||
24 | super(identifyInfo); | 24 | super(identifyInfo); |
25 | } | 25 | } |
26 | 26 | ||
27 | - public boolean getReceiptsOrder(String FBillTypeID, String F_ZDB_text1,String allAmountFor,String F_ZDB_Text667 ) throws Exception { | 27 | + public boolean getReceiptsOrder(String FBillTypeID,String realRecAmountFor) throws Exception { |
28 | String FilterString = """ | 28 | String FilterString = """ |
29 | - FBillTypeID.FNumber = '%s' and F_ZDB_text1 ='%s' and FALLAMOUNTFOR = '%s' and F_ZDB_Text667 = '%s' | ||
30 | - """.formatted(FBillTypeID, F_ZDB_text1,allAmountFor,F_ZDB_Text667); | 29 | + FBillTypeID.FNumber = '%s' and FREALRECAMOUNTFOR = '%s' |
30 | + """.formatted(FBillTypeID,realRecAmountFor); | ||
31 | var query = new GeneralQueryMessage(); | 31 | var query = new GeneralQueryMessage(); |
32 | query.setFilterString(FilterString); | 32 | query.setFilterString(FilterString); |
33 | query.setFieldKeys("FID"); | 33 | query.setFieldKeys("FID"); |