Compare commits

...

84 Commits

Author SHA1 Message Date
xiang2lin 03afc47268 Merge branch 'yuecheng-project' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-23 11:35:26 +08:00
xiang2lin 068c5a5972 重试交易修改
2024年7月23日 11:34:37
2024-07-23 11:34:48 +08:00
yuqh bcece745c1 Merge remote-tracking branch 'origin/yuecheng-project' into yuecheng-project 2024-07-23 11:20:20 +08:00
yuqh 3dae883102 堃博OA对接宁波银行 2024-07-23 11:20:07 +08:00
lvleigang 49e216eb0c Merge branch 'yuecheng-project' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-17 14:20:38 +08:00
lvleigang dae8255a93 主数据下发修改业务调整 2024-07-17 14:20:28 +08:00
xiang2lin 97a8b99d8b 不同银行参数处理
2024年7月17日 10:05:03
2024-07-17 10:05:09 +08:00
xiang2lin 07f80f0552 查询语句修改
2024年7月16日 15:04:16
2024-07-16 15:04:22 +08:00
xiang2lin 1a08603535 公司数据源域名修改
2024年7月16日 15:01:34
2024-07-16 15:01:39 +08:00
xiang2lin 7ef5aba728 cbs插件测试
2024年7月16日 15:01:07
2024-07-16 15:01:12 +08:00
lvleigang 5de635b0cb Merge branches 'dev' and 'yuecheng-project' of http://ufidahz.com.cn:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-15 14:45:21 +08:00
xiang2lin beedfe51e2 不同银行代发字段设置
2024年7月15日 10:40:09
2024-07-15 10:40:14 +08:00
xiang2lin 59de267038 增加字段
2024年7月15日 10:39:42
2024-07-15 10:39:51 +08:00
xiang2lin 357453c017 工资代发
2024年7月12日 16:23:11
2024-07-12 16:23:18 +08:00
xiang2lin 5fc9b8319e 工资代发
2024年7月12日 16:22:31
2024-07-12 16:22:43 +08:00
xiang2lin 89a1182f26 Merge branch 'dev' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-11 10:45:38 +08:00
xiang2lin 97d5129ca5 保存日志 2024-07-11 10:45:13 +08:00
xiang2lin 943829f8d7 重试参数 2024-07-10 18:34:01 +08:00
xiang2lin 043f7704aa 重试参数 2024-07-10 18:33:47 +08:00
xiang2lin 4ae3c5b623 Merge remote-tracking branch 'origin/yuecheng-project' into yuecheng-project 2024-07-10 16:05:59 +08:00
yuqh 0f93bce5ba 收款与付款信息 2024-07-08 10:01:35 +08:00
yuqh bcae9c8a05 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-08 10:01:03 +08:00
xiang2lin 17e173392f 测试 2024-07-06 14:51:30 +08:00
xiang2lin 13c5c5dab5 日志service引入
2024年7月5日 15:59:14
2024-07-05 15:59:19 +08:00
xiang2lin afb1b83427 cbs pubKey修改
2024年7月5日 15:46:22
2024-07-05 15:46:26 +08:00
lvleigang 8fc7f351b1 日志 2024-07-05 15:45:07 +08:00
xiang2lin 3f64961d20 cbs pubKey修改
2024年7月5日 15:43:58
2024-07-05 15:44:03 +08:00
lvleigang 9d409413ab 日志 2024-07-05 15:27:21 +08:00
xiang2lin a6555d0c58 打印日志 2024-07-05 13:58:01 +08:00
lvleigang e03491cddd Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-05 13:39:56 +08:00
lvleigang 9f0fefc503 修改主数据 2024-07-05 13:39:35 +08:00
xiang2lin 8bbb653364 初始化参数修改
2024年7月5日 12:42:10
2024-07-05 12:42:14 +08:00
lvleigang 5eee3be6c0 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project
 Conflicts:
	service/src/main/java/com/hzya/frame/cbs8/service/impl/Cbs8ExtServiceImpl.java
2024-07-05 11:34:40 +08:00
lvleigang 45d79526ae 修改主数据 2024-07-05 11:33:52 +08:00
xiang2lin 514b7fd387 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-05 11:30:40 +08:00
xiang2lin 4f3ad2e410 打印日志 2024-07-05 11:30:18 +08:00
lvleigang ccfb478ce9 修改主数据 2024-07-05 11:01:49 +08:00
xiang2lin 4df2832c59 打印日志 2024-07-05 10:36:45 +08:00
xiang2lin 4d7763cea5 打印日志 2024-07-05 10:16:07 +08:00
xiang2lin e1b993b580 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-05 10:14:42 +08:00
xiang2lin 9425dcd48a 打印日志 2024-07-05 10:14:33 +08:00
lvleigang 7080685aad Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-05 09:19:16 +08:00
yuqh 86b2808b9c 收付款单 2024-07-05 09:17:46 +08:00
xiang2lin 68083196ee 更新工资发放查询结果时,把支付时间更新到主表
2024年7月4日 16:54:31
2024-07-04 16:54:37 +08:00
xiang2lin 81448dbc47 工资发放主表增加支付时间字段
2024年7月4日 16:53:50
2024-07-04 16:53:56 +08:00
xiang2lin 5550b7fe79 oa数据源编码修改 2024-07-04 16:17:48 +08:00
yuqh 650a7f3dae Merge remote-tracking branch 'origin/yuecheng-project' into yuecheng-project 2024-07-04 16:15:00 +08:00
yuqh 49aaccd8fa 付款单 2024-07-04 16:14:50 +08:00
xiang2lin c034abc1d5 增加oa数据源编码 2024-07-04 16:13:09 +08:00
lvleigang abe1500dde Merge branches 'dev' and 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-04 15:48:52 +08:00
xiang2lin 290243f8be 注视没用的代码 2024-07-04 15:44:41 +08:00
xiang2lin 965454a1c7 externalCallInterfaceToESB 返回值改成base64编码后的字符串,原先返回的是byte[]
2024年7月4日 15:20:05
2024-07-04 15:20:17 +08:00
xiang2lin f7325c3d8e Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-04 14:19:15 +08:00
xiang2lin 3bc9b11dda 去掉查询条件
2024年7月4日 12:57:21
2024-07-04 14:18:55 +08:00
lvleigang e4319a17d8 Merge branches 'dev' and 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project
 Conflicts:
	service/src/main/java/com/hzya/frame/mdm/mdmModule/service/impl/MdmModuleServiceImpl.java
2024-07-04 13:58:02 +08:00
lvleigang f99ea46e16 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-04 13:40:54 +08:00
lvleigang 4496f11c8c 修改主数据 2024-07-04 13:34:59 +08:00
xiang2lin 61afdb4552 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-04 12:57:43 +08:00
xiang2lin bef253f924 去掉查询条件
2024年7月4日 12:57:21
2024-07-04 12:57:24 +08:00
xiang2lin 3769d1601d 增加流程结束状态
2024年7月4日 12:54:43
2024-07-04 12:54:48 +08:00
xiang2lin 020e5955e8 去掉todo
2024年7月4日 10:20:04
2024-07-04 12:52:42 +08:00
yuqh 8aad897d67 开始堆si山代码 2024-07-04 12:06:24 +08:00
yuqh d873dce529 MDM公用文件 2024-07-04 11:59:44 +08:00
xiang2lin a4c8399995 去掉todo
2024年7月4日 10:20:04
2024-07-04 10:20:08 +08:00
xiang2lin 25696996d7 保存日志 2024-07-04 10:19:51 +08:00
xiang2lin 9fd9436d94 Merge branch 'yuecheng-project' of http://hzya.ufyct.com:9015/root/kangarooDataCenterV3 into yuecheng-project 2024-07-02 13:46:34 +08:00
xiang2lin a4875f3392 暂存 2024-07-02 13:46:23 +08:00
lvleigang d57bba9621 修改适配达梦 2024-07-02 13:35:27 +08:00
lvleigang 8c138a7a7c 通用数据jsonobject的key为空情况修复 2024-07-02 09:28:49 +08:00
lvleigang da0773b0cf 越城区测试token拼接失败问题 2024-07-01 16:46:59 +08:00
lvleigang f4e670c2e1 越城区测试token拼接失败问题 2024-07-01 16:31:50 +08:00
lvleigang 17f3550068 越城区测试token拼接失败问题 2024-07-01 16:29:26 +08:00
lvleigang 5d68660e1b 越城区测试token拼接失败问题 2024-07-01 16:02:46 +08:00
lvleigang 2214d86ee0 越城区测试token拼接失败问题 2024-07-01 16:01:13 +08:00
lvleigang 94fd4cbf51 越城区测试token拼接失败问题 2024-07-01 15:39:19 +08:00
xiang2lin 5f748a699c 暂存 2024-07-01 15:00:23 +08:00
hecan 52d60580b9 如果没有子表,移除掉jsonobjectList中key为null的 2024-07-01 13:43:21 +08:00
yuqh 822a2d43eb MDM公用文件 2024-07-01 11:42:07 +08:00
yuqh 61d200d06c Merge remote-tracking branch 'origin/yuecheng-project' into yuecheng-project 2024-07-01 11:30:22 +08:00
yuqh 260f562e9b MDM公用文件 2024-07-01 11:30:01 +08:00
xiang2lin bd18c8aa75 暂存 2024-06-29 15:50:48 +08:00
xiang2lin c90f91b2b2 增加资金使用审批表sql语句 2024-06-29 15:28:21 +08:00
xiang2lin 109fb9ce59 删掉没用的数据 2024-06-29 15:26:38 +08:00
xiang2lin 083d91d6e7 待支付列表语句增加 2024-06-28 10:28:52 +08:00
43 changed files with 1390 additions and 398 deletions

View File

@ -3,6 +3,7 @@ package com.hzya.frame.plugin.cbs8.plugin;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.cbs8.service.ICbsPluginService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -96,6 +97,6 @@ public class ElecBillPluginInitializer extends PluginBaseEntity {
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
cbsPluginService.elecBillUpload(requestJson);
return null;
return BaseResult.getSuccessMessageEntity("cbs8电子回单插件执行成功");
}
}

View File

@ -109,7 +109,7 @@ public class PayApplyAgentPluginInitializer extends PluginBaseEntity {
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
//1查询代支付的
AgentPaymentEntity agentPaymentEntity = new AgentPaymentEntity();
agentPaymentEntity.setOaId("4442823497745714629");
//agentPaymentEntity.setOaId("4442823497745714629");
cbsPluginService.applyAgentPay(agentPaymentEntity);
return null;
}

View File

@ -1,9 +1,13 @@
package com.hzya.frame.plugin.cbs8.plugin;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.plugin.cbs8.service.ICbsPluginService;
import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -19,7 +23,8 @@ public class PayApplyPluginInitializer extends PluginBaseEntity {
@Autowired
private ICbsPluginService cbsPluginService;
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
/***
* 插件初始化方法
* @Author 👻👻👻👻👻👻👻👻 gjh
@ -102,11 +107,28 @@ public class PayApplyPluginInitializer extends PluginBaseEntity {
requestJson.remove("jsonStr");
paymentEntity = JSONObject.parseObject(requestJson.toString(),PaymentEntity.class);
}
if (null == paymentEntity)
if (null == paymentEntity){
paymentEntity = new PaymentEntity();
}
String taskDetailId = requestJson.getString("integration_task_living_details_id");
if (StrUtil.isNotEmpty(taskDetailId)){
//查询日志里的参数
//查询日志表
IntegrationTaskLivingDetailsEntity taskDetailEntity = taskLivingDetailsService.get(taskDetailId);
if (null != taskDetailEntity){
//重试标记
paymentEntity.setRetryFlag("1");
//paymentEntity.setReferenceNum(taskDetailEntity.getRootAppBill());
JSONObject rootAppPk = JSONObject.parseObject(taskDetailEntity.getRootAppPk());
paymentEntity.setFormsonId(rootAppPk.getString("formsonId"));
paymentEntity.setTaskDetailId(taskDetailId);
}else {
return BaseResult.getFailureMessageEntity("根据id:{},查不到记录",taskDetailId);
}
}
//支付申请
paymentEntity.setOaId("8475071606892874568");
//paymentEntity.setOaId("-5026223055769156433");
cbsPluginService.applyPay(paymentEntity);
return null;
return BaseResult.getSuccessMessageEntity("cbs8支付申请插件执行完成");
}
}

View File

@ -7,6 +7,7 @@ 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.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -120,7 +121,6 @@ public class TransactionDetailPluginInitializer extends PluginBaseEntity {
List<TransactionDetailDTO> transactionDetailList = cbsPluginService.queryTransactionDetail(transactionDetailReqDTO);
//保存交易明细到OA底表
cbsPluginService.saveTransactionDetail(transactionDetailList);
return new JsonResultEntity("成功",true,transactionDetailList);
//return null;
return BaseResult.getSuccessMessageEntity("成功",transactionDetailList);
}
}

View File

@ -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,24 +81,13 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
}
paymentEntity.setDataSourceCode(oa_data_source_code);
List<PaymentEntity> paymentList = paymentService.queryUnpaid(paymentEntity);
/* List<PaymentEntity> 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) {
//调用支付申请接口
pay.setTaskDetailId(paymentEntity.getTaskDetailId());
if (StrUtil.isNotEmpty(paymentEntity.getTaskDetailId())){
pay.setReferenceNumNew(spliceBillCode(pay.getReferenceNum()));
}
PayResponseDTO payResponseDTO = cbs8Service.payApply(pay);
boolean successed = payResponseDTO.getSuccessed();
if (successed){
@ -112,7 +99,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);
}
}
@ -136,6 +123,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
cbsLogEntity.setBill_code(Convert.toStr(entity.getReferenceNumNew(),entity.getReferenceNum()));
cbsLogEntity.setTab_name_ch(entity.getBillName());
cbsLogEntity.setTab_name_en(entity.getTableName());
cbsLogEntity.setFormson_id(entity.getFormsonId());
Boolean successed = payResponseDTO.getSuccessed();
if (successed){
cbsLogEntity.setPay_state(PayState.p.getValue());
@ -226,10 +214,11 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
public void elecBillUpload(JSONObject requestJson) throws Exception {
//查询支付成功 没有电子回单的数据
PaymentEntity paymentEntity = new PaymentEntity();
// List<PaymentEntity> paymentList = paymentService.queryElecIsNull(paymentEntity);
paymentEntity.setPayDate("2024-06-20");
paymentEntity.setReferenceNum("41");
List<PaymentEntity> paymentList = Arrays.asList(paymentEntity);
paymentEntity.setDataSourceCode(oa_data_source_code);
List<PaymentEntity> paymentList = paymentService.queryElecIsNull(paymentEntity);
//paymentEntity.setPayDate("2024-06-20");
//paymentEntity.setReferenceNum("41");
//List<PaymentEntity> paymentList = Arrays.asList(paymentEntity);
if (CollectionUtils.isNotEmpty(paymentList)) {
for (PaymentEntity pay : paymentList) {
try {
@ -329,8 +318,9 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
PaymentApplyAgentDTO detailDTO = BeanUtil.copyProperties(detail,PaymentApplyAgentDTO.class);
paymentApplyAgentList.add(detailDTO);
}
//招行这里要传203
paymentApplySubmitReqDTO.setBankExtend5("203");
//不同银行添加 处理不一样
//addAttribute(agentPay,paymentApplySubmitReqDTO,paymentApplyAgentList);
PayResponseDTO payResponseDTO = cbs8Service.agentPayApply(paymentApplySubmitReqDTO,paymentApplyAgentList);
if (null != payResponseDTO){
Boolean successed = payResponseDTO.getSuccessed();
@ -358,6 +348,65 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
}
}
/**
* 不同银行设置不同的字段
* @param agentPay
* @param paymentApplySubmitReqDTO 表头
* @param list 表体
*/
private void addAttribute(AgentPaymentEntity agentPay, PaymentApplySubmitReqDTO paymentApplySubmitReqDTO,List<PaymentApplyAgentDTO> list) {
//招商 CMB
//代发类型
paymentApplySubmitReqDTO.setBankExtend5("203");
//浦东发展银行 PDB
paymentApplySubmitReqDTO.setPersonalFlag("1");
//代发类型
paymentApplySubmitReqDTO.setBankExtend5("203");
//单位编号
paymentApplySubmitReqDTO.setBankExtend6("203");
//代发信息 1002表示代发工资
paymentApplySubmitReqDTO.setBankExtend8("1002");
//民生银行 CMC
//1表示代发工资
paymentApplySubmitReqDTO.setBankExtend5("1");
//农业银行 ABC
//200表示同行代发工资
paymentApplySubmitReqDTO.setBankExtend2("200");
//99020001表示工资发放
paymentApplySubmitReqDTO.setBankExtend8("99020001");
//光大银行 CEB
paymentApplySubmitReqDTO.setBankExtend1("00000000");
paymentApplySubmitReqDTO.setBankExtend8("0");
//证件号不知道填什么
for (PaymentApplyAgentDTO paymentApplyAgentDTO : list) {
paymentApplyAgentDTO.setDtlExtend1("");
}
//民生银行
//付款类型 1代表代发工资
paymentApplySubmitReqDTO.setBankExtend5("1");
//工商银行
paymentApplySubmitReqDTO.setUrgentTag("0");
//广发银行
//3表示代发工资
paymentApplySubmitReqDTO.setBankExtend2("3");
//华夏银行
paymentApplySubmitReqDTO.setBankExtend1("0");
// xhj3001表示代发工资
paymentApplySubmitReqDTO.setBankExtend2("xhj3001");
}
/**
* 代发代扣 结果详情查询
*
@ -388,7 +437,7 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
} else {
result.setPayResult(PayState.payStateGetValue(pay_status));//支付状态 支付状态和支付申请状态用一个
}
agentPaymentService.updateResult(result);
//更新明细表
List<AgentPayQueryDTO> agentDetails = agentPayResultResDTO.getAgentDetails();
for (AgentPayQueryDTO d : agentDetails) {
@ -403,6 +452,8 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
detail.setDataSourceCode(oa_data_source_code);
agentPaymentDetailService.updatePayResult(detail);
}
result.setPayDate(CBSUtil.convertTimestampToString(agentDetails.get(0).getDtlPayTime()));
agentPaymentService.updateResult(result);
}
}
return agentPayResultResDTO;
@ -510,4 +561,10 @@ public class CbsPluginServiceImpl implements ICbsPluginService {
}
}
//拼接新的单据号
private String spliceBillCode(String code){
String hour = Convert.toStr(DateUtil.hour(new Date(),true));
String minute = Convert.toStr(DateUtil.minute(new Date()));
return code+"-"+hour+minute;
}
}

View File

@ -17,6 +17,8 @@ import com.hzya.frame.mdm.mdmModuleDistribute.dao.IMdmModuleDistributeDao;
import com.hzya.frame.mdm.mdmModuleDistribute.entity.MdmModuleDistributeEntity;
import com.hzya.frame.mdm.mdmModuleDistributeDetail.dao.IMdmModuleDistributeDetailDao;
import com.hzya.frame.mdm.mdmModuleDistributeDetail.entity.MdmModuleDistributeDetailEntity;
import com.hzya.frame.mdm.mdmModuleDistributeTripartite.dao.IMdmModuleDistributeTripartiteDao;
import com.hzya.frame.mdm.mdmModuleDistributeTripartite.entity.MdmModuleDistributeTripartiteEntity;
import com.hzya.frame.mdm.mdmModuleSendLog.dao.IMdmModuleSendLogDao;
import com.hzya.frame.mdm.mdmModuleSendLog.entity.MdmModuleSendLogEntity;
import com.hzya.frame.mdm.service.IMdmServiceCache;
@ -79,7 +81,8 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
private IMdmServiceCache mdmServiceCache;
@Resource
private IMdmModuleSendLogDao mdmModuleSendLogDao;
@Resource
private IMdmModuleDistributeTripartiteDao mdmModuleDistributeTripartiteDao;
@Value("${zt.url}")
private String url ;
@ -342,6 +345,21 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
parameterJson.put("body",apiEntity.getBodyIn());
parameterJson.put("query",apiEntity.getQueryIn());
parameterJson.put("data",object);
if (!"1".equals(type)) {//删除或者修改情况,查询三方id有就设置没有就设置空
//1根据主数据id数据id应用ID默认查询主数据应用下发三方id表只查询最新的一条数据
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setSts("Y");
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDistributeTripartiteEntity.setDataId(object.getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity = mdmModuleDistributeTripartiteDao.queryOneTripartite(mdmModuleDistributeTripartiteEntity);
String tripartiteId = "";
if(mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null ){
tripartiteId = mdmModuleDistributeTripartiteEntity.getTripartiteId();
}
parameterJson.put("tripartiteId", tripartiteId);
}
/** head */
Map<String, String> header = null;
/** query */
@ -399,7 +417,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
return BaseResult.getFailureMessageEntity("发送错误:"+rzjsonResultEntity.getMsg());
}
JSONObject attritube = JSONObject.parseObject(rzjsonResultEntity.getAttribute().toString());
logger.info("认证接口返回信息:"+ attritube.toJSONString());
logger.info("认证接口返回信息:"+ attritube.toJSONString());
querys = getQuery(apiEntity,querys,attritube);
headers = getHeaders(apiEntity,headers,attritube);
@ -408,6 +426,39 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//组装数据发送
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){
if ("1".equals(type)) {//保存三方返回id
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
JSONObject backScriptJson = new JSONObject();
backScriptJson.put("data", jsonResultEntity.getAttribute());
groovy.put("code", scriptEntity.getScriptCode()+"back");
groovy.put("className", scriptEntity.getClassName()+"back");
groovy.put("name", scriptEntity.getScriptName()+"back");
groovy.put("methodStr", scriptEntity.getBackScriptData());
groovy.put("parameterJson", backScriptJson);
JSONObject groovyStr = new JSONObject();
groovyStr.put("jsonStr", groovy);
try {
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
if(str != null){
JSONObject backJsonResultEntity = JSONObject.parseObject(str.toString());
if(backJsonResultEntity != null && backJsonResultEntity.getString("success") != null && "true".equals(backJsonResultEntity.getString("success"))){
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setCreate();
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDistributeTripartiteEntity.setDataId(object.getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
}
}
} catch (Exception e) {
logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
taskDetailEntity.setResult("新增返回脚本解析保存三方id错误");
taskLivingDetailsService.updateLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("发送错误");
}
}
}
taskDetailEntity.setResult("发送成功");
taskLivingDetailsService.saveLogFailToSuccess(taskDetailEntity);
return BaseResult.getFailureMessageEntity("发送成功");
@ -422,6 +473,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//查询主数据
MdmModuleEntity queryMdmModuleEntity = new MdmModuleEntity();
queryMdmModuleEntity.setSts("Y");
queryMdmModuleEntity.setMdmCode(10004L);
List<MdmModuleEntity> mdmModuleEntities = mdmModuleDao.queryBase(queryMdmModuleEntity);
if(mdmModuleEntities == null || mdmModuleEntities.size() == 0){
return BaseResult.getSuccessMessageEntity("主数据未设置,不需要下发");
@ -458,11 +510,11 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities = mdmModuleDbFiledsRuleDao.queryBase(queryFildRule);
//新增
doAdd(mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
doAdd(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
//修改
//doUpdate(mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
doUpdate(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
//删除
//doDelete(mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
doDelete(mdmModuleEntities.get(i).getId(),mdmCode,mdmModuleDbEntities,mdmModuleDistributeEntities,mdmModuleDbFiledsRuleEntities,mdmModuleDbFiledsEntities);
}
@ -476,7 +528,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
return BaseResult.getSuccessMessageEntity("执行成功");
}
private void doDelete(Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) throws Exception {
private void doDelete(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) throws Exception {
//查询一千条数据
String mainDb = null;
List<JSONObject> objects = new ArrayList<>();
@ -573,6 +625,20 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
parameterJson.put("body",apiEntity.getBodyIn());
parameterJson.put("query",apiEntity.getQueryIn());
parameterJson.put("data",doObjects.get(i));
//1根据主数据id数据id应用ID默认查询主数据应用下发三方id表只查询最新的一条数据
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setSts("Y");
mdmModuleDistributeTripartiteEntity.setMdmId(mdmId);
mdmModuleDistributeTripartiteEntity.setDataId(objects.get(i).getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity = mdmModuleDistributeTripartiteDao.queryOneTripartite(mdmModuleDistributeTripartiteEntity);
String tripartiteId = "";
if(mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null ){
tripartiteId = mdmModuleDistributeTripartiteEntity.getTripartiteId();
}
parameterJson.put("tripartiteId", tripartiteId);
/** head */
Map<String, String> header = null;
/** query */
@ -657,7 +723,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
}
}
private void doUpdate(Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) throws Exception {
private void doUpdate(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities, List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities, List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities) throws Exception {
//查询一千条数据
String mainDb = null;
List<JSONObject> objects = new ArrayList<>();
@ -742,6 +808,18 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
parameterJson.put("body",apiEntity.getBodyIn());
parameterJson.put("query",apiEntity.getQueryIn());
parameterJson.put("data",doObjects.get(i));
//1根据主数据id数据id应用ID默认查询主数据应用下发三方id表只查询最新的一条数据
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setSts("Y");
mdmModuleDistributeTripartiteEntity.setMdmId(mdmId);
mdmModuleDistributeTripartiteEntity.setDataId(objects.get(i).getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity = mdmModuleDistributeTripartiteDao.queryOneTripartite(mdmModuleDistributeTripartiteEntity);
String tripartiteId = "";
if(mdmModuleDistributeTripartiteEntity != null && mdmModuleDistributeTripartiteEntity.getTripartiteId() != null ){
tripartiteId = mdmModuleDistributeTripartiteEntity.getTripartiteId();
}
parameterJson.put("tripartiteId", tripartiteId);
/** head */
Map<String, String> header = null;
/** query */
@ -833,7 +911,7 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
* @param mdmModuleDistributeEntities
* @return void
**/
private void doAdd(Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
private void doAdd(String mdmId,Long mainCode,List<MdmModuleDbEntity> mdmModuleDbEntities, List<MdmModuleDistributeEntity> mdmModuleDistributeEntities,List<MdmModuleDbFiledsRuleEntity> mdmModuleDbFiledsRuleEntities,List<MdmModuleDbFiledsEntity> mdmModuleDbFiledsEntities ) throws Exception {
//查询一千条数据
String mainDb = null;
List<JSONObject> objects = new ArrayList<>();
@ -993,6 +1071,43 @@ public class MdmModulePluginInitializer extends PluginBaseEntity {
//组装数据发送
JsonResultEntity jsonResultEntity = sendData(apiEntity,headers,bodys,querys);
if(jsonResultEntity.isFlag()){
if (scriptEntity != null && scriptEntity.getId() != null && scriptEntity.getBackScriptData() != null ) {
JSONObject backScriptJson = new JSONObject();
backScriptJson.put("data", jsonResultEntity.getAttribute());
groovy.put("code", scriptEntity.getScriptCode()+"back");
groovy.put("className", scriptEntity.getClassName()+"back");
groovy.put("name", scriptEntity.getScriptName()+"back");
groovy.put("methodStr", scriptEntity.getBackScriptData());
groovy.put("parameterJson", backScriptJson);
JSONObject groovyStr = new JSONObject();
groovyStr.put("jsonStr", groovy);
try {
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
if(str != null){
JSONObject backJsonResultEntity = JSONObject.parseObject(str.toString());
if(backJsonResultEntity != null && backJsonResultEntity.getString("success") != null && "true".equals(backJsonResultEntity.getString("success"))){
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setId(UUIDUtils.getUUID());
mdmModuleDistributeTripartiteEntity.setSts("Y");
mdmModuleDistributeTripartiteEntity.setCreate_user_id("1");
mdmModuleDistributeTripartiteEntity.setModify_user_id("1");
mdmModuleDistributeTripartiteEntity.setCreate_time(new Date());
mdmModuleDistributeTripartiteEntity.setModify_time(new Date());
mdmModuleDistributeTripartiteEntity.setOrg_id("0");
mdmModuleDistributeTripartiteEntity.setCompanyId("0");
mdmModuleDistributeTripartiteEntity.setMdmId(mdmId);
mdmModuleDistributeTripartiteEntity.setDataId(objects.get(i).getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
}
}
} catch (Exception e) {
logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"2","新增返回脚本解析保存三方id错误",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;
}
}
//保存日志
saveMdmModuleSendLogEntity(mainCode,mdmModuleDistributeEntities.get(i1).getId(),"1","发送成功",mainDb,objects.get(i).getString("id"),sysApplicationEntity.getName(),sysApplicationEntity.getId(),apiEntity.getApiName(),apiEntity.getId(),doObjects.get(i).toJSONString(),"1");
continue;

View File

@ -22,15 +22,15 @@ spring:
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: dm.jdbc.driver.DmDriver
# type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
# url: jdbc:dm://hzya.ufyct.com:9040/businesscenter?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
# url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
# username: hzyazt
# url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
# username: root
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: dm.jdbc.driver.DmDriver
# driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置
# url: jdbc:dm://hzya.ufyct.com:9040/businesscenter?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
url: jdbc:dm://ufidahz.com.cn:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: hzyazt
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /Users/apple/Desktop/log/local

View File

@ -12,7 +12,7 @@ spring:
dynamic:
datasource:
master:
url: jdbc:mysql://hzya.ufyct.com:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
url: jdbc:mysql://ufidahz.com.cn:9014/businesscenter?serverTimezone=UTC&useUnicode=true&characterEncoding=UTF8&serverTimezone=GMT%2B8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowLoadLocalInfile=false&autoReconnect=true&failOverReadOnly=false&connectTimeout=30000&socketTimeout=30000&autoReconnectForPools=true
username: root
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: com.mysql.jdbc.Driver # 3.2.0开始支持SPI可省略此配置

View File

@ -1,28 +1,28 @@
#logging:
# #日志级别 指定目录级别
# level:
# root: info
# encodings: UTF-8
# file:
# # 日志保存路径
# path: /zt/log
#spring:
# flyway:
# # 启动flyway migration, 默认为true
# enabled: false
# datasource:
# dynamic:
# druid:
# filters: stat,log4j2
# datasource:
# master:
# url: jdbc:dm://10.75.51.82:5238?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
# username: businesscenter
# password: 6842568689469adad597d144ee104063
# driver-class-name: dm.jdbc.driver.DmDriver
#savefile:
# # 文件保存路径
# path: /zt/file
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /zt/log
spring:
flyway:
# 启动flyway migration, 默认为true
enabled: false
datasource:
dynamic:
druid:
filters: stat,log4j2
datasource:
master:
url: jdbc:dm://10.75.51.82:5238?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: businesscenter
password: 6842568689469adad597d144ee104063
driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /zt/file
#公司mysql
#ax:
# url: http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterface
@ -49,31 +49,31 @@
#公司服务器达梦
logging:
#日志级别 指定目录级别
level:
root: info
encodings: UTF-8
file:
# 日志保存路径
path: /zt/log
spring:
flyway:
# 启动flyway migration, 默认为true
enabled: false
datasource:
dynamic:
druid:
filters: stat,log4j2
datasource:
master:
url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
username: hzyazt
password: 62e4295b615a30dbf3b8ee96f41c820b
driver-class-name: dm.jdbc.driver.DmDriver
savefile:
# 文件保存路径
path: /zt/file
#logging:
# #日志级别 指定目录级别
# level:
# root: info
# encodings: UTF-8
# file:
# # 日志保存路径
# path: /zt/log
#spring:
# flyway:
# # 启动flyway migration, 默认为true
# enabled: false
# datasource:
# dynamic:
# druid:
# filters: stat,log4j2
# datasource:
# master:
# url: jdbc:dm://hzya.ufyct.com:9040?schema=businesscenter&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8&compatibleMode=oracle
# username: hzyazt
# password: 62e4295b615a30dbf3b8ee96f41c820b
# driver-class-name: dm.jdbc.driver.DmDriver
#savefile:
# # 文件保存路径
# path: /zt/file
cbs8:
appId: 1P4AGrpz
appSecret: 2c2369ae5dc04382844bbe3a5abf39e1bea9cd3a
@ -83,8 +83,8 @@ cbs8:
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
#电子回单下载临时存放位置
elec_path: /zt/elecfile
OA:
data_source_code: yc_oa
data_source_code: OA

View File

@ -28,4 +28,6 @@ cbs8:
# 这个私钥到时候上传到cbs和下面到是同一对
#ya_private_key: e1eacfdee9b8d4184437d5a2071e17ce31befc3d93395f9f05709ed562e8dc46
ya_public_key: 044fa399d2223760f17b81b863cb482b009294c4516f8a605dea1475ec09e720eaa98468715e5ad509a592a0b426061551c5a3df236966c23253a7d894eac0dcde
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
cbs_public_key: 0469146F06BF3B01236E84632441E826F3067A6B93BC3839C836A06007869CD351FBBE388B51F742859388BBC1DE089923AAFBC69E448F15141DDF30EE6CE90185
OA:
data_source_code: OA

View File

@ -57,6 +57,42 @@ public class temButtom {
@Autowired
private PayResultPluginInitializer payResultPluginInitializer;
@Test
public void payApplyExtTest(){
String bodys = "{\n" +
" \"amount\": \"12000\",\n" +
" \"applyCodeField\": \"field0086\",\n" +
" \"billName\": \"资金使用审批表(其他)\",\n" +
" \"busType\": \"202\",\n" +
" \"cnapsCode\": \"00031342444\",\n" +
" \"currency\": \"10\",\n" +
" \"dataSourceCode\": \"master\",\n" +
" \"finishedflag\": \"1\",\n" +
" \"formsonId\": \"8364887433640955440\",\n" +
" \"oaId\": \"-4951125123923096260\",\n" +
" \"payAccount\": \"8110801013602348528\",\n" +
" \"payBankName\": \"中信银行绍兴分行\",\n" +
" \"payCompany\": \"绍兴市越城区建设投资有限公司\",\n" +
" \"payDateField\": \"field0070\",\n" +
" \"payResultField\": \"field0069\",\n" +
" \"personalFlag\": \"0\",\n" +
" \"receipt\": \"\",\n" +
" \"receiptFiled\": \"\",\n" +
" \"referenceNum\": \"ZJSY202407030002-1\",\n" +
" \"revAccount\": \"7122459925896517\",\n" +
" \"revAccountName\": \"越城区人民医院\",\n" +
" \"revBankName\": \"中国农业银行绍兴支行\",\n" +
" \"sort\": \"1\",\n" +
" \"startDate\": \"2024-07-03 11:34:29.999000\",\n" +
" \"summaryId\": \"7384107412543258850\",\n" +
" \"tableName\": \"formson_0222\",\n" +
" \"title\": \"《资金使用审批表》-ZJSY202407030002\"\n" +
"}";
SysExtensionApiEntity api = new SysExtensionApiEntity();
api.setBodys(bodys);
cbs8ExtService.payApply(api);
System.out.println("111");
}
@Test
public void cbs8PluginTest(){
try {
@ -100,15 +136,15 @@ public class temButtom {
@Test
public void cbs8ExtTest(){
PaymentEntity paymentEntity = new PaymentEntity();
paymentEntity.setReferenceNum("CL202406140003");
paymentEntity.setReferenceNum("ZJSY202407030002-1");
paymentEntity.setPayAccount("655905707410000");
paymentEntity.setPayBankName("");
paymentEntity.setAmount("99.02");
paymentEntity.setRevAccount("123456778");
paymentEntity.setRevBankName("中国工商银行总行清算中心");
paymentEntity.setAmount("12000");
paymentEntity.setRevAccount("7122459925896517");
paymentEntity.setRevBankName("中国农业银行绍兴支行");
paymentEntity.setRevBankType("ICB");
paymentEntity.setRevAccountName("测试账户");
paymentEntity.setCnapsCode("102100099996");
paymentEntity.setCnapsCode("00031342444");
paymentEntity.setPurpose("测试用途");
paymentEntity.setBusType("202");
paymentEntity.setCurrency("10");

View File

@ -655,13 +655,26 @@ public class GeneralServiceImpl implements GeneralService {
List<HashMap<String, Object>> list = null;
try {
list = baseDaoUtilImpl.selectWhereList(tablename, defaultOrder, whereCriteria);
convertKeysToLowerCase(list);
return BaseResult.getSuccessMessageEntity("查询成功", list);
} catch (Exception e) {
log.error("defaultselectList{}", e.getMessage());
return BaseResult.getFailureMessageEntity("查询失败");
}
}
//强制转换数据库字段为小写,出问题在说
public void convertKeysToLowerCase(List<HashMap<String, Object>> list) {
if(list != null && list.size() > 0){
for (HashMap<String, Object> map : list) {
HashMap<String, Object> lowerCaseMap = new HashMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
lowerCaseMap.put(entry.getKey().toLowerCase(), entry.getValue());
}
map.clear(); // 清空原来的Map避免重复存储
map.putAll(lowerCaseMap); // 将转换后的Map全部放回原位
}
}
}
/**
* @param jsonObject
* @return com.hzya.frame.web.entity.JsonResultEntity

View File

@ -1,6 +1,7 @@
package com.hzya.frame.bip.v3.v2207.service.impl;
import com.alibaba.fastjson.JSON;
import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.bip.v3.v2207.entity.BipTokenVo;
import com.hzya.frame.bip.v3.v2207.service.IBipV32207BillService;
@ -33,6 +34,7 @@ public class BipV32207BillServiceImpl extends BaseService<BipTokenVo, String> im
public SysExtensionApiEntity getBipBill(SysExtensionApiEntity entity) {
try {
Map<String, String> headers = entity.getHeaders();
logger.info("扩展方法得到的请求头:"+ JSON.toJSONString(headers));
String client_id = headers.get("client_id");
//token信息
String access_token = headers.get("access_token");

View File

@ -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<JSONObject> dataList = cbsResponseDTO.getData();
if (CollectionUtils.isNotEmpty(dataList)){
JSONObject o = dataList.get(0);
PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class);
return payResponseDTO;
}
}
return new PayResponseDTO();
}
}

View File

@ -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,12 +17,23 @@ public interface ICbs8ExtService {
*/
SysExtensionApiEntity payApply(SysExtensionApiEntity entity);
/**
* 支付申请回调
* @param logEntity
*/
void payApplyCallBack(SysMessageManageLogEntity logEntity);
/**
* 代发代扣 支付申请
* @param entity
* @return
*/
SysExtensionApiEntity agentPayApply(SysExtensionApiEntity entity);
/**
* 代发代扣 支付申请 回调方法
* @param logEntity
* @return
*/
void agentPayApplyCallBack(SysMessageManageLogEntity logEntity);
/**
* 交易结果查询

View File

@ -4,17 +4,23 @@ 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
/**
@ -27,6 +33,9 @@ import java.util.*;
public class Cbs8ExtServiceImpl implements ICbs8ExtService {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
/**
* 支付经办
*
@ -36,11 +45,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 +63,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 +71,77 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
List<PayRequestDTO> list = Arrays.asList(payRequestDTO);
String requestData = JSONObject.toJSONString(list);
//加密 签名
encrypAndsign(entity,requestData);
encrypAndsign(entity, requestData);
//重试日志id
entity.getHeaders().put("integration_task_living_details_id",paymentEntity.getTaskDetailId());
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 taskDetailId = targetHeaders.getString("integration_task_living_details_id");
String returnDataBase64 = logEntity.getReturnData();
byte[] secretResByte = Base64.getDecoder().decode(returnDataBase64);
//解密报文
String decryptRes = CBSUtil.decrypt(secretResByte);
//6记录系统日志
IntegrationTaskLivingDetailsEntity logTask = new IntegrationTaskLivingDetailsEntity();
String oaId = sourceBody.getString("oaId");
String formsonId = sourceBody.getString("formsonId");
JSONObject rootAppPk = new JSONObject();
rootAppPk.put("oaId",oaId);
rootAppPk.put("formsonId",formsonId);
logTask.setRootAppPk(rootAppPk.toString());
String ferenceNum = Convert.toStr(sourceBody.getString("referenceNumNew"), sourceBody.getString("referenceNum"));
logTask.setRootAppBill(ferenceNum);
logTask.setPluginId("CBS8PayApplyPlugin");
//对方接口返回信息
logTask.setNewTransmitInfo(decryptRes);
Date date = new Date();
logTask.setNewPushDate(date);
//调用接口请求参数
logTask.setRootAppNewData(hzyaExtData);
PayResponseDTO payResponseDTO = PayResponseDTO.payResValueOf(decryptRes);
if (StrUtil.isEmpty(taskDetailId)){
logTask.setCreate_time(date);
logTask.setModify_time(date);
//为true是成功
if (payResponseDTO.getSuccessed()) {
taskLivingDetailsService.saveLogToSuccess(logTask);
}else {
taskLivingDetailsService.saveLogToFail(logTask);
}
}else {
logTask.setId(taskDetailId);
logTask.setModify_time(date);
if (payResponseDTO.getSuccessed()){
taskLivingDetailsService.saveLogFailToSuccess(logTask);
}else {
taskLivingDetailsService.updateLogFailToSuccess(logTask);
}
}
} catch (Exception e) {
logger.info("payApplyCallBack方法执行出错:{}",e);
}
}
/**
* 代发代扣 支付申请
*
@ -77,8 +151,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);
@ -86,6 +160,49 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
return entity;
}
/**
* 代发代扣 支付申请 回调方法
*
* @param logEntity
* @return
*/
@Override
public void agentPayApplyCallBack(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("CBS8PayApplyAgentPlugin");
//对方接口返回信息
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("agentPayApplyCallBack方法执行出错:{}",e);
}
}
/**
* 交易结果查询
*
@ -95,13 +212,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 +234,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 +252,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 +262,6 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
}
/**
* 代发代扣结果查询
*
@ -155,10 +271,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 +288,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 +300,34 @@ public class Cbs8ExtServiceImpl implements ICbs8ExtService {
/**
* 请求头
*
* @param sign
* @param timestamp
* @return
*/
private Map<String,String> headersValueOf(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());
private Map<String, String> headersValueOf(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;
}
/**
* 加密 签名
* @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);
String sign = CBSUtil.sign(requestData, timestamp);
//加密
byte[] encryptedData = CBSUtil.encrypt(requestData);
Map<String,String> header = headersValueOf(sign,timestamp);
Map<String, String> header = headersValueOf(sign, timestamp);
header.put("hzyaExtData", requestData);
entity.setByteBodys(encryptedData);
entity.setHeaders(header);
}

View File

@ -45,18 +45,20 @@ public class Cbs8ServiceImpl implements ICbs8Service {
.put("appId","800026")
.build();
String body = HttpRequest.post("http://127.0.0.1:9999/kangarooDataCenterV3/entranceController/externalCallInterfaceToESB").addHeaders(headerMap).body(JSONObject.toJSONString(paymentEntity)).timeout(60000).execute().body();
logger.info("payApply方法调用externalCallInterfaceToESB返回信息{}",body);
//解密响应报文
String result = decryptResBody(body);
if (StrUtil.isNotEmpty(result)){
CbsResponseDTO cbsResponseDTO = JSONObject.parseObject(result, CbsResponseDTO.class);
List<JSONObject> 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<JSONObject> 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 +207,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<JSONObject> 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<JSONObject> dataList = cbsResponseDTO.getData();
// if (CollectionUtils.isNotEmpty(dataList)){
// JSONObject o = dataList.get(0);
// PayResponseDTO payResponseDTO = JSON.toJavaObject(o, PayResponseDTO.class);
// return payResponseDTO;
// }
// }
return payResponseDTO;
}
/**
@ -253,9 +256,11 @@ public class Cbs8ServiceImpl implements ICbs8Service {
* @return
*/
private String decryptResBody(String body){
logger.info("准备解密银行返回的报文:{}",body);
if (StrUtil.isNotEmpty(body)){
JsonResultEntity resultEntity = JSONObject.parseObject(body,JsonResultEntity.class);
String bodyBase64 = String.valueOf(resultEntity.getAttribute());
logger.info("base64解码后的参数:{}",bodyBase64);
byte[] bodyBytes = Base64.getDecoder().decode(bodyBase64);
//这里验证一下如果系统异常 返回的报文没加密
String test = new String(bodyBytes);

View File

@ -169,8 +169,14 @@ public class CBSUtil {
* @return
*/
public static byte[] encrypt(String requestData){
logger.info("bodyEncryptionKey: "+bodyEncryptionKey+"requestData: "+ requestData);
try {
byte[] encrypt = SM2Util.encrypt(bodyEncryptionKey, requestData.getBytes(StandardCharsets.UTF_8));
return encrypt;
}catch (Exception e){
logger.error("加密失败",e);
}
return null;
}
public static String decrypt(byte[] cipherData){

View File

@ -24,22 +24,12 @@ import java.util.Map;
public class CbsAccessToken {
private static final Logger logger = LoggerFactory.getLogger(CbsAccessToken.class);
@Value("${cbs8.appId}")
private String app_id;
@Value("${cbs8.appSecret}")
private String app_secret;
@Value("${cbs8.url}")
private String app_url;
private static String appId;
private static String appSecret;
private static String url;
@PostConstruct
public void init() {
appId = app_id;
appSecret = app_secret;
url = app_url;
}
private static String app_id;
private static String app_secret;
private static String app_url;
//刷新token用
private static final String BEARER = "Bearer ";
/**
@ -52,9 +42,21 @@ public class CbsAccessToken {
}
private static CbsAccessToken cbsAccessToken = new CbsAccessToken();
@Value("${cbs8.appId}")
public void setApp_id(String app_id) {
CbsAccessToken.app_id = app_id;
}
@Value("${cbs8.appSecret}")
public void setApp_secret(String app_secret) {
CbsAccessToken.app_secret = app_secret;
}
@Value("${cbs8.url}")
public void setApp_url(String app_url) {
CbsAccessToken.app_url = app_url;
}
public static CbsAccessToken getInstance() {
logger.info("开始获取token");
if (null == cbsAccessToken.token){
initToken();
}else {
@ -65,6 +67,7 @@ public class CbsAccessToken {
refreshToken();
}
}
logger.info("取到的token:{}",cbsAccessToken.token);
return cbsAccessToken;
}
@ -75,13 +78,14 @@ public class CbsAccessToken {
* 获取token
*/
private static void initToken(){
CbsAccessToken ct = (CbsAccessToken) ApplicationContextUtil.getBeanByName("cbsAccessToken");
logger.info("开始获取cbstoken");
//CbsAccessToken ct = (CbsAccessToken) ApplicationContextUtil.getBeanByName("cbsAccessToken");
Map<String,String> param = new HashMap<>();
param.put("app_id",ct.appId);
param.put("app_secret",ct.appSecret);
param.put("app_id",CbsAccessToken.app_id);
param.put("app_secret",CbsAccessToken.app_secret);
param.put("grant_type","client_credentials");
String res = HttpRequest.post(ct.url+"/openapi/app/v1/app/token").body(JSONObject.toJSONString(param)).execute().body();
logger.info("获取cbstoken请求地址:{},参数:{}",CbsAccessToken.app_url,JSONObject.toJSONString(param));
String res = HttpRequest.post(CbsAccessToken.app_url+"/openapi/app/v1/app/token").body(JSONObject.toJSONString(param)).execute().body();
logger.info("获取cbstoken结果",res);
if (StrUtil.isNotEmpty(res) && JSONUtil.isTypeJSON(res)){
JSONObject tokenObject = JSONObject.parseObject(res);
@ -104,10 +108,10 @@ public class CbsAccessToken {
* 刷新token
*/
private static void refreshToken(){
CbsAccessToken ct = (CbsAccessToken) ApplicationContextUtil.getBeanByName("cbsAccessToken");
//CbsAccessToken ct = (CbsAccessToken) ApplicationContextUtil.getBeanByName("cbsAccessToken");
//token不为空并且没过期 刷新token
if (null != cbsAccessToken.token && System.currentTimeMillis() < cbsAccessToken.expiryTime ){
String res = HttpRequest.get(ct.url + "/openapi/app/v1/app/refresh-token").header("Authorization", BEARER + cbsAccessToken.token).execute().body();
String res = HttpRequest.get(CbsAccessToken.app_url + "/openapi/app/v1/app/refresh-token").header("Authorization", BEARER + cbsAccessToken.token).execute().body();
logger.info("刷新cbstoken结果",res);
if (StrUtil.isNotEmpty(res) && JSONUtil.isTypeJSON(res)){
JSONObject tokenObject = JSONObject.parseObject(res);

View File

@ -1918,15 +1918,22 @@ public class MdmServiceImpl implements IMdmService {
groovyStr.put("jsonStr", groovy);
try {
Object str = groovyIntegrationService.groovyScriptExecution(groovyStr);
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setCreate();
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDistributeTripartiteEntity.setDataId(object.getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(str.toString());
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
if(str != null){
JSONObject backJsonResultEntity = JSONObject.parseObject(str.toString());
if(backJsonResultEntity != null && backJsonResultEntity.getString("success") != null && "true".equals(backJsonResultEntity.getString("success"))){
MdmModuleDistributeTripartiteEntity mdmModuleDistributeTripartiteEntity = new MdmModuleDistributeTripartiteEntity();
mdmModuleDistributeTripartiteEntity.setCreate();
mdmModuleDistributeTripartiteEntity.setMdmId(mdmModuleEntity.getId());
mdmModuleDistributeTripartiteEntity.setDataId(object.getString("id"));
mdmModuleDistributeTripartiteEntity.setAppId(sysApplicationEntity.getId());
mdmModuleDistributeTripartiteEntity.setTripartiteId(backJsonResultEntity.getString("tripartiteId"));
mdmModuleDistributeTripartiteDao.save(mdmModuleDistributeTripartiteEntity);
}
}
} catch (Exception e) {
return BaseResult.getFailureMessageEntity("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
logger.error("新增返回脚本解析保存三方id错误"+jsonResultEntity.getAttribute());
saveMdmModuleSendLogEntity(mdmModuleEntity.getMdmCode(),mdmModuleDistributeEntity.getId(),"2", "转发失败", dbname, object.getString("id"), sysApplicationEntity.getName(),sysApplicationEntity.getId(), apiEntity.getApiName(),apiEntity.getId(), object.toJSONString(), type);
return BaseResult.getFailureMessageEntity("发送错误:" + jsonResultEntity.getMsg());
}
}
}
@ -2254,7 +2261,7 @@ public class MdmServiceImpl implements IMdmService {
private JsonResultEntity sendData(SysApplicationApiEntity applicationApiEntity, Map<String, String> headers, String bodys, String querys) {
StringBuffer urls = new StringBuffer(url);
if (querys != null) {
if (querys != null && !"".equals(querys)) {
urls.append("?");
urls.append(querys);
}

View File

@ -9,4 +9,11 @@ import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
* @Date 2024/6/14 17:30
**/
public interface ICbsLogDao extends IBaseDao<CbsLogEntity,String> {
/**
* 更新日志
* @param entity
* @return
*/
int updateLog(CbsLogEntity entity);
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.seeyon.cbs8.dao.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.seeyon.cbs8.dao.ICbsLogDao;
import com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity;
@ -12,4 +13,16 @@ import org.springframework.stereotype.Repository;
**/
@Repository()
public class CbsLogDaoImpl extends MybatisGenericDao<CbsLogEntity,String> implements ICbsLogDao {
/**
* 更新日志
*
* @param entity
* @return
*/
@DS("#entity.dataSourceCode")
@Override
public int updateLog(CbsLogEntity entity) {
this.update(getSqlIdPrifx()+"entity_update",entity);
return 0;
}
}

View File

@ -25,7 +25,10 @@ public class AgentPaymentDetailEntity extends BaseEntity {
//明细序号从1开始递增
private int dtlSeqNum;
//明细用途
private String dtlPurpose;
//是否跨行 Y表示跨行 N表示同行
private String dtlBankFlag;
//支付结果
private String payResult;
//支付日期
@ -110,4 +113,20 @@ public class AgentPaymentDetailEntity extends BaseEntity {
public void setPayDate(String payDate) {
this.payDate = payDate;
}
public String getDtlPurpose() {
return dtlPurpose;
}
public void setDtlPurpose(String dtlPurpose) {
this.dtlPurpose = dtlPurpose;
}
public String getDtlBankFlag() {
return dtlBankFlag;
}
public void setDtlBankFlag(String dtlBankFlag) {
this.dtlBankFlag = dtlBankFlag;
}
}

View File

@ -11,6 +11,8 @@
<result property="dtlCnapsCode" column="dtlCnapsCode" />
<result property="dtlRevName" column="dtlRevName" />
<result property="dtlRevBankName" column="dtlRevBankName" />
<result property="dtlBankFlag" column="dtlBankFlag" />
<result property="dtlPurpose" column="dtlPurpose" />
<result property="payResult" column="payResult" />
<result property="payDate" column="payDate" />
</resultMap>
@ -25,6 +27,8 @@
dtlCnapsCode,
dtlRevName,
dtlRevBankName,
dtlPurpose,
dtlBankFlag,
payResult,
payDate
</sql>
@ -39,16 +43,19 @@
formson_0225.id,
formson_0225.formmain_id AS formmainId,
'formson_0225' AS tabName,
'N' AS dtlBankFlag,
formson_0225.field0001 AS dtlSeqNum,
formson_0225.field0019 AS dtlAmount,
formson_0225.field0036 AS dtlRevAccount,
formson_0225.field0035 AS dtlCnapsCode,
formson_0225.field0037 AS dtlRevName,
formson_0225.field0034 AS dtlRevBankName,
to_char(formmain_0224.field0030,'yyyy-MM')||'月'||'工资'AS dtlPurpose,
formson_0225.field0044 AS payResult,
formson_0225.field0045 AS payDate
FROM
formson_0225
LEFT JOIN formmain_0224 ON formmain_0224.id = formson_0225.formmain_id
)formson_0225
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id !='' "> formson_0225.id = #{id} </if>

View File

@ -35,10 +35,13 @@ public class AgentPaymentEntity extends BaseEntity {
private String applyCode;
//支付结果
private String payResult;
//支付日期
private String payDate;
private String tableName;//表名称
private String billName;//单据名称
private String payBankType;//付款银行类型
public String getReferenceNum() {
return referenceNum;
}
@ -142,4 +145,20 @@ public class AgentPaymentEntity extends BaseEntity {
public void setPayResult(String payResult) {
this.payResult = payResult;
}
public String getPayDate() {
return payDate;
}
public void setPayDate(String payDate) {
this.payDate = payDate;
}
public String getPayBankType() {
return payBankType;
}
public void setPayBankType(String payBankType) {
this.payBankType = payBankType;
}
}

View File

@ -27,6 +27,7 @@
busType,
amount,
currency,
payBankType,
payAccount,
applyCode,
payResult,
@ -52,7 +53,8 @@
'755915707610112' AS payAccount,
formmain_0224.field0043 AS applyCode,
formmain_0224.field0046 AS payResult,
'工资' AS purpose
formmain_0224.field0053 as payBankType,
to_char(formmain_0224.field0030,'yyyy-MM')||'月'||''工资' AS purpose
FROM
formmain_0224
LEFT JOIN COL_SUMMARY ON COL_SUMMARY.FORM_RECORDID = formmain_0224.id
@ -112,6 +114,7 @@
</trim>
and formmain_0224.applyCode is null
and formmain_0224.payResult is null
and formmain_0224.finishedflag = 1
</select>
@ -119,6 +122,7 @@
update formmain_0224 set
<trim suffix="" suffixOverrides=",">
<if test="applyCode != null and applyCode !='' ">field0043 =#{applyCode},</if>
<if test="payDate != null and payDate !='' ">field0058 =#{payDate},</if>
<if test="payResult != null and payResult !='' ">field0046 =#{payResult}</if>
</trim>
where id = #{oaId}

View File

@ -22,6 +22,8 @@ public class CbsLogEntity extends BaseEntity {
private String id;
//oa单据id
private String oa_id;
//oa子表id
private String formson_id;
//oa单据号
private String bill_code;
//英文表名
@ -148,4 +150,12 @@ public class CbsLogEntity extends BaseEntity {
public void setCbs_apply_code(String cbs_apply_code) {
this.cbs_apply_code = cbs_apply_code;
}
public String getFormson_id() {
return formson_id;
}
public void setFormson_id(String formson_id) {
this.formson_id = formson_id;
}
}

View File

@ -4,6 +4,7 @@
<resultMap id="get-CbsLogEntity-result" type="com.hzya.frame.seeyon.cbs8.entity.CbsLogEntity">
<result property="id" column="id" />
<result property="oa_id" column="oa_id" />
<result property="formson_id" column="formson_id" />
<result property="bill_code" column="bill_code" />
<result property="tab_name_en" column="tab_name_en" />
<result property="tab_name_ch" column="tab_name_ch" />
@ -26,6 +27,7 @@
field0005 as cbs_apply_code,
field0006 as bill_code,
field0007 as oa_id,
field0020 as formson_id,
field0008 as tab_name_ch,
field0009 as tab_name_en,
field0010 as pay_state,
@ -47,6 +49,7 @@
<if test="cbs_apply_code != null and cbs_apply_code !='' "> and field0005 = #{cbs_apply_code} </if>
<if test="bill_code != null and bill_code !='' "> and field0006 = #{bill_code} </if>
<if test="oa_id != null and oa_id !='' "> and field0007 = #{oa_id} </if>
<if test="formson_id != null and formson_id !='' "> and field0020 = #{formson_id} </if>
<if test="tab_name_ch != null and tab_name_ch !='' "> and field0008 = #{tab_name_ch} </if>
<if test="tab_name_en != null and tab_name_en !='' "> and field0009 = #{tab_name_en} </if>
<if test="pay_state != null and pay_state !='' "> and field0010 = #{pay_state} </if>
@ -69,6 +72,7 @@
<if test="cbs_apply_code != null and cbs_apply_code !='' "> and field0005 like '${cbs_apply_code}%' </if>
<if test="bill_code != null and bill_code !='' "> and field0006 like '${bill_code}%' </if>
<if test="oa_id != null and oa_id !='' "> and field0007 = #{oa_id} </if>
<if test="formson_id != null and formson_id !='' "> and field0020 = #{formson_id} </if>
<if test="tab_name_ch != null and tab_name_ch !='' "> and field0008 like '${tab_name_ch}%' </if>
<if test="tab_name_en != null and tab_name_en !='' "> and field0009 like '${tab_name_en}%' </if>
<if test="pay_state != null and pay_state !='' "> and field0010 like '${pay_state}%' </if>
@ -85,6 +89,7 @@
formmain_0232
<trim prefix="where" prefixOverrides="and">
<if test="oa_id != null and oa_id !='' "> field0007 = #{oa_id} </if>
<if test="formson_id != null and formson_id !='' "> and field0020 = #{formson_id} </if>
<if test="id != null and id !='' "> and id = #{id} </if>
<if test="bill_code != null and bill_code !='' "> and field0006 = #{bill_code} </if>
<if test="tab_name_en != null and tab_name_en !='' "> and field0008 = #{tab_name_en} </if>
@ -106,6 +111,7 @@
<if test="pay_state != null and pay_state !='' ">field0010 =#{pay_state},</if>
field0011 =#{message},
<if test="apply_state != null and apply_state !='' ">field0012 =#{apply_state},</if>
<if test="cbs_apply_code != null and cbs_apply_code !='' ">field0005 =#{cbs_apply_code},</if>
<if test="successed != null and successed !='' ">field0014 =#{successed}</if>
</trim>
where id = #{id}

View File

@ -45,6 +45,10 @@ public class PaymentEntity extends BaseEntity {
private String payType;//付款类别
private String payCompanyCode;//付款公司编码
//是否重试
private String retryFlag;
//重试日志id
private String taskDetailId;
public String getOaId() {
return oaId;
}
@ -324,4 +328,20 @@ public class PaymentEntity extends BaseEntity {
public void setApplyCode(String applyCode) {
this.applyCode = applyCode;
}
public String getRetryFlag() {
return retryFlag;
}
public void setRetryFlag(String retryFlag) {
this.retryFlag = retryFlag;
}
public String getTaskDetailId() {
return taskDetailId;
}
public void setTaskDetailId(String taskDetailId) {
this.taskDetailId = taskDetailId;
}
}

View File

@ -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,149 @@
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
WHERE field0064 = '-5486592002512828355'-- 是否本次支付
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
</sql>
<!-- 采用==查询 -->
<select id="entity_list_base" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
@ -162,6 +301,7 @@
<if test="personalFlag != null and personalFlag !='' ">and v.personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and v.tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and v.oaId = #{oaId} </if>
<if test="formsonId != null and formsonId !='' ">and v.formsonId = #{formsonId} </if>
<if test="payCompany != null and payCompany !='' "> and v.payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and v.payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and v.title = #{title} </if>
@ -171,80 +311,44 @@
<if test="payBankName != null and payBankName !='' ">and v.payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and v.payType = #{payType} </if>
<if test="finishedflag != null and finishedflag !='' "> and v.finishedflag = #{finishedflag} </if>
</trim>
order by v.oaId,v.sort
</select>
<!-- 查询交易成功,且电子回单为空的,上传电子回单用 -->
<select id="PaymentEntity_list_base_elec_isnull" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
<!-- select
<include refid="PaymentEntity_Base_Column_List"/>
from
v_hzya_oa_cbs_all-->
-- 差旅费报销单
SELECT
formson_0210.id as oaId, -- 主表id
'formson_0210' as tableName, -- 表名
COL_SUMMARY.SUBJECT as title, -- 单据标题
unit.name as payCompany, -- 付款公司
'差旅费报销单' as billName,
'field0072' as payResultField, -- 支付结果字段
'field0073' as payDateField, -- 打款日期字段
'' as receiptFiled,-- 电子回单字段
COL_SUMMARY.id as summaryId,
formmain_0209.field0017||'-'||formson_0210.sort as referenceNum, -- 单据编号
formmain_0209.START_DATE as startDate, -- 单据日期
formmain_0209.FINISHEDFLAG as finishedflag, -- 流程状态
formson_0210.field0073 as payDate, -- 打款日期
formson_0210.field0072 as payResult, -- 支付结果
REGEXP_REPLACE(formmain_0209.field0042, '[[:space:]]', '') as payAccount, -- 付款账户
REGEXP_REPLACE(formmain_0209.field0041, '[[:space:]]', '') as payBankName, -- 付款开户行
formson_0210.field0031 as amount, -- 金额
formmain_0209.field0038 as purpose, -- 用途
formmain_0209.field0038 as cbsAbstract, -- 摘要
REGEXP_REPLACE(formson_0210.field0069, '[[:space:]]', '') as revAccount, -- 收款账户
formson_0210.field0068 as revBankName, -- 收款开户行
'' as revAccountName, -- 收款人
REGEXP_REPLACE(formson_0210.field0071, '[[:space:]]', '') as cnapsCode, -- 收款联行号
item.showvalue as personalFlag,-- 公私标记
'' as revBankType,-- 收款银行类型
'10' as currency,-- 币种
'' as busType,-- 业务类型
'' as receipt -- 电子回单
from
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_AFFAIR ON CTP_AFFAIR.object_id = COL_SUMMARY.id
left join CTP_ENUM_ITEM item on item.id =formson_0210.field0070
left join ORG_UNIT unit on unit.id =formmain_0209.field0002
-- left join V_USER_VIEW_ALL us on us.staffid=formmain_0209.field0024
WHERE 1=1
-- and formson_0210.field0031>0
and CTP_AFFAIR.node_name = '发起者' and CTP_AFFAIR.COMPLETE_TIME is null and CTP_AFFAIR.STATE = 3
select v.* from (
<include refid="base_sql"/>
) v
<trim prefix="where" prefixOverrides="and">
<if test="referenceNum != null and referenceNum !='' "> referenceNum = #{referenceNum} </if>
<if test="busType != null and busType !='' "> and busType = #{busType} </if>
<if test="amount != null and amount !='' ">and amount = #{amount} </if>
<if test="currency != null and currency !='' "> and currency = #{currency} </if>
<if test="payAccount != null and payAccount !='' ">and payAccount = #{payAccount} </if>
<if test="revAccount != null and revAccount !='' "> and revAccount = #{revAccount} </if>
<if test="revAccountName != null and revAccountName !='' "> and revAccountName = #{revAccountName} </if>
<if test="revBankType != null and revBankType !='' "> and revBankType = #{revBankType} </if>
<if test="revBankName != null and revBankName !='' ">and revBankName = #{revBankName} </if>
<if test="cnapsCode != null and cnapsCode !='' ">and cnapsCode = #{cnapsCode} </if>
<if test="purpose != null and purpose !='' "> and purpose = #{purpose} </if>
<if test="personalFlag != null and personalFlag !='' ">and personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and oaId = #{oaId} </if>
<if test="payCompany != null and payCompany !='' "> and payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and title = #{title} </if>
<if test="billName != null and billName !='' "> and billName = #{billName} </if>
<if test="payBankName != null and payBankName !='' ">and payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and payType = #{payType} </if>
and receipt is null and personalFlag='0' and payResult = '支付成功'
<if test="referenceNum != null and referenceNum !='' "> v.referenceNum = #{referenceNum} </if>
<if test="busType != null and busType !='' "> and v.busType = #{busType} </if>
<if test="amount != null and amount !='' ">and v.amount = #{amount} </if>
<if test="currency != null and currency !='' "> and v.currency = #{currency} </if>
<if test="payAccount != null and payAccount !='' ">and v.payAccount = #{payAccount} </if>
<if test="revAccount != null and revAccount !='' "> and v.revAccount = #{revAccount} </if>
<if test="revAccountName != null and revAccountName !='' "> and v.revAccountName = #{revAccountName} </if>
<if test="revBankType != null and revBankType !='' "> and v.revBankType = #{revBankType} </if>
<if test="revBankName != null and revBankName !='' ">and v.revBankName = #{revBankName} </if>
<if test="cnapsCode != null and cnapsCode !='' ">and v.cnapsCode = #{cnapsCode} </if>
<if test="purpose != null and purpose !='' "> and v.purpose = #{purpose} </if>
<if test="personalFlag != null and personalFlag !='' ">and v.personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and v.tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and v.oaId = #{oaId} </if>
<if test="formsonId != null and formsonId !='' ">and v.formsonId = #{formsonId} </if>
<if test="payCompany != null and payCompany !='' "> and v.payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and v.payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and v.title = #{title} </if>
<if test="billName != null and billName !='' "> and v.billName = #{billName} </if>
<if test="payResult != null and payResult !='' ">and v.payResult = #{payResult} </if>
<if test="applyCode != null and applyCode !='' ">and v.applyCode = #{applyCode} </if>
<if test="payBankName != null and payBankName !='' ">and v.payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and v.payType = #{payType} </if>
<if test="finishedflag != null and finishedflag !='' "> and v.finishedflag = #{finishedflag} </if>
and (v.receipt is NULL OR v.receipt = '')
-- and payResult = '支付成功'
</trim>
order by v.oaId,v.sort
</select>
<!-- 查询待支付的 -->
<select id="PaymentEntity_list_base_unpaid" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
@ -266,6 +370,7 @@
<if test="personalFlag != null and personalFlag !='' ">and v.personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and v.tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and v.oaId = #{oaId} </if>
<if test="formsonId != null and formsonId !='' ">and v.formsonId = #{formsonId} </if>
<if test="payCompany != null and payCompany !='' "> and v.payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and v.payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and v.title = #{title} </if>
@ -274,9 +379,13 @@
<if test="payBankName != null and payBankName !='' ">and v.payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and v.payType = #{payType} </if>
<if test="finishedflag != null and finishedflag !='' "> and v.finishedflag = #{finishedflag} </if>
and v.amount > 0
and v.payResult is null
<if test="retryFlag == null or retryFlag == ''">
and v.payResult is null
and v.amount > 0
and v.finishedflag = 1
</if>
</trim>
order by v.oaId,v.sort
</select>
@ -285,10 +394,9 @@
<!-- 查询未完成的 采用==查询 -->
<select id="PaymentEntity_list_base_in_payment" resultMap="get-PaymentEntity-result" parameterType="com.hzya.frame.seeyon.cbs8.entity.PaymentEntity">
select
<include refid="PaymentEntity_Base_Column_List"/>
from
v_hzya_oa_cbs
select v.* from (
<include refid="base_sql"/>
) v
<trim prefix="where" prefixOverrides="and">
<if test="referenceNum != null and referenceNum !='' "> referenceNum = #{referenceNum} </if>
<if test="busType != null and busType !='' "> and busType = #{busType} </if>
@ -304,6 +412,7 @@
<if test="personalFlag != null and personalFlag !='' ">and personalFlag = #{personalFlag} </if>
<if test="tableName != null and tableName !='' "> and tableName = #{tableName} </if>
<if test="oaId != null and oaId !='' ">and oaId = #{oaId} </if>
<if test="formsonId != null and formsonId !='' ">and v.formsonId = #{formsonId} </if>
<if test="payCompany != null and payCompany !='' "> and payCompany = #{payCompany} </if>
<if test="payCompanyCode != null and payCompanyCode !='' "> and payCompanyCode = #{payCompanyCode} </if>
<if test="title != null and title !='' "> and title = #{title} </if>
@ -311,10 +420,11 @@
<if test="payResult != null and payResult !='' ">and payResult = #{payResult} </if>
<if test="payBankName != null and payBankName !='' ">and payBankName = #{payBankName} </if>
<if test="payType != null and payType !='' "> and payType = #{payType} </if>
and (payResult='支付中'
or payResult not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败'))
and personalFlag='0'
and (v.payResult='支付中'
or v.payResult not in ('审批撤销','审批拒绝','处理失败','退票','支付成功','取消支付','修改支付','支付失败'))
and v.personalFlag='0'
</trim>
order by v.oaId,v.sort
</select>

View File

@ -82,13 +82,15 @@ public class CbsLogServiceImpl extends BaseService<CbsLogEntity,String> implemen
String payee = StringUtil.nullConvert(cbsLogEntity.getPayee());
String amount = StringUtil.nullConvert(cbsLogEntity.getAmount());
String cbs_apply_code = StringUtil.nullConvert(cbsLogEntity.getCbs_apply_code());
String formson_id = StringUtil.nullConvert(cbsLogEntity.getFormson_id());
//根据oaid判断是否在日志表中存在如果存在则更新如果不存在则新增
CbsLogEntity cbsLogEntityResend=new CbsLogEntity();
cbsLogEntityResend.setOa_id(cbsLogEntity.getOa_id());
cbsLogEntityResend.setFormson_id(cbsLogEntity.getFormson_id());
cbsLogEntityResend.setDataSourceCode(oa_data_source_code);
List<CbsLogEntity> queryList = query(cbsLogEntityResend);
if(CollectionUtils.isEmpty(queryList)){
String data = StrUtil.format(getXmlTemplate(),title,pay_company,payee,amount,cbs_apply_code,bill_code,oa_id,tab_name_ch,tab_name_en,pay_state,message,apply_state,successed);
String data = StrUtil.format(getXmlTemplate(),title,pay_company,payee,amount,cbs_apply_code,bill_code,oa_id,tab_name_ch,tab_name_en,pay_state,message,apply_state,successed,formson_id);
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
.put("apiCode", "8000240007")
.put("publicKey","ZJYAorA7JuRDfrVjywcx78BFcqlLwthgXNC65TXxxQMUHuxCe7eDIk+3zDUT+v578prj")//发送者
@ -109,12 +111,13 @@ public class CbsLogServiceImpl extends BaseService<CbsLogEntity,String> implemen
logEntity.setApply_state(apply_state);
logEntity.setSuccessed(successed);
logEntity.setBill_code(cbsLogEntity.getBill_code());
logEntity.setCbs_apply_code(cbs_apply_code);
logEntity.setDataSourceCode(oa_data_source_code);
try {
update(logEntity);
updateLog(logEntity);
}catch (Exception e){
e.printStackTrace();
logger.error("更新");
logger.error("更新cbs交易日志出错:{}",e);
}
}
}
@ -186,14 +189,14 @@ public class CbsLogServiceImpl extends BaseService<CbsLogEntity,String> implemen
*
* @param logEntity
*/
@DS("#logEntity.dataSourceCode")
// @DS("#logEntity.dataSourceCode")
@Override
public void updateLog(CbsLogEntity logEntity) {
cbsLogDao.update(logEntity);
cbsLogDao.updateLog(logEntity);
}
//获取xml模板
private String getXmlTemplate(){
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 "<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\"/><column id=\"field0020\" type=\"0\" name=\"OA子表id\" 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><column name=\"OA子表id\"><value><![CDATA[{}]]></value></column></values><subForms/></formExport></forms>";
}
}

View File

@ -24,6 +24,51 @@ public class PayBillEntity extends BaseEntity {
private String pkOrg;//组织
private String pkCustomer;//客户
private String pk_oppaccount;//付款账户
private String pkBalatype;//结算方式
private String billCode;//单据编号
private String queryState;
private String pkRecproject;//收款方名称
private String memo;//摘要
public String getPkRecproject() {
return pkRecproject;
}
public void setPkRecproject(String pkRecproject) {
this.pkRecproject = pkRecproject;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getQueryState() {
return queryState;
}
public void setQueryState(String queryState) {
this.queryState = queryState;
}
public String getBillCode() {
return billCode;
}
public void setBillCode(String billCode) {
this.billCode = billCode;
}
public String getPkBalatype() {
return pkBalatype;
}
public void setPkBalatype(String pkBalatype) {
this.pkBalatype = pkBalatype;
}
public String getPkCustomer() {
return pkCustomer;

View File

@ -10,46 +10,103 @@
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
<result property="pkBalatype" column="pk_balatype" jdbcType="VARCHAR"/>
<result property="billCode" column="bill_code" jdbcType="VARCHAR"/>
<result property="memo" column="memo" jdbcType="VARCHAR"/>
<result property="pkRecproject" column="pk_recproject" jdbcType="VARCHAR"/>
</resultMap>
<!--工程项目查询-->
<select id="PayBillEntity_list_base" resultMap="get-PayBillEntity-result" parameterType="com.hzya.frame.seeyon.paybill.entity.PayBillEntity">
select bill_code,m1.id,bill_date,formmain_0236.field0003 as pk_recproject,memo,primal_money,pk_oppaccount,pk_supplier,pk_org,pk_balatype,table_name,field_name,send_state from (
SELECT
body.id as id,
field0001 as bill_code,
field0070 AS bill_date,
field0057 AS primal_money,
field0019 AS pk_oppaccount,
field0082 AS pk_supplier,
case
when field0065 = '-3106276434709167837' then 'GGKH'
when field0065 = '-4979667232919961351' then field0083
end AS pk_supplier,
field0089 AS pk_org,
field0091 AS pk_balatype,
field0090 AS pk_recproject_code,
field0092 AS memo,
'formson_0222' as table_name,
'field0084' as field_name
'field0084' as field_name,
field0084 as send_state
FROM formmain_0093 main
LEFT JOIN formson_0222 body ON main.id = body.formmain_id
WHERE field0070 IS NOT null and field0084 is null
WHERE field0070 IS NOT null and finishedflag = '1'
union all
SELECT
body.id as id,
field0017 as bill_code,
field0073 AS bill_date,
field0031 AS primal_money,
field0042 AS pk_oppaccount,
field0077 AS pk_supplier,
case
when field0070 = '-3106276434709167837' then 'GGKH'
when field0070 = '-4979667232919961351' then field0077
end AS pk_supplier,
field0082 AS pk_org,
field0084 AS pk_balatype,
field0083 AS pk_recproject,
field0086 AS memo,
'formson_0210' as table_name,
'field0078' as field_name
'field0078' as field_name,
field0078 as send_state
FROM formmain_0209 main
LEFT JOIN formson_0210 body ON main.id = body.formmain_id
WHERE field0073 IS NOT null and field0078 is null
WHERE field0073 IS NOT null and finishedflag = '1'
union all
SELECT
body.id as id,
field0001 as bill_code,
field0053 AS bill_date,
field0041 AS primal_money,
field0024 AS pk_oppaccount,
field0057 AS pk_supplier,
case
when field0048 = '-3106276434709167837' then 'GGKH'
when field0048 = '-4979667232919961351' then field0057
end AS pk_supplier,
field0061 AS pk_org,
field0063 AS pk_balatype,
field0062 AS pk_recproject,
field0064 AS memo,
'formson_0223' as table_name,
'field0058' as field_name
'field0058' as field_name,
field0058 as send_state
FROM formmain_0094 main
LEFT JOIN formson_0223 body ON main.id = body.formmain_id
WHERE field0053 IS NOT NULL and field0058 is null
WHERE field0053 IS NOT NULL and finishedflag = '1'
union all
SELECT
main.id as id,
field0002 as bill_code,
field0058 AS bill_date,
sum(field0019) AS primal_money,
field0051 AS pk_oppaccount,
'GGKH' AS pk_supplier,
field0048 AS pk_org,
field0060 AS pk_balatype,
'' AS pk_recproject,
field0061 AS memo,
'formmain_0224' as table_name,
'field0055' as field_name,
field0055 as send_state
FROM formmain_0224 main
LEFT JOIN formson_0225 body ON main.id = body.formmain_id
WHERE field0058 IS NOT NULL and finishedflag = '1'
group by main.id,field0002,field0058,field0051,field0048
,field0060,field0055,field0047,field0061
)m1 left join formmain_0236 on m1.pk_recproject_code = formmain_0236.field0002
<trim prefix="where" prefixOverrides="and">
<if test="id != null and id != ''"> and id = #{id} </if>
<if test="queryState != null and queryState != ''"> and send_state is null</if>
</trim>
</select>
<!--通过主键修改方法-->

View File

@ -1,5 +1,6 @@
package com.hzya.frame.seeyon.paybill.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -10,6 +11,9 @@ import com.hzya.frame.seeyon.paybill.dao.IPayBillDao;
import com.hzya.frame.seeyon.paybill.entity.PayBillEntity;
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
import com.hzya.frame.seeyon.service.impl.SeeYonInterFaceImpl;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.u9c.itemmaster.entity.VU9cItemmasterEntity;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.jetbrains.annotations.NotNull;
@ -18,6 +22,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@ -31,7 +36,8 @@ import java.util.List;
@Service("PayBillServiceImpl")
public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implements IPayBillService {
private static final Logger logger = LoggerFactory.getLogger(PayBillServiceImpl.class);
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired
private IPayBillDao payBillDao;
/**
@ -43,59 +49,118 @@ public class PayBillServiceImpl extends BaseService<PaymentEntity,String> implem
*/
@Override
public JsonResultEntity sendEngineerPayBillToBip(JSONObject requestJson) {
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
String interId = requestJsonObj.getString("integration_task_living_details_id");
logger.info("付款结算单重推解析后:"+requestJsonObj.toString());
logger.info("付款结算单重推执行的任务主键:"+interId);
JsonResultEntity resultEntity = new JsonResultEntity();
PayBillEntity entity = new PayBillEntity();
requestJson.put("db_code","OA");
entity.setDataSourceCode(requestJson.getString("db_code"));
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
if(StrUtil.isNotEmpty(interId)){
oldMsg = taskLivingDetailsService.get(interId);
}
String rootAppPk = oldMsg.getRootAppPk();
entity.setId(rootAppPk);
if(StrUtil.isEmpty(rootAppPk)){
entity.setQueryState("查询");
}
List<PayBillEntity>payBillEntityList = payBillDao.getOaEngineerPay(entity);
if(CollectionUtils.isNotEmpty(payBillEntityList)){
for(PayBillEntity pay : payBillEntityList){
String token = BipUtil.getBipToken("yonyou","8000230000");
JSONObject main = bindingAdd(pay);
logger.info("工程付款单调用中台生成BIP付款结算单推送报文{}",main.toString());
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230014",token);
logger.info("工程付款单调用中台生成BIP付款结算单返回结果{}",result);
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("success");
if(flag){
pay.setState("Y");
}else{
pay.setState("N");
try {
String token = BipUtil.getBipToken("yonyou","8000230000");
JSONObject main = bindingAdd(pay);
logger.info("工程付款单调用中台生成BIP付款结算单推送报文{}",main.toString());
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230014",token);
logger.info("工程付款单调用中台生成BIP付款结算单返回结果{}",result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(pay.getId());
logDetails.setRootAppBill(pay.getBillCode());
logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(pay));
//logDetails.setNewState(SysMessageManageLogStatusEnum.statusGetValue(logEntity.getStatus()));
logDetails.setPluginId("PayBillPlugin");
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("success");
if(flag){
pay.setState("Y");
}else{
pay.setState("N");
}
pay.setDataSourceCode(requestJson.getString("db_code"));
try {
if(StrUtil.isEmpty(interId)){
if(flag){
taskLivingDetailsService.saveLogToSuccess(logDetails);
}else{
taskLivingDetailsService.saveLogToFail(logDetails);
}
}else{
logDetails.setId(interId);
if(flag){
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
}else{
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
}
}
} catch (Exception e) {
logger.info("保存日志失败"+e.getMessage());
payBillDao.updateState(pay);
e.printStackTrace();
}
payBillDao.updateState(pay);
// todo 后续在写吧没字段等OA开了外网在创建修改推送状态避免再次查询
} catch (Exception e) {
logger.info("付款单执行失败:"+e.getMessage());
e.printStackTrace();
}
pay.setDataSourceCode(requestJson.getString("db_code"));
payBillDao.updateState(pay);
// todo 后续在写吧没字段等OA开了外网在创建修改推送状态避免再次查询
}
}
return null;
return new JsonResultEntity("成功",true,resultEntity);
}
@NotNull
private JSONObject bindingAdd(PayBillEntity pay) {
String billDate = pay.getBillDate().substring(0,19);
if(billDate.length()>19){
billDate= pay.getBillDate().substring(0,19);
}
JSONObject head = new JSONObject();
head.put("pk_org","");//所属组织
head.put("pk_group","");//集团
head.put("pk_org",pay.getPkOrg());//所属组织
head.put("pk_group","ycjf");//集团
head.put("bill_type","F5");//单据类型 默认F5
head.put("trade_type","D5");//付款结算类型 默认D5
head.put("source_flag","2");//付款结算类型 默认2
head.put("bill_date",pay.getBillDate());//单据日期
head.put("bill_date",billDate);//单据日期
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
head.put("pk_currtype","CNY");//币种
head.put("billmaker","");//制单人
head.put("billmaker","yonyou");//制单人//先临时使用管理员账户后续在确认
//处理明细数据按照明细付款 多个明细生成多个付款结算单
JSONArray detailsArr = new JSONArray();
JSONObject body = new JSONObject();
body.put("pk_org","");//所属组织
body.put("pk_group","");//集团
body.put("pk_org",pay.getPkOrg());//所属组织
body.put("pk_balatype",pay.getPkBalatype());//结算方式
body.put("pk_group","ycjf");//集团
body.put("bill_type","F5");//单据类型 默认F5
body.put("trade_type","D5");//付款结算类型 默认D5
body.put("pk_currtype","CNY");//币种
body.put("bill_date",pay.getBillDate());//单据日期
body.put("bill_date",billDate);//单据日期
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
body.put("creationtime",pay.getBillDate());//创建时间
body.put("creationtime",billDate);//创建时间
body.put("direction","-1");//方向 :1=;-1=;
body.put("objecttype","0");//交易对象
body.put("pk_customer",pay.getPkCustomer());//客户
body.put("pk_account",pay.getPkOppaccount());//付款银行账号
body.put("pk_customer",pay.getPkSupplier());//客户
body.put("pk_recproject",pay.getPkRecproject());//收支项目
body.put("memo",pay.getMemo());//摘要
String pkOppaccount = "";
if(StrUtil.isNotEmpty(pay.getPkOppaccount())){
pkOppaccount = pay.getPkOppaccount().replaceAll(" ","");
}
body.put("pk_oppaccount",pkOppaccount);//付款银行账号
detailsArr.add(body);
JSONObject main = new JSONObject();
main.put("head",head);//表头

View File

@ -20,11 +20,11 @@ public class RecBillDaoImpl extends MybatisGenericDao implements IRecBillDao {
@DS("#rec.dataSourceCode")
@Override
public List<RecBillEntity> getOaRecBill(RecBillEntity rec) {
return super.selectList("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.PayBillEntity_list_base",rec);
return super.selectList("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.RecBillEntity_list_base",rec);
}
@DS("#rec.dataSourceCode")
@Override
public int updateState(RecBillEntity rec) {
return super.update("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.PayBillEntity_update",rec);
return super.update("com.hzya.frame.seeyon.recbill.dao.impl.RecBillDaoImpl.RecBillEntity_update",rec);
}
}

View File

@ -21,6 +21,60 @@ public class RecBillEntity extends BaseEntity {
private String pkCustomer;//客户
private String pkAccount;//收款账户
private String pkOrg;//组织
private String billmaker;//组织
private String billCode;//单据编号
private String queryState;
private String pkBalatype;//结算方式
private String pkRecproject;//收款方名称
private String memo;//摘要
public String getPkBalatype() {
return pkBalatype;
}
public void setPkBalatype(String pkBalatype) {
this.pkBalatype = pkBalatype;
}
public String getPkRecproject() {
return pkRecproject;
}
public void setPkRecproject(String pkRecproject) {
this.pkRecproject = pkRecproject;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
public String getQueryState() {
return queryState;
}
public void setQueryState(String queryState) {
this.queryState = queryState;
}
public String getBillCode() {
return billCode;
}
public void setBillCode(String billCode) {
this.billCode = billCode;
}
public String getBillmaker() {
return billmaker;
}
public void setBillmaker(String billmaker) {
this.billmaker = billmaker;
}
public String getPkCustomer() {
return pkCustomer;

View File

@ -12,22 +12,35 @@
<result property="pkSupplier" column="pk_supplier" jdbcType="VARCHAR"/>
<result property="tableName" column="table_name" jdbcType="VARCHAR"/>
<result property="fieldName" column="field_name" jdbcType="VARCHAR"/>
<result property="billCode" column="bill_code" jdbcType="VARCHAR"/>
<result property="memo" column="memo" jdbcType="VARCHAR"/>
<result property="pkRecproject" column="pk_recproject" jdbcType="VARCHAR"/>
</resultMap>
<!--工程项目查询-->
<select id="RecBillEntity_list_base" resultMap="get-RecBillEntity-result" parameterType="com.hzya.frame.seeyon.recbill.entity.RecBillEntity">
SELECT
field0002 AS pk_org,
field0006 AS bill_date,
field0009 AS primal_money,
field0001 AS pk_account,
field0013 AS pk_customer,
field0012 AS pk_oppaccount,
SELECT
main.id AS id,
main.field0005 AS bill_code,
org.field0002 AS pk_org,
main.field0006 AS bill_date,
main.field0009 AS primal_money,
main.field0001 AS pk_account,
case when cust.field0013 is null then 'GGKH' else cust.field0013 end AS pk_customer,
main.field0012 AS pk_oppaccount,
'formmain_0233' as table_name,
'field0016' as field_name
FROM formmain_0233
WHERE field0016 IS null
'field0016' as field_name,
concat(cust.field0014,main.field0010) as memo,
cost.field0003 as pk_recproject
FROM formmain_0233 main
left join formmain_0235 org on main.field0002 = org.field0001
left join formmain_0177 cust on main.field0013 = cust.field0014
left join formmain_0236 cost on cost.field0001 = main.field0010
where 1=1
<if test="id != null and id != ''"> and main.id = #{id} </if>
<if test="queryState != null and queryState != ''"> and main.field0016 IS null </if>
and org.field0002 is not null
</select>
<!--通过主键修改方法-->

View File

@ -1,5 +1,6 @@
package com.hzya.frame.seeyon.recbill.service.impl;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
@ -9,6 +10,8 @@ import com.hzya.frame.seeyon.cbs8.entity.PaymentEntity;
import com.hzya.frame.seeyon.recbill.dao.IRecBillDao;
import com.hzya.frame.seeyon.recbill.entity.RecBillEntity;
import com.hzya.frame.seeyon.recbill.service.IRecBillService;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.commons.collections.CollectionUtils;
import org.jetbrains.annotations.NotNull;
@ -17,6 +20,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
@ -30,7 +34,8 @@ import java.util.List;
@Service("RecBillServiceImpl")
public class RecBillServiceImpl extends BaseService<PaymentEntity,String> implements IRecBillService {
private static final Logger logger = LoggerFactory.getLogger(RecBillServiceImpl.class);
@Autowired
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
@Autowired
private IRecBillDao payBillDao;
/**
@ -42,59 +47,112 @@ public class RecBillServiceImpl extends BaseService<PaymentEntity,String> implem
*/
@Override
public JsonResultEntity sendRecBillToBip(JSONObject requestJson) {
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
String interId = requestJsonObj.getString("integration_task_living_details_id");
logger.info("付款结算单重推解析后:"+requestJsonObj.toString());
logger.info("收款结算单重推执行的任务主键:"+interId);
JsonResultEntity resultEntity = new JsonResultEntity();
RecBillEntity entity = new RecBillEntity();
requestJson.put("db_code","OA");
entity.setDataSourceCode(requestJson.getString("db_code"));
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
if(StrUtil.isNotEmpty(interId)){
oldMsg = taskLivingDetailsService.get(interId);
}
String rootAppPk = oldMsg.getRootAppPk();
entity.setId(rootAppPk);
if(StrUtil.isEmpty(rootAppPk)){
entity.setQueryState("查询");
}
List<RecBillEntity>payBillEntityList = payBillDao.getOaRecBill(entity);
if(CollectionUtils.isNotEmpty(payBillEntityList)){
for(RecBillEntity pay : payBillEntityList){
String token = BipUtil.getBipToken("yonyou","8000230000");
JSONObject main = bindingAdd(pay);
logger.info("银行流水收款信息数据{}",main.toString());
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230016",token);
logger.info("银行流水收款信息数据{}",result);
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("success");
if(flag){
pay.setState("Y");
}else{
pay.setState("N");
try {
String token = BipUtil.getBipToken("yonyou","8000230000");
JSONObject main = bindingAdd(pay);
logger.info("银行流水收款信息数据{}",main.toString());
String result = BipUtil.sendU9cTOBipEsb(main.toString(),"8000230016",token);
logger.info("银行流水收款信息数据{}",result);
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(pay.getId());
logDetails.setRootAppBill(pay.getBillCode());
logDetails.setNewTransmitInfo(result);
logDetails.setNewPushDate(new Date());
logDetails.setRootAppNewData(JSON.toJSONString(pay));
//logDetails.setNewState(SysMessageManageLogStatusEnum.statusGetValue(logEntity.getStatus()));
logDetails.setPluginId("RecBillPluginInitializer");
JSONObject resultObj = JSON.parseObject(result);
boolean flag = resultObj.getBoolean("success");
if(flag){
pay.setState("Y");
}else{
pay.setState("N");
}
pay.setDataSourceCode(requestJson.getString("db_code"));
try {
if(StrUtil.isEmpty(interId)){
if(flag){
taskLivingDetailsService.saveLogToSuccess(logDetails);
}else{
taskLivingDetailsService.saveLogToFail(logDetails);
}
}else{
logDetails.setId(interId);
if(flag){
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
}else{
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
}
}
} catch (Exception e) {
logger.info("保存日志失败"+e.getMessage());
payBillDao.updateState(pay);
e.printStackTrace();
}
payBillDao.updateState(pay);
// todo 后续在写吧没字段等OA开了外网在创建修改推送状态避免再次查询
} catch (Exception e) {
logger.info("收款单执行失败:"+e.getMessage());
e.printStackTrace();
}
pay.setDataSourceCode(requestJson.getString("db_code"));
payBillDao.updateState(pay);
// todo 后续在写吧没字段等OA开了外网在创建修改推送状态避免再次查询
}
}
return null;
return new JsonResultEntity("成功",true,resultEntity);
}
@NotNull
private JSONObject bindingAdd(RecBillEntity pay) {
String dateSte = pay.getBillDate()+" 00:00:00";
JSONObject head = new JSONObject();
head.put("pk_org","");//所属组织
head.put("pk_group","");//集团
head.put("pk_org",pay.getPkOrg());//所属组织
head.put("pk_group","ycjf");//集团
head.put("bill_type","F4");//单据类型 默认F5
head.put("trade_type","D4");//付款结算类型 默认D5
head.put("source_flag","2");//付款结算类型 默认2
head.put("bill_date",pay.getBillDate());//单据日期
head.put("bill_date",dateSte);//单据日期
head.put("primal_money",pay.getPrimalMoney());//付款原币金额
head.put("pk_currtype","CNY");//币种
head.put("billmaker","");//制单人
head.put("billmaker","yonyou");//制单人 //先临时使用管理员账户后续在确认
//处理明细数据按照明细付款 多个明细生成多个付款结算单
JSONArray detailsArr = new JSONArray();
JSONObject body = new JSONObject();
body.put("pk_org","");//所属组织
body.put("pk_group","");//集团
body.put("pk_org",pay.getPkOrg());//所属组织
body.put("pk_balatype",pay.getPkBalatype());//结算方式
body.put("pk_group","ycjf");//集团
body.put("bill_type","F4");//单据类型 默认F5
body.put("trade_type","D4");//付款结算类型 默认D5
body.put("pk_currtype","CNY");//币种
body.put("bill_date",pay.getBillDate());//单据日期
body.put("pay_primal",pay.getPrimalMoney());//付款原币金额
body.put("creationtime",pay.getBillDate());//创建时间
body.put("bill_date",dateSte);//单据日期
body.put("rec_primal",pay.getPrimalMoney());//付款原币金额
body.put("creationtime",dateSte);//创建时间
body.put("direction","-1");//方向 :1=;-1=;
body.put("objecttype","0");//交易对象
body.put("pk_customer",pay.getPkCustomer());//客户
body.put("pk_account",pay.getPkAccount());//收款银行账号
// body.put("pk_recproject",pay.getPkRecproject());//收支项目
body.put("memo",pay.getMemo());//摘要
detailsArr.add(body);
JSONObject main = new JSONObject();
main.put("head",head);//表头

View File

@ -1655,8 +1655,30 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
//例如A应用发送数据到中台中台转发到B应用
HttpServletRequest request = (HttpServletRequest) servletRequest;
String oldbodys = ServletUtil.getBody(servletRequest);
Enumeration<String> headerNames = request.getHeaderNames();
Map<String, String> newheader = ServletUtil.getHeaderMap(request);
StringBuffer newheaders = new StringBuffer();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
newheader.put(headerName,headerValue);
newheaders.append(headerName).append("=").append(headerValue).append("&");
}
logger.info("转发接口获取newheaders信息"+ newheaders);
Map<String, String> oldheaderMap = ServletUtil.getHeaderMap(request);
String oldquerys = request.getQueryString();
logger.info("转发接口获取querys信息"+ oldquerys);
if (oldheaderMap != null && oldheaderMap.size() > 0) {
StringBuffer stringBuffer = new StringBuffer();
for (String key : oldheaderMap.keySet()) {
stringBuffer.append(key).append("=").append(oldheaderMap.get(key)).append("&");
}
logger.info("转发接口获取header信息"+ stringBuffer);
}
logger.info("转发接口获取bodys信息"+ oldbodys);
//应用key
String publicKey = request.getHeader("publicKey");
//应用密钥
@ -1766,7 +1788,13 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
Method[] methods = null;
Object object = null;
if (headers != null && headers.size() > 0) {
StringBuffer stringBuffer = new StringBuffer();
for (String key : headers.keySet()) {
stringBuffer.append(key).append("=").append(headers.get(key)).append("&");
}
logger.info("内部方法转换前header信息"+ stringBuffer);
}
// 判断是否有内部api 是否扩展api 1启用 2停用
@ -1790,6 +1818,7 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
if (m.getName().equals(receiveApi.getFunName().trim())) {
try {
logger.info("invoke开始>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
sysExtensionApiEntity = (SysExtensionApiEntity) m.invoke(object, sysExtensionApiEntity);
logger.info("invoke结束>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
break;
@ -1805,6 +1834,15 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
headers = sysExtensionApiEntity.getHeaders();
String querys = sysExtensionApiEntity.getQuerys();
String bodys = sysExtensionApiEntity.getBodys();
if (headers != null && headers.size() > 0) {
StringBuffer stringBuffer = new StringBuffer();
for (String key : headers.keySet()) {
stringBuffer.append(key).append("=").append(headers.get(key)).append("&");
}
logger.info("内部方法转换后header信息"+ stringBuffer);
}
logger.info("内部方法转换bodys信息"+ bodys);
//设置参数获取参数
StringBuffer url = new StringBuffer();
if(!receiveApi.getDestinationAddress().toLowerCase().startsWith("http")){
@ -1867,6 +1905,15 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
entity.setContentType("application/json");
post.setEntity(entity);
}
if (headers != null && headers.size() > 0) {
StringBuffer stringBuffer = new StringBuffer();
for (String key : headers.keySet()) {
stringBuffer.append(key).append("=").append(headers.get(key)).append("&");
}
logger.info("转发接口发送header信息"+ stringBuffer);
}
logger.info("转发接口发送bodys信息"+ bodys);
response = closeableHttpClient.execute(post);
HttpEntity entity = response.getEntity();
@ -2079,16 +2126,18 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
Map<String, String> headers,
String oldquerys, String querys,
String body, boolean flag,String msg) {
logger.info("保存日志开始内部");
SysMessageManageLogEntity sysMessageManageLogEntity = new SysMessageManageLogEntity();
//messageManageId 消息主表主键
//theme 消息主题
//messageCode 消息编码
//sendApp
sysMessageManageLogEntity.setSendApp(sendApp.getId());//发送者应用
sysMessageManageLogEntity.setSendApp(sendApp.getId() != null ? sendApp.getId() : null);//发送者应用
//sendApi 发送者
sysMessageManageLogEntity.setReceiveCode(receiveApi.getApiCode() != null ? receiveApi.getApiCode().toString() : null);//接收者编码
sysMessageManageLogEntity.setReceiveApp(receiveApp.getId());//接收者应用
sysMessageManageLogEntity.setReceiveApi(receiveApi.getId());//接收者
sysMessageManageLogEntity.setReceiveApp(receiveApp.getId() != null ? receiveApp.getId() : null);//接收者应用
sysMessageManageLogEntity.setReceiveApi(receiveApi.getId() != null ? receiveApi.getId() : null);//接收者
JSONObject jsonObject = new JSONObject();
jsonObject.put("body", oldbodys);
jsonObject.put("header", oldheaderMap);
@ -2701,7 +2750,17 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
}
logger.info("保存日志开始");
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(),true,null);
try {
Base64.getEncoder().encodeToString(byteBodys);
} catch (Exception e) {
logger.error("byteBodys{}", e.getMessage());
}
try {
Base64.getEncoder().encodeToString(body);
} catch (Exception e) {
logger.error("body{}", e.getMessage());
}
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, Base64.getEncoder().encodeToString(body),true,null);
if (methods != null && methods.length > 0) {
for (Method m : methods) {
if (null != m) {
@ -2783,6 +2842,8 @@ public class SysApplicationServiceImpl extends BaseService<SysApplicationEntity,
}
logger.info("保存日志开始");
SysMessageManageLogEntity sysMessageManageLogEntity = saveLog(sendApp, receiveApp, receiveApi, oldbodys,Base64.getEncoder().encodeToString(byteBodys) , oldheaderMap,headers, headers, oldquerys,querys, body.toString(), true,null);
logger.info("保存日志结束");
if (methods != null && methods.length > 0) {
for (Method m : methods) {
if (null != m) {

View File

@ -36,7 +36,7 @@ public class MasterDataDaoImpl extends BaseService<ComparisonEntity, String> imp
List<HashMap<String, Object>> hashMaps = execSqlService.execSelectSql(str, "");
return hashMaps;
}catch (Exception e){
logger.info("U8C主数据档案用户档案没有需要同步中台的数据");
logger.info("主数据查询异常"+e.getMessage());
return null;
}
}

View File

@ -1,5 +1,6 @@
package com.hzya.frame.sysnew.comparison.masterData.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
@ -60,9 +61,9 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
for (MdmModuleSourceEntity mdmModuleSourceEntity : list) {
// applicationCache.get()
// logger.info("入参数据"+jsonObject.toString());
String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的开始时间
String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm:ss");//定时任务执行时传入的结束时间
// logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime);
String startTime = DateUtil.format(json.getDate("startTime"),"yyyy-MM-dd HH:mm");//定时任务执行时传入的开始时间
String endTime = DateUtil.format(json.getDate("endTime"),"yyyy-MM-dd HH:mm");//定时任务执行时传入的结束时间
logger.info("本次任务查询区间开始时间:{} 结束时间:{}",startTime,endTime);
String tableName = "";
try {
//通过不同的应用类型用于拼接sql
@ -75,6 +76,9 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
}
// if(!"10003".equals(mdmCode)){
// continue;
// }
// if(1==1){
// continue;
// }
switch (appTyp) {//1致远OA 2用友U8C 3用友BIP
case "1":
@ -101,7 +105,7 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
if (null != listAll && listAll.size() > 0) {
ParametricAssembly(mdmModuleSourceEntity, listAll, mdmCode, tableName);
} else {
logger.info("U8C主数据档案没有需要同步中台的数据");
logger.info("U8C主数据档案没有需要同步中台的数据"+mdmCode);
}
} catch (Exception e) {
logger.info("主数据同步错误:{}",e.getMessage());
@ -153,7 +157,14 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
sb.append(" and a.modify_date < '"+endTime+"'");
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("SELECT id as data_id,field0013 AS code,field0014 AS name,field0016 AS pk_custclass,field0015 AS shortname,field0012 AS pk_org FROM formmain_0177 a WHERE 1=1 " +sb.toString());
stringBuffer.append("SELECT a.id as data_id, field0013 AS code, field0014 AS name,\n" +
"0 AS custprop, 1 AS custstate, 2 AS enablestate,\n" +
"'CN' AS pk_country, 'P0800' AS pk_timezone, 'ZH-CN' AS pk_format,\n" +
"'ycjf' AS pk_group, item.code AS pk_custclass_code,item.SHOWVALUE AS pk_custclass,'项目' as custprop_type, field0015 AS shortname,\n" +
"'ycjf' AS pk_org \n" +
"FROM formmain_0177 a\n" +
"LEFT JOIN ctp_enum_item item ON a.field0031 = item.id " +
"WHERE 1=1 " +sb.toString());
mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);
if(CollectionUtils.isNotEmpty(hashMaps)){
@ -196,12 +207,10 @@ public class MasterDataServiceImpl extends BaseService<ComparisonEntity, String>
}else{
// ts = DateUtil.dateToString(new Date(), "yyyy-MM-dd HH:mm:ss");
sb.append(" and a.update_time >= '"+startTime+"'");
sb.append(" and a.update_time <> '"+endTime+"'");
sb.append(" and a.update_time < '"+endTime+"'");
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select a.id as data_id, a.name as user_name, a.code AS user_code,e.LOGIN_NAME as login_name,CASE WHEN EXT_ATTR_11 = '1' \n" +
"THEN '男' WHEN EXT_ATTR_11 = '2' THEN '女' ELSE NULL END AS gender,CASE WHEN (a.EXT_ATTR_1 IS NULL OR a.EXT_ATTR_1 ='') THEN '11111111111' ELSE a.EXT_ATTR_1 END AS mobile FROM org_member a left join org_principal e on a.id = e.MEMBER_ID\n" +
" WHERE 1=1 and e.LOGIN_NAME IS not null " + sb.toString());
stringBuffer.append("SELECT a.id AS data_id, a.NAME AS user_name, a.CODE AS user_code, e.LOGIN_NAME AS login_name, 'Hzya@1314' as user_password, 'N' as islocked, '1' as user_type, '0' as base_doc_type, '静态密码验证' as identityverifycode, '0000' as pk_org, 'ZH-CN' as format, 'Y' as isca, '2' as enablestate, 'ZH' as contentlang, a.CODE as user_code_q, CASE WHEN EXT_ATTR_11 = '1' THEN '男' WHEN EXT_ATTR_11 = '2' THEN '女' ELSE NULL END AS gender, CASE WHEN ( a.EXT_ATTR_1 IS NULL OR a.EXT_ATTR_1 = '' ) THEN '11111111111' ELSE a.EXT_ATTR_1 END AS mobile FROM org_member a LEFT JOIN org_principal e ON a.id = e.MEMBER_ID WHERE 1=1 and e.LOGIN_NAME IS not null"+ sb.toString()+"" );//
// " WHERE 1=1 and a.id = '-2698997042624247722'");
mdmModuleSourceEntity.setDataSourceCode(dbCode);
List<HashMap<String, Object>> hashMaps = masterDataDaoImpl.queryArchivesByDataSource(stringBuffer.toString(),mdmModuleSourceEntity);

View File

@ -326,6 +326,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
} else {
jsonObjectList.put(comparisonDetailsEntity.getDbName(), new ArrayList<>());
}
jsonObjectList.remove(null);
list.add(jsonObjectList);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(uuid,jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口新增",jsonObject.getString("optionName"),tableName+"_option_log","1");
@ -460,6 +461,7 @@ public class ComparisonServiceImpl extends BaseService<ComparisonEntity, String>
}else{
jsonObjectList.put(comparisonDetailsEntity.getDbName(),new ArrayList<>());
}
jsonObjectList.remove(null);
jsonObjects.add(jsonObjectList);
//保存操作日志
controlsLogDaoimpl.saveControlsLog(comparisonEntity.getId(),jsonObject.getString("appName"),jsonObject.getString("appCode"),jsonObject.toJSONString(),"接口更新",jsonObject.getString("optionName"),comparisonEntity.getDbName()+"_option_log","1");

View File

@ -34,7 +34,7 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
}
public static void main(String[] args) {
java.lang.String str = "{\"data\":{\"enablestate\":\"2\",\"user_password\":\"Hzya@1314\",\"gender\":\"12312\",\"user_name\":\"测试用户\",\"modify_time\":1719305835000,\"document_rule_num\":112,\"pk_org\":{\"org_mnecode\":\"1\",\"modify_time\":1718866279000,\"document_rule_num\":4,\"add_status\":\"0\",\"org_address\":\"1\",\"delete_status\":\"1\",\"org_innercode\":\"1\",\"id\":\"f7a8cee35fce4aa8ab266b3c7f125d7d\",\"data_status\":\"F\",\"modify_user_id\":\"1\",\"org_name\":\"开发部\",\"sorts\":4,\"document_rule\":\"ZZ-2024-06-20-00004\",\"create_user_id\":\"1\",\"create_time\":1718864103000,\"company_id\":\"Y\",\"org_memo\":\"1\",\"update_status\":\"0\",\"sts\":\"Y\",\"org_tel\":\"1\",\"org_id\":\"Y\",\"org_ncindustry\":\"1\",\"org_fatherorg\":\"c4913dde8da142bab4206fc084269382\",\"org_code\":\"003\",\"org_principal\":\"1\",\"org_countryzone\":\"1\"},\"add_status\":\"0\",\"pwdlevelcode\":\"\",\"user_type\":\"1\",\"user_code\":\"17633965916\",\"delete_status\":\"1\",\"id\":\"d99fe4e1c211450a960f7a1057da0d2c\",\"data_status\":\"F\",\"modify_user_id\":\"1\",\"sorts\":346,\"document_rule\":\"YH-2024-06-25-00112\",\"create_user_id\":\"1\",\"create_time\":1719305229000,\"company_id\":\"Y\",\"user_code_q\":\"KP003\",\"format\":\"ZH-CN\",\"mobile\":\"123123\",\"identityverifycode\":\"静态密码验证\",\"islocked\":\"N\",\"update_status\":\"0\",\"base_doc_type\":\"0\",\"sts\":\"Y\",\"login_name\":\"123123\",\"pwdparam\":\"2024-06-17\",\"org_id\":\"Y\",\"abledate\":\"2024-06-17 00:00:00\",\"isca\":\"Y\",\"contentlang\":\"ZH\"},\"query\":\"[]\",\"header\":\"[{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"100\\\",\\\"index\\\":0,\\\"description\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNR\\\",\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"7127798c-b731-453a-b3ac-cfe9033eeace\\\",\\\"parameterName\\\":\\\"pubKey\\\",\\\"required\\\":true,\\\"example\\\":\\\"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA87rrNREgMNeOEOwlvM2iqqEfshDadRHziDSB2PbRnoMqSv1nGr3XBlZuseNj5HmxDEkLhOdfyw0yjzoz3wK7XhFpeN4Iyf7NT7hps5jAQMEpnul9Qwmj5qUr/eK5SaO9H8n7sh9BvCdrX9oRUh+U2/ceA3O+y/MUHk5DRvSadc8FhpqbOaNBbAzPnyYAwpVUPvaJ90jcGN1ZG99HR1GEzC+Cn9s6vgt7dYL6ysMs36bSP47xraDSxpfr0CLwa6JV/9KjLIeqL1ZaMtK0CJ1zJGCBA6O6kgxeE9Ul7q2lSS6mPAEJ78izaTYsrjhLpKT+eTtFBOLFbiCrbLp8tVE5kwIDAQAB\\\"},{\\\"parameterType\\\":\\\"fundamental\\\",\\\"length\\\":\\\"50\\\",\\\"index\\\":1,\\\"description\\\":\\\"OA\\\",\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"7f965281-df0f-4d2f-b005-07e061fcde49\\\",\\\"parameterName\\\":\\\"client_id\\\",\\\"required\\\":true,\\\"example\\\":\\\"OA\\\"},{\\\"parameterType\\\":\\\"authport\\\",\\\"length\\\":\\\"50\\\",\\\"index\\\":2,\\\"concreteType\\\":\\\"String\\\",\\\"id\\\":\\\"cbc0e105-17c0-4385-8863-8903303edc1f\\\",\\\"parameterName\\\":\\\"access_token\\\",\\\"example\\\":[\\\"attribute\\\",\\\"data\\\",\\\"access_token\\\"]}]\",\"body\":\"[{\\\"index\\\":0,\\\"id\\\":\\\"beeedbc6-24c2-4093-9a5e-20fced9fb1b4\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}";
java.lang.String str = "{\"data\":{\"code\":\"test0628\",\"modify_time\":1719544020000,\"document_rule_num\":1,\"mdm_customer_bank\":[{\"create_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"accnum\":\"6234886523676743\",\"formmain_id\":\"-9194252578190768513\",\"create_time\":1719544020000,\"company_id\":\"0\",\"combinenum\":\"001421036014\",\"modify_time\":1719830508000,\"pk_bankdoc\":\"中国人民银行进贤县支行\",\"sts\":\"Y\",\"data_id\":\"5504698360056529043\",\"org_id\":\"0\",\"id\":\"7565801375982767614\",\"modify_user_id\":\"1\",\"data_status\":\"F\",\"sorts\":173}],\"pk_org\":{},\"add_status\":\"0\",\"data_id\":\"9026082101877884176\",\"delete_status\":\"1\",\"custprop_type\":\"项目\",\"id\":\"-9194252578190768513\",\"modify_user_id\":\"1\",\"data_status\":\"F\",\"sorts\":126,\"document_rule\":\"KH-2024-06-28-00001\",\"create_user_id\":\"c796fd9ba4c9f5ff3cc2fa41a040e443\",\"create_time\":1719544020000,\"update_status\":\"0\",\"sts\":\"Y\",\"pk_custclass\":\"K01\",\"org_id\":\"0\",\"name\":\"越城区人民医院\"},\"query\":\"[]\",\"header\":\"[]\",\"body\":\"[{\\\"index\\\":0,\\\"id\\\":\\\"23af8d17-7ab9-4d71-b357-6f4d04ac0706\\\",\\\"parameterName\\\":\\\"body\\\",\\\"first\\\":true}]\"}";
A88772 s = new A88772();
s.execute(str);
}
@ -46,37 +46,22 @@ public class GroovyIntegrationServiceImpl implements IGroovyIntegrationService {
com.alibaba.fastjson.JSONObject reqData = com.alibaba.fastjson.JSON.parseObject(jsonStr);
com.alibaba.fastjson.JSONObject data = reqData.getJSONObject("data");
com.alibaba.fastjson.JSONObject ufinterfaceObject = new com.alibaba.fastjson.JSONObject();
ufinterfaceObject.put("billtype", "customer");
ufinterfaceObject.put("isexchange", "Y");
ufinterfaceObject.put("replace", "Y");
ufinterfaceObject.put("sender", "openUser");
ufinterfaceObject.put("account", "ycjf");
ufinterfaceObject.put("groupcode", "ycjf");
com.alibaba.fastjson.JSONObject billObject = new com.alibaba.fastjson.JSONObject();
com.alibaba.fastjson.JSONObject billheadObject = new com.alibaba.fastjson.JSONObject();
billheadObject.put("code", data.get("code"));
billheadObject.put("custprop", data.get("custprop"));
billheadObject.put("custstate", data.get("custstate"));
billheadObject.put("pk_custclass", data.get("pk_custclass"));
billheadObject.put("pk_country", data.get("pk_country"));
billheadObject.put("pk_timezone", "P0800");
billheadObject.put("pk_format", "ZH-CN");
billheadObject.put("enablestate", data.get("enablestate"));
billheadObject.put("name", data.get("name"));
billheadObject.put("pk_group", data.get("pk_group"));
billheadObject.put("pk_org", data.get("pk_org"));
billheadObject.put("taxpayerid", data.get("taxpayerid"));
billObject.put("billhead", billheadObject);
ufinterfaceObject.put("bill", billObject);
bodys.put("ufinterface", ufinterfaceObject);
com.alibaba.fastjson.JSONObject mdm_customer = new com.alibaba.fastjson.JSONObject();
mdm_customer.put("code",data.getString("code"));
mdm_customer.put("custprop",data.getString("custprop"));
mdm_customer.put("custstate",data.getString("custstate"));
mdm_customer.put("enablestate",data.getString("enablestate"));
mdm_customer.put("name",data.getString("name"));
mdm_customer.put("name",data.getString("name"));
mdm_customer.put("name",data.getString("name"));
mdm_customer.put("name",data.getString("name"));
mdm_customer.put("name",data.getString("name"));
com.alibaba.fastjson.JSONArray datadetail = data.getJSONArray("mdm_customer_bank");
com.alibaba.fastjson.JSONArray mdm_customer_bank = new com.alibaba.fastjson.JSONArray();
bodys.put("mdm_customer", mdm_customer);
bodys.put("mdm_customer_bank", mdm_customer_bank);
returnObject.put("bodys",bodys.toJSONString());
return returnObject.toJSONString();
}
}