Authored by Lixiaodi

Merge branch 'dev_pay_million' into test6.8.8

@@ -1106,6 +1106,13 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1106,6 +1106,13 @@ public class PaymentServiceImpl implements IPaymentService {
1106 tradeBills.setTradeStatus(100); 1106 tradeBills.setTradeStatus(100);
1107 tradeBills.setCreateTime(now); 1107 tradeBills.setCreateTime(now);
1108 addTradeBills(tradeBills); 1108 addTradeBills(tradeBills);
  1109 +
  1110 + OrdersPayTransfer transferSuccess = new OrdersPayTransfer();
  1111 + transferSuccess.setId(transfer.getId());
  1112 + transferSuccess.setAlipayTradeId(orderId);
  1113 + transferSuccess.setStatus(1);
  1114 + transferSuccess.setUpdateTime(now);
  1115 + ordersPayTransferMapper.updateByPrimaryKeySelective(transferSuccess);
1109 } else if(exceedMillion(jsonObject)) { 1116 } else if(exceedMillion(jsonObject)) {
1110 Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), tradeBills, orderCode, account, amount, now); 1117 Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), tradeBills, orderCode, account, amount, now);
1111 String resultStr = JSON.toJSONString(mapResult); 1118 String resultStr = JSON.toJSONString(mapResult);
@@ -1178,13 +1185,14 @@ public class PaymentServiceImpl implements IPaymentService { @@ -1178,13 +1185,14 @@ public class PaymentServiceImpl implements IPaymentService {
1178 @Autowired 1185 @Autowired
1179 private ConfigReader configReader; 1186 private ConfigReader configReader;
1180 1187
1181 - private void checkTransferExist(long orderCode) { 1188 + private OrdersPayTransfer checkTransferExist(long orderCode) {
1182 // 查看是否已经有转账记录 1189 // 查看是否已经有转账记录
1183 OrdersPayTransfer exist = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode); 1190 OrdersPayTransfer exist = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode);
1184 if (exist != null) { 1191 if (exist != null) {
1185 logger.warn("OrdersPayTransfer has exist, orderCode is {}", orderCode); 1192 logger.warn("OrdersPayTransfer has exist, orderCode is {}", orderCode);
1186 throw new ServiceException(400, "订单已经处理过"); 1193 throw new ServiceException(400, "订单已经处理过");
1187 } 1194 }
  1195 + return exist;
1188 } 1196 }
1189 1197
1190 private OrdersPayTransfer createTransfer(long buyerOrderCode, long sellerOrderCode, Integer transferType, String alipayAccount, 1198 private OrdersPayTransfer createTransfer(long buyerOrderCode, long sellerOrderCode, Integer transferType, String alipayAccount,
@@ -179,7 +179,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -179,7 +179,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
179 public Map<String, String> transferMoneyWhenExceedMillion(String transferOrderCode, String businessId, String alipayUid, String alipayAccount, String userName, BigDecimal transferAmount) throws Exception{ 179 public Map<String, String> transferMoneyWhenExceedMillion(String transferOrderCode, String businessId, String alipayUid, String alipayAccount, String userName, BigDecimal transferAmount) throws Exception{
180 180
181 Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount); 181 Map<String, String> queryParams = buildTransferParamsWhenExceedMillion(transferOrderCode, businessId, alipayUid, alipayAccount, userName, transferAmount);
182 - String respTxt = sendOpenApiRequestWithException(transferOrderCode, queryParams); 182 + String respTxt = sendMApiRequestWithException(transferOrderCode, queryParams);
183 183
184 Map<String, String> result; 184 Map<String, String> result;
185 185
@@ -235,6 +235,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -235,6 +235,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
235 logger.info("[{}] trade openapi resp: {}", orderCode, response); 235 logger.info("[{}] trade openapi resp: {}", orderCode, response);
236 return response; 236 return response;
237 } 237 }
  238 +
  239 + private String sendMApiRequestWithException(String orderCode, Map<String, String> paramMap) throws Exception {
  240 + logger.info("[{}] send openapi request: {}", orderCode, paramMap);
  241 + String response = httpClient.postFormData(AlipayConfig.MAPI_URL, paramMap);
  242 + logger.info("[{}] trade openapi resp: {}", orderCode, response);
  243 + return response;
  244 + }
238 245
239 246
240 private PayQueryBo queryOpenApiConvert(String orderCode, String respText) { 247 private PayQueryBo queryOpenApiConvert(String orderCode, String respText) {