From af8cd7db30e347bf4a9d4753e352abe9106bdb09 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期二, 11 一月 2022 18:06:54 +0800
Subject: [PATCH] 商业街1/11代码提交

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java |   44 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
index 145ea24..287240b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsMerchantServiceImpl.java
@@ -18,6 +18,7 @@
 import com.panzhihua.common.model.vos.community.microCommercialStreet.IndexTopStatisticsVO;
 import com.panzhihua.common.model.vos.community.microCommercialStreet.McsGameVO;
 import com.panzhihua.common.model.vos.community.microCommercialStreet.McsLoginUserInfoVO;
+import com.panzhihua.service_community.dao.McsInformationDAO;
 import com.panzhihua.service_community.util.NearbyUtil;
 import com.spatial4j.core.shape.Rectangle;
 import org.springframework.beans.BeanUtils;
@@ -66,6 +67,8 @@
     private McsConfigDAO mcsConfigDAO;
     @Resource
     private McsGameDAO mcsGameDAO;
+    @Resource
+    private McsInformationDAO mcsInformationDAO;
     @Resource
     private StringRedisTemplate stringRedisTemplate;
 
@@ -274,11 +277,9 @@
             } else {
                 nowExpireAt = DateUtils.addDay(previousExpireAt, litDays);
             }
-            McsMerchant mcsMerchant1 = new McsMerchant();
-            mcsMerchant1.setId(mcsMerchant.getId());
-            mcsMerchant1.setExpireAt(nowExpireAt);
-            mcsMerchant1.setUpdatedBy(userId);
-            num = this.baseMapper.updateById(mcsMerchant1);
+            mcsMerchant.setExpireAt(nowExpireAt);
+            mcsMerchant.setUpdatedBy(userId);
+            num = this.baseMapper.updateById(mcsMerchant);
         }
         if (num > 0) {
             return R.ok(mcsMerchant.getId());
@@ -390,6 +391,39 @@
         return R.ok();
     }
 
+    /**
+     * 根据userId获取商家信息
+     * @param userId
+     * @return
+     */
+    @Override
+    public R retrieveMcsMerchantInfoByUserId(Long userId) {
+        McsMerchant mcsMerchant = this.baseMapper.selectOne(new QueryWrapper<McsMerchant>().lambda()
+                .eq(McsMerchant::getUserId, userId).eq(McsMerchant::getIsDel, false));
+        McsMerchantVO mcsMerchantVO = null;
+        if (nonNull(mcsMerchant)) {
+            mcsMerchantVO = new McsMerchantVO();
+            BeanUtils.copyProperties(mcsMerchant, mcsMerchantVO);
+        }
+        return R.ok(mcsMerchantVO);
+    }
+
+    /**
+     * 定时任务-每隔5分钟执行一次,将已到期的微商业街商家旗下所有的游戏/资讯全部下架
+     * @return
+     */
+    @Override
+    public R offResourceForMcsMerchant() {
+        int num = 0;
+        List<Long> needDealIds = this.baseMapper.selectNeedDealExpiredMerchant();
+        if (nonNull(needDealIds) && !needDealIds.isEmpty()) {
+            mcsGameDAO.setOffByMerchantIds(needDealIds);
+            mcsInformationDAO.setOffByMerchantIds(needDealIds);
+            num = this.baseMapper.updateIsPauseStatus(needDealIds);
+        }
+        return R.ok("执行任务数:" + num);
+    }
+
     private void retrieveMerchantSurplusLitDays(McsMerchantVO merchantVO) {
         Integer publishLimit = merchantVO.getPublishLimit();
         Integer publishCount = mcsGameDAO.selectPublishCount(merchantVO.getId());

--
Gitblit v1.7.1