change před 4 roky
rodič
revize
3b5928cab7

+ 2 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/ZhongZhengApplication.java

@@ -5,6 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
 import org.springframework.context.annotation.Bean;
+import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.web.client.RestTemplate;
 
 /**
@@ -14,6 +15,7 @@ import org.springframework.web.client.RestTemplate;
  */
 
 @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
+@EnableScheduling
 public class ZhongZhengApplication
 {
     public static void main(String[] args)

+ 40 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/schedule/ScheduleController.java

@@ -0,0 +1,40 @@
+package com.zhongzheng.controller.schedule;
+
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.modules.schedule.service.IScheduleService;
+import com.zhongzheng.modules.user.bo.UserQueryBo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 定时任务
+ *
+ * @author ruoyi
+ * @date 2021-11-10
+ */
+@Api(value = "定时任务", tags = {"定时任务管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/app/common")
+public class ScheduleController extends BaseController {
+
+    private final IScheduleService iScheduleService;
+
+
+    /**
+     * 查询學員用户列表
+     * @return
+     */
+    @ApiOperation("查询學員用户列表")
+    @GetMapping("/updateGoodsSend")
+    public AjaxResult updateGoodsSend(UserQueryBo bo) {
+        iScheduleService.updateGoodsSend(bo);
+        return AjaxResult.success();
+    }
+
+}

+ 7 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/ProfileTpServiceImpl.java

@@ -24,6 +24,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.pagehelper.Page;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
 
 import java.util.*;
 import java.util.stream.Collectors;
@@ -160,7 +161,12 @@ public class ProfileTpServiceImpl extends ServiceImpl<ProfileTpMapper, ProfileTp
     public ProfileTpVo queryByGoodsId(Long goodsId) {
         ProfileTpQueryBo profileTpQueryBo = new ProfileTpQueryBo();
         profileTpQueryBo.setGoodsId(goodsId);
-        return profileTpMapper.selectList(profileTpQueryBo).get(0);
+        List<ProfileTpVo> profileTpVos = profileTpMapper.selectList(profileTpQueryBo);
+        if (!CollectionUtils.isEmpty(profileTpVos)){
+            return profileTpVos.get(0);
+        }else {
+            return null;
+        }
     }
 
 

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/IScheduleService.java

@@ -0,0 +1,26 @@
+package com.zhongzheng.modules.schedule.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhongzheng.modules.polyv.bo.PolyvVideoAddBo;
+import com.zhongzheng.modules.polyv.bo.PolyvVideoEditBo;
+import com.zhongzheng.modules.polyv.bo.PolyvVideoQueryBo;
+import com.zhongzheng.modules.polyv.domain.PolyvVideo;
+import com.zhongzheng.modules.polyv.vo.PolyvVideoQuerVo;
+import com.zhongzheng.modules.polyv.vo.PolyvVideoVo;
+import com.zhongzheng.modules.polyv.vo.PolyvVo;
+import com.zhongzheng.modules.user.bo.UserQueryBo;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 保利威视频信息Service接口
+ *
+ * @author ruoyi
+ * @date 2021-06-11
+ */
+public interface IScheduleService extends IService<PolyvVideo> {
+
+    String updateGoodsSend(UserQueryBo bo);
+}

+ 47 - 19
zhongzheng-admin/src/main/java/com/zhongzheng/controller/grade/SaticScheduleTask.java → zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -1,7 +1,21 @@
-package com.zhongzheng.controller.grade;
+package com.zhongzheng.modules.schedule.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.http.HttpStatus;
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.pagehelper.Page;
+import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.common.utils.http.HttpUtils;
+import com.zhongzheng.common.utils.polyv.PolyvUtils;
 import com.zhongzheng.modules.base.service.IProfileTpService;
 import com.zhongzheng.modules.base.vo.ProfileTpVo;
 import com.zhongzheng.modules.goods.service.IGoodsService;
@@ -10,33 +24,52 @@ import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
 import com.zhongzheng.modules.grade.service.IClassGradeService;
 import com.zhongzheng.modules.grade.service.IClassGradeUserService;
 import com.zhongzheng.modules.inform.bo.InformUserAddBo;
-import com.zhongzheng.modules.inform.domain.Inform;
 import com.zhongzheng.modules.inform.service.IInformRemindService;
 import com.zhongzheng.modules.inform.service.IInformService;
 import com.zhongzheng.modules.inform.service.IInformUserService;
 import com.zhongzheng.modules.inform.vo.InformRemindVo;
-import com.zhongzheng.modules.order.bo.OrderGoodsAddBo;
 import com.zhongzheng.modules.order.mapper.OrderMapper;
 import com.zhongzheng.modules.order.service.IOrderBusinessService;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
+import com.zhongzheng.modules.polyv.bo.PolyvVideoAddBo;
+import com.zhongzheng.modules.polyv.bo.PolyvVideoEditBo;
+import com.zhongzheng.modules.polyv.bo.PolyvVideoQueryBo;
+import com.zhongzheng.modules.polyv.domain.PolyvVideDo;
+import com.zhongzheng.modules.polyv.domain.PolyvVideo;
+import com.zhongzheng.modules.polyv.domain.TokenResponse;
+import com.zhongzheng.modules.polyv.mapper.PolyvVideoMapper;
+import com.zhongzheng.modules.polyv.vo.PolyvVideoQuerVo;
+import com.zhongzheng.modules.polyv.vo.PolyvVideoVo;
+import com.zhongzheng.modules.polyv.vo.PolyvVo;
+import com.zhongzheng.modules.schedule.service.IScheduleService;
+import com.zhongzheng.modules.user.bo.UserQueryBo;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.vo.UserVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
-import java.time.LocalDateTime;
+import java.io.IOException;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
 
-@Configuration      //1.主要用于标记配置类,兼备Component的效果。
-@EnableScheduling   // 2.开启定时任务
-public class SaticScheduleTask {
+import static com.squareup.okhttp.internal.Util.md5Hex;
+
+/**
+ * 定时任务
+ *
+ * @author change
+ * @date 2021-06-11
+ */
+@Service
+public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVideo> implements IScheduleService {
 
     @Autowired
     private IInformService informService;
@@ -80,11 +113,8 @@ public class SaticScheduleTask {
     @Value("${aliyun.sms.informationNotificationCode}")
     private String informationNotificationCode;
 
-    //3.添加定时任务
-    //@Scheduled(cron = "0/2 * * * * ?")
-    //或直接指定时间间隔,例如:5秒
-    @Scheduled(fixedRate = 5000)
-    private void configureTasks() {
+    @Override
+    public String updateGoodsSend(UserQueryBo bo) {
         InformRemindVo informRemindVo = informRemindService.queryById(1L);
         List<OrderGoodsVo> orderGoodsVo = iOrderGoodsService.selectOrderGoods();
 
@@ -167,8 +197,6 @@ public class SaticScheduleTask {
                 }
             }
         }
-
-
+        return "请求成功";
     }
-
-}
+}