| @@ -90,38 +90,28 @@ public class SendCallBackSmsServiceImpl implements MsgSendService { | |||||
| record.setSendstatus(EnumMsgSendStatus.MSG_SEND_FAIL.getCode()); | record.setSendstatus(EnumMsgSendStatus.MSG_SEND_FAIL.getCode()); | ||||
| } | } | ||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| long id = idWorker.nextId(); | |||||
| WxMsg wxMsg = new WxMsg(); | |||||
| wxMsg.setTenantId(record.getTenantId()); | |||||
| wxMsg.setModelId(record.getModelId()); | |||||
| wxMsg.setMsg(record.getMsg()); | |||||
| wxMsg.setExpectSendNumber(record.getExpectSendNumber()); | |||||
| wxMsg.setPhones(record.getPhones()); | |||||
| wxMsg.setSignature(record.getSignature()); | |||||
| wxMsg.setIsright(record.getIsright()); | |||||
| wxMsg.setName(record.getName()); | |||||
| wxMsg.setSendstatus(record.getSendstatus()); | |||||
| wxMsg.setLabel(record.getLabel()); | |||||
| wxMsg.setStatus(record.getStatus()); | |||||
| wxMsg.setWay(record.getWay()); | |||||
| wxMsg.setId(id); | |||||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss"); | |||||
| wxMsg.setSendtime(systemTime); | |||||
| wxMsg.setCreatetime(DateUtils.stringToDate(systemTime, "yyyy-MM-dd HH:mm:ss")); | |||||
| //精准投放 | |||||
| if (couponInject != null) { | |||||
| wxMsg.setCouponInjectId(couponInject.getId()); | |||||
| if(record.getId() == null){ | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| long id = idWorker.nextId(); | |||||
| record.setId(id); | |||||
| String systemTime = DateUtils.getSystemTime("yyyy-MM-dd HH:mm:ss"); | |||||
| record.setSendtime(systemTime); | |||||
| record.setCreatetime(DateUtils.stringToDate(systemTime, "yyyy-MM-dd HH:mm:ss")); | |||||
| //精准投放 | |||||
| if (couponInject != null) { | |||||
| record.setCouponInjectId(couponInject.getId()); | |||||
| } | |||||
| wxMsgMapper.insertSelective(record); | |||||
| } | } | ||||
| wxMsgMapper.insertSelective(wxMsg); | |||||
| if (ret.equals(EnumMsgSendStatus.MSG_SEND_SUCCESS.getCode().toString())) { | if (ret.equals(EnumMsgSendStatus.MSG_SEND_SUCCESS.getCode().toString())) { | ||||
| wxMsgService.addMsgCallback(wxMsg, batchNo); | |||||
| wxMsgService.addMsgCallback(record, batchNo); | |||||
| //wx_msg改为已发送 | //wx_msg改为已发送 | ||||
| wxMsg.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); | |||||
| wxMsgMapper.updateByPrimaryKeySelective(wxMsg); | |||||
| record.setStatus(EnumMsgStatus.MSG_STATUS_SENDED.getCode()); | |||||
| wxMsgMapper.updateByPrimaryKeySelective(record); | |||||
| } else { | } else { | ||||
| logger.error("发送:{},运营商返回失败:{}",phone,result); | logger.error("发送:{},运营商返回失败:{}",phone,result); | ||||
| wxMsgMapper.updateByPrimaryKeySelective(wxMsg); | |||||
| wxMsgMapper.updateByPrimaryKeySelective(record); | |||||
| throw new MallinkException(1001,"运营商返回失败:"+result); | throw new MallinkException(1001,"运营商返回失败:"+result); | ||||
| } | } | ||||
| } | } | ||||