Ver a proveniência

[精准发券][修改][短信发送]

release_toaliyun_real
gongbiao há 7 anos
ascendente
cometimento
d05a97df25
1 ficheiros alterados com 13 adições e 10 eliminações
  1. +13
    -10
      mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java

+ 13
- 10
mallinkService/src/main/java/com/iformall/service/impl/WxCouponInjectServiceImpl.java Ver ficheiro

@@ -130,20 +130,18 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {


record.setCouponName(wxCoupon.getTitle()); record.setCouponName(wxCoupon.getTitle());
record.setSendAmount(cUsers.size()); record.setSendAmount(cUsers.size());

couponInjectMapper.insertSelective(record); couponInjectMapper.insertSelective(record);
if(record.getSendType().equals(EnumCouponInjectSendType.IMMEDIATE.getCode())) { if(record.getSendType().equals(EnumCouponInjectSendType.IMMEDIATE.getCode())) {

List<WxCUser> sentUsers = sendCoupon(wxCoupon, cUsers, record); List<WxCUser> sentUsers = sendCoupon(wxCoupon, cUsers, record);
if (sentUsers.size() > 0) { if (sentUsers.size() > 0) {
record.setStatus(EnumCouponInjectStatus.HAS_SENT.getCode()); record.setStatus(EnumCouponInjectStatus.HAS_SENT.getCode());
ResultData msgSendRes = sendMsg(record, sentUsers);
if (msgSendRes.code == Result.SUCCESS)
record.setMsgId((Long)msgSendRes.data);
//发送短信
sendMsg(record, sentUsers);
} else { } else {
record.setStatus(EnumCouponInjectStatus.SEND_FAILED.getCode()); record.setStatus(EnumCouponInjectStatus.SEND_FAILED.getCode());
} }
record.setSendAmount(sentUsers.size()); record.setSendAmount(sentUsers.size());

couponInjectMapper.updateByPrimaryKeySelective(record); couponInjectMapper.updateByPrimaryKeySelective(record);
} }


@@ -171,7 +169,8 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {
return new ResultData(ErrorCode.MSG_SUM_ZERO); return new ResultData(ErrorCode.MSG_SUM_ZERO);
} }


wxmsg.setExpectSendNumber(cUsers.size());//预计发送数量
//预计发送数量
wxmsg.setExpectSendNumber(cUsers.size());
if(wxMsgConfig.getRemains()<cUsers.size()){ if(wxMsgConfig.getRemains()<cUsers.size()){
return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT); return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT);
} }
@@ -183,8 +182,9 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {
StringBuffer sb=new StringBuffer(); StringBuffer sb=new StringBuffer();
for(WxCUser user:cUsers){ for(WxCUser user:cUsers){
String phone = user.getPhone(); String phone = user.getPhone();
if(null!=phone && !phone.equals(""))
if(null!=phone && !phone.equals("")){
sb.append(phone).append(","); sb.append(phone).append(",");
}
} }
wxmsg.setPhones(sb.deleteCharAt(sb.length()-1).toString()); wxmsg.setPhones(sb.deleteCharAt(sb.length()-1).toString());
wxmsg.setLabel(""); wxmsg.setLabel("");
@@ -192,7 +192,8 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {
return new ResultData(ErrorCode.MSG_NO_VALID_PHONE); return new ResultData(ErrorCode.MSG_NO_VALID_PHONE);
} }


wxmsg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode());//立即发送
//立即发送
wxmsg.setIsright(EnumMsgSend.MSG_SEND_IMMEDIATELY.getCode());
wxmsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); wxmsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode());
wxmsg.setSendtime(com.iformall.utils.DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss")); wxmsg.setSendtime(com.iformall.utils.DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss"));


@@ -202,8 +203,10 @@ public class WxCouponInjectServiceImpl implements WxCouponInjectService {
wxmsg.setSignature(model.getSignature()); wxmsg.setSignature(model.getSignature());
wxmsg.setSuccessNumber(0); wxmsg.setSuccessNumber(0);
wxmsg.setErrorNumber(0); wxmsg.setErrorNumber(0);
wxmsg.setWay(EnumSendWay.COUPON.getCode());//1、标签短信2、精准发券
return wxMsgService.saveOrUpdate(wxmsg,wxMsgConfig);
//1、标签短信2、精准发券
wxmsg.setWay(EnumSendWay.COUPON.getCode());
wxMsgService.sendMsgFromCouponInject(wxmsg,wxMsgConfig,record);
return new ResultData();
} }


private List<WxCUser> sendCoupon(WxCoupon wxCoupon,List<WxCUser> cUsers,WxCouponInject record){ private List<WxCUser> sendCoupon(WxCoupon wxCoupon,List<WxCUser> cUsers,WxCouponInject record){


Carregando…
Cancelar
Guardar