Commit f9a9280e authored by shiyu's avatar shiyu

晚上七点发送短信沉香专场

parent d14e02e3
...@@ -97,4 +97,9 @@ public class SpecialPerformanceRequestDto extends BaseRequestDto implements Enti ...@@ -97,4 +97,9 @@ public class SpecialPerformanceRequestDto extends BaseRequestDto implements Enti
* 分享记录id * 分享记录id
*/ */
private String shareRecordId; private String shareRecordId;
/**
* 短信点击进入的标识
*/
private String smsFlag;
} }
...@@ -276,6 +276,9 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService ...@@ -276,6 +276,9 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
@Override @Override
public Result findItemList(SpecialPerformanceRequestDto dto) { public Result findItemList(SpecialPerformanceRequestDto dto) {
try { try {
if (StringUtils.hasLength(dto.getSmsFlag())) {
logger.info("用户id:{} 通过短信进入专场:{}", dto.getUserId(), dto.getSpecialPerformanceId());
}
String shareRecordId = dto.getShareRecordId(); String shareRecordId = dto.getShareRecordId();
DistributorShareRecord distributorShareRecord = null; DistributorShareRecord distributorShareRecord = null;
long introducerId = CommConsts.SYSTEM_ACCOUNT; long introducerId = CommConsts.SYSTEM_ACCOUNT;
......
...@@ -1153,8 +1153,10 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -1153,8 +1153,10 @@ public class SupplierItemServiceImpl implements SupplierItemService {
searchDto.setLimit(dto.getLimit()); searchDto.setLimit(dto.getLimit());
String viewKey = userId + ":homepage"; String viewKey = userId + ":homepage";
if (dto.getPage() == 1) { if (dto.getPage() == 1) {
if (redisUtils.hasKey(viewKey)) {
redisUtils.delete(viewKey); redisUtils.delete(viewKey);
} }
}
if (redisUtils.hasKey(viewKey)) { if (redisUtils.hasKey(viewKey)) {
List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey); List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey);
searchDto.setFilterIds(searchItemIds); searchDto.setFilterIds(searchItemIds);
...@@ -1165,9 +1167,9 @@ public class SupplierItemServiceImpl implements SupplierItemService { ...@@ -1165,9 +1167,9 @@ public class SupplierItemServiceImpl implements SupplierItemService {
if (redisUtils.hasKey(viewKey)) { if (redisUtils.hasKey(viewKey)) {
List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey); List<Long> searchItemIds = (List<Long>) redisUtils.get(viewKey);
searchItemIds.addAll(filterItemIds); searchItemIds.addAll(filterItemIds);
redisUtils.set(viewKey, searchItemIds); redisUtils.set(viewKey, searchItemIds, 60 * 60 * 2);
} else { } else {
redisUtils.set(viewKey, filterItemIds); redisUtils.set(viewKey, filterItemIds, 60 * 60 * 2);
} }
Date now = new Date(); Date now = new Date();
supplierItemList.forEach(supplierItem -> { supplierItemList.forEach(supplierItem -> {
......
...@@ -46,8 +46,8 @@ public class SendMsgFromExcelJob { ...@@ -46,8 +46,8 @@ public class SendMsgFromExcelJob {
@Value("${spring.profiles.active}") @Value("${spring.profiles.active}")
private String env; private String env;
// 每年8月8日晚上8点执行一次 // 每年8月12日晚上19点执行一次
// @Scheduled(cron = "0 0 20 8 8 ?") @Scheduled(cron = "0 0 19 12 8 ?")
public void executeTask() { public void executeTask() {
if ("dev".equals(env)) { if ("dev".equals(env)) {
logger.info(">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行给指定类目用户发送通知任务<<<<<<<<<<<<<<<<<<<<<"); logger.info(">>>>>>>>>>>>>>>>>>>>>>> dev环境, 不执行给指定类目用户发送通知任务<<<<<<<<<<<<<<<<<<<<<");
...@@ -60,7 +60,7 @@ public class SendMsgFromExcelJob { ...@@ -60,7 +60,7 @@ public class SendMsgFromExcelJob {
} }
logger.info(">>>>>>>>>>>> sendMsgFromExcel 开始执行 <<<<<<<<<<<<"); logger.info(">>>>>>>>>>>> sendMsgFromExcel 开始执行 <<<<<<<<<<<<");
try { try {
String key = "xmly:sendMsgFromExcel:0808"; String key = "cx:sendMsgFromExcel:0812";
Date now = new Date(); Date now = new Date();
if (redisUtils.hasKey(key)) { if (redisUtils.hasKey(key)) {
String msg = "给指定类目用户发送通知任务正在重复执行"; String msg = "给指定类目用户发送通知任务正在重复执行";
...@@ -68,7 +68,7 @@ public class SendMsgFromExcelJob { ...@@ -68,7 +68,7 @@ public class SendMsgFromExcelJob {
logger.info(">>>>>>>>>>>> sendMsgFromExcel 已经执行过了 <<<<<<<<<<<<"); logger.info(">>>>>>>>>>>> sendMsgFromExcel 已经执行过了 <<<<<<<<<<<<");
return; return;
} }
String fileName = "喜马拉雅品类用户手机号.xlsx"; String fileName = "沉香短信表.xlsx";
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileName); InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(fileName);
StringArrayExcelReadListener listener = new StringArrayExcelReadListener(); StringArrayExcelReadListener listener = new StringArrayExcelReadListener();
ExcelReader reader = EasyExcelFactory.read(inputStream, listener).build(); ExcelReader reader = EasyExcelFactory.read(inputStream, listener).build();
...@@ -78,17 +78,20 @@ public class SendMsgFromExcelJob { ...@@ -78,17 +78,20 @@ public class SendMsgFromExcelJob {
List<String> head = listener.getHead(); List<String> head = listener.getHead();
logger.info("excel title = {}", head); logger.info("excel title = {}", head);
List<List<String>> dataList = listener.getData(); List<List<String>> dataList = listener.getData();
logger.info(">>>>>>>>>> 喜马拉雅类目 excel 读取数据 : {} 条", dataList.size()); logger.info(">>>>>>>>>> 沉香类目 excel 读取数据 : {} 条", dataList.size());
dataList.stream().forEach(row -> { dataList.stream().forEach(row -> {
String phone = row.get(0); String phone = row.get(0);
String url = wxAppletApi.getUrlLink(CommConsts.ITEM_OF_GROUPPURCHASE_URL,"itemId=" + 32894809); String url = wxAppletApi.getUrlLink(CommConsts.SPECIAL_PERFORMANCE_URL,"specialId=" + 28 + "&k=sms");
//发短信 //发短信
String msg = "藏传手绘黄财神小唐卡开启众筹啦,请前往"+ url + "查看"; String msg = "万香之王·沉香高货专场开始啦,请前往"+ url + "查看";
aliSmsSender.sendSms(phone, msg); aliSmsSender.sendSms(phone, msg);
logger.info("手机号: {}, 喜马拉雅类目, 发送短信成功", phone); logger.info("手机号: {}, 沉香类目, 发送短信成功", phone);
}); });
String successMsg = "给指定类目用户发送通知执行完成"; String successMsg = "给指定类目用户发送通知执行完成";
aliSmsSender.sendSms("15757185512", successMsg); //发短信
String url = wxAppletApi.getUrlLink(CommConsts.SPECIAL_PERFORMANCE_URL,"specialId=" + 28 + "&k=sms");
String msg = "万香之王·沉香高货专场开始啦,请前往"+ url + "查看";
aliSmsSender.sendSms("15757185512", msg);
redisUtils.set(key, now, 3600 * 24); redisUtils.set(key, now, 3600 * 24);
logger.info(">>>>>>>>>>>> sendMsgFromExcel 发送通知给指定用户定时任务执行完成 <<<<<<<<<<<<"); logger.info(">>>>>>>>>>>> sendMsgFromExcel 发送通知给指定用户定时任务执行完成 <<<<<<<<<<<<");
} catch (Exception e) { } catch (Exception e) {
......
...@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.api; ...@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.api;
import com.wwdz.ch.core.api.LogisticsApi; import com.wwdz.ch.core.api.LogisticsApi;
import com.wwdz.ch.core.entity.LogisticsRequestDto; import com.wwdz.ch.core.entity.LogisticsRequestDto;
import com.wwdz.ch.core.type.Result; import com.wwdz.ch.core.type.Result;
import com.wwdz.ch.wx.job.SendMsgFromExcelJob;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -21,6 +22,9 @@ public class LogisticsApiTest { ...@@ -21,6 +22,9 @@ public class LogisticsApiTest {
@Autowired @Autowired
LogisticsApi logisticsApi; LogisticsApi logisticsApi;
@Autowired
SendMsgFromExcelJob sendMsgFromExcelJob;
@Test @Test
public void findTrails() { public void findTrails() {
...@@ -30,4 +34,10 @@ public class LogisticsApiTest { ...@@ -30,4 +34,10 @@ public class LogisticsApiTest {
Result result = logisticsApi.findTrails(dto); Result result = logisticsApi.findTrails(dto);
logger.info("物流轨迹: {}" + result); logger.info("物流轨迹: {}" + result);
} }
@Test
public void test() {
sendMsgFromExcelJob.executeTask();
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment