Browse Source

修改保底视频获取方式

xueyiming 4 months ago
parent
commit
89f42bd3f5

+ 0 - 5
we-com-server/src/main/java/com/tzld/piaoquan/wecom/common/constant/RedisConstant.java

@@ -2,11 +2,6 @@ package com.tzld.piaoquan.wecom.common.constant;
 
 public interface RedisConstant {
 
-    String PUSH_MESSAGE_TEXT = "push_message_text";
-    String ACCESS_TOKEN = "ACCESS_TOKEN";
-
     String WE_COM_ACCESS_TOKEN = "WE_COM_ACCESS_TOKEN_%s";
 
-    //小程序保底视频key
-    String GUARANTEED_MINI_PROGRAM_KEY = "guaranteed_mini_program_%s";
 }

+ 4 - 10
we-com-server/src/main/java/com/tzld/piaoquan/wecom/controller/MessageController.java

@@ -3,11 +3,13 @@ package com.tzld.piaoquan.wecom.controller;
 
 import com.tzld.piaoquan.wecom.common.base.CommonResponse;
 import com.tzld.piaoquan.wecom.model.vo.GuaranteedParam;
-import com.tzld.piaoquan.wecom.model.vo.MessageTextParam;
 import com.tzld.piaoquan.wecom.service.MessageAttachmentService;
 import com.tzld.piaoquan.wecom.service.MessageService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 @RestController
 @RequestMapping("/wecom/message")
@@ -25,12 +27,4 @@ public class MessageController {
         return messageAttachmentService.createGuaranteedMiniProgram(guaranteedParam);
     }
 
-    //创建新text 有时限和无时限  新创建覆盖原text 未创建取默认保底
-    @PostMapping("/text/create")
-    public CommonResponse<Void> createMessageText(@RequestBody MessageTextParam messageTextParam){
-        messageService.createMessageText(messageTextParam);
-        return CommonResponse.success();
-    }
-
-
 }

+ 30 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/dao/mapper/GuaranteesVideoMapper.java

@@ -0,0 +1,30 @@
+package com.tzld.piaoquan.wecom.dao.mapper;
+
+import com.tzld.piaoquan.wecom.model.po.GuaranteesVideo;
+import com.tzld.piaoquan.wecom.model.po.GuaranteesVideoExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface GuaranteesVideoMapper {
+    long countByExample(GuaranteesVideoExample example);
+
+    int deleteByExample(GuaranteesVideoExample example);
+
+    int deleteByPrimaryKey(Long id);
+
+    int insert(GuaranteesVideo record);
+
+    int insertSelective(GuaranteesVideo record);
+
+    List<GuaranteesVideo> selectByExample(GuaranteesVideoExample example);
+
+    GuaranteesVideo selectByPrimaryKey(Long id);
+
+    int updateByExampleSelective(@Param("record") GuaranteesVideo record, @Param("example") GuaranteesVideoExample example);
+
+    int updateByExample(@Param("record") GuaranteesVideo record, @Param("example") GuaranteesVideoExample example);
+
+    int updateByPrimaryKeySelective(GuaranteesVideo record);
+
+    int updateByPrimaryKey(GuaranteesVideo record);
+}

+ 4 - 8
we-com-server/src/main/java/com/tzld/piaoquan/wecom/job/WeComMessageDataJob.java

@@ -33,7 +33,6 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 import static com.tzld.piaoquan.wecom.common.constant.MessageConstant.MAX_VIDEO_NUM;
-import static com.tzld.piaoquan.wecom.common.constant.RedisConstant.GUARANTEED_MINI_PROGRAM_KEY;
 import static com.tzld.piaoquan.wecom.common.constant.TimeConstant.MILLISECOND_DAY;
 
 @Log4j2
@@ -115,8 +114,7 @@ public class WeComMessageDataJob {
 
         }
         //保底视频获取
-        String key = String.format(GUARANTEED_MINI_PROGRAM_KEY, DateUtil.getThatDayDateString());
-        GuaranteedParam guaranteedParam = (GuaranteedParam) redisTemplate.opsForValue().get(key);
+        GuaranteedParam guaranteedParam = messageAttachmentService.getGuaranteedVideo(DateUtil.getThatDayDateString());
         if (guaranteedParam == null
                 || CollectionUtils.isEmpty(guaranteedParam.getVideoParamList())) {
             LarkRobotUtil.sendMessage("保底视频获取异常,请检查" + DateUtil.getThatDayDateString());
@@ -254,8 +252,7 @@ public class WeComMessageDataJob {
     }
 
     private void saveGuaranteedVideoIdList(List<Long> staffIds) {
-        String key = String.format(GUARANTEED_MINI_PROGRAM_KEY, DateUtil.getThatDayDateString());
-        GuaranteedParam guaranteedParam = (GuaranteedParam) redisTemplate.opsForValue().get(key);
+        GuaranteedParam guaranteedParam = messageAttachmentService.getGuaranteedVideo(DateUtil.getThatDayDateString());
         if (guaranteedParam == null || CollectionUtils.isEmpty(guaranteedParam.getVideoParamList())) {
             return;
         }
@@ -557,11 +554,10 @@ public class WeComMessageDataJob {
     @XxlJob("existGuaranteesJob")
     public ReturnT<String> existGuarantees(String param) {
         //保底视频获取
-        String key = String.format(GUARANTEED_MINI_PROGRAM_KEY, DateUtil.getNextDayDateString());
-        GuaranteedParam guaranteedParam = (GuaranteedParam) redisTemplate.opsForValue().get(key);
+        GuaranteedParam guaranteedParam = messageAttachmentService.getGuaranteedVideo(DateUtil.getNextDayDateString());
         if (guaranteedParam == null
                 || CollectionUtils.isEmpty(guaranteedParam.getVideoParamList())) {
-            LarkRobotUtil.sendMessage("保底视频异常,请检查" + DateUtil.getNextDayDateString());
+            LarkRobotUtil.sendMessage("@薛一鸣 保底视频异常,请检查" + DateUtil.getNextDayDateString());
         }
         return ReturnT.SUCCESS;
     }

+ 92 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/GuaranteesVideo.java

@@ -0,0 +1,92 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import java.util.Date;
+
+public class GuaranteesVideo {
+    private Long id;
+
+    private String date;
+
+    private Long staffId;
+
+    private String videoIds;
+
+    private Integer isDelete;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public Long getStaffId() {
+        return staffId;
+    }
+
+    public void setStaffId(Long staffId) {
+        this.staffId = staffId;
+    }
+
+    public String getVideoIds() {
+        return videoIds;
+    }
+
+    public void setVideoIds(String videoIds) {
+        this.videoIds = videoIds;
+    }
+
+    public Integer getIsDelete() {
+        return isDelete;
+    }
+
+    public void setIsDelete(Integer isDelete) {
+        this.isDelete = isDelete;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", id=").append(id);
+        sb.append(", date=").append(date);
+        sb.append(", staffId=").append(staffId);
+        sb.append(", videoIds=").append(videoIds);
+        sb.append(", isDelete=").append(isDelete);
+        sb.append(", createTime=").append(createTime);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 652 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/po/GuaranteesVideoExample.java

@@ -0,0 +1,652 @@
+package com.tzld.piaoquan.wecom.model.po;
+
+import com.tzld.piaoquan.wecom.utils.page.Page;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class GuaranteesVideoExample {
+    protected String orderByClause;
+
+    protected boolean distinct;
+
+    protected List<Criteria> oredCriteria;
+
+    protected Page page;
+
+    public GuaranteesVideoExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    public void setPage(Page page) {
+        this.page=page;
+    }
+
+    public Page getPage() {
+        return page;
+    }
+
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Long value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Long value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Long value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Long value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Long value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Long> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Long> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Long value1, Long value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Long value1, Long value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateIsNull() {
+            addCriterion("`date` is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateIsNotNull() {
+            addCriterion("`date` is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateEqualTo(String value) {
+            addCriterion("`date` =", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateNotEqualTo(String value) {
+            addCriterion("`date` <>", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateGreaterThan(String value) {
+            addCriterion("`date` >", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateGreaterThanOrEqualTo(String value) {
+            addCriterion("`date` >=", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateLessThan(String value) {
+            addCriterion("`date` <", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateLessThanOrEqualTo(String value) {
+            addCriterion("`date` <=", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateLike(String value) {
+            addCriterion("`date` like", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateNotLike(String value) {
+            addCriterion("`date` not like", value, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateIn(List<String> values) {
+            addCriterion("`date` in", values, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateNotIn(List<String> values) {
+            addCriterion("`date` not in", values, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateBetween(String value1, String value2) {
+            addCriterion("`date` between", value1, value2, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andDateNotBetween(String value1, String value2) {
+            addCriterion("`date` not between", value1, value2, "date");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIsNull() {
+            addCriterion("staff_id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIsNotNull() {
+            addCriterion("staff_id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdEqualTo(Long value) {
+            addCriterion("staff_id =", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotEqualTo(Long value) {
+            addCriterion("staff_id <>", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdGreaterThan(Long value) {
+            addCriterion("staff_id >", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdGreaterThanOrEqualTo(Long value) {
+            addCriterion("staff_id >=", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdLessThan(Long value) {
+            addCriterion("staff_id <", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdLessThanOrEqualTo(Long value) {
+            addCriterion("staff_id <=", value, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdIn(List<Long> values) {
+            addCriterion("staff_id in", values, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotIn(List<Long> values) {
+            addCriterion("staff_id not in", values, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdBetween(Long value1, Long value2) {
+            addCriterion("staff_id between", value1, value2, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andStaffIdNotBetween(Long value1, Long value2) {
+            addCriterion("staff_id not between", value1, value2, "staffId");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsIsNull() {
+            addCriterion("video_ids is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsIsNotNull() {
+            addCriterion("video_ids is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsEqualTo(String value) {
+            addCriterion("video_ids =", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsNotEqualTo(String value) {
+            addCriterion("video_ids <>", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsGreaterThan(String value) {
+            addCriterion("video_ids >", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsGreaterThanOrEqualTo(String value) {
+            addCriterion("video_ids >=", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsLessThan(String value) {
+            addCriterion("video_ids <", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsLessThanOrEqualTo(String value) {
+            addCriterion("video_ids <=", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsLike(String value) {
+            addCriterion("video_ids like", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsNotLike(String value) {
+            addCriterion("video_ids not like", value, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsIn(List<String> values) {
+            addCriterion("video_ids in", values, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsNotIn(List<String> values) {
+            addCriterion("video_ids not in", values, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsBetween(String value1, String value2) {
+            addCriterion("video_ids between", value1, value2, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andVideoIdsNotBetween(String value1, String value2) {
+            addCriterion("video_ids not between", value1, value2, "videoIds");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNull() {
+            addCriterion("is_delete is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIsNotNull() {
+            addCriterion("is_delete is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteEqualTo(Integer value) {
+            addCriterion("is_delete =", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotEqualTo(Integer value) {
+            addCriterion("is_delete <>", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThan(Integer value) {
+            addCriterion("is_delete >", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) {
+            addCriterion("is_delete >=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThan(Integer value) {
+            addCriterion("is_delete <", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteLessThanOrEqualTo(Integer value) {
+            addCriterion("is_delete <=", value, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteIn(List<Integer> values) {
+            addCriterion("is_delete in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotIn(List<Integer> values) {
+            addCriterion("is_delete not in", values, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) {
+            addCriterion("is_delete not between", value1, value2, "isDelete");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNull() {
+            addCriterion("create_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIsNotNull() {
+            addCriterion("create_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeEqualTo(Date value) {
+            addCriterion("create_time =", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotEqualTo(Date value) {
+            addCriterion("create_time <>", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThan(Date value) {
+            addCriterion("create_time >", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("create_time >=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThan(Date value) {
+            addCriterion("create_time <", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("create_time <=", value, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeIn(List<Date> values) {
+            addCriterion("create_time in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotIn(List<Date> values) {
+            addCriterion("create_time not in", values, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeBetween(Date value1, Date value2) {
+            addCriterion("create_time between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andCreateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("create_time not between", value1, value2, "createTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNull() {
+            addCriterion("update_time is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIsNotNull() {
+            addCriterion("update_time is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeEqualTo(Date value) {
+            addCriterion("update_time =", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotEqualTo(Date value) {
+            addCriterion("update_time <>", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThan(Date value) {
+            addCriterion("update_time >", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
+            addCriterion("update_time >=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThan(Date value) {
+            addCriterion("update_time <", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
+            addCriterion("update_time <=", value, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeIn(List<Date> values) {
+            addCriterion("update_time in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotIn(List<Date> values) {
+            addCriterion("update_time not in", values, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeBetween(Date value1, Date value2) {
+            addCriterion("update_time between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+
+        public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
+            addCriterion("update_time not between", value1, value2, "updateTime");
+            return (Criteria) this;
+        }
+    }
+
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 0 - 11
we-com-server/src/main/java/com/tzld/piaoquan/wecom/model/vo/MessageTextParam.java

@@ -1,11 +0,0 @@
-package com.tzld.piaoquan.wecom.model.vo;
-
-import lombok.Data;
-
-@Data
-public class MessageTextParam {
-
-    private String text;
-
-    private Integer hour;
-}

+ 1 - 3
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/AccessTokenServiceImpl.java

@@ -6,7 +6,6 @@ import com.tzld.piaoquan.wecom.dao.mapper.CorpMapper;
 import com.tzld.piaoquan.wecom.model.po.Corp;
 import com.tzld.piaoquan.wecom.model.po.CorpExample;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
-import com.tzld.piaoquan.wecom.utils.HttpClientUtil;
 import com.tzld.piaoquan.wecom.utils.LarkRobotUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -19,9 +18,8 @@ import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
-import static com.tzld.piaoquan.wecom.common.constant.RedisConstant.ACCESS_TOKEN;
 import static com.tzld.piaoquan.wecom.common.constant.RedisConstant.WE_COM_ACCESS_TOKEN;
-import static com.tzld.piaoquan.wecom.common.constant.WeComConstant.*;
+import static com.tzld.piaoquan.wecom.common.constant.WeComConstant.GET_WE_COM_ACCESS_TOKEN_URL;
 
 @Slf4j
 @Service

+ 37 - 10
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageAttachmentServiceImpl.java

@@ -2,17 +2,15 @@ package com.tzld.piaoquan.wecom.service.Impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.databind.util.BeanUtil;
 import com.tzld.piaoquan.wecom.common.base.CommonResponse;
 import com.tzld.piaoquan.wecom.common.enums.MessageAttachmentTypeEnum;
 import com.tzld.piaoquan.wecom.component.HttpPoolClient;
+import com.tzld.piaoquan.wecom.dao.mapper.GuaranteesVideoMapper;
 import com.tzld.piaoquan.wecom.dao.mapper.MessageAttachmentMapper;
 import com.tzld.piaoquan.wecom.model.bo.AdPutFlowParam;
 import com.tzld.piaoquan.wecom.model.bo.VideoDetail;
 import com.tzld.piaoquan.wecom.model.bo.VideoParam;
-import com.tzld.piaoquan.wecom.model.po.MessageAttachment;
-import com.tzld.piaoquan.wecom.model.po.MessageAttachmentExample;
-import com.tzld.piaoquan.wecom.model.po.Staff;
+import com.tzld.piaoquan.wecom.model.po.*;
 import com.tzld.piaoquan.wecom.model.vo.GuaranteedParam;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.service.MessageAttachmentService;
@@ -41,7 +39,6 @@ import static com.tzld.piaoquan.wecom.common.constant.MessageConstant.MAX_VIDEO_
 import static com.tzld.piaoquan.wecom.common.constant.MessageConstant.appid;
 import static com.tzld.piaoquan.wecom.common.constant.OtherServerURL.POST_ADD_TENCENT;
 import static com.tzld.piaoquan.wecom.common.constant.OtherServerURL.POST_VIDEO_DETAIL_URL;
-import static com.tzld.piaoquan.wecom.common.constant.RedisConstant.GUARANTEED_MINI_PROGRAM_KEY;
 import static com.tzld.piaoquan.wecom.common.constant.TimeConstant.MILLISECOND_DAY;
 import static com.tzld.piaoquan.wecom.common.constant.WeComConstant.POST_WE_COM_MEDIA_UPLOAD;
 
@@ -62,6 +59,9 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
     @Autowired
     private RedisTemplate<String, Object> redisTemplate;
 
+    @Autowired
+    private GuaranteesVideoMapper guaranteesVideoMapper;
+
     @Override
     public void addMiniProgram(List<MessageAttachment> messageAttachmentList, Long createTime) {
         for (MessageAttachment messageAttachment : messageAttachmentList) {
@@ -106,8 +106,8 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
                 MessageAttachment messageAttachment = messageAttachmentList.get(0);
                 if (messageAttachment.getSendTime() != null
                         && DateUtil.dateDifference(new Date(), messageAttachment.getSendTime()) < 90 * MILLISECOND_DAY) {
-                    LarkRobotUtil.sendMessage("保底视频半年内已发送,请查看videoId=" + videoId);
-                    return CommonResponse.create(500, "保底视频半年内已发送,请查看videoId=" + videoId);
+//                    LarkRobotUtil.sendMessage("保底视频半年内已发送,请查看videoId=" + videoId);
+//                    return CommonResponse.create(500, "保底视频半年内已发送,请查看videoId=" + videoId);
                 }
             }
             videoIds.addAll(videoParam.getVideoIds());
@@ -146,12 +146,39 @@ public class MessageAttachmentServiceImpl implements MessageAttachmentService {
             }
         }
         addMiniProgram(messageAttachmentList, null);
-        String date = guaranteedParam.getDate();
-        String key = String.format(GUARANTEED_MINI_PROGRAM_KEY, date);
-        redisTemplate.opsForValue().set(key, guaranteedParam, 14, TimeUnit.DAYS);
+        for (VideoParam videoParam : guaranteedParam.getVideoParamList()) {
+            GuaranteesVideo guaranteesVideo = new GuaranteesVideo();
+            guaranteesVideo.setDate(guaranteedParam.getDate());
+            guaranteesVideo.setStaffId(videoParam.getStaffId());
+            guaranteesVideo.setVideoIds(JSONObject.toJSONString(videoParam.getVideoIds()));
+            guaranteesVideoMapper.insertSelective(guaranteesVideo);
+        }
         return CommonResponse.success();
     }
 
+    @Override
+    public GuaranteedParam getGuaranteedVideo(String date) {
+        GuaranteesVideoExample example = new GuaranteesVideoExample();
+        example.createCriteria().andDateEqualTo(date);
+        List<GuaranteesVideo> guaranteesVideos = guaranteesVideoMapper.selectByExample(example);
+        if (CollectionUtils.isEmpty(guaranteesVideos)) {
+            LarkRobotUtil.sendMessage("获保底视频空,@薛一鸣");
+            return null;
+        }
+        GuaranteedParam guaranteedParam = new GuaranteedParam();
+        guaranteedParam.setDate(date);
+        List<VideoParam> videoParams = new ArrayList<>();
+        for (GuaranteesVideo guaranteesVideo : guaranteesVideos) {
+            VideoParam videoParam = new VideoParam();
+            videoParam.setStaffId(guaranteesVideo.getStaffId());
+            List<Long> videoIds = JSONArray.parseArray(guaranteesVideo.getVideoIds(), Long.class);
+            videoParam.setVideoIds(videoIds);
+            videoParams.add(videoParam);
+        }
+        guaranteedParam.setVideoParamList(videoParams);
+        return guaranteedParam;
+    }
+
     public Map<Long, VideoDetail> getVideoDetail(Set<Long> videoIdList) {
         try {
             Map<Long, VideoDetail> map = new HashMap<>();

+ 0 - 22
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/Impl/MessageServiceImpl.java

@@ -2,26 +2,18 @@ package com.tzld.piaoquan.wecom.service.Impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.piaoquan.wecom.common.constant.MessageConstant;
-import com.tzld.piaoquan.wecom.common.exception.CustomizeException;
 import com.tzld.piaoquan.wecom.component.HttpPoolClient;
-import com.tzld.piaoquan.wecom.model.vo.MessageTextParam;
 import com.tzld.piaoquan.wecom.service.AccessTokenService;
 import com.tzld.piaoquan.wecom.service.MessageService;
 import com.tzld.piaoquan.wecom.utils.DateUtil;
-import com.tzld.piaoquan.wecom.utils.HttpClientUtil;
 import com.tzld.piaoquan.wecom.utils.LarkRobotUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
 import java.io.IOException;
-import java.util.concurrent.TimeUnit;
 
-import static com.tzld.piaoquan.wecom.common.constant.RedisConstant.PUSH_MESSAGE_TEXT;
 import static com.tzld.piaoquan.wecom.common.constant.WeComConstant.POST_WE_COM_ADD_MSG_TEMPLATE;
-import static com.tzld.piaoquan.wecom.common.enums.ExceptionCodeEnum.PARAMS_ERROR;
 
 
 @Slf4j
@@ -34,9 +26,6 @@ public class MessageServiceImpl implements MessageService {
     @Autowired
     private AccessTokenService accessTokenService;
 
-    @Autowired
-    private RedisTemplate<String, Object> redisTemplate;
-
     @Override
     public boolean pushWeComMessage(JSONObject jsonObject, Long corpId) {
         try {
@@ -58,17 +47,6 @@ public class MessageServiceImpl implements MessageService {
         return false;
     }
 
-    @Override
-    public void createMessageText(MessageTextParam messageTextParam) {
-        if (messageTextParam == null || messageTextParam.getHour() == null) {
-            throw new CustomizeException(PARAMS_ERROR);
-        }
-        if (messageTextParam.getHour() == -1) {
-            redisTemplate.opsForValue().set(PUSH_MESSAGE_TEXT, messageTextParam.getText());
-        } else {
-            redisTemplate.opsForValue().set(PUSH_MESSAGE_TEXT, messageTextParam.getText(), messageTextParam.getHour(), TimeUnit.HOURS);
-        }
-    }
 
 
 

+ 2 - 0
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageAttachmentService.java

@@ -13,6 +13,8 @@ public interface MessageAttachmentService {
 
     CommonResponse<Void> createGuaranteedMiniProgram(GuaranteedParam guaranteedParam);
 
+    GuaranteedParam getGuaranteedVideo(String date);
+
     String getPicMediaId(String cover, Long corpId);
 
     String getPage(Staff staff, Long videoId);

+ 0 - 3
we-com-server/src/main/java/com/tzld/piaoquan/wecom/service/MessageService.java

@@ -1,13 +1,10 @@
 package com.tzld.piaoquan.wecom.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.tzld.piaoquan.wecom.model.vo.MessageTextParam;
 
 public interface MessageService {
 
     boolean pushWeComMessage(JSONObject jsonObject, Long corpId);
 
-    void createMessageText(MessageTextParam messageTextParam);
-
     String getMessageText();
 }

+ 1 - 1
we-com-server/src/main/resources/application-test.properties

@@ -2,7 +2,7 @@ server.port=8080
 
 spring.datasource.username=crawler
 spring.datasource.password=crawler123456@
-spring.datasource.url=jdbc:mysql://rm-bp1k5853td1r25g3n690.mysql.rds.aliyuncs.com:3306/piaoquan-crawler?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true
+spring.datasource.url=jdbc:mysql://rm-bp17q95335a99272b.mysql.rds.aliyuncs.com:3306/growth?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowMultiQueries=true
 
 spring.redis.host=r-bp1m4nvh130sfjjc6fpd.redis.rds.aliyuncs.com
 spring.redis.port=6379

+ 1 - 1
we-com-server/src/main/resources/mybatis-generator-config.xml

@@ -52,7 +52,7 @@
 
 <!--        <table tableName="we_com_alert_message" domainObjectName="AlertMessage" alias=""/>-->
 <!--        <table tableName="we_com_history_message" domainObjectName="HistoryMessage" alias=""/>-->
-        <table tableName="we_com_message_attachment" domainObjectName="MessageAttachment" alias=""/>
+        <table tableName="we_com_guarantees_video" domainObjectName="GuaranteesVideo" alias=""/>
 <!--        <table tableName="we_com_staff" domainObjectName="Staff" alias=""/>-->
 <!--        <table tableName="we_com_staff_with_user" domainObjectName="StaffWithUser" alias=""/>-->
 <!--        <table tableName="we_com_send_message" domainObjectName="SendMessage" alias=""/>-->