|
@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
-import com.usky.dxtop.common.core.domain.AjaxResult;
|
|
|
|
import com.usky.dxtop.common.core.page.CommonPage;
|
|
import com.usky.dxtop.common.core.page.CommonPage;
|
|
import com.usky.dxtop.common.exception.CustomException;
|
|
import com.usky.dxtop.common.exception.CustomException;
|
|
import com.usky.dxtop.common.utils.Arith;
|
|
import com.usky.dxtop.common.utils.Arith;
|
|
@@ -25,18 +24,13 @@ import com.usky.dxtop.service.OrderService;
|
|
import com.usky.dxtop.service.api.TopApi;
|
|
import com.usky.dxtop.service.api.TopApi;
|
|
import com.usky.dxtop.service.emun.OrderStatus;
|
|
import com.usky.dxtop.service.emun.OrderStatus;
|
|
import com.usky.dxtop.service.vo.OrderRequest;
|
|
import com.usky.dxtop.service.vo.OrderRequest;
|
|
-
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.apache.poi.hssf.record.SSTRecord;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.FastByteArrayOutputStream;
|
|
import org.springframework.util.FastByteArrayOutputStream;
|
|
-
|
|
|
|
import javax.imageio.ImageIO;
|
|
import javax.imageio.ImageIO;
|
|
import java.awt.image.BufferedImage;
|
|
import java.awt.image.BufferedImage;
|
|
-import java.io.IOException;
|
|
|
|
-import java.util.Date;
|
|
|
|
import java.util.TreeMap;
|
|
import java.util.TreeMap;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -146,14 +140,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
BufferedImage image = QRCodeUtil.encode(topScanPayApi, null, true);
|
|
BufferedImage image = QRCodeUtil.encode(topScanPayApi, null, true);
|
|
// 转换流信息写出
|
|
// 转换流信息写出
|
|
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
|
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
|
- try
|
|
|
|
- {
|
|
|
|
- ImageIO.write(image, "jpg", os);
|
|
|
|
- }
|
|
|
|
- catch (IOException e)
|
|
|
|
- {
|
|
|
|
- throw new CustomException("接口异常"+e.getMessage());
|
|
|
|
- }
|
|
|
|
|
|
+ ImageIO.write(image, "jpg", os);
|
|
encode = Base64.encode(os.toByteArray());
|
|
encode = Base64.encode(os.toByteArray());
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
throw new CustomException("生成二维码失败"+e.getMessage());
|
|
throw new CustomException("生成二维码失败"+e.getMessage());
|
|
@@ -183,26 +170,25 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void callCardTopApi(Order order) {
|
|
public void callCardTopApi(Order order) {
|
|
- //TODO 等待测试接口,url,请求,响应需要替换
|
|
|
|
- boolean b = false;
|
|
|
|
|
|
+ boolean b;
|
|
|
|
+ String param = "";
|
|
|
|
+ String result = "";
|
|
try {
|
|
try {
|
|
- String param = "";
|
|
|
|
- String result = "";
|
|
|
|
b = true;
|
|
b = true;
|
|
- callApiLogService.add(order.getOrderNumber(),CARD_TOP,TopApi.DEAL_SELECT_URL,JSONObject.toJSONString(param),result);
|
|
|
|
- if (b){
|
|
|
|
- //成功修改状态成功
|
|
|
|
- order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
|
|
- this.updateById(order);
|
|
|
|
- }else {
|
|
|
|
- //失败修改状态为卡充值失败
|
|
|
|
- order.setOrderFlag(OrderStatus.PAYMENT_ERROR_DEBIT.getCode());
|
|
|
|
- this.updateById(order);
|
|
|
|
- }
|
|
|
|
|
|
+ //TODO 等待测试接口,url,请求,响应需要替换
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
|
+ b = false;
|
|
log.error("---order---卡充值api调用异常"+ e.getMessage());
|
|
log.error("---order---卡充值api调用异常"+ e.getMessage());
|
|
- throw new CustomException("卡充值异常"+e.getMessage());
|
|
|
|
}
|
|
}
|
|
|
|
+ callApiLogService.add(order.getOrderNumber(),CARD_TOP,TopApi.DEAL_SELECT_URL,JSONObject.toJSONString(param),result);
|
|
|
|
+ if (b){
|
|
|
|
+ //成功修改状态成功
|
|
|
|
+ order.setOrderFlag(OrderStatus.SUCCESS.getCode());
|
|
|
|
+ }else {
|
|
|
|
+ //失败修改状态为卡充值失败
|
|
|
|
+ order.setOrderFlag(OrderStatus.PAYMENT_ERROR_DEBIT.getCode());
|
|
|
|
+ }
|
|
|
|
+ this.updateById(order);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -257,17 +243,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
* 充值成功后处理
|
|
* 充值成功后处理
|
|
* @param order
|
|
* @param order
|
|
*/
|
|
*/
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public void paySuccess(Order order){
|
|
public void paySuccess(Order order){
|
|
- try {
|
|
|
|
- //是否可以操作
|
|
|
|
- boolean b = isCheckOrder(order.getOrderNumber());
|
|
|
|
- if (b){
|
|
|
|
- //调用卡充值api
|
|
|
|
- callCardTopApi(order);
|
|
|
|
- }
|
|
|
|
- }catch (Exception e){
|
|
|
|
- log.error("---order---卡充值异常"+e.getMessage());
|
|
|
|
|
|
+ boolean b = isCheckOrder(order.getOrderNumber());
|
|
|
|
+ if (b){
|
|
|
|
+ //调用卡充值api
|
|
|
|
+ callCardTopApi(order);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|