From 1f99a4e7789c477291ac7f80c44c676280e932e5 Mon Sep 17 00:00:00 2001 From: zhangchao Date: Tue, 23 Jan 2024 17:26:10 +0800 Subject: [PATCH] =?UTF-8?q?#fix=20=E4=BC=98=E5=8C=96=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=8E=A8=E9=80=81=E9=80=BB=E8=BE=91=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?14=E5=A4=A9=E6=8E=A8=E9=80=81=E4=B8=BA15=E5=A4=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../talkonlineweb/controller/UserContoller.java | 5 +--- .../lyms/talkonlineweb/domain/LymsPushMessage.java | 2 +- .../lyms/talkonlineweb/result/PushOrderResult.java | 4 +++- .../service/impl/LymsHisInfoServiceImpl.java | 1 + .../talkonlineweb/task/ServiceContentTask.java | 27 +++++++++++----------- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java index 085b20d..c77dab5 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java @@ -10,6 +10,7 @@ import com.lyms.talkonlineweb.result.BaseResponse; import com.lyms.talkonlineweb.service.LymsUserService; import com.lyms.talkonlineweb.service.LymsUserroleService; import com.lyms.talkonlineweb.service.UserroleInfoService; +import com.lyms.talkonlineweb.task.ServiceContentTask; import com.lyms.talkonlineweb.util.Constant; import com.lyms.talkonlineweb.util.HXService; import com.lyms.talkonlineweb.util.JwtUtils; @@ -337,8 +338,4 @@ public class UserContoller { return baseResponse; } - public static void main(String[] args) { - System.out.println(DigestUtils.md5DigestAsHex("passwd".getBytes()));; - } - } 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 19925e5..0054d32 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日推送 3:21日 4:28 + * 类型 0:上传推送 1:7日推送 2:15日推送 3:21日 4:28 */ @TableField(value = "type") private int type; diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java index eaf9d05..e3d0618 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java @@ -1,5 +1,6 @@ package com.lyms.talkonlineweb.result; +import com.baomidou.mybatisplus.annotation.TableField; import lombok.Data; import java.util.Date; @@ -13,7 +14,8 @@ public class PushOrderResult { private String hname; private String pname; private String idno; - private Date service_start_time; + @TableField(value = "service_start_time") + private Date serviceStartTime; private String iname; private Integer cid; } diff --git a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java index cb2734a..f6f1f14 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java @@ -136,6 +136,7 @@ public class LymsHisInfoServiceImpl extends ServiceImplcode, "+code); if (null == code || code != 0) { lymsPushMessage.setStatus(0); + lymsPushMessage.setRemark(String.valueOf(code)); }else { lymsPushMessage.setStatus(1); } 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 0e0eac7..96a11e4 100644 --- a/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java +++ b/talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java @@ -27,14 +27,14 @@ public class ServiceContentTask { private final LymsPushMessageService lymsPushMessageService; /** * 定时推送 - * 公众号提醒(开通服务后第7天、开通服务后第14天) + * 公众号提醒(开通服务后第7天、开通服务后第15天、21、28) */ @Scheduled(cron = "0 0 9 * * ?") public void serviceContent(){ log.info("serviceContent startup"); Date day=new Date(); String seven= DateUtils.format(DateUtils.addDateDays(day,-7)); - String fourteen= DateUtils.format(DateUtils.addDateDays(day,-14)); + String fourteen= DateUtils.format(DateUtils.addDateDays(day,-15)); String twenty=DateUtils.format(DateUtils.addDateDays(day,-21)); String twentyEight=DateUtils.format(DateUtils.addDateDays(day,-28)); String startStr=" 00:00:00"; @@ -47,7 +47,7 @@ public class ServiceContentTask { if (CollectionUtils.isNotEmpty(orderList)){ String fourteenTime=fourteen+endStr; String twentyOneTime=twenty+endStr; - String sevenTime=seven+endStr; + String twentyEightTime=twentyEight+endStr; List list=new ArrayList<>(); orderList.stream().forEach(order -> { LymsPushMessage lymsPushMessage=new LymsPushMessage(); @@ -61,7 +61,7 @@ public class ServiceContentTask { lymsPushMessage.setTitle("通知:您有一条服务内容推送消息,请点击此处及时查看。"); lymsPushMessage.setName(order.getPname()); lymsPushMessage.setPushTime(new Date()); - lymsPushMessage.setType(checkTime(fourteenTime,twentyOneTime,sevenTime,order.getService_start_time())); + lymsPushMessage.setType(checkTime(fourteenTime,twentyOneTime,twentyEightTime,order.getServiceStartTime())); //推送微信公众号 Map map=new HashMap<>(); map.put("keyword1",new DataEntity(order.getPname(),"#173177")); @@ -76,6 +76,7 @@ public class ServiceContentTask { log.info("SendWeChatMsg--->code, "+code); if (null == code || code != 0) { lymsPushMessage.setStatus(0); + lymsPushMessage.setRemark(String.valueOf(code)); }else { lymsPushMessage.setStatus(1); } @@ -89,20 +90,20 @@ public class ServiceContentTask { log.info("serviceContent end"); } - private int checkTime(String fourteenTime,String twentyTime,String sevenTime,Date date){ + private int checkTime(String fourteenTime,String twentyTime,String twentyEightTime,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; - } - if (fourteen.compareTo(date)>=0){ - return 2; + Date twentyEight= DateUtils.parse(twentyEightTime,DateUtil.YYYY_MM_DD_HH_MM_SS); + //0:上传推送 1:7日推送 2:15日推送 3:21日 4:28 + if (twentyEight.compareTo(date)>=0){ + return 4; } if (twenty.compareTo(date)>=0){ return 3; } - return 4; + if (fourteen.compareTo(date)>=0){ + return 2; + } + return 1; } } -- 1.8.3.1