Parcourir la source

Merge branch 'master' of http://git.iamsee.com/dunbai/railway

Eric il y a 4 ans
Parent
commit
474edea474
28 fichiers modifiés avec 742 ajouts et 564 suppressions
  1. 9 1
      pom.xml
  2. 6 3
      railway-admin/src/main/java/com/railway/web/controller/business/app/AppUpgradeController.java
  3. 11 13
      railway-admin/src/main/java/com/railway/web/controller/business/baseinfo/BusFjxgmdController.java
  4. 2 1
      railway-admin/src/main/java/com/railway/web/controller/business/baseinfo/BusPreventController.java
  5. 2 1
      railway-admin/src/main/java/com/railway/web/controller/business/baseinfo/BusSdtzController.java
  6. 2 0
      railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbBlqController.java
  7. 166 154
      railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbFdfxjyqController.java
  8. 25 5
      railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJlgzController.java
  9. 2 2
      railway-admin/src/main/resources/application-dev.yml
  10. 2 2
      railway-admin/src/main/resources/application-prod.yml
  11. 22 0
      railway-business/src/main/java/com/railway/business/app/domain/vo/AppUpgradeQuery.java
  12. 3 3
      railway-business/src/main/java/com/railway/business/baseinfo/mapper/BusFjxgmdMapper.java
  13. 3 3
      railway-business/src/main/java/com/railway/business/baseinfo/service/IBusFjxgmdService.java
  14. 13 22
      railway-business/src/main/java/com/railway/business/baseinfo/service/impl/BusFjxgmdServiceImpl.java
  15. 1 1
      railway-business/src/main/java/com/railway/business/catenary/domain/BusJcbBlq.java
  16. 11 0
      railway-business/src/main/java/com/railway/business/catenary/domain/vo/JlgzLineVo.java
  17. 13 0
      railway-business/src/main/java/com/railway/business/catenary/domain/vo/JlgzSubstationVo.java
  18. 7 2
      railway-business/src/main/java/com/railway/business/catenary/mapper/BusJlgzMapper.java
  19. 16 3
      railway-business/src/main/java/com/railway/business/catenary/service/IBusJlgzService.java
  20. 35 18
      railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJlgzServiceImpl.java
  21. BIN
      railway-business/src/main/resources/excel/template/关节式分相检测记录.xls
  22. BIN
      railway-business/src/main/resources/excel/template/分段绝缘器检测记录.xls
  23. 11 5
      railway-business/src/main/resources/mapper/catenary/BusJcbBlqMapper.xml
  24. 26 0
      railway-business/src/main/resources/mapper/catenary/BusJlgzMapper.xml
  25. 5 0
      railway-common/pom.xml
  26. 4 1
      railway-common/src/main/java/com/railway/common/utils/file/MimeTypeUtils.java
  27. 98 36
      railway-common/src/main/java/com/railway/common/utils/http/HttpUtils.java
  28. 247 288
      railway-common/src/main/java/com/railway/common/utils/poi/WordUtils.java

+ 9 - 1
pom.xml

@@ -9,7 +9,7 @@
   <version>1.0.0</version>
 
   <name>railway</name>
-  <description>管理系统</description>
+  <description>供电生产管理系统</description>
   <packaging>pom</packaging>
 
   <modules>
@@ -52,6 +52,7 @@
     <protobuf.version>3.19.1</protobuf.version>
     <log4j.version>2.15.0</log4j.version>
     <maven-plugin.version>2.6.1</maven-plugin.version>
+    <guava.version>30.0-jre</guava.version>
   </properties>
 
   <!-- 依赖声明 -->
@@ -203,6 +204,13 @@
         <version>${lombok.version}</version>
       </dependency>
 
+      <!-- guava -->
+      <dependency>
+        <groupId>com.google.guava</groupId>
+        <artifactId>guava</artifactId>
+        <version>${guava.version}</version>
+      </dependency>
+
       <!-- 打包插件 -->
       <dependency>
         <groupId>org.springframework.boot</groupId>

+ 6 - 3
railway-admin/src/main/java/com/railway/web/controller/business/app/AppUpgradeController.java

@@ -1,6 +1,7 @@
 package com.railway.web.controller.business.app;
 
 import com.railway.business.app.domain.AppUpgrade;
+import com.railway.business.app.domain.vo.AppUpgradeQuery;
 import com.railway.business.app.service.IAppUpgradeService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
@@ -72,18 +73,20 @@ public class AppUpgradeController extends BaseController {
 
   @ApiOperation(value = "APK更新版本检查")
   @GetMapping("/upgrade")
-  public AjaxResult upgrade(AppUpgrade appUpgrade) {
+  public AjaxResult upgrade(AppUpgradeQuery query) {
     AppUpgrade info = appUpgradeService.getNewestInfo();
     AjaxResult ajax = AjaxResult.success();
-    if (!info.getApkVersion().equals(appUpgrade.getApkVersion())) {
+    if (null != info && !info.getApkVersion().equals(query.getApkVersion())) {
       String android = "android";
       String url;
-      if (android.equals(appUpgrade.getOsType().toLowerCase())) {
+      if (android.equals(query.getOsType().toLowerCase())) {
         url = info.getUrl();
       } else {
         url = "https://www.baidu.com";
       }
       ajax.put("url", url);
+      ajax.put("apkVersion", info.getApkVersion());
+      ajax.put("description", info.getDescription());
     }
     return ajax;
   }

+ 11 - 13
railway-admin/src/main/java/com/railway/web/controller/business/baseinfo/BusFjxgmdController.java

@@ -2,7 +2,7 @@ package com.railway.web.controller.business.baseinfo;
 
 import com.railway.business.baseinfo.domain.BaseDeptStation;
 import com.railway.business.baseinfo.domain.BusFjxgmd;
-import com.railway.business.baseinfo.domain.vo.BusFjxgmdQueryVo;
+import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
 import com.railway.business.baseinfo.service.IBaseStationService;
 import com.railway.business.baseinfo.service.IBusFjxgmdService;
 import com.railway.common.core.controller.BaseController;
@@ -10,11 +10,15 @@ import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import java.util.ArrayList;
-
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
 import java.util.List;
@@ -80,15 +84,9 @@ public class BusFjxgmdController extends BaseController {
 
   @ApiOperation(value = "通过支柱信息获取对锚列表", notes = "通过支柱信息获取对锚列表,需要传查询条件", response = AjaxResult.class)
   @GetMapping("/getListByZz")
-  public TableDataInfo getListByZz(BusFjxgmdQueryVo busFjxgmdQueryVo) {
+  public TableDataInfo getListByZz(BusSmartQueryVo busSmartQueryVo) {
     startPage();
-    List<BusFjxgmd> list = new ArrayList<BusFjxgmd>();
-    if (busFjxgmdQueryVo != null && StringUtils.isNoneBlank(busFjxgmdQueryVo.getXingbie())
-        && busFjxgmdQueryVo.getLineId() != null) {
-      list = busFjxgmdService.getListByZz(busFjxgmdQueryVo);
-    } else {
-      list = busFjxgmdService.getList(new BusFjxgmd());
-    }
+    List<BusFjxgmd> list = busFjxgmdService.getListByZz(busSmartQueryVo);
     return getDataTable(list);
   }
 

+ 2 - 1
railway-admin/src/main/java/com/railway/web/controller/business/baseinfo/BusPreventController.java

@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -48,7 +49,7 @@ public class BusPreventController extends BaseController {
             if(list!=null&&list.size()==1){
                 busSmartQueryVo.setMarker(list.get(0).getMarker());
             }else{
-                return null;
+                return getDataTable(new ArrayList<>());
             }
         }
         if(busSmartQueryVo.getPillarArea()==null||busSmartQueryVo.getPillarArea().equals("")){

+ 2 - 1
railway-admin/src/main/java/com/railway/web/controller/business/baseinfo/BusSdtzController.java

@@ -15,6 +15,7 @@ import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
 import javax.validation.Valid;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -91,7 +92,7 @@ public class BusSdtzController extends BaseController {
       if(list!=null&&list.size()==1){
         busSmartQueryVo.setMarker(list.get(0).getMarker());
       }else{
-        return null;
+        return getDataTable(new ArrayList<>());
       }
     }
     if(busSmartQueryVo.getPillarArea()==null||busSmartQueryVo.getPillarArea().equals("")){

+ 2 - 0
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbBlqController.java

@@ -2,6 +2,7 @@ package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcbBlq;
 import com.railway.business.catenary.domain.vo.JcebQueryVo;
+import com.railway.business.catenary.enums.JcebStatusEnum;
 import com.railway.business.catenary.service.IBusJcbBlqService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
@@ -142,6 +143,7 @@ public class BusJcbBlqController extends BaseController {
     @ApiOperation(value = "导出excel")
     @GetMapping(value = "exportExcel")
     public AjaxResult exportExcel(JcebQueryVo query) {
+        query.setSubmitState(JcebStatusEnum.COMPLETED.getCode());
         String localFilePath = busJcbBlqService.exportExcel(query);
         return sysFileService.uploadFile(localFilePath);
     }

+ 166 - 154
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbFdfxjyqController.java

@@ -2,6 +2,7 @@ package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcbFdfxjyq;
 import com.railway.business.catenary.domain.vo.JcebQueryVo;
+import com.railway.business.catenary.enums.JcebStatusEnum;
 import com.railway.business.catenary.service.IBusJcbFdfxjyqService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
@@ -14,180 +15,191 @@ import com.railway.common.utils.poi.WordUtils;
 import com.railway.system.service.ISysFileService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import java.io.InputStream;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import javax.validation.Valid;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
 /**
  * @author wuhonghao
  */
+@Slf4j
 @Api(value = "rest/catenary/bus/jcb/fdfxjyq", tags = "检查表 - dxf分选绝缘器检查表 ")
 @RestController
 @Validated
 @RequestMapping(value = "business/catenary/bus/jcb/fdfxjyq")
 public class BusJcbFdfxjyqController extends BaseController {
 
-    private final IBusJcbFdfxjyqService busJcbFdfxjyqService;
-    private final ISysFileService sysFileService;
-
-    @Value("${railway.filePath}")
-    public String filePath;
-
-    public BusJcbFdfxjyqController(IBusJcbFdfxjyqService busJcbFdfxjyqService,
-        ISysFileService sysFileService) {
-        this.busJcbFdfxjyqService = busJcbFdfxjyqService;
-        this.sysFileService = sysFileService;
-    }
-
-    @ApiOperation(value = "新增")
-    @PostMapping("/add")
-    public AjaxResult add(@Validated @RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
-        //将文件转成base64
-        if(busJcbFdfxjyq.getPicUrl()!=null&&!"".equals(busJcbFdfxjyq.getPicUrl())){
-            MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(busJcbFdfxjyq.getPicUrl());
-            String path = sysFileService.uploadFile(multipartFile);
-            busJcbFdfxjyq.setPicUrl(path);
-        }
-        return toAjax(busJcbFdfxjyqService.create(busJcbFdfxjyq));
-    }
-
-    @ApiOperation(value = "删除")
-    @DeleteMapping("/{ids}")
-    public AjaxResult delete(@RequestParam String[] ids) {
-        return toAjax(busJcbFdfxjyqService.delete(ids));
-    }
-
-    @ApiOperation(value = "更新")
-    @PutMapping("/update")
-    public AjaxResult update(@RequestBody @Valid BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
-        //将文件转成base64
-        if(busJcbFdfxjyq.getPicUrl()!=null&&!"".equals(busJcbFdfxjyq.getPicUrl())){
-            MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(busJcbFdfxjyq.getPicUrl());
-            String path = sysFileService.uploadFile(multipartFile);
-            busJcbFdfxjyq.setPicUrl(path);
-        }
-        return toAjax(busJcbFdfxjyqService.update(busJcbFdfxjyq));
-    }
-
-    @ApiOperation(value = "单个")
-    @GetMapping(value = {"/", "/{id}"})
-    public AjaxResult getInfo(@PathVariable String id) {
-        BusJcbFdfxjyq info = busJcbFdfxjyqService.getInfo(id);
-        AjaxResult ajax = AjaxResult.success();
-        ajax.put("info",info);
-        return ajax;
-    }
-
-    @ApiOperation(value = "列表")
-    @GetMapping(value = "list")
-    public TableDataInfo getList(BusJcbFdfxjyq busJcbFdfxjyq) {
-        startPage();
-        List<BusJcbFdfxjyq> list = busJcbFdfxjyqService.getList(busJcbFdfxjyq);
-        return getDataTable(list);
+  private final IBusJcbFdfxjyqService busJcbFdfxjyqService;
+  private final ISysFileService sysFileService;
+
+  @Value("${railway.filePath}")
+  public String filePath;
+
+  public BusJcbFdfxjyqController(IBusJcbFdfxjyqService busJcbFdfxjyqService,
+      ISysFileService sysFileService) {
+    this.busJcbFdfxjyqService = busJcbFdfxjyqService;
+    this.sysFileService = sysFileService;
+  }
+
+  @ApiOperation(value = "新增")
+  @PostMapping("/add")
+  public AjaxResult add(@Validated @RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
+    //将文件转成base64
+    if (busJcbFdfxjyq.getPicUrl() != null && !"".equals(busJcbFdfxjyq.getPicUrl())) {
+      MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(
+          busJcbFdfxjyq.getPicUrl());
+      String path = sysFileService.uploadFile(multipartFile);
+      busJcbFdfxjyq.setPicUrl(path);
     }
-
-    @ApiOperation(value = "获取上次检测值")
-    @GetMapping(value = "getLastOne")
-    public AjaxResult getLastOne(BusJcbFdfxjyq busJcbFdfxjyq) {
-        BusJcbFdfxjyq info = busJcbFdfxjyqService.getLastOne(busJcbFdfxjyq);
-        AjaxResult ajax = AjaxResult.success();
-        ajax.put("info",info);
-        return ajax;
-    }
-
-    @ApiOperation(value = "提交")
-    @PutMapping("/submit")
-    public AjaxResult submit(@RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
-        busJcbFdfxjyq.setUpdateBy(getUsername());
-        //将文件转成base64
-        if(busJcbFdfxjyq.getPicUrl()!=null&&!"".equals(busJcbFdfxjyq.getPicUrl())){
-            MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(busJcbFdfxjyq.getPicUrl());
-            String path = sysFileService.uploadFile(multipartFile);
-            busJcbFdfxjyq.setPicUrl(path);
-        }
-        return toAjax(busJcbFdfxjyqService.submit(busJcbFdfxjyq));
-    }
-
-    @ApiOperation(value = "退回")
-    @PutMapping("/reject")
-    public AjaxResult reject(@RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
-        busJcbFdfxjyq.setUpdateBy(getUsername());
-        return toAjax(busJcbFdfxjyqService.reject(busJcbFdfxjyq));
-    }
-
-    @ApiOperation(value = "确认")
-    @PutMapping("/confirm")
-    public AjaxResult confirm(@RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
-        busJcbFdfxjyq.setUpdateBy(getUsername());
-        return toAjax(busJcbFdfxjyqService.confirm(busJcbFdfxjyq));
-    }
-
-    @ApiOperation(value = "导出")
-    @GetMapping("/export")
-    public AjaxResult export(@RequestParam String id) throws InterruptedException {
-        //获取基础数据
-        BusJcbFdfxjyq info = busJcbFdfxjyqService.getInfo(id);
-        WordUtils wordUtil=new WordUtils();
-        //填充变量
-        Map<String, Object> params = new HashMap<>();
-        params.put("${fdh}", info.getFdh());
-        params.put("${qj}", info.getStationName());
-        params.put("${jcrq}", DateUtils.parseCheckDate(info.getCheckDate()));
-        params.put("${wd}", info.getTemperature());
-        params.put("${jcr}", info.getCheckUser());
-        params.put("${pointB}", info.getPointB().toString());
-        params.put("${pointG}", info.getPointG().toString());
-        params.put("${fcd}", info.getFcd().toString());
-        params.put("${fddmpsd}", info.getFddmpsd().toString());
-        params.put("${jybjFdjyqzjyzt}", StringUtils.yesOrNo(info.getJybjFdjyqzjyzt()));
-        params.put("${jybjClsjyzzt}", StringUtils.yesOrNo(info.getJybjClsjyzzt()));
-        params.put("${lbjztLs}", StringUtils.yesOrNo(info.getLbjztLs()));
-        params.put("${lbjztXdx}", StringUtils.yesOrNo(info.getLbjztXdx()));
-        params.put("${lbjztPhzj}", StringUtils.yesOrNo(info.getLbjztPhzj()));
-        params.put("${lbjztJcxjt}", StringUtils.yesOrNo(info.getLbjztJcxjt()));
-        params.put("${lbjztXhj}", StringUtils.yesOrNo(info.getLbjztXhj()));
-        params.put("${sbzt}", StringUtils.YES_VALUE.equals(info.getSbzt()) ? "合格" : "不合格");
-        params.put("${xlfdXlpd}", info.getXlfdXlpd().toString());
-        params.put("${xlfdWgdg}", info.getXlfdWgdg().toString());
-        params.put("${xlfdFdsxlqj}", info.getXlfdFdsxlqj().toString());
-        params.put("${xlfdFdczxlqj}", info.getXlfdFdczxlqj().toString());
-        params.put("${sdgjcztSddg}", StringUtils.yesOrNo(info.getSdgjcztSddg()));
-        params.put("${confirmUser}", StringUtils.isEmpty(info.getConfirmUserRealName())?"":info.getConfirmUserRealName());
-        params.put("${czwt}", info.getCzwtAll());
-        //填充图片信息
-        Map<String,Object> header = new HashMap<>();
-        header.put("width", 450);
-        header.put("height", 110);
-        header.put("type", "jpg");
-        InputStream inputStream = HttpUtils.sendGetStream(info.getPicUrl(), "");
-        //解决网络传输造成流读取不全问题
-        Thread.sleep(200);
-        header.put("content", WordUtils.inputStream2ByteArray(inputStream, true));
-        params.put("${header}",header);
-
-
-
-        //生成word文件的文件名
-        String fileName = "DXF分段绝缘器手册.docx";
-        String template = "word/template/DXF分段绝缘器手册.docx";
-        String localFilePath = wordUtil.getWord(params, template, fileName);
-        return sysFileService.uploadFile(localFilePath);
-
+    return toAjax(busJcbFdfxjyqService.create(busJcbFdfxjyq));
+  }
+
+  @ApiOperation(value = "删除")
+  @DeleteMapping("/{ids}")
+  public AjaxResult delete(@RequestParam String[] ids) {
+    return toAjax(busJcbFdfxjyqService.delete(ids));
+  }
+
+  @ApiOperation(value = "更新")
+  @PutMapping("/update")
+  public AjaxResult update(@RequestBody @Valid BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
+    //将文件转成base64
+    if (busJcbFdfxjyq.getPicUrl() != null && !"".equals(busJcbFdfxjyq.getPicUrl())) {
+      MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(
+          busJcbFdfxjyq.getPicUrl());
+      String path = sysFileService.uploadFile(multipartFile);
+      busJcbFdfxjyq.setPicUrl(path);
     }
-
-
-    @ApiOperation(value = "导出excel")
-    @GetMapping(value = "exportExcel")
-    public AjaxResult exportExcel(JcebQueryVo query) {
-        String localFilePath = busJcbFdfxjyqService.exportExcel(query);
-        return sysFileService.uploadFile(localFilePath);
+    return toAjax(busJcbFdfxjyqService.update(busJcbFdfxjyq));
+  }
+
+  @ApiOperation(value = "单个")
+  @GetMapping(value = {"/", "/{id}"})
+  public AjaxResult getInfo(@PathVariable String id) {
+    BusJcbFdfxjyq info = busJcbFdfxjyqService.getInfo(id);
+    AjaxResult ajax = AjaxResult.success();
+    ajax.put("info", info);
+    return ajax;
+  }
+
+  @ApiOperation(value = "列表")
+  @GetMapping(value = "list")
+  public TableDataInfo getList(BusJcbFdfxjyq busJcbFdfxjyq) {
+    startPage();
+    List<BusJcbFdfxjyq> list = busJcbFdfxjyqService.getList(busJcbFdfxjyq);
+    return getDataTable(list);
+  }
+
+  @ApiOperation(value = "获取上次检测值")
+  @GetMapping(value = "getLastOne")
+  public AjaxResult getLastOne(BusJcbFdfxjyq busJcbFdfxjyq) {
+    BusJcbFdfxjyq info = busJcbFdfxjyqService.getLastOne(busJcbFdfxjyq);
+    AjaxResult ajax = AjaxResult.success();
+    ajax.put("info", info);
+    return ajax;
+  }
+
+  @ApiOperation(value = "提交")
+  @PutMapping("/submit")
+  public AjaxResult submit(@RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
+    busJcbFdfxjyq.setUpdateBy(getUsername());
+    //将文件转成base64
+    if (busJcbFdfxjyq.getPicUrl() != null && !"".equals(busJcbFdfxjyq.getPicUrl())) {
+      MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(
+          busJcbFdfxjyq.getPicUrl());
+      String path = sysFileService.uploadFile(multipartFile);
+      busJcbFdfxjyq.setPicUrl(path);
     }
+    return toAjax(busJcbFdfxjyqService.submit(busJcbFdfxjyq));
+  }
+
+  @ApiOperation(value = "退回")
+  @PutMapping("/reject")
+  public AjaxResult reject(@RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
+    busJcbFdfxjyq.setUpdateBy(getUsername());
+    return toAjax(busJcbFdfxjyqService.reject(busJcbFdfxjyq));
+  }
+
+  @ApiOperation(value = "确认")
+  @PutMapping("/confirm")
+  public AjaxResult confirm(@RequestBody BusJcbFdfxjyq busJcbFdfxjyq) throws Exception {
+    busJcbFdfxjyq.setUpdateBy(getUsername());
+    return toAjax(busJcbFdfxjyqService.confirm(busJcbFdfxjyq));
+  }
+
+  @ApiOperation(value = "导出")
+  @GetMapping("/export")
+  public AjaxResult export(@RequestParam String id) throws InterruptedException {
+    //获取基础数据
+    BusJcbFdfxjyq info = busJcbFdfxjyqService.getInfo(id);
+    WordUtils wordUtil = new WordUtils();
+    //填充变量
+    Map<String, Object> params = new HashMap<>();
+    params.put("${fdh}", info.getFdh());
+    params.put("${qj}", info.getStationName());
+    params.put("${jcrq}", DateUtils.parseCheckDate(info.getCheckDate()));
+    params.put("${wd}", info.getTemperature());
+    params.put("${jcr}", info.getCheckUser());
+    params.put("${pointB}", info.getPointB().toString());
+    params.put("${pointG}", info.getPointG().toString());
+    params.put("${fcd}", info.getFcd().toString());
+    params.put("${fddmpsd}", info.getFddmpsd().toString());
+    params.put("${jybjFdjyqzjyzt}", StringUtils.yesOrNo(info.getJybjFdjyqzjyzt()));
+    params.put("${jybjClsjyzzt}", StringUtils.yesOrNo(info.getJybjClsjyzzt()));
+    params.put("${lbjztLs}", StringUtils.yesOrNo(info.getLbjztLs()));
+    params.put("${lbjztXdx}", StringUtils.yesOrNo(info.getLbjztXdx()));
+    params.put("${lbjztPhzj}", StringUtils.yesOrNo(info.getLbjztPhzj()));
+    params.put("${lbjztJcxjt}", StringUtils.yesOrNo(info.getLbjztJcxjt()));
+    params.put("${lbjztXhj}", StringUtils.yesOrNo(info.getLbjztXhj()));
+    params.put("${sbzt}", StringUtils.YES_VALUE.equals(info.getSbzt()) ? "合格" : "不合格");
+    params.put("${xlfdXlpd}", info.getXlfdXlpd().toString());
+    params.put("${xlfdWgdg}", info.getXlfdWgdg().toString());
+    params.put("${xlfdFdsxlqj}", info.getXlfdFdsxlqj().toString());
+    params.put("${xlfdFdczxlqj}", info.getXlfdFdczxlqj().toString());
+    params.put("${sdgjcztSddg}", StringUtils.yesOrNo(info.getSdgjcztSddg()));
+    params.put("${confirmUser}",
+        StringUtils.isEmpty(info.getConfirmUserRealName()) ? "" : info.getConfirmUserRealName());
+    params.put("${czwt}", info.getCzwtAll());
+    //填充图片信息
+    Map<String, Object> header = new HashMap<>();
+    header.put("width", 450);
+    header.put("height", 110);
+    header.put("type", "jpg");
+    byte[] byteArray = HttpUtils.sendGetStream(info.getPicUrl());
+    log.info("byteArray.length - {}", byteArray.length);
+    header.put("content", byteArray);
+    log.info("header.size() - {}", header.size());
+    params.put("${header}", header);
+
+    //生成word文件的文件名
+    String fileName = "DXF分段绝缘器手册.docx";
+    String template = "word/template/DXF分段绝缘器手册.docx";
+    String localFilePath = wordUtil.getWord(params, template, fileName);
+    return sysFileService.uploadFile(localFilePath);
+
+  }
+
+  @ApiOperation(value = "导出excel")
+  @GetMapping(value = "exportExcel")
+  public AjaxResult exportExcel(JcebQueryVo query) {
+    query.setSubmitState(JcebStatusEnum.COMPLETED.getCode());
+    String localFilePath = busJcbFdfxjyqService.exportExcel(query);
+    return sysFileService.uploadFile(localFilePath);
+  }
 
 
 }

+ 25 - 5
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJlgzController.java

@@ -1,16 +1,17 @@
 package com.railway.web.controller.business.catenary;
 
+import com.railway.business.baseinfo.domain.BaseSubstation;
+import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
 import com.railway.business.catenary.domain.BusJlgz;
 import com.railway.business.catenary.domain.vo.BusJlgzListByZzVo;
-import com.railway.business.catenary.domain.vo.BusJlgzQueryVo;
+import com.railway.business.catenary.domain.vo.JlgzLineVo;
+import com.railway.business.catenary.domain.vo.JlgzSubstationVo;
 import com.railway.business.catenary.service.IBusJlgzService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import java.util.List;
-import javax.validation.Valid;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -21,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+import java.util.List;
+
 /**
  * @author fenghao
  */
@@ -73,11 +77,27 @@ public class BusJlgzController extends BaseController {
 
     @ApiOperation(value = "通过支柱信息获取历史故障统计", notes = "通过支柱信息获取历史故障统计", response = AjaxResult.class)
     @GetMapping("/getListByZz")
-    public AjaxResult getListByZz(BusJlgzQueryVo busJlgzQueryVo) {
-        List<BusJlgzListByZzVo> list = budJlgzService.getListByZz(busJlgzQueryVo);
+    public AjaxResult getListByZz(BusSmartQueryVo busSmartQueryVo) {
+        List<BusJlgzListByZzVo> list = budJlgzService.getListByZz(busSmartQueryVo);
         AjaxResult ajax = AjaxResult.success();
         ajax.put("info",list);
         return ajax;
     }
 
+    @ApiOperation(value = "获取记录故障线别")
+    @GetMapping("/getJlgzLine")
+    public TableDataInfo getJlgzLine() {
+        startPage();
+        List<JlgzLineVo> list = budJlgzService.getJlgzLine();
+        return getDataTable(list);
+    }
+
+    @ApiOperation(value = "获取记录故障所别")
+    @GetMapping("/getJlgzSubstation")
+    public TableDataInfo getJlgzSubstation(BaseSubstation baseSubstation) {
+        startPage();
+        List<JlgzSubstationVo> list = budJlgzService.getJlgzSubstation(baseSubstation.getLineId());
+        return getDataTable(list);
+    }
+
 }

+ 2 - 2
railway-admin/src/main/resources/application-dev.yml

@@ -46,9 +46,9 @@ spring:
   servlet:
     multipart:
       # 单个文件大小
-      max-file-size: 10MB
+      max-file-size: 50MB
       # 设置总上传的文件大小
-      max-request-size: 20MB
+      max-request-size: 100MB
   # 服务模块
   devtools:
     restart:

+ 2 - 2
railway-admin/src/main/resources/application-prod.yml

@@ -46,9 +46,9 @@ spring:
   servlet:
     multipart:
       # 单个文件大小
-      max-file-size: 10MB
+      max-file-size: 50MB
       # 设置总上传的文件大小
-      max-request-size: 20MB
+      max-request-size: 100MB
   # 服务模块
   devtools:
     restart:

+ 22 - 0
railway-business/src/main/java/com/railway/business/app/domain/vo/AppUpgradeQuery.java

@@ -0,0 +1,22 @@
+package com.railway.business.app.domain.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * apk版本升级表
+ *
+ * @author zhaomn 2021-12-13
+ */
+@Data
+@ApiModel("apk版本升级查询参数")
+public class AppUpgradeQuery {
+
+  @ApiModelProperty(value = "终端类型")
+  private String osType;
+
+  @ApiModelProperty(value = "apk版本")
+  private String apkVersion;
+
+}

+ 3 - 3
railway-business/src/main/java/com/railway/business/baseinfo/mapper/BusFjxgmdMapper.java

@@ -2,7 +2,7 @@ package com.railway.business.baseinfo.mapper;
 
 import com.github.pagehelper.Page;
 import com.railway.business.baseinfo.domain.BusFjxgmd;
-import com.railway.business.baseinfo.domain.vo.BusFjxgmdQueryVo;
+import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -44,8 +44,8 @@ public interface BusFjxgmdMapper {
 
     /**
      * 通过支柱信息获取对锚列表
-     * @param busFjxgmdQueryVo
+     * @param busSmartQueryVo
      * @return
      */
-    List<BusFjxgmd> getListByZz(@Param("query") BusFjxgmdQueryVo busFjxgmdQueryVo);
+    List<BusFjxgmd> getListByZz(@Param("query") BusSmartQueryVo busSmartQueryVo);
 }

+ 3 - 3
railway-business/src/main/java/com/railway/business/baseinfo/service/IBusFjxgmdService.java

@@ -1,7 +1,7 @@
 package com.railway.business.baseinfo.service;
 
 import com.railway.business.baseinfo.domain.BusFjxgmd;
-import com.railway.business.baseinfo.domain.vo.BusFjxgmdQueryVo;
+import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
 
 import java.util.List;
 
@@ -42,8 +42,8 @@ public interface IBusFjxgmdService {
 
     /**
      * 通过支柱信息获取对锚列表
-     * @param busFjxgmdQueryVo
+     * @param busSmartQueryVo
      * @return
      */
-    List<BusFjxgmd> getListByZz(BusFjxgmdQueryVo busFjxgmdQueryVo);
+    List<BusFjxgmd> getListByZz(BusSmartQueryVo busSmartQueryVo);
 }

+ 13 - 22
railway-business/src/main/java/com/railway/business/baseinfo/service/impl/BusFjxgmdServiceImpl.java

@@ -2,17 +2,16 @@ package com.railway.business.baseinfo.service.impl;
 
 import com.railway.business.baseinfo.domain.BusFjxgmd;
 import com.railway.business.baseinfo.domain.BusZzdzxx;
-import com.railway.business.baseinfo.domain.vo.BusFjxgmdQueryVo;
 import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
-import com.railway.business.baseinfo.mapper.BusZzdzxxMapper;
-import com.railway.common.enums.DelFlagEnum;
 import com.railway.business.baseinfo.mapper.BusFjxgmdMapper;
+import com.railway.business.baseinfo.mapper.BusZzdzxxMapper;
 import com.railway.business.baseinfo.service.IBusFjxgmdService;
+import com.railway.common.enums.DelFlagEnum;
 import com.railway.common.utils.SecurityUtils;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 /**
@@ -87,28 +86,20 @@ public class BusFjxgmdServiceImpl implements IBusFjxgmdService{
 
     /**
      * 通过支柱信息获取对锚列表
-     * @param busFjxgmdQueryVo
+     * @param busSmartQueryVo
      * @return
      */
     @Override
-    public List<BusFjxgmd> getListByZz(BusFjxgmdQueryVo busFjxgmdQueryVo) {
-        if (StringUtils.isBlank(busFjxgmdQueryVo.getPillarArea())) {
-            busFjxgmdQueryVo.setPillarArea("500");
+    public List<BusFjxgmd> getListByZz(BusSmartQueryVo busSmartQueryVo) {
+        if (busSmartQueryVo.getPillarArea() == null) {
+            busSmartQueryVo.setPillarArea("500");
+        }
+        List<BusZzdzxx> zzList = busZzdzxxMapper.smartQuery(busSmartQueryVo);
+        if (zzList != null && zzList.size() == 1) {
+            return busFjxgmdMapper.getListByZz(busSmartQueryVo);
         }
-        // 有站场区间,支柱号 查询支柱公里标
-        if (StringUtils.isNoneBlank(busFjxgmdQueryVo.getPillarCode())
-            && busFjxgmdQueryVo.getStationId() != null) {
-            BusSmartQueryVo vo = new BusSmartQueryVo();
-            vo.setPillarCode(busFjxgmdQueryVo.getPillarCode());
-            vo.setStationId(busFjxgmdQueryVo.getStationId());
-            vo.setLineId(busFjxgmdQueryVo.getLineId());
-            vo.setXingbie(busFjxgmdQueryVo.getXingbie());
-            List<BusZzdzxx> zzList = busZzdzxxMapper.smartQuery(vo);
-            if (zzList != null && zzList.size() > 0) {
-                BusZzdzxx zz = zzList.get(0);
-                busFjxgmdQueryVo.setMarker(zz.getMarker());
-            }
+        else {
+            return new ArrayList<BusFjxgmd>();
         }
-        return busFjxgmdMapper.getListByZz(busFjxgmdQueryVo);
     }
 }

+ 1 - 1
railway-business/src/main/java/com/railway/business/catenary/domain/BusJcbBlq.java

@@ -123,7 +123,7 @@ public class BusJcbBlq extends BusJcab{
     }
 
     public String getJdx(){
-        if(blqjdztJddz!=null&&blqjdztJddz.compareTo(new BigDecimal("10"))==1){
+        if(blqjdztJddz!=null&&blqjdztJddz.compareTo(new BigDecimal("10"))==-1){
             return "良好";
         }else{
             return "故障";

+ 11 - 0
railway-business/src/main/java/com/railway/business/catenary/domain/vo/JlgzLineVo.java

@@ -0,0 +1,11 @@
+package com.railway.business.catenary.domain.vo;
+
+import lombok.Data;
+
+@Data
+public class JlgzLineVo {
+
+  private Long lineId;
+  private String lineName;
+
+}

+ 13 - 0
railway-business/src/main/java/com/railway/business/catenary/domain/vo/JlgzSubstationVo.java

@@ -0,0 +1,13 @@
+package com.railway.business.catenary.domain.vo;
+
+import lombok.Data;
+
+@Data
+public class JlgzSubstationVo {
+
+  private Long substationId;
+  private String substationName;
+  private Long lineId;
+  private String lineName;
+
+}

+ 7 - 2
railway-business/src/main/java/com/railway/business/catenary/mapper/BusJlgzMapper.java

@@ -1,9 +1,11 @@
 package com.railway.business.catenary.mapper;
 
 import com.github.pagehelper.Page;
+import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
 import com.railway.business.catenary.domain.BusJlgz;
 import com.railway.business.catenary.domain.vo.BusJlgzListByZzVo;
-import com.railway.business.catenary.domain.vo.BusJlgzQueryVo;
+import com.railway.business.catenary.domain.vo.JlgzLineVo;
+import com.railway.business.catenary.domain.vo.JlgzSubstationVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -44,6 +46,9 @@ public interface BusJlgzMapper {
     */
     Page<BusJlgz> getList(BusJlgz busJlgz);
 
-    List<BusJlgzListByZzVo> getListByZz(@Param("query") BusJlgzQueryVo busJlgzQueryVo);
+    List<BusJlgzListByZzVo> getListByZz(@Param("query") BusSmartQueryVo busSmartQueryVo);
 
+    List<JlgzLineVo> getJlgzLine();
+
+    List<JlgzSubstationVo> getJlgzSubstation(Long lineId);
 }

+ 16 - 3
railway-business/src/main/java/com/railway/business/catenary/service/IBusJlgzService.java

@@ -1,8 +1,10 @@
 package com.railway.business.catenary.service;
 
+import com.railway.business.baseinfo.domain.vo.BusSmartQueryVo;
 import com.railway.business.catenary.domain.BusJlgz;
 import com.railway.business.catenary.domain.vo.BusJlgzListByZzVo;
-import com.railway.business.catenary.domain.vo.BusJlgzQueryVo;
+import com.railway.business.catenary.domain.vo.JlgzLineVo;
+import com.railway.business.catenary.domain.vo.JlgzSubstationVo;
 
 import java.util.List;
 /**
@@ -39,9 +41,20 @@ public interface IBusJlgzService {
 
     /**
      * 智能查询-历史故障统计
-     * @param busJlgzQueryVo
+     * @param busSmartQueryVo
      * @return
      */
-    List<BusJlgzListByZzVo> getListByZz(BusJlgzQueryVo busJlgzQueryVo);
+    List<BusJlgzListByZzVo> getListByZz(BusSmartQueryVo busSmartQueryVo);
 
+    /**
+     * 获取记录故障的线别
+     * @return
+     */
+    List<JlgzLineVo> getJlgzLine();
+
+    /**
+     * 获取记录故障的所别
+     * @param lineId
+     */
+    List<JlgzSubstationVo> getJlgzSubstation(Long lineId);
 }

+ 35 - 18
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJlgzServiceImpl.java

@@ -6,18 +6,22 @@ import com.railway.business.baseinfo.mapper.BusZzdzxxMapper;
 import com.railway.business.catenary.domain.BusJlgz;
 import com.railway.business.catenary.domain.BusJlgzPic;
 import com.railway.business.catenary.domain.vo.BusJlgzListByZzVo;
-import com.railway.business.catenary.domain.vo.BusJlgzQueryVo;
+import com.railway.business.catenary.domain.vo.JlgzLineVo;
+import com.railway.business.catenary.domain.vo.JlgzSubstationVo;
 import com.railway.business.catenary.mapper.BusJlgzMapper;
 import com.railway.business.catenary.mapper.BusJlgzPicMapper;
 import com.railway.business.catenary.service.IBusJlgzService;
+import com.railway.common.core.domain.entity.SysDictData;
 import com.railway.common.enums.DelFlagEnum;
 import com.railway.common.utils.SecurityUtils;
 import com.railway.common.utils.StringUtils;
 import com.railway.common.utils.sql.SqlUtil;
+import com.railway.system.mapper.SysDictDataMapper;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 /**
@@ -32,11 +36,13 @@ public class BusJlgzServiceImpl implements IBusJlgzService {
 	private final BusJlgzMapper busJlgzMapper;
 	private final BusJlgzPicMapper busJlgzPicMapper;
 	private final BusZzdzxxMapper busZzdzxxMapper;
+	private final SysDictDataMapper sysDictDataMapper;
 
-	public BusJlgzServiceImpl(BusJlgzMapper busJlgzMapper, BusJlgzPicMapper busJlgzPicMapper, BusZzdzxxMapper busZzdzxxMapper) {
+	public BusJlgzServiceImpl(BusJlgzMapper busJlgzMapper, BusJlgzPicMapper busJlgzPicMapper, BusZzdzxxMapper busZzdzxxMapper, SysDictDataMapper sysDictDataMapper) {
 		this.busJlgzMapper = busJlgzMapper;
 		this.busJlgzPicMapper = busJlgzPicMapper;
 		this.busZzdzxxMapper = busZzdzxxMapper;
+		this.sysDictDataMapper = sysDictDataMapper;
 	}
 
 	/**
@@ -150,24 +156,35 @@ public class BusJlgzServiceImpl implements IBusJlgzService {
 	}
 
 	@Override
-	public List<BusJlgzListByZzVo> getListByZz(BusJlgzQueryVo busJlgzQueryVo) {
-		if (busJlgzQueryVo.getPillarArea() == null) {
-			busJlgzQueryVo.setPillarArea("500");
+	public List<BusJlgzListByZzVo> getListByZz(BusSmartQueryVo busSmartQueryVo) {
+		if (busSmartQueryVo.getPillarArea() == null) {
+			busSmartQueryVo.setPillarArea("500");
 		}
-		// 有站场区间,支柱号 查询支柱公里标
-		if (StringUtils.isNoneBlank(busJlgzQueryVo.getPillarCode())
-				&& busJlgzQueryVo.getStationId() != null) {
-			BusSmartQueryVo vo = new BusSmartQueryVo();
-			vo.setPillarCode(busJlgzQueryVo.getPillarCode());
-			vo.setStationId(busJlgzQueryVo.getStationId());
-			vo.setLineId(busJlgzQueryVo.getLineId());
-			vo.setXingbie(busJlgzQueryVo.getXingbie());
-			List<BusZzdzxx> zzList = busZzdzxxMapper.smartQuery(vo);
-			if (zzList != null && zzList.size() > 0) {
-				BusZzdzxx zz = zzList.get(0);
-				busJlgzQueryVo.setMarker(zz.getMarker());
+		List<BusZzdzxx> zzList = busZzdzxxMapper.smartQuery(busSmartQueryVo);
+		if(zzList != null && zzList.size() == 1){
+			return busJlgzMapper.getListByZz(busSmartQueryVo);
+		}
+		else {
+			List<BusJlgzListByZzVo> list = new ArrayList<BusJlgzListByZzVo>();
+			List<SysDictData> gzyy = sysDictDataMapper.selectDictDataByType("gzyy");
+			for (SysDictData d : gzyy) {
+				BusJlgzListByZzVo vo = new BusJlgzListByZzVo();
+				vo.setYylx(d.getDictValue());
+				vo.setYylxText(d.getDictLabel());
+				vo.setTotal(0);
+				list.add(vo);
 			}
+			return list;
 		}
-		return busJlgzMapper.getListByZz(busJlgzQueryVo);
+	}
+
+	@Override
+	public List<JlgzLineVo> getJlgzLine() {
+		return busJlgzMapper.getJlgzLine();
+	}
+
+	@Override
+	public List<JlgzSubstationVo> getJlgzSubstation(Long lineId) {
+		return busJlgzMapper.getJlgzSubstation(lineId);
 	}
 }

BIN
railway-business/src/main/resources/excel/template/关节式分相检测记录.xls


BIN
railway-business/src/main/resources/excel/template/分段绝缘器检测记录.xls


+ 11 - 5
railway-business/src/main/resources/mapper/catenary/BusJcbBlqMapper.xml

@@ -352,19 +352,22 @@
 
   <select id="getInfo" resultMap="BaseResultMap">
     SELECT
-    <include refid="Base_Column_List"/>,u.real_name confirm_user_real_name
+    <include refid="Base_Column_List"/>,u.real_name confirm_user_real_name,base.sccj
     FROM bus_jcb_blq t
     LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
     LEFT JOIN sys_user u on t.confirm_user = u.user_name
+    LEFT JOIN (select DISTINCT pillar_code,sccj,dept_station_id from base_blq) base on (t.pillar_code = base.pillar_code and t.dept_station_id = base.dept_station_id)
     WHERE t.del_flag='0' and t.id = #{id}
 
   </select>
 
   <select id="getList" resultMap="BaseResultMap">
     SELECT
-    <include refid="Base_Column_List"/>
+    <include refid="Base_Column_List"/>,u.real_name confirm_user_real_name,base.sccj
     FROM bus_jcb_blq t
     LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
+    LEFT JOIN sys_user u on t.confirm_user = u.user_name
+    LEFT JOIN (select DISTINCT pillar_code,sccj,dept_station_id from base_blq) base on (t.pillar_code = base.pillar_code and t.dept_station_id = base.dept_station_id)
     <where>
       t.del_flag='0'
       <if test="blqId!=null and blqId!=''">
@@ -492,10 +495,12 @@
 
   <select id="getLastOne" resultMap="BaseResultMap">
     SELECT
-    <include refid="Base_Column_List"/>
+    <include refid="Base_Column_List"/>,u.real_name confirm_user_real_name,base.sccj
     FROM
     bus_jcb_blq t
     LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
+    LEFT JOIN sys_user u on t.confirm_user = u.user_name
+    LEFT JOIN (select DISTINCT pillar_code,sccj,dept_station_id from base_blq) base on (t.pillar_code = base.pillar_code and t.dept_station_id = base.dept_station_id)
     WHERE
     t.submit_state = '1'and t.del_flag = '0'
     <if test="stationId!=null and stationId!=''">
@@ -517,9 +522,10 @@
 
   <select id="getJcebList" resultMap="BaseResultMap">
     SELECT
-    <include refid="Base_Column_List"/>,base.sccj
+    <include refid="Base_Column_List"/>,u.real_name confirm_user_real_name,base.sccj
     FROM bus_jcb_blq t
-    LEFT JOIN base_blq base on t.pillar_code = base.pillar_code
+    LEFT JOIN sys_user u on t.confirm_user = u.user_name
+    LEFT JOIN (select DISTINCT pillar_code,sccj,dept_station_id from base_blq) base on (t.pillar_code = base.pillar_code and t.dept_station_id = base.dept_station_id)
     LEFT JOIN v_station v on t.dept_station_id = v.dept_station_id
     <where>
       t.del_flag='0'

+ 26 - 0
railway-business/src/main/resources/mapper/catenary/BusJlgzMapper.xml

@@ -267,4 +267,30 @@
     where dictYylx.dict_type = 'gzyy'
     order by ifnull(res.total,0) desc, dictYylx.dict_sort
   </select>
+
+  <select id="getJlgzLine" resultType="com.railway.business.catenary.domain.vo.JlgzLineVo">
+    SELECT
+      line_id AS lineId,
+      line_name AS lineName
+    FROM
+      v_substation
+    GROUP BY line_id
+    ORDER BY line_id
+  </select>
+
+  <select id="getJlgzSubstation" resultType="com.railway.business.catenary.domain.vo.JlgzSubstationVo">
+    SELECT
+      line_id AS lineId,
+      line_name AS lineName,
+      substation_id AS substationId,
+      substation_name AS substationName
+    FROM
+      v_substation
+    <where>
+      <if test="lineId!=null and lineId!=''">
+        line_id = #{lineId}
+      </if>
+    </where>
+    ORDER BY line_id
+  </select>
 </mapper>

+ 5 - 0
railway-common/pom.xml

@@ -142,6 +142,11 @@
       <artifactId>swagger-annotations</artifactId>
     </dependency>
 
+    <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+
   </dependencies>
 
 </project>

+ 4 - 1
railway-common/src/main/java/com/railway/common/utils/file/MimeTypeUtils.java

@@ -37,7 +37,10 @@ public class MimeTypeUtils {
       // 视频格式
       "mp4", "avi", "rmvb",
       // pdf
-      "pdf"};
+      "pdf",
+      // apk
+      "apk"
+  };
 
   public static String getExtension(String prefix) {
     switch (prefix) {

+ 98 - 36
railway-common/src/main/java/com/railway/common/utils/http/HttpUtils.java

@@ -1,17 +1,22 @@
 package com.railway.common.utils.http;
 
 import com.railway.common.constant.Constants;
+import com.railway.common.utils.StringUtils;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.net.ConnectException;
+import java.net.HttpURLConnection;
 import java.net.SocketTimeoutException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.nio.charset.StandardCharsets;
 import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.HttpsURLConnection;
 import javax.net.ssl.SSLContext;
@@ -50,26 +55,17 @@ public class HttpUtils {
   public static String sendGet(String url, String param, String contentType) {
     StringBuilder result = new StringBuilder();
     BufferedReader in = null;
+    InputStream is = sendGetStream(url, param);
+    if (null == is) {
+      return null;
+    }
     try {
-      String urlNameString = url + "?" + param;
-      log.info("sendGet - {}", urlNameString);
-      URL realUrl = new URL(urlNameString);
-      URLConnection connection = realUrl.openConnection();
-      connection.setRequestProperty("accept", "*/*");
-      connection.setRequestProperty("connection", "Keep-Alive");
-      connection.setRequestProperty("user-agent",
-              "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
-      connection.connect();
-      in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType));
+      in = new BufferedReader(new InputStreamReader(is, contentType));
       String line;
       while ((line = in.readLine()) != null) {
         result.append(line);
       }
       log.info("recv - {}", result);
-    } catch (ConnectException e) {
-      log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
-    } catch (SocketTimeoutException e) {
-      log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e);
     } catch (IOException e) {
       log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e);
     } catch (Exception e) {
@@ -86,6 +82,19 @@ public class HttpUtils {
     return result.toString();
   }
 
+  /**
+   * 向指定 URL 发送GET方法的请求
+   *
+   * @param url 发送请求的 URL
+   * @return 所代表远程资源的响应结果
+   */
+  public static byte [] sendGetStream(String url) {
+    InputStream in = sendGetStream(url, null);
+    if(null == in){
+      return new byte[0];
+    }
+    return inputStream2ByteArray(in);
+  }
   /**
    * 向指定 URL 发送GET方法的请求
    *
@@ -94,20 +103,21 @@ public class HttpUtils {
    * @return 所代表远程资源的响应结果
    */
   public static InputStream sendGetStream(String url, String param) {
-    StringBuilder result = new StringBuilder();
-    BufferedReader in = null;
+    String urlNameString = url;
+    if (StringUtils.isNotEmpty(param)) {
+      urlNameString = url + "?" + param;
+    }
+    log.info("sendGet - {}", urlNameString);
     try {
-      String urlNameString = url + "?" + param;
-      log.info("sendGet - {}", urlNameString);
+      urlNameString = getRedirectUrl(urlNameString);
       URL realUrl = new URL(urlNameString);
       URLConnection connection = realUrl.openConnection();
       connection.setRequestProperty("accept", "*/*");
       connection.setRequestProperty("connection", "Keep-Alive");
       connection.setRequestProperty("user-agent",
-              "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+          "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
       connection.connect();
-      InputStream inputStream = connection.getInputStream();
-      return inputStream;
+      return connection.getInputStream();
     } catch (ConnectException e) {
       log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e);
     } catch (SocketTimeoutException e) {
@@ -116,19 +126,9 @@ public class HttpUtils {
       log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e);
     } catch (Exception e) {
       log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e);
-    } finally {
-      try {
-        if (in != null) {
-          in.close();
-        }
-      } catch (Exception ex) {
-        log.error("调用in.close Exception, url=" + url + ",param=" + param, ex);
-      }
     }
     return null;
   }
-
-
   /**
    * 向指定 URL 发送POST方法的请求
    *
@@ -147,7 +147,7 @@ public class HttpUtils {
       conn.setRequestProperty("accept", "*/*");
       conn.setRequestProperty("connection", "Keep-Alive");
       conn.setRequestProperty("user-agent",
-              "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+          "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
       conn.setRequestProperty("Accept-Charset", "utf-8");
       conn.setRequestProperty("contentType", "utf-8");
       conn.setDoOutput(true);
@@ -191,13 +191,13 @@ public class HttpUtils {
       log.info("sendSSLPost - {}", urlNameString);
       SSLContext sc = SSLContext.getInstance("SSL");
       sc.init(null, new TrustManager[]{new TrustAnyTrustManager()},
-              new java.security.SecureRandom());
+          new java.security.SecureRandom());
       URL console = new URL(urlNameString);
       HttpsURLConnection conn = (HttpsURLConnection) console.openConnection();
       conn.setRequestProperty("accept", "*/*");
       conn.setRequestProperty("connection", "Keep-Alive");
       conn.setRequestProperty("user-agent",
-              "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
+          "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
       conn.setRequestProperty("Accept-Charset", "utf-8");
       conn.setRequestProperty("contentType", "utf-8");
       conn.setDoOutput(true);
@@ -212,7 +212,7 @@ public class HttpUtils {
       while ((ret = br.readLine()) != null) {
         if (!"".equals(ret.trim())) {
           result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1),
-                  StandardCharsets.UTF_8));
+              StandardCharsets.UTF_8));
         }
       }
       log.info("recv - {}", result);
@@ -222,7 +222,7 @@ public class HttpUtils {
       log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e);
     } catch (SocketTimeoutException e) {
       log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param,
-              e);
+          e);
     } catch (IOException e) {
       log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e);
     } catch (Exception e) {
@@ -231,6 +231,62 @@ public class HttpUtils {
     return result.toString();
   }
 
+  /**
+   * 获取重定向地址
+   * @param path 原URL地址
+   * @return 重定向之后的地址
+   * @throws Exception 读写异常
+   */
+  private static String getRedirectUrl(String path) throws Exception {
+    HttpURLConnection conn = (HttpURLConnection) new URL(path)
+        .openConnection();
+    conn.setInstanceFollowRedirects(false);
+    conn.setConnectTimeout(5000);
+    String redirectUrl = conn.getHeaderField("Location");
+    if(null == redirectUrl){
+      redirectUrl = path;
+    }
+    return redirectUrl;
+  }
+
+
+  /**
+   * 将输入流中的数据写入字节数组
+   */
+  public static byte[] inputStream2ByteArray(InputStream in) {
+    List<byte[]> byteList = new ArrayList<>();
+    byte[] bytes = new byte[40960];
+    int len;
+    try {
+      while ((len = in.read(bytes)) != -1) {
+        byteList.add(Arrays.copyOfRange(bytes, 0, len));
+      }
+    }catch (IOException e) {
+      e.printStackTrace();
+    } finally {
+      try {
+        in.close();
+      } catch (Exception e2) {
+        e2.getStackTrace();
+      }
+    }
+    return concatAll(byteList);
+  }
+
+  public static byte[] concatAll(List<byte []> rest) {
+    int totalLength = 0;
+    for (byte[] array : rest) {
+      totalLength += array.length;
+    }
+    byte[] result = new byte[totalLength];
+    int offset = 0;
+    for (byte[] array : rest) {
+      System.arraycopy(array, 0, result, offset, array.length);
+      offset += array.length;
+    }
+    return result;
+  }
+
   private static class TrustAnyTrustManager implements X509TrustManager {
 
     @Override
@@ -254,4 +310,10 @@ public class HttpUtils {
       return true;
     }
   }
+
+  public static void test(){
+    String url = "http://gdsc.svstrong.com/profile/2021/12/15/2254d969-a04f-4a46-888f-2d0a406678b0.png";
+    byte[] byteArray = HttpUtils.sendGetStream(url);
+    log.info("byteArray.length - {}", byteArray.length);
+  }
 }

+ 247 - 288
railway-common/src/main/java/com/railway/common/utils/poi/WordUtils.java

@@ -22,326 +22,285 @@ import org.apache.poi.xwpf.usermodel.XWPFTableRow;
 
 /*******************************************
  * 通过word模板生成新的word工具类
- * @Package com.railway.common.utils.poi
- * @Author wuhonghao
- * @Date 2021/10/16
+ * @author wuhonghao
+ * @date 2021/10/16
  *******************************************/
 public class WordUtils {
 
-    /**
-     * 根据模板生成word
-     * @param is     模板的路径
-     * @param params   需要替换的参数
-     * @param tableList   需要插入的参数
-     * @param fileName 生成word文件的文件名
-     * @param response 请求
-     */
-    public void getWord(InputStream is, Map<String, Object> params, List<String[]> tableList, String fileName, HttpServletResponse response) throws Exception {
-        CustomXWPFDocument doc = new CustomXWPFDocument(is);
-        //替换文本里面的变量
-        this.replaceInPara(doc, params);
-        //替换表格里面的变量
-        this.replaceInTable(doc, params, tableList);
-        OutputStream os = response.getOutputStream();
-        response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
-        response.setHeader("Content-disposition", "attachment; filename=" + fileName);
-        doc.write(os);
-        this.close(os);
-        this.close(is);
-    }
+  /**
+   * 根据模板生成word
+   *
+   * @param is 模板的路径
+   * @param params 需要替换的参数
+   * @param tableList 需要插入的参数
+   * @param fileName 生成word文件的文件名
+   * @param response 请求
+   */
+  public void getWord(InputStream is, Map<String, Object> params, List<String[]> tableList,
+      String fileName, HttpServletResponse response) throws Exception {
+    CustomXWPFDocument doc = new CustomXWPFDocument(is);
+    //替换文本里面的变量
+    this.replaceInPara(doc, params);
+    //替换表格里面的变量
+    this.replaceInTable(doc, params, tableList);
+    OutputStream os = response.getOutputStream();
+    response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
+    response.setHeader("Content-disposition", "attachment; filename=" + fileName);
+    doc.write(os);
+    this.close(os);
+    this.close(is);
+  }
 
-    /**
-     * 根据模板生成word
-     * @param params   需要替换的参数
-     * @param template 模板位置
-     * @param wordName 生成word文件的文件名
-     */
-    public String getWord(Map<String, Object> params, String template, String wordName)  {
-        return getWord(params, null, template, wordName);
-    }
+  /**
+   * 根据模板生成word
+   *
+   * @param params 需要替换的参数
+   * @param template 模板位置
+   * @param wordName 生成word文件的文件名
+   */
+  public String getWord(Map<String, Object> params, String template, String wordName) {
+    return getWord(params, null, template, wordName);
+  }
 
-    /**
-     * 根据模板生成word
-     * @param params   需要替换的参数
-     * @param tableList   需要插入的参数
-     * @param template 模板位置
-     * @param wordName 生成word文件的文件名
-     */
-    public String getWord(Map<String, Object> params, List<String[]> tableList,
-        String template, String wordName)  {
-        String fileName = encodingFilename(wordName);
-        String filePath = FileUploadUtils.getAbsoluteFile(fileName);
-        try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(template);
-            CustomXWPFDocument doc = new CustomXWPFDocument(is);
-            OutputStream os = new FileOutputStream(filePath)){
-            //替换文本里面的变量
-            this.replaceInPara(doc, params);
-            //替换表格里面的变量
-            this.replaceInTable(doc, params, tableList);
-            doc.write(os);
-        } catch (IOException e) {
-            return null;
-        }
-        return filePath;
+  /**
+   * 根据模板生成word
+   *
+   * @param params 需要替换的参数
+   * @param tableList 需要插入的参数
+   * @param template 模板位置
+   * @param wordName 生成word文件的文件名
+   */
+  public String getWord(Map<String, Object> params, List<String[]> tableList,
+      String template, String wordName) {
+    String fileName = encodingFilename(wordName);
+    String filePath = FileUploadUtils.getAbsoluteFile(fileName);
+    try (InputStream is = Thread.currentThread().getContextClassLoader()
+        .getResourceAsStream(template);
+        CustomXWPFDocument doc = new CustomXWPFDocument(is);
+        OutputStream os = new FileOutputStream(filePath)) {
+      //替换文本里面的变量
+      this.replaceInPara(doc, params);
+      //替换表格里面的变量
+      this.replaceInTable(doc, params, tableList);
+      doc.write(os);
+    } catch (IOException e) {
+      return null;
     }
+    return filePath;
+  }
 
-    /**
-     * 编码文件名
-     */
-    public String encodingFilename(String filename) {
-        filename = UUID.randomUUID() + Constants.UNDERLINE + filename;
-        return filename;
-    }
+  /**
+   * 编码文件名
+   */
+  public String encodingFilename(String filename) {
+    filename = UUID.randomUUID() + Constants.UNDERLINE + filename;
+    return filename;
+  }
 
-    /**
-     * 替换段落里面的变量
-     * @param doc    要替换的文档
-     * @param params 参数
-     */
-    private void replaceInPara(CustomXWPFDocument doc, Map<String, Object> params) {
-        Iterator<XWPFParagraph> iterator = doc.getParagraphsIterator();
-        XWPFParagraph para;
-        while (iterator.hasNext()) {
-            para = iterator.next();
-            this.replaceInPara(para, params, doc);
-        }
+  /**
+   * 替换段落里面的变量
+   *
+   * @param doc 要替换的文档
+   * @param params 参数
+   */
+  private void replaceInPara(CustomXWPFDocument doc, Map<String, Object> params) {
+    Iterator<XWPFParagraph> iterator = doc.getParagraphsIterator();
+    XWPFParagraph para;
+    while (iterator.hasNext()) {
+      para = iterator.next();
+      this.replaceInPara(para, params, doc);
     }
+  }
 
-    /**
-     * 替换段落里面的变量
-     *
-     * @param para   要替换的段落
-     * @param params 参数
-     */
-    private void replaceInPara(XWPFParagraph para, Map<String, Object> params, CustomXWPFDocument doc) {
-        List<XWPFRun> runs;
-        Matcher matcher;
-        if (this.matcher(para.getParagraphText()).find()) {
-            runs = para.getRuns();
-            /*int start = -1;
-            int end = -1;
-            String str = "";
-            for (int i = 0; i < runs.size(); i++) {
-                XWPFRun run = runs.get(i);
-                String runText = run.toString();
-                str += runText;
-                if ('$' == runText.charAt(0) && '{' == runText.charAt(1)) {
-                    start = i;
-                }
-                if ((start != -1)) {
-                    str += runText;
-                }
-                if ('}' == runText.charAt(runText.length() - 1)) {
-                    if (start != -1) {
-                        end = i;
-                        break;
-                    }
-                }
-            }*/
-
-/*            for (int i = start; i <= end; i++) {
-                para.removeRun(i);
-                i--;
-                end--;
-            }*/
-            for (int i = 0; i < runs.size(); i++) {
-                XWPFRun run = runs.get(i);
-                String str = run.toString();
-                for (Map.Entry<String, Object> entry : params.entrySet()) {
-                    String key = entry.getKey();
-                    if (str.indexOf(key) != -1) {
-                        Object value = entry.getValue();
-                        if (value instanceof String) {
-                            str = str.replace(key, value.toString());
-                            //if(run.getText(0).equals(key)){
-                                run.setText(str, 0);
-                            //}
-
-                            //para.createRun().setText(str, 0);
-                            //para.insertNewRun(start).setText(str);
-                            break;
-                        } else if (value instanceof Map) {
-                            str = str.replace(key, "");
-                            Map pic = (Map) value;
-                            int width = Integer.parseInt(pic.get("width").toString());
-                            int height = Integer.parseInt(pic.get("height").toString());
-                            int picType = getPictureType(pic.get("type").toString());
-                            byte[] byteArray = (byte[]) pic.get("content");
-                            ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray);
-                            try {
-                                //int ind = doc.addPicture(byteInputStream,picType);
-                                //doc.createPicture(ind, width , height,para);
-                                String blipId = doc.addPictureData(byteInputStream, picType);
-                                doc.createPicture(run,blipId,doc.getAllPictures().size() - 1, width, height, para);
-                                run.setText(str, 0);
-                                //para.createRun().setText(str, 0);
-                                break;
-                            } catch (Exception e) {
-                                e.printStackTrace();
-                            }
-                        }
-                    }
-                }
+  /**
+   * 替换段落里面的变量
+   *
+   * @param para 要替换的段落
+   * @param params 参数
+   */
+  private void replaceInPara(XWPFParagraph para, Map<String, Object> params,
+      CustomXWPFDocument doc) {
+    List<XWPFRun> runs;
+    if (this.matcher(para.getParagraphText()).find()) {
+      runs = para.getRuns();
+      for (XWPFRun run : runs) {
+        String str = run.toString();
+        for (Map.Entry<String, Object> entry : params.entrySet()) {
+          String key = entry.getKey();
+          if (str.contains(key)) {
+            Object value = entry.getValue();
+            if (value instanceof String) {
+              str = str.replace(key, value.toString());
+              run.setText(str, 0);
+              break;
+            } else if (value instanceof Map) {
+              str = str.replace(key, "");
+              Map<String, Object> pic = (Map<String, Object>) value;
+              int width = Integer.parseInt(pic.get("width").toString());
+              int height = Integer.parseInt(pic.get("height").toString());
+              int picType = getPictureType(pic.get("type").toString());
+              byte[] byteArray = (byte[]) pic.get("content");
+              ByteArrayInputStream byteInputStream = new ByteArrayInputStream(
+                  byteArray);
+              try {
+                String blipId = doc.addPictureData(byteInputStream, picType);
+                doc.createPicture(run, blipId, doc.getAllPictures().size() - 1,
+                    width, height, para);
+                run.setText(str, 0);
+                break;
+              } catch (Exception e) {
+                e.printStackTrace();
+              }
             }
-
+          }
         }
+      }
     }
+  }
 
-
-    /**
-     * 为表格插入数据,行数不够添加新行
-     *
-     * @param table     需要插入数据的表格
-     * @param tableList 插入数据集合
-     */
-    private static void insertTable(XWPFTable table, List<String[]> tableList) {
-        //创建行,根据需要插入的数据添加新行,不处理表头
-        for (int i = 0; i < tableList.size(); i++) {
-            XWPFTableRow row = table.createRow();
-        }
-        //遍历表格插入数据
-        List<XWPFTableRow> rows = table.getRows();
-        int length = table.getRows().size();
-        for (int i = 1; i < length - 1; i++) {
-            XWPFTableRow newRow = table.getRow(i);
-            List<XWPFTableCell> cells = newRow.getTableCells();
-            for (int j = 0; j < cells.size(); j++) {
-                XWPFTableCell cell = cells.get(j);
-                String s = tableList.get(i - 1)[j];
-                cell.setText(s);
-            }
-        }
+  /**
+   * 为表格插入数据,行数不够添加新行
+   *
+   * @param table 需要插入数据的表格
+   * @param tableList 插入数据集合
+   */
+  private static void insertTable(XWPFTable table, List<String[]> tableList) {
+    //创建行,根据需要插入的数据添加新行,不处理表头
+    for (int i = 0; i < tableList.size(); i++) {
+      table.createRow();
+    }
+    //遍历表格插入数据
+    int length = table.getRows().size();
+    for (int i = 1; i < length - 1; i++) {
+      XWPFTableRow newRow = table.getRow(i);
+      List<XWPFTableCell> cells = newRow.getTableCells();
+      for (int j = 0; j < cells.size(); j++) {
+        XWPFTableCell cell = cells.get(j);
+        String s = tableList.get(i - 1)[j];
+        cell.setText(s);
+      }
     }
+  }
 
-    /**
-     * 替换表格里面的变量
-     * @param doc    要替换的文档
-     * @param params 参数
-     */
-    private void replaceInTable(CustomXWPFDocument doc, Map<String, Object> params, List<String[]> tableList) {
-        Iterator<XWPFTable> iterator = doc.getTablesIterator();
-        XWPFTable table;
-        List<XWPFTableRow> rows;
-        List<XWPFTableCell> cells;
-        List<XWPFParagraph> paras;
-        while (iterator.hasNext()) {
-            table = iterator.next();
-            if (table.getRows().size() > 1) {
-                //判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
-                if (this.matcher(table.getText()).find()) {
-                    rows = table.getRows();
-                    for (XWPFTableRow row : rows) {
-                        cells = row.getTableCells();
-                        for (XWPFTableCell cell : cells) {
-                            paras = cell.getParagraphs();
-                            for (XWPFParagraph para : paras) {
-                                this.replaceInPara(para, params, doc);
-                            }
-                        }
-                    }
-                } else {
-                    if(tableList!=null){
-                        insertTable(table, tableList);  //插入数据
-                    }
-                }
+  /**
+   * 替换表格里面的变量
+   *
+   * @param doc 要替换的文档
+   * @param params 参数
+   */
+  private void replaceInTable(CustomXWPFDocument doc, Map<String, Object> params,
+      List<String[]> tableList) {
+    Iterator<XWPFTable> iterator = doc.getTablesIterator();
+    XWPFTable table;
+    List<XWPFTableRow> rows;
+    List<XWPFTableCell> cells;
+    List<XWPFParagraph> paras;
+    while (iterator.hasNext()) {
+      table = iterator.next();
+      if (table.getRows().size() > 1) {
+        //判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
+        if (this.matcher(table.getText()).find()) {
+          rows = table.getRows();
+          for (XWPFTableRow row : rows) {
+            cells = row.getTableCells();
+            for (XWPFTableCell cell : cells) {
+              paras = cell.getParagraphs();
+              for (XWPFParagraph para : paras) {
+                this.replaceInPara(para, params, doc);
+              }
             }
+          }
+        } else {
+          if (tableList != null) {
+            //插入数据
+            insertTable(table, tableList);
+          }
         }
+      }
     }
+  }
 
 
-    /**
-     * 正则匹配字符串
-     *
-     * @param str
-     * @return
-     */
-    private Matcher matcher(String str) {
-        Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}", Pattern.CASE_INSENSITIVE);
-        Matcher matcher = pattern.matcher(str);
-        return matcher;
-    }
+  /**
+   * 正则匹配字符串
+   */
+  private Matcher matcher(String str) {
+    Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}", Pattern.CASE_INSENSITIVE);
+    return pattern.matcher(str);
+  }
 
 
-    /**
-     * 根据图片类型,取得对应的图片类型代码
-     *
-     * @param picType
-     * @return int
-     */
-    private static int getPictureType(String picType) {
-        int res = CustomXWPFDocument.PICTURE_TYPE_PICT;
-        if (picType != null) {
-            if (picType.equalsIgnoreCase("png")) {
-                res = CustomXWPFDocument.PICTURE_TYPE_PNG;
-            } else if (picType.equalsIgnoreCase("dib")) {
-                res = CustomXWPFDocument.PICTURE_TYPE_DIB;
-            } else if (picType.equalsIgnoreCase("emf")) {
-                res = CustomXWPFDocument.PICTURE_TYPE_EMF;
-            } else if (picType.equalsIgnoreCase("jpg") || picType.equalsIgnoreCase("jpeg")) {
-                res = CustomXWPFDocument.PICTURE_TYPE_JPEG;
-            } else if (picType.equalsIgnoreCase("wmf")) {
-                res = CustomXWPFDocument.PICTURE_TYPE_WMF;
-            }
-        }
-        return res;
+  /**
+   * 根据图片类型,取得对应的图片类型代码
+   *
+   * @return int
+   */
+  private static int getPictureType(String picType) {
+    int res = CustomXWPFDocument.PICTURE_TYPE_PICT;
+    if (picType != null) {
+      if ("png".equalsIgnoreCase(picType)) {
+        res = CustomXWPFDocument.PICTURE_TYPE_PNG;
+      } else if ("dib".equalsIgnoreCase(picType)) {
+        res = CustomXWPFDocument.PICTURE_TYPE_DIB;
+      } else if ("emf".equalsIgnoreCase(picType)) {
+        res = CustomXWPFDocument.PICTURE_TYPE_EMF;
+      } else if ("jpg".equalsIgnoreCase(picType) || "jpeg".equalsIgnoreCase(picType)) {
+        res = CustomXWPFDocument.PICTURE_TYPE_JPEG;
+      } else if ("wmf".equalsIgnoreCase(picType)) {
+        res = CustomXWPFDocument.PICTURE_TYPE_WMF;
+      }
     }
+    return res;
+  }
 
-    /**
-     * 将输入流中的数据写入字节数组
-     *
-     * @param in
-     * @return
-     */
-    public static byte[] inputStream2ByteArray(InputStream in, boolean isClose) {
-        byte[] byteArray = null;
+  /**
+   * 将输入流中的数据写入字节数组
+   */
+  public static byte[] inputStream2ByteArray(InputStream in, boolean isClose) {
+    byte[] byteArray = null;
+    try {
+      int total = in.available();
+      byteArray = new byte[total];
+      in.read(byteArray);
+    } catch (IOException e) {
+      e.printStackTrace();
+    } finally {
+      if (isClose) {
         try {
-            int total = in.available();
-            byteArray = new byte[total];
-            in.read(byteArray);
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-            if (isClose) {
-                try {
-                    in.close();
-                } catch (Exception e2) {
-                    e2.getStackTrace();
-                }
-            }
+          in.close();
+        } catch (Exception e2) {
+          e2.getStackTrace();
         }
-        return byteArray;
+      }
     }
+    return byteArray;
+  }
 
-
-    /**
-     * 关闭输入流
-     *
-     * @param is
-     */
-    private void close(InputStream is) {
-        if (is != null) {
-            try {
-                is.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
+  /**
+   * 关闭输入流
+   */
+  private void close(InputStream is) {
+    if (is != null) {
+      try {
+        is.close();
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
     }
+  }
 
-    /**
-     * 关闭输出流
-     *
-     * @param os
-     */
-    private void close(OutputStream os) {
-        if (os != null) {
-            try {
-                os.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
+  /**
+   * 关闭输出流
+   */
+  private void close(OutputStream os) {
+    if (os != null) {
+      try {
+        os.close();
+      } catch (IOException e) {
+        e.printStackTrace();
+      }
     }
+  }
 
 
 }