|
@@ -1,23 +1,31 @@
|
|
|
package com.github.zuihou.business.externalApi.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.zuihou.base.service.SuperCacheServiceImpl;
|
|
|
import com.github.zuihou.business.externalApi.dao.AgvHikOrderDetailInfoMapper;
|
|
|
-import com.github.zuihou.business.externalApi.dao.AgvOrderDetailInfoMapper;
|
|
|
import com.github.zuihou.business.externalApi.entity.AgvHikOrderDetailInfo;
|
|
|
import com.github.zuihou.business.externalApi.service.AgvHikOrderDetailInfoService;
|
|
|
-import com.github.zuihou.business.externalApi.service.AgvOrderDetailInfoService;
|
|
|
import com.github.zuihou.common.constant.CacheKey;
|
|
|
+import com.github.zuihou.common.constant.ParameterKey;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
|
import com.github.zuihou.injection.annonation.InjectionResult;
|
|
|
import com.github.zuihou.utils.BeanPlusUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.http.HttpEntity;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.Map;
|
|
|
+import java.util.Random;
|
|
|
+import java.util.concurrent.Future;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -33,6 +41,9 @@ import java.util.Map;
|
|
|
|
|
|
public class AgvHikOrderDetailInfoServiceImpl extends SuperCacheServiceImpl<AgvHikOrderDetailInfoMapper, AgvHikOrderDetailInfo> implements AgvHikOrderDetailInfoService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ private RestTemplate restTemplate;
|
|
|
+
|
|
|
@Override
|
|
|
protected String getRegion() {
|
|
|
return CacheKey.USER;
|
|
@@ -60,4 +71,36 @@ public class AgvHikOrderDetailInfoServiceImpl extends SuperCacheServiceImpl<AgvH
|
|
|
return agvHikOrderDetailInfo;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ @Async
|
|
|
+ public void asyncCallbackTask(String data){
|
|
|
+ // sleep10秒
|
|
|
+ log.info("异步模拟agv回到参数data=",data);
|
|
|
+ try {
|
|
|
+ Thread.sleep(10000);
|
|
|
+ // 组装数据模拟agv任务完成返回
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ String taskCode = jsonObject.getString("taskCode");
|
|
|
+ if(Long.valueOf(taskCode) % 10 == 1){
|
|
|
+ jsonObject.put("method","end");
|
|
|
+ jsonObject.put("code","999999");
|
|
|
+ jsonObject.put("msg","false");
|
|
|
+ }else{
|
|
|
+ jsonObject.put("method","end");
|
|
|
+ jsonObject.put("code","0");
|
|
|
+ jsonObject.put("msg","success");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 组装参数发送至agv回调接口
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8"));
|
|
|
+
|
|
|
+ HttpEntity<String> formEntity = new HttpEntity<String>(jsonObject.toJSONString(),headers);
|
|
|
+ String returnData = restTemplate.postForObject("http://localhost:8760/api/authority/agv/agvCallbackService/agvCallback",formEntity, String.class);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|