同步票据池功能
This commit is contained in:
parent
848ce0a62d
commit
e663fac646
|
|
@ -22,4 +22,15 @@
|
|||
</table>
|
||||
|
||||
|
||||
<table name="票据池" key="uf_pjc" modeId="13">
|
||||
<field name="收到日期/开具日期" key="sdrqkjrq" ebsKey="acceptorDate"/>
|
||||
<field name="回款人/收款人" key="hkrskr" ebsKey="drawerName"/>
|
||||
<field name="票面金额" key="pmje" ebsKey="billAmount"/>
|
||||
<field name="票据编号" key="pjbh" ebsKey="billNbr" unique="true"/>
|
||||
<field name="出票日期" key="cprq" ebsKey="issueDate"/>
|
||||
<field name="到期日期" key="dqrq" ebsKey="dueDate"/>
|
||||
<field name="承兑银行/付款银行" key="cdyhfkyh" ebsKey="acceptorName/"/>
|
||||
</table>
|
||||
|
||||
|
||||
</config>
|
||||
|
|
|
|||
|
|
@ -56,6 +56,55 @@ public class SyncCBSAccountDetailsJob extends BaseCronJob {
|
|||
*/
|
||||
private String paymentNatureList;
|
||||
|
||||
/**
|
||||
* 日期类型 0-交易日期
|
||||
*/
|
||||
private String dateType;
|
||||
/**
|
||||
* 账户列表 查询账户列表,不传默认返回全部
|
||||
*/
|
||||
private String accountNoList;
|
||||
/**
|
||||
* 银行类型列表 例如招行CMB,银行类型枚举见附录4.1.5
|
||||
*/
|
||||
private String bankTypeList;
|
||||
/**
|
||||
* 币种列表 见附录币种枚举,4.1.1
|
||||
*/
|
||||
private String currencyList;
|
||||
/**
|
||||
* 明细来源
|
||||
* B:银行,即银行直联
|
||||
* U:用户,即手工/ERP接口导入
|
||||
* 不传默认查全部
|
||||
*/
|
||||
private String detailedSources;
|
||||
/**
|
||||
* 明细类型 1-当日明细 2-历史明细 与明细日期无关,仅标识数据来源银行的不同接口
|
||||
*/
|
||||
private String currentFlag;
|
||||
|
||||
/**
|
||||
* 账户性质列表 客户在公共设置>基础信息>账户性质查询自定义内容,例如AA-综合户,此处传值“AA”
|
||||
*/
|
||||
private String accountNatureList;
|
||||
/**
|
||||
* 银行流水号 银行流水号
|
||||
*/
|
||||
private String bankSerialNumber;
|
||||
/**
|
||||
* 交易流水号 交易流水号,由CBS8定义生成的唯一标识
|
||||
*/
|
||||
private Long transactionSerialNumber;
|
||||
/**
|
||||
* 单位编码列表 客户在公共设置>基础信息>组织机构维护,例如0001-XX科技有限公司,此处传0001
|
||||
*/
|
||||
private String unitCodeList;
|
||||
/**
|
||||
* ERP业务参考号 erpSerialNumber
|
||||
*/
|
||||
private String erpSerialNumber;
|
||||
|
||||
private SQLMapper getSQLMapper() {
|
||||
return MapperProxyFactory.getProxy(SQLMapper.class);
|
||||
}
|
||||
|
|
@ -82,13 +131,19 @@ public class SyncCBSAccountDetailsJob extends BaseCronJob {
|
|||
requestParam.setStartDate(nowDate);
|
||||
requestParam.setEndDate(nowDate);
|
||||
}
|
||||
requestParam.setDateType("0");
|
||||
if (StrUtil.isNotBlank(loanType)) {
|
||||
requestParam.setLoanType(loanType);
|
||||
}
|
||||
if (StrUtil.isNotBlank(paymentNatureList)) {
|
||||
requestParam.setPaymentNatureList(Arrays.stream(paymentNatureList.split(",")).collect(Collectors.toList()));
|
||||
}
|
||||
requestParam.setLoanType(loanType);
|
||||
requestParam.setPaymentNatureList(paymentNatureList == null ? null :Arrays.stream(paymentNatureList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setDateType(dateType);
|
||||
requestParam.setAccountNoList(accountNoList== null ? null :Arrays.stream(accountNoList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setBankTypeList(bankTypeList== null ? null :Arrays.stream(bankTypeList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setCurrencyList(currencyList== null ? null :Arrays.stream(currencyList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setDetailedSources(detailedSources);
|
||||
requestParam.setCurrentFlag(currentFlag);
|
||||
requestParam.setAccountNatureList(accountNatureList== null ? null :Arrays.stream(accountNatureList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setBankSerialNumber(bankSerialNumber);
|
||||
requestParam.setTransactionSerialNumber(transactionSerialNumber);
|
||||
requestParam.setUnitCodeList(unitCodeList== null ? null :Arrays.stream(unitCodeList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setErpSerialNumber(erpSerialNumber);
|
||||
|
||||
//查询前1000条数据
|
||||
AccountManagementClient accountManagementClient = new AccountManagementClient();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,311 @@
|
|||
package com.engine.salary.timer;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.SQLMapper;
|
||||
import com.engine.salary.remote.cbs8.client.BillManagementClient;
|
||||
import com.engine.salary.remote.cbs8.config.EBS2ECConfig;
|
||||
import com.engine.salary.remote.cbs8.request.GetDtaRequest;
|
||||
import com.engine.salary.remote.cbs8.response.GetDtaResponse;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.thoughtworks.xstream.XStream;
|
||||
import com.thoughtworks.xstream.security.AnyTypePermission;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.formmode.setup.ModeRightInfo;
|
||||
import weaver.general.GCONST;
|
||||
import weaver.general.TimeUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 获取票据池
|
||||
* <p>Copyright: Copyright (c) 2024</p>
|
||||
* <p>Company: 泛微软件</p>
|
||||
*
|
||||
* @author qiantao
|
||||
* @version 1.0
|
||||
**/
|
||||
@Slf4j
|
||||
public class SyncCBSBillPoolJob extends BaseCronJob {
|
||||
|
||||
/**
|
||||
* 持票人单位编码 多选。填在cbs系统公共设置>基础信息>组织机构维护的单位编码
|
||||
*/
|
||||
private String displayHoldOrganizationCodeList;
|
||||
/**
|
||||
* 持票人账号 多选。
|
||||
*/
|
||||
private String holdAccountList;
|
||||
|
||||
/**
|
||||
* 系统票据类型 多选。按附录4.1.3票据类型-票据状态-流通标志级联关系表选择后按顺序填写。系统票据类型枚举见附录4.1.3。票据状态枚举见附录4.1.4。流通标志枚举见附录4.1.5。
|
||||
*/
|
||||
private String billVarietyList;
|
||||
|
||||
/**
|
||||
* 出票日期起 格式为yyyy-mm-dd,出票日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String issueDateStart;
|
||||
|
||||
/**
|
||||
* 出票日期止 格式为yyyy-mm-dd,出票日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String issueDateEnd;
|
||||
|
||||
|
||||
/**
|
||||
* 到期日期起 格式为yyyy-mm-dd,到期日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String dueDateStart;
|
||||
/**
|
||||
* 到期日期止 格式为yyyy-mm-dd,到期日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String dueDateEnd;
|
||||
/**
|
||||
* 票据种类 AC01-银承,AC02-商承
|
||||
*/
|
||||
private String billType;
|
||||
/**
|
||||
* 票据来源 多选。1-直联交易,2-台账交易,3-台账登记,4-挑票同步,5-任务同步
|
||||
*/
|
||||
private String draftSourceList;
|
||||
/**
|
||||
* 持票银行类型 多选。见附录4.1.1.银行类型枚举
|
||||
*/
|
||||
private String holdBankTypeList;
|
||||
|
||||
/**
|
||||
* 持票签收日期起 格式为yyyy-mm-dd,持票签收日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String holdSignDateStart;
|
||||
/**
|
||||
* 持票签收日期止 格式为yyyy-mm-dd,持票签收日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String holdSignDateEnd;
|
||||
/**
|
||||
* 系统票据编号
|
||||
*/
|
||||
private String draftNbr;
|
||||
/**
|
||||
* 票据(包)号
|
||||
*/
|
||||
private String billNbr;
|
||||
|
||||
/**
|
||||
* 票据金额起 大于等于0,最多为两位小数且整数位上限为13位。票据金额起止不允许一边有值一边无值。单位(元)
|
||||
*/
|
||||
private BigDecimal billAmountStart;
|
||||
|
||||
/**
|
||||
* 票据金额止 大于等于0,最多为两位小数且整数位上限为13位。票据金额起止不允许一边有值一边无值。单位(元)
|
||||
*/
|
||||
private BigDecimal billAmountEnd;
|
||||
|
||||
/**
|
||||
* 子票区间起 子票区间起止不允许一边有值一边无值,最多12位
|
||||
*/
|
||||
private String subBillIntervalStart;
|
||||
/**
|
||||
* 子票区间止 子票区间起止不允许一边有值一边无值,最多12位
|
||||
*/
|
||||
private String subBillIntervalEnd;
|
||||
|
||||
/**
|
||||
* 票据状态
|
||||
*/
|
||||
private String billStsList;
|
||||
/**
|
||||
* 流通标志
|
||||
*/
|
||||
private String billTrsStsList;
|
||||
/**
|
||||
* 库存状态 1-已入库,2-已出库。 为空时默认查询全部数据
|
||||
*/
|
||||
private String stockFlag;
|
||||
/**
|
||||
* 出库方式 0-空,2-背书,3-质押,4-解质,5-贴现,6-分包,7-结清, 8-作废。 为空时默认查询全部数据
|
||||
*/
|
||||
private String outInvType;
|
||||
/**
|
||||
* 记录状态 NOR-正常,USE-占用,DEL-删除 SUC-完成。为空时默认查询全部数据
|
||||
*/
|
||||
private String lockFlag;
|
||||
|
||||
|
||||
private SQLMapper getSQLMapper() {
|
||||
return MapperProxyFactory.getProxy(SQLMapper.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
user.setLoginid("sysadmin");
|
||||
|
||||
try {
|
||||
GetDtaRequest requestParam = new GetDtaRequest();
|
||||
requestParam.setCurrentPage(1);
|
||||
requestParam.setPageSize(1000);
|
||||
|
||||
if (StrUtil.isBlank(displayHoldOrganizationCodeList)) {
|
||||
throw new SalaryRunTimeException("持票人单位编码为空,请在计划任务配置此项!");
|
||||
}
|
||||
requestParam.setDisplayHoldOrganizationCodeList(Arrays.stream(displayHoldOrganizationCodeList.split(",")).collect(Collectors.toList()));
|
||||
|
||||
if (StrUtil.isBlank(holdAccountList)) {
|
||||
throw new SalaryRunTimeException("持票人账号为空,请在计划任务配置此项!");
|
||||
}
|
||||
requestParam.setHoldAccountList(Arrays.stream(holdAccountList.split(",")).collect(Collectors.toList()));
|
||||
|
||||
if (StrUtil.isNotBlank(issueDateStart) && StrUtil.isNotBlank(issueDateEnd)) {
|
||||
requestParam.setIssueDateStart(issueDateStart);
|
||||
requestParam.setIssueDateEnd(issueDateEnd);
|
||||
} else {
|
||||
String nowDate = LocalDate.now().toString();
|
||||
requestParam.setIssueDateStart(nowDate);
|
||||
requestParam.setIssueDateEnd(nowDate);
|
||||
}
|
||||
|
||||
//系统票据类型
|
||||
requestParam.setBillVarietyList(Arrays.stream(Util.null2String(billVarietyList).split(",")).collect(Collectors.toList()));
|
||||
|
||||
requestParam.setDueDateStart(dueDateStart);
|
||||
requestParam.setDueDateEnd(dueDateEnd);
|
||||
requestParam.setBillType(billType);
|
||||
requestParam.setDraftSourceList(draftSourceList==null ? null :Arrays.stream(draftSourceList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setHoldBankTypeList(holdBankTypeList==null ? null :Arrays.stream(holdBankTypeList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setHoldSignDateStart(holdSignDateStart);
|
||||
requestParam.setHoldSignDateEnd(holdSignDateEnd);
|
||||
requestParam.setDraftNbr(draftNbr);
|
||||
requestParam.setBillNbr(billNbr);
|
||||
requestParam.setBillAmountStart(billAmountStart);
|
||||
requestParam.setBillAmountEnd(billAmountEnd);
|
||||
requestParam.setSubBillIntervalStart(subBillIntervalStart);
|
||||
requestParam.setSubBillIntervalEnd(subBillIntervalEnd);
|
||||
requestParam.setBillStsList(billStsList==null ? null :Arrays.stream(billStsList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setBillTrsStsList(billTrsStsList==null ? null :Arrays.stream(billTrsStsList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setStockFlag(stockFlag);
|
||||
requestParam.setOutInvType(outInvType);
|
||||
requestParam.setLockFlag(lockFlag);
|
||||
|
||||
//查询前1000条数据
|
||||
BillManagementClient bailManagementClient = new BillManagementClient();
|
||||
GetDtaResponse response = bailManagementClient.dtaQuery(requestParam);
|
||||
List<GetDtaResponse.Detail> list = response.getData().getList();
|
||||
|
||||
//判断是否还存在数据,递归查询
|
||||
boolean hasNextPage = response.getData().isHasNextPage();
|
||||
int nextPage = response.getData().getNextPage();
|
||||
while (hasNextPage) {
|
||||
requestParam.setCurrentPage(nextPage);
|
||||
GetDtaResponse nextPageResponse = bailManagementClient.dtaQuery(requestParam);
|
||||
List<GetDtaResponse.Detail> pageData = nextPageResponse.getData().getList();
|
||||
list.addAll(pageData);
|
||||
hasNextPage = nextPageResponse.getData().isHasNextPage();
|
||||
nextPage = nextPageResponse.getData().getNextPage();
|
||||
}
|
||||
|
||||
//加载cbs配置
|
||||
XStream xStream = new XStream();
|
||||
String resource = GCONST.getRootPath() + "WEB-INF" + File.separatorChar + "CBS2ECConfig.xml";
|
||||
File file = new File(resource);
|
||||
xStream.addPermission(AnyTypePermission.ANY);
|
||||
xStream.processAnnotations(EBS2ECConfig.class);
|
||||
EBS2ECConfig dto = (EBS2ECConfig) xStream.fromXML(file);
|
||||
EBS2ECConfig.Table table = dto.getTables().get(2);
|
||||
Integer modeId = table.getModeId();
|
||||
String tableName = table.getKey();
|
||||
|
||||
//获取已存在的数据
|
||||
EBS2ECConfig.Table.Field uniqueField = table.getFields().stream().filter(EBS2ECConfig.Table.Field::isUnique).findFirst().orElse(null);
|
||||
if (uniqueField == null) {
|
||||
throw new SalaryRunTimeException("未设置唯一标识字段");
|
||||
}
|
||||
String uniqueKey = uniqueField.getKey();
|
||||
String uniqueEbsKey = uniqueField.getEbsKey();
|
||||
List<String> uniqueDataKeys = getSQLMapper().listString(String.format("select %s from %s", uniqueKey, tableName));
|
||||
|
||||
|
||||
for (GetDtaResponse.Detail detail : list) {
|
||||
Map<String, String> detailMap = JsonUtil.parseMap(detail, String.class);
|
||||
String uniqueData = detailMap.get(uniqueEbsKey);
|
||||
if (StrUtil.isBlank(uniqueData)) {
|
||||
log.warn("跳过cbs票据池数据,唯一标识返回空,uniqueKey:{},uniqueEbsKey:{}", uniqueKey, uniqueEbsKey);
|
||||
continue;
|
||||
}
|
||||
if (uniqueDataKeys.contains(uniqueData)) {
|
||||
log.warn("跳过cbs票据池数据,数据已存在,uniqueKey:{},uniqueEbsKey:{},值{}", uniqueKey, uniqueEbsKey, uniqueData);
|
||||
continue;
|
||||
}
|
||||
|
||||
List<String> fields = new ArrayList<String>() {{
|
||||
add("formmodeid");
|
||||
add("modedatacreater");
|
||||
add("modedatacreatertype");
|
||||
add("modedatacreatedate");
|
||||
add("modedatacreatetime");
|
||||
}};
|
||||
String currDate = TimeUtil.getCurrentDateString();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
|
||||
String currTime = sdf.format(new Date());
|
||||
List<Object> values = new ArrayList<Object>() {{
|
||||
add(modeId);
|
||||
add(1);
|
||||
add(0);
|
||||
add(String.format("'%s'", currDate));
|
||||
add(String.format("'%s'", currTime));
|
||||
}};
|
||||
|
||||
for (EBS2ECConfig.Table.Field field : table.getFields()) {
|
||||
//数据库字段
|
||||
String fieldName = field.getKey();
|
||||
fields.add(fieldName);
|
||||
// 接口值
|
||||
String value = detailMap.getOrDefault(field.getEbsKey(), "");
|
||||
values.add(String.format("'%s'", value));
|
||||
}
|
||||
|
||||
//业务逻辑字段,收款类型
|
||||
fields.add("pjlx");
|
||||
//应付票据
|
||||
Integer pjlx;
|
||||
if ("ISS".equals(detail.getBillVariety())) {
|
||||
pjlx = 2;
|
||||
} else {
|
||||
//应收票据 0:银承 1:商承
|
||||
pjlx = "AC01".equals(detail.getBillType()) ? 0 : 1;
|
||||
}
|
||||
values.add(pjlx);
|
||||
|
||||
|
||||
String sql = String.format("insert into %s (%s) values (%s)", tableName, String.join(",", fields), values.stream().map(Object::toString).collect(Collectors.joining(",")));
|
||||
RecordSet rs = new RecordSet();
|
||||
rs.execute(sql);
|
||||
|
||||
if (modeId != null) {
|
||||
rs.executeQuery("select max(id) from " + tableName);
|
||||
int mainId = 0;
|
||||
if (rs.next()) {
|
||||
mainId = rs.getInt(1);
|
||||
}
|
||||
ModeRightInfo ModeRightInfo = new ModeRightInfo();
|
||||
ModeRightInfo.setNewRight(true);
|
||||
ModeRightInfo.editModeDataShare(1, modeId, mainId);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取CBS票据池数据失败", e);
|
||||
throw new SalaryRunTimeException("获取CBS票据池数据失败," + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -23,6 +23,7 @@ import weaver.hrm.User;
|
|||
import weaver.interfaces.schedule.BaseCronJob;
|
||||
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
|
@ -49,19 +50,99 @@ public class SyncCBSPayDetailsJob extends BaseCronJob {
|
|||
*/
|
||||
private String holdAccountList;
|
||||
|
||||
/**
|
||||
* 系统票据类型 多选。按附录4.1.3票据类型-票据状态-流通标志级联关系表选择后按顺序填写。系统票据类型枚举见附录4.1.3。票据状态枚举见附录4.1.4。流通标志枚举见附录4.1.5。
|
||||
*/
|
||||
private String billVarietyList;
|
||||
|
||||
/**
|
||||
* 出票日期起 格式为yyyy-mm-dd,出票日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String issueDateStart;
|
||||
|
||||
/**
|
||||
* 出票日期止 格式为yyyy-mm-dd,出票日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String issueDateEnd;
|
||||
|
||||
|
||||
/**
|
||||
* 系统票据类型 多选。按附录4.1.3票据类型-票据状态-流通标志级联关系表选择后按顺序填写。系统票据类型枚举见附录4.1.3。票据状态枚举见附录4.1.4。流通标志枚举见附录4.1.5。
|
||||
* 到期日期起 格式为yyyy-mm-dd,到期日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String billVarietyList;
|
||||
private String dueDateStart;
|
||||
/**
|
||||
* 到期日期止 格式为yyyy-mm-dd,到期日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String dueDateEnd;
|
||||
/**
|
||||
* 票据种类 AC01-银承,AC02-商承
|
||||
*/
|
||||
private String billType;
|
||||
/**
|
||||
* 票据来源 多选。1-直联交易,2-台账交易,3-台账登记,4-挑票同步,5-任务同步
|
||||
*/
|
||||
private String draftSourceList;
|
||||
/**
|
||||
* 持票银行类型 多选。见附录4.1.1.银行类型枚举
|
||||
*/
|
||||
private String holdBankTypeList;
|
||||
|
||||
/**
|
||||
* 持票签收日期起 格式为yyyy-mm-dd,持票签收日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String holdSignDateStart;
|
||||
/**
|
||||
* 持票签收日期止 格式为yyyy-mm-dd,持票签收日期起止不允许一边有值一边无值,日期间隔最大为一年
|
||||
*/
|
||||
private String holdSignDateEnd;
|
||||
/**
|
||||
* 系统票据编号
|
||||
*/
|
||||
private String draftNbr;
|
||||
/**
|
||||
* 票据(包)号
|
||||
*/
|
||||
private String billNbr;
|
||||
|
||||
/**
|
||||
* 票据金额起 大于等于0,最多为两位小数且整数位上限为13位。票据金额起止不允许一边有值一边无值。单位(元)
|
||||
*/
|
||||
private BigDecimal billAmountStart;
|
||||
|
||||
/**
|
||||
* 票据金额止 大于等于0,最多为两位小数且整数位上限为13位。票据金额起止不允许一边有值一边无值。单位(元)
|
||||
*/
|
||||
private BigDecimal billAmountEnd;
|
||||
|
||||
/**
|
||||
* 子票区间起 子票区间起止不允许一边有值一边无值,最多12位
|
||||
*/
|
||||
private String subBillIntervalStart;
|
||||
/**
|
||||
* 子票区间止 子票区间起止不允许一边有值一边无值,最多12位
|
||||
*/
|
||||
private String subBillIntervalEnd;
|
||||
|
||||
/**
|
||||
* 票据状态
|
||||
*/
|
||||
private String billStsList;
|
||||
/**
|
||||
* 流通标志
|
||||
*/
|
||||
private String billTrsStsList;
|
||||
/**
|
||||
* 库存状态 1-已入库,2-已出库。 为空时默认查询全部数据
|
||||
*/
|
||||
private String stockFlag;
|
||||
/**
|
||||
* 出库方式 0-空,2-背书,3-质押,4-解质,5-贴现,6-分包,7-结清, 8-作废。 为空时默认查询全部数据
|
||||
*/
|
||||
private String outInvType;
|
||||
/**
|
||||
* 记录状态 NOR-正常,USE-占用,DEL-删除 SUC-完成。为空时默认查询全部数据
|
||||
*/
|
||||
private String lockFlag;
|
||||
|
||||
private SQLMapper getSQLMapper() {
|
||||
return MapperProxyFactory.getProxy(SQLMapper.class);
|
||||
|
|
@ -82,6 +163,16 @@ public class SyncCBSPayDetailsJob extends BaseCronJob {
|
|||
requestParam.setCurrentPage(1);
|
||||
requestParam.setPageSize(1000);
|
||||
|
||||
if (StrUtil.isBlank(displayHoldOrganizationCodeList)) {
|
||||
throw new SalaryRunTimeException("持票人单位编码为空,请在计划任务配置此项!");
|
||||
}
|
||||
requestParam.setDisplayHoldOrganizationCodeList(Arrays.stream(displayHoldOrganizationCodeList.split(",")).collect(Collectors.toList()));
|
||||
|
||||
if (StrUtil.isBlank(holdAccountList)) {
|
||||
throw new SalaryRunTimeException("持票人账号为空,请在计划任务配置此项!");
|
||||
}
|
||||
requestParam.setHoldAccountList(Arrays.stream(holdAccountList.split(",")).collect(Collectors.toList()));
|
||||
|
||||
if (StrUtil.isNotBlank(issueDateStart) && StrUtil.isNotBlank(issueDateEnd)) {
|
||||
requestParam.setIssueDateStart(issueDateStart);
|
||||
requestParam.setIssueDateEnd(issueDateEnd);
|
||||
|
|
@ -90,16 +181,29 @@ public class SyncCBSPayDetailsJob extends BaseCronJob {
|
|||
requestParam.setIssueDateStart(nowDate);
|
||||
requestParam.setIssueDateEnd(nowDate);
|
||||
}
|
||||
if(StrUtil.isBlank(displayHoldOrganizationCodeList)){
|
||||
throw new SalaryRunTimeException("持票人单位编码为空,请在计划任务配置此项!");
|
||||
}
|
||||
requestParam.setDisplayHoldOrganizationCodeList(Arrays.stream(displayHoldOrganizationCodeList.split(",")).collect(Collectors.toList()));
|
||||
if(StrUtil.isBlank(holdAccountList)){
|
||||
throw new SalaryRunTimeException("持票人账号为空,请在计划任务配置此项!");
|
||||
}
|
||||
requestParam.setHoldAccountList(Arrays.stream(holdAccountList.split(",")).collect(Collectors.toList()));
|
||||
|
||||
//系统票据类型
|
||||
requestParam.setBillVarietyList(Arrays.stream(billVarietyList.split(",")).collect(Collectors.toList()));
|
||||
|
||||
requestParam.setDueDateStart(dueDateStart);
|
||||
requestParam.setDueDateEnd(dueDateEnd);
|
||||
requestParam.setBillType(billType);
|
||||
requestParam.setDraftSourceList(draftSourceList==null ? null :Arrays.stream(draftSourceList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setHoldBankTypeList(holdBankTypeList==null ? null :Arrays.stream(holdBankTypeList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setHoldSignDateStart(holdSignDateStart);
|
||||
requestParam.setHoldSignDateEnd(holdSignDateEnd);
|
||||
requestParam.setDraftNbr(draftNbr);
|
||||
requestParam.setBillNbr(billNbr);
|
||||
requestParam.setBillAmountStart(billAmountStart);
|
||||
requestParam.setBillAmountEnd(billAmountEnd);
|
||||
requestParam.setSubBillIntervalStart(subBillIntervalStart);
|
||||
requestParam.setSubBillIntervalEnd(subBillIntervalEnd);
|
||||
requestParam.setBillStsList(billStsList==null ? null :Arrays.stream(billStsList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setBillTrsStsList(billTrsStsList==null ? null :Arrays.stream(billTrsStsList.split(",")).collect(Collectors.toList()));
|
||||
requestParam.setStockFlag(stockFlag);
|
||||
requestParam.setOutInvType(outInvType);
|
||||
requestParam.setLockFlag(lockFlag);
|
||||
|
||||
//查询前1000条数据
|
||||
BillManagementClient bailManagementClient = new BillManagementClient();
|
||||
GetDtaResponse response = bailManagementClient.dtaQuery(requestParam);
|
||||
|
|
@ -146,11 +250,11 @@ public class SyncCBSPayDetailsJob extends BaseCronJob {
|
|||
Map<String, String> detailMap = JsonUtil.parseMap(detail, String.class);
|
||||
String uniqueData = detailMap.get(uniqueEbsKey);
|
||||
if (StrUtil.isBlank(uniqueData)) {
|
||||
log.warn("跳过cbs票据数据,唯一标识返回空,uniqueKey:{},uniqueEbsKey:{}", uniqueKey, uniqueEbsKey);
|
||||
log.warn("跳过cbs票据收款数据,唯一标识返回空,uniqueKey:{},uniqueEbsKey:{}", uniqueKey, uniqueEbsKey);
|
||||
continue;
|
||||
}
|
||||
if (uniqueDataKeys.contains(uniqueData)) {
|
||||
log.warn("跳过cbs票据数据,数据已存在,uniqueKey:{},uniqueEbsKey:{},值{}", uniqueKey, uniqueEbsKey, uniqueData);
|
||||
log.warn("跳过cbs票据收款数据,数据已存在,uniqueKey:{},uniqueEbsKey:{},值{}", uniqueKey, uniqueEbsKey, uniqueData);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +293,8 @@ public class SyncCBSPayDetailsJob extends BaseCronJob {
|
|||
|
||||
//业务逻辑字段,收款类型
|
||||
fields.add("sklx");
|
||||
values. add("AC01".equals(detailMap.get("billType")) ? 0 : 1);
|
||||
//应收票据 0:银承 1:商承
|
||||
values. add("AC01".equals(detail.getBillType()) ? 0 : 1);
|
||||
|
||||
/*
|
||||
* 认领逻辑,
|
||||
|
|
@ -232,8 +337,8 @@ public class SyncCBSPayDetailsJob extends BaseCronJob {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取CBS票据信息失败", e);
|
||||
throw new SalaryRunTimeException("获取CBS票据信息失败," + e.getMessage(), e);
|
||||
log.error("获取CBS票据收款数据失败", e);
|
||||
throw new SalaryRunTimeException("获取CBS票据收款数据信息失败," + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue