Commit fb12eddc0b25f832c5c9922401a8b003693b0aab

Authored by zhangmeiyang
1 parent 38b68476

金蝶对接pt2

Showing 22 changed files with 514 additions and 163 deletions
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/component/TransferComponent.java
1 1 package com.diligrp.etrade.thirdparty.component;
2 2  
3 3  
  4 +import com.diligrp.etrade.core.Constants;
4 5 import com.diligrp.etrade.thirdparty.domain.co.basic.BaseSourceCo;
5 6 import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo;
6 7 import com.diligrp.etrade.thirdparty.domain.model.*;
... ... @@ -10,6 +11,7 @@ import org.springframework.stereotype.Component;
10 11 import org.springframework.util.ObjectUtils;
11 12  
12 13 import java.time.LocalDateTime;
  14 +import java.time.format.DateTimeFormatter;
13 15  
14 16 /**
15 17 * Transfer Component (传输组件)
... ... @@ -34,7 +36,7 @@ public class TransferComponent {
34 36 * @param systemCode 系统代码
35 37 */
36 38 public void transBaseCo(BaseBillCo co, Long marketId, String systemCode) {
37   - co.setFDATE(LocalDateTime.now().toString());
  39 + co.setFDATE(LocalDateTime.now().format(DateTimeFormatter.ofPattern(Constants.DATE_TIME_FORMAT)));
38 40 co.setFCURRENCYID(new FCURRENCYID());
39 41 co.setFMAINBOOKSTDCURRID(new FMAINBOOKSTDCURRID());
40 42 co.setFPAYORGID(new FPAYORGID());
... ... @@ -57,7 +59,6 @@ public class TransferComponent {
57 59 this.transSettleOrgId(co.getFSETTLEORGID(), marketId, systemCode);
58 60 this.transCurrency(co.getFCURRENCYID(), marketId, systemCode);
59 61 this.transMainBookCurrency(co.getFMAINBOOKSTDCURRID(), marketId, systemCode);
60   -
61 62 }
62 63  
63 64 public void transBasicCo(BaseSourceCo co, Long marketId, String systemCode){
... ... @@ -95,6 +96,9 @@ public class TransferComponent {
95 96 * @param fcustomerid fcustomerid
96 97 */
97 98 public void transCustomer(FCUSTOMERID fcustomerid){
  99 + if (ObjectUtils.isEmpty(fcustomerid.getFNumber())){
  100 + return;
  101 + }
98 102 fcustomerid.setFNumber(transMapper.getCustomer(Long.valueOf(fcustomerid.getFNumber())).getCode());
99 103 }
100 104  
... ... @@ -104,6 +108,9 @@ public class TransferComponent {
104 108 * @param forderid forderid
105 109 */
106 110 public void transOrderId(FORDERID forderid){
  111 + if (ObjectUtils.isEmpty(forderid.getFNumber())){
  112 + return;
  113 + }
107 114 forderid.setFNumber(transMapper.getCustomer(Long.valueOf(forderid.getFNumber())).getCode());
108 115 }
109 116  
... ... @@ -113,6 +120,9 @@ public class TransferComponent {
113 120 * @param ftransferid ftransferid
114 121 */
115 122 public void transTransferId(FTRANSFERID ftransferid){
  123 + if (ObjectUtils.isEmpty(ftransferid.getFNumber())){
  124 + return;
  125 + }
116 126 ftransferid.setFNumber(transMapper.getCustomer(Long.valueOf(ftransferid.getFNumber())).getCode());
117 127 }
118 128  
... ... @@ -177,6 +187,9 @@ public class TransferComponent {
177 187 * @param fsaledeptid fsaledeptid
178 188 */
179 189 public void transDepId(FSALEDEPTID fsaledeptid){
  190 + if (ObjectUtils.isEmpty(fsaledeptid.getFNumber())){
  191 + return;
  192 + }
180 193 fsaledeptid.setFNumber(transMapper.getDepartment(Long.valueOf(fsaledeptid.getFNumber())).getDepartmentCode());
181 194 }
182 195  
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/demarcate/AbstractBillHandler.java
1 1 package com.diligrp.etrade.thirdparty.demarcate;
2 2  
  3 +import com.diligrp.etrade.core.util.JsonUtils;
3 4 import com.diligrp.etrade.thirdparty.component.TransferComponent;
4 5 import com.diligrp.etrade.thirdparty.domain.co.business.BaseBillCo;
5 6 import com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto;
  7 +import com.diligrp.etrade.thirdparty.domain.dto.ClientDto;
  8 +import com.diligrp.etrade.thirdparty.domain.model.FEntityDetail;
6 9 import com.diligrp.etrade.thirdparty.mapper.TransMapper;
  10 +import com.diligrp.etrade.thirdparty.type.BasicEnum;
7 11 import com.diligrp.etrade.thirdparty.type.BusinessEnum;
  12 +import com.diligrp.etrade.thirdparty.type.DynamicType;
  13 +import com.diligrp.etrade.thirdparty.type.SelectType;
  14 +import com.diligrp.etrade.thirdparty.utils.PurchaseOrderApiUtils;
  15 +import com.kingdee.bos.webapi.entity.IdentifyInfo;
8 16 import jakarta.annotation.Resource;
  17 +import org.springframework.util.ObjectUtils;
  18 +
  19 +import java.util.ArrayList;
  20 +import java.util.HashMap;
  21 +import java.util.List;
  22 +import java.util.Map;
9 23  
10 24 /**
11 25 * 抽象业务处理程序
... ... @@ -21,6 +35,55 @@ public abstract class AbstractBillHandler<T extends BaseBillCo> implements TypeM
21 35 @Resource
22 36 protected TransMapper transMapper;
23 37  
  38 + protected static final Map<String, TransferFunctionSingle> TRANSFER_FUNCTION_SINGLE_MAP = new HashMap<>();
  39 + protected static final Map<String, TransferFunctionMulti> TRANSFER_FUNCTION_MULTI_MAP = new HashMap<>();
  40 + protected static final TransferFunctionSingle DEPT = AbstractBillHandler::transferDynamicDept;
  41 + protected static final TransferFunctionSingle CUSTOMER = AbstractBillHandler::transferDynamicCustomer;
  42 + protected static final TransferFunctionSingle SETTLE_TYPE = AbstractBillHandler::transferDynamicSettleType;
  43 + protected static final TransferFunctionSingle BUSINESS_TYPE = AbstractBillHandler::transferDynamicBusinessType;
  44 + protected static final TransferFunctionMulti CHARGE_ITEM = AbstractBillHandler::transferDynamicChargeItem;
  45 +
  46 + static {
  47 + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.DEPARTMENT_TO_LOWER.code, DEPT);
  48 + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.CUSTOMER_TO_LOWER.code, CUSTOMER);
  49 + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.FINANCIAL_CHANNEL_TYPE_TO_LOWER.code, SETTLE_TYPE);
  50 + TRANSFER_FUNCTION_SINGLE_MAP.put(BasicEnum.FINANCIAL_BUSINESS_TYPE_TO_LOWER.code, BUSINESS_TYPE);
  51 + TRANSFER_FUNCTION_MULTI_MAP.put(BasicEnum.CHARGE_ITEM_TO_LOWER.code, CHARGE_ITEM);
  52 + }
  53 +
  54 + /**
  55 + * 转换动态配置部门
  56 + *
  57 + * @param t t
  58 + * @param data 数据
  59 + */
  60 + protected static <T extends BaseBillCo> 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 BaseBillCo> void transferDynamicCustomer(T t, BusinessDetailDto data) {
  71 + t.getFTRANSFERID().setFNumber(data.getItemValue());
  72 + t.getFORDERID().setFNumber(data.getItemValue());
  73 + t.getFCUSTOMERID().setFNumber(data.getItemValue());
  74 + }
  75 +
  76 + /**
  77 + * 转移动态结算类型
  78 + *
  79 + * @param t t
  80 + * @param data 数据
  81 + */
  82 + protected static <T extends BaseBillCo> void transferDynamicSettleType(T t, BusinessDetailDto data) {
  83 + t.getFSettleTypeID().setFNumber(data.getItemValue());
  84 + }
  85 +
  86 +
24 87 /**
25 88 * 固定转换
26 89 *
... ... @@ -32,19 +95,133 @@ public abstract class AbstractBillHandler&lt;T extends BaseBillCo&gt; implements TypeM
32 95 transferComponent.transBaseCo(t, marketId, systemCode);
33 96 }
34 97  
  98 + /**
  99 + * Transfer Dynamic 业务类型
  100 + *
  101 + * @param t t
  102 + * @param data 数据
  103 + */
  104 + protected static <T extends BaseBillCo> void transferDynamicBusinessType(T t, BusinessDetailDto data) {
  105 + t.setF_PZCW_Text(data.getItemValue());
  106 + }
  107 +
  108 + /**
  109 + * Transfer Dynamic Charge 项目
  110 + *
  111 + * @param data 数据
  112 + * @param entity 实体
  113 + */
  114 + protected static <T extends BaseBillCo> void transferDynamicChargeItem(T entity, List<BusinessDetailDto> data) {
  115 + Map<String,String> relationMap = new HashMap<>();
  116 + Map<String,String> codeMap = new HashMap<>();
  117 + for (BusinessDetailDto dto : data) {
  118 + if (!ObjectUtils.isEmpty(dto.getItemRelationId())){
  119 + relationMap.put(String.valueOf(dto.getItemRelationId()), dto.getItemValue());
  120 + }
  121 + if (!ObjectUtils.isEmpty(dto.getItemCode())){
  122 + codeMap.put(dto.getItemCode(), dto.getItemValue());
  123 + }
  124 + }
  125 + List<FEntityDetail> fEntityDetail = entity.getFEntityDetail().stream().filter(f -> ObjectUtils.isEmpty(f.getFCOSTID())).toList();
  126 + fEntityDetail.forEach(e->{
  127 + var costId = e.getFASSETID().getFNUMBER();
  128 + if (relationMap.containsKey(costId)){
  129 + e.getFCOSTID().setFNUMBER(relationMap.get(costId));
  130 + }else if (codeMap.containsKey(costId)){
  131 + e.getFCOSTID().setFNUMBER(relationMap.get(costId));
  132 + }
  133 + });
  134 + }
  135 +
  136 + protected void transferDataList(List<T> ts, Long marketId, String systemCode){
  137 + ts.forEach(e -> {
  138 + transfer(e, marketId, systemCode);
  139 + getFilteredDynamicDataSingle(DynamicType.fromCode(e.getF_PZCW_Text()), marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_SINGLE_MAP.get(k).transferDynamic(e, v));
  140 + getFilteredDynamicDataMulti(DynamicType.fromCode(e.getF_PZCW_Text()), marketId, systemCode).forEach((k, v) -> TRANSFER_FUNCTION_MULTI_MAP.get(k).transferDynamic(e, v));
  141 + });
  142 + }
  143 +
  144 + /**
  145 + * 获取动态数据
  146 + *
  147 + * @param marketId 市场 ID
  148 + * @param systemCode 系统代码
  149 + * @param dynamicType 动态型
  150 + * @return {@link Map}<{@link String}, {@link BusinessDetailDto}>
  151 + */
  152 + protected Map<String, BusinessDetailDto> getFilteredDynamicDataSingle(DynamicType dynamicType, Long marketId, String systemCode) {
  153 + var queryArrays = new String[]{
  154 + BasicEnum.DEPARTMENT_TO_LOWER.code,
  155 + BasicEnum.CUSTOMER_TO_LOWER.code,
  156 + BasicEnum.FINANCIAL_CHANNEL_TYPE_TO_LOWER.code,
  157 + BasicEnum.FINANCIAL_BUSINESS_TYPE_TO_LOWER.code
  158 + };
  159 + var dynamicParam = transMapper.getFixedWithQueryArrays(systemCode, dynamicType.code, marketId, SelectType.FIXED.getCode(),queryArrays );
  160 + Map<String, BusinessDetailDto> map = new HashMap<>();
  161 + dynamicParam.forEach(e -> map.computeIfAbsent(e.getCode(), k -> e));
  162 + return map;
  163 + }
35 164  
36 165 /**
37 166 * 获取动态数据
38 167 *
39   - * @param code 法典
  168 + * @param marketId 市场 ID
  169 + * @param systemCode 系统代码
  170 + * @param dynamicType 动态型
  171 + * @return {@link Map}<{@link String}, {@link BusinessDetailDto}>
  172 + */
  173 + protected Map<String, List<BusinessDetailDto>> getFilteredDynamicDataMulti(DynamicType dynamicType, Long marketId, String systemCode) {
  174 + var queryArrays = new String[]{BasicEnum.CHARGE_ITEM_TO_LOWER.code};
  175 + var dynamicParam = transMapper.getFixedWithQueryArrays(systemCode, dynamicType.code, marketId, SelectType.FIXED.getCode(),queryArrays);
  176 + Map<String, List<BusinessDetailDto>> map = new HashMap<>();
  177 + dynamicParam.forEach(e -> map.computeIfAbsent(e.getCode(), k -> new ArrayList<>()).add(e));
  178 + return map;
  179 + }
  180 +
  181 + /**
  182 + * 发送采购订单
  183 + *
40 184 * @param marketId 市场 ID
41 185 * @param systemCode 系统代码
42   - * @return {@link BusinessDetailDto}
  186 + * @param ts 茨
  187 + * @throws Exception 例外
43 188 */
44   - protected BusinessDetailDto getDynamicData(String code, Long marketId, String systemCode) {
45   - return transMapper.getDynamicParam(systemCode, code, marketId);
  189 + protected void sendPurchaseOrder(List<T> ts,Long marketId, String systemCode) throws Exception {
  190 + ClientDto clientParam = transMapper.getClientParam(systemCode, marketId);
  191 + var identifyInfo = new IdentifyInfo();
  192 + identifyInfo.setAppId(clientParam.getApplyId());
  193 + identifyInfo.setUserName(clientParam.getUsername());
  194 + identifyInfo.setServerUrl(clientParam.getServiceAddress());
  195 + identifyInfo.setAppSecret(clientParam.getSecurityKey());
  196 + identifyInfo.setdCID(clientParam.getDataCentreId());
  197 + var util = new PurchaseOrderApiUtils(identifyInfo);
  198 + for (T e : ts) {
  199 + util.createOnePurchaseOrder(JsonUtils.toJsonString(e), getDocumentType(marketId, systemCode, e.getFBillTypeID().getFNUMBER()));
  200 + }
46 201 }
47 202  
  203 + /**
  204 + * 获取文档类型
  205 + *
  206 + * @param marketId 市场 ID
  207 + * @param systemCode 系统代码
  208 + * @param billTypeId 账单类型 ID
  209 + * @return {@link String}
  210 + */
  211 + protected String getDocumentType(Long marketId, String systemCode, String billTypeId) {
  212 + return transMapper.getMappingDict(systemCode, marketId, billTypeId).getMapCategory();
  213 + }
  214 +
  215 +
  216 + @FunctionalInterface
  217 + protected interface TransferFunctionSingle {
  218 + void transferDynamic(BaseBillCo baseBillCo, BusinessDetailDto data);
  219 + }
  220 +
  221 + @FunctionalInterface
  222 + protected interface TransferFunctionMulti {
  223 + void transferDynamic(BaseBillCo baseBillCo, List<BusinessDetailDto> data);
  224 + }
48 225  
49 226 /**
50 227 * 处理
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/BaseBillCo.java
... ... @@ -4,7 +4,7 @@ import com.diligrp.etrade.thirdparty.domain.model.*;
4 4 import com.fasterxml.jackson.annotation.JsonProperty;
5 5  
6 6 import java.io.Serializable;
7   -import java.math.BigDecimal;
  7 +import java.util.List;
8 8  
9 9 /**
10 10 * @Author: zhangmeiyang
... ... @@ -13,10 +13,7 @@ import java.math.BigDecimal;
13 13 */
14 14 public class BaseBillCo implements Serializable {
15 15 private String FAR_Remark;
16   - private BigDecimal FPrice;
17   - private BigDecimal FTaxPrice;
18   - private BigDecimal FPriceQty;
19   - private String FBUSINESSTYPE;
  16 + private String F_PZCW_Text;
20 17 private String FDATE;
21 18 private FBillTypeID FBillTypeID;
22 19 private FSETTLEORGID FSETTLEORGID;
... ... @@ -28,10 +25,9 @@ public class BaseBillCo implements Serializable {
28 25 private FTRANSFERID FTRANSFERID;
29 26 private FORDERID FORDERID;
30 27 private FMAINBOOKSTDCURRID FMAINBOOKSTDCURRID;
31   - private FCOSTID FCOSTID;
32   - private FASSETID FASSETID;
33 28 private FChargeId FChargeId;
34 29 private FSettleTypeID FSettleTypeID;
  30 + private List<FEntityDetail> FEntityDetail;
35 31  
36 32 @JsonProperty("FAR_Remark")
37 33 public String getFAR_Remark() {
... ... @@ -42,40 +38,13 @@ public class BaseBillCo implements Serializable {
42 38 this.FAR_Remark = FAR_Remark;
43 39 }
44 40  
45   - @JsonProperty("FPrice")
46   - public BigDecimal getFPrice() {
47   - return FPrice;
  41 + @JsonProperty("F_PZCW_Text")
  42 + public String getF_PZCW_Text() {
  43 + return F_PZCW_Text;
48 44 }
49 45  
50   - public void setFPrice(BigDecimal FPrice) {
51   - this.FPrice = FPrice;
52   - }
53   -
54   - @JsonProperty("FTaxPrice")
55   - public BigDecimal getFTaxPrice() {
56   - return FTaxPrice;
57   - }
58   -
59   - public void setFTaxPrice(BigDecimal FTaxPrice) {
60   - this.FTaxPrice = FTaxPrice;
61   - }
62   -
63   - @JsonProperty("FPriceQty")
64   - public BigDecimal getFPriceQty() {
65   - return FPriceQty;
66   - }
67   -
68   - public void setFPriceQty(BigDecimal FPriceQty) {
69   - this.FPriceQty = FPriceQty;
70   - }
71   -
72   - @JsonProperty("FBUSINESSTYPE")
73   - public String getFBUSINESSTYPE() {
74   - return FBUSINESSTYPE;
75   - }
76   -
77   - public void setFBUSINESSTYPE(String FBUSINESSTYPE) {
78   - this.FBUSINESSTYPE = FBUSINESSTYPE;
  46 + public void setF_PZCW_Text(String f_PZCW_Text) {
  47 + F_PZCW_Text = f_PZCW_Text;
79 48 }
80 49  
81 50 @JsonProperty("FDATE")
... ... @@ -177,24 +146,6 @@ public class BaseBillCo implements Serializable {
177 146 this.FMAINBOOKSTDCURRID = FMAINBOOKSTDCURRID;
178 147 }
179 148  
180   - @JsonProperty("FCOSTID")
181   - public FCOSTID getFCOSTID() {
182   - return FCOSTID;
183   - }
184   -
185   - public void setFCOSTID(FCOSTID FCOSTID) {
186   - this.FCOSTID = FCOSTID;
187   - }
188   -
189   - @JsonProperty("FASSETID")
190   - public FASSETID getFASSETID() {
191   - return FASSETID;
192   - }
193   -
194   - public void setFASSETID(FASSETID FASSETID) {
195   - this.FASSETID = FASSETID;
196   - }
197   -
198 149 @JsonProperty("FChargeId")
199 150 public FChargeId getFChargeId() {
200 151 return FChargeId;
... ... @@ -212,4 +163,13 @@ public class BaseBillCo implements Serializable {
212 163 public void setFSettleTypeID(FSettleTypeID FSettleTypeID) {
213 164 this.FSettleTypeID = FSettleTypeID;
214 165 }
  166 +
  167 + @JsonProperty("FEntityDetail")
  168 + public List<FEntityDetail> getFEntityDetail() {
  169 + return FEntityDetail;
  170 + }
  171 +
  172 + public void setFEntityDetail(List<FEntityDetail> FEntityDetail) {
  173 + this.FEntityDetail = FEntityDetail;
  174 + }
215 175 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/BusinessBillCo.java
1 1 package com.diligrp.etrade.thirdparty.domain.co.business;
2 2  
3   -import com.fasterxml.jackson.annotation.JsonProperty;
4   -
5   -import java.math.BigDecimal;
6   -
7 3 /**
8 4 * @Author: zhangmeiyang
9 5 * @CreateTime: 2024-10-14 10:55
10 6 * @Version: todo
11 7 */
12 8 public class BusinessBillCo extends BaseBillCo{
13   - private BigDecimal FNoTaxAmountFor_D;
14   -
15   - @JsonProperty("FNoTaxAmountFor_D")
16   - public BigDecimal getFNoTaxAmountFor_D() {
17   - return FNoTaxAmountFor_D;
18   - }
19 9  
20   - public void setFNoTaxAmountFor_D(BigDecimal FNoTaxAmountFor_D) {
21   - this.FNoTaxAmountFor_D = FNoTaxAmountFor_D;
22   - }
23 10 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/CardBillCo.java
... ... @@ -9,7 +9,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
9 9 */
10 10 public class CardBillCo extends BaseBillCo {
11 11 private String F_ZDB_Text;
12   - private String F_PZCW_Text;
13 12  
14 13 @JsonProperty("F_ZDB_Text")
15 14 public String getF_ZDB_Text() {
... ... @@ -19,15 +18,6 @@ public class CardBillCo extends BaseBillCo {
19 18 public void setF_ZDB_Text(String f_ZDB_Text) {
20 19 F_ZDB_Text = f_ZDB_Text;
21 20 }
22   -
23   - @JsonProperty("F_PZCW_Text")
24   - public String getF_PZCW_Text() {
25   - return F_PZCW_Text;
26   - }
27   -
28   - public void setF_PZCW_Text(String f_PZCW_Text) {
29   - F_PZCW_Text = f_PZCW_Text;
30   - }
31 21 }
32 22  
33 23  
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/EntranceFeeBillCo.java
1 1 package com.diligrp.etrade.thirdparty.domain.co.business;
2 2  
3   -import com.fasterxml.jackson.annotation.JsonProperty;
4   -
5   -import java.math.BigDecimal;
6   -
7 3 /**
8 4 * @Author: zhangmeiyang
9 5 * @CreateTime: 2024-10-10 10:17
10 6 * @Version: todo
11 7 */
12 8 public class EntranceFeeBillCo extends BaseBillCo{
13   - private BigDecimal FNoTaxAmountFor_D;
14   -
15   - @JsonProperty("FNoTaxAmountFor_D")
16   - public BigDecimal getFNoTaxAmountFor_D() {
17   - return FNoTaxAmountFor_D;
18   - }
19   -
20   - public void setFNoTaxAmountFor_D(BigDecimal FNoTaxAmountFor_D) {
21   - this.FNoTaxAmountFor_D = FNoTaxAmountFor_D;
22   - }
23 9  
24 10 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/RefrigeratorBillCo.java
1 1 package com.diligrp.etrade.thirdparty.domain.co.business;
2 2  
3   -import com.fasterxml.jackson.annotation.JsonProperty;
4   -
5   -import java.math.BigDecimal;
6   -
7 3 /**
8 4 * @Author: zhangmeiyang
9 5 * @CreateTime: 2024-10-10 14:18
10 6 * @Version: todo
11 7 */
12 8 public class RefrigeratorBillCo extends BaseBillCo {
13   - private BigDecimal FNoTaxAmountFor_D;
14   -
15   - @JsonProperty("FNoTaxAmountFor_D")
16   - public BigDecimal getFNoTaxAmountFor_D() {
17   - return FNoTaxAmountFor_D;
18   - }
19 9  
20   - public void setFNoTaxAmountFor_D(BigDecimal FNoTaxAmountFor_D) {
21   - this.FNoTaxAmountFor_D = FNoTaxAmountFor_D;
22   - }
23 10  
24 11 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/SettleBillCo.java
... ... @@ -9,7 +9,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
9 9 */
10 10 public class SettleBillCo extends BaseBillCo {
11 11 private String F_ZDB_Text;
12   - private String F_PZCW_Text;
13 12  
14 13 @JsonProperty("F_ZDB_Text")
15 14 public String getF_ZDB_Text() {
... ... @@ -20,14 +19,5 @@ public class SettleBillCo extends BaseBillCo {
20 19 F_ZDB_Text = f_ZDB_Text;
21 20 }
22 21  
23   - @JsonProperty("F_PZCW_Text")
24   - public String getF_PZCW_Text() {
25   - return F_PZCW_Text;
26   - }
27   -
28   - public void setF_PZCW_Text(String f_PZCW_Text) {
29   - F_PZCW_Text = f_PZCW_Text;
30   - }
31   -
32 22 }
33 23  
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/co/business/WeighingBillCo.java
1 1 package com.diligrp.etrade.thirdparty.domain.co.business;
2 2  
3   -import com.fasterxml.jackson.annotation.JsonProperty;
4   -
5   -import java.math.BigDecimal;
6   -
7 3 /**
8 4 * @Author: zhangmeiyang
9 5 * @CreateTime: 2024-10-10 11:08
10 6 * @Version: todo
11 7 */
12 8 public class WeighingBillCo extends BaseBillCo {
13   - private BigDecimal FNoTaxAmountFor_D;
14   -
15   - @JsonProperty("FNoTaxAmountFor_D")
16   - public BigDecimal getFNoTaxAmountFor_D() {
17   - return FNoTaxAmountFor_D;
18   - }
19 9  
20   - public void setFNoTaxAmountFor_D(BigDecimal FNoTaxAmountFor_D) {
21   - this.FNoTaxAmountFor_D = FNoTaxAmountFor_D;
22   - }
23 10  
24 11 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/dto/FinancialDictMappingDto.java 0 → 100644
  1 +package com.diligrp.etrade.thirdparty.domain.dto;
  2 +
  3 +
  4 +/**
  5 + * @author dengwei
  6 + * @version 1.0.0
  7 + * @ClassName FinancialDictMappingVO.java
  8 + * @Description FinancialDictMappingVO
  9 + * @date 2024-10-22 17:12
  10 + */
  11 +public class FinancialDictMappingDto {
  12 + /**
  13 + * 市场 ID
  14 + */
  15 + private Long marketId;
  16 +
  17 + /**
  18 + * 对接系统code(kingdee:金蝶)
  19 + */
  20 + private String systemCode;
  21 +
  22 + /**
  23 + * 字典dd_code
  24 + * 支付方式:financial_channel_type
  25 + * 业务类型:financial_business_type
  26 + */
  27 + private String dictDdCode;
  28 +
  29 + /**
  30 + * 字典 ID
  31 + */
  32 + private Long dictId;
  33 +
  34 + /**
  35 + * dict 代码
  36 + */
  37 + private String dictCode;
  38 +
  39 + /**
  40 + * dict 名称
  41 + */
  42 + private String dictName;
  43 +
  44 + /**
  45 + * 映射类别
  46 + * 1:现金 2:支票 3:商业承兑汇票 4:银行承兑汇票 5:本票 6:汇兑 7:信用证 8:委托收款 9:托收承付 10:汇票
  47 + * 11:银行汇票 12:电子支付 13:光票托收 14:承兑交单 15:远期付款交单 16:即期付款交单 17:票汇 18:信用卡 19:微信 20:支付宝
  48 + */
  49 + private String mapCategory;
  50 +
  51 + /**
  52 + * 映射分类
  53 + * 支付方式:1:现金业务 2:银行业务 3:票据业务 4:内部结算
  54 + * 业务类型:AR_receivable:应收单 AR_RECEIVEBILL:收款单 AR_REFUNDBILL:收款退款单
  55 + */
  56 + private String mapType;
  57 +
  58 +
  59 + public Long getMarketId() {
  60 + return marketId;
  61 + }
  62 +
  63 + public void setMarketId(Long marketId) {
  64 + this.marketId = marketId;
  65 + }
  66 +
  67 + public String getSystemCode() {
  68 + return systemCode;
  69 + }
  70 +
  71 + public void setSystemCode(String systemCode) {
  72 + this.systemCode = systemCode;
  73 + }
  74 +
  75 + public String getDictDdCode() {
  76 + return dictDdCode;
  77 + }
  78 +
  79 + public void setDictDdCode(String dictDdCode) {
  80 + this.dictDdCode = dictDdCode;
  81 + }
  82 +
  83 + public Long getDictId() {
  84 + return dictId;
  85 + }
  86 +
  87 + public void setDictId(Long dictId) {
  88 + this.dictId = dictId;
  89 + }
  90 +
  91 + public String getDictCode() {
  92 + return dictCode;
  93 + }
  94 +
  95 + public void setDictCode(String dictCode) {
  96 + this.dictCode = dictCode;
  97 + }
  98 +
  99 + public String getDictName() {
  100 + return dictName;
  101 + }
  102 +
  103 + public void setDictName(String dictName) {
  104 + this.dictName = dictName;
  105 + }
  106 +
  107 + public String getMapCategory() {
  108 + return mapCategory;
  109 + }
  110 +
  111 + public void setMapCategory(String mapCategory) {
  112 + this.mapCategory = mapCategory;
  113 + }
  114 +
  115 + public String getMapType() {
  116 + return mapType;
  117 + }
  118 +
  119 + public void setMapType(String mapType) {
  120 + this.mapType = mapType;
  121 + }
  122 +}
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/domain/model/FEntityDetail.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-10-28 16:41
  10 + * @Version: todo
  11 + */
  12 +public class FEntityDetail {
  13 + private FCOSTID FCOSTID;
  14 + private FASSETID FASSETID;
  15 + private BigDecimal FPriceQty;
  16 + private BigDecimal FTaxPrice;
  17 + private BigDecimal FPrice;
  18 + private BigDecimal FNoTaxAmountFor_D;
  19 +
  20 + @JsonProperty("FCOSTID")
  21 + public FCOSTID getFCOSTID() {
  22 + return FCOSTID;
  23 + }
  24 +
  25 + public void setFCOSTID(FCOSTID FCOSTID) {
  26 + this.FCOSTID = FCOSTID;
  27 + }
  28 +
  29 + @JsonProperty("FASSETID")
  30 + public FASSETID getFASSETID() {
  31 + return FASSETID;
  32 + }
  33 +
  34 + public void setFASSETID(FASSETID FASSETID) {
  35 + this.FASSETID = FASSETID;
  36 + }
  37 +
  38 + @JsonProperty("FPriceQty")
  39 + public BigDecimal getFPriceQty() {
  40 + return FPriceQty;
  41 + }
  42 +
  43 + public void setFPriceQty(BigDecimal FPriceQty) {
  44 + this.FPriceQty = FPriceQty;
  45 + }
  46 +
  47 + @JsonProperty("FTaxPrice")
  48 + public BigDecimal getFTaxPrice() {
  49 + return FTaxPrice;
  50 + }
  51 +
  52 + public void setFTaxPrice(BigDecimal FTaxPrice) {
  53 + this.FTaxPrice = FTaxPrice;
  54 + }
  55 +
  56 + @JsonProperty("FPrice")
  57 + public BigDecimal getFPrice() {
  58 + return FPrice;
  59 + }
  60 +
  61 + public void setFPrice(BigDecimal FPrice) {
  62 + this.FPrice = FPrice;
  63 + }
  64 +
  65 + @JsonProperty("FNoTaxAmountFor_D")
  66 + public BigDecimal getFNoTaxAmountFor_D() {
  67 + return FNoTaxAmountFor_D;
  68 + }
  69 +
  70 + public void setFNoTaxAmountFor_D(BigDecimal FNoTaxAmountFor_D) {
  71 + this.FNoTaxAmountFor_D = FNoTaxAmountFor_D;
  72 + }
  73 +}
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/business/BusinessBillHandler.java
... ... @@ -17,10 +17,10 @@ import java.util.List;
17 17 @Component
18 18 public class BusinessBillHandler extends AbstractBillHandler<BusinessBillCo> {
19 19 @Override
20   - public void handle(String json, Long marketId, String systemCode) {
  20 + public void handle(String json, Long marketId, String systemCode) throws Exception{
21 21 List<BusinessBillCo> businessBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {});
22   - businessBillCos.forEach(e->super.transfer(e,marketId,systemCode));
23   - System.out.println(JsonUtils.toJsonString(businessBillCos));
  22 + transferDataList(businessBillCos, marketId, systemCode);
  23 + sendPurchaseOrder(businessBillCos, marketId, systemCode);
24 24 }
25 25  
26 26 @Override
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/business/CardBillHandler.java
... ... @@ -19,8 +19,8 @@ public class CardBillHandler extends AbstractBillHandler&lt;CardBillCo&gt; {
19 19 @Override
20 20 public void handle(String json, Long marketId, String systemCode) throws Exception {
21 21 List<CardBillCo> cardBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {});
22   - cardBillCos.forEach(e-> super.transfer(e,marketId,systemCode));
23   - System.out.println(JsonUtils.toJsonString(cardBillCos));
  22 + transferDataList(cardBillCos, marketId, systemCode);
  23 + sendPurchaseOrder(cardBillCos,marketId, systemCode);
24 24 }
25 25  
26 26 @Override
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/business/EntranceFeeBillHandler.java
... ... @@ -17,10 +17,10 @@ import java.util.List;
17 17 @Component
18 18 public class EntranceFeeBillHandler extends AbstractBillHandler<EntranceFeeBillCo> {
19 19 @Override
20   - public void handle(String json, Long marketId, String systemCode) {
  20 + public void handle(String json, Long marketId, String systemCode) throws Exception{
21 21 List<EntranceFeeBillCo> entranceFeeBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {});
22   - entranceFeeBillCos.forEach(e->super.transfer(e,marketId,systemCode));
23   - System.out.println(JsonUtils.toJsonString(entranceFeeBillCos));
  22 + transferDataList(entranceFeeBillCos, marketId, systemCode);
  23 + sendPurchaseOrder(entranceFeeBillCos, marketId, systemCode);
24 24 }
25 25  
26 26 @Override
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/business/RefrigeratorBillHandler.java
... ... @@ -17,10 +17,10 @@ import java.util.List;
17 17 @Component
18 18 public class RefrigeratorBillHandler extends AbstractBillHandler<RefrigeratorBillCo> {
19 19 @Override
20   - public void handle(String json, Long marketId, String systemCode) {
  20 + public void handle(String json, Long marketId, String systemCode) throws Exception {
21 21 List<RefrigeratorBillCo> refrigeratorBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {});
22   - refrigeratorBillCos.forEach(e->super.transfer(e,marketId,systemCode));
23   - System.out.println(JsonUtils.toJsonString(refrigeratorBillCos));
  22 + transferDataList(refrigeratorBillCos, marketId, systemCode);
  23 + sendPurchaseOrder(refrigeratorBillCos, marketId, systemCode);
24 24 }
25 25  
26 26 @Override
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/business/SettleBillHandler.java
... ... @@ -18,10 +18,10 @@ import java.util.List;
18 18 public class SettleBillHandler extends AbstractBillHandler<SettleBillCo> {
19 19  
20 20 @Override
21   - public void handle(String json, Long marketId, String systemCode) {
  21 + public void handle(String json, Long marketId, String systemCode) throws Exception {
22 22 List<SettleBillCo> settleBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {});
23   - settleBillCos.forEach(e-> super.transfer(e,marketId,systemCode));
24   - System.out.println(JsonUtils.toJsonString(settleBillCos));
  23 + transferDataList(settleBillCos, marketId, systemCode);
  24 + super.sendPurchaseOrder(settleBillCos,marketId, systemCode);
25 25 }
26 26  
27 27 @Override
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/handler/business/WeighingBillHandler.java
... ... @@ -17,10 +17,10 @@ import java.util.List;
17 17 @Component
18 18 public class WeighingBillHandler extends AbstractBillHandler<WeighingBillCo> {
19 19 @Override
20   - public void handle(String json, Long marketId, String systemCode) {
  20 + public void handle(String json, Long marketId, String systemCode) throws Exception {
21 21 List<WeighingBillCo> weighingBillCos = JsonUtils.fromJsonString(json, new TypeReference<>() {});
22   - weighingBillCos.forEach(e->super.transfer(e,marketId,systemCode));
23   - System.out.println(JsonUtils.toJsonString(weighingBillCos));
  22 + transferDataList(weighingBillCos, marketId, systemCode);
  23 + sendPurchaseOrder(weighingBillCos, marketId, systemCode);
24 24 }
25 25  
26 26 @Override
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/mapper/TransMapper.java
... ... @@ -7,6 +7,8 @@ import com.diligrp.etrade.thirdparty.domain.dto.*;
7 7 import org.apache.ibatis.annotations.Mapper;
8 8 import org.apache.ibatis.annotations.Param;
9 9  
  10 +import java.util.List;
  11 +
10 12 /**
11 13 * @Author: zhangmeiyang
12 14 * @CreateTime: 2024-10-16 17:08
... ... @@ -34,7 +36,7 @@ public interface TransMapper extends MybatisMapperSupport {
34 36 * @return {@link BusinessDetailDto}
35 37 */
36 38 @DataSource(DataSourceConstants.DS_KEY_SLAVE)
37   - BusinessDetailDto getDynamicParam(@Param("systemCode")String systemCode, @Param("code") String code, @Param("marketId")Long marketId);
  39 + List<BusinessDetailDto> getFixedWithQueryArrays(@Param("systemCode")String systemCode, @Param("code") String code, @Param("marketId")Long marketId,@Param("selectType") Integer selectType,@Param("basicCodes")String[] basicCodes);
38 40  
39 41  
40 42 /**
... ... @@ -85,4 +87,15 @@ public interface TransMapper extends MybatisMapperSupport {
85 87 @DataSource(DataSourceConstants.DS_KEY_SLAVE)
86 88 MappingDto getMappingData(@Param("mapping") MappingDto mappingDto);
87 89  
  90 +
  91 + /**
  92 + * 获取基本配置
  93 + *
  94 + * @param systemCode 系统代码
  95 + * @param marketId 市场 ID
  96 + * @return {@link BaseConfigDto}
  97 + */
  98 + @DataSource(DataSourceConstants.DS_KEY_SLAVE)
  99 + FinancialDictMappingDto getMappingDict(@Param("systemCode") String systemCode, @Param("marketId") Long marketId,@Param("billTypeId") String billTypeId);
  100 +
88 101 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/type/BasicEnum.java
... ... @@ -15,12 +15,17 @@ public enum BasicEnum {
15 15 CHARGE_ITEM_GROUP("CHARGE_ITEM_GROUP"),
16 16 CUSTOMER("CUSTOMER"),
17 17 FINANCIAL_CHANNEL_TYPE("FINANCIAL_CHANNEL_TYPE"),
18   - FINANCIAL_BUSINESS_TYPE("FINANCIAL_BUSINESS_TYPE");
  18 + FINANCIAL_BUSINESS_TYPE("FINANCIAL_BUSINESS_TYPE"),
  19 + DEPARTMENT_TO_LOWER("department"),
  20 + CHARGE_ITEM_TO_LOWER("charge_item"),
  21 + CHARGE_ITEM_GROUP_TO_LOWER("charge_item_group"),
  22 + CUSTOMER_TO_LOWER("customer"),
  23 + FINANCIAL_CHANNEL_TYPE_TO_LOWER("financial_channel_type"),
  24 + FINANCIAL_BUSINESS_TYPE_TO_LOWER("financial_business_type");
19 25 public final String code;
20 26  
21 27  
22 28 BasicEnum(String code) {
23 29 this.code = code;
24   -
25 30 }
26 31 }
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/type/DynamicType.java 0 → 100644
  1 +package com.diligrp.etrade.thirdparty.type;
  2 +
  3 +import com.diligrp.etrade.thirdparty.error.ThirdPartyException;
  4 +
  5 +/**
  6 + * @Author: zhangmeiyang
  7 + * @CreateTime: 2024-10-28 12:33
  8 + * @Version: todo
  9 + */
  10 +public enum DynamicType {
  11 + JMSF_ITEM_CHARGE("JMSF_ITEM_CHARGE"),
  12 + JMSF_ITEM_WEIGHT("JMSF_ITEM_WEIGHT"),
  13 + COLD("506"),
  14 + CARD("CARD"),
  15 + ENTIRE_TENANCY("1"),
  16 + SUBLET("4"),
  17 + ACCOMMODATION("5"),
  18 + BAIL("3"),
  19 + EARNEST("2"),
  20 + OTHER_CHARGES("10"),
  21 + TRADE("5502"),
  22 + REFUND("5503");
  23 + public final String code;
  24 +
  25 + DynamicType(String code) {
  26 + this.code = code;
  27 + }
  28 +
  29 + public static DynamicType fromCode(String code) {
  30 + for (DynamicType type : values()) {
  31 + if (type.code.equals(code)) {
  32 + return type;
  33 + }
  34 + }
  35 + throw new ThirdPartyException("业务类型匹配错误");
  36 + }
  37 +}
... ...
etrade-thirdparty/src/main/java/com/diligrp/etrade/thirdparty/utils/PurchaseOrderApiUtils.java
... ... @@ -29,17 +29,18 @@ public class PurchaseOrderApiUtils extends BaseApiUtils {
29 29 }
30 30  
31 31  
32   - public void createOnePurchaseOrder(String json) throws Exception {
  32 + public void createOnePurchaseOrder(String json,String formId) throws Exception {
33 33 Map<String, Object> map = JsonUtils.fromJsonString(json, new TypeReference<>() {
34 34 });
35 35 var message = new GeneralSendMessage();
36 36 message.setModel(map);
37 37 message.setAutoSubmitAndAudit(true);
38   - save(JsonUtils.toJsonString(message));
  38 +// save(JsonUtils.toJsonString(message));
  39 + System.out.println(JsonUtils.toJsonString(message));
39 40 }
40 41  
41   - private void save(String json) throws Exception {
42   - String res = api.save("PUR_PurchaseOrder", json);
  42 + private void save(String json,String formId) throws Exception {
  43 + String res = api.save(formId, json);
43 44 RepoRet repoRet = JsonUtils.fromJsonString(res, new TypeReference<>() {});
44 45 if (!repoRet.getResult().getResponseStatus().isIsSuccess()) {
45 46 ThirdPartyErrorCodeEnum errorCodeEnum = ThirdPartyErrorCodeEnum.getByCode(repoRet.getResult().getResponseStatus().getErrorCode());
... ...
etrade-thirdparty/src/main/resources/com/diligrp/etrade/thirdparty/mapper/TransMapper.xml
... ... @@ -16,10 +16,10 @@
16 16 AND market_id = #{marketId}
17 17 AND system_code = #{systemCode}
18 18 </select>
19   - <select id="getDynamicParam" resultType="com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto">
  19 + <select id="getFixedWithQueryArrays" resultType="com.diligrp.etrade.thirdparty.domain.dto.BusinessDetailDto">
20 20 SELECT
21   - fb.code AS code
22   - , fb.name AS name
  21 + fbd.code AS code
  22 + , fbd.name AS name
23 23 , fbd.select_type AS selectType
24 24 , fbd.item_code AS itemCode
25 25 , fbd.item_name AS itemName
... ... @@ -33,6 +33,11 @@
33 33 AND fb.market_id = #{marketId}
34 34 AND fb.code = #{code}
35 35 AND fb.system_code = #{systemCode}
  36 + AND fbd.select_type = #{selectType}
  37 + AND fbd.code IN
  38 + <foreach item="item" index="index" collection="basicCodes" open="(" separator="," close=")">
  39 + #{item}
  40 + </foreach>
36 41 </select>
37 42 <select id="getDepartment" resultType="com.diligrp.etrade.thirdparty.domain.dto.DepartmentDto">
38 43 SELECT
... ... @@ -92,4 +97,22 @@
92 97 AND business = #{mapping.business}
93 98 AND system_data_id = #{mapping.systemDataId}
94 99 </select>
  100 + <select id="getMappingDict" resultType="com.diligrp.etrade.thirdparty.domain.dto.FinancialDictMappingDto">
  101 + SELECT
  102 + `dict_id` AS `dictId`
  103 + , `dict_code` AS `dictCode`
  104 + , `dict_dd_code` AS `dictDdCode`
  105 + , `dict_name` AS `dictName`
  106 + , `map_type` AS `mapType`
  107 + , `map_category` AS `mapCategory`
  108 + , `market_id` AS `marketId`
  109 + , `system_code` AS `systemCode`
  110 + FROM
  111 + `dili-basic-data`.`financial_dict_mapping`
  112 + WHERE
  113 + 1 = 1
  114 + AND market_id = #{marketId}
  115 + AND system_code = #{systemCode}
  116 + AND dict_code = #{billTypeId}
  117 + </select>
95 118 </mapper>
... ...