|
|
|
@@ -22,6 +22,8 @@ import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.*; |
|
|
|
import com.iformall.mq.MqBaseProducer; |
|
|
|
import com.iformall.service.*; |
|
|
|
import com.iformall.sms.EnumSMSChannel; |
|
|
|
import com.iformall.sms.SMSFactory; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
@@ -90,6 +92,10 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
@Lazy |
|
|
|
@Autowired |
|
|
|
TtCUserService ttCUserService; |
|
|
|
|
|
|
|
@Lazy |
|
|
|
@Autowired |
|
|
|
SMSFactory smsFactory; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageInfo<WxMsg> listAsPage(WxMsg record, Integer pageIndex, Integer pageSize) { |
|
|
|
@@ -103,8 +109,8 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
int success = wxMsgCallbackMapper.queryMsgSendTotal(params); |
|
|
|
params.put("status", "0"); |
|
|
|
int error = wxMsgCallbackMapper.queryMsgSendTotal(params); |
|
|
|
temp.setSuccessNumber(success); |
|
|
|
temp.setErrorNumber(error); |
|
|
|
temp.setSuccessNumber(success*temp.getPerCount()); |
|
|
|
temp.setErrorNumber(error*temp.getPerCount()); |
|
|
|
} |
|
|
|
|
|
|
|
PageInfo<WxMsg> pageInfo = new PageInfo<>(templist); |
|
|
|
@@ -121,8 +127,8 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
int success = wxMsgCallbackMapper.queryMsgSendTotal(params); |
|
|
|
params.put("status", "0"); |
|
|
|
int error = wxMsgCallbackMapper.queryMsgSendTotal(params); |
|
|
|
wxMsg.setSuccessNumber(success); |
|
|
|
wxMsg.setErrorNumber(error); |
|
|
|
wxMsg.setSuccessNumber(success*wxMsg.getPerCount()); |
|
|
|
wxMsg.setErrorNumber(error*wxMsg.getPerCount()); |
|
|
|
if(null != wxMsg.getModelId() && wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){ |
|
|
|
WxTemplateMsg wxTemplateMsg = wxTemplateMsgMapper.selectById(wxMsg.getModelId()); |
|
|
|
wxMsg.setWxTemplateMsg(wxTemplateMsg); |
|
|
|
@@ -275,7 +281,6 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
} |
|
|
|
return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); |
|
|
|
} |
|
|
|
|
|
|
|
if (phones.isEmpty()) {//没有手工输入手机号时解析标签,有,继续流转 |
|
|
|
if(wxMsg.getWay() == EnumSendWay.TAG.getCode()){ |
|
|
|
List<WxCUserBasicInfo> list = |
|
|
|
@@ -323,6 +328,18 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
logger.info("短信数量不足"); |
|
|
|
return new ResultData(ErrorCode.MSG_SUM_INSUFFICENT); |
|
|
|
} |
|
|
|
|
|
|
|
EnumSMSChannel smsChannel = EnumSMSChannel.getEnum(wxMsgConfig.getSmsChannel()); |
|
|
|
if (null == smsChannel) { |
|
|
|
return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND,"短信配置渠道错误"); |
|
|
|
} |
|
|
|
wxMsg.setSmsChannel(smsChannel.getCode()); |
|
|
|
WxMsgModel wxMsgModel = wxMsgModelMapper.selectById(wxMsg.getModelId()); |
|
|
|
if (null == wxMsgModel) { |
|
|
|
return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND,"短信模版未查询到"); |
|
|
|
} |
|
|
|
wxMsg.setPerCount(calcuteMsgCount(wxMsgModel,smsChannel)); |
|
|
|
wxMsg.setExpectSendNumber(wxMsg.getExpectSendNumber()*wxMsg.getPerCount()); |
|
|
|
saveOrUpdate(wxMsg, wxMsgConfig); |
|
|
|
return new ResultData(); |
|
|
|
}else if(wxMsg.getWay() == EnumSendWay.APPINFOR.getCode()){ |
|
|
|
@@ -334,6 +351,12 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private Integer calcuteMsgCount(WxMsgModel wxMsgModel,EnumSMSChannel smsChannel) { |
|
|
|
if (null != smsChannel.getPerSize() && smsChannel.getPerSize() > 0 ) { |
|
|
|
return wxMsgModel.calcuteContentSize(smsChannel.getPerSize()); |
|
|
|
} |
|
|
|
return 1; |
|
|
|
} |
|
|
|
|
|
|
|
@Async |
|
|
|
@Override |
|
|
|
@@ -357,6 +380,7 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
wxMsg1.setSignature(wxMsg.getSignature()); |
|
|
|
wxMsg1.setMsg(wxMsg.getMsg()); |
|
|
|
wxMsg1.setModelId(wxMsg.getModelId()); |
|
|
|
wxMsg1.setSmsChannel(wxMsg.getSmsChannel()); |
|
|
|
if (extra > 0 && i == index) { |
|
|
|
List<String> phoneList = Arrays.asList(split).subList(i * 1000, length); |
|
|
|
String phones = StringUtils.join(phoneList, ","); |
|
|
|
|