|
|
@@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.yc.ship.framework.common.pojo.PageResult;
|
|
|
import com.yc.ship.framework.common.util.object.BeanUtils;
|
|
|
import com.yc.ship.framework.mybatis.core.util.MyBatisUtils;
|
|
|
+import com.yc.ship.module.product.dal.mysql.voyage.VoyageMapper;
|
|
|
import com.yc.ship.module.system.dal.dataobject.dict.DictDataDO;
|
|
|
import com.yc.ship.module.system.dal.dataobject.sms.SmsTemplateDO;
|
|
|
import com.yc.ship.module.system.dal.mysql.dict.DictDataMapper;
|
|
|
@@ -79,6 +80,8 @@ public class SmsSendconfigServiceImpl implements SmsSendconfigService {
|
|
|
private SmsTemplateMapper smsTemplateMapper;
|
|
|
@Resource
|
|
|
private DictDataMapper dictDataMapper;
|
|
|
+ @Resource
|
|
|
+ private VoyageMapper voyageMapper;
|
|
|
|
|
|
@Override
|
|
|
public Long createSmsSendconfig(SmsSendconfigSaveReqVO createReqVO) {
|
|
|
@@ -311,55 +314,65 @@ public class SmsSendconfigServiceImpl implements SmsSendconfigService {
|
|
|
@Override
|
|
|
@Async
|
|
|
public void upSmsSendMsg(int type, String code, int day) {
|
|
|
- // 查询订单联系人
|
|
|
- List<Map<String,Object>> linkList = tradeOrderMapper.queryOrderLink(day,type);
|
|
|
- // 查询接站登记人
|
|
|
- List<Map<String,Object>> jzPhoneList = tradeOrderMapper.queryOrderJzPhone(day,type);
|
|
|
- // 查询订单游客电话
|
|
|
- List<Map<String,Object>> visitorMobileList = tradeOrderMapper.queryOrderVisitorMobile(day,type);
|
|
|
- // 查询短信配置
|
|
|
- SmsTemplateDO smsTemplateDO = smsTemplateMapper.selectByCode(code);
|
|
|
- // 合并两个列表并去重
|
|
|
- Set<String> phoneSet = new HashSet<>();
|
|
|
- Map<String, Map<String, Object>> phoneDataMap = new HashMap<>();
|
|
|
- processPhoneList(linkList, "link_mobile", phoneSet, phoneDataMap);
|
|
|
- processPhoneList(jzPhoneList, "phone", phoneSet, phoneDataMap);
|
|
|
- processPhoneList(visitorMobileList, "mobile", phoneSet, phoneDataMap);
|
|
|
-
|
|
|
- List<String> phoneList = new ArrayList<>(phoneSet);
|
|
|
- List<String> params = smsTemplateDO.getParams();// ["【pick】","【time】"]
|
|
|
- Map<String, Object> templateParams = new HashMap<>();
|
|
|
- if(type == 1){
|
|
|
- // 上水
|
|
|
- // 获取上水抵达三峡游客中心 查询数据字典
|
|
|
- List<DictDataDO> arriveDataLis = dictDataMapper.selectListByStatusAndDictType(0, "up_arrive");
|
|
|
- if(day == 1){
|
|
|
- // 获取上水登船时间 查询数据字典
|
|
|
- List<DictDataDO> dictDataList = dictDataMapper.selectListByStatusAndDictType(0, "up_board");
|
|
|
- templateParams.put(params.get(0), dictDataList.get(0).getLabel());
|
|
|
- templateParams.put(params.get(1), arriveDataLis.get(0).getLabel());
|
|
|
- }else{
|
|
|
- templateParams.put(params.get(0), DateUtil.format(DateUtil.offsetDay(new Date(), day), "yyyy年MM月dd日"));
|
|
|
- templateParams.put(params.get(1), arriveDataLis.get(0).getLabel());
|
|
|
- }
|
|
|
- }else{
|
|
|
- // 下水
|
|
|
- if(day == 1){
|
|
|
- // 获取下水登船时间 查询数据字典
|
|
|
- List<DictDataDO> dictDataList = dictDataMapper.selectListByStatusAndDictType(0, "down_board");
|
|
|
- templateParams.put(params.get(0), dictDataList.get(0).getLabel());
|
|
|
- }else{
|
|
|
- templateParams.put(params.get(0), DateUtil.format(DateUtil.offsetDay(new Date(), day), "yyyy年MM月dd日"));
|
|
|
- }
|
|
|
- }
|
|
|
- if(CollectionUtil.isNotEmpty(phoneList)){
|
|
|
- for(String phone : phoneList){
|
|
|
+ // 获取航次信息
|
|
|
+ List<Map<String,Object>> voyageList = voyageMapper.queryOrderVoyage(day,type);
|
|
|
+ if(CollectionUtil.isNotEmpty(voyageList)){
|
|
|
+ for(Map<String,Object> voyageMap: voyageList){
|
|
|
+ // 查询订单联系人
|
|
|
+ List<Map<String,Object>> linkList = tradeOrderMapper.queryOrderLink(day,type,(Long)voyageMap.get("voyageId"));
|
|
|
+ // 查询接站登记人
|
|
|
+ List<Map<String,Object>> jzPhoneList = tradeOrderMapper.queryOrderJzPhone(day,type,(Long)voyageMap.get("voyageId"));
|
|
|
+ // 查询订单游客电话
|
|
|
+ List<Map<String,Object>> visitorMobileList = tradeOrderMapper.queryOrderVisitorMobile(day,type,(Long)voyageMap.get("voyageId"));
|
|
|
+ // 查询短信配置
|
|
|
+ SmsTemplateDO smsTemplateDO = smsTemplateMapper.selectByCode(code);
|
|
|
+ // 合并两个列表并去重
|
|
|
+ Set<String> phoneSet = new HashSet<>();
|
|
|
+ Map<String, Map<String, Object>> phoneDataMap = new HashMap<>();
|
|
|
+ processPhoneList(linkList, "link_mobile", phoneSet, phoneDataMap);
|
|
|
+ processPhoneList(jzPhoneList, "phone", phoneSet, phoneDataMap);
|
|
|
+ processPhoneList(visitorMobileList, "mobile", phoneSet, phoneDataMap);
|
|
|
+
|
|
|
+ List<String> phoneList = new ArrayList<>(phoneSet);
|
|
|
+ List<String> params = smsTemplateDO.getParams();// ["【pick】","【time】"]
|
|
|
+ Map<String, Object> templateParams = new HashMap<>();
|
|
|
+ if(type == 1){
|
|
|
+ // 上水
|
|
|
+ // 获取上水抵达三峡游客中心 查询数据字典
|
|
|
+ List<DictDataDO> arriveDataLis = dictDataMapper.selectListByStatusAndDictType(0, "up_arrive");
|
|
|
+ if(day == 1){
|
|
|
+ // 获取上水登船时间 查询数据字典
|
|
|
+ List<DictDataDO> dictDataList = dictDataMapper.selectListByStatusAndDictType(0, "up_board");
|
|
|
+ templateParams.put(params.get(0), dictDataList.get(0).getLabel());
|
|
|
+ templateParams.put(params.get(1), arriveDataLis.get(0).getLabel());
|
|
|
+ }else{
|
|
|
+ templateParams.put(params.get(0), DateUtil.format(DateUtil.offsetDay(new Date(), day), "yyyy年MM月dd日"));
|
|
|
+ templateParams.put(params.get(1), arriveDataLis.get(0).getLabel());
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 下水
|
|
|
+ if(day == 1){
|
|
|
+ // 获取下水登船时间 查询数据字典
|
|
|
+ List<DictDataDO> dictDataList = dictDataMapper.selectListByStatusAndDictType(0, "down_board");
|
|
|
+ templateParams.put(params.get(1), dictDataList.get(0).getLabel());
|
|
|
+ }else{
|
|
|
+ templateParams.put(params.get(0), DateUtil.format(DateUtil.offsetDay(new Date(), day), "yyyy年MM月dd日"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(CollectionUtil.isNotEmpty(phoneList)){
|
|
|
+ for(String phone : phoneList){
|
|
|
+ if(type == 2 && day == 1){
|
|
|
+ templateParams.put(params.get(0),voyageMap.get("boarding_address"));
|
|
|
+ }
|
|
|
// log.info("【短信发送】:phone:{}", phone);
|
|
|
// log.info("【短信发送】:templateParams:{}", templateParams);
|
|
|
- smsSendService.sendSingleSmsToAdmin(phone, null, smsTemplateDO.getId(), templateParams);
|
|
|
- }
|
|
|
+ smsSendService.sendSingleSmsToAdmin(phone, null, smsTemplateDO.getId(), templateParams);
|
|
|
+ }
|
|
|
// smsSendService.sendSingleSmsToAdmin("18071246889", null, smsTemplateDO.getId(), templateParams);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void processPhoneList(List<Map<String, Object>> dataList, String phoneKey,
|