Browse Source

修改统计

YPZ 3 tuần trước cách đây
mục cha
commit
6099e4c3b6

+ 8 - 2
java/storlead-sasa/storlead-trade/src/main/java/com/storlead/trade/service/impl/MarketEmailsServiceImpl.java

@@ -262,15 +262,17 @@ public class MarketEmailsServiceImpl extends MyBaseServiceImpl<MarketEmailsMappe
         wrapper.in(MarketEmailsEntity::getCustomerId, customerIdList);
         wrapper.in(MarketEmailsEntity::getCustomerId, customerIdList);
         wrapper.eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
         wrapper.eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
         wrapper.set(MarketEmailsEntity::getHasProtect, dto.getHasProtect());
         wrapper.set(MarketEmailsEntity::getHasProtect, dto.getHasProtect());
-        wrapper.set(MarketEmailsEntity::getProtectTime, new Date());
+
 
 
         // 如果是开启保护 且 前端传了保护原因 -> 一并写入
         // 如果是开启保护 且 前端传了保护原因 -> 一并写入
         if (Integer.valueOf(1).equals(dto.getHasProtect()) && !ObjectUtils.isEmpty(dto.getProtectReason())) {
         if (Integer.valueOf(1).equals(dto.getHasProtect()) && !ObjectUtils.isEmpty(dto.getProtectReason())) {
             wrapper.set(MarketEmailsEntity::getProtectReason, dto.getProtectReason());
             wrapper.set(MarketEmailsEntity::getProtectReason, dto.getProtectReason());
+            wrapper.set(MarketEmailsEntity::getProtectTime, new Date());
         }
         }
         // 如果是移除保护 -> 清空保护原因
         // 如果是移除保护 -> 清空保护原因
         if (Integer.valueOf(0).equals(dto.getHasProtect())) {
         if (Integer.valueOf(0).equals(dto.getHasProtect())) {
             wrapper.set(MarketEmailsEntity::getProtectReason, null);
             wrapper.set(MarketEmailsEntity::getProtectReason, null);
+            wrapper.set(MarketEmailsEntity::getProtectTime, null);
         }
         }
         boolean ok = this.update(wrapper);
         boolean ok = this.update(wrapper);
         if (!ok) {
         if (!ok) {
@@ -310,7 +312,11 @@ public class MarketEmailsServiceImpl extends MyBaseServiceImpl<MarketEmailsMappe
         wrapper.in(MarketEmailsEntity::getCustomerId, customerIdList);
         wrapper.in(MarketEmailsEntity::getCustomerId, customerIdList);
         wrapper.eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
         wrapper.eq(MarketEmailsEntity::getIsDelete, CommonConstant.DEL_FLAG_0);
         wrapper.set(MarketEmailsEntity::getHasSuspend, dto.getHasSuspend());
         wrapper.set(MarketEmailsEntity::getHasSuspend, dto.getHasSuspend());
-        wrapper.set(MarketEmailsEntity::getSuspendTime, new Date());
+        if (Integer.valueOf(1).equals(dto.getHasSuspend())) {
+            wrapper.set(MarketEmailsEntity::getSuspendTime, new Date());
+        }else if (Integer.valueOf(0).equals(dto.getHasSuspend())) {
+            wrapper.set(MarketEmailsEntity::getSuspendTime, null);
+        }
         boolean ok = this.update(wrapper);
         boolean ok = this.update(wrapper);
         if (!ok) {
         if (!ok) {
             return Result.error("暂停失败");
             return Result.error("暂停失败");