浏览代码

1、上传店铺信息添加游客数据

luobo 3 年之前
父节点
当前提交
5ff8e4f5d0

+ 15 - 0
smart-system/src/main/java/com/huijy/management/domain/ShopSalesRecord.java

@@ -2,6 +2,8 @@ package com.huijy.management.domain;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.List;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.huijy.common.annotation.Excel;
 import com.huijy.common.core.domain.BaseEntity;
@@ -54,6 +56,11 @@ public class ShopSalesRecord extends BaseEntity
     /** 销售金额 */
     @Excel(name = "销售金额")
     private BigDecimal salesAmount;
+    /**
+     * 酒店游客信息
+     */
+    private List<ShopGuestRecord> shopGuestRecordList;
+
 
     public void setShopSalesRecordId(Long shopSalesRecordId)
     {
@@ -136,6 +143,14 @@ public class ShopSalesRecord extends BaseEntity
         this.shopName = shopName;
     }
 
+    public List<ShopGuestRecord> getShopGuestRecordList() {
+        return shopGuestRecordList;
+    }
+
+    public void setShopGuestRecordList(List<ShopGuestRecord> shopGuestRecordList) {
+        this.shopGuestRecordList = shopGuestRecordList;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 13 - 1
smart-system/src/main/java/com/huijy/management/service/impl/ShopSalesRecordServiceImpl.java

@@ -2,6 +2,8 @@ package com.huijy.management.service.impl;
 
 import java.util.List;
 import com.huijy.common.utils.DateUtils;
+import com.huijy.management.domain.ShopGuestRecord;
+import com.huijy.management.service.IShopGuestRecordService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.huijy.management.mapper.ShopSalesRecordMapper;
@@ -20,6 +22,8 @@ public class ShopSalesRecordServiceImpl implements IShopSalesRecordService
     @Autowired
     private ShopSalesRecordMapper shopSalesRecordMapper;
 
+    private IShopGuestRecordService shopGuestRecordService;
+
     /**
      * 查询店铺销售记录
      *
@@ -54,7 +58,15 @@ public class ShopSalesRecordServiceImpl implements IShopSalesRecordService
     public int insertShopSalesRecord(ShopSalesRecord shopSalesRecord)
     {
         shopSalesRecord.setCreateTime(DateUtils.getNowDate());
-        return shopSalesRecordMapper.insertShopSalesRecord(shopSalesRecord);
+       Integer row = shopSalesRecordMapper.insertShopSalesRecord(shopSalesRecord);
+       if (shopSalesRecord.getShopGuestRecordList()!=null && shopSalesRecord.getShopGuestRecordList().size()>0){
+           for (ShopGuestRecord item:shopSalesRecord.getShopGuestRecordList()){
+               item.setShopId(shopSalesRecord.getShopId());
+               item.setCreateTime(shopSalesRecord.getCreateTime());
+               shopGuestRecordService.insertShopGuestRecord(item);
+           }
+       }
+        return row;
     }
 
     /**