浏览代码

检测表 统一service

Eric 4 年之前
父节点
当前提交
5343746bc2

+ 3 - 49
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbJcxcController.java

@@ -1,13 +1,13 @@
 package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcbJcxc;
+import com.railway.business.catenary.domain.vo.JcebQueryVo;
 import com.railway.business.catenary.service.IBusJcbJcxcService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
 import com.railway.common.utils.DateUtils;
 import com.railway.common.utils.StringUtils;
-import com.railway.common.utils.poi.EasyExcelUtil;
 import com.railway.common.utils.poi.WordUtils;
 import com.railway.system.service.ISysFileService;
 import io.swagger.annotations.Api;
@@ -16,11 +16,9 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.time.LocalDate;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * @author zhangcaifeng
@@ -147,53 +145,9 @@ public class BusJcbJcxcController extends BaseController {
 
     @ApiOperation(value = "导出excel")
     @GetMapping(value = "exportExcel")
-    public AjaxResult exportExcel(BusJcbJcxc busJcbJcxc) {
-        List<BusJcbJcxc> list = busJcbJcxcService.getList(busJcbJcxc);
-        list = list.stream().map(x -> transData(x)).collect(Collectors.toList());
-        Map<String, Object> params = new HashMap<>();
-        String fileName = "交叉线岔检测(修)记录.xls";
-        String templateFileName = "excel/template/交叉线岔检测(修)记录.xls";
-        String localFilePath = new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
+    public AjaxResult exportExcel(JcebQueryVo query) {
+        String localFilePath = busJcbJcxcService.exportExcel(query);
         return sysFileService.uploadFile(localFilePath);
     }
 
-    private BusJcbJcxc transData(BusJcbJcxc x) {
-        x.setDcxh("18");
-        x.setXiangbie("检测");
-        if((Integer.parseInt(x.getXch()) & 1) == 1){
-            // xch奇数
-            if(x.getLgzzgc() != null) {
-                x.setXxfx(x.getLgzzgc());
-            } else {
-                x.setXxfx(x.getGzyfzgc());
-            }
-        } else {
-            // xch偶数
-            if(x.getLgzzgc() != null) {
-                x.setSxfx(x.getLgzzgc());
-            } else {
-                x.setSxfx(x.getGzyfzgc());
-            }
-        }
-        x.setWxj(StringUtils.YES_VALUE.equals(x.getWxj()) ? "无" : "有");
-        if(StringUtils.YES_VALUE.equals(x.getXcxzgazlg()) &&
-                StringUtils.YES_VALUE.equals(x.getHdjx()) &&
-                StringUtils.YES_VALUE.equals(x.getFhzzsq()) &&
-                StringUtils.YES_VALUE.equals(x.getDqssxx()) &&
-                StringUtils.YES_VALUE.equals(x.getLswst()) &&
-                StringUtils.YES_VALUE.equals(x.getXzgldydx()) &&
-                StringUtils.YES_VALUE.equals(x.getDxztlh()) &&
-                StringUtils.YES_VALUE.equals(x.getWxj()) &&
-                StringUtils.YES_VALUE.equals(x.getHddxxjzt()) &&
-                StringUtils.YES_VALUE.equals(x.getJcdxzt()) &&
-                StringUtils.YES_VALUE.equals(x.getDljxzt())
-        ) {
-            x.setGlbjzt("良好");
-        } else {
-            x.setGlbjzt("故障");
-        }
-        return x;
-
-    }
-
 }

+ 3 - 25
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbWjcxcController.java

@@ -1,6 +1,7 @@
 package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcbWjcxc;
+import com.railway.business.catenary.domain.vo.JcebQueryVo;
 import com.railway.business.catenary.service.IBusJcbWjcxcService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
@@ -18,7 +19,6 @@ import java.time.LocalDate;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.stream.Collectors;
 
 /**
  * @author zhangcaifeng
@@ -149,31 +149,9 @@ public class BusJcbWjcxcController extends BaseController {
 
     @ApiOperation(value = "导出excel")
     @GetMapping(value = "exportExcel")
-    public AjaxResult exportExcel(BusJcbWjcxc busJcbWjcxc) {
-        List<BusJcbWjcxc> list = busJcbWjcxcService.getList(busJcbWjcxc);
-        list = list.stream().map(x -> transData(x)).collect(Collectors.toList());
-        Map<String, Object> params = new HashMap<>();
-        String fileName = "无交叉线岔检测(修)记录.xls";
-        String templateFileName = "excel/template/无交叉线岔检测(修)记录.xls";
-        String localFilePath = new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
+    public AjaxResult exportExcel(JcebQueryVo query) {
+        String localFilePath = busJcbWjcxcService.exportExcel(query);
         return sysFileService.uploadFile(localFilePath);
     }
 
-    private BusJcbWjcxc transData(BusJcbWjcxc x) {
-        x.setXiangbie("检测");
-        if(StringUtils.YES_VALUE.equals(x.getZxwxjqzt()) ||
-                StringUtils.YES_VALUE.equals(x.getCxwxjqzt())
-        ) {
-            x.setYwxj("有");
-        } else {
-            x.setYwxj("无");
-        }
-        if(StringUtils.YES_VALUE.equals(x.getDljzt())){
-            x.setDljzt("良好");
-        } else {
-            x.setDljzt("故障");
-        }
-        return x;
-    }
-
 }

+ 7 - 30
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcebJddzController.java

@@ -1,31 +1,19 @@
 package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcebJddz;
-import com.railway.business.catenary.enums.JcebStatusEnum;
+import com.railway.business.catenary.domain.vo.JcebQueryVo;
 import com.railway.business.catenary.service.IBusJcebJddzService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
-import com.railway.common.utils.StringUtils;
-import com.railway.common.utils.poi.EasyExcelUtil;
 import com.railway.system.service.ISysFileService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 import javax.validation.Valid;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-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 java.util.List;
 
 /**
  * @author zhangcaifeng
@@ -99,20 +87,9 @@ public class BusJcebJddzController extends BaseController {
 
     @ApiOperation(value = "导出excel")
     @GetMapping(value = "exportExcel")
-    public AjaxResult exportExcel(BusJcebJddz busJcebJddz) {
-        List<BusJcebJddz> list = busJcebJddzService.getList(busJcebJddz);
-        Map<String, Object> params = new HashMap<>();
-        if(!list.isEmpty()) {
-            params.put("operator", list.get(0).getOperator());
-            if(JcebStatusEnum.COMPLETED.getCode().equals(list.get(0).getSubmitState()))
-                params.put("confirmUser", list.get(0).getUpdateBy());
-        }
-        list = list.stream()
-                .map(x -> {x.setSfhg(StringUtils.YES_VALUE.equals(x.getSfhg()) ? "合格" : "不合格"); return x;})
-                .collect(Collectors.toList());
-        String fileName = "接地电阻测量记录.xls";
-        String templateFileName = "excel/template/接地电阻测量记录.xls";
-        String localFilePath = new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
+    public AjaxResult exportExcel(JcebQueryVo query) {
+        String localFilePath = busJcebJddzService.exportExcel(query);
         return sysFileService.uploadFile(localFilePath);
     }
+
 }

+ 7 - 22
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcebXsjcjlController.java

@@ -1,28 +1,19 @@
 package com.railway.web.controller.business.catenary;
 
 import com.railway.business.catenary.domain.BusJcebXsjcjl;
+import com.railway.business.catenary.domain.vo.JcebQueryVo;
 import com.railway.business.catenary.service.IBusJcebXsjcjlService;
 import com.railway.common.core.controller.BaseController;
 import com.railway.common.core.domain.AjaxResult;
 import com.railway.common.core.page.TableDataInfo;
-import com.railway.common.utils.poi.EasyExcelUtil;
 import com.railway.system.service.ISysFileService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import javax.validation.Valid;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-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 java.util.List;
 
 /**
  * @author zhangcaifeng
@@ -96,15 +87,9 @@ public class BusJcebXsjcjlController extends BaseController {
 
     @ApiOperation(value = "导出excel")
     @GetMapping(value = "exportExcel")
-    public AjaxResult exportExcel(BusJcebXsjcjl busJcebXsjcjl) {
-        List<BusJcebXsjcjl> list = busJcebXsjcjlService.getList(busJcebXsjcjl);
-        Map<String, Object> params = new HashMap<>();
-        if(!list.isEmpty()) {
-            params.put("stationName", list.get(0).getStationName());
-        }
-        String fileName = "巡检记录.xls";
-        String templateFileName = "excel/template/巡检记录.xls";
-        String localFilePath = new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
+    public AjaxResult exportExcel(JcebQueryVo query) {
+        String localFilePath = busJcebXsjcjlService.exportExcel(query);
         return sysFileService.uploadFile(localFilePath);
     }
+
 }

+ 9 - 0
railway-business/src/main/java/com/railway/business/catenary/domain/BusJcbDmcgyq.java

@@ -90,4 +90,13 @@ public class BusJcbDmcgyq extends BusJcab{
     @ApiModelProperty(value = "用户id")
     private Long userId;
 
+    // 导出用
+    private String licheng;  // 里程
+
+    private String gyqNumber;  // 编号
+
+    private String ctl; // 磁通量
+
+
+
 }

+ 50 - 5
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcbJcxcServiceImpl.java

@@ -12,10 +12,14 @@ import com.railway.business.catenary.service.IBusJcbJcxcService;
 import com.railway.common.utils.SecurityUtils;
 import com.railway.common.utils.StringUtils;
 import com.railway.common.utils.poi.EasyExcelUtil;
-import java.util.List;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 /**
  * 检查表-交叉线岔
  *
@@ -135,10 +139,51 @@ public class BusJcbJcxcServiceImpl extends BusJcabServiceImpl implements IBusJcb
    */
   @Override
   public String exportExcel(JcebQueryVo query) {
-    List<BusJcbJcxc> list = busJcbJcxcMapper.getJcebList(query);
-    String fileName = "交叉线岔.xls";
-    String templateFileName = "excel/template/交叉线岔.xls";
-    return new EasyExcelUtil().writeExcel(fileName, templateFileName, list);
+      List<BusJcbJcxc> list = busJcbJcxcMapper.getJcebList(query);
+      list = list.stream().map(x -> transData(x)).collect(Collectors.toList());
+      Map<String, Object> params = new HashMap<>();
+      String fileName = "交叉线岔检测(修)记录.xls";
+      String templateFileName = "excel/template/交叉线岔检测(修)记录.xls";
+      return new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
+  }
+
+  private BusJcbJcxc transData(BusJcbJcxc x) {
+    x.setDcxh("18");
+    x.setXiangbie("检测");
+    if((Integer.parseInt(x.getXch()) & 1) == 1){
+      // xch奇数
+      if(x.getLgzzgc() != null) {
+        x.setXxfx(x.getLgzzgc());
+      } else {
+        x.setXxfx(x.getGzyfzgc());
+      }
+    } else {
+      // xch偶数
+      if(x.getLgzzgc() != null) {
+        x.setSxfx(x.getLgzzgc());
+      } else {
+        x.setSxfx(x.getGzyfzgc());
+      }
+    }
+    x.setWxj(StringUtils.YES_VALUE.equals(x.getWxj()) ? "无" : "有");
+    if(StringUtils.YES_VALUE.equals(x.getXcxzgazlg()) &&
+            StringUtils.YES_VALUE.equals(x.getHdjx()) &&
+            StringUtils.YES_VALUE.equals(x.getFhzzsq()) &&
+            StringUtils.YES_VALUE.equals(x.getDqssxx()) &&
+            StringUtils.YES_VALUE.equals(x.getLswst()) &&
+            StringUtils.YES_VALUE.equals(x.getXzgldydx()) &&
+            StringUtils.YES_VALUE.equals(x.getDxztlh()) &&
+            StringUtils.YES_VALUE.equals(x.getWxj()) &&
+            StringUtils.YES_VALUE.equals(x.getHddxxjzt()) &&
+            StringUtils.YES_VALUE.equals(x.getJcdxzt()) &&
+            StringUtils.YES_VALUE.equals(x.getDljxzt())
+    ) {
+      x.setGlbjzt("良好");
+    } else {
+      x.setGlbjzt("故障");
+    }
+    return x;
+
   }
 
   /**

+ 27 - 4
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcbWjcxcServiceImpl.java

@@ -12,10 +12,14 @@ import com.railway.business.catenary.service.IBusJcbWjcxcService;
 import com.railway.common.utils.SecurityUtils;
 import com.railway.common.utils.StringUtils;
 import com.railway.common.utils.poi.EasyExcelUtil;
-import java.util.List;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
 /**
  * 检查表-无交叉线岔
  *
@@ -136,9 +140,28 @@ public class BusJcbWjcxcServiceImpl extends BusJcabServiceImpl implements IBusJc
   @Override
   public String exportExcel(JcebQueryVo query) {
     List<BusJcbWjcxc> list = busJcbWjcxcMapper.getJcebList(query);
-    String fileName = "无交叉线岔.xls";
-    String templateFileName = "excel/template/无交叉线岔.xls";
-    return new EasyExcelUtil().writeExcel(fileName, templateFileName, list);
+    list = list.stream().map(x -> transData(x)).collect(Collectors.toList());
+    Map<String, Object> params = new HashMap<>();
+    String fileName = "无交叉线岔检测(修)记录.xls";
+    String templateFileName = "excel/template/无交叉线岔检测(修)记录.xls";
+    return new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
+  }
+
+  private BusJcbWjcxc transData(BusJcbWjcxc x) {
+    x.setXiangbie("检测");
+    if(StringUtils.YES_VALUE.equals(x.getZxwxjqzt()) ||
+            StringUtils.YES_VALUE.equals(x.getCxwxjqzt())
+    ) {
+      x.setYwxj("有");
+    } else {
+      x.setYwxj("无");
+    }
+    if(StringUtils.YES_VALUE.equals(x.getDljzt())){
+      x.setDljzt("良好");
+    } else {
+      x.setDljzt("故障");
+    }
+    return x;
   }
 
   /**

+ 9 - 2
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcebJddzServiceImpl.java

@@ -3,6 +3,7 @@ package com.railway.business.catenary.service.impl;
 import com.railway.business.baseinfo.service.IBaseStationService;
 import com.railway.business.catenary.domain.BusJcebJddz;
 import com.railway.business.catenary.domain.vo.JcebQueryVo;
+import com.railway.business.catenary.enums.JcebStatusEnum;
 import com.railway.business.catenary.mapper.BusJcebJddzMapper;
 import com.railway.business.catenary.service.IBusJcebJddzService;
 import com.railway.common.utils.StringUtils;
@@ -10,6 +11,8 @@ import com.railway.common.utils.poi.EasyExcelUtil;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
+
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -128,9 +131,13 @@ public class BusJcebJddzServiceImpl extends BusJcebServiceImpl<BusJcebJddz>
     List<BusJcebJddz> list = busJcebJddzMapper.getJcebList(query);
     Map<String, Object> params = new HashMap<>();
     if(!list.isEmpty()) {
-      params.put("mdh", list.get(0).getMdh());
-      params.put("stationName", list.get(0).getStationName());
+      params.put("operator", list.get(0).getOperator());
+      if(JcebStatusEnum.COMPLETED.getCode().equals(list.get(0).getSubmitState()))
+        params.put("confirmUser", list.get(0).getUpdateBy());
     }
+    list = list.stream()
+            .map(x -> {x.setSfhg(StringUtils.YES_VALUE.equals(x.getSfhg()) ? "合格" : "不合格"); return x;})
+            .collect(Collectors.toList());
     String fileName = "接地电阻测量记录.xls";
     String templateFileName = "excel/template/接地电阻测量记录.xls";
     return new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);

+ 5 - 7
railway-business/src/main/java/com/railway/business/catenary/service/impl/BusJcebXsjcjlServiceImpl.java

@@ -9,11 +9,12 @@ import com.railway.business.catenary.util.JcebQueryUtil;
 import com.railway.common.utils.SecurityUtils;
 import com.railway.common.utils.StringUtils;
 import com.railway.common.utils.poi.EasyExcelUtil;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 /**
  * @author zcf
@@ -125,11 +126,8 @@ public class BusJcebXsjcjlServiceImpl extends BusJcebServiceImpl<BusJcebXsjcjl>
     JcebQueryUtil.setBusJcebQuery(query);
     List<BusJcebXsjcjl> list = busJcebXsjcjlMapper.getJcebList(query);
     Map<String, Object> params = new HashMap<>();
-    if(!list.isEmpty()) {
-      params.put("stationName", list.get(0).getStationName());
-    }
-    String fileName = "全面检查记录.xls";
-    String templateFileName = "excel/template/全面检查记录.xls";
+    String fileName = "巡检记录.xls";
+    String templateFileName = "excel/template/巡检记录.xls";
     return new EasyExcelUtil().getExcel(params, list, templateFileName, fileName);
   }
 

二进制
railway-business/src/main/resources/excel/template/地磁感应器检测记录.xls