Forráskód Böngészése

FEAT: 直播订单导出修改

xdd 2 napja
szülő
commit
46620289d1

+ 6 - 2
fs-admin/src/main/java/com/fs/live/controller/LiveOrderController.java

@@ -128,8 +128,12 @@ public class LiveOrderController extends BaseController
         List<LiveOrder> list = liveOrderService.selectLiveOrderListExport(liveOrder);
 
         for (LiveOrder order : list) {
-            order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
-            order.setUserAddress(ParseUtils.parseAddress(order.getUserAddress()));
+            if(StringUtils.isNotNull(order.getUserPhone())){
+                order.setUserPhone(ParseUtils.parsePhone(order.getUserPhone()));
+            }
+            if(StringUtils.isNotNull(order.getUserAddress())){
+                order.setUserAddress(ParseUtils.parseAddress(order.getUserAddress()));
+            }
         }
         ExcelUtil<LiveOrder> util = new ExcelUtil<LiveOrder>(LiveOrder.class);
         return util.exportExcel(list, "订单数据");

+ 3 - 1
fs-service-system/src/main/java/com/fs/live/domain/LiveOrder.java

@@ -7,6 +7,7 @@ import lombok.Data;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.time.ZoneId;
 import java.util.Date;
 
 /**
@@ -100,7 +101,8 @@ public class LiveOrder extends BaseEntity {
     /** 支付时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
-    private LocalDateTime payTime;
+    private Date payTime;
+
     /** 支付方式 1微信 */
     @Excel(name = "支付方式", readConverterExp = "微信=1")
     private String payType;

+ 3 - 3
fs-service-system/src/main/java/com/fs/live/mapper/LiveOrderPaymentMapper.java

@@ -85,8 +85,8 @@ public interface LiveOrderPaymentMapper {
     @Select("select * from live_order_payment where business_id= #{orderId} and status=1 order by create_time desc limit 1")
     LiveOrderPayment selectLiveOrderLatestPayByOrderId(@Param("orderId") Long orderId);
 
-    @MapKey("orderId")
-    @Select("select order_id,bank_transaction_id from live_order_payment where bank_transaction_id is not null")
-    Map<Long, LiveOrderPayment> selectAllPayments();
+    @MapKey("businessId")
+    @Select("select business_id,bank_transaction_id from live_order_payment where bank_transaction_id is not null")
+    Map<String, LiveOrderPayment> selectAllPayments();
 
 }

+ 8 - 6
fs-service-system/src/main/java/com/fs/live/service/impl/LiveOrderServiceImpl.java

@@ -14,6 +14,7 @@ import java.util.stream.Collectors;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -559,7 +560,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
             order.setStatus(2);
             order.setIsPay("1");
-            order.setPayTime(LocalDateTime.now());
+            order.setPayTime(new Date());
             baseMapper.updateLiveOrder(order);
             return "SUCCESS";
         }catch (Exception e){
@@ -776,7 +777,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         }
         Map<Long, FsStoreDelivers> byOrderIdWithTypeBatch = fsStoreDeliversMapper
                 .findByOrderIdWithTypeBatch(collect, 1);
-        Map<Long, LiveOrderPayment> paymentMap = liveOrderPaymentMapper.selectAllPayments();
+        Map<String, LiveOrderPayment> paymentMap = liveOrderPaymentMapper.selectAllPayments();
 
         for (LiveOrder order : liveOrders) {
             FsStoreDelivers delivers = byOrderIdWithTypeBatch.get(order.getOrderId());
@@ -795,7 +796,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
             }
             order.setPayPrice(order.getTotalPrice());
 
-            LiveOrderPayment liveOrderPayment = paymentMap.get(order.getOrderId());
+            LiveOrderPayment liveOrderPayment = paymentMap.get(String.valueOf(order.getOrderId()));
             if(ObjectUtil.isNotNull(liveOrderPayment)){
                 order.setBankTrxId(liveOrderPayment.getBankTransactionId());
             }
@@ -1206,7 +1207,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
         payment.setPayment(order.getPayMoney().doubleValue());
         if(order.getPayTime()!=null){
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            String timeString = order.getPayTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+            String timeString = DateUtil.format(order.getPayTime(),"yyyy-MM-dd HH:mm:ss");
             Date date = sdf.parse(timeString); // 时间格式转为时间戳
             long timeLong = date.getTime();
             payment.setPaytime(new Timestamp(timeLong));
@@ -1359,7 +1360,8 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
 
         if(order.getPayTime()!=null){
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-            String format = order.getPayTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+            String format = DateUtil.format(order.getPayTime(),"yyyy-MM-dd HH:mm:ss");
+
             remarkDTO.setPayTime(format);
         }
         erpOrder.setSeller_memo(erpOrder.getSeller_memo()+JSONUtil.toJsonStr(remarkDTO));
@@ -2416,7 +2418,7 @@ public class LiveOrderServiceImpl implements ILiveOrderService {
             userService.incPayCount(Long.valueOf(liveOrder.getUserId()));
 
             liveOrder.setStatus(2);
-            liveOrder.setPayTime(LocalDateTime.now());
+            liveOrder.setPayTime(new Date());
             liveUserLotteryRecordMapper.updateOrderStatusByOrderId(liveOrder.getOrderId(), 2);
             baseMapper.updateLiveOrder(liveOrder);
             return R.ok("支付成功");