|
|
@@ -5,13 +5,12 @@ import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.common.IdWorker; |
|
|
import com.iformall.domain.po.*; |
|
|
import com.iformall.domain.po.*; |
|
|
|
|
|
import com.iformall.domain.po.msg.WxMsgRecord; |
|
|
import com.iformall.domain.vo.WxCouponSendVo; |
|
|
import com.iformall.domain.vo.WxCouponSendVo; |
|
|
import com.iformall.enums.*; |
|
|
import com.iformall.enums.*; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.exception.MallinkException; |
|
|
import com.iformall.mapper.WxCouponOrderMapper; |
|
|
|
|
|
import com.iformall.mapper.WxCouponSendConfigMapper; |
|
|
|
|
|
import com.iformall.mapper.WxCouponSendMapper; |
|
|
|
|
|
import com.iformall.mapper.WxMerchantBUserMapper; |
|
|
|
|
|
|
|
|
import com.iformall.mapper.*; |
|
|
|
|
|
import com.iformall.mq.MqBaseProducer; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.service.*; |
|
|
import com.iformall.utils.DateUtils; |
|
|
import com.iformall.utils.DateUtils; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
@@ -22,7 +21,9 @@ import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@Service |
|
|
@Service |
|
|
public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
@@ -46,7 +47,12 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
WxMerchantBUserMapper wxMerchantBUserMapper; |
|
|
WxMerchantBUserMapper wxMerchantBUserMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
PushLimitService pushLimitService; |
|
|
PushLimitService pushLimitService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private MqBaseProducer mqBaseProducer; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxCUserMapper wxCUserMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxAppinfoService wxAppinfoService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { |
|
|
public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { |
|
|
@@ -224,6 +230,30 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
logger.error(e.getMessage()); |
|
|
logger.error(e.getMessage()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 发送短信 |
|
|
|
|
|
if (send.getSendSms().equals(EnumCouponSendSms.YES.getCode())) { |
|
|
|
|
|
//券名 |
|
|
|
|
|
String title = send.getTitle(); |
|
|
|
|
|
//找出用户手机号 |
|
|
|
|
|
WxCUser user = wxCUserMapper.selectByPrimaryKey(cUserId); |
|
|
|
|
|
String phone = user.getPhone(); |
|
|
|
|
|
//小程序名称 |
|
|
|
|
|
WxAppinfo appInfo = wxAppinfoService.getCAppInfo(tenantId); |
|
|
|
|
|
String appName = appInfo.getName(); |
|
|
|
|
|
Map<String, String> msgReplaceMap = new HashMap(); |
|
|
|
|
|
msgReplaceMap.put("title", title); |
|
|
|
|
|
msgReplaceMap.put("app", appName); |
|
|
|
|
|
|
|
|
|
|
|
WxMsgRecord wxMsgRecord = new WxMsgRecord(); |
|
|
|
|
|
wxMsgRecord.setMsgType(EnumMsgRecordType.SMS.getCode()); |
|
|
|
|
|
wxMsgRecord.setModelType(EnumMsgModel.COUPON_SEND.getCode()); |
|
|
|
|
|
wxMsgRecord.setReceiver(phone); |
|
|
|
|
|
wxMsgRecord.setTenantId(tenantId); |
|
|
|
|
|
wxMsgRecord.setDynamicContentMap(msgReplaceMap); |
|
|
|
|
|
mqBaseProducer.sendMessage(wxMsgRecord, EnumMsgMqTopic.DEFAULT.getCode(), EnumMsgMqTag.DEFAULT.getCode(), EnumMsgMqKey.DEFAULT.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return bRet; |
|
|
return bRet; |
|
|
|