|
@@ -1,5 +1,6 @@
|
|
|
package com.gree.mall.manager.logic.settle.repair;
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
@@ -17,7 +18,6 @@ import com.gree.mall.manager.plus.entity.*;
|
|
|
import com.gree.mall.manager.plus.service.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -52,16 +52,16 @@ public class DailyTransferLogic {
|
|
|
|
|
|
//任务发发放表
|
|
|
List<SettleDailyIssueTask> list = new ArrayList<>();
|
|
|
- if (summaryNumberList == null || summaryNumberList.size() == 0) {
|
|
|
+ if (CollectionUtil.isEmpty(summaryNumberList)) {
|
|
|
summaryNumberList = new ArrayList<>();
|
|
|
- List<Map<String, Object>> summaryMap = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> summaryMap;
|
|
|
if (isMonth) {
|
|
|
summaryMap = dailyMapper.querySummaryMonthNumber(summaryBatchNo, adminUser.getAdminCompanyWechat().getCompanyWechatId());
|
|
|
} else {
|
|
|
summaryMap = dailyMapper.querySummaryNumber(summaryBatchNo, adminUser.getAdminCompanyWechat().getCompanyWechatId());
|
|
|
}
|
|
|
|
|
|
- if (summaryMap.size() == 0) {
|
|
|
+ if (CollectionUtil.isEmpty(summaryMap)) {
|
|
|
throw new RemoteServiceException("没有找到可执行结算单位。");
|
|
|
}
|
|
|
for (Map item : summaryMap) {
|
|
@@ -69,7 +69,7 @@ public class DailyTransferLogic {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (summaryNumberList == null || summaryNumberList.size() == 0) {
|
|
|
+ if (CollectionUtil.isEmpty(summaryNumberList)) {
|
|
|
throw new RemoteServiceException("没有可结算的单位");
|
|
|
}
|
|
|
|
|
@@ -226,7 +226,8 @@ public class DailyTransferLogic {
|
|
|
settleDailyIssueSummaryMonthRecordService.updateBatchById(issueSummaryRecords, 500);
|
|
|
//等待10S 查询转账转态
|
|
|
//Thread.sleep(1000 * 10);
|
|
|
- Integer issueStatus = queryMonthTransferResult(issueSummaryRecords, bankList, reqnbr, queryDate, summaryNumber, adminUser);
|
|
|
+ Integer issueStatus = queryMonthTransferResult(issueSummaryRecords, bankList, reqnbr, queryDate, summaryNumber,
|
|
|
+ adminUser.getCompanyWechatId(), adminUser.getCompanyName());
|
|
|
//记录单次记录
|
|
|
saveCallApiRecord(issueBatchNo, totalIssueCost, issueStatus, opName, reqnbr, adminUser);
|
|
|
settleDailyIssueTaskService.lambdaUpdate()
|
|
@@ -249,7 +250,7 @@ public class DailyTransferLogic {
|
|
|
try {
|
|
|
//查询结算单位对应银行授权账号
|
|
|
SettleDailyBankCardBalance authBankCard = settleDailyBankCardBalanceService.lambdaQuery()
|
|
|
- .eq(SettleDailyBankCardBalance::getCompanyWechatId, adminUser.getAdminUserId())
|
|
|
+ .eq(SettleDailyBankCardBalance::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
.eq(SettleDailyBankCardBalance::getSummaryNumber, summaryNumber)
|
|
|
.one();
|
|
|
if (authBankCard == null) {
|
|
@@ -301,7 +302,7 @@ public class DailyTransferLogic {
|
|
|
|
|
|
String issueBatchNo = commonLogic.generateNo("FF", "issueBatchNo", 15);
|
|
|
// 金额大于0才发放
|
|
|
- if (bankList != null && bankList.size() > 0) {
|
|
|
+ if (CollectionUtil.isNotEmpty(bankList)) {
|
|
|
payItem.setTtlamt(totalIssueCost.toString());
|
|
|
payItem.setTtlcnt(bankList.size() + "");
|
|
|
payItem.setCuramt(totalIssueCost.toString());
|
|
@@ -379,7 +380,9 @@ public class DailyTransferLogic {
|
|
|
settleDailyIssueSummaryRecordService.updateBatchById(issueSummaryRecords, 500);
|
|
|
//等待10S 查询转账转态
|
|
|
//Thread.sleep(1000 * 10);
|
|
|
- Integer issueStatus = queryTransferResult(issueSummaryRecords, bankList, reqnbr, queryDate, summaryNumber, adminUser);
|
|
|
+ Integer issueStatus = queryTransferResult(issueSummaryRecords, bankList, reqnbr, queryDate, summaryNumber,
|
|
|
+ adminUser.getAdminCompanyWechat().getCompanyWechatId(), adminUser.getAdminCompanyWechat().getCompanyName());
|
|
|
+
|
|
|
//记录单次记录
|
|
|
saveCallApiRecord(issueBatchNo, totalIssueCost, issueStatus, opName, reqnbr, adminUser);
|
|
|
settleDailyIssueTaskService.lambdaUpdate()
|
|
@@ -406,7 +409,9 @@ public class DailyTransferLogic {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public Integer queryMonthTransferResult(List<SettleDailyIssueSummaryMonthRecord> issueSummaryRecords, List<DailyWokerBankCardMonthBean> bankList, String reqnbr, String queryDate, String summaryNumber, AdminUserCom adminUser) throws Exception {
|
|
|
+ public Integer queryMonthTransferResult(List<SettleDailyIssueSummaryMonthRecord> issueSummaryRecords,
|
|
|
+ List<DailyWokerBankCardMonthBean> bankList, String reqnbr, String queryDate,
|
|
|
+ String summaryNumber, String companyId, String companyName) throws Exception {
|
|
|
Map<String, Object> payResultMap = cmcBankLogic.insteadResult(reqnbr, summaryNumber);
|
|
|
Integer issueStaus = DailyConstant.ISSUE_STATUS_BANK_DO;
|
|
|
if (DailyConstant.CMC_RESPONSE_SUCCESS_CODE.equals(payResultMap.get("code").toString())) {
|
|
@@ -418,8 +423,8 @@ public class DailyTransferLogic {
|
|
|
String transferResult = map.get("trssts").toString();
|
|
|
for (SettleDailyIssueSummaryMonthRecord issueSummaryRecord : issueSummaryRecords) {
|
|
|
if (map.get("trsseq").toString().equals(issueSummaryRecord.getRequestNo())) {
|
|
|
- issueSummaryRecord.setCompanyWechatId(adminUser.getAdminCompanyWechat().getCompanyWechatId());
|
|
|
- issueSummaryRecord.setCompanyWechatName(adminUser.getAdminCompanyWechat().getCompanyName());
|
|
|
+ issueSummaryRecord.setCompanyWechatId(companyId);
|
|
|
+ issueSummaryRecord.setCompanyWechatName(companyName);
|
|
|
//转账成功的记录
|
|
|
if (Arrays.asList(DailyConstant.TRANSFER_RESP_SUCCESS).contains(transferResult)) {
|
|
|
issueSummaryRecord.setStatus(DailyConstant.ISSUE_STATUS_SUCCESS);
|
|
@@ -480,7 +485,9 @@ public class DailyTransferLogic {
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
- public Integer queryTransferResult(List<SettleDailyIssueSummaryRecord> issueSummaryRecords, List<DailyWorkerBankCardBean> bankList, String reqnbr, String queryDate, String summaryNumber, AdminUserCom adminUser) throws Exception {
|
|
|
+ public Integer queryTransferResult(List<SettleDailyIssueSummaryRecord> issueSummaryRecords,
|
|
|
+ List<DailyWorkerBankCardBean> bankList, String reqnbr, String queryDate,
|
|
|
+ String summaryNumber, String companyId, String companyName) throws Exception {
|
|
|
Map<String, Object> payResultMap = cmcBankLogic.insteadResult(reqnbr, summaryNumber);
|
|
|
Integer issueStaus = DailyConstant.ISSUE_STATUS_BANK_DO;
|
|
|
if (DailyConstant.CMC_RESPONSE_SUCCESS_CODE.equals(payResultMap.get("code").toString())) {
|
|
@@ -492,8 +499,8 @@ public class DailyTransferLogic {
|
|
|
String transferResult = map.get("trssts").toString();
|
|
|
for (SettleDailyIssueSummaryRecord issueSummaryRecord : issueSummaryRecords) {
|
|
|
if (map.get("trsseq").toString().equals(issueSummaryRecord.getRequestNo())) {
|
|
|
- issueSummaryRecord.setCompanyWechatId(adminUser.getAdminCompanyWechat().getCompanyWechatId());
|
|
|
- issueSummaryRecord.setCompanyWechatId(adminUser.getAdminCompanyWechat().getCompanyName());
|
|
|
+ issueSummaryRecord.setCompanyWechatId(companyId);
|
|
|
+ issueSummaryRecord.setCompanyWechatId(companyName);
|
|
|
//转账成功的记录
|
|
|
if (Arrays.asList(DailyConstant.TRANSFER_RESP_SUCCESS).contains(transferResult)) {
|
|
|
issueSummaryRecord.setStatus(DailyConstant.ISSUE_STATUS_SUCCESS);
|
|
@@ -534,10 +541,8 @@ public class DailyTransferLogic {
|
|
|
}
|
|
|
|
|
|
public void excute() {
|
|
|
- AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
try {
|
|
|
List<SettleDailyIssueTask> tasks = settleDailyIssueTaskService.lambdaQuery()
|
|
|
- .eq(StringUtils.isNotBlank(adminUser.getCompanyWechatId()), SettleDailyIssueTask::getCompanyWechatId, adminUser.getCompanyWechatId())
|
|
|
.eq(SettleDailyIssueTask::getTaskStatus, 2)
|
|
|
.list();
|
|
|
if (tasks.size() == 0) {
|
|
@@ -549,7 +554,7 @@ public class DailyTransferLogic {
|
|
|
if (task.getIsMonth()) {
|
|
|
log.info("【月结查询】");
|
|
|
List<SettleDailyIssueSummaryMonthRecord> items = settleDailyIssueSummaryMonthRecordService.lambdaQuery()
|
|
|
- .eq(SettleDailyIssueSummaryMonthRecord::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
+ .eq(SettleDailyIssueSummaryMonthRecord::getCompanyWechatId, task.getCompanyWechatId())
|
|
|
.eq(SettleDailyIssueSummaryMonthRecord::getSummaryBatchNo, task.getSummaryBatchNo())
|
|
|
.eq(SettleDailyIssueSummaryMonthRecord::getSummaryNumber, task.getSummaryNumber())
|
|
|
.eq(SettleDailyIssueSummaryMonthRecord::getStatus, DailyConstant.ISSUE_STATUS_BANK_DO).list();
|
|
@@ -562,13 +567,14 @@ public class DailyTransferLogic {
|
|
|
}
|
|
|
String queryDateEnd = DateUtil.format(new Date(), "yyyyMMdd");
|
|
|
List<DailyWokerBankCardMonthBean> bankList = dailyMapper.queryIssueSalaryMonthBankCardInfo(task.getSummaryBatchNo(),
|
|
|
- task.getSummaryNumber(), DailyConstant.ISSUE_STATUS_BANK_DO, adminUser.getAdminCompanyWechat().getCompanyWechatId());
|
|
|
- this.queryMonthTransferResult(items, bankList, task.getRequestNo(), queryDateEnd,task.getSummaryNumber(), adminUser);
|
|
|
+ task.getSummaryNumber(), DailyConstant.ISSUE_STATUS_BANK_DO, task.getCompanyWechatId());
|
|
|
+ this.queryMonthTransferResult(items, bankList, task.getRequestNo(), queryDateEnd,task.getSummaryNumber(),
|
|
|
+ task.getCompanyWechatId(), task.getCompanyWechatName());
|
|
|
|
|
|
} else {
|
|
|
log.info("【日结查询】");
|
|
|
List<SettleDailyIssueSummaryRecord> items = settleDailyIssueSummaryRecordService.lambdaQuery()
|
|
|
- .eq(SettleDailyIssueSummaryRecord::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
+ .eq(SettleDailyIssueSummaryRecord::getCompanyWechatId, task.getCompanyWechatId())
|
|
|
.eq(SettleDailyIssueSummaryRecord::getSummaryBatchNo, task.getSummaryBatchNo())
|
|
|
.eq(SettleDailyIssueSummaryRecord::getSummaryNumber, task.getSummaryNumber())
|
|
|
.eq(SettleDailyIssueSummaryRecord::getStatus, DailyConstant.ISSUE_STATUS_BANK_DO).list();
|
|
@@ -581,11 +587,13 @@ public class DailyTransferLogic {
|
|
|
String queryDateEnd = DateUtil.format(new Date(), "yyyyMMdd");
|
|
|
|
|
|
List<DailyWorkerBankCardBean> bankList = dailyMapper.queryIssueSalaryAndBankCardInfo(task.getSummaryBatchNo(),
|
|
|
- task.getSummaryNumber(), DailyConstant.ISSUE_STATUS_BANK_DO, adminUser.getAdminCompanyWechat().getCompanyWechatId());
|
|
|
- Integer status = this.queryTransferResult(items, bankList, task.getRequestNo(), queryDateEnd,task.getSummaryNumber(), adminUser);
|
|
|
+ task.getSummaryNumber(), DailyConstant.ISSUE_STATUS_BANK_DO, task.getCompanyWechatId());
|
|
|
+ Integer status = this.queryTransferResult(items, bankList, task.getRequestNo(), queryDateEnd,task.getSummaryNumber(),
|
|
|
+ task.getCompanyWechatId(), task.getCompanyWechatName());
|
|
|
+
|
|
|
settleDailyBankTransferRecordService.lambdaUpdate()
|
|
|
.set(SettleDailyBankTransferRecord::getIssueStatus,status)
|
|
|
- .eq(SettleDailyBankTransferRecord::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
+ .eq(SettleDailyBankTransferRecord::getCompanyWechatId, task.getCompanyWechatId())
|
|
|
.eq(SettleDailyBankTransferRecord::getReqNo,task.getRequestNo())
|
|
|
.update();
|
|
|
}
|