Commit 68b6d208 authored by hongguangwu's avatar hongguangwu

1.7.20-非扣税银企

parent 3b66bbd5
......@@ -1349,11 +1349,15 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 1:获取需要查询结果的非扣税支付任务(发放中的任务)——主表
List<EkpBankResultVo> mainList = ekpBankPayTaskService.getEkpBankMainByNeedResultMain(typeName);
String statusRemark;
// 终结态:失败6/8/41或成功7
String failStatus = "41";
int i = 0;
if (mainList != null && !mainList.isEmpty()) {
EkpBankPayTask main;
// 是否全部时8:授权失败,如果是,则整单失败
boolean isShouQuanShiBai;
// 是否为终结态,是,才下一步
boolean isResultStatus = true;
for (EkpBankResultVo vo : mainList) {
seqNo = seqNoPre + System.currentTimeMillis() + (i++);
responseV1 = icbcTransactionFlowQueryService.getResultNoTax(vo, tranDate, tranTime, seqNo, client);
......@@ -1362,6 +1366,7 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
setIcbcLogBaseInfoNoTax(responseV1, icbcLogList, vo.getFdWxNo(), vo.getFdId());
dataList = responseV1.getRd();
isShouQuanShiBai = false;
isResultStatus = true;
if (dataList != null && !dataList.isEmpty()) {
for (MybankEnterprisePayQpayentResponseV1.MybankEnterprisePayQpayentResponseRdV1 data : dataList) {
if (CommonConstants.EIGHT_STRING.equals(data.getResult())) {
......@@ -1370,99 +1375,108 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
isShouQuanShiBai = false;
break;
}
}
}
// 返回码,交易成功返回0,正表示业务报错,负表示系统报错
if (responseV1.isSuccess() && !isShouQuanShiBai) {
// 生成日志主表
logs = new EkpBankGrantLog();
saveNewEkpBankGrantLog(responseV1.getPackageName(), vo, vo.getFdId(), logs, title);
oldDetailList = ekpBankGrantDetailService.getListByParentId(vo.getFdId());
oldMap = new HashMap<>();
if (oldDetailList != null && !oldDetailList.isEmpty()) {
for (EkpBankGrantDetail temp : oldDetailList) {
// oldMap.put temp.getFdSerialNumber(), temp)
oldMap.put(temp.getFdSerialNumber(), temp);
if (!(CommonConstants.SIX_STRING.equals(data.getResult())
|| CommonConstants.SEVEN_STRING.equals(data.getResult())
|| CommonConstants.EIGHT_STRING.equals(data.getResult())
|| failStatus.equals(data.getResult()))) {
isResultStatus = false;
}
}
moneyAll = BigDecimal.ZERO;
moneySuccess = BigDecimal.ZERO;
moneyFail = BigDecimal.ZERO;
numSuccess = 0;
numFail = 0;
if (dataList != null && !dataList.isEmpty()) {
logDetailList = new ArrayList<>();
detailDataList = new ArrayList<>();
for (MybankEnterprisePayQpayentResponseV1.MybankEnterprisePayQpayentResponseRdV1 data : dataList) {
// 交易时间
if (Common.isNotNull(data.getStartDate())) {
logs.setFdTransactionTime(DateUtil.stringToDateByFormat(data.getStartDate(), null));
}
// 是否为终结态,是,才下一步
if (isResultStatus) {
// 返回码,交易成功返回0,正表示业务报错,负表示系统报错
if (responseV1.isSuccess() && !isShouQuanShiBai) {
// 生成日志主表
logs = new EkpBankGrantLog();
saveNewEkpBankGrantLog(responseV1.getPackageName(), vo, vo.getFdId(), logs, title);
oldDetailList = ekpBankGrantDetailService.getListByParentId(vo.getFdId());
oldMap = new HashMap<>();
if (oldDetailList != null && !oldDetailList.isEmpty()) {
for (EkpBankGrantDetail temp : oldDetailList) {
// oldMap.put temp.getFdSerialNumber(), temp)
oldMap.put(temp.getFdSerialNumber(), temp);
}
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayAmt()), new BigDecimal("100"), 2);
moneyAll = BigDecimalUtils.safeAdd(moneyAll, money);
// 初始化日志明细
logDetail = new EkpBankGrantLogDetail();
setLogDetailBaseInfoNoTax(logs, money, logDetail, data);
detailData = oldMap.get(data.getiSeqno());
if (detailData != null) {
// 收款人名称
logDetail.setFdPayee(detailData.getFdPayeeName());
// 收款银行
logDetail.setFdRecipientBank(detailData.getFdRecipientBank());
if ("7".equals(data.getResult())) {
moneySuccess = BigDecimalUtils.safeAdd(moneySuccess, money);
numSuccess++;
detailData.setFdGrantStatus("发放成功");
} else {
moneyFail = BigDecimalUtils.safeAdd(moneyFail, money);
numFail++;
detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
statusRemark = NO_TAX_STATUS_MAP.get(data.getResult());
detailData.setFdFailureFeedback(statusRemark);
// 批量更新中信银行表数据,使发放失败处理有数据出现
ekpBankGrantDetailService.updateZhongXinStatus(detailData.getFdSalaryId(), detailData.getFdId(), statusRemark);
ekpBankGrantDetailService.updateZhongXinMainStatus(detailData.getFdSalaryId(), detailData.getFdId(), statusRemark);
}
moneyAll = BigDecimal.ZERO;
moneySuccess = BigDecimal.ZERO;
moneyFail = BigDecimal.ZERO;
numSuccess = 0;
numFail = 0;
if (dataList != null && !dataList.isEmpty()) {
logDetailList = new ArrayList<>();
detailDataList = new ArrayList<>();
for (MybankEnterprisePayQpayentResponseV1.MybankEnterprisePayQpayentResponseRdV1 data : dataList) {
// 交易时间
if (Common.isNotNull(data.getStartDate())) {
logs.setFdTransactionTime(DateUtil.stringToDateByFormat(data.getStartDate(), null));
}
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayAmt()), new BigDecimal("100"), 2);
moneyAll = BigDecimalUtils.safeAdd(moneyAll, money);
// 初始化日志明细
logDetail = new EkpBankGrantLogDetail();
setLogDetailBaseInfoNoTax(logs, money, logDetail, data);
detailData = oldMap.get(data.getiSeqno());
if (detailData != null) {
// 收款人名称
logDetail.setFdPayee(detailData.getFdPayeeName());
// 收款银行
logDetail.setFdRecipientBank(detailData.getFdRecipientBank());
if ("7".equals(data.getResult())) {
moneySuccess = BigDecimalUtils.safeAdd(moneySuccess, money);
numSuccess++;
detailData.setFdGrantStatus("发放成功");
} else {
moneyFail = BigDecimalUtils.safeAdd(moneyFail, money);
numFail++;
detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
statusRemark = NO_TAX_STATUS_MAP.get(data.getResult());
detailData.setFdFailureFeedback(statusRemark);
// 批量更新中信银行表数据,使发放失败处理有数据出现
ekpBankGrantDetailService.updateZhongXinStatus(detailData.getFdSalaryId(), detailData.getFdId(), statusRemark);
ekpBankGrantDetailService.updateZhongXinMainStatus(detailData.getFdSalaryId(), detailData.getFdId(), statusRemark);
}
detailDataList.add(detailData);
}
detailDataList.add(detailData);
logDetailList.add(logDetail);
}
logDetailList.add(logDetail);
ekpBankGrantLogDetailService.saveBatch(logDetailList);
main = new EkpBankPayTask();
main.setFdId(vo.getFdId());
main.setFdGrantStatus("已发放");
ekpBankPayTaskService.updateById(main);
// 更新明细状态为成功或失败
ekpBankGrantDetailService.updateBatchById(detailDataList);
}
if (numSuccess > 0) {
moneyFail = BigDecimalUtils.safeSubtract(moneyAll, moneySuccess);
numFail = vo.getNum() - numSuccess;
}
ekpBankGrantLogDetailService.saveBatch(logDetailList);
// 失败总金额
logs.setFdFailFee(moneyFail);
// 成功总金额
logs.setFdSuccessFee(moneySuccess);
// 总金额
logs.setFdSumFee(moneyAll);
// 失败总笔数
logs.setFdTransactionFailTotal(numFail);
// 成功总笔数
logs.setFdTransactionSuccessTotal(numSuccess);
ekpBankGrantLogService.updateById(logs);
} else if (400019 == responseV1.getReturnCode() || isShouQuanShiBai) {
main = new EkpBankPayTask();
main.setFdErrorMsg("授权验证失败");
main.setFdId(vo.getFdId());
main.setFdGrantStatus("已发放");
// 2024-11-29 16:55:32 经 项目经理王鹏 与 产品经理 孙兆松 沟通,将 “银企付款任务”列表的“发放状态”的值,由“拒绝授权”改为“处理失败”。
main.setFdGrantStatus("处理失败");
ekpBankPayTaskService.updateById(main);
// 更新明细状态为成功或失败
ekpBankGrantDetailService.updateBatchById(detailDataList);
}
if (numSuccess > 0) {
moneyFail = BigDecimalUtils.safeSubtract(moneyAll, moneySuccess);
numFail = vo.getNum() - numSuccess;
// 更新明细状态为 发放失败,原因为处理失败
//ekpBankGrantDetailService.updateStatusByGrantFail(vo.getFdId())
}
// 失败总金额
logs.setFdFailFee(moneyFail);
// 成功总金额
logs.setFdSuccessFee(moneySuccess);
// 总金额
logs.setFdSumFee(moneyAll);
// 失败总笔数
logs.setFdTransactionFailTotal(numFail);
// 成功总笔数
logs.setFdTransactionSuccessTotal(numSuccess);
ekpBankGrantLogService.updateById(logs);
} else if (400019 == responseV1.getReturnCode() || isShouQuanShiBai) {
main = new EkpBankPayTask();
main.setFdErrorMsg("授权验证失败");
main.setFdId(vo.getFdId());
// 2024-11-29 16:55:32 经 项目经理王鹏 与 产品经理 孙兆松 沟通,将 “银企付款任务”列表的“发放状态”的值,由“拒绝授权”改为“处理失败”。
main.setFdGrantStatus("处理失败");
ekpBankPayTaskService.updateById(main);
// 更新明细状态为 发放失败,原因为处理失败
//ekpBankGrantDetailService.updateStatusByGrantFail(vo.getFdId())
}
}
}
......@@ -1490,64 +1504,62 @@ public class IcbcTransactionFlowIssueServiceImpl extends ServiceImpl<EkpSocialIn
// 返回码,交易成功返回0,正表示业务报错,负表示系统报错
if (responseV1.isSuccess() && responseV1.getRd() != null && !responseV1.getRd().isEmpty()) {
// 生成日志主表
logs = new EkpBankGrantLog();
saveNewEkpBankGrantLog(responseV1.getPackageName(), vo, vo.getFdId(), logs, title);
dataList = responseV1.getRd();
data = dataList.get(0);
if (data != null) {
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayAmt()), new BigDecimal("100"), 2);
detailData = new EkpBankGrantDetail();
detailData.setFdId(vo.getFdId());
//detailData.setFdSerialNumber(data.getiSeqno());
// 生成日志主表
logs = new EkpBankGrantLog();
// 失败总金额
logs.setFdFailFee(BigDecimal.ZERO);
// 成功总金额
logs.setFdSuccessFee(BigDecimal.ZERO);
// 总金额
logs.setFdSumFee(money);
// 失败总笔数
logs.setFdTransactionFailTotal(0);
// 成功总笔数
logs.setFdTransactionSuccessTotal(0);
if ("7".equals(data.getResult())) {
// 失败总笔数
logs.setFdTransactionSuccessTotal(1);
logs.setFdSuccessFee(money);
detailData.setFdGrantStatus("发放成功");
detailData.setFdHandleStatus("已处理");
} else {
// 失败总笔数
logs.setFdTransactionFailTotal(1);
// 终结态才下一步
if (data != null && (CommonConstants.SIX_STRING.equals(data.getResult())
|| CommonConstants.SEVEN_STRING.equals(data.getResult())
|| CommonConstants.EIGHT_STRING.equals(data.getResult())
|| failStatus.equals(data.getResult()))) {
money = BigDecimalUtils.safeDivide(new BigDecimal(data.getPayAmt()), new BigDecimal("100"), 2);
detailData = new EkpBankGrantDetail();
detailData.setFdId(vo.getFdId());
// 生成日志主表
logs = new EkpBankGrantLog();
// 失败总金额
logs.setFdFailFee(money);
detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
statusRemark = NO_TAX_STATUS_MAP.get(data.getResult());
detailData.setFdFailureFeedback(statusRemark);
detailData.setFdFailNum(vo.getFdFailNum() + 1);
// 批量更新中信银行表数据,使发放失败处理有数据出现
ekpBankGrantDetailService.updateZhongXinStatus(vo.getFdSalaryId(), vo.getFdId(), statusRemark);
ekpBankGrantDetailService.updateZhongXinMainStatus(vo.getFdSalaryId(), vo.getFdId(), statusRemark);
}
// 交易时间
if (Common.isNotNull(data.getStartDate())) {
logs.setFdTransactionTime(DateUtil.stringToDateByFormat(data.getStartDate(), null));
}
saveNewEkpBankGrantLog(responseV1.getPackageName(), vo, vo.getFdParentId(), logs, title);
// 初始化日志明细
logDetail = new EkpBankGrantLogDetail();
setLogDetailBaseInfoNoTax(logs, money, logDetail, data);
// 收款人名称
logDetail.setFdPayee(vo.getFdPayeeName());
logDetail.setFdRecipientBank(vo.getFdRecipientBank());
ekpBankGrantLogDetailService.save(logDetail);
detailDataList.add(detailData);
logs.setFdFailFee(BigDecimal.ZERO);
// 成功总金额
logs.setFdSuccessFee(BigDecimal.ZERO);
// 总金额
logs.setFdSumFee(money);
// 失败总笔数
logs.setFdTransactionFailTotal(0);
// 成功总笔数
logs.setFdTransactionSuccessTotal(0);
if ("7".equals(data.getResult())) {
// 失败总笔数
logs.setFdTransactionSuccessTotal(1);
logs.setFdSuccessFee(money);
detailData.setFdGrantStatus("发放成功");
detailData.setFdHandleStatus("已处理");
} else {
// 失败总笔数
logs.setFdTransactionFailTotal(1);
// 失败总金额
logs.setFdFailFee(money);
detailData.setFdGrantStatus("发放失败");
detailData.setFdHandleStatus("");
statusRemark = NO_TAX_STATUS_MAP.get(data.getResult());
detailData.setFdFailureFeedback(statusRemark);
detailData.setFdFailNum(vo.getFdFailNum() + 1);
// 批量更新中信银行表数据,使发放失败处理有数据出现
ekpBankGrantDetailService.updateZhongXinStatus(vo.getFdSalaryId(), vo.getFdId(), statusRemark);
ekpBankGrantDetailService.updateZhongXinMainStatus(vo.getFdSalaryId(), vo.getFdId(), statusRemark);
}
// 交易时间
if (Common.isNotNull(data.getStartDate())) {
logs.setFdTransactionTime(DateUtil.stringToDateByFormat(data.getStartDate(), null));
}
saveNewEkpBankGrantLog(responseV1.getPackageName(), vo, vo.getFdParentId(), logs, title);
// 初始化日志明细
logDetail = new EkpBankGrantLogDetail();
setLogDetailBaseInfoNoTax(logs, money, logDetail, data);
// 收款人名称
logDetail.setFdPayee(vo.getFdPayeeName());
logDetail.setFdRecipientBank(vo.getFdRecipientBank());
ekpBankGrantLogDetailService.save(logDetail);
detailDataList.add(detailData);
}
} else if (400019 == responseV1.getReturnCode()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment