Merge remote-tracking branch 'origin/yuecheng-project' into yuecheng-project

This commit is contained in:
yuqh 2024-06-19 09:56:21 +08:00
commit 905df77c02
34 changed files with 2596 additions and 40 deletions

View File

@ -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;
}
}

View File

@ -1,25 +1,13 @@
package com.hzya.frame.plugin.cbs8.plugin; 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.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity; 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.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 com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* @Description 经办支付申请 * @Description 经办支付申请
* @Author xiangerlin * @Author xiangerlin

View File

@ -0,0 +1,110 @@
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @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);
List<TransactionDetailDTO> transactionDetailList = cbsPluginService.queryTransactionDetail(transactionDetailReqDTO);
return null;
}
}

View File

@ -1,6 +1,10 @@
package com.hzya.frame.plugin.cbs8.service; package com.hzya.frame.plugin.cbs8.service;
import com.alibaba.fastjson.JSONObject; 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 * @Description
@ -21,4 +25,18 @@ public interface ICbsPluginService {
* @throws Exception * @throws Exception
*/ */
void queryResult(JSONObject requestJson)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<TransactionDetailDTO> queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO);
} }

View File

@ -1,24 +1,34 @@
package com.hzya.frame.plugin.cbs8.service.impl; 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.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONObject; 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.req.PayResultRequestDTO;
import com.hzya.frame.cbs8.dto.res.PayResponseDTO; import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO;
import com.hzya.frame.cbs8.dto.res.PayResultResDTO; import com.hzya.frame.cbs8.dto.res.*;
import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.service.ICbs8Service;
import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.CBSUtil;
import com.hzya.frame.cbs8.util.PayState; 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.plugin.cbs8.service.ICbsPluginService;
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity; import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
import com.hzya.frame.seeyon.cbs8.service.ICbsLogService; import com.hzya.frame.seeyon.cbs8.service.ICbsLogService;
import com.hzya.frame.seeyon.cbs8.service.IPaymentService; import com.hzya.frame.seeyon.cbs8.service.IPaymentService;
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;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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.ArrayList;
import java.util.List; import java.util.List;
@ -36,7 +46,13 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
private IPaymentService paymentService; private IPaymentService paymentService;
@Autowired @Autowired
private ICbsLogService cbsLogService; private ICbsLogService cbsLogService;
@Autowired
private ICtpAttachmentService ctpAttachmentService;
@Value("${cbs8.elec_path}")
private String elec_path;
@Value("${OA.data_source_code}")
private String oa_data_source_code;
/** /**
* 支付申请 * 支付申请
* *
@ -131,4 +147,89 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
} }
} }
} }
/**
* 电子回单查询 并上传OA
*
* @param requestJson
* @throws Exception
*/
@Override
public void elecBillUpload(JSONObject requestJson) throws Exception {
//查询支付成功 没有电子回单的数据
PaymentEntity paymentEntity = new PaymentEntity();
List<PaymentEntity> paymentList = paymentService.queryElecIsNull(paymentEntity);
if (CollectionUtils.isNotEmpty(paymentList)) {
for (PaymentEntity pay : paymentList) {
try {
String payDate = DateUtil.format(DateUtil.parse(pay.getPayDate()), "yyyy-MM-dd");
//查询cbs电子回单
List<ElecResponseDTO> 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();
}
}
}catch (Exception e){
logger.error("电子回单查询出错",e);
}
}
}
}
/**
* 查询交易明细
* transactionDetailReqDTO.currentPage transactionDetailReqDTO.pageSize 必填
* @param transactionDetailReqDTO
*/
@Override
public List<TransactionDetailDTO> 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<TransactionDetailDTO> resultList = new ArrayList<>();
do{
transactionDetailReqDTO.setCurrentPage(currentPage);//页码
currentPage++;//页码自增
hasNextPage = false;//保护功能防止出现死循环
CbsResDataDTO dataDTO = cbs8Service.queryTransactionDetail(transactionDetailReqDTO);
if (null != dataDTO){
hasNextPage = dataDTO.getHasNextPage();
List<TransactionDetailDTO> transactionDetailDTOList = CBSUtil.convertJsonArrayToList(dataDTO.getList(), TransactionDetailDTO.class);
resultList.addAll(transactionDetailDTOList);
}
}while (hasNextPage);
return resultList;
}
} }

View File

@ -54,4 +54,8 @@ cbs8:
# 这个私钥到时候上传到cbs和下面到是同一对 # 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46 #ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826 cbs_public_key: 0469146F06BF3B01236E84632441E826
#电子回单下载临时存放位置
elec_path: /Users/xiangerlin/Downloads/
OA:
data_source_code: yc_oa

View File

@ -3,4 +3,6 @@
<beans default-autowire="byName"> <beans default-autowire="byName">
<bean name="payApplyPluginInitializer" class="com.hzya.frame.plugin.cbs8.plugin.PayApplyPluginInitializer" /> <bean name="payApplyPluginInitializer" class="com.hzya.frame.plugin.cbs8.plugin.PayApplyPluginInitializer" />
<bean name="payResultPluginInitializer" class="com.hzya.frame.plugin.cbs8.plugin.PayResultPluginInitializer" /> <bean name="payResultPluginInitializer" class="com.hzya.frame.plugin.cbs8.plugin.PayResultPluginInitializer" />
<bean name="elecBillPluginInitializer" class="com.hzya.frame.plugin.cbs8.plugin.ElecBillPluginInitializer" />
<bean name="transactionDetailPluginInitializer" class="com.hzya.frame.plugin.cbs8.plugin.TransactionDetailPluginInitializer" />
</beans> </beans>

View File

@ -1,15 +1,29 @@
package com.hzya.frame; package com.hzya.frame;
import cn.hutool.core.convert.Convert;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 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.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 com.hzya.frame.util.AESUtil;
import org.apache.http.protocol.HTTP;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*;
/** /**
* @ClassName dsasas * @ClassName dsasas
@ -23,6 +37,74 @@ public class temButtom {
@Resource @Resource
SeeyonExtPluginInitializer seeyonExtPluginInitializer; 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<PayRequestDTO> 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<String,String> 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 @Test
public void seeyonExtTest(){ public void seeyonExtTest(){
JSONObject jsonStr = new JSONObject(); JSONObject jsonStr = new JSONObject();

View File

@ -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<String> currencyList;
// 银行类型列表
private List<String> bankTypeList;
// 回单文件状态 1-已取回 0-未取回
private String billStatus;
// 借贷 1- 2-
private String loanType;
// 单位编码列表
private List<String> unitCodeList;
// 对账码列表
private List<String> 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<String> getCurrencyList() {
return currencyList;
}
public void setCurrencyList(List<String> currencyList) {
this.currencyList = currencyList;
}
public List<String> getBankTypeList() {
return bankTypeList;
}
public void setBankTypeList(List<String> 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<String> getUnitCodeList() {
return unitCodeList;
}
public void setUnitCodeList(List<String> unitCodeList) {
this.unitCodeList = unitCodeList;
}
public List<String> getCheckCodeList() {
return checkCodeList;
}
public void setCheckCodeList(List<String> checkCodeList) {
this.checkCodeList = checkCodeList;
}
public String getSettleBusinessReferenceCode() {
return settleBusinessReferenceCode;
}
public void setSettleBusinessReferenceCode(String settleBusinessReferenceCode) {
this.settleBusinessReferenceCode = settleBusinessReferenceCode;
}
}

View File

@ -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<String> accountNoList;//账户列表
private List<String> bankTypeList;//银行类型列表
private List<String> currencyList;//币种列表
private String detailedSources;//明细来源
private String currentFlag;//明细类型
private String loanType;//借贷类型 1 2
private List<String> accountNatureList;//账户性质列表
private String bankSerialNumber;//银行流水号
private String transactionSerialNumber;//交易流水号
private List<String> 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<String> getAccountNoList() {
return accountNoList;
}
public void setAccountNoList(List<String> accountNoList) {
this.accountNoList = accountNoList;
}
public List<String> getBankTypeList() {
return bankTypeList;
}
public void setBankTypeList(List<String> bankTypeList) {
this.bankTypeList = bankTypeList;
}
public List<String> getCurrencyList() {
return currencyList;
}
public void setCurrencyList(List<String> 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<String> getAccountNatureList() {
return accountNatureList;
}
public void setAccountNatureList(List<String> 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<String> getUnitCodeList() {
return unitCodeList;
}
public void setUnitCodeList(List<String> 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;
}
}

View File

@ -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<JSONObject> 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<JSONObject> getList() {
return list;
}
public void setList(List<JSONObject> 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 <T>
*/
private static <T> void adaptAndAddToList(String json, List<Object> list, Class<T> 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));
}
}
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -23,24 +23,30 @@ public interface ICbs8ExtService {
*/ */
SysExtensionApiEntity payResult(SysExtensionApiEntity entity); SysExtensionApiEntity payResult(SysExtensionApiEntity entity);
/**
* 交易明细查询
* @param entity
* @return
*/
SysExtensionApiEntity transactionDetailQuery(SysExtensionApiEntity entity);
/** /**
* 代发代扣 * 代发代扣
* @param entity * @param entity
* @return * @return
*/ */
String payApplyAgent(SysExtensionApiEntity entity); SysExtensionApiEntity payApplyAgent(SysExtensionApiEntity entity);
/** /**
* 代发代扣结果查询 * 代发代扣结果查询
* @param entity * @param entity
* @return * @return
*/ */
String payApplyAgentResult(SysExtensionApiEntity entity); SysExtensionApiEntity payApplyAgentResult(SysExtensionApiEntity entity);
/** /**
* 电子回单查询 * 电子回单查询
* @param entity * @param entity
* @return * @return
*/ */
String elecQuery(SysExtensionApiEntity entity); SysExtensionApiEntity elecQuery(SysExtensionApiEntity entity);
} }

