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 36baa131..d013e070 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 @@ -105,7 +105,7 @@ public class PayApplyPluginInitializer extends PluginBaseEntity { if (null == paymentEntity) paymentEntity = new PaymentEntity(); //支付申请 - paymentEntity.setOaId("8475071606892874568"); + //paymentEntity.setOaId("8475071606892874568"); cbsPluginService.applyPay(paymentEntity); return null; } 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 f560a661..5f0c5f1d 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 @@ -26,6 +26,7 @@ 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.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; import com.hzya.frame.uuid.UUIDLong; import com.hzya.frame.web.exception.BaseSystemException; import org.apache.commons.collections.CollectionUtils; @@ -35,10 +36,7 @@ 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.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.stream.Collectors; /** @@ -83,21 +81,6 @@ public class CbsPluginServiceImpl implements ICbsPluginService { } paymentEntity.setDataSourceCode(oa_data_source_code); List paymentList = paymentService.queryUnpaid(paymentEntity); - /* List paymentList = new ArrayList<>(); - paymentEntity.setReferenceNum("CL202406140001"); - paymentEntity.setPayAccount("655905707410000"); - paymentEntity.setPayBankName(""); - paymentEntity.setAmount("99"); - paymentEntity.setRevAccount("123456778"); - paymentEntity.setRevBankName("中国工商银行总行清算中心"); - paymentEntity.setRevBankType("ICB"); - paymentEntity.setRevAccountName("测试账户"); - paymentEntity.setCnapsCode("102100099996"); - paymentEntity.setPurpose("测试用途"); - paymentEntity.setBusType("202"); - paymentEntity.setCurrency("10"); - paymentEntity.setPurpose("测试用途"); - paymentList.add(paymentEntity);*/ if (CollectionUtils.isNotEmpty(paymentList)){ for (PaymentEntity pay : paymentList) { //调用支付申请接口 @@ -112,7 +95,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService { pay.setDataSourceCode(oa_data_source_code); pay.setApplyCode(payResponseDTO.getBusNum()); paymentService.updatePayState(pay); - //5、记录操作日志 + //5、记录操作日志到OA底表 savePayLog(pay,payResponseDTO); } } diff --git a/service/src/main/java/com/hzya/frame/cbs8/dto/res/PayResponseDTO.java b/service/src/main/java/com/hzya/frame/cbs8/dto/res/PayResponseDTO.java index 2534d4f8..65e68c5d 100644 --- a/service/src/main/java/com/hzya/frame/cbs8/dto/res/PayResponseDTO.java +++ b/service/src/main/java/com/hzya/frame/cbs8/dto/res/PayResponseDTO.java @@ -1,5 +1,12 @@ package com.hzya.frame.cbs8.dto.res; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import org.apache.commons.collections.CollectionUtils; + +import java.util.List; + /** * @Description 经办支付接口返回参数中的data节点 * @Author xiangerlin @@ -70,4 +77,22 @@ public class PayResponseDTO { public void setSuccessed(Boolean successed) { this.successed = successed; } + + /** + * 从银行响应报文解析 + * @param result + * @return + */ + public static PayResponseDTO payResValueOf(String result){ + if (StrUtil.isNotEmpty(result)){ + CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); + List dataList = cbsResponseDTO.getData(); + if (CollectionUtils.isNotEmpty(dataList)){ + JSONObject o = dataList.get(0); + PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class); + return payResponseDTO; + } + } + return new PayResponseDTO(); + } } 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 5f47a625..91ae238a 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 @@ -1,6 +1,7 @@ package com.hzya.frame.cbs8.service; import com.hzya.frame.sysnew.application.entity.SysExtensionApiEntity; +import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity; /** * @Description @@ -16,6 +17,11 @@ public interface ICbs8ExtService { */ SysExtensionApiEntity payApply(SysExtensionApiEntity entity); + /** + * 支付申请回调 + * @param logEntity + */ + void payApplyCallBack(SysMessageManageLogEntity logEntity); /** * 代发代扣 支付申请 * @param entity 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 accce4ca..5272ba7c 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,17 +4,22 @@ import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import com.hzya.frame.cbs8.dto.req.*; +import com.hzya.frame.cbs8.dto.res.PayResponseDTO; import com.hzya.frame.cbs8.service.ICbs8ExtService; import com.hzya.frame.cbs8.util.CBSUtil; import com.hzya.frame.cbs8.util.CbsAccessToken; 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.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity; +import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService; +import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity; import com.hzya.frame.web.exception.BaseSystemException; import org.apache.http.protocol.HTTP; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; + import java.util.*; /** @@ -27,6 +32,8 @@ import java.util.*; public class Cbs8ExtServiceImpl implements ICbs8ExtService { Logger logger = LoggerFactory.getLogger(getClass()); + private IIntegrationTaskLivingDetailsService taskLivingDetailsService; + /** * 支付经办 * @@ -36,11 +43,11 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity payApply(SysExtensionApiEntity entity) { String bodys = entity.getBodys(); - if (StrUtil.isNotEmpty(bodys)){ - PaymentEntity paymentEntity = JSONObject.parseObject(bodys,PaymentEntity.class); - if (null != paymentEntity){ + if (StrUtil.isNotEmpty(bodys)) { + PaymentEntity paymentEntity = JSONObject.parseObject(bodys, PaymentEntity.class); + if (null != paymentEntity) { PayRequestDTO payRequestDTO = new PayRequestDTO(); - String ferenceNum = Convert.toStr(paymentEntity.getReferenceNumNew(),paymentEntity.getReferenceNum()); + String ferenceNum = Convert.toStr(paymentEntity.getReferenceNumNew(), paymentEntity.getReferenceNum()); payRequestDTO.setReferenceNum(ferenceNum); payRequestDTO.setBusType(paymentEntity.getBusType()); payRequestDTO.setAmount(paymentEntity.getAmount()); @@ -54,7 +61,7 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { payRequestDTO.setPurpose(paymentEntity.getPurpose()); payRequestDTO.setErpExtend1(paymentEntity.getPayType()); //集中支付模式 - if (CBSUtil.CENTRALIZED_PAYMENT_TYPE.equals(payRequestDTO.getBusType())){ + if (CBSUtil.CENTRALIZED_PAYMENT_TYPE.equals(payRequestDTO.getBusType())) { payRequestDTO.setBusiStep("1"); payRequestDTO.setApplyUnitCode(paymentEntity.getPayCompanyCode()); payRequestDTO.setPayAccount(null); @@ -62,12 +69,55 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { List list = Arrays.asList(payRequestDTO); String requestData = JSONObject.toJSONString(list); //加密 签名 - encrypAndsign(entity,requestData); + encrypAndsign(entity, requestData); + entity.setBodys(requestData); } } return entity; } + /** + * 支付申请回调 + * + * @param logEntity + */ + @Override + public void payApplyCallBack(SysMessageManageLogEntity logEntity) { + try { + logger.info("回调方法里的参数:{}", JSONObject.toJSONString(logEntity)); + JSONObject targetData = JSONObject.parseObject(logEntity.getTargetData());//目标数据 + JSONObject sourceData = JSONObject.parseObject(logEntity.getSourceData());//源数据 + JSONObject sourceHeaders = sourceData.getJSONObject("header");//源header + JSONObject targetHeaders = targetData.getJSONObject("header");//目标header + JSONObject sourceBody = sourceData.getJSONObject("body");//源数据body + //自定义参数,存放的是请求报文明文 + String hzyaExtData = targetHeaders.getString("hzyaExtData"); + String returnDataBase64 = logEntity.getReturnData(); + byte[] secretResByte = Base64.getDecoder().decode(returnDataBase64); + //解密报文 + String decryptRes = CBSUtil.decrypt(secretResByte); + //6、记录系统日志 + IntegrationTaskLivingDetailsEntity logTask = new IntegrationTaskLivingDetailsEntity(); + logTask.setRootAppPk(sourceBody.getString("formsonId")); + logTask.setRootAppBill(sourceBody.getString("referenceNum")); + logTask.setPluginId("CBS8PayApplyPlugin"); + //对方接口返回信息 + logTask.setNewTransmitInfo(decryptRes); + logTask.setNewPushDate(new Date()); + //调用接口请求参数 + logTask.setRootAppNewData(hzyaExtData); + PayResponseDTO payResponseDTO = PayResponseDTO.payResValueOf(decryptRes); + //为true是成功 + if (payResponseDTO.getSuccessed()) { + taskLivingDetailsService.saveLogToSuccess(logTask); + }else { + taskLivingDetailsService.saveLogToFail(logTask); + } + } catch (Exception e) { + logger.info("payApplyCallBack方法执行出错:{}",e); + } + } + /** * 代发代扣 支付申请 * @@ -77,8 +127,8 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity agentPayApply(SysExtensionApiEntity entity) { String boyds = entity.getBodys(); - if (StrUtil.isNotEmpty(boyds)){ - AgentPayRequestDTO agentPayRequest = JSONObject.parseObject(boyds,AgentPayRequestDTO.class); + if (StrUtil.isNotEmpty(boyds)) { + AgentPayRequestDTO agentPayRequest = JSONObject.parseObject(boyds, AgentPayRequestDTO.class); String requestData = JSONObject.toJSONString(agentPayRequest); //加密签名 encrypAndsign(entity, requestData); @@ -95,13 +145,13 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity payResult(SysExtensionApiEntity entity) { String bodys = entity.getBodys(); - if (StrUtil.isNotEmpty(bodys)){ - PayResultRequestDTO payResultRequest = JSONObject.parseObject(bodys,PayResultRequestDTO.class); - if (null != payResultRequest && StrUtil.isNotEmpty(payResultRequest.getReferenceNum())){ + if (StrUtil.isNotEmpty(bodys)) { + PayResultRequestDTO payResultRequest = JSONObject.parseObject(bodys, PayResultRequestDTO.class); + if (null != payResultRequest && StrUtil.isNotEmpty(payResultRequest.getReferenceNum())) { String requestData = JSONObject.toJSONString(payResultRequest); //加密 签名 - encrypAndsign(entity,requestData); - }else { + encrypAndsign(entity, requestData); + } else { throw new BaseSystemException("业务参考号不能为空!!!!"); } } @@ -117,8 +167,8 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity transactionDetailQuery(SysExtensionApiEntity entity) { String bodys = entity.getBodys(); - if (StrUtil.isNotEmpty(bodys)){ - TransactionDetailReqDTO transactionDetailReqDTO = JSONObject.parseObject(bodys,TransactionDetailReqDTO.class); + if (StrUtil.isNotEmpty(bodys)) { + TransactionDetailReqDTO transactionDetailReqDTO = JSONObject.parseObject(bodys, TransactionDetailReqDTO.class); String requestData = JSONObject.toJSONString(transactionDetailReqDTO); ////加密签名 encrypAndsign(entity, requestData); @@ -135,8 +185,8 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity payApplyAgent(SysExtensionApiEntity entity) { String bodys = entity.getBodys(); - if (StrUtil.isNotEmpty(bodys)){ - AgentPayRequestDTO agentPayRequest = JSONObject.parseObject(bodys,AgentPayRequestDTO.class); + if (StrUtil.isNotEmpty(bodys)) { + AgentPayRequestDTO agentPayRequest = JSONObject.parseObject(bodys, AgentPayRequestDTO.class); String requestData = JSONObject.toJSONString(agentPayRequest); ////加密签名 encrypAndsign(entity, requestData); @@ -145,7 +195,6 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { } - /** * 代发代扣结果查询 * @@ -155,10 +204,10 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity payApplyAgentResult(SysExtensionApiEntity entity) { String bodys = entity.getBodys(); - if (StrUtil.isNotEmpty(bodys)){ - AgentPayResultRequestDTO agentPayResultRequestDTO = JSONObject.parseObject(bodys,AgentPayResultRequestDTO.class); + if (StrUtil.isNotEmpty(bodys)) { + AgentPayResultRequestDTO agentPayResultRequestDTO = JSONObject.parseObject(bodys, AgentPayResultRequestDTO.class); String requestData = JSONObject.toJSONString(agentPayResultRequestDTO); - encrypAndsign(entity,requestData); + encrypAndsign(entity, requestData); } return entity; } @@ -172,11 +221,11 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { @Override public SysExtensionApiEntity elecQuery(SysExtensionApiEntity entity) { String bodys = entity.getBodys(); - if (StrUtil.isNotEmpty(bodys)){ - ElecRequestDTO elecRequestDTO = JSONObject.parseObject(bodys,ElecRequestDTO.class); + if (StrUtil.isNotEmpty(bodys)) { + ElecRequestDTO elecRequestDTO = JSONObject.parseObject(bodys, ElecRequestDTO.class); String requestData = JSONObject.toJSONString(elecRequestDTO); //加密 签名 - encrypAndsign(entity,requestData); + encrypAndsign(entity, requestData); } return entity; } @@ -184,32 +233,35 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService { /** * 请求头 + * * @param sign * @param timestamp * @return */ - private Map headersValueOf(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()); + private Map headersValueOf(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; } /** * 加密 签名 - * @param entity 接口转发参数对象 + * + * @param entity 接口转发参数对象 * @param requestData 请求参数json字符串 */ private void encrypAndsign(SysExtensionApiEntity entity, String requestData) { //签名 long timestamp = System.currentTimeMillis(); - logger.info("CBS请求参数明文:{}",requestData); - String sign = CBSUtil.sign(requestData,timestamp); + logger.info("CBS请求参数明文:{}", requestData); + String sign = CBSUtil.sign(requestData, timestamp); //加密 byte[] encryptedData = CBSUtil.encrypt(requestData); - Map header = headersValueOf(sign,timestamp); + Map header = headersValueOf(sign, timestamp); + header.put("hzyaExtData", requestData); entity.setByteBodys(encryptedData); entity.setHeaders(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 6b57738e..bdefa4a9 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 @@ -47,16 +47,17 @@ public class Cbs8ServiceImpl implements ICbs8Service { String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(JSONObject.toJSONString(paymentEntity)).timeout(60000).execute().body(); //解密响应报文 String result = decryptResBody(body); - if (StrUtil.isNotEmpty(result)){ - CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); - List dataList = cbsResponseDTO.getData(); - if (CollectionUtils.isNotEmpty(dataList)){ - JSONObject o = dataList.get(0); - PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class); - return payResponseDTO; - } - } - return new PayResponseDTO(); + PayResponseDTO payResponseDTO = PayResponseDTO.payResValueOf(result); +// if (StrUtil.isNotEmpty(result)){ +// CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); +// List dataList = cbsResponseDTO.getData(); +// if (CollectionUtils.isNotEmpty(dataList)){ +// JSONObject o = dataList.get(0); +// PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class); +// return payResponseDTO; +// } +// } + return payResponseDTO; } /** @@ -205,16 +206,17 @@ public class Cbs8ServiceImpl implements ICbs8Service { .build(); String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(params).timeout(60000).execute().body(); String result = decryptResBody(body); - if (StrUtil.isNotEmpty(result)){ - CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); - List dataList = cbsResponseDTO.getData(); - if (CollectionUtils.isNotEmpty(dataList)){ - JSONObject o = dataList.get(0); - PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class); - return payResponseDTO; - } - } - return new PayResponseDTO(); + PayResponseDTO payResponseDTO = PayResponseDTO.payResValueOf(result); +// if (StrUtil.isNotEmpty(result)){ +// CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class); +// List dataList = cbsResponseDTO.getData(); +// if (CollectionUtils.isNotEmpty(dataList)){ +// JSONObject o = dataList.get(0); +// PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class); +// return payResponseDTO; +// } +// } + return payResponseDTO; } /** diff --git a/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml b/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml index b8d3deee..410dca31 100644 --- a/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml +++ b/service/src/main/java/com/hzya/frame/seeyon/cbs8/entity/PaymentEntity.xml @@ -76,6 +76,7 @@ SELECT formmain_0209.id as oaId, -- 主表id formson_0210.formsonId, + formson_0210.sort, 'formson_0210' as tableName, -- 表名 COL_SUMMARY.SUBJECT as title, -- 单据标题 unit.name as payCompany, -- 付款公司 @@ -136,11 +137,148 @@ field0072, field0073, field0080 + ORDER BY formmain_id,sort )formson_0210 LEFT JOIN formmain_0209 ON formson_0210.FORMMAIN_ID = formmain_0209.id LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0209.id left join CTP_ENUM_ITEM item on item.id =formson_0210.field0070 left join ORG_UNIT unit on unit.id =formmain_0209.field0002 + union all + SELECT + formmain_0094.id as oaId, -- 主表id + formson_0223.formsonId AS formsonId,-- 明细表id + formson_0223.sort, + 'formson_0223' as tableName, -- 表名 + COL_SUMMARY.SUBJECT as title, -- 单据标题 + formmain_0094.field0006 as payCompany, -- 付款公司 + '财务报销审批表(集团外)' as billName, + 'field0052' as payResultField, -- 支付结果字段 + 'field0053' as payDateField, -- 打款日期字段 + 'field0060' AS applyCodeField,-- CBS支付申请单号 + '' as receiptFiled,-- 电子回单字段 + COL_SUMMARY.id as summaryId, + formmain_0094.field0001||'-'||formson_0223.sort as referenceNum, -- 单据编号 + formmain_0094.START_DATE as startDate, -- 单据日期 + formmain_0094.FINISHEDFLAG as finishedflag, -- 流程状态 + formson_0223.field0053 as payDate, -- 打款日期 + formson_0223.field0052 as payResult, -- 支付结果 + formson_0223.field0060 AS applyCode,-- 支付申请单号 + REGEXP_REPLACE(formmain_0094.field0024, '[[:space:]]', '') as payAccount, -- 付款账户 + REGEXP_REPLACE(formmain_0094.field0025, '[[:space:]]', '') as payBankName, -- 付款开户行 + formmain_0094.field0054 as amount, -- 金额 + formmain_0094.field0007 as purpose, -- 用途 + formmain_0094.field0007 as cbsAbstract, -- 摘要 + REGEXP_REPLACE(formson_0223.field0050, '[[:space:]]', '') as revAccount, -- 收款账户 + formson_0223.field0049 as revBankName, -- 收款开户行 + formson_0223.field0056 as revAccountName, -- 收款人 + REGEXP_REPLACE(formson_0223.field0051, '[[:space:]]', '') as cnapsCode, -- 收款联行号 + item.ENUMVALUE as personalFlag,-- 公私标记 + formson_0223.field0059 as revBankType, + '10' as currency, + '202' as busType, + '' as receipt -- 电子回单 + from + ( + SELECT + wm_concat(id) AS formsonId, + formmain_id, + sum(field0041) AS field0041,-- 金额 + min(sort) AS sort, + field0049,-- 收方开户行 + field0050,-- 收方账户 + field0051,-- 收方联行号 + field0059,-- 收方银行类型 + field0056,-- 收方名称 + field0048,-- 公私标记 + field0052,-- 支付结果 + field0053,-- 支付时间 + field0060-- 支付申请单号 + FROM + formson_0223 + WHERE field0047 = '-5486592002512828355'-- 是否本次支付 + GROUP BY + formmain_id, + field0049, + field0050, + field0051, + field0059, + field0056, + field0048, + field0052, + field0053, + field0060 + ORDER BY formmain_id,sort + )formson_0223 + LEFT JOIN formmain_0094 ON formson_0223.FORMMAIN_ID = formmain_0094.id + LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0094.id + left join CTP_ENUM_ITEM item on item.id =formson_0223.field0048 + UNION ALL + SELECT + formmain_0093.id as oaId, -- 主表id + formson_0222.formsonId, + formson_0222.sort, + 'formson_0222' as tableName, -- 表名 + COL_SUMMARY.SUBJECT as title, -- 单据标题 + formmain_0093.field0006 as payCompany, -- 付款公司 + formmain_0093.field0087 as billName, + 'field0069' as payResultField, -- 支付结果字段 + 'field0070' as payDateField, -- 打款日期字段 + 'field0086' AS applyCodeField,-- cbs支付申请单号 + '' as receiptFiled,-- 电子回单字段 + COL_SUMMARY.id as summaryId, + formmain_0093.field0001||'-'||formson_0222.sort as referenceNum, -- 单据编号 + formmain_0093.START_DATE as startDate, -- 单据日期 + formmain_0093.FINISHEDFLAG as finishedflag, -- 流程状态 + formson_0222.field0070 as payDate, -- 打款日期 + formson_0222.field0069 as payResult, -- 支付结果 + formson_0222.field0086 AS applyCode,-- 支付申请单号 + REGEXP_REPLACE(formmain_0093.field0019, '[[:space:]]', '') as payAccount, -- 付款账户 + REGEXP_REPLACE(formmain_0093.field0018, '[[:space:]]', '') as payBankName, -- 付款开户行 + formmain_0093.field0071 as amount, -- 金额 + formmain_0093.field0022 as purpose, -- 用途 + formmain_0093.field0022 as cbsAbstract, -- 摘要 + REGEXP_REPLACE(formson_0222.field0067, '[[:space:]]', '') as revAccount, -- 收款账户 + formson_0222.field0066 as revBankName, -- 收款开户行 + formson_0222.field0082 as revAccountName, -- 收款人 + REGEXP_REPLACE(formson_0222.field0068, '[[:space:]]', '') as cnapsCode, -- 收款联行号 + item.enumvalue as personalFlag,-- 公私标记 + formson_0222.field0085 as revBankType, + '10' as currency, + '202' as busType, + '' as receipt -- 电子回单 + from + ( + SELECT + wm_concat(id) AS formsonId, + formmain_id, + sum(field0057) AS field0041,-- 金额 + min(sort) AS sort, + field0066,-- 收方开户行 + field0067,-- 收方账户 + field0068,-- 收方联行号 + field0085,-- 收方银行类型 + field0082,-- 收方名称 + field0065,-- 公私标记 + field0069,-- 支付结果 + field0070,-- 支付时间 + field0086-- 支付申请单号 + FROM formson_0222 + GROUP BY + formmain_id, + field0066, + field0067, + field0068, + field0085, + field0082, + field0065, + field0069, + field0070, + field0086 + ORDER BY formmain_id,sort + )formson_0222 + LEFT JOIN formmain_0093 ON formson_0222.FORMMAIN_ID = formmain_0093.id + LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0093.id + left join CTP_ENUM_ITEM item on item.id =formson_0222.field0065 @@ -276,6 +414,7 @@ and v.finishedflag = #{finishedflag} and v.amount > 0 and v.payResult is null + and v.finishedflag = 1 diff --git a/service/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java b/service/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java index bb2df76f..4446877b 100644 --- a/service/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java +++ b/service/src/main/java/com/hzya/frame/seeyon/cbs8/service/impl/CbsLogServiceImpl.java @@ -111,7 +111,7 @@ public class CbsLogServiceImpl extends BaseService implemen logEntity.setBill_code(cbsLogEntity.getBill_code()); logEntity.setDataSourceCode(oa_data_source_code); try { - update(logEntity); + updateLog(logEntity); }catch (Exception e){ e.printStackTrace(); logger.error("更新");