cbs
This commit is contained in:
parent
fa3f5eb622
commit
1039fa7295
|
@ -26,6 +26,13 @@ public interface ICbsPluginService {
|
|||
*/
|
||||
void applyPay(PaymentEntity entity)throws Exception;
|
||||
|
||||
/**
|
||||
* 保存支付申请日志
|
||||
* @param entity
|
||||
* @throws Exception
|
||||
*/
|
||||
void savePayLog(PaymentEntity entity,PayResponseDTO payResponseDTO)throws Exception;
|
||||
|
||||
/**
|
||||
* 查询支付申请的交易结果
|
||||
* @param cbsLogEntity
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package com.hzya.frame.plugin.cbs8.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
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.JSONObject;
|
||||
import com.hzya.frame.cbs8.dto.req.*;
|
||||
import com.hzya.frame.cbs8.dto.res.*;
|
||||
|
@ -13,12 +17,10 @@ import com.hzya.frame.cbs8.util.CBSUtil;
|
|||
import com.hzya.frame.cbs8.util.PayState;
|
||||
import com.hzya.frame.plugin.cbs8.service.ICbsPluginService;
|
||||
import com.hzya.frame.seeyon.cap4.form.dto.*;
|
||||
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentDetailEntity;
|
||||
import com.hzya.frame.seeyon.cbs8.entity.AgentPaymentEntity;
|
||||
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
|
||||
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
|
||||
import com.hzya.frame.seeyon.cbs8.entity.*;
|
||||
import com.hzya.frame.seeyon.cbs8.service.ICbsLogService;
|
||||
import com.hzya.frame.seeyon.cbs8.service.IPaymentService;
|
||||
import com.hzya.frame.seeyon.cbs8.service.ITransactionDetailService;
|
||||
import com.hzya.frame.seeyon.entity.CtpAttachmentEntity;
|
||||
import com.hzya.frame.seeyon.entity.CtpFileEntity;
|
||||
import com.hzya.frame.seeyon.service.ICtpAttachmentService;
|
||||
|
@ -35,6 +37,7 @@ import java.io.File;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
|
@ -52,6 +55,8 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
private ICbsLogService cbsLogService;
|
||||
@Autowired
|
||||
private ICtpAttachmentService ctpAttachmentService;
|
||||
@Autowired
|
||||
private ITransactionDetailService transactionDetailService;
|
||||
|
||||
@Autowired
|
||||
private RestUtil restUtil;
|
||||
|
@ -101,11 +106,45 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
pay.setDataSourceCode(oa_data_source_code);
|
||||
paymentService.updatePayState(pay);
|
||||
//5、记录操作日志
|
||||
cbsLogService.saveLog(new CbsLogEntity());
|
||||
savePayLog(pay,payResponseDTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存支付申请日志
|
||||
*
|
||||
* @param entity
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void savePayLog(PaymentEntity entity,PayResponseDTO payResponseDTO) throws Exception {
|
||||
//4. 保存日志
|
||||
CbsLogEntity cbsLogEntity = new CbsLogEntity();
|
||||
cbsLogEntity.setTitle(entity.getTitle());
|
||||
cbsLogEntity.setPay_company(entity.getPayCompany());
|
||||
cbsLogEntity.setPayee(entity.getRevAccountName());
|
||||
cbsLogEntity.setAmount(entity.getAmount());
|
||||
cbsLogEntity.setOa_id(entity.getOaId());
|
||||
cbsLogEntity.setBill_code(Convert.toStr(entity.getReferenceNumNew(),entity.getReferenceNum()));
|
||||
cbsLogEntity.setTab_name_ch(entity.getBillName());
|
||||
cbsLogEntity.setTab_name_en(entity.getTableName());
|
||||
Boolean successed = payResponseDTO.getSuccessed();
|
||||
if (successed){
|
||||
cbsLogEntity.setPay_state(PayState.p.getValue());
|
||||
cbsLogEntity.setApply_state(PayState.two.getValue());
|
||||
cbsLogEntity.setCbs_apply_code(payResponseDTO.getBusNum());
|
||||
cbsLogEntity.setSuccessed("true");
|
||||
entity.setPayResult(PayState.p.getValue());
|
||||
}else {
|
||||
cbsLogEntity.setPay_state("推送失败");
|
||||
cbsLogEntity.setMessage(payResponseDTO.getErrorMsg());
|
||||
cbsLogEntity.setSuccessed("false");
|
||||
entity.setPayResult("推送失败");
|
||||
}
|
||||
cbsLogService.saveLog(cbsLogEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付申请的交易结果
|
||||
*
|
||||
|
@ -117,6 +156,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
if (null == cbsLogEntity){
|
||||
cbsLogEntity = new CbsLogEntity();
|
||||
}
|
||||
cbsLogEntity.setDataSourceCode(oa_data_source_code);
|
||||
// 1、查询支付中的日志
|
||||
List<CbsLogEntity> inPayList = cbsLogService.queryInPayment(cbsLogEntity);
|
||||
if (CollectionUtils.isNotEmpty(inPayList)){
|
||||
|
@ -134,6 +174,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
//如果支付状态为空,保存支付申请状态,如果支付状态不为空,则保存支付状态
|
||||
PaymentEntity paymentEntity = new PaymentEntity();
|
||||
paymentEntity.setOaId(entity.getOa_id());
|
||||
paymentEntity.setDataSourceCode(oa_data_source_code);
|
||||
List<PaymentEntity> paymentList = paymentService.query(paymentEntity);
|
||||
if (CollectionUtils.isNotEmpty(paymentList)){
|
||||
paymentEntity = paymentList.get(0);
|
||||
|
@ -149,11 +190,13 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
paymentEntity.setPayDate(CBSUtil.convertTimestampToString(payResultResDTO.getPayDate()));
|
||||
}
|
||||
//更新视图单据状态
|
||||
paymentEntity.setDataSourceCode(oa_data_source_code);
|
||||
paymentService.updatePayState(paymentEntity);
|
||||
//更新日志表状态
|
||||
entity.setPay_state(paymentEntity.getPayResult());
|
||||
entity.setApply_state(PayState.payStateGetValue(status));
|
||||
cbsLogService.update(entity);
|
||||
entity.setDataSourceCode(oa_data_source_code);
|
||||
cbsLogService.updateLog(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -297,6 +340,18 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
*/
|
||||
@Override
|
||||
public void saveTransactionDetail(List<TransactionDetailDTO> transactionDetailList) {
|
||||
if (CollectionUtils.isNotEmpty(transactionDetailList)){
|
||||
//过滤已经保存过的数据
|
||||
for (TransactionDetailDTO dto : transactionDetailList) {
|
||||
TransactionDetailEntity transactionDetail = new TransactionDetailEntity();
|
||||
BeanUtil.copyProperties(dto,transactionDetail);
|
||||
transactionDetailService.restSave(transactionDetail);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//这个方法没用,用的是8.0批量保存方式,我没有测试
|
||||
private void saveTransactionDetailTemp(List<TransactionDetailDTO> transactionDetailList) {
|
||||
if (CollectionUtils.isNotEmpty(transactionDetailList)){
|
||||
//过滤已经保存过的数据
|
||||
for (TransactionDetailDTO dto : transactionDetailList) {
|
||||
|
@ -353,23 +408,4 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 无流程表单模版
|
||||
* @param type
|
||||
* transaction 交易明细
|
||||
* payApply 支付申请日志
|
||||
* @return
|
||||
*/
|
||||
private String getXmlTemplate(String type){
|
||||
if (StrUtil.isNotEmpty(type)){
|
||||
if ("transaction".equals(type)){
|
||||
//交易明细
|
||||
return "<forms version=\"2.1\"><formExport><summary id=\"-6287716442449165745\" name=\"formmain_0233\"/><definitions><column id=\"field0001\" type=\"0\" name=\"我方银行账户\" isNullable=\"false\" length=\"100\"/><column id=\"field0002\" type=\"0\" name=\"我方户名\" isNullable=\"false\" length=\"100\"/><column id=\"field0003\" type=\"0\" name=\"我方开户行\" isNullable=\"false\" length=\"100\"/><column id=\"field0004\" type=\"0\" name=\"我方银行类型\" isNullable=\"false\" length=\"100\"/><column id=\"field0005\" type=\"0\" name=\"交易流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0006\" type=\"3\" name=\"交易日期\" isNullable=\"false\" length=\"255\"/><column id=\"field0007\" type=\"0\" name=\"银行流水号\" isNullable=\"false\" length=\"100\"/><column id=\"field0008\" type=\"0\" name=\"币种\" isNullable=\"false\" length=\"100\"/><column id=\"field0009\" type=\"4\" name=\"收款金额\" isNullable=\"false\" length=\"20\"/><column id=\"field0010\" type=\"0\" name=\"用途\" isNullable=\"false\" length=\"800\"/><column id=\"field0011\" type=\"0\" name=\"摘要\" isNullable=\"false\" length=\"256\"/><column id=\"field0012\" type=\"0\" name=\"对方账号\" isNullable=\"false\" length=\"100\"/><column id=\"field0013\" type=\"0\" name=\"对方户名\" isNullable=\"false\" length=\"100\"/><column id=\"field0014\" type=\"0\" name=\"对方开户行\" isNullable=\"false\" length=\"100\"/><column id=\"field0015\" type=\"0\" name=\"备注\" isNullable=\"false\" length=\"800\"/></definitions><values><column name=\"我方银行账户\"><value><![CDATA[{}]]></value></column><column name=\"我方户名\"><value><![CDATA[{}]]></value></column><column name=\"我方开户行\"><value><![CDATA[{}]]></value></column><column name=\"我方银行类型\"><value><![CDATA[{}]]></value></column><column name=\"交易流水号\"><value><![CDATA[{}]]></value></column><column name=\"交易日期\"><value><![CDATA[{}]]></value></column><column name=\"银行流水号\"><value><![CDATA[{}]]></value></column><column name=\"币种\"><value><![CDATA[{}]]></value></column><column name=\"收款金额\"><value><![CDATA[{}]]></value></column><column name=\"用途\"><value><![CDATA[{}]]></value></column><column name=\"摘要\"><value><![CDATA[{}]]></value></column><column name=\"对方账号\"><value><![CDATA[{}]]></value></column><column name=\"对方户名\"><value><![CDATA[{}]]></value></column><column name=\"对方开户行\"><value><![CDATA[{}]]></value></column><column name=\"备注\"><value><![CDATA[{}]]></value></column></values><subForms/></formExport></forms>";
|
||||
}else if ("payApply".equals(type)){
|
||||
//支付日志
|
||||
return "<forms version=\"2.1\"><formExport><summary id=\"9195604394844442459\" name=\"formmain_0232\"/><definitions><column id=\"field0002\" type=\"0\" name=\"流程标题\" isNullable=\"false\" length=\"100\"/><column id=\"field0003\" type=\"0\" name=\"付款主体公司\" isNullable=\"false\" length=\"100\"/><column id=\"field0004\" type=\"0\" name=\"收款人\" isNullable=\"false\" length=\"100\"/><column id=\"field0019\" type=\"4\" name=\"金额\" isNullable=\"false\" length=\"20\"/><column id=\"field0005\" type=\"0\" name=\"CBS支付申请单号\" isNullable=\"false\" length=\"100\"/><column id=\"field0006\" type=\"0\" name=\"OA单据编号\" isNullable=\"false\" length=\"100\"/><column id=\"field0007\" type=\"0\" name=\"OA单据ID\" isNullable=\"false\" length=\"100\"/><column id=\"field0008\" type=\"0\" name=\"OA中文表名\" isNullable=\"false\" length=\"100\"/><column id=\"field0009\" type=\"0\" name=\"OA数据库表名\" isNullable=\"false\" length=\"100\"/><column id=\"field0010\" type=\"0\" name=\"支付状态\" isNullable=\"false\" length=\"100\"/><column id=\"field0011\" type=\"0\" name=\"支付信息\" isNullable=\"false\" length=\"100\"/><column id=\"field0012\" type=\"0\" name=\"支付申请状态\" isNullable=\"false\" length=\"100\"/><column id=\"field0014\" type=\"0\" name=\"成功标记\" isNullable=\"false\" length=\"100\"/></definitions><values><column name=\"流程标题\"><value><![CDATA[{}]]></value></column><column name=\"付款主体公司\"><value><![CDATA[{}]]></value></column><column name=\"收款人\"><value><![CDATA[{}]]></value></column><column name=\"金额\"><value><![CDATA[{}]]></value></column><column name=\"CBS支付申请单号\"><value><![CDATA[{}]]></value></column><column name=\"OA单据编号\"><value><![CDATA[{}]]></value></column><column name=\"OA单据ID\"><value><![CDATA[{}]]></value></column><column name=\"OA中文表名\"><value><![CDATA[{}]]></value></column><column name=\"OA数据库表名\"><value><![CDATA[{}]]></value></column><column name=\"支付状态\"><value><![CDATA[{}]]></value></column><column name=\"支付信息\"><value><![CDATA[{}]]></value></column><column name=\"支付申请状态\"><value><![CDATA[{}]]></value></column><column name=\"成功标记\"><value><![CDATA[{}]]></value></column></values><subForms/></formExport></forms>";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue