|
@@ -8,6 +8,7 @@ import com.gzlh.device.camera.factory.CameraFactory;
|
|
|
import com.gzlh.device.camera.properties.CameraPropertiesConfig;
|
|
|
import com.gzlh.utils.FileUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -18,21 +19,19 @@ import org.w3c.dom.Element;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
+import java.net.InetAddress;
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/camera")
|
|
|
public class CameraController {
|
|
|
- @Value("${file.root-path}")
|
|
|
- private String path;
|
|
|
- @Value("${application.channel-name}")
|
|
|
- private String channel;
|
|
|
@Resource
|
|
|
private CameraFactory cameraFactory;
|
|
|
@Resource
|
|
|
private CameraPropertiesConfig cameraPropertiesConfig;
|
|
|
-
|
|
|
+ @Resource
|
|
|
+ private ServerProperties serverProperties;
|
|
|
|
|
|
@PostMapping("/recv")
|
|
|
public void recv(
|
|
@@ -40,7 +39,8 @@ public class CameraController {
|
|
|
// HttpServletRequest request
|
|
|
) throws IOException {
|
|
|
// String xmlStr = IOUtils.toString(request.getInputStream(), request.getCharacterEncoding());
|
|
|
-
|
|
|
+ String path=SystemObject.filePropertiesConfig.getRootPath();
|
|
|
+ String channelCode=SystemObject.applicationConfig.getChannelCode();
|
|
|
Map<String, Object> StringObjectMap = new HashMap<>();
|
|
|
Document document = XmlUtil.parseXml(xmlStr);
|
|
|
Element rootElement = XmlUtil.getRootElement(document);
|
|
@@ -62,15 +62,15 @@ public class CameraController {
|
|
|
EventDataManager.cacheData("boxNoList",boxNoMap);
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
+ String ipAddr =InetAddress.getLocalHost().getHostAddress()+":"+String.valueOf(serverProperties.getPort());
|
|
|
|
|
|
-
|
|
|
- String savePath=path+"/"+SystemObject.applicationConfig.getChannelCode()+"/"+ calendar.get(Calendar.YEAR)+(calendar.get(Calendar.MONTH)+1)+calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
-
|
|
|
+ String savePath=path+"/"+channelCode+"/"+ calendar.get(Calendar.YEAR)+(calendar.get(Calendar.MONTH)+1)+calendar.get(Calendar.DAY_OF_MONTH);
|
|
|
List<String> fList = new ArrayList();
|
|
|
List<String> bList = new ArrayList();
|
|
|
for (Map.Entry<String, Object> entry : conta.entrySet()) {
|
|
|
if(entry.getKey().contains("PIC")&& !StringUtils.isEmpty((String) entry.getValue())){
|
|
|
String filePath = FileUtils.downLoad((String) entry.getValue(),savePath);
|
|
|
+ filePath=filePath.replace(path,ipAddr+"/files");
|
|
|
// String base64 = FileUtils.getBase64FromImg(filePath);
|
|
|
if (entry.getKey().contains("CONTA_F")){
|
|
|
fList.add(filePath);
|