Pārlūkot izejas kodu

修改消费记录

he.dujuan 3 gadi atpakaļ
vecāks
revīzija
b7199f7c59

+ 1 - 3
eladmin-system/src/main/java/me/zhengjie/config/rabbitmq/test/ListenerTemplate.java

@@ -115,9 +115,7 @@ public class ListenerTemplate {
             dmExpenseCalendar.setCardProfile(attendance.getInteger("card_profile"));
 
             String bh = UUID.randomUUID().toString();
-            DmOrderItem orderItem1 = new DmOrderItem();
-            orderItem1.setBh(bh);
-            dmExpenseCalendar.setOrderItem(orderItem1);//关联编号
+            dmExpenseCalendar.setBh(bh);//关联编号
             JSONArray item = attendance.getJSONArray("details");
             for (int i = 0; i < item.size(); i++) {
                 JSONObject userData = item.getJSONObject(i);

+ 2 - 4
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderPayment.java

@@ -5,10 +5,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
+import javax.persistence.*;
 import java.io.Serializable;
 
 @Entity
@@ -19,6 +16,7 @@ public class DmOrderPayment implements Serializable {
     @Id
     @Column(name = "id")
     @ApiModelProperty(value = "id")
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     private Integer id;
 
     @Column(name = "bh")

+ 7 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/domain/DmOrderRecord.java

@@ -25,6 +25,7 @@ import javax.persistence.*;
 import javax.validation.constraints.*;
 import java.sql.Timestamp;
 import java.io.Serializable;
+import java.util.List;
 
 /**
 * @website https://el-admin.vip
@@ -49,10 +50,14 @@ public class DmOrderRecord implements Serializable {
 //    @JoinColumn(name = "id")
 //    @ManyToOne(fetch=FetchType.LAZY)
 //    @ApiModelProperty(value = "订单编号", hidden = true)
-    @OneToOne
+    @OneToMany
     @JoinColumn(name = "bh")
     @ApiModelProperty(value = "订单编号")
-    private DmOrderItem orderItem;
+    private List<DmOrderItem> orderItems;
+
+    @Column(name = "bh")
+    @ApiModelProperty(value = "订单编号")
+    private String bh;
 
     @Column(name = "money")
     @ApiModelProperty(value = "实付金额")

+ 3 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/dto/DmOrderRecordDto.java

@@ -42,7 +42,9 @@ public class DmOrderRecordDto implements Serializable {
     //订单编号
 //    private List<DmOrderItem> orderItem;
 //    private DmOrderItemSmallDto orderItem;
-    private DmOrderItem orderItem;
+    private List<DmOrderItem> orderItems;
+
+    private String bh;
 
     //实付金额
     private String money;

+ 0 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderPaymentServiceImpl.java

@@ -49,8 +49,6 @@ public class DmOrderPaymentServiceImpl implements DmOrderPaymentService {
 
     @Override
     public DmOrderPaymentDto create(DmOrderPayment resources) {
-        Snowflake snowflake = IdUtil.createSnowflake(1, 1);
-        resources.setId((int) snowflake.nextId());
         return dmOrderPaymentMapper.toDto(dmOrderPaymentRepository.save(resources));
     }
 

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderRecordServiceImpl.java

@@ -109,7 +109,7 @@ public class DmOrderRecordServiceImpl implements DmOrderRecordService {
         List<Map<String, Object>> list = new ArrayList<>();
         for (DmOrderRecordDto dmOrderRecord : all) {
             Map<String,Object> map = new LinkedHashMap<>();
-            map.put("订单编号", dmOrderRecord.getOrderItem().getBh());//
+            map.put("订单编号", dmOrderRecord.getBh());//
             map.put("实付金额", dmOrderRecord.getMoney());
             map.put("用户姓名", dmOrderRecord.getUserName());
             map.put("人员种类", dmOrderRecord.getUserType());