Commit 68b6d208 authored by hongguangwu's avatar hongguangwu

1.7.20-非扣税银企

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