Ver código fonte

订单列表样式调整

xlq 3 semanas atrás
pai
commit
7a14615021

+ 22 - 0
src/main/java/com/qmrb/system/pojo/vo/PayOrderVO.java

@@ -18,6 +18,28 @@ import lombok.Data;
  */
 @Data
 public class PayOrderVO {
+    /**
+     * 车牌号
+     */
+    private String carNumber;
+
+    /**
+     * 停车场id
+     */
+    private Long carParkId;
+
+
+    /**
+     * 停车场名称
+     */
+    private String carParkName;
+
+    /**
+     * 车辆进入时间
+     */
+    @Schema(description = "车辆进入时间",type="Date")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date inTime;
 
     /**
      * 本系统生成的订单

+ 23 - 1
src/main/java/com/qmrb/system/service/impl/OrderServiceImpl.java

@@ -21,16 +21,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.qmrb.system.converter.PayOrderConverter;
 import com.qmrb.system.mapper.OrderMapper;
+import com.qmrb.system.pojo.entity.CarPark;
 import com.qmrb.system.pojo.entity.Order;
 import com.qmrb.system.pojo.entity.ToolWxConfig;
 import com.qmrb.system.pojo.form.BarnRecordForm;
 import com.qmrb.system.pojo.form.PayOrderForm;
 import com.qmrb.system.pojo.query.PayOrderQuery;
+import com.qmrb.system.pojo.vo.BarnRecordVO;
 import com.qmrb.system.pojo.vo.PayOrderVO;
 import com.qmrb.system.pojo.vo.ReCreateOrderVO;
 import com.qmrb.system.pojo.vo.ToCreateOrderVO;
 import com.qmrb.system.pojo.vo.WxLoginVO;
 import com.qmrb.system.service.IBarnRecordService;
+import com.qmrb.system.service.ICarParkService;
 import com.qmrb.system.service.OrderService;
 import com.qmrb.system.service.ToolWxConfigService;
 import com.qmrb.system.utils.WxPayUtil;
@@ -59,6 +62,7 @@ import java.math.BigDecimal;
 import java.net.URISyntaxException;
 import java.nio.charset.StandardCharsets;
 import java.security.PrivateKey;
+import java.time.format.DateTimeFormatter;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -91,6 +95,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private PayOrderConverter converter;
 
+    @Autowired
+    private ICarParkService carParkService;
+
     /**分页查询
      * */
     @Override
@@ -466,10 +473,25 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         int pageNum = queryParams.getPageNum();
         int pageSize = queryParams.getPageSize();
         //String keywords = queryParams.getKeywords();
-        
+
+
+        // 获取停车场信息
+        List<CarPark> list = carParkService.list();
+        HashMap<Long, String> map = new HashMap<>();
+        if (CollectionUtil.isNotEmpty(list)) {
+            list.stream().forEach(item -> {
+                map.put(item.getId(), item.getName());
+            });
+        }
 
         // 实体转换
         Page<PayOrderVO> pageResult = baseMapper.getPageByUserId(new Page<>(pageNum, pageSize),queryParams);
+        // 停车场名称转换
+        for (PayOrderVO record : pageResult.getRecords()) {
+            if (record.getCarParkId() != null && map.keySet().contains(record.getCarParkId())) {
+                record.setCarParkName(map.get(record.getCarParkId()));
+            }
+        }
         return pageResult;
     }
 

+ 13 - 8
src/main/resources/mapper/OrderMapper.xml

@@ -2,14 +2,19 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.qmrb.system.mapper.OrderMapper">
 
-    <select id="getPageByUserId" parameterType="com.qmrb.system.pojo.query.PayOrderQuery" 
+    <select id="getPageByUserId" parameterType="com.qmrb.system.pojo.query.PayOrderQuery"
             resultType="com.qmrb.system.pojo.vo.PayOrderVO">
-        select 
-            po.* 
-        from 
-            pay_order po INNER JOIN barn_record br on po.good_id = br.id 
-        where br.car_number = (
-        select plate_number from my_car_plate_number where user_id = #{queryParams.userId} order by create_time desc limit 1
-        )
+        select
+            po.*,
+            br.car_park_id,
+            br.car_number,
+            br.in_time
+        from pay_order po
+        INNER JOIN barn_record br on po.good_id = br.id
+        where br.car_number = (select plate_number
+                               from my_car_plate_number
+                               where user_id = #{queryParams.userId}
+                               order by create_time desc limit 1
+            )
     </select>
 </mapper>