|
|
|
@@ -12,6 +12,7 @@ import com.iformall.domain.po.WxCUser; |
|
|
|
import com.iformall.domain.po.WxCUserBasicInfo; |
|
|
|
import com.iformall.domain.po.WxMsg; |
|
|
|
import com.iformall.domain.po.WxMsgConfig; |
|
|
|
import com.iformall.enums.EnumMsgStatus; |
|
|
|
import com.iformall.mapper.*; |
|
|
|
import com.iformall.service.WxCUserService; |
|
|
|
import com.iformall.service.WxCUserTagsService; |
|
|
|
@@ -23,6 +24,7 @@ import com.iformall.utils.RsaUtil; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.beans.Encoder; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
@Service |
|
|
|
@@ -66,7 +68,7 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
} |
|
|
|
|
|
|
|
if(phones.equals("")){ |
|
|
|
return new ResultData(Result.SUCCESS, "您需要添加要发送的手机号"); |
|
|
|
return new ResultData(ErrorCode.MSG_PHONE_NOT_FOUND, "请输入手机号"); |
|
|
|
} |
|
|
|
|
|
|
|
if (wxMsg.getId() == null) { |
|
|
|
@@ -82,10 +84,10 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
|
|
|
|
//是否立即发送 |
|
|
|
if (wxMsg.getIsright() == 1) { |
|
|
|
wxMsg.setStatus(1); |
|
|
|
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); |
|
|
|
sendmsg(wxMsg); |
|
|
|
} else { |
|
|
|
wxMsg.setStatus(0); |
|
|
|
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode()); |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
wxMsg.setId(idWorker.nextId()); |
|
|
|
wxMsg.setCreatetime(new Date()); |
|
|
|
@@ -102,11 +104,11 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
|
|
|
|
//是否立即发送 |
|
|
|
if (wxMsg.getIsright() == 1) { |
|
|
|
wxMsg.setStatus(1); |
|
|
|
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); |
|
|
|
sendmsg(wxMsg); |
|
|
|
} else { |
|
|
|
//定时 |
|
|
|
wxMsg.setStatus(0); |
|
|
|
wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_NOT_SEND.getCode()); |
|
|
|
wxMsgMapper.updateByPrimaryKeySelective(wxMsg); |
|
|
|
return new ResultData(Result.SUCCESS, "短信会在预设时间发送"); |
|
|
|
|
|
|
|
@@ -152,7 +154,7 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
WxMsgConfig wxMsgConfig = new WxMsgConfig(); |
|
|
|
wxMsgConfig.setTenantId(wxMsg.getTenantId()); |
|
|
|
List<WxMsgConfig> wxMsgConfigs = wxMsgConfigMapper.findList(wxMsgConfig); |
|
|
|
if (wxMsgConfigs.size() == 0) return new ResultData(Result.SUCCESS, "您还未接入短信运营商,请联系平台管理员"); |
|
|
|
if (wxMsgConfigs.size() == 0) return new ResultData(ErrorCode.MSG_SERVER_NOT_FIND, "您还未接入短信运营商,请联系平台管理员"); |
|
|
|
wxMsgConfig = wxMsgConfigs.get(0); |
|
|
|
|
|
|
|
String secret = wxMsgConfig.getSecret(); |
|
|
|
@@ -201,9 +203,9 @@ public class WxMsgServiceImpl implements WxMsgService { |
|
|
|
String ret = jsonObjectResult.get("ret").toString(); |
|
|
|
|
|
|
|
if (ret.equals("1")) { |
|
|
|
wxMsg.setSendstatus(1); |
|
|
|
wxMsg.setSendstatus(EnumMsgStatus.MSG_SEND_SUCCESS.getCode()); |
|
|
|
} else { |
|
|
|
wxMsg.setSendstatus(0); |
|
|
|
wxMsg.setSendstatus(EnumMsgStatus.MSG_SEND_FAIL.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
if (wxMsg.getId() == null) { |
|
|
|
|