|
|
@@ -8,17 +8,20 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.google.common.collect.Lists;
|
|
|
-
|
|
|
import com.sckw.contract.api.RemoteContractService;
|
|
|
import com.sckw.contract.api.model.dto.req.TradeEntListQueryFeignDto;
|
|
|
import com.sckw.contract.api.model.dto.res.TradeEntInfoResVo;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.enums.EntTypeEnum;
|
|
|
+import com.sckw.core.model.vo.FileInfoVO;
|
|
|
import com.sckw.core.utils.PageUtils;
|
|
|
+import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginEntHolder;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.BaseResult;
|
|
|
+import com.sckw.file.api.dubbo.RemoteFileService;
|
|
|
import com.sckw.payment.api.model.dto.common.R;
|
|
|
+import com.sckw.payment.config.ApplicationProperties;
|
|
|
import com.sckw.payment.entity.*;
|
|
|
import com.sckw.payment.enums.ExecutionStatusEnum;
|
|
|
import com.sckw.payment.enums.OrderTypeEnum;
|
|
|
@@ -44,14 +47,13 @@ import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
-import org.slf4j.Logger;
|
|
|
-import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
@@ -70,13 +72,13 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
|
|
|
- private static final Logger logger = LoggerFactory.getLogger(WalletPrepaidServiceImpl.class);
|
|
|
|
|
|
@Autowired
|
|
|
private WalletPrepaidMapper walletPrepaidMapper;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
private RemoteSystemService remoteSystemService;
|
|
|
-
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
+ private RemoteFileService remoteFileService;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
|
private RemoteContractService remoteContractService;
|
|
|
@Autowired
|
|
|
@@ -89,7 +91,8 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
|
|
|
private KwpWalletMapper kwpWalletMapper;
|
|
|
@Resource
|
|
|
private KwpWalletSplitMapper kwpWalletSplitMapper;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private ApplicationProperties applicationProperties;
|
|
|
@Autowired
|
|
|
private WalletPrepaidRecordMapper walletPrepaidRecordMapper;
|
|
|
@Qualifier("walletPrepaidBalanceMapper")
|
|
|
@@ -304,7 +307,7 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
|
|
|
payReq.setFilter(getUid(prepaid.getSupEntId()));
|
|
|
payReq.setOrderNo(orderNo);
|
|
|
payReq.setAmt(prepaidAddDto.getPrepaidAmount().toString());
|
|
|
- payReq.setNoticeUrl("/walletPrepaid/receivedCallback");//todo
|
|
|
+ payReq.setNoticeUrl(applicationProperties.getCharge());
|
|
|
payReq.setRemark(prepaidAddDto.getRemark());
|
|
|
R<PayRes> pay;
|
|
|
try {
|
|
|
@@ -358,6 +361,7 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
|
|
|
log.info("支付回调 {}", JSONObject.toJSONString(receivedCallbackDto));
|
|
|
WalletPrepaidRecord walletPrepaidRecord = walletPrepaidRecordMapper.selectWalletPrepaidRecordByOrderNo(receivedCallbackDto.getPayOrderNo());
|
|
|
if (walletPrepaidRecord == null) {
|
|
|
+ log.error("预付记录不存在");
|
|
|
throw new BusinessException("预付记录不存在");
|
|
|
}
|
|
|
WalletPrepaid walletPrepaid = walletPrepaidMapper.selectWalletPrepaidById(walletPrepaidRecord.getPrepaidId());
|
|
|
@@ -366,12 +370,11 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
|
|
|
|
|
|
KwpWalletSplit kwpWalletSplit = new KwpWalletSplit();
|
|
|
try {
|
|
|
- // 支付 清分 提现
|
|
|
- //todo 新增清分订单,清分成功后,增加可提现余额
|
|
|
+ // 新增清分订单,清分成功后,增加可提现余额
|
|
|
customSettleDto.setUid(getUid(walletPrepaid.getProEntId()));
|
|
|
customSettleDto.setAmt(String.valueOf(receivedCallbackDto.getTranAmt()));
|
|
|
customSettleDto.setMchtFee("0.00");
|
|
|
- customSettleDto.setNoticeUrl("/wallet/split");//todo
|
|
|
+ customSettleDto.setNoticeUrl(applicationProperties.getSplit());
|
|
|
customSettleDto.setSummery("");
|
|
|
customSettleDto.setRemark("清分");
|
|
|
DivideDto divideDto = new DivideDto();
|
|
|
@@ -403,6 +406,27 @@ public class WalletPrepaidServiceImpl implements IWalletPrepaidService {
|
|
|
} finally {
|
|
|
kwpWalletSplitMapper.insert(kwpWalletSplit);
|
|
|
}
|
|
|
+ WalletBusinessFile walletBusinessFile = new WalletBusinessFile();
|
|
|
+ try {
|
|
|
+ walletBusinessFile.setBusinessId(kwpWalletSplit.getId());
|
|
|
+ walletBusinessFile.setRemark("");
|
|
|
+ walletBusinessFile.setStatus(0);
|
|
|
+ walletBusinessFile.setDelFlag(0);
|
|
|
+ walletBusinessFile.setCreateBy(LoginUserHolder.getUserId());
|
|
|
+ walletBusinessFile.setCreateTime(new Date());
|
|
|
+ walletBusinessFile.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ walletBusinessFile.setUpdateTime(new Date());
|
|
|
+ MultipartFile file = receivedCallbackDto.getFile();
|
|
|
+ BaseResult<FileInfoVO> httpResult = remoteFileService.fileUpload(file);
|
|
|
+ if (HttpStatus.SUCCESS_CODE == httpResult.getCode()) {
|
|
|
+ FileInfoVO data = httpResult.getData();
|
|
|
+ walletBusinessFile.setFilePath(Objects.nonNull(data) ? data.getFileAbsolutePath() : "");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("支付凭证文件写入异常 {}", e.getMessage());
|
|
|
+ } finally {
|
|
|
+ businessFileMapper.insert(walletBusinessFile);
|
|
|
+ }
|
|
|
//修改预付记录
|
|
|
walletPrepaidRecord.setReceivedAmount(receivedCallbackDto.getTranAmt());
|
|
|
walletPrepaidRecord.setStatus(PayStatusEnum.PAID.getCode());
|