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