Commit 2571dcae authored by shiyu's avatar shiyu

自测账号不发送短信

parent 905ee60f
...@@ -3,6 +3,8 @@ package com.wwdz.ch.core.consts; ...@@ -3,6 +3,8 @@ package com.wwdz.ch.core.consts;
import tk.mybatis.spring.mapper.SpringBootBindUtil; import tk.mybatis.spring.mapper.SpringBootBindUtil;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
/** /**
* 一些常用的参数定义 * 一些常用的参数定义
...@@ -156,4 +158,10 @@ public interface CommConsts { ...@@ -156,4 +158,10 @@ public interface CommConsts {
* 默认介绍佣金比例 * 默认介绍佣金比例
*/ */
public final static double REBATE = 0.03; public final static double REBATE = 0.03;
/**
* 自测账号,不发送短信
*/
public static final List<Long> NOT_SEND_MSG_USERID = Arrays.asList(9357942L, 42273900L, 290775L ,61091901L, 299497L, 61097938L,
61113888L, 60652774L, 60684039L, 42192256L, 60652774L);
} }
...@@ -19,5 +19,12 @@ public interface SpecialPerformanceDao { ...@@ -19,5 +19,12 @@ public interface SpecialPerformanceDao {
int insert(SpecialPerformance specialPerformance); int insert(SpecialPerformance specialPerformance);
/**
* 查询当天结束的专场
* @param dto
* @return
*/
List<SpecialPerformance> findTodayEndList();
} }
...@@ -7,9 +7,13 @@ import com.wwdz.ch.db.domain.distribution.SpecialPerformanceExample; ...@@ -7,9 +7,13 @@ import com.wwdz.ch.db.domain.distribution.SpecialPerformanceExample;
import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto; import com.wwdz.ch.db.dto.request.distribution.SpecialPerformanceRequestDto;
import com.wwdz.ch.db.mapper.distribution.SpecialPerformanceMapper; import com.wwdz.ch.db.mapper.distribution.SpecialPerformanceMapper;
import com.xxdxxs.db.component.JdbcHelper; import com.xxdxxs.db.component.JdbcHelper;
import com.xxdxxs.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -78,4 +82,18 @@ public class SpecialPerformanceDaoImpl implements SpecialPerformanceDao { ...@@ -78,4 +82,18 @@ public class SpecialPerformanceDaoImpl implements SpecialPerformanceDao {
specialPerformanceMapper.insert(specialPerformance); specialPerformanceMapper.insert(specialPerformance);
return specialPerformance.getId(); return specialPerformance.getId();
} }
@Override
public List<SpecialPerformance> findTodayEndList() {
SpecialPerformanceExample example = new SpecialPerformanceExample();
SpecialPerformanceExample.Criteria criteria = example.createCriteria();
criteria.andStateEqualTo(3);
criteria.andEndTimeLessThanOrEqualTo(new Date());
LocalDate currentLD = LocalDate.now();
LocalDateTime startOfDay = currentLD.atStartOfDay();
criteria.andEndTimeGreaterThan(DateUtils.fromLocalDateTime(startOfDay));
return specialPerformanceMapper.selectByExample(example);
}
} }
...@@ -56,8 +56,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService { ...@@ -56,8 +56,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
private static final Logger logger = LoggerFactory.getLogger(AuctionRecordServiceImpl.class); private static final Logger logger = LoggerFactory.getLogger(AuctionRecordServiceImpl.class);
private static final List<Long> NOT_SEND_MSG_USERID = Arrays.asList(9357942L, 42273900L, 290775L ,61091901L, 299497L, 61097938L,
61113888L, 60652774L, 60684039L, 42192256L, 60652774L);
@Value("${dts.wx.auction-msg-url}") @Value("${dts.wx.auction-msg-url}")
private String AUCTION_MSG_URL; private String AUCTION_MSG_URL;
...@@ -170,7 +169,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService { ...@@ -170,7 +169,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL, "itemId=" + itemId + "&shareRecordId="); String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL, "itemId=" + itemId + "&shareRecordId=");
String msg = "您出价过的拍品" + supplierItem.getName() + "的价格被其他人超越了, 当前价是" + PriceUtil.convertPriceFenToYuan(price) + String msg = "您出价过的拍品" + supplierItem.getName() + "的价格被其他人超越了, 当前价是" + PriceUtil.convertPriceFenToYuan(price) +
"元,竞拍截止时间是" + DateUtils.toString(endTime) +", 请前往"+ url + "查看"; "元,竞拍截止时间是" + DateUtils.toString(endTime) +", 请前往"+ url + "查看";
if (!NOT_SEND_MSG_USERID.contains(auctionRecord.getUserId())) { if (!CommConsts.NOT_SEND_MSG_USERID.contains(auctionRecord.getUserId())) {
aliSmsSender.sendSms(auctionRecord.getUserId(), msg); aliSmsSender.sendSms(auctionRecord.getUserId(), msg);
} }
} }
...@@ -178,7 +177,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService { ...@@ -178,7 +177,7 @@ public class AuctionRecordServiceImpl implements AuctionRecordService {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + itemId + "&shareRecordId="); String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + itemId + "&shareRecordId=");
String msg = "您出价过的拍品" + supplierItem.getName() + "的价格被其他人超越了, 当前价是" + PriceUtil.convertPriceFenToYuan(price) + String msg = "您出价过的拍品" + supplierItem.getName() + "的价格被其他人超越了, 当前价是" + PriceUtil.convertPriceFenToYuan(price) +
"元,竞拍截止时间是" + DateUtils.toString(endTime) +", 请前往"+ url + "查看"; "元,竞拍截止时间是" + DateUtils.toString(endTime) +", 请前往"+ url + "查看";
if (!NOT_SEND_MSG_USERID.contains(auctionRecord.getUserId())) { if (!CommConsts.NOT_SEND_MSG_USERID.contains(auctionRecord.getUserId())) {
aliSmsSender.sendSms(auctionRecord.getUserId(), msg); aliSmsSender.sendSms(auctionRecord.getUserId(), msg);
} }
} }
......
...@@ -353,14 +353,18 @@ public class DistributionOrderServiceImpl implements DistributionOrderService { ...@@ -353,14 +353,18 @@ public class DistributionOrderServiceImpl implements DistributionOrderService {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + supplierItem.getId() + "&shareRecordId="); String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + supplierItem.getId() + "&shareRecordId=");
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" + String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看"; DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看";
if (!CommConsts.NOT_SEND_MSG_USERID.contains(auctionRecord.getUserId())) {
aliSmsSender.sendSms(auctionRecord.getUserId(), msg); aliSmsSender.sendSms(auctionRecord.getUserId(), msg);
} }
}
} else { } else {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + supplierItem.getId() + "&shareRecordId="); String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + supplierItem.getId() + "&shareRecordId=");
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" + String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看"; DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看";
if (!CommConsts.NOT_SEND_MSG_USERID.contains(auctionRecord.getUserId())) {
aliSmsSender.sendSms(auctionRecord.getUserId(), msg); aliSmsSender.sendSms(auctionRecord.getUserId(), msg);
} }
}
return Result.success(map); return Result.success(map);
} else { } else {
return Result.failed("稍后再试"); return Result.failed("稍后再试");
......
...@@ -198,10 +198,17 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService ...@@ -198,10 +198,17 @@ public class SpecialPerformanceServiceImpl implements SpecialPerformanceService
dto.setStateList(Arrays.asList(SpecialPerformanceEnum.StateEnum.PREVIEW.getCode(), SpecialPerformanceEnum.StateEnum.PROCESSING.getCode())); dto.setStateList(Arrays.asList(SpecialPerformanceEnum.StateEnum.PREVIEW.getCode(), SpecialPerformanceEnum.StateEnum.PROCESSING.getCode()));
List<SpecialPerformance> specialPerformances = specialPerformanceDao.findByType(dto); List<SpecialPerformance> specialPerformances = specialPerformanceDao.findByType(dto);
if (CollectionUtils.isEmpty(specialPerformances)) {
//查询当天结束的专场
List<SpecialPerformance> endSpecialPerformances = specialPerformanceDao.findTodayEndList();
if (CollectionUtils.isEmpty(specialPerformances) && CollectionUtils.isEmpty(endSpecialPerformances)) {
return Result.success(resultList); return Result.success(resultList);
} }
for (SpecialPerformance specialPerformance : specialPerformances) { List<SpecialPerformance> allList = new ArrayList<>();
allList.addAll(specialPerformances);
allList.addAll(endSpecialPerformances);
for (SpecialPerformance specialPerformance : allList) {
SpecialPerformanceVo specialPerformanceVo = new SpecialPerformanceVo(); SpecialPerformanceVo specialPerformanceVo = new SpecialPerformanceVo();
if (now.after(specialPerformance.getEndTime())) { if (now.after(specialPerformance.getEndTime())) {
SpecialPerformance updateDto = new SpecialPerformance(); SpecialPerformance updateDto = new SpecialPerformance();
......
package com.wwdz.ch.wx.job; package com.wwdz.ch.wx.job;
import com.wwdz.ch.core.consts.AuctionEnum; import com.wwdz.ch.core.consts.AuctionEnum;
import com.wwdz.ch.core.consts.CommConsts;
import com.wwdz.ch.core.consts.DistributionEnum; import com.wwdz.ch.core.consts.DistributionEnum;
import com.wwdz.ch.core.consts.SpecialPerformanceEnum; import com.wwdz.ch.core.consts.SpecialPerformanceEnum;
import com.wwdz.ch.core.notify.AliSmsSender; import com.wwdz.ch.core.notify.AliSmsSender;
...@@ -144,7 +145,9 @@ public class AutoSendMsgJob { ...@@ -144,7 +145,9 @@ public class AutoSendMsgJob {
}*/ }*/
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + itemId + "&shareRecordId="); String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + itemId + "&shareRecordId=");
String msg = "您出过价的拍品" + supplierItem.getName() + ",将在1小时内结束,请前往"+ url + "查看"; String msg = "您出过价的拍品" + supplierItem.getName() + ",将在1小时内结束,请前往"+ url + "查看";
if (!CommConsts.NOT_SEND_MSG_USERID.contains(userId)) {
aliSmsSender.sendSms(userId, msg); aliSmsSender.sendSms(userId, msg);
}
logger.info("================商品id:{}, 将在1小时内结束,提醒短信发送成功 ==============", supplierItem.getId()); logger.info("================商品id:{}, 将在1小时内结束,提醒短信发送成功 ==============", supplierItem.getId());
redisUtils.set(abortEndKey, itemId, 3600 * 2); redisUtils.set(abortEndKey, itemId, 3600 * 2);
} }
...@@ -211,13 +214,17 @@ public class AutoSendMsgJob { ...@@ -211,13 +214,17 @@ public class AutoSendMsgJob {
//发短信 //发短信
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" + String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看"; DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看";
if (!CommConsts.NOT_SEND_MSG_USERID.contains(userId)) {
aliSmsSender.sendSms(userId, msg); aliSmsSender.sendSms(userId, msg);
} }
}
} else { } else {
String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL,"itemId=" + supplierItem.getId() + "&shareRecordId="); String url = wxAppletApi.getUrlLink(AUCTION_MSG_URL, "itemId=" + supplierItem.getId() + "&shareRecordId=");
String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" + String msg = "您已中拍" + supplierItem.getName() + ",成交价是" + PriceUtil.convertPriceFenToYuan(distributionOrder.getAmount()) + "元,请在" +
DateUtils.toString(payEndTime) + "前完成付款,请前往"+ url + "查看"; DateUtils.toString(payEndTime) + "前完成付款,请前往" + url + "查看";
if (!CommConsts.NOT_SEND_MSG_USERID.contains(userId)) {
aliSmsSender.sendSms(userId, msg); aliSmsSender.sendSms(userId, msg);
}
logger.info("================订单号:{}, 催付款短信通知发送成功 ==============", distributionOrder.getDistributionOrderId()); logger.info("================订单号:{}, 催付款短信通知发送成功 ==============", distributionOrder.getDistributionOrderId());
} }
redisUtils.set(key, distributionOrder.getDistributionOrderId(), 3600 * 24); redisUtils.set(key, distributionOrder.getDistributionOrderId(), 3600 * 24);
......
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