|
@@ -23,6 +23,7 @@ import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.huashe.common.exception.ServiceException;
|
|
@@ -52,6 +53,7 @@ import com.huashe.park.domain.entity.PileMachineInfo;
|
|
|
import com.huashe.park.domain.entity.ProjectInfo;
|
|
|
import com.huashe.park.infrastructure.cfg.forest.CADForestCfg;
|
|
|
import com.huashe.park.infrastructure.excel.ExcelHandle;
|
|
|
+import com.huashe.park.infrastructure.mqtt.CADService;
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
|
|
@@ -93,6 +95,9 @@ public class ConsUnitInfoServiceImpl implements IConsUnitInfoService {
|
|
|
@Autowired
|
|
|
private ExcelHandle excelHandle;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CADService cadService;
|
|
|
+
|
|
|
private final static String PROFILE = "/profile";
|
|
|
|
|
|
@Autowired
|
|
@@ -295,6 +300,15 @@ public class ConsUnitInfoServiceImpl implements IConsUnitInfoService {
|
|
|
writeFileToResponse(csvFile, response);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void upload(MultipartFile file) {
|
|
|
+ HttpRequest form = HttpRequest.post(cadForestCfg.getCadServer() + "/upload").form("dwg_file", file);
|
|
|
+ log.info(">>>>>>>>>>>>{}", form.toString());
|
|
|
+ String json = form.execute().body();
|
|
|
+ log.info(">>>>>>>>>>>>{}", json);
|
|
|
+ cadService.newTopic(file);
|
|
|
+ }
|
|
|
+
|
|
|
private void writeFileToResponse(File file, HttpServletResponse response) {
|
|
|
// 读取文件内容并写入响应输出流
|
|
|
try (FileInputStream fis = new FileInputStream(file); OutputStream os = response.getOutputStream()) {
|