Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -6,7 +6,6 @@ import io.swagger.annotations.Api;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.log.OthersToInterfaceLog;
|
||||
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
||||
import org.nl.acs.ext.wms.service.NDCToAcsService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -17,17 +16,17 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "ndc接口")
|
||||
@RequestMapping("/ndcToAcs")
|
||||
@Api(tags = "acs套件回传接口")
|
||||
@RequestMapping("/api/kitToAcs")
|
||||
@Slf4j
|
||||
public class NDCToAcsController {
|
||||
public class KitToAcsController {
|
||||
|
||||
private final NDCToAcsService ndcToAcsService;
|
||||
|
||||
|
||||
@SaIgnore
|
||||
@PostMapping("/agv/agvCallbackService/agvCallback")
|
||||
@OthersToInterfaceLog("NDC->ACS")
|
||||
@PostMapping("/agvCallback")
|
||||
@OthersToInterfaceLog("kit->ACS")
|
||||
public ResponseEntity<Object> agvCallback(@RequestBody JSONObject requestParam) throws Exception{
|
||||
return new ResponseEntity<>(ndcToAcsService.agvCallback(requestParam), HttpStatus.OK);
|
||||
}
|
||||
@@ -5,11 +5,9 @@ package org.nl.acs.ext.wms.rest;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import jdk.nashorn.internal.ir.annotations.Ignore;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.ext.wms.liKuData.*;
|
||||
import org.nl.acs.ext.wms.service.AcsToLiKuService;
|
||||
import org.nl.acs.ext.wms.service.LiKuToAcsService;
|
||||
import org.nl.modules.logging.InterfaceLogType;
|
||||
import org.nl.modules.logging.annotation.Log;
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.acs.ext.wms.service.impl;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -11,6 +12,7 @@ import org.nl.acs.device.address.service.AddressService;
|
||||
import org.nl.acs.device.address.service.dto.AddressDto;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device.service.impl.DeviceServiceImpl;
|
||||
import org.nl.acs.ext.wms.IpUtil;
|
||||
import org.nl.acs.ext.wms.NdcHttpUtil;
|
||||
import org.nl.acs.ext.wms.UnifiedResponse;
|
||||
import org.nl.acs.ext.wms.service.AcsToNDCService;
|
||||
@@ -74,19 +76,35 @@ public class AcsToNDCServiceImpl implements AcsToNDCService {
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WCSURL).getValue();
|
||||
AddressDto addressDto = addressService.findByCode("applyTaskToWcs");
|
||||
String url = wmsurl + addressDto.getMethods_url();
|
||||
|
||||
LuceneLogDto logDto =
|
||||
LuceneLogDto.builder()
|
||||
.logType("接口日志")
|
||||
.request_url(wmsurl)
|
||||
.request_direction("post")
|
||||
.request_param(JSON.toJSONString(jo))
|
||||
.method(addressDto.getMethods_url())
|
||||
.content("开始请求")
|
||||
.build();
|
||||
luceneExecuteLogService.interfaceExecuteLog(logDto);
|
||||
long start = System.currentTimeMillis();
|
||||
HttpResponse result = HttpRequest.post(url)
|
||||
//表单内容
|
||||
.body(String.valueOf(jo))
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("下发科聪任务")
|
||||
.content("任务号:" + instruction.getTask_code() + ",指令号:" + instruction.getInstruction_code() + ",下发wcs任务序列反馈参数:" + jo)
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
LuceneLogDto logResult =
|
||||
LuceneLogDto.builder()
|
||||
.logType("接口日志")
|
||||
.request_url(wmsurl)
|
||||
.request_direction("post")
|
||||
.request_param(JSON.toJSONString(jo))
|
||||
.method(addressDto.getMethods_url())
|
||||
.response_param(JSON.toJSONString(result))
|
||||
.executeTime(System.currentTimeMillis() - start)
|
||||
.content("响应请求")
|
||||
.build();
|
||||
luceneExecuteLogService.deviceExecuteLog(logResult);
|
||||
log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", instruction.getTask_code(), instruction.getInstruction_code(), result.getStatus(), result.body());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface LuceneExecuteLogService {
|
||||
*
|
||||
* @param luceneLogDto 日志结果对象
|
||||
*/
|
||||
void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException;
|
||||
void interfaceExecuteLog(LuceneLogDto luceneLogDto);
|
||||
|
||||
/**
|
||||
* 设备执行日志,会保留历史记录
|
||||
|
||||
@@ -42,12 +42,12 @@ public class LuceneExecuteLogServiceImpl implements LuceneExecuteLogService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interfaceExecuteLog(LuceneLogDto luceneLogDto) throws IOException {
|
||||
public void interfaceExecuteLog(LuceneLogDto luceneLogDto) {
|
||||
luceneLogDto.setLogType(LogTypeEnum.INTERFACE_LOG.getDesc());
|
||||
addIndex(luceneLogDto);
|
||||
}
|
||||
|
||||
private void addIndex(LuceneLogDto luceneLogDto) throws IOException {
|
||||
private void addIndex(LuceneLogDto luceneLogDto) {
|
||||
IndexWriter indexWriter = LuceneIndexWriter.getIndexWriter();
|
||||
//创建一个Document对象
|
||||
Document document = new Document();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 8010
|
||||
port: 8011
|
||||
#配置数据源
|
||||
spring:
|
||||
datasource:
|
||||
|
||||
Reference in New Issue
Block a user