From d7452d46f66a58caaad0442fbcca6953336c18ea Mon Sep 17 00:00:00 2001
From: jiangqs <jiangqs>
Date: 星期三, 14 六月 2023 16:04:29 +0800
Subject: [PATCH] 活动管理

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
index 497cb16..362d843 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -33,8 +33,6 @@
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
@@ -275,28 +273,24 @@
     @Override
     public void changeCooperationTime(MgtChangeCoopDto mgtChangeCoopDto){
         Shop shop = this.getById(mgtChangeCoopDto.getShopId());
-        String coopStartTime = mgtChangeCoopDto.getCoopStartTime();
-        String coopEndTime = mgtChangeCoopDto.getCoopEndTime();
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        try {
-            Date coopStartDate = simpleDateFormat.parse(coopStartTime);
-            Date coopEndDate = simpleDateFormat.parse(coopEndTime);
-            Date nowTime = new Date();
-            shop.setCooperationStartTime(coopStartDate);
-            shop.setCooperationEndTime(coopEndDate);
-            Boolean inTime = false;
-            if(coopStartDate.compareTo(nowTime)<0&&coopEndDate.compareTo(nowTime)>0){
-                inTime = true;
-            }
-            if(shop.getShopStatus()==2&&inTime){
-                shop.setShopStatus(1);
-            }
-            shop.setUpdateTime(nowTime);
-            shop.setUpdateUserId(mgtChangeCoopDto.getUserId());
-            this.saveOrUpdate(shop);
-        } catch (ParseException e) {
-            e.printStackTrace();
+        Date coopStartDate = mgtChangeCoopDto.getCoopStartTime();
+        Date coopEndDate = mgtChangeCoopDto.getCoopEndTime();
+        Date nowTime = new Date();
+        shop.setCooperationStartTime(coopStartDate);
+        shop.setCooperationEndTime(coopEndDate);
+        Boolean inTime = false;
+        if(coopStartDate.compareTo(nowTime)<=0&&coopEndDate.compareTo(nowTime)>=0){
+            inTime = true;
+            shop.setCooperativeFlag(1);
+        }else{
+            shop.setCooperativeFlag(0);
         }
+        if(shop.getShopStatus()==2&&inTime){
+            shop.setShopStatus(1);
+        }
+        shop.setUpdateTime(nowTime);
+        shop.setUpdateUserId(mgtChangeCoopDto.getUserId());
+        this.saveOrUpdate(shop);
     }
 
     /**

--
Gitblit v1.7.1