Commit 33fd03e7 by levphon

工单标准接口-短信异步修改

1 parent 7c387159
package cn.com.glsx.stdinterface.modules.service; package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.stdinterface.common.exception.StdInterfaceException;
import cn.com.glsx.stdinterface.modules.util.RopHttpUtil; import cn.com.glsx.stdinterface.modules.util.RopHttpUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
...@@ -34,6 +34,7 @@ public class MessageService { ...@@ -34,6 +34,7 @@ public class MessageService {
* @param type 类型 * @param type 类型
* @param context 发送内容 * @param context 发送内容
*/ */
@Async
public void sendMessage(String phone, String source, String type, String context) { public void sendMessage(String phone, String source, String type, String context) {
MultiValueMap<String, String> params = new LinkedMultiValueMap<>(4); MultiValueMap<String, String> params = new LinkedMultiValueMap<>(4);
try { try {
...@@ -46,10 +47,14 @@ public class MessageService { ...@@ -46,10 +47,14 @@ public class MessageService {
log.info("发送短信结果{}", post); log.info("发送短信结果{}", post);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.info("发送短信异常,{}", e.getMessage()); log.error("发送短信到{}异常,{}", phone, e.getMessage());
throw new StdInterfaceException("4444444", e.getMessage()); //throw new StdInterfaceException("444444", e.getMessage());
} }
} }
public static void main(String[] args) {
MessageService messageService = new MessageService();
messageService.sendMessage("18682185876", "eshield_workOrder_warm", "1", "this is a test!");
}
} }
...@@ -41,7 +41,6 @@ import lombok.extern.slf4j.Slf4j; ...@@ -41,7 +41,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -1285,7 +1284,6 @@ public class WorkOrderService { ...@@ -1285,7 +1284,6 @@ public class WorkOrderService {
* @param workOrder * @param workOrder
* @param vehicle * @param vehicle
*/ */
@Async
public void finishedNotifyTarget(WorkOrder workOrder, Vehicle vehicle) { public void finishedNotifyTarget(WorkOrder workOrder, Vehicle vehicle) {
String receiveNumbers = workOrder.getNotifyTarget(); String receiveNumbers = workOrder.getNotifyTarget();
if (StringUtils.isNullOrEmpty(receiveNumbers)) { if (StringUtils.isNullOrEmpty(receiveNumbers)) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!