diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java index 872340f..19925e5 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java @@ -66,7 +66,7 @@ public class LymsPushMessage implements Serializable { @TableField(value = "cid") private int cid; /** - * 类型 0:上传推送 1:7日推送 2:14日推送 + * 类型 0:上传推送 1:7日推送 2:14日推送 3:21日 4:28 */ @TableField(value = "type") private int type; diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsOrderMapper.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsOrderMapper.java index 0e97e41..7fd8420 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsOrderMapper.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/mapper/LymsOrderMapper.java @@ -27,7 +27,9 @@ public interface LymsOrderMapper extends BaseMapper { List selectPushOrder(@Param("pId") Integer pid); - List selectOrderTaskList(@Param("sevenStart")String sevenStart, @Param("sevenEnd")String sevenEnd, @Param("fourteenStart")String fourteenStart, @Param("fourteenEnd")String fourteenEnd); + List selectOrderTaskList(@Param("sevenStart")String sevenStart, @Param("sevenEnd")String sevenEnd, + @Param("fourteenStart")String fourteenStart, @Param("fourteenEnd")String fourteenEnd, + @Param("twentyStart")String twentyStart, @Param("twentyEnd")String twentyEnd,@Param("twentyEightStart")String twentyEightStart, @Param("twentyEightEnd")String twentyEightEnd ); } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java index 22b2790..a4c2bdc 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/LymsOrderService.java @@ -25,7 +25,8 @@ public interface LymsOrderService extends IService { List queryOrderList(OrderRequest orderRequest); - List selectOrderTaskList(String sevenStart, String sevenEnd, String fourteenStart, String fourteenEnd); + List selectOrderTaskList(String sevenStart, String sevenEnd, + String fourteenStart, String fourteenEnd,String twentyStart, String twentyEnd, String twentyEightStart, String twentyEightEnd); List selectPushOrder(Integer pId); diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java index 2ac233c..7c96b8e 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsOrderServiceImpl.java @@ -118,8 +118,9 @@ public class LymsOrderServiceImpl extends ServiceImpl selectOrderTaskList(String sevenStart, String sevenEnd, String fourteenStart, String fourteenEnd) { - return lymsOrderMapper.selectOrderTaskList( sevenStart, sevenEnd, fourteenStart, fourteenEnd); + public List selectOrderTaskList(String sevenStart, String sevenEnd, String fourteenStart, String fourteenEnd, + String twentyStart, String twentyEnd, String twentyEightStart, String twentyEightEnd) { + return lymsOrderMapper.selectOrderTaskList( sevenStart, sevenEnd, fourteenStart, fourteenEnd, twentyStart, twentyEnd, twentyEightStart, twentyEightEnd); } @Override diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java index 8795ddb..0e0eac7 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java @@ -1,6 +1,5 @@ package com.lyms.talkonlineweb.task; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.lyms.oss.utils.DateUtils; import com.lyms.talkonlineweb.domain.*; import com.lyms.talkonlineweb.param.DataEntity; @@ -8,13 +7,11 @@ import com.lyms.talkonlineweb.result.PushOrderResult; import com.lyms.talkonlineweb.service.*; import com.lyms.talkonlineweb.util.Constant; import com.lyms.talkonlineweb.util.DateUtil; -import com.lyms.talkonlineweb.util.StringUtil; import com.lyms.talkonlineweb.util.WeiXinUtil; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.ParameterResolutionDelegate; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -38,12 +35,19 @@ public class ServiceContentTask { Date day=new Date(); String seven= DateUtils.format(DateUtils.addDateDays(day,-7)); String fourteen= DateUtils.format(DateUtils.addDateDays(day,-14)); + String twenty=DateUtils.format(DateUtils.addDateDays(day,-21)); + String twentyEight=DateUtils.format(DateUtils.addDateDays(day,-28)); String startStr=" 00:00:00"; String endStr=" 23:59:59"; List orderList= lymsOrderService.selectOrderTaskList( - seven+startStr,seven+endStr,fourteen+startStr,fourteen+endStr); + seven+startStr,seven+endStr, + fourteen+startStr,fourteen+endStr, + twenty+startStr,twenty+endStr, + twentyEight+startStr,twentyEight+endStr); if (CollectionUtils.isNotEmpty(orderList)){ String fourteenTime=fourteen+endStr; + String twentyOneTime=twenty+endStr; + String sevenTime=seven+endStr; List list=new ArrayList<>(); orderList.stream().forEach(order -> { LymsPushMessage lymsPushMessage=new LymsPushMessage(); @@ -57,7 +61,7 @@ public class ServiceContentTask { lymsPushMessage.setTitle("通知:您有一条服务内容推送消息,请点击此处及时查看。"); lymsPushMessage.setName(order.getPname()); lymsPushMessage.setPushTime(new Date()); - lymsPushMessage.setType(checkTime(fourteenTime,order.getService_start_time())); + lymsPushMessage.setType(checkTime(fourteenTime,twentyOneTime,sevenTime,order.getService_start_time())); //推送微信公众号 Map map=new HashMap<>(); map.put("keyword1",new DataEntity(order.getPname(),"#173177")); @@ -85,11 +89,20 @@ public class ServiceContentTask { log.info("serviceContent end"); } - private int checkTime(String time,Date date){ - Date endTime= DateUtils.parse(time,DateUtil.YYYY_MM_DD_HH_MM_SS); - if (endTime.compareTo(date)<0){ + private int checkTime(String fourteenTime,String twentyTime,String sevenTime,Date date){ + Date fourteen= DateUtils.parse(fourteenTime,DateUtil.YYYY_MM_DD_HH_MM_SS); + Date twenty= DateUtils.parse(twentyTime,DateUtil.YYYY_MM_DD_HH_MM_SS); + Date seven= DateUtils.parse(sevenTime,DateUtil.YYYY_MM_DD_HH_MM_SS); + //0:上传推送 1:7日推送 2:14日推送 3:21日 4:28 + if (seven.compareTo(date)>=0){ return 1; - } - return 2; + } + if (fourteen.compareTo(date)>=0){ + return 2; + } + if (twenty.compareTo(date)>=0){ + return 3; + } + return 4; } } diff --git a/talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml b/talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml index bdcfafb..203f263 100644 --- a/talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml +++ b/talkonlineweb/src/main/resources/mapper/LymsOrderMapper.xml @@ -83,7 +83,12 @@ = #{sevenStart} AND o.service_start_time <= #{sevenEnd}) or (o.service_start_time >= #{fourteenStart} - AND o.service_start_time <= #{fourteenEnd}))]]> + AND o.service_start_time <= #{fourteenEnd}) + or (o.service_start_time >= #{twentyStart} + AND o.service_start_time <= #{twentyEnd}) + or (o.service_start_time >= #{twentyEightStart} + AND o.service_start_time <= #{twentyEightEnd}) + )]]> and `status`=1