Browse Source

获取更新提示

lyhzzz 2 years ago
parent
commit
bd8e451bce

+ 9 - 0
src/main/java/com/fdkankan/manage/inner/controller/InnerController.java

@@ -6,6 +6,7 @@ import com.fdkankan.manage.controller.BaseController;
 import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.manage.service.ICommonService;
 import com.fdkankan.manage.service.ISceneProService;
+import com.fdkankan.manage.service.IServiceUpTipService;
 import com.fdkankan.manage.vo.request.SceneParam;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,6 +29,8 @@ public class InnerController extends BaseController {
 
     @Autowired
     private ISceneProService sceneProService;
+    @Autowired
+    IServiceUpTipService serviceUpTipService;
 
     @PostMapping("/move")
     public ResultData move(@RequestBody SceneParam param){
@@ -42,4 +45,10 @@ public class InnerController extends BaseController {
         return ResultData.ok();
     }
 
+    @GetMapping("/getServiceUpTip")
+    public ResultData getServiceUpTip(@RequestParam(required = false) Integer type){
+
+        return ResultData.ok( serviceUpTipService.getServiceUpTipByType(type));
+    }
+
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/service/IServiceUpTipService.java

@@ -15,4 +15,6 @@ import com.fdkankan.manage.vo.request.ServiceUPTipParam;
 public interface IServiceUpTipService extends IService<ServiceUpTip> {
 
     Object pageList(ServiceUPTipParam param);
+
+    Object getServiceUpTipByType(Integer type);
 }

+ 20 - 0
src/main/java/com/fdkankan/manage/service/impl/ServiceUpTipServiceImpl.java

@@ -7,10 +7,14 @@ import com.fdkankan.manage.entity.ServiceUpTip;
 import com.fdkankan.manage.mapper.IServiceUpTipMapper;
 import com.fdkankan.manage.service.IServiceUpTipService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.util.Dateutils;
 import com.fdkankan.manage.vo.request.ServiceUPTipParam;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 
+import java.util.Date;
+import java.util.List;
+
 /**
  * <p>
  *  服务实现类
@@ -35,4 +39,20 @@ public class ServiceUpTipServiceImpl extends ServiceImpl<IServiceUpTipMapper, Se
 
         return PageInfo.PageInfo(page);
     }
+
+    @Override
+    public Object getServiceUpTipByType(Integer type) {
+        LambdaQueryWrapper<ServiceUpTip> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(ServiceUpTip::getType,type);
+        wrapper.eq(ServiceUpTip::getBanStatus,0);
+
+        String date = Dateutils.getDate(new Date());
+        wrapper.ge(ServiceUpTip::getTipStartTime,date);
+        wrapper.le(ServiceUpTip::getTipEndTime,date);
+        List<ServiceUpTip> list = this.list(wrapper);
+        if(list == null || list.size()<=0){
+            return null;
+        }
+        return list.get(0);
+    }
 }