Browse Source

fixed 预约记录接口

fushengqian 9 months ago
parent
commit
cee58906fc

+ 9 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/BookServiceImpl.java

@@ -177,6 +177,15 @@ public class BookServiceImpl extends ServiceImpl<MtBookMapper, MtBook> implement
         if (mtBook.getSort() != null) {
             book.setSort(mtBook.getSort());
         }
+        if (mtBook.getServiceDates() != null) {
+            book.setServiceDates(mtBook.getServiceDates());
+        }
+        if (mtBook.getServiceTimes() != null) {
+            book.setServiceTimes(mtBook.getServiceTimes());
+        }
+        if (mtBook.getServiceStaffIds() != null) {
+            book.setServiceStaffIds(mtBook.getServiceStaffIds());
+        }
         book.setUpdateTime(new Date());
         mtBookMapper.updateById(book);
         return book;

+ 25 - 4
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBookController.java

@@ -23,9 +23,8 @@ import lombok.AllArgsConstructor;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 预约管理类controller
@@ -182,6 +181,8 @@ public class BackendBookController extends BaseController {
         String status = params.get("status") == null ? "" : params.get("status").toString();
         String storeId = (params.get("storeId") == null || StringUtil.isEmpty(params.get("storeId").toString())) ? "0" : params.get("storeId").toString();
         String sort = (params.get("sort") == null || StringUtil.isEmpty(params.get("sort").toString())) ? "0" : params.get("sort").toString();
+        String dates = params.get("dates") == null ? "" : params.get("dates").toString();
+        List<LinkedHashMap> times = params.get("times") == null ? new ArrayList<>() : (List) params.get("times");
 
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
@@ -201,7 +202,27 @@ public class BackendBookController extends BaseController {
         mtBook.setStoreId(Integer.parseInt(storeId));
         mtBook.setSort(Integer.parseInt(sort));
         mtBook.setMerchantId(accountInfo.getMerchantId());
-
+        mtBook.setServiceDates(dates);
+        String timeStr = "";
+        if (times != null && times.size() > 0) {
+            List<String> timeArr = new ArrayList<>();
+            for (LinkedHashMap time : times) {
+                 String startTime = time.get("startTime") == null ? "" : time.get("startTime").toString();
+                 String endTime = time.get("endTime") == null ? "" : time.get("endTime").toString();
+                 String num = time.get("num") == null ? "" : time.get("num").toString();
+                 if (StringUtil.isNotEmpty(startTime) && StringUtil.isNotEmpty(endTime) && StringUtil.isNotEmpty(num)) {
+                     String item = startTime + "-" + endTime + "-" + num;
+                     if (!timeArr.contains(item)) {
+                         timeArr.add(item);
+                     }
+                 }
+            }
+            if (timeArr.size() > 0) {
+                timeStr = timeArr.stream().collect(Collectors.joining(","));
+                mtBook.setServiceTimes(timeStr);
+            }
+        }
+        mtBook.setServiceTimes(timeStr);
         if (StringUtil.isNotEmpty(id)) {
             mtBook.setId(Integer.parseInt(id));
             bookService.updateBook(mtBook);

+ 4 - 1
fuint-repository/src/main/java/com/fuint/repository/model/MtBookItem.java

@@ -37,6 +37,9 @@ public class MtBookItem implements Serializable {
     @ApiModelProperty("预约ID")
     private Integer bookId;
 
+    @ApiModelProperty("预约用户ID")
+    private Integer userId;
+
     @ApiModelProperty("商品ID")
     private Integer goodsId;
 
@@ -55,7 +58,7 @@ public class MtBookItem implements Serializable {
     @ApiModelProperty("预约备注")
     private String remark;
 
-    @ApiModelProperty("预约备注")
+    @ApiModelProperty("预约员工ID")
     private Integer serviceStaffId;
 
     @ApiModelProperty("创建时间")