| @@ -84,33 +84,6 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| @Override | |||
| public ResultData saveOrUpdate(WxMsg wxMsg) { | |||
| //1、手机多条以逗号分隔,直接通过实体得到wxmsg.getphones | |||
| //2、通过标签 | |||
| String phones=wxMsg.getPhones(); | |||
| String label = wxMsg.getLabel(); | |||
| if(!phones.equals("") && !label.equals("")){//两种方式只能选其一 | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| if(phones.equals("")){//没有手工输入手机号时解析标签,有,继续流转 | |||
| phones=parselabel(wxMsg.getTenantId(), wxMsg); | |||
| if(phones.equals("")){//解析之后手机号依然不存在时返回 | |||
| return new ResultData(ErrorCode.MSG_PHONE_NOT_FOUND); | |||
| } | |||
| } | |||
| //保证手机号惟一 | |||
| String[] phoneSplit = phones.split(","); | |||
| Set<String> phoneSet=new HashSet<>(); | |||
| for(String phone:phoneSplit){ | |||
| phoneSet.add(phone); | |||
| } | |||
| wxMsg.setExpectSendNumber(phoneSet.size());//预计发送数量 | |||
| StringBuffer sb=new StringBuffer(); | |||
| for(String phone:phoneSet){ | |||
| sb.append(phone).append(","); | |||
| } | |||
| wxMsg.setPhones(sb.deleteCharAt(sb.length()-1).toString()); | |||
| //新增记录 | |||
| if (wxMsg.getId() == null) { | |||
| @@ -124,6 +97,34 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| } | |||
| //1、手机多条以逗号分隔,直接通过实体得到wxmsg.getphones | |||
| //2、通过标签 | |||
| String phones=wxMsg.getPhones(); | |||
| String label = wxMsg.getLabel(); | |||
| if(!phones.equals("") && !label.equals("")){//两种方式只能选其一 | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| if(phones.equals("")){//没有手工输入手机号时解析标签,有,继续流转 | |||
| phones=parselabel(wxMsg.getTenantId(), wxMsg); | |||
| if(phones.equals("")){//解析之后手机号依然不存在时返回 | |||
| return new ResultData(ErrorCode.MSG_PHONE_NOT_FOUND); | |||
| } | |||
| } | |||
| //保证手机号惟一 | |||
| String[] phoneSplit = phones.split(","); | |||
| Set<String> phoneSet=new HashSet<>(); | |||
| for(String phone:phoneSplit){ | |||
| phoneSet.add(phone); | |||
| } | |||
| wxMsg.setExpectSendNumber(phoneSet.size());//预计发送数量 | |||
| StringBuffer sb=new StringBuffer(); | |||
| for(String phone:phoneSet){ | |||
| sb.append(phone).append(","); | |||
| } | |||
| wxMsg.setPhones(sb.deleteCharAt(sb.length()-1).toString()); | |||
| //是否立即发送 | |||
| if (wxMsg.getIsright() == 1) { | |||
| wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); | |||
| @@ -146,6 +147,34 @@ public class WxMsgServiceImpl implements WxMsgService { | |||
| return new ResultData(Result.SUCCESS, "已保存到草稿箱"); | |||
| } | |||
| //1、手机多条以逗号分隔,直接通过实体得到wxmsg.getphones | |||
| //2、通过标签 | |||
| String phones=wxMsg.getPhones(); | |||
| String label = wxMsg.getLabel(); | |||
| if(!phones.equals("") && !label.equals("")){//两种方式只能选其一 | |||
| return new ResultData(ErrorCode.MSG_SEND_WAY_CHOOSE_ERROR); | |||
| } | |||
| if(phones.equals("")){//没有手工输入手机号时解析标签,有,继续流转 | |||
| phones=parselabel(wxMsg.getTenantId(), wxMsg); | |||
| if(phones.equals("")){//解析之后手机号依然不存在时返回 | |||
| return new ResultData(ErrorCode.MSG_PHONE_NOT_FOUND); | |||
| } | |||
| } | |||
| //保证手机号惟一 | |||
| String[] phoneSplit = phones.split(","); | |||
| Set<String> phoneSet=new HashSet<>(); | |||
| for(String phone:phoneSplit){ | |||
| phoneSet.add(phone); | |||
| } | |||
| wxMsg.setExpectSendNumber(phoneSet.size());//预计发送数量 | |||
| StringBuffer sb=new StringBuffer(); | |||
| for(String phone:phoneSet){ | |||
| sb.append(phone).append(","); | |||
| } | |||
| wxMsg.setPhones(sb.deleteCharAt(sb.length()-1).toString()); | |||
| //是否立即发送 | |||
| if (wxMsg.getIsright() == 1) { | |||
| wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); | |||