Browse Source

Merge remote-tracking branch 'origin/develop' into develop

zishan-an 11 months ago
parent
commit
5d1593d365

+ 42 - 0
src/main/java/com/kexun/controller/BusinessController.java

@@ -27,6 +27,48 @@ public class BusinessController {
 
     @Autowired
     private CustomInfoService CustomInfoService;
+    @RequestMapping("getBusinessSize")
+    public Result getBusinessSize(@RequestBody String json) {
+        JSONObject req = JSON.parseObject(json);
+        int businessType = req.getIntValue("businessType");
+        List<BusinessInfo> list=null;
+        switch(businessType){
+            case 0:
+                list = BusinessService.queryBusinessList("'0'",null);
+                for (BusinessInfo businessInfo : list) {
+                    if (businessInfo.getStatus().equals("0")) {
+                        businessInfo.setStatus("待解析");
+                    }
+                }
+                break;
+            case 1:
+                list = BusinessService.queryBusinessList("'1','2'",null);
+                for (BusinessInfo businessInfo : list) {
+                    if (businessInfo.getStatus().equals("1")) {
+                        businessInfo.setStatus("解析完成");
+                    } else if (businessInfo.getStatus().equals("2")) {
+                        businessInfo.setStatus("白户");
+                    }
+                }
+                break;
+            case 2:
+                list = BusinessService.queryBusinessList("'3','4'",null);
+                for (BusinessInfo businessInfo : list) {
+                    if (businessInfo.getStatus().equals("3")) {
+                        businessInfo.setStatus("查询失败");
+                    } else if (businessInfo.getStatus().equals("4")) {
+                        businessInfo.setStatus("查询异常");
+                    }
+                }
+                break;
+
+        }
+        int businessSize= list.size();
+        JSONObject resJson = new JSONObject();
+        resJson.put("business_size", businessSize);
+        return Result.success("ok", resJson);
+    }
+
     @RequestMapping("businessList")
     public Result businessList(@RequestBody String json) {
         JSONObject req = JSON.parseObject(json);

+ 50 - 34
src/main/java/com/kexun/controller/ReportController.java

@@ -23,13 +23,28 @@ import java.util.List;
 public class ReportController {
 
 
+    /**
+     * 文件目录,解析后的文件目录
+     */
     @Value("${report.file.xmlSourcePath}")
-    private String filePath;
-
-
+    private String xmlSourcePath;
+    /**
+     * 文件目录,解析后的文件目录
+     */
+    @Value("${report.file.xmlTargetPath}")
+    private String xmlTargetPath;
+
+    /**
+     * 模型文件目标文件
+     */
     @Value("${report.file.modelTargetPath}")
     private String modelPath;
 
+    /**
+     * 存放JSON文件路径
+     */
+    @Value("${report.file.jsonTargetPath}")
+    private String jsonTargetPath;
 
     @Autowired
     private ReportFileService reportFileService;
@@ -45,11 +60,18 @@ public class ReportController {
     }
 
 
-
+    /**
+     * 文件下载
+     * @param filename
+     * @return
+     * @throws IOException
+     */
     @GetMapping("/download/{filename}")
     public Result downloadFile(@PathVariable("filename") String filename) throws IOException {
-        String downFilePath = filePath+ filename;
-
+        String downFilePath = xmlTargetPath + filename;
+        if (filename.endsWith(".txt")){
+            downFilePath = jsonTargetPath + filename;
+        }
         File file = new File(downFilePath);
         if (file.exists()) {
             byte[] fileContent = Files.readAllBytes(file.toPath());
@@ -58,13 +80,17 @@ public class ReportController {
             resJson.put("file", base64);
             return Result.success("ok", resJson);
         } else {
-
             return Result.error("文件不存在!");
         }
 
     }
 
-
+    /**
+     * 模型文件下载
+     * @param modname
+     * @return
+     * @throws IOException
+     */
     @GetMapping("/downloadMod/{modname}")
     public Result downloadMod(@PathVariable("modname") String modname) throws IOException {
         String downFilePath = modelPath+ modname;
@@ -84,19 +110,6 @@ public class ReportController {
 
     }
 
-//    @PostMapping("download")
-//    public Result  download(@RequestParam String fileName)  {
-//        System.out.println(fileName);
-//        reportService.download(fileName);
-//        return Result.success();
-//    }
-
-//    @PostMapping("downloadMod")
-//    public Result  downloadMod(@RequestParam String fileName)  {
-//        System.out.println(fileName);
-//        reportService.downloadMod(fileName);
-//        return Result.success();
-//    }
     @PostMapping("del")
     public Result del(@RequestBody String json) {
         JSONObject req = JSON.parseObject(json);
@@ -118,13 +131,20 @@ public class ReportController {
         else {
             reportFileEntity.setFileNameModel("");
         }
-        File file = new File(filePath+file_name);
+        File file = new File(xmlTargetPath +file_name);
         file.delete();
         reportFileService.saveOrUpdate(reportFileEntity);
         return Result.success();
     }
-    //原来的逻辑是新增,2024.1.2之后改为修改 如果没有文件,改为新增,方法需要重写
-    //目前仍需改:若已有文件,需将原有数据删除
+
+
+    /**
+     * 文件上传
+     * 原来的逻辑是新增,2024.1.2之后改为修改 如果没有文件,改为新增,方法需要重写
+     * 目前仍需改:若已有文件,需将原有数据删除
+     * @param json
+     * @return
+     */
     @PostMapping("fileReportAdd")
     public Result fileReportAdd(@RequestBody String json)
     {
@@ -132,13 +152,8 @@ public class ReportController {
         long headInfId=Long.valueOf(req.getString("headInfId")) ;
         long businessId=Long.valueOf(req.getString("businessId")) ;
         String s = req.getString("fileNameTxt");
-        System.out.println("chaciren");
-        System.out.println(headInfId);
         ReportFileEntity reportFileEntity = reportFileService.findByHeadInfId(headInfId);
         if(reportFileEntity==null) {
-//            System.out.println("chawuciren");
-//            System.out.println(headInfId);
-
             reportFileEntity = new ReportFileEntity();
             reportFileEntity.setHeadInfId(headInfId);
             reportFileEntity.setRptNo(req.getString("rptNo"));
@@ -153,26 +168,27 @@ public class ReportController {
             }
         }
         else {
-//            System.out.println("chayouciren");
-//            System.out.println(headInfId);
+            //1:xml文件
             if(req.getString("fileNameXml").equals("1")){
                 String fileXml =  reportFileEntity.getFileNameXml();
                 if(fileXml!=null){
-                    File file = new File(filePath+fileXml);
+                    File file = new File(xmlSourcePath +fileXml);
                     file.delete();
                 }
                 reportFileEntity.setFileNameXml(req.getString("file_name"));
+            //2:txt json文件
             } else if (req.getString("fileNameTxt").equals("1")) {
                 String fileTxt =  reportFileEntity.getFileNameTxt();
                 if(fileTxt!=null){
-                    File file = new File(filePath+fileTxt);
+                    File file = new File(jsonTargetPath +fileTxt);
                     file.delete();
                 }
                 reportFileEntity.setFileNameTxt(req.getString("file_name"));
             } else  {
+                //3、模型文件
                 String fileModel =  reportFileEntity.getFileNameModel();
                 if(fileModel!=null){
-                    File file = new File(filePath+fileModel);
+                    File file = new File(modelPath +fileModel);
                     file.delete();
                 }
                 reportFileEntity.setFileNameModel(req.getString("file_name"));