|
|
|
@ -671,6 +671,49 @@ public class BankServiceImpl implements BankService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//IPAY银行接口(批量) |
|
|
|
@Override |
|
|
|
public Result ipayAuto(BankDTO bankDTO) { |
|
|
|
// 获取需要处理的订单号列表 |
|
|
|
List<CashCollection> cashCollections = cashCollectionMapper.selectIpayList(); |
|
|
|
BankVO bankVO = new BankVO(); |
|
|
|
List<String> message = new ArrayList<>(); |
|
|
|
// 对每个订单执行getFirstdata方法 |
|
|
|
for (CashCollection cashCollection : cashCollections) { |
|
|
|
// 创建一个新的BankDTO实例,设置订单号 |
|
|
|
Ipay88DTO ipay88DTO = new Ipay88DTO(); |
|
|
|
ipay88DTO.setOrderNo(cashCollection.getOrderCode()); |
|
|
|
|
|
|
|
// 将double先转为int再转为string |
|
|
|
double amountDouble = cashCollection.getPermanentGold() * 3.18; |
|
|
|
int amountInt = (int) amountDouble; |
|
|
|
ipay88DTO.setAmount(String.valueOf(amountInt)); |
|
|
|
|
|
|
|
double feeDouble = cashCollection.getPermanentGold() * 3.18 * 0.0085; |
|
|
|
int feeInt = (int) feeDouble; |
|
|
|
ipay88DTO.setFee(String.valueOf(feeInt)); |
|
|
|
|
|
|
|
double netDouble = cashCollection.getPermanentGold() * 3.18 - cashCollection.getPermanentGold() * 3.18 * 0.0085; |
|
|
|
int netInt = (int) netDouble; |
|
|
|
ipay88DTO.setNet(String.valueOf(netInt)); |
|
|
|
cashCollectionMapper.updateByGoldCoinOrderCodeByIpay88(ipay88DTO); |
|
|
|
// 构建成功消息 |
|
|
|
Map<String, Object> successData = new HashMap<>(); |
|
|
|
successData.put("success", true); |
|
|
|
successData.put("orderNo", ipay88DTO.getOrderNo()); |
|
|
|
successData.put("amount", ipay88DTO.getAmount()); |
|
|
|
successData.put("fee", ipay88DTO.getFee()); |
|
|
|
successData.put("net", ipay88DTO.getNet()); |
|
|
|
message.add(JSON.toJSONString(successData, true)); |
|
|
|
} |
|
|
|
|
|
|
|
// 将message存入bankVO |
|
|
|
bankVO.setMessage(message); |
|
|
|
|
|
|
|
// 返回处理结果列表 |
|
|
|
return Result.success(bankVO); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成PaymentAsia API所需的签名 |
|
|
|
* |
|
|
|
|