View File

@ -1,9 +1,10 @@
package com.hzya.frame.cbs8.service; package com.hzya.frame.cbs8.service;
import com.alibaba.fastjson.JSONObject; 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.req.PayResultRequestDTO;
import com.hzya.frame.cbs8.dto.res.PayResponseDTO; import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO;
import com.hzya.frame.cbs8.dto.res.PayResultResDTO; import com.hzya.frame.cbs8.dto.res.*;
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
import java.util.List; import java.util.List;
@ -28,4 +29,25 @@ public interface ICbs8Service {
* @throws Exception * @throws Exception
*/ */
List<PayResultResDTO> queryPayResult(PayResultRequestDTO resultRequestDTO); List<PayResultResDTO> queryPayResult(PayResultRequestDTO resultRequestDTO);
/**
* 查询电子回单
* @param elecRequestDTO
* startDate 开始日期 - 必填
* endDate 结束日期 -必填
* billStatus 回单状态 1-已取回 0-未取回 只有已取回的才能下载
* settleBusinessReferenceCode 业务参考号
* @return List<ElecResponseDTO>
* bucketFileUrl 回单下载地址
* billFileName 回单文件名称
* settleBusinessReferenceCode 业务参考号
*/
List<ElecResponseDTO> queryElecBill(ElecRequestDTO elecRequestDTO);
/**
* 查询交易明细
* @param transactionDetailReqDTO
* @return
*/
CbsResDataDTO queryTransactionDetail(TransactionDetailReqDTO transactionDetailReqDTO);
} }

View File

@ -4,8 +4,10 @@ import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSONObject; 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.PayRequestDTO;
import com.hzya.frame.cbs8.dto.req.PayResultRequestDTO; 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.service.ICbs8ExtService;
import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.CBSUtil;
import com.hzya.frame.cbs8.util.CbsAccessToken; import com.hzya.frame.cbs8.util.CbsAccessToken;
@ -101,17 +103,12 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
String sign = CBSUtil.sign(requestData,timestamp); String sign = CBSUtil.sign(requestData,timestamp);
//加密 //加密
byte[] encryptedData = CBSUtil.encrypt(requestData); byte[] encryptedData = CBSUtil.encrypt(requestData);
Map<String,String> header = new HashMap(); Map<String,String> header = getHeaders(sign,timestamp);
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());
entity.setBodys(Base64.getEncoder().encodeToString(encryptedData)); entity.setBodys(Base64.getEncoder().encodeToString(encryptedData));
entity.setHeaders(header); 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(); 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); String decrypt = CBSUtil.decrypt(bodyBytes);
System.out.println(decrypt);
}else { }else {
throw new BaseSystemException("业务参考号不能为空!!!!"); throw new BaseSystemException("业务参考号不能为空!!!!");
} }
@ -119,6 +116,30 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
return entity; 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<String,String> 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 * @return
*/ */
@Override @Override
public String payApplyAgent(SysExtensionApiEntity entity) { public SysExtensionApiEntity payApplyAgent(SysExtensionApiEntity entity) {
return null; return null;
} }
@ -137,7 +158,7 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
* @return * @return
*/ */
@Override @Override
public String payApplyAgentResult(SysExtensionApiEntity entity) { public SysExtensionApiEntity payApplyAgentResult(SysExtensionApiEntity entity) {
return null; return null;
} }
@ -148,7 +169,35 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
* @return * @return
*/ */
@Override @Override
public String elecQuery(SysExtensionApiEntity entity) { public SysExtensionApiEntity elecQuery(SysExtensionApiEntity entity) {
return null; 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<String,String> 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<String,String> getHeaders(String sign,long timestamp){
Map<String,String> 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;
} }
} }

View File

@ -1,18 +1,23 @@
package com.hzya.frame.cbs8.service.impl; package com.hzya.frame.cbs8.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapBuilder; import cn.hutool.core.map.MapBuilder;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; 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.req.PayResultRequestDTO;
import com.hzya.frame.cbs8.dto.res.CbsResponseDTO; import com.hzya.frame.cbs8.dto.req.TransactionDetailReqDTO;
import com.hzya.frame.cbs8.dto.res.PayResponseDTO; import com.hzya.frame.cbs8.dto.res.*;
import com.hzya.frame.cbs8.dto.res.PayResultResDTO;
import com.hzya.frame.cbs8.service.ICbs8Service; import com.hzya.frame.cbs8.service.ICbs8Service;
import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.CBSUtil;
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity; import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
import com.hzya.frame.seeyon.cbs8.service.IPaymentService; import com.hzya.frame.seeyon.cbs8.service.IPaymentService;
import org.apache.commons.collections.CollectionUtils; 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.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -25,6 +30,7 @@ import java.util.Map;
**/ **/
@Service @Service
public class Cbs8ServiceImpl implements ICbs8Service { public class Cbs8ServiceImpl implements ICbs8Service {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired @Autowired
private IPaymentService paymentService; private IPaymentService paymentService;
@Override @Override
@ -66,4 +72,96 @@ public class Cbs8ServiceImpl implements ICbs8Service {
} }
return null; return null;
} }
/**
* 查询电子回单
*
* @param elecRequestDTO startDate 开始日期 - 必填
* endDate 结束日期 -必填
* billStatus 回单状态 1-已取回 0-未取回 只有已取回的才能下载
* settleBusinessReferenceCode 业务参考号
* @return List<ElecResponseDTO>
* bucketFileUrl 回单下载地址
* billFileName 回单文件名称
* settleBusinessReferenceCode 业务参考号
*/
@Override
public List<ElecResponseDTO> 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<String, String> headerMap = MapBuilder.<String, String>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<JSONObject> dataList = cbsResponseDTO.getData();
if (CollectionUtils.isNotEmpty(dataList)){
JSONObject jsonObject = dataList.get(0);
CbsResDataDTO dataDTO = JSON.toJavaObject(jsonObject, CbsResDataDTO.class);
List<ElecResponseDTO> 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<String, String> headerMap = MapBuilder.<String, String>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<JSONObject> list = cbsResponseDTO.getData();
if (CollectionUtils.isNotEmpty(list)){
JSONObject jsonObject = list.get(0);
CbsResDataDTO dataDTO = JSON.toJavaObject(jsonObject, CbsResDataDTO.class);
return dataDTO;
}
}
}
}
return null;
}
} }

View File

@ -0,0 +1,91 @@
package com.hzya.frame.seeyon.cbs8.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description 代发代扣明细表
* @Author xiangerlin
* @Date 2024/6/18 14:58
**/
public class AgentPaymentDetailEntity extends BaseEntity {
private String dtlAmount;
//收款账号
private String dtlRevAccount;
//联行号 同行可不传跨行必传
private String dtlCnapsCode;
//收款账户名称
private String dtlRevName;
//收款开户行 ,如果传的联行号能匹配到对应到开户行cbs8会自动带出
private String dtlRevBankName;
//主表id
private String formmainId;
//表名
private String tabName;
//明细序号从1开始递增
private int dtlSeqNum;
public String getDtlAmount() {
return dtlAmount;
}
public void setDtlAmount(String dtlAmount) {
this.dtlAmount = dtlAmount;
}
public String getDtlRevAccount() {
return dtlRevAccount;
}
public void setDtlRevAccount(String dtlRevAccount) {
this.dtlRevAccount = dtlRevAccount;
}
public String getDtlCnapsCode() {
return dtlCnapsCode;
}
public void setDtlCnapsCode(String dtlCnapsCode) {
this.dtlCnapsCode = dtlCnapsCode;
}
public String getDtlRevName() {
return dtlRevName;
}
public void setDtlRevName(String dtlRevName) {
this.dtlRevName = dtlRevName;
}
public String getDtlRevBankName() {
return dtlRevBankName;
}
public void setDtlRevBankName(String dtlRevBankName) {
this.dtlRevBankName = dtlRevBankName;
}
public String getFormmainId() {
return formmainId;
}
public void setFormmainId(String formmainId) {
this.formmainId = formmainId;
}
public String getTabName() {
return tabName;
}
public void setTabName(String tabName) {
this.tabName = tabName;
}
public int getDtlSeqNum() {
return dtlSeqNum;
}
public void setDtlSeqNum(int dtlSeqNum) {
this.dtlSeqNum = dtlSeqNum;
}
}

View File

@ -0,0 +1,97 @@
package com.hzya.frame.seeyon.cbs8.entity;
import com.hzya.frame.web.entity.BaseEntity;
/**
* @Description 代发代扣 主表
* @Author xiangerlin
* @Date 2024/6/18 14:44
**/
public class AgentPaymentEntity extends BaseEntity {
//业务参考号
private String referenceNum;
/**
* 业务类型
* 201-代扣
* 203-代发
* 代发工资传203
*/
private String busType;
//总金额 小数位2位
private String amount;
//币种
private String currency;
//付款账号
private String payAccount;
//用途
private String purpose;
private String tableName;//表名称
private String billName;//单据名称
public String getReferenceNum() {
return referenceNum;
}
public void setReferenceNum(String referenceNum) {
this.referenceNum = referenceNum;
}
public String getBusType() {
return busType;
}
public void setBusType(String busType) {
this.busType = busType;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public String getCurrency() {
return currency;
}
public void setCurrency(String currency) {
this.currency = currency;
}
public String getPayAccount() {
return payAccount;
}
public void setPayAccount(String payAccount) {
this.payAccount = payAccount;
}
public String getPurpose() {
return purpose;
}
public void setPurpose(String purpose) {
this.purpose = purpose;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getBillName() {
return billName;
}
public void setBillName(String billName) {
this.billName = billName;
}
}

View File

@ -0,0 +1,31 @@
package com.hzya.frame.seeyon.cbs8.service;
import com.hzya.frame.basedao.service.IBaseService;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity;
import java.util.List;
/**
* @Description OA代发代扣
* @Author xiangerlin
* @Date 2024/6/18 15:04
**/
public interface IAgentPaymentService extends IBaseService<AgentPaymentEntity,String> {
/**
* 查询待支付待代发代扣 主表
* @param entity
* @return
* @throws Exception
*/
List<AgentPaymentEntity> queryUnpaid(AgentPaymentEntity entity) throws Exception;
/**
* 查询明细表
* @param entity
* @return
* @throws Exception
*/
List<AgentPaymentDetailEntity> queryDetails(AgentPaymentDetailEntity entity)throws Exception;
}

View File

@ -0,0 +1,41 @@
package com.hzya.frame.seeyon.cbs8.service.impl;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity;
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity;
import com.hzya.frame.seeyon.cbs8.service.IAgentPaymentService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/18 15:06
**/
@Service(value = "cbs8AgentPaymentServiceImpl")
public class AgentPaymentServiceImpl extends BaseService<AgentPaymentEntity,String> implements IAgentPaymentService {
/**
* 查询待支付待代发代扣 主表
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<AgentPaymentEntity> queryUnpaid(AgentPaymentEntity entity) throws Exception {
return null;
}
/**
* 查询明细表
*
* @param entity
* @return
* @throws Exception
*/
@Override
public List<AgentPaymentDetailEntity> queryDetails(AgentPaymentDetailEntity entity) throws Exception {
return null;
}
}

View File

@ -8,14 +8,14 @@ import java.util.List;
public interface ICtpAttachmentDao extends IBaseDao<CtpAttachmentEntity,String> { public interface ICtpAttachmentDao extends IBaseDao<CtpAttachmentEntity,String> {
//更新数据 //更新数据
@DS("ht_oa_sqlserver") @DS("#ctpAttachmentEntity.dataSourceCode")
int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity); int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity);
//根据fiel_url查询附件业务记录如果存在则更新如果不存在则新增 //根据fiel_url查询附件业务记录如果存在则更新如果不存在则新增
@DS("ht_oa_sqlserver") @DS("#ctpAttachmentEntity.dataSourceCode")
List<CtpAttachmentEntity> queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity); List<CtpAttachmentEntity> queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity);
//新增 //新增
@DS("ht_oa_sqlserver") @DS("#ctpAttachmentEntity.dataSourceCode")
CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity); CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity);
} }

View File

@ -0,0 +1,12 @@
package com.hzya.frame.seeyon.dao;
import com.hzya.frame.basedao.dao.IBaseDao;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
/**
* @Description seeyon 附件对象
* @Author xiangerlin
* @Date 2024/6/17 15:21
**/
public interface ICtpFileDao extends IBaseDao<CtpFileEntity,String> {
}

View File

@ -11,19 +11,19 @@ import java.util.List;
@Repository(value = "ctpAttachmentDaoImpl") @Repository(value = "ctpAttachmentDaoImpl")
public class public class
CtpAttachmentDaoImpl extends MybatisGenericDao<CtpAttachmentEntity,String> implements ICtpAttachmentDao { CtpAttachmentDaoImpl extends MybatisGenericDao<CtpAttachmentEntity,String> implements ICtpAttachmentDao {
@DS("ht_oa_sqlserver") @DS("#ctpAttachmentEntity.dataSourceCode")
@Override @Override
public int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) { public int updateCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) {
return super.update("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_update",ctpAttachmentEntity); return super.update("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_update",ctpAttachmentEntity);
} }
@DS("ht_oa_sqlserver") @DS("#ctpAttachmentEntity.dataSourceCode")
@Override @Override
public List<CtpAttachmentEntity> queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) { public List<CtpAttachmentEntity> queryCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) {
return (List<CtpAttachmentEntity>) super.selectList("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_list_base",ctpAttachmentEntity); return (List<CtpAttachmentEntity>) super.selectList("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_list_base",ctpAttachmentEntity);
} }
@DS("ht_oa_sqlserver") @DS("#ctpAttachmentEntity.dataSourceCode")
@Override @Override
public CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) { public CtpAttachmentEntity saveCtpAttachment(CtpAttachmentEntity ctpAttachmentEntity) {
return super.save("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_insert",ctpAttachmentEntity); return super.save("com.hzya.frame.seeyon.dao.impl.CtpAttachmentDaoImpl.entity_insert",ctpAttachmentEntity);

View File

@ -0,0 +1,17 @@
package com.hzya.frame.seeyon.dao.impl;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.seeyon.dao.ICtpAttachmentDao;
import com.hzya.frame.seeyon.dao.ICtpFileDao;
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
import com.hzya.frame.seeyon.entity.CtpFileEntity;
import org.springframework.stereotype.Repository;
/**
* @Description
* @Author xiangerlin
* @Date 2024/6/17 15:22
**/
@Repository()
public class CtpFileDaoImpl extends MybatisGenericDao<CtpFileEntity,String> implements ICtpFileDao {
}

View File

@ -0,0 +1,113 @@
package com.hzya.frame.seeyon.entity;
import com.hzya.frame.web.entity.BaseEntity;
import java.io.File;
/**
* @Description OA附件表
* @Author xiangerlin
* @Date 2021/10/29 08:56
**/
public class CtpFileEntity extends BaseEntity {
private String category;//应用类别
private String type;//类型
private String filename;//文件名
private String mime_type;//文件类型
private String create_date;
private String create_member;
private String file_size;//大小
private String description;//描述
private String update_date;
private String account_id;
private File file;//临时用
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getMime_type() {
return mime_type;
}
public void setMime_type(String mime_type) {
this.mime_type = mime_type;
}
public String getCreate_date() {
return create_date;
}
public void setCreate_date(String create_date) {
this.create_date = create_date;
}
public String getCreate_member() {
return create_member;
}
public void setCreate_member(String create_member) {
this.create_member = create_member;
}
public String getFile_size() {
return file_size;
}
public void setFile_size(String file_size) {
this.file_size = file_size;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getUpdate_date() {
return update_date;
}
public void setUpdate_date(String update_date) {
this.update_date = update_date;
}
public String getAccount_id() {
return account_id;
}
public void setAccount_id(String account_id) {
this.account_id = account_id;
}
public File getFile() {
return file;
}
public void setFile(File file) {
this.file = file;
}
}

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hzya.frame.seeyon.entity.CtpFileEntity">
<resultMap id="get-CtpFileEntity-result" type="com.hzya.frame.seeyon.entity.CtpFileEntity">
<!--主键 -->
<result property="id" column="id" />
<result property="category" column="category" />
<result property="type" column="type" />
<result property="filename" column="filename" />
<result property="mime_type" column="mime_type" />
<result property="create_date" column="create_date" />
<result property="create_member" column="create_member" />
<result property="file_size" column="file_size" />
<result property="description" column="description" />
<result property="update_date" column="update_date" />
<result property="account_id" column="account_id" />
</resultMap>
<sql id="CtpFileEntity_sql">
id,
category,
type,
filename,
mime_type,
create_date,
create_member,
file_size,
description,
update_date,
account_id
</sql>
<!-- 查询 采用==查询 -->
<select id="CtpFileEntity_list_base" resultMap="get-CtpFileEntity-result" parameterType="com.hzya.frame.seeyon.entity.CtpFileEntity">
select
<include refid="CtpFileEntity_sql"/>
from
ctp_file
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''">id = #{id}</if>
<if test="filename != null and filename != ''">and filename = #{filename}</if>
</trim>
</select>
</mapper>

View File

@ -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<CtpAttachmentEntity, String> {
/**
* 保存附件关系表
* @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;
}

View File

@ -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<CtpFileEntity, String> {
}

View File

@ -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<CtpAttachmentEntity, String> 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<CtpFileEntity> 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;
}
}

View File

@ -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<CtpFileEntity, String> implements ICtpFileService {
}

View File

@ -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<String, Object> 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<String, String> 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;
}
}

View File

@ -20,6 +20,8 @@ public class SysApplicationApiEntity extends BaseEntity {
private String appId; private String appId;
/** api应用名称 */ /** api应用名称 */
private String appName; private String appName;
/** api应用地址 **/
private String appUrl;
/** 目录 */ /** 目录 */
private String catalogueId; private String catalogueId;
/** 目录名称 */ /** 目录名称 */
@ -291,5 +293,13 @@ public class SysApplicationApiEntity extends BaseEntity {
public void setReturnSuccessValue(String returnSuccessValue) { public void setReturnSuccessValue(String returnSuccessValue) {
this.returnSuccessValue = returnSuccessValue; this.returnSuccessValue = returnSuccessValue;
} }
public String getAppUrl() {
return appUrl;
}
public void setAppUrl(String appUrl) {
this.appUrl = appUrl;
}
} }

View File

@ -10,6 +10,7 @@
<result property="apiPath" column="api_path" jdbcType="VARCHAR"/> <result property="apiPath" column="api_path" jdbcType="VARCHAR"/>
<result property="appId" column="app_id" jdbcType="VARCHAR"/> <result property="appId" column="app_id" jdbcType="VARCHAR"/>
<result property="appName" column="app_name" jdbcType="VARCHAR"/> <result property="appName" column="app_name" jdbcType="VARCHAR"/>
<result property="appUrl" column="app_url" jdbcType="VARCHAR"/>
<result property="catalogueId" column="catalogue_id" jdbcType="VARCHAR"/> <result property="catalogueId" column="catalogue_id" jdbcType="VARCHAR"/>
<result property="catalogueName" column="catalogue_name" jdbcType="VARCHAR"/> <result property="catalogueName" column="catalogue_name" jdbcType="VARCHAR"/>
<result property="apiName" column="api_name" jdbcType="VARCHAR"/> <result property="apiName" column="api_name" jdbcType="VARCHAR"/>
@ -84,6 +85,7 @@
a.id, a.id,
a.api_status, a.api_status,
b.name as app_name, b.name as app_name,
b.interfaceAddress as app_url,
a.app_id, a.app_id,
a.catalogue_id, a.catalogue_id,
c.name as catalogue_name, c.name as catalogue_name,