From 74e0f8ae384d9000f3115a5fac021d3e7d5caa4a Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Mon, 17 Jun 2024 15:11:32 +0800 Subject: [PATCH 01/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0cbs8=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E5=9B=9E=E5=8D=95=E4=B8=8B=E8=BD=BD=E4=B8=B4=E6=97=B6=E5=AD=98?= =?UTF-8?q?=E6=94=BE=E6=96=87=E4=BB=B6=E5=A4=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildpackage/src/main/resources/application-yc.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildpackage/src/main/resources/application-yc.yml b/buildpackage/src/main/resources/application-yc.yml index eeea3364..8c5ff607 100644 --- a/buildpackage/src/main/resources/application-yc.yml +++ b/buildpackage/src/main/resources/application-yc.yml @@ -54,4 +54,6 @@ cbs8: # 这个私钥到时候上传到cbs,和下面到是同一对 #ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46 ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde - cbs_public_key: 0469146F06BF3B01236E84632441E826 \ No newline at end of file + cbs_public_key: 0469146F06BF3B01236E84632441E826 + #电子回单下载临时存放位置 + elec_path: /Users/xiangerlin/Downloads/ \ No newline at end of file From df4f4f584bed379f2a8e0f62fa7f9fa7bfcf9ea2 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 09:15:01 +0800 Subject: [PATCH 02/12] =?UTF-8?q?=E7=94=B5=E5=AD=90=E5=9B=9E=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/ElecBillPluginInitializer.java | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/ElecBillPluginInitializer.java diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/ElecBillPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/ElecBillPluginInitializer.java new file mode 100644 index 00000000..685cef93 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/ElecBillPluginInitializer.java @@ -0,0 +1,101 @@ +package com.hzya.frame.plugin.cbs8.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description 电子回单定时任务 + * @Author xiangerlin + * @Date 2024/6/17 14:03 + **/ +public class ElecBillPluginInitializer extends PluginBaseEntity { + + Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired + private ICbsPluginService cbsPluginService; + /*** + * 插件初始化方法 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 10:48 + * @Param [] + * @return void + **/ + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + /**** + * 插件销毁方法 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + /**** + * 插件的ID + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginId() { + return "CBS8ElecBillPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "cbs8电子回单插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "cbs8电子回单插件"; + } + + /*** + * 插件类型 1、场景插件 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 14:01 + * @Param [] + * @return java.lang.String + **/ + @Override + public String getPluginType() { + return "1"; + } + + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 执行业务代码的参数 + * @return void + **/ + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + cbsPluginService.elecBillUpload(requestJson); + return null; + } +} From 347eb4e89faebe02bbf52536633f01bdb352f7dd Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 09:15:50 +0800 Subject: [PATCH 03/12] =?UTF-8?q?=E4=BA=A4=E6=98=93=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TransactionDetailPluginInitializer.java | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java new file mode 100644 index 00000000..264984f7 --- /dev/null +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java @@ -0,0 +1,107 @@ +package com.hzya.frame.plugin.cbs8.plugin; + +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.base.PluginBaseEntity; +import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.util.CBSUtil; +import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; +import com.hzya.frame.web.entity.JsonResultEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; + +/** + * @Description 交易明细查询 + * @Author xiangerlin + * @Date 2024/6/17 16:03 + **/ +public class TransactionDetailPluginInitializer extends PluginBaseEntity { + Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private ICbsPluginService cbsPluginService; + + /*** + * 插件初始化方法 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 10:48 + * @Param [] + * @return void + **/ + @Override + public void initialize() { + logger.info(getPluginLabel() + "執行初始化方法initialize()"); + } + + /**** + * 插件销毁方法 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public void destroy() { + logger.info(getPluginLabel() + "執行銷毀方法destroy()"); + } + + /**** + * 插件的ID + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginId() { + return "CBS8TransactionDetailQueryPlugin"; + } + + /**** + * 插件的名称 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginName() { + return "cbs8交易明细查询插件"; + } + + /**** + * 插件的显示值 + * @author 👻👻👻👻👻👻👻👻 gjh + * @date 2023-08-02 10:48 + * @return void + **/ + @Override + public String getPluginLabel() { + return "cbs8交易明细查询插件"; + } + + /*** + * 插件类型 1、场景插件 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-02 14:01 + * @Param [] + * @return java.lang.String + **/ + @Override + public String getPluginType() { + return "1"; + } + + /*** + * 执行业务代码 + * @Author 👻👻👻👻👻👻👻👻 gjh + * @Date 2023-08-07 11:20 + * @param requestJson 执行业务代码的参数 + * @return void + **/ + @Override + public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception { + TransactionDetailReqDTO transactionDetailReqDTO = new TransactionDetailReqDTO(); + transactionDetailReqDTO.setCurrentPage(CBSUtil.DEFAULT_CURRENT_PAGE); + transactionDetailReqDTO.setPageSize(CBSUtil.DEFAULT_PAGE_SIZE); + cbsPluginService.queryTransactionDetail(transactionDetailReqDTO); + return null; + } +} From 29c560bcfecdb8f67e61fc28f5d26303fe5054f4 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 09:16:47 +0800 Subject: [PATCH 04/12] cbs8 --- .../plugin/PayApplyPluginInitializer.java | 12 --- .../TransactionDetailPluginInitializer.java | 5 +- .../cbs8/service/ICbsPluginService.java | 18 ++++ .../service/impl/CbsPluginServiceImpl.java | 98 ++++++++++++++++++- 4 files changed, 118 insertions(+), 15 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java index 93012623..65c4ac12 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/PayApplyPluginInitializer.java @@ -1,25 +1,13 @@ package com.hzya.frame.plugin.cbs8.plugin; -import cn.hutool.core.map.MapBuilder; -import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; -import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; -import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity; -import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; -import com.hzya.frame.seeyon.cbs8.service.ICbsLogService; -import com.hzya.frame.seeyon.cbs8.service.IPaymentService; import com.hzya.frame.web.entity.JsonResultEntity; -import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - /** * @Description 经办支付申请 * @Author xiangerlin diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java index 264984f7..e65b75dc 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/plugin/TransactionDetailPluginInitializer.java @@ -3,6 +3,7 @@ package com.hzya.frame.plugin.cbs8.plugin; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.base.PluginBaseEntity; import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.res.TransactionDetailDTO; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; import com.hzya.frame.web.entity.JsonResultEntity; @@ -10,6 +11,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import java.util.List; + /** * @Description 交易明细查询 * @Author xiangerlin @@ -101,7 +104,7 @@ public class TransactionDetailPluginInitializer extends PluginBaseEntity { TransactionDetailReqDTO transactionDetailReqDTO = new TransactionDetailReqDTO(); transactionDetailReqDTO.setCurrentPage(CBSUtil.DEFAULT_CURRENT_PAGE); transactionDetailReqDTO.setPageSize(CBSUtil.DEFAULT_PAGE_SIZE); - cbsPluginService.queryTransactionDetail(transactionDetailReqDTO); + List transactionDetailList = cbsPluginService.queryTransactionDetail(transactionDetailReqDTO); return null; } } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java index e6497480..f4491c0a 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/ICbsPluginService.java @@ -1,6 +1,10 @@ package com.hzya.frame.plugin.cbs8.service; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.res.TransactionDetailDTO; + +import java.util.List; /** * @Description @@ -21,4 +25,18 @@ public interface ICbsPluginService { * @throws Exception */ void queryResult(JSONObject requestJson)throws Exception; + + /** + * 电子回单查询 并上传OA + * @param requestJson + * @throws Exception + */ + void elecBillUpload(JSONObject requestJson)throws Exception; + + /** + * 查询交易明细 + * transactionDetailReqDTO.currentPage 、 transactionDetailReqDTO.pageSize 必填 + * @param transactionDetailReqDTO + */ + List queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO); } diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java index a4b02f1e..57f488da 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java @@ -1,10 +1,15 @@ package com.hzya.frame.plugin.cbs8.service.impl; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.res.PayResponseDTO; -import com.hzya.frame.cbs8.dto.res.PayResultResDTO; +import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.PayState; @@ -14,11 +19,18 @@ import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.service.ICbsLogService; import com.hzya.frame.seeyon.cbs8.service.IPaymentService; +import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; +import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; +import com.hzya.frame.seeyon.service.ICtpAttachmentService; +import com.hzya.frame.seeyon.util.RestUtil; +import com.hzya.frame.uuid.UUIDLong; import org.apache.commons.collections.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import java.io.File; import java.util.ArrayList; import java.util.List; @@ -36,7 +48,11 @@ public class CbsPluginServiceImpl implements ICbsPluginService { private IPaymentService paymentService; @Autowired private ICbsLogService cbsLogService; + @Autowired + private ICtpAttachmentService ctpAttachmentService; + @Value("${cbs8.elec_path}") + private String elec_path; /** * 支付申请 * @@ -131,4 +147,82 @@ public class CbsPluginServiceImpl implements ICbsPluginService { } } } + + /** + * 电子回单查询 并上传OA + * + * @param requestJson + * @throws Exception + */ + @Override + public void elecBillUpload(JSONObject requestJson) throws Exception { + //查询支付成功 没有电子回单的数据 + PaymentEntity paymentEntity = new PaymentEntity(); + List paymentList = paymentService.queryElecIsNull(paymentEntity); + if (CollectionUtils.isNotEmpty(paymentList)) { + for (PaymentEntity pay : paymentList) { + String payDate = DateUtil.format(DateUtil.parse(pay.getPayDate()), "yyyy-MM-dd"); + //查询cbs电子回单 + List elecResList = cbs8Service.queryElecBill(new ElecRequestDTO(payDate,DateUtil.today(),pay.getReferenceNum())); + if (CollectionUtils.isNotEmpty(elecResList)){ + ElecResponseDTO elecResponseDTO = elecResList.get(0); + String bucketFileUrl = elecResponseDTO.getBucketFileUrl(); + String bucketFileName = elecResponseDTO.getBucketFileName(); + //上传电子回单到OA + HttpUtil.downloadFile(bucketFileUrl, FileUtil.file(elec_path));//附件下载 + String pdfUrl = elec_path + bucketFileName; + File file = new File(pdfUrl); + if (file.exists()) { + JSONObject jsonObjectUpload = RestUtil.fileUpload(file); + String file_url = jsonObjectUpload.getString("fileUrl"); + if (null != jsonObjectUpload && StrUtil.isNotEmpty(file_url)) { + String sub_reference = String.valueOf(UUIDLong.longUUID()); + pay.setReceipt(sub_reference); + //更新表单的电子回单值 + paymentService.updateElec(pay); + //保存附件关系 + CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); + ctpAttachmentEntity.setFile_url(file_url); + ctpAttachmentService.saveAttachment(file_url, pay.getSummaryId(), sub_reference); + } + //删除本地临时文件 + file.delete(); + } + } + } + } + } + + /** + * 查询交易明细 + * transactionDetailReqDTO.currentPage 、 transactionDetailReqDTO.pageSize 必填 + * @param transactionDetailReqDTO + */ + @Override + public List queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO) { + boolean hasNextPage = true;//是否有下一页 + int currentPage = transactionDetailReqDTO.getCurrentPage(); + int pageSize = transactionDetailReqDTO.getPageSize(); + if (currentPage == 0){ + currentPage = CBSUtil.DEFAULT_CURRENT_PAGE;//页码 + } + if (pageSize == 0){ + pageSize = CBSUtil.DEFAULT_PAGE_SIZE;//每页条数 + transactionDetailReqDTO.setPageSize(pageSize); + } + List resultList = new ArrayList<>(); + do{ + transactionDetailReqDTO.setCurrentPage(currentPage);//页码 + currentPage++;//页码自增 + hasNextPage = false;//保护功能,防止出现死循环 + CbsResDataDTO dataDTO = cbs8Service.queryTransactionDetail(transactionDetailReqDTO); + if (null != dataDTO){ + hasNextPage = dataDTO.getHasNextPage(); + List transactionDetailDTOList = CBSUtil.convertJsonArrayToList(dataDTO.getList(), TransactionDetailDTO.class); + resultList.addAll(transactionDetailDTOList); + } + }while (hasNextPage); + + return resultList; + } } From 444e03451109acff00e5cd5048d39b38bd14b1f9 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 09:17:01 +0800 Subject: [PATCH 05/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=B5=E5=AD=90?= =?UTF-8?q?=E5=9B=9E=E5=8D=95=E3=80=81=E4=BA=A4=E6=98=93=E6=98=8E=E7=BB=86?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cfgHome/plugin/cbs8/spring/spring-buildpackage-plugin.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/buildpackage/src/main/resources/cfgHome/plugin/cbs8/spring/spring-buildpackage-plugin.xml b/buildpackage/src/main/resources/cfgHome/plugin/cbs8/spring/spring-buildpackage-plugin.xml index 8970b941..4f977b6f 100644 --- a/buildpackage/src/main/resources/cfgHome/plugin/cbs8/spring/spring-buildpackage-plugin.xml +++ b/buildpackage/src/main/resources/cfgHome/plugin/cbs8/spring/spring-buildpackage-plugin.xml @@ -3,4 +3,6 @@ + + From 6af94ef32ce570098336cba695382ad10f38b150 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 09:17:34 +0800 Subject: [PATCH 06/12] =?UTF-8?q?cbs8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frame/cbs8/dto/req/ElecRequestDTO.java | 134 +++++ .../cbs8/dto/req/TransactionDetailReqDTO.java | 164 +++++++ .../frame/cbs8/dto/res/CbsResDataDTO.java | 458 ++++++++++++++++++ .../frame/cbs8/dto/res/ElecResponseDTO.java | 305 ++++++++++++ .../cbs8/dto/res/TransactionDetailDTO.java | 207 ++++++++ .../frame/cbs8/service/ICbs8ExtService.java | 12 +- .../hzya/frame/cbs8/service/ICbs8Service.java | 26 +- .../cbs8/service/impl/Cbs8ExtServiceImpl.java | 69 ++- .../cbs8/service/impl/Cbs8ServiceImpl.java | 104 +++- 9 files changed, 1461 insertions(+), 18 deletions(-) create mode 100644 service/src/main/java/com/hzya/frame/cbs8/dto/req/ElecRequestDTO.java create mode 100644 service/src/main/java/com/hzya/frame/cbs8/dto/req/TransactionDetailReqDTO.java create mode 100644 service/src/main/java/com/hzya/frame/cbs8/dto/res/CbsResDataDTO.java create mode 100644 service/src/main/java/com/hzya/frame/cbs8/dto/res/ElecResponseDTO.java create mode 100644 service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/req/ElecRequestDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/req/ElecRequestDTO.java new file mode 100644 index 00000000..f318d279 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/req/ElecRequestDTO.java @@ -0,0 +1,134 @@ +package com.hzya.frame.cbs8.dto.req; + +import java.util.List; + +/** + * @Description 电子回单查询请求参数 + * @Author xiangerlin + * @Date 2024/1/4 17:08 + **/ +public class ElecRequestDTO { + // 开始日期 + private String startDate; + + // 结束日期 + private String endDate; + + // 账号 + private String accountNo; + + // 币种列表 + private List currencyList; + + // 银行类型列表 + private List bankTypeList; + + // 回单文件状态 1-已取回 0-未取回 + private String billStatus; + + // 借贷 1-借 2-贷 + private String loanType; + + // 单位编码列表 + private List unitCodeList; + + // 对账码列表 + private List checkCodeList; + + // ERP业务参考号 + private String settleBusinessReferenceCode; + + public ElecRequestDTO(String settleBusinessReferenceCode) { + this.settleBusinessReferenceCode = settleBusinessReferenceCode; + } + + public ElecRequestDTO(String startDate, String endDate, String settleBusinessReferenceCode) { + this.startDate = startDate; + this.endDate = endDate; + this.settleBusinessReferenceCode = settleBusinessReferenceCode; + } + + public ElecRequestDTO() { + + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public List getCurrencyList() { + return currencyList; + } + + public void setCurrencyList(List currencyList) { + this.currencyList = currencyList; + } + + public List getBankTypeList() { + return bankTypeList; + } + + public void setBankTypeList(List bankTypeList) { + this.bankTypeList = bankTypeList; + } + + public String getBillStatus() { + return billStatus; + } + + public void setBillStatus(String billStatus) { + this.billStatus = billStatus; + } + + public String getLoanType() { + return loanType; + } + + public void setLoanType(String loanType) { + this.loanType = loanType; + } + + public List getUnitCodeList() { + return unitCodeList; + } + + public void setUnitCodeList(List unitCodeList) { + this.unitCodeList = unitCodeList; + } + + public List getCheckCodeList() { + return checkCodeList; + } + + public void setCheckCodeList(List checkCodeList) { + this.checkCodeList = checkCodeList; + } + + public String getSettleBusinessReferenceCode() { + return settleBusinessReferenceCode; + } + + public void setSettleBusinessReferenceCode(String settleBusinessReferenceCode) { + this.settleBusinessReferenceCode = settleBusinessReferenceCode; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/req/TransactionDetailReqDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/req/TransactionDetailReqDTO.java new file mode 100644 index 00000000..26f5f4bf --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/req/TransactionDetailReqDTO.java @@ -0,0 +1,164 @@ +package com.hzya.frame.cbs8.dto.req; + +import java.util.List; + +/** + * @Description 查询境内交易明细参数 + * @Author xiangerlin + * @Date 2024/1/3 09:55 + **/ +public class TransactionDetailReqDTO { + private int currentPage;//当前页码 从1开始 + private int pageSize;//本次查询的记录数,最大1000条 + private String startDate;//开始日期 + private String endDate;//结束日期 + private String dateType;//日期类型0:交易日期,1:起息日期 + private List accountNoList;//账户列表 + private List bankTypeList;//银行类型列表 + private List currencyList;//币种列表 + private String detailedSources;//明细来源 + private String currentFlag;//明细类型 + private String loanType;//借贷类型 1:借 2:贷 + private List accountNatureList;//账户性质列表 + private String bankSerialNumber;//银行流水号 + private String transactionSerialNumber;//交易流水号 + private List unitCodeList ;//单位编码列表 + private String erpSerialNumber ;//erp业务参考号 + + public TransactionDetailReqDTO() { + + } + + public TransactionDetailReqDTO(String startDate, String endDate) { + this.startDate = startDate; + this.endDate = endDate; + } + + public String getStartDate() { + return startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } + + public String getEndDate() { + return endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public String getDateType() { + return dateType; + } + + public void setDateType(String dateType) { + this.dateType = dateType; + } + + public List getAccountNoList() { + return accountNoList; + } + + public void setAccountNoList(List accountNoList) { + this.accountNoList = accountNoList; + } + + public List getBankTypeList() { + return bankTypeList; + } + + public void setBankTypeList(List bankTypeList) { + this.bankTypeList = bankTypeList; + } + + public List getCurrencyList() { + return currencyList; + } + + public void setCurrencyList(List currencyList) { + this.currencyList = currencyList; + } + + public String getDetailedSources() { + return detailedSources; + } + + public void setDetailedSources(String detailedSources) { + this.detailedSources = detailedSources; + } + + public String getCurrentFlag() { + return currentFlag; + } + + public void setCurrentFlag(String currentFlag) { + this.currentFlag = currentFlag; + } + + public String getLoanType() { + return loanType; + } + + public void setLoanType(String loanType) { + this.loanType = loanType; + } + + public List getAccountNatureList() { + return accountNatureList; + } + + public void setAccountNatureList(List accountNatureList) { + this.accountNatureList = accountNatureList; + } + + public String getBankSerialNumber() { + return bankSerialNumber; + } + + public void setBankSerialNumber(String bankSerialNumber) { + this.bankSerialNumber = bankSerialNumber; + } + + public String getTransactionSerialNumber() { + return transactionSerialNumber; + } + + public void setTransactionSerialNumber(String transactionSerialNumber) { + this.transactionSerialNumber = transactionSerialNumber; + } + + public List getUnitCodeList() { + return unitCodeList; + } + + public void setUnitCodeList(List unitCodeList) { + this.unitCodeList = unitCodeList; + } + + public String getErpSerialNumber() { + return erpSerialNumber; + } + + public void setErpSerialNumber(String erpSerialNumber) { + this.erpSerialNumber = erpSerialNumber; + } + + public int getCurrentPage() { + return currentPage; + } + + public void setCurrentPage(int currentPage) { + this.currentPage = currentPage; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/CbsResDataDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/CbsResDataDTO.java new file mode 100644 index 00000000..0bb30dc8 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/CbsResDataDTO.java @@ -0,0 +1,458 @@ +package com.hzya.frame.cbs8.dto.res; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.annotation.JSONField; + +import java.util.List; + +/** + * @Description data节点 + * @Author xiangerlin + * @Date 2024/1/2 09:26 + **/ +public class CbsResDataDTO { + + + private List list;//明细数据 + //------- 交易明细字段----- + private int endRow; + private Boolean hasNextPage;//是否有下一页 + private Boolean hasPreviousPage;//是否有前一页 + @JSONField(name = "isFirstPage") + private Boolean hasFirstPage; + @JSONField(name = "isLastPage") + private Boolean hasLastPage; + private int navigateFirstPage; + private int navigateLastPage; + private int navigatePages; + private int nextPage; + private int pageNum; + private int pageSize; + private int pages; + private int prePage; + private int size; + private int startRow; + private int total; + //------- 交易明细字段----- + + //------经办支付返回参数------ + private String busNum;//申请单编号 + private String errorCode;//错误编码 + private String errorMsg;//错误信息 + private String freezeFlowNum;//内部户冻结流水号 + private String recordNum;//批量经办序号 + private String referenceNum;//业务参考号 + private Boolean successed;//是否成功 + //------经办支付返回参数------ + + + //------查询交易结果返回参数------- + + private String busType;//支付业务类型 + private String payAccount;//付款账号 + private String payAccountName;//付款户名 + private String payBankName;//付款开户行名称 + private String payBankType;//付款银行类型 + private String currency;//币种 + private String amount;//金额 + private String revAccount;//收款账户 + private String revAccountName;//收款账户名 + private String revBankName;//收款开户行 + private String revBankType;//收款银行类型 + private String payChannel;//支付渠道 + + private String status;//支付申请单状态 + private String payStatus;//支付状态 + private String payDate;//支付时间 + private String planNumber;//计划流水号 + private String planItemCode;//资金预算编号 + private String planItemName;//预算名称 + private String erpExtend1;//客户备用字段1 + private String erpExtend2;//客户备用字段1 + private String erpExtend3;//客户备用字段1 + + //------查询交易结果返回参数------- + + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + + public int getEndRow() { + return endRow; + } + + public void setEndRow(int endRow) { + this.endRow = endRow; + } + + public Boolean getHasNextPage() { + return hasNextPage; + } + + public void setHasNextPage(Boolean hasNextPage) { + this.hasNextPage = hasNextPage; + } + + public Boolean getHasPreviousPage() { + return hasPreviousPage; + } + + public void setHasPreviousPage(Boolean hasPreviousPage) { + this.hasPreviousPage = hasPreviousPage; + } + + public Boolean getHasFirstPage() { + return hasFirstPage; + } + + public void setHasFirstPage(Boolean hasFirstPage) { + this.hasFirstPage = hasFirstPage; + } + + public Boolean getHasLastPage() { + return hasLastPage; + } + + public void setHasLastPage(Boolean hasLastPage) { + this.hasLastPage = hasLastPage; + } + + public int getNavigateFirstPage() { + return navigateFirstPage; + } + + public void setNavigateFirstPage(int navigateFirstPage) { + this.navigateFirstPage = navigateFirstPage; + } + + public int getNavigateLastPage() { + return navigateLastPage; + } + + public void setNavigateLastPage(int navigateLastPage) { + this.navigateLastPage = navigateLastPage; + } + + public int getNavigatePages() { + return navigatePages; + } + + public void setNavigatePages(int navigatePages) { + this.navigatePages = navigatePages; + } + + public int getNextPage() { + return nextPage; + } + + public void setNextPage(int nextPage) { + this.nextPage = nextPage; + } + + public int getPageNum() { + return pageNum; + } + + public void setPageNum(int pageNum) { + this.pageNum = pageNum; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getPages() { + return pages; + } + + public void setPages(int pages) { + this.pages = pages; + } + + public int getPrePage() { + return prePage; + } + + public void setPrePage(int prePage) { + this.prePage = prePage; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int getStartRow() { + return startRow; + } + + public void setStartRow(int startRow) { + this.startRow = startRow; + } + + public int getTotal() { + return total; + } + + public void setTotal(int total) { + this.total = total; + } + + public String getBusNum() { + return busNum; + } + + public void setBusNum(String busNum) { + this.busNum = busNum; + } + + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public String getFreezeFlowNum() { + return freezeFlowNum; + } + + public void setFreezeFlowNum(String freezeFlowNum) { + this.freezeFlowNum = freezeFlowNum; + } + + public String getRecordNum() { + return recordNum; + } + + public void setRecordNum(String recordNum) { + this.recordNum = recordNum; + } + + public String getReferenceNum() { + return referenceNum; + } + + public void setReferenceNum(String referenceNum) { + this.referenceNum = referenceNum; + } + + public Boolean getSuccessed() { + return successed; + } + + public void setSuccessed(Boolean successed) { + this.successed = successed; + } + + public String getBusType() { + return busType; + } + + public void setBusType(String busType) { + this.busType = busType; + } + + public String getPayAccount() { + return payAccount; + } + + public void setPayAccount(String payAccount) { + this.payAccount = payAccount; + } + + public String getPayAccountName() { + return payAccountName; + } + + public void setPayAccountName(String payAccountName) { + this.payAccountName = payAccountName; + } + + public String getPayBankName() { + return payBankName; + } + + public void setPayBankName(String payBankName) { + this.payBankName = payBankName; + } + + public String getPayBankType() { + return payBankType; + } + + public void setPayBankType(String payBankType) { + this.payBankType = payBankType; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getRevAccount() { + return revAccount; + } + + public void setRevAccount(String revAccount) { + this.revAccount = revAccount; + } + + public String getRevAccountName() { + return revAccountName; + } + + public void setRevAccountName(String revAccountName) { + this.revAccountName = revAccountName; + } + + public String getRevBankName() { + return revBankName; + } + + public void setRevBankName(String revBankName) { + this.revBankName = revBankName; + } + + public String getRevBankType() { + return revBankType; + } + + public void setRevBankType(String revBankType) { + this.revBankType = revBankType; + } + + public String getPayChannel() { + return payChannel; + } + + public void setPayChannel(String payChannel) { + this.payChannel = payChannel; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getPayStatus() { + return payStatus; + } + + public void setPayStatus(String payStatus) { + this.payStatus = payStatus; + } + + public String getPayDate() { + return payDate; + } + + public void setPayDate(String payDate) { + this.payDate = payDate; + } + + public String getPlanNumber() { + return planNumber; + } + + public void setPlanNumber(String planNumber) { + this.planNumber = planNumber; + } + + public String getPlanItemCode() { + return planItemCode; + } + + public void setPlanItemCode(String planItemCode) { + this.planItemCode = planItemCode; + } + + public String getPlanItemName() { + return planItemName; + } + + public void setPlanItemName(String planItemName) { + this.planItemName = planItemName; + } + + public String getErpExtend1() { + return erpExtend1; + } + + public void setErpExtend1(String erpExtend1) { + this.erpExtend1 = erpExtend1; + } + + public String getErpExtend2() { + return erpExtend2; + } + + public void setErpExtend2(String erpExtend2) { + this.erpExtend2 = erpExtend2; + } + + public String getErpExtend3() { + return erpExtend3; + } + + public void setErpExtend3(String erpExtend3) { + this.erpExtend3 = erpExtend3; + } + + /** + * 把json字符串转换成指定范型的list + * @param json + * @param list + * @param clazz + * @param + */ + private static void adaptAndAddToList(String json, List list, Class clazz) { + JSONObject jsonObject = JSON.parseObject(json); + + if (jsonObject.containsKey("list")) { + JSONArray listArray = jsonObject.getJSONArray("list"); + for (Object item : listArray) { + JSONObject itemObject = (JSONObject) item; + // 适配不同类型的节点 + list.add(JSON.toJavaObject(itemObject, clazz)); + } + } + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/ElecResponseDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/ElecResponseDTO.java new file mode 100644 index 00000000..6e77d30a --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/ElecResponseDTO.java @@ -0,0 +1,305 @@ +package com.hzya.frame.cbs8.dto.res; + +/** + * @Description 电子回单查询返回参数 + * @Author xiangerlin + * @Date 2024/1/4 17:13 + **/ +public class ElecResponseDTO { + + // 账号 + private String accountNo; + + // 账号名称 + private String accountName; + + // 银行类型 + private String bankType; + + // 银行类型名称 + private String bankTypeName; + + // 开户行 + private String openingBank; + + // 交易日期 + private String transactionDate; + + // 电子回单文件状态 + private String electronicBillStatus; + + // 电子回单文件名称 + private String billFileName; + + // 回单文件下载地址 + private String bucketFileUrl; + + // 回单文件名称 + private String bucketFileName; + + // 回单类型 + private String electronicBillType; + + // 银行流水号 + private String bankSerialNumber; + + // 回单编号 + private String printInstanceNumber; + + // 币种 + private String currency; + + // 币种名称 + private String currencyName; + + // 借贷类型 + private String loanType; + + // 交易金额 + private String transactionAmount; + + // 对方账号 + private String oppositeAccount; + + // 对方账户名 + private String oppositeAccountName; + + // 对方开户地 + private String oppositeOpeningPlace; + + // 对方开户行 + private String oppositeOpeningBank; + + // 摘要 + private String digest; + + // 用途 + private String purpose; + + // 账户性质 + private String accountNatureCode; + + // 对账码 + private String checkCode; + + // 单位编码 + private String unitCode; + + // ERP业务参考号 + private String settleBusinessReferenceCode; + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getBankTypeName() { + return bankTypeName; + } + + public void setBankTypeName(String bankTypeName) { + this.bankTypeName = bankTypeName; + } + + public String getOpeningBank() { + return openingBank; + } + + public void setOpeningBank(String openingBank) { + this.openingBank = openingBank; + } + + public String getTransactionDate() { + return transactionDate; + } + + public void setTransactionDate(String transactionDate) { + this.transactionDate = transactionDate; + } + + public String getElectronicBillStatus() { + return electronicBillStatus; + } + + public void setElectronicBillStatus(String electronicBillStatus) { + this.electronicBillStatus = electronicBillStatus; + } + + public String getBillFileName() { + return billFileName; + } + + public void setBillFileName(String billFileName) { + this.billFileName = billFileName; + } + + public String getBucketFileUrl() { + return bucketFileUrl; + } + + public void setBucketFileUrl(String bucketFileUrl) { + this.bucketFileUrl = bucketFileUrl; + } + + public String getBucketFileName() { + return bucketFileName; + } + + public void setBucketFileName(String bucketFileName) { + this.bucketFileName = bucketFileName; + } + + public String getElectronicBillType() { + return electronicBillType; + } + + public void setElectronicBillType(String electronicBillType) { + this.electronicBillType = electronicBillType; + } + + public String getBankSerialNumber() { + return bankSerialNumber; + } + + public void setBankSerialNumber(String bankSerialNumber) { + this.bankSerialNumber = bankSerialNumber; + } + + public String getPrintInstanceNumber() { + return printInstanceNumber; + } + + public void setPrintInstanceNumber(String printInstanceNumber) { + this.printInstanceNumber = printInstanceNumber; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getCurrencyName() { + return currencyName; + } + + public void setCurrencyName(String currencyName) { + this.currencyName = currencyName; + } + + public String getLoanType() { + return loanType; + } + + public void setLoanType(String loanType) { + this.loanType = loanType; + } + + public String getTransactionAmount() { + return transactionAmount; + } + + public void setTransactionAmount(String transactionAmount) { + this.transactionAmount = transactionAmount; + } + + public String getOppositeAccount() { + return oppositeAccount; + } + + public void setOppositeAccount(String oppositeAccount) { + this.oppositeAccount = oppositeAccount; + } + + public String getOppositeAccountName() { + return oppositeAccountName; + } + + public void setOppositeAccountName(String oppositeAccountName) { + this.oppositeAccountName = oppositeAccountName; + } + + public String getOppositeOpeningPlace() { + return oppositeOpeningPlace; + } + + public void setOppositeOpeningPlace(String oppositeOpeningPlace) { + this.oppositeOpeningPlace = oppositeOpeningPlace; + } + + public String getOppositeOpeningBank() { + return oppositeOpeningBank; + } + + public void setOppositeOpeningBank(String oppositeOpeningBank) { + this.oppositeOpeningBank = oppositeOpeningBank; + } + + public String getDigest() { + return digest; + } + + public void setDigest(String digest) { + this.digest = digest; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getAccountNatureCode() { + return accountNatureCode; + } + + public void setAccountNatureCode(String accountNatureCode) { + this.accountNatureCode = accountNatureCode; + } + + public String getCheckCode() { + return checkCode; + } + + public void setCheckCode(String checkCode) { + this.checkCode = checkCode; + } + + public String getUnitCode() { + return unitCode; + } + + public void setUnitCode(String unitCode) { + this.unitCode = unitCode; + } + + public String getSettleBusinessReferenceCode() { + return settleBusinessReferenceCode; + } + + public void setSettleBusinessReferenceCode(String settleBusinessReferenceCode) { + this.settleBusinessReferenceCode = settleBusinessReferenceCode; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java new file mode 100644 index 00000000..b51a41fa --- /dev/null +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/TransactionDetailDTO.java @@ -0,0 +1,207 @@ +package com.hzya.frame.cbs8.dto.res; + +/** + * @Description 境内账户交易明细 + * @Author xiangerlin + * @Date 2023/12/29 16:40 + **/ +public class TransactionDetailDTO extends TransactionResParentDTO{ + private String accountNo;//银行账号 + private String accountName;//银行名称 + private String bankType;//银行类型 + private String openBank;//开户行名称 + private String bankTransactionDate;//交易日期 + private String bankSerialNumber;//银行流水号 + private String transactionSerialNumber;//交易流水号 + private String currency;//币种 + private String loanType;//借贷类型 + private String incurredAmount;//发生额 + private String accountBalance;//交易后余额 + private String purpose;//用途 + private String digest;//摘要 + private String oppositeAccount;//对方账号 + private String oppositeName;//对方户名 + private String oppositeOpeningBank;//对方开户行 + private String associatedCustomerNumber;//关联客户号 + private String merchantNumber;//客商编号 + private String merchantName;//客商名称 + private String transactionCode;//交易代码 + private String remark;//备注 + private String erpSerialNumber;//erp业务参考号 + + public String getAccountNo() { + return accountNo; + } + + public void setAccountNo(String accountNo) { + this.accountNo = accountNo; + } + + public String getAccountName() { + return accountName; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public String getBankType() { + return bankType; + } + + public void setBankType(String bankType) { + this.bankType = bankType; + } + + public String getOpenBank() { + return openBank; + } + + public void setOpenBank(String openBank) { + this.openBank = openBank; + } + + public String getBankTransactionDate() { + return bankTransactionDate; + } + + public void setBankTransactionDate(String bankTransactionDate) { + this.bankTransactionDate = bankTransactionDate; + } + + public String getBankSerialNumber() { + return bankSerialNumber; + } + + public void setBankSerialNumber(String bankSerialNumber) { + this.bankSerialNumber = bankSerialNumber; + } + + public String getTransactionSerialNumber() { + return transactionSerialNumber; + } + + public void setTransactionSerialNumber(String transactionSerialNumber) { + this.transactionSerialNumber = transactionSerialNumber; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getLoanType() { + return loanType; + } + + public void setLoanType(String loanType) { + this.loanType = loanType; + } + + public String getIncurredAmount() { + return incurredAmount; + } + + public void setIncurredAmount(String incurredAmount) { + this.incurredAmount = incurredAmount; + } + + public String getAccountBalance() { + return accountBalance; + } + + public void setAccountBalance(String accountBalance) { + this.accountBalance = accountBalance; + } + + public String getPurpose() { + return purpose; + } + + public void setPurpose(String purpose) { + this.purpose = purpose; + } + + public String getDigest() { + return digest; + } + + public void setDigest(String digest) { + this.digest = digest; + } + + public String getOppositeAccount() { + return oppositeAccount; + } + + public void setOppositeAccount(String oppositeAccount) { + this.oppositeAccount = oppositeAccount; + } + + public String getOppositeName() { + return oppositeName; + } + + public void setOppositeName(String oppositeName) { + this.oppositeName = oppositeName; + } + + public String getOppositeOpeningBank() { + return oppositeOpeningBank; + } + + public void setOppositeOpeningBank(String oppositeOpeningBank) { + this.oppositeOpeningBank = oppositeOpeningBank; + } + + public String getAssociatedCustomerNumber() { + return associatedCustomerNumber; + } + + public void setAssociatedCustomerNumber(String associatedCustomerNumber) { + this.associatedCustomerNumber = associatedCustomerNumber; + } + + public String getMerchantNumber() { + return merchantNumber; + } + + public void setMerchantNumber(String merchantNumber) { + this.merchantNumber = merchantNumber; + } + + public String getMerchantName() { + return merchantName; + } + + public void setMerchantName(String merchantName) { + this.merchantName = merchantName; + } + + public String getTransactionCode() { + return transactionCode; + } + + public void setTransactionCode(String transactionCode) { + this.transactionCode = transactionCode; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + public String getErpSerialNumber() { + return erpSerialNumber; + } + + public void setErpSerialNumber(String erpSerialNumber) { + this.erpSerialNumber = erpSerialNumber; + } +} diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java index 85e7ab27..f4961dc9 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8ExtService.java @@ -23,24 +23,30 @@ public interface ICbs8ExtService { */ SysExtensionApiEntity payResult(SysExtensionApiEntity entity); + /** + * 交易明细查询 + * @param entity + * @return + */ + SysExtensionApiEntity transactionDetailQuery(SysExtensionApiEntity entity); /** * 代发代扣 * @param entity * @return */ - String payApplyAgent(SysExtensionApiEntity entity); + SysExtensionApiEntity payApplyAgent(SysExtensionApiEntity entity); /** * 代发代扣结果查询 * @param entity * @return */ - String payApplyAgentResult(SysExtensionApiEntity entity); + SysExtensionApiEntity payApplyAgentResult(SysExtensionApiEntity entity); /** * 电子回单查询 * @param entity * @return */ - String elecQuery(SysExtensionApiEntity entity); + SysExtensionApiEntity elecQuery(SysExtensionApiEntity entity); } diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java index 56b66518..138991ac 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/ICbs8Service.java @@ -1,9 +1,10 @@ package com.hzya.frame.cbs8.service; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.res.PayResponseDTO; -import com.hzya.frame.cbs8.dto.res.PayResultResDTO; +import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import java.util.List; @@ -28,4 +29,25 @@ public interface ICbs8Service { * @throws Exception */ List queryPayResult(PayResultRequestDTO resultRequestDTO); + + /** + * 查询电子回单 + * @param elecRequestDTO + * startDate 开始日期 - 必填 + * endDate 结束日期 -必填 + * billStatus 回单状态 1-已取回 0-未取回 ,只有已取回的才能下载 + * settleBusinessReferenceCode 业务参考号 + * @return List + * bucketFileUrl 回单下载地址 + * billFileName 回单文件名称 + * settleBusinessReferenceCode 业务参考号 + */ + List queryElecBill(ElecRequestDTO elecRequestDTO); + + /** + * 查询交易明细 + * @param transactionDetailReqDTO + * @return + */ + CbsResDataDTO queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO); } diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java index c3cef7f0..0e3edd92 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java @@ -4,8 +4,10 @@ import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; import com.hzya.frame.cbs8.dto.req.PayRequestDTO; import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; +import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; import com.hzya.frame.cbs8.service.ICbs8ExtService; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.CbsAccessToken; @@ -101,17 +103,12 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { String sign = CBSUtil.sign(requestData,timestamp); //加密 byte[] encryptedData = CBSUtil.encrypt(requestData); - Map header = new HashMap(); - header.put(CBSUtil.SIGN_HEADER_NAME,sign); - header.put(CBSUtil.TIMESTAMP_HEADER,Long.toString(timestamp)); - header.put(HTTP.CONTENT_TYPE,CBSUtil.TARGET_CONTENT_TYPE); - header.put(CBSUtil.AUTHORIZATION,CBSUtil.BEARER+ CbsAccessToken.getToken()); + Map header = getHeaders(sign,timestamp); entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); entity.setHeaders(header); byte[] bodyBytes = HttpRequest.post("https://cbs8-openapi-reprd.csuat.cmburl.cn/openapi/payment/openapi/v2/detail").addHeaders(header).body(encryptedData).execute().bodyBytes(); //解密报文 String decrypt = CBSUtil.decrypt(bodyBytes); - System.out.println(decrypt); }else { throw new BaseSystemException("业务参考号不能为空!!!!"); } @@ -119,6 +116,30 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { return entity; } + /** + * 交易明细查询 + * + * @param entity + * @return + */ + @Override + public SysExtensionApiEntity transactionDetailQuery(SysExtensionApiEntity entity) { + String bodys = entity.getBodys(); + if (StrUtil.isEmpty(bodys)){ + TransactionDetailReqDTO transactionDetailReqDTO = JSONObject.parseObject(bodys,TransactionDetailReqDTO.class); + String requestData = JSONObject.toJSONString(transactionDetailReqDTO); + //签名 + long timestamp = System.currentTimeMillis(); + String sign = CBSUtil.sign(requestData,timestamp); + //加密 + byte[] encryptedData = CBSUtil.encrypt(requestData); + Map header = getHeaders(sign,timestamp); + entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); + entity.setHeaders(header); + } + return entity; + } + /** * 代发代扣 * @@ -126,7 +147,7 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { * @return */ @Override - public String payApplyAgent(SysExtensionApiEntity entity) { + public SysExtensionApiEntity payApplyAgent(SysExtensionApiEntity entity) { return null; } @@ -137,7 +158,7 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { * @return */ @Override - public String payApplyAgentResult(SysExtensionApiEntity entity) { + public SysExtensionApiEntity payApplyAgentResult(SysExtensionApiEntity entity) { return null; } @@ -148,7 +169,35 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { * @return */ @Override - public String elecQuery(SysExtensionApiEntity entity) { - return null; + public SysExtensionApiEntity elecQuery(SysExtensionApiEntity entity) { + String bodys = entity.getBodys(); + if (StrUtil.isNotEmpty(bodys)){ + ElecRequestDTO elecRequestDTO = JSONObject.parseObject(bodys,ElecRequestDTO.class); + String requestData = JSONObject.toJSONString(elecRequestDTO); + //签名 + long timestamp = System.currentTimeMillis(); + String sign = CBSUtil.sign(requestData,timestamp); + //加密 + byte[] encryptedData = CBSUtil.encrypt(requestData); + Map header = getHeaders(sign,timestamp); + entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); + entity.setHeaders(header); + byte[] bodyBytes = HttpRequest.post("https://cbs8-openapi-reprd.csuat.cmburl.cn/openapi/account/openapi/v1/electronic-bill/query").addHeaders(header).body(encryptedData).execute().bodyBytes(); + //解密报文 + String decrypt = CBSUtil.decrypt(bodyBytes); + System.out.println(decrypt); + } + return entity; + } + + + + private Map getHeaders(String sign,long timestamp){ + Map header = new HashMap(); + header.put(CBSUtil.SIGN_HEADER_NAME,sign); + header.put(CBSUtil.TIMESTAMP_HEADER,Long.toString(timestamp)); + header.put(HTTP.CONTENT_TYPE,CBSUtil.TARGET_CONTENT_TYPE); + header.put(CBSUtil.AUTHORIZATION,CBSUtil.BEARER+ CbsAccessToken.getToken()); + return header; } } diff --git a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java index a0d090dd..08e91d12 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ServiceImpl.java @@ -1,18 +1,23 @@ package com.hzya.frame.cbs8.service.impl; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.map.MapBuilder; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; -import com.hzya.frame.cbs8.dto.res.CbsResponseDTO; -import com.hzya.frame.cbs8.dto.res.PayResponseDTO; -import com.hzya.frame.cbs8.dto.res.PayResultResDTO; +import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO; +import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.service.IPaymentService; import org.apache.commons.collections.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @@ -25,6 +30,7 @@ import java.util.Map; **/ @Service public class Cbs8ServiceImpl implements ICbs8Service { + Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private IPaymentService paymentService; @Override @@ -66,4 +72,96 @@ public class Cbs8ServiceImpl implements ICbs8Service { } return null; } + + /** + * 查询电子回单 + * + * @param elecRequestDTO startDate 开始日期 - 必填 + * endDate 结束日期 -必填 + * billStatus 回单状态 1-已取回 0-未取回 ,只有已取回的才能下载 + * settleBusinessReferenceCode 业务参考号 + * @return List + * bucketFileUrl 回单下载地址 + * billFileName 回单文件名称 + * settleBusinessReferenceCode 业务参考号 + */ + @Override + public List queryElecBill(ElecRequestDTO elecRequestDTO) { + if (null == elecRequestDTO){ + elecRequestDTO = new ElecRequestDTO(); + } + if (StrUtil.isEmpty(elecRequestDTO.getStartDate())){ + elecRequestDTO.setStartDate(DateUtil.today()); + } + if (StrUtil.isEmpty(elecRequestDTO.getEndDate())){ + elecRequestDTO.setEndDate(DateUtil.today()); + } + String params = JSON.toJSONString(elecRequestDTO, SerializerFeature.WRITE_MAP_NULL_FEATURES, SerializerFeature.QuoteFieldNames); + logger.info("电子回单查询请求参数为:{}", params); + Map headerMap = MapBuilder.create(true) + .put("apiCode", "8000260005") + .put("publicKey","ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj") + .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + .put("appId","800026") + .build(); + String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + if (StrUtil.isNotEmpty(result)){ + CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); + if (null != cbsResponseDTO){ + if (CollectionUtils.isNotEmpty(cbsResponseDTO.getData())){ + List dataList = cbsResponseDTO.getData(); + if (CollectionUtils.isNotEmpty(dataList)){ + JSONObject jsonObject = dataList.get(0); + CbsResDataDTO dataDTO = JSON.toJavaObject(jsonObject, CbsResDataDTO.class); + List elecResponseDTOList = CBSUtil.convertJsonArrayToList(dataDTO.getList(), ElecResponseDTO.class); + return elecResponseDTOList; + } + } + } + } + return null; + } + + /** + * 查询交易明细 + * + * @param transactionDetailReqDTO + * @return + */ + @Override + public CbsResDataDTO queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO) { + //页码 + int currentPage = transactionDetailReqDTO.getCurrentPage(); + //每页条数 + int pageSize = transactionDetailReqDTO.getPageSize(); + if (currentPage == 0){ + currentPage = CBSUtil.DEFAULT_CURRENT_PAGE; + } + if (pageSize == 0){ + pageSize = CBSUtil.DEFAULT_PAGE_SIZE; + transactionDetailReqDTO.setPageSize(pageSize); + } + String params = JSON.toJSONString(transactionDetailReqDTO); + Map headerMap = MapBuilder.create(true) + .put("apiCode", "8000260006") + .put("publicKey","ZJYA1vBeY1ai53iNmbAEsw6DImjkXGBkdMailxcBdliFC85Ce7eDIk+3zDUT+v578prj") + .put("secretKey","7Gp6OjHrIaQ6R3tXGPrI4morjQyWL+qu4JJschQnkBRtv26VDgGFVYKOy5kMZfd/j3JzOP8MtA1LSGvL+2BWG8c/o7DKi92S4mr3zcGearA=") + .put("appId","800026") + .build(); + String result = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface").addHeaders(headerMap).body(params).timeout(60000).execute().body(); + if (StrUtil.isNotEmpty(result)){ + CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); + if (null != cbsResponseDTO){ + if (CollectionUtils.isNotEmpty(cbsResponseDTO.getData())){ + List list = cbsResponseDTO.getData(); + if (CollectionUtils.isNotEmpty(list)){ + JSONObject jsonObject = list.get(0); + CbsResDataDTO dataDTO = JSON.toJavaObject(jsonObject, CbsResDataDTO.class); + return dataDTO; + } + } + } + } + return null; + } } From 54eb505bda1c6a83ab41524c18a646b8567c634a Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 09:43:43 +0800 Subject: [PATCH 07/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0oa=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E7=BC=96=E7=A0=81=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildpackage/src/main/resources/application-yc.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/buildpackage/src/main/resources/application-yc.yml b/buildpackage/src/main/resources/application-yc.yml index 8c5ff607..57d31813 100644 --- a/buildpackage/src/main/resources/application-yc.yml +++ b/buildpackage/src/main/resources/application-yc.yml @@ -56,4 +56,6 @@ cbs8: ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde cbs_public_key: 0469146F06BF3B01236E84632441E826 #电子回单下载临时存放位置 - elec_path: /Users/xiangerlin/Downloads/ \ No newline at end of file + elec_path: /Users/xiangerlin/Downloads/ +OA: + data_source_code: yc_oa \ No newline at end of file From e0efefc5224f887964cd5cd0e7e354fe18a0cb9b Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 10:21:52 +0800 Subject: [PATCH 08/12] =?UTF-8?q?entity=5Fget=E6=96=B9=E6=B3=95=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0interfaceAddress=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sysnew/application/api/entity/SysApplicationApiEntity.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml index c7234686..d356447d 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml @@ -84,6 +84,7 @@ a.id, a.api_status, b.name as app_name, + b.interfaceAddress as app_url, a.app_id, a.catalogue_id, c.name as catalogue_name, From f0b53a019f6818f1c1747b262325017949c29723 Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 10:35:30 +0800 Subject: [PATCH 09/12] cbs8 --- .../service/impl/CbsPluginServiceImpl.java | 63 ++++++++++--------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java index 57f488da..8cdc00ae 100644 --- a/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java +++ b/buildpackage/src/main/java/com/hzya/frame/plugin/cbs8/service/impl/CbsPluginServiceImpl.java @@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.cbs8.dto.req.ElecRequestDTO; import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; @@ -13,14 +12,13 @@ import com.hzya.frame.cbs8.dto.res.*; import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.PayState; -import com.hzya.frame.plugin.cbs8.plugin.PayApplyPluginInitializer; import com.hzya.frame.plugin.cbs8.service.ICbsPluginService; import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.service.ICbsLogService; import com.hzya.frame.seeyon.cbs8.service.IPaymentService; -import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; +import com.hzya.frame.seeyon.entity.CtpFileEntity; import com.hzya.frame.seeyon.service.ICtpAttachmentService; import com.hzya.frame.seeyon.util.RestUtil; import com.hzya.frame.uuid.UUIDLong; @@ -53,6 +51,8 @@ public class CbsPluginServiceImpl implements ICbsPluginService { @Value("${cbs8.elec_path}") private String elec_path; + @Value("${OA.data_source_code}") + private String oa_data_source_code; /** * 支付申请 * @@ -161,33 +161,40 @@ public class CbsPluginServiceImpl implements ICbsPluginService { List paymentList = paymentService.queryElecIsNull(paymentEntity); if (CollectionUtils.isNotEmpty(paymentList)) { for (PaymentEntity pay : paymentList) { - String payDate = DateUtil.format(DateUtil.parse(pay.getPayDate()), "yyyy-MM-dd"); - //查询cbs电子回单 - List elecResList = cbs8Service.queryElecBill(new ElecRequestDTO(payDate,DateUtil.today(),pay.getReferenceNum())); - if (CollectionUtils.isNotEmpty(elecResList)){ - ElecResponseDTO elecResponseDTO = elecResList.get(0); - String bucketFileUrl = elecResponseDTO.getBucketFileUrl(); - String bucketFileName = elecResponseDTO.getBucketFileName(); - //上传电子回单到OA - HttpUtil.downloadFile(bucketFileUrl, FileUtil.file(elec_path));//附件下载 - String pdfUrl = elec_path + bucketFileName; - File file = new File(pdfUrl); - if (file.exists()) { - JSONObject jsonObjectUpload = RestUtil.fileUpload(file); - String file_url = jsonObjectUpload.getString("fileUrl"); - if (null != jsonObjectUpload && StrUtil.isNotEmpty(file_url)) { - String sub_reference = String.valueOf(UUIDLong.longUUID()); - pay.setReceipt(sub_reference); - //更新表单的电子回单值 - paymentService.updateElec(pay); - //保存附件关系 - CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); - ctpAttachmentEntity.setFile_url(file_url); - ctpAttachmentService.saveAttachment(file_url, pay.getSummaryId(), sub_reference); + try { + String payDate = DateUtil.format(DateUtil.parse(pay.getPayDate()), "yyyy-MM-dd"); + //查询cbs电子回单 + List elecResList = cbs8Service.queryElecBill(new ElecRequestDTO(payDate,DateUtil.today(),pay.getReferenceNum())); + if (CollectionUtils.isNotEmpty(elecResList)){ + ElecResponseDTO elecResponseDTO = elecResList.get(0); + String bucketFileUrl = elecResponseDTO.getBucketFileUrl(); + String bucketFileName = elecResponseDTO.getBucketFileName(); + //上传电子回单到OA + HttpUtil.downloadFile(bucketFileUrl, FileUtil.file(elec_path));//附件下载 + String pdfUrl = elec_path + bucketFileName; + File file = new File(pdfUrl); + if (file.exists()) { + CtpFileEntity cpFileEntity = new CtpFileEntity(); + cpFileEntity.setFile(file); + cpFileEntity.setDataSourceCode(oa_data_source_code); + JSONObject jsonObjectUpload = RestUtil.fileUpload(file,"8000240005"); + String file_url = jsonObjectUpload.getString("fileUrl"); + if (null != jsonObjectUpload && StrUtil.isNotEmpty(file_url)) { + String sub_reference = String.valueOf(UUIDLong.longUUID()); + pay.setReceipt(sub_reference); + //更新表单的电子回单值 + paymentService.updateElec(pay); + //保存附件关系 + CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); + ctpAttachmentEntity.setFile_url(file_url); + ctpAttachmentService.saveAttachment(file_url, pay.getSummaryId(), sub_reference); + } + //删除本地临时文件 + file.delete(); } - //删除本地临时文件 - file.delete(); } + }catch (Exception e){ + logger.error("电子回单查询出错",e); } } } From fccd328111bf26abe0f2b8518f77297dd8e4209a Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 10:35:55 +0800 Subject: [PATCH 10/12] =?UTF-8?q?=E6=B5=8B=E8=AF=95cbs=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../test/java/com/hzya/frame/temButtom.java | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/buildpackage/src/test/java/com/hzya/frame/temButtom.java b/buildpackage/src/test/java/com/hzya/frame/temButtom.java index e3154559..5067d326 100644 --- a/buildpackage/src/test/java/com/hzya/frame/temButtom.java +++ b/buildpackage/src/test/java/com/hzya/frame/temButtom.java @@ -1,15 +1,29 @@ package com.hzya.frame; +import cn.hutool.core.convert.Convert; +import cn.hutool.http.HttpRequest; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.cbs8.dto.req.PayRequestDTO; +import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; +import com.hzya.frame.cbs8.dto.res.PayResultResDTO; +import com.hzya.frame.cbs8.service.ICbs8ExtService; +import com.hzya.frame.cbs8.service.ICbs8Service; +import com.hzya.frame.cbs8.util.CBSUtil; +import com.hzya.frame.cbs8.util.CbsAccessToken; import com.hzya.frame.plugin.seeyonExt.plugin.SeeyonExtPluginInitializer; +import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; +import com.hzya.frame.stringutil.StringUtil; +import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; import com.hzya.frame.util.AESUtil; +import org.apache.http.protocol.HTTP; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import javax.annotation.Resource; +import java.util.*; /** * @ClassName dsasas @@ -23,6 +37,74 @@ public class temButtom { @Resource SeeyonExtPluginInitializer seeyonExtPluginInitializer; + @Resource + ICbs8Service cs8Service; + @Resource + ICbs8ExtService cbs8ExtService; + + @Test + public void queryResultTest(){ + SysExtensionApiEntity sysExt = new SysExtensionApiEntity(); + sysExt.setBodys("{\"referenceNum\":\"CL202406140002\"}"); + cbs8ExtService.payResult(sysExt); + System.out.println("11111"); + } + + @Test + public void cbs8ExtTest(){ + PaymentEntity paymentEntity = new PaymentEntity(); + paymentEntity.setReferenceNum("CL202406140003"); + paymentEntity.setPayAccount("655905707410000"); + paymentEntity.setPayBankName(""); + paymentEntity.setAmount("99.02"); + paymentEntity.setRevAccount("123456778"); + paymentEntity.setRevBankName("中国工商银行总行清算中心"); + paymentEntity.setRevBankType("ICB"); + paymentEntity.setRevAccountName("测试账户"); + paymentEntity.setCnapsCode("102100099996"); + paymentEntity.setPurpose("测试用途"); + paymentEntity.setBusType("202"); + paymentEntity.setCurrency("10"); + if (null != paymentEntity){ + PayRequestDTO payRequestDTO = new PayRequestDTO(); + String ferenceNum = Convert.toStr(paymentEntity.getReferenceNumNew(),paymentEntity.getReferenceNum()); + payRequestDTO.setReferenceNum(ferenceNum); + payRequestDTO.setBusType(paymentEntity.getBusType()); + payRequestDTO.setAmount(paymentEntity.getAmount()); + payRequestDTO.setCurrency(paymentEntity.getCurrency()); + payRequestDTO.setPayAccount(StringUtil.replaceBlank(paymentEntity.getPayAccount())); + payRequestDTO.setRevAccount(StringUtil.replaceBlank(paymentEntity.getRevAccount())); + payRequestDTO.setRevAccountName(StringUtil.replaceBlank(paymentEntity.getRevAccountName())); + payRequestDTO.setRevBankType(StringUtil.replaceBlank((paymentEntity.getRevBankType()))); + payRequestDTO.setRevBankName(StringUtil.replaceBlank(paymentEntity.getRevBankName())); + payRequestDTO.setCnapsCode(StringUtil.replaceBlank((paymentEntity.getCnapsCode()))); + payRequestDTO.setPurpose(paymentEntity.getPurpose()); + payRequestDTO.setErpExtend1(paymentEntity.getPayType()); + //集中支付模式 + if (CBSUtil.CENTRALIZED_PAYMENT_TYPE.equals(payRequestDTO.getBusType())){ + payRequestDTO.setBusiStep("1"); + payRequestDTO.setApplyUnitCode(paymentEntity.getPayCompanyCode()); + payRequestDTO.setPayAccount(null); + } + List list = new ArrayList<>(); + list.add(payRequestDTO); + String requestData = JSONObject.toJSONString(list); + System.out.println("明文参数:"+requestData); + //签名 + long timestamp = System.currentTimeMillis(); + String sign = CBSUtil.sign(requestData,timestamp); + //加密 + byte[] encryptedData = CBSUtil.encrypt(requestData); + Map header = new HashMap(); + header.put(CBSUtil.SIGN_HEADER_NAME,sign); + header.put(CBSUtil.TIMESTAMP_HEADER,Long.toString(timestamp)); + header.put(HTTP.CONTENT_TYPE,CBSUtil.TARGET_CONTENT_TYPE); + header.put(CBSUtil.AUTHORIZATION,CBSUtil.BEARER+CbsAccessToken.getToken()); + byte[] bodyByte = HttpRequest.post("https://cbs8-openapi-reprd.csuat.cmburl.cn/openapi/payment/openapi/v1/payment-apply-common").addHeaders(header).body(encryptedData).execute().bodyBytes(); + String decrypt = CBSUtil.decrypt(bodyByte); + System.out.println(decrypt); + } + } @Test public void seeyonExtTest(){ JSONObject jsonStr = new JSONObject(); From 3fffae8d3c61562b2ed3a783f447ebdc31404b5a Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Tue, 18 Jun 2024 11:00:52 +0800 Subject: [PATCH 11/12] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=20apiUrl=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/entity/SysApplicationApiEntity.java | 10 ++++ .../api/entity/SysApplicationApiEntity.xml | 46 ++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java index e0fc5061..bed8eaf7 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java +++ b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.java @@ -20,6 +20,8 @@ public class SysApplicationApiEntity extends BaseEntity { private String appId; /** api应用名称 */ private String appName; + /** api应用地址 **/ + private String appUrl; /** 目录 */ private String catalogueId; /** 目录名称 */ @@ -291,5 +293,13 @@ public class SysApplicationApiEntity extends BaseEntity { public void setReturnSuccessValue(String returnSuccessValue) { this.returnSuccessValue = returnSuccessValue; } + + public String getAppUrl() { + return appUrl; + } + + public void setAppUrl(String appUrl) { + this.appUrl = appUrl; + } } diff --git a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml index d180eef9..f6596703 100644 --- a/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml +++ b/service/src/main/java/com/hzya/frame/sysnew/application/api/entity/SysApplicationApiEntity.xml @@ -10,6 +10,7 @@ + @@ -84,6 +85,7 @@ a.id, a.api_status, b.name as app_name, + b.interfaceAddress as app_url, a.app_id, a.catalogue_id, c.name as catalogue_name, @@ -702,7 +704,7 @@ where id = #{id} - select a.id, a.catalogue_id AS catalogueId, @@ -744,6 +746,48 @@ where id = #{id} order by a.sorts asc + + select + + from + ctp_file + + id = #{id} + and filename = #{filename} + + + + + diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java b/service/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java new file mode 100644 index 00000000..3af20d9d --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/ICtpAttachmentService.java @@ -0,0 +1,20 @@ +package com.hzya.frame.seeyon.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; + +/** + * @Description seeyon 附件关系 + * @Author xiangerlin + * @Date 2024/6/17 15:30 + **/ +public interface ICtpAttachmentService extends IBaseService { + /** + * 保存附件关系表 + * @param fileUrl ctp_file id + * @param col_summary_id col_summary id + * @param sub_reference 随机uuid + * @return + */ + CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference)throws Exception; +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/ICtpFileService.java b/service/src/main/java/com/hzya/frame/seeyon/service/ICtpFileService.java new file mode 100644 index 00000000..b34826ef --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/ICtpFileService.java @@ -0,0 +1,12 @@ +package com.hzya.frame.seeyon.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.seeyon.entity.CtpFileEntity; + +/** + * @Description seeyon 附件 + * @Author xiangerlin + * @Date 2024/6/17 15:23 + **/ +public interface ICtpFileService extends IBaseService { +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/impl/CtpAttachmentServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/service/impl/CtpAttachmentServiceImpl.java new file mode 100644 index 00000000..0ee1e68f --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/impl/CtpAttachmentServiceImpl.java @@ -0,0 +1,70 @@ +package com.hzya.frame.seeyon.service.impl; + +import cn.hutool.core.date.DateUtil; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.seeyon.dao.ICtpAttachmentDao; +import com.hzya.frame.seeyon.entity.CtpAttachmentEntity; +import com.hzya.frame.seeyon.entity.CtpFileEntity; +import com.hzya.frame.seeyon.service.ICtpAttachmentService; +import com.hzya.frame.seeyon.service.ICtpFileService; +import com.hzya.frame.uuid.UUIDLong; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/6/17 15:31 + **/ +@Service(value = "ctpAttachmentService") +public class CtpAttachmentServiceImpl extends BaseService implements ICtpAttachmentService { + + private ICtpAttachmentDao ctpAttachmentDao; + @Autowired + private ICtpFileService ctpFileService; + @Autowired + public void setCtpAttachmentDao(ICtpAttachmentDao dao) { + this.ctpAttachmentDao = dao; + this.dao = dao; + } + + /** + * 保存附件关系表 + * + * @param fileUrl ctp_file id + * @param col_summary_id col_summary id + * @param sub_reference 随机uuid + * @return + */ + @Override + public CtpAttachmentEntity saveAttachment(String fileUrl, String col_summary_id, String sub_reference)throws Exception { + //查一下附件 + CtpFileEntity ctpFileEntity = new CtpFileEntity(); + ctpFileEntity.setId(fileUrl); + ctpFileEntity.setDataSourceCode(""); + List ctpFileList = ctpFileService.query(ctpFileEntity); + if (CollectionUtils.isNotEmpty(ctpFileList)){ + CtpFileEntity ctpFile = ctpFileList.get(0); + if (null != ctpFile){ + CtpAttachmentEntity ctpAttachmentEntity = new CtpAttachmentEntity(); + ctpAttachmentEntity.setId(String.valueOf(UUIDLong.longUUID())); + ctpAttachmentEntity.setFile_url(ctpFile.getId());//ctp_file表的id + ctpAttachmentEntity.setAtt_reference(col_summary_id);//业务表单的id + ctpAttachmentEntity.setSub_reference(sub_reference);//这个字段要保存到业务表附件到字段上 + ctpAttachmentEntity.setCategory("66");//这里写66 才可以显示图片 + ctpAttachmentEntity.setFilename(ctpFile.getFilename()); + ctpAttachmentEntity.setType(ctpFile.getType()); + ctpAttachmentEntity.setMime_type(ctpFile.getMime_type()); + ctpAttachmentEntity.setAttachment_size(ctpFile.getFile_size()); + ctpAttachmentEntity.setCreatedate(new Date()); + this.save(ctpAttachmentEntity); + return ctpAttachmentEntity; + } + } + return null; + } +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/service/impl/CtpFileServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/service/impl/CtpFileServiceImpl.java new file mode 100644 index 00000000..31f96553 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/service/impl/CtpFileServiceImpl.java @@ -0,0 +1,15 @@ +package com.hzya.frame.seeyon.service.impl; + +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.seeyon.entity.CtpFileEntity; +import com.hzya.frame.seeyon.service.ICtpFileService; +import org.springframework.stereotype.Service; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/6/17 15:24 + **/ +@Service() +public class CtpFileServiceImpl extends BaseService implements ICtpFileService { +} diff --git a/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java b/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java new file mode 100644 index 00000000..dc6195f2 --- /dev/null +++ b/service/src/main/java/com/hzya/frame/seeyon/util/RestUtil.java @@ -0,0 +1,127 @@ +package com.hzya.frame.seeyon.util; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.seeyon.entity.CtpFileEntity; +import com.hzya.frame.sysnew.application.api.entity.SysApplicationApiEntity; +import com.hzya.frame.sysnew.application.api.service.ISysApplicationApiService; +import com.hzya.frame.web.exception.BaseSystemException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.util.HashMap; + +/** + * @Description 致远rest接口工具类 + * @Author xiangerlin + * @Date 2024/6/17 15:49 + **/ +@Component +public class RestUtil { + + @Autowired + private ISysApplicationApiService sysApplicationApiService; + static Logger logger = LoggerFactory.getLogger(RestUtil.class); + + private RestUtil() { + } + + + /** + * 附件上传 + * @param file 附件对象 + * @param api_code 接口编码 + * @return + */ + public JSONObject fileUpload(File file,String api_code) { + if (StrUtil.isNotEmpty(api_code)){ + //1、查询附件上传api接口信息 + SysApplicationApiEntity sysApp = getByCode(api_code); + if (null != sysApp){ + String app_url = sysApp.getAppUrl(); + String url = app_url+"/seeyon/rest/attachment?token=@token@"; + String token = getToken(null,"8000240000"); + url = url.replaceAll("@token@",token); + HashMap paramMap = new HashMap<>(); + paramMap.put("file", file); + String result = HttpUtil.post(url, paramMap); + if (StrUtil.isNotBlank(result)) { + logger.info("附件上传结果"+result); + JSONObject jsonObject = JSONObject.parseObject(result); + String atts = jsonObject.get("atts").toString(); + if (StrUtil.isNotEmpty(atts)) { + JSONArray jsonArray = JSONArray.parseArray(atts); + JSONObject res = (JSONObject) jsonArray.get(0); + return res; + } + } + } + }else { + throw new BaseSystemException("api_code不能为空"); + } + return null; + } + + /** + * 获取token + * @param login_name + * @param api_code + * @return + */ + public String getToken(String login_name,String api_code){ + if (StrUtil.isNotEmpty(api_code)){ + SysApplicationApiEntity sysApp = getByCode(api_code); + if (null != sysApp){ + HashMap hashMap = new HashMap<>(); + String app_url = sysApp.getAppUrl(); + String url = app_url+"/seeyon/rest/token"; + String headerIn = sysApp.getHeaderIn(); + JSONArray headers = JSON.parseArray(headerIn); + for (int i = 0; i < headers.size(); i++) { + JSONObject object1 = headers.getJSONObject(i); + String parameterName = object1.getString("parameterName"); + if ("userName".equals(parameterName) || "password".equals(parameterName) || "loginName".equals(parameterName)){ + String example = object1.getString("example"); + hashMap.put(parameterName,example); + } + } + if (StrUtil.isNotEmpty(login_name)){ + hashMap.put("loginName",login_name); + } + String result = HttpRequest.post(url).body(JSON.toJSONString(hashMap)).execute().body(); + JSONObject jsonObject = JSONObject.parseObject(result); + if (null != jsonObject) { + logger.info("======token:{}======" ,jsonObject.getString("id")); + return jsonObject.getString("id"); + } + } + }else { + throw new BaseSystemException("api_code不能为空"); + } + return null; + } + + private SysApplicationApiEntity getByCode(String api_code){ + if (StrUtil.isNotEmpty(api_code)){ + SysApplicationApiEntity sysApp = new SysApplicationApiEntity(); + sysApp.setApiCode(Long.valueOf(api_code)); + sysApp = sysApplicationApiService.queryOne(sysApp); + if (null != sysApp && StrUtil.isNotEmpty(sysApp.getId())){ + sysApp = sysApplicationApiService.get(sysApp.getId()); + if (null != sysApp){ + return sysApp; + } + } + }else { + throw new BaseSystemException("api_code不能为空"); + } + return null; + } +}