Commit 1f99a4e7789c477291ac7f80c44c676280e932e5
1 parent
0dbfeca993
Exists in
dev
#fix 优化服务推送逻辑,修改14天推送为15天
Showing 5 changed files with 20 additions and 19 deletions
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
- talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java
talkonlineweb/src/main/java/com/lyms/talkonlineweb/controller/UserContoller.java
View file @
1f99a4e
| ... | ... | @@ -10,6 +10,7 @@ |
| 10 | 10 | import com.lyms.talkonlineweb.service.LymsUserService; |
| 11 | 11 | import com.lyms.talkonlineweb.service.LymsUserroleService; |
| 12 | 12 | import com.lyms.talkonlineweb.service.UserroleInfoService; |
| 13 | +import com.lyms.talkonlineweb.task.ServiceContentTask; | |
| 13 | 14 | import com.lyms.talkonlineweb.util.Constant; |
| 14 | 15 | import com.lyms.talkonlineweb.util.HXService; |
| 15 | 16 | import com.lyms.talkonlineweb.util.JwtUtils; |
| ... | ... | @@ -335,10 +336,6 @@ |
| 335 | 336 | e.printStackTrace(); |
| 336 | 337 | } |
| 337 | 338 | return baseResponse; |
| 338 | - } | |
| 339 | - | |
| 340 | - public static void main(String[] args) { | |
| 341 | - System.out.println(DigestUtils.md5DigestAsHex("passwd".getBytes()));; | |
| 342 | 339 | } |
| 343 | 340 | |
| 344 | 341 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPushMessage.java
View file @
1f99a4e
talkonlineweb/src/main/java/com/lyms/talkonlineweb/result/PushOrderResult.java
View file @
1f99a4e
| 1 | 1 | package com.lyms.talkonlineweb.result; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 3 | 4 | import lombok.Data; |
| 4 | 5 | |
| 5 | 6 | import java.util.Date; |
| ... | ... | @@ -13,7 +14,8 @@ |
| 13 | 14 | private String hname; |
| 14 | 15 | private String pname; |
| 15 | 16 | private String idno; |
| 16 | - private Date service_start_time; | |
| 17 | + @TableField(value = "service_start_time") | |
| 18 | + private Date serviceStartTime; | |
| 17 | 19 | private String iname; |
| 18 | 20 | private Integer cid; |
| 19 | 21 | } |
talkonlineweb/src/main/java/com/lyms/talkonlineweb/service/impl/LymsHisInfoServiceImpl.java
View file @
1f99a4e
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/ServiceContentTask.java
View file @
1f99a4e
| ... | ... | @@ -27,14 +27,14 @@ |
| 27 | 27 | private final LymsPushMessageService lymsPushMessageService; |
| 28 | 28 | /** |
| 29 | 29 | * 定时推送 |
| 30 | - * 公众号提醒(开通服务后第7天、开通服务后第14天) | |
| 30 | + * 公众号提醒(开通服务后第7天、开通服务后第15天、21、28) | |
| 31 | 31 | */ |
| 32 | 32 | @Scheduled(cron = "0 0 9 * * ?") |
| 33 | 33 | public void serviceContent(){ |
| 34 | 34 | log.info("serviceContent startup"); |
| 35 | 35 | Date day=new Date(); |
| 36 | 36 | String seven= DateUtils.format(DateUtils.addDateDays(day,-7)); |
| 37 | - String fourteen= DateUtils.format(DateUtils.addDateDays(day,-14)); | |
| 37 | + String fourteen= DateUtils.format(DateUtils.addDateDays(day,-15)); | |
| 38 | 38 | String twenty=DateUtils.format(DateUtils.addDateDays(day,-21)); |
| 39 | 39 | String twentyEight=DateUtils.format(DateUtils.addDateDays(day,-28)); |
| 40 | 40 | String startStr=" 00:00:00"; |
| ... | ... | @@ -47,7 +47,7 @@ |
| 47 | 47 | if (CollectionUtils.isNotEmpty(orderList)){ |
| 48 | 48 | String fourteenTime=fourteen+endStr; |
| 49 | 49 | String twentyOneTime=twenty+endStr; |
| 50 | - String sevenTime=seven+endStr; | |
| 50 | + String twentyEightTime=twentyEight+endStr; | |
| 51 | 51 | List<LymsPushMessage> list=new ArrayList<>(); |
| 52 | 52 | orderList.stream().forEach(order -> { |
| 53 | 53 | LymsPushMessage lymsPushMessage=new LymsPushMessage(); |
| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | lymsPushMessage.setTitle("通知:您有一条服务内容推送消息,请点击此处及时查看。"); |
| 62 | 62 | lymsPushMessage.setName(order.getPname()); |
| 63 | 63 | lymsPushMessage.setPushTime(new Date()); |
| 64 | - lymsPushMessage.setType(checkTime(fourteenTime,twentyOneTime,sevenTime,order.getService_start_time())); | |
| 64 | + lymsPushMessage.setType(checkTime(fourteenTime,twentyOneTime,twentyEightTime,order.getServiceStartTime())); | |
| 65 | 65 | //推送微信公众号 |
| 66 | 66 | Map<String,Object> map=new HashMap<>(); |
| 67 | 67 | map.put("keyword1",new DataEntity(order.getPname(),"#173177")); |
| ... | ... | @@ -76,6 +76,7 @@ |
| 76 | 76 | log.info("SendWeChatMsg--->code, "+code); |
| 77 | 77 | if (null == code || code != 0) { |
| 78 | 78 | lymsPushMessage.setStatus(0); |
| 79 | + lymsPushMessage.setRemark(String.valueOf(code)); | |
| 79 | 80 | }else { |
| 80 | 81 | lymsPushMessage.setStatus(1); |
| 81 | 82 | } |
| 82 | 83 | |
| 83 | 84 | |
| 84 | 85 | |
| ... | ... | @@ -89,21 +90,21 @@ |
| 89 | 90 | log.info("serviceContent end"); |
| 90 | 91 | } |
| 91 | 92 | |
| 92 | - private int checkTime(String fourteenTime,String twentyTime,String sevenTime,Date date){ | |
| 93 | + private int checkTime(String fourteenTime,String twentyTime,String twentyEightTime,Date date){ | |
| 93 | 94 | Date fourteen= DateUtils.parse(fourteenTime,DateUtil.YYYY_MM_DD_HH_MM_SS); |
| 94 | 95 | Date twenty= DateUtils.parse(twentyTime,DateUtil.YYYY_MM_DD_HH_MM_SS); |
| 95 | - Date seven= DateUtils.parse(sevenTime,DateUtil.YYYY_MM_DD_HH_MM_SS); | |
| 96 | - //0:上传推送 1:7日推送 2:14日推送 3:21日 4:28 | |
| 97 | - if (seven.compareTo(date)>=0){ | |
| 98 | - return 1; | |
| 96 | + Date twentyEight= DateUtils.parse(twentyEightTime,DateUtil.YYYY_MM_DD_HH_MM_SS); | |
| 97 | + //0:上传推送 1:7日推送 2:15日推送 3:21日 4:28 | |
| 98 | + if (twentyEight.compareTo(date)>=0){ | |
| 99 | + return 4; | |
| 99 | 100 | } |
| 100 | - if (fourteen.compareTo(date)>=0){ | |
| 101 | - return 2; | |
| 102 | - } | |
| 103 | 101 | if (twenty.compareTo(date)>=0){ |
| 104 | 102 | return 3; |
| 105 | 103 | } |
| 106 | - return 4; | |
| 104 | + if (fourteen.compareTo(date)>=0){ | |
| 105 | + return 2; | |
| 106 | + } | |
| 107 | + return 1; | |
| 107 | 108 | } |
| 108 | 109 | } |