13 changed files with 279 additions and 39 deletions
-
16archives/src/main/java/com/storeroom/modules/archives/controller/ArchivesController.java
-
205archives/src/main/java/com/storeroom/modules/archives/controller/CallExternalController.java
-
23archives/src/main/java/com/storeroom/modules/archives/controller/StorageController.java
-
8archives/src/main/java/com/storeroom/modules/archives/controller/TagController.java
-
16archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesSummaryRepository.java
-
9archives/src/main/java/com/storeroom/modules/archives/repository/ArchivesTagRepository.java
-
4archives/src/main/java/com/storeroom/modules/archives/repository/StorageLogRepository.java
-
2archives/src/main/java/com/storeroom/modules/archives/service/ArchivesCaseService.java
-
6archives/src/main/java/com/storeroom/modules/archives/service/ArchivesService.java
-
2archives/src/main/java/com/storeroom/modules/archives/service/ArchivesTagService.java
-
4archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesCaseServiceImpl.java
-
18archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java
-
5archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesTagServiceImpl.java
@ -0,0 +1,205 @@ |
|||
package com.storeroom.modules.archives.controller; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.storeroom.modules.device.service.DeviceService; |
|||
import com.storeroom.modules.device.service.dto.DeviceInfoDto; |
|||
import com.storeroom.utils.ApiResponse; |
|||
import com.storeroom.utils.HttpUtils; |
|||
import com.storeroom.utils.StringUtils; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.RequiredArgsConstructor; |
|||
import org.apache.http.HttpResponse; |
|||
import org.apache.http.util.EntityUtils; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.web.bind.annotation.GetMapping; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.HashMap; |
|||
|
|||
@RestController |
|||
@RequiredArgsConstructor |
|||
@Api(tags = "调用外部接口") |
|||
@RequestMapping("/api/callExternal") |
|||
public class CallExternalController { |
|||
|
|||
private final DeviceService deviceService; |
|||
|
|||
@ApiOperation("打开架体具体某一列") |
|||
@GetMapping("/openCol") |
|||
public ApiResponse<Object> openCol( |
|||
String deviceId,Integer quNo, Integer colNo,Integer leNo, Integer divNo,Integer zyNo |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
if(quNo!=null) |
|||
json.put("QuNo",quNo); |
|||
if(colNo!=null) |
|||
json.put("ColNo",colNo); |
|||
if(leNo!=null) |
|||
json.put("LeNo",leNo); |
|||
if(divNo!=null) |
|||
json.put("DivNo",divNo); |
|||
if(zyNo!=null) |
|||
json.put("ZyNo",zyNo); |
|||
|
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/OpenCol", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
@ApiOperation("打开档案所在位置") |
|||
@GetMapping("/findFiles") |
|||
public ApiResponse<Object> findFiles( |
|||
String deviceId,String fileName,String storeCode,Integer quNo, Integer colNo,Integer leNo, Integer divNo,Integer zyNo,String position,Integer type |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("fileName",fileName); |
|||
json.put("position",position); |
|||
json.put("type",type); |
|||
JSONObject json1 = new JSONObject(); |
|||
json1.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode()); |
|||
json1.put("quNo",quNo); |
|||
json1.put("colNo",colNo); |
|||
json1.put("leNo",leNo); |
|||
json1.put("divNo",divNo); |
|||
json1.put("zyNo",zyNo); |
|||
json.put("positionKey",json1); |
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/findFiles", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
@ApiOperation("获取密集架实时状态") |
|||
@GetMapping("/reportStatus") |
|||
public ApiResponse<Object> reportStatus( |
|||
String deviceId,String StoreCode,Integer quNo |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode()); |
|||
json.put("QuNo",quNo); |
|||
|
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/ReportStatus", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
@ApiOperation("停止移动") |
|||
@GetMapping("/stopMove") |
|||
public ApiResponse<Object> stopMove( |
|||
String deviceId,String StoreCode,Integer quNo |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode()); |
|||
json.put("QuNo",quNo); |
|||
|
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/StopMove", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
@ApiOperation("密集架通风") |
|||
@GetMapping("/vent") |
|||
public ApiResponse<Object> vent( |
|||
String deviceId,String StoreCode,Integer quNo |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode()); |
|||
json.put("QuNo",quNo); |
|||
|
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Vent", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
@ApiOperation("密集架合架") |
|||
@GetMapping("/reset") |
|||
public ApiResponse<Object> reset( |
|||
String deviceId,String StoreCode,Integer quNo |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("storeCode", StringUtils.isEmpty(device.getStoreroomCode()) ? "12345678" : device.getStoreroomCode()); |
|||
json.put("QuNo",quNo); |
|||
|
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/Reset", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
@ApiOperation("公告下发") |
|||
@GetMapping("/getNotice") |
|||
public ApiResponse<Object> getNotice( |
|||
String deviceId,String notice |
|||
){ |
|||
String retust = ""; |
|||
DeviceInfoDto device = deviceService.findById(deviceId); |
|||
JSONObject json = new JSONObject(); |
|||
json.put("notice",notice); |
|||
|
|||
try { |
|||
HashMap<String, String> map = new HashMap<>(); |
|||
map.put("Content-type", "application/json"); |
|||
HttpResponse response = HttpUtils.doPost("http://"+device.getDeviceIp()+":"+device.getDevicePort(), "/IntelligentCabinetAPIServer/getNotice", |
|||
"POST", map, null, json.toJSONString()); |
|||
retust = EntityUtils.toString(response.getEntity()); |
|||
}catch (Exception e){ |
|||
retust = "连接失败"; |
|||
} |
|||
return ApiResponse.success(retust); |
|||
} |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue