|
|
@@ -12,6 +12,7 @@ import com.iformall.domain.po.base.BaseEntity; |
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
import com.iformall.domain.po.base.TenantEntity; |
|
|
import com.iformall.domain.po.msg.AppUniformMsg; |
|
|
import com.iformall.domain.po.msg.AppUniformMsg; |
|
|
import com.iformall.domain.po.msg.MpAppMsg; |
|
|
import com.iformall.domain.po.msg.MpAppMsg; |
|
|
|
|
|
import com.iformall.domain.po.msg.WxMsg; |
|
|
import com.iformall.domain.po.msg.WxMsgRecord; |
|
|
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.*; |
|
|
@@ -68,6 +69,10 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
WxMsgLimitService wxMsgLimitService; |
|
|
WxMsgLimitService wxMsgLimitService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
WxCouponMerchantMapper wxCouponMerchantMapper; |
|
|
WxCouponMerchantMapper wxCouponMerchantMapper; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxTemplateMsgService wxTemplateMsgService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
WxMsgService wxMsgService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { |
|
|
public PageInfo<WxCouponSendVo> listAsPage(WxCouponSend record, Integer pageIndex, Integer pageSize) { |
|
|
@@ -426,8 +431,9 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
setUserId(couponOrder.getCUserId()); |
|
|
setUserId(couponOrder.getCUserId()); |
|
|
}}); |
|
|
}}); |
|
|
if(list != null && list.size() > 0){ |
|
|
if(list != null && list.size() > 0){ |
|
|
WxCUser cuser = list.get(0); |
|
|
|
|
|
if(cuser != null){ |
|
|
|
|
|
|
|
|
for (WxCUser cuser:list) { |
|
|
|
|
|
//发订阅消息 |
|
|
|
|
|
sendCouponRemind(send, couponOrder, cuser); |
|
|
// 发送微信模板消息(公众号模板消息/小程序统一消息/小程序模板消息) |
|
|
// 发送微信模板消息(公众号模板消息/小程序统一消息/小程序模板消息) |
|
|
sendMpMsgForSendCoupon(send, couponOrder, cuser); |
|
|
sendMpMsgForSendCoupon(send, couponOrder, cuser); |
|
|
} |
|
|
} |
|
|
@@ -475,6 +481,33 @@ public class WxCouponSendServiceImpl implements WxCouponSendService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void sendCouponRemind(WxCouponSend send, WxCouponOrder couponOrder,WxCUser cuser){ |
|
|
|
|
|
try { |
|
|
|
|
|
WxTemplateMsg temp = new WxTemplateMsg(); |
|
|
|
|
|
temp.updateTenantInfo(send); |
|
|
|
|
|
temp.setType(EnumTemplateType.SEND_COUPON_REMIND.getCode()); |
|
|
|
|
|
temp = wxTemplateMsgService.getByObj(temp); |
|
|
|
|
|
if(temp.getId() != null){ |
|
|
|
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
|
|
|
|
|
WxMsg msg = new WxMsg(); |
|
|
|
|
|
msg.updateTenantInfo(send); |
|
|
|
|
|
msg.setPhones(cuser.getOpenId()); |
|
|
|
|
|
msg.setModelId(temp.getId()); |
|
|
|
|
|
Map<String,String> map = new HashMap<>(); |
|
|
|
|
|
map.put("thing1",send.getTitle()); |
|
|
|
|
|
map.put("time3",dateFormat.format(couponOrder.getCreateDate())); |
|
|
|
|
|
map.put("time4",dateFormat.format(couponOrder.getExpiredTime())); |
|
|
|
|
|
map.put("thing5","你的优惠卷已到账!请立即使用"); |
|
|
|
|
|
map.put("goToPage","pages/index/index?type=mc"); |
|
|
|
|
|
msg.setMsg(JSONObject.toJSONString(map)); |
|
|
|
|
|
wxMsgService.batchSendAppinfo(msg); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
// e.printStackTrace(); |
|
|
|
|
|
logger.error("发卷消息发送异常"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private boolean sendMpMsgForSendCoupon(WxCouponSend send, WxCouponOrder couponOrder, WxCUser user) { |
|
|
private boolean sendMpMsgForSendCoupon(WxCouponSend send, WxCouponOrder couponOrder, WxCUser user) { |
|
|
// 发送 公众号 模板消息 |
|
|
// 发送 公众号 模板消息 |
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
|
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); |
|
|
|