Przeglądaj źródła

交叉线岔 导出excel

Eric 4 lat temu
rodzic
commit
bb9a80dcc0

+ 40 - 0
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcbJcxcController.java

@@ -19,6 +19,7 @@ import java.time.LocalDate;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author zhangcaifeng
@@ -152,6 +153,7 @@ public class BusJcbJcxcController extends BaseController {
     @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";
@@ -159,4 +161,42 @@ public class BusJcbJcxcController extends BaseController {
         return sysFileService.uploadFile(localFilePath);
     }
 
+    private BusJcbJcxc transData(BusJcbJcxc x) {
+        x.setDcxh("18");
+        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;
+
+    }
+
 }

+ 10 - 0
railway-admin/src/main/java/com/railway/web/controller/business/catenary/BusJcebJddzController.java

@@ -1,10 +1,12 @@
 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.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;
@@ -13,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
 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;
@@ -102,7 +105,14 @@ public class BusJcebJddzController extends BaseController {
         if(!list.isEmpty()) {
             params.put("mdh", list.get(0).getMdh());
             params.put("stationName", list.get(0).getStationName());
+            params.put("operationDate", list.get(0).getOperationDate());
+            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);

+ 16 - 3
railway-business/src/main/java/com/railway/business/catenary/domain/BusJcbJcxc.java

@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.hibernate.validator.constraints.Length;
+
 /**
  * 检查表-交叉线岔
  * @author zcf 2021-10-18
@@ -27,9 +28,12 @@ public class BusJcbJcxc extends BusJcab{
     @ApiModelProperty(value = "工支1拉出值")
     private Integer gz1lcz;
 
-    @ApiModelProperty(value = "工支2/非支拉出值")
+    @ApiModelProperty(value = "工支2拉出值")
     private Integer gz2lcz;
 
+    @ApiModelProperty(value = "非支拉出值")
+    private Integer fzlcz;
+
     @ApiModelProperty(value = "直股拉出值")
     private Integer zglcz;
 
@@ -42,8 +46,8 @@ public class BusJcbJcxc extends BusJcab{
     @ApiModelProperty(value = "偏离值")
     private Integer plz;
 
-    @ApiModelProperty(value = "线岔限制管安装牢固 0是 1否")
-    @Length(min = 1, max = 1, message = "【线岔限制管安装牢固 0是 1否】长度必须介于 {min} 和 {max} 之间")
+    @ApiModelProperty(value = "线岔限制管安装牢固 1是 0否")
+    @Length(min = 1, max = 1, message = "【线岔限制管安装牢固 1是 0否】长度必须介于 {min} 和 {max} 之间")
     private String xcxzgazlg;
 
     @ApiModelProperty(value = "线岔限制管安装牢固-故障描述")
@@ -142,4 +146,13 @@ public class BusJcbJcxc extends BusJcab{
     @ApiModelProperty(value = "用户id")
     private Long userId;
 
+    // 以下非数据库字段,导出excel用到
+    private String dcxh;
+
+    private Integer sxfx; // 上行方向
+
+    private Integer xxfx; // 下行方向
+
+    private String glbjzt; // 各零部件状态
+
 }

BIN
railway-business/src/main/resources/excel/template/交叉线岔检测(修)记录.xls


BIN
railway-business/src/main/resources/excel/template/接地电阻测量记录.xls


+ 13 - 1
railway-business/src/main/resources/mapper/catenary/BusJcbJcxcMapper.xml

@@ -17,6 +17,7 @@
     <result column="check_date" property="checkDate"/>
     <result column="gz1lcz" property="gz1lcz"/>
     <result column="gz2lcz" property="gz2lcz"/>
+    <result column="fzlcz" property="fzlcz"/>
     <result column="zglcz" property="zglcz"/>
     <result column="qglcz" property="qglcz"/>
     <result column="ngj" property="ngj"/>
@@ -72,6 +73,7 @@
     t.check_date,
     t.gz1lcz,
     t.gz2lcz,
+    t.fzlcz,
     t.zglcz,
     t.qglcz,
     t.ngj,
@@ -140,6 +142,9 @@
       <if test='null != gz2lcz'>
         gz2lcz,
       </if>
+      <if test='null != fzlcz'>
+        fzlcz,
+      </if>
       <if test='null != zglcz'>
         zglcz,
       </if>
@@ -280,6 +285,9 @@
       <if test='null != gz2lcz'>
         #{gz2lcz},
       </if>
+      <if test='null != fzlcz'>
+        #{fzlcz},
+      </if>
       <if test='null != zglcz'>
         #{zglcz},
       </if>
@@ -414,6 +422,7 @@
       <if test='null != checkDate'>check_date = #{checkDate},</if>
       <if test='null != gz1lcz'>gz1lcz = #{gz1lcz},</if>
       <if test='null != gz2lcz'>gz2lcz = #{gz2lcz},</if>
+      <if test='null != gz2lcz'>fzlcz = #{fzlcz},</if>
       <if test='null != zglcz'>zglcz = #{zglcz},</if>
       <if test='null != qglcz'>qglcz = #{qglcz},</if>
       <if test='null != ngj'>ngj = #{ngj},</if>
@@ -466,7 +475,7 @@
 
   <select id="getLastRecord" resultMap="BaseResultMap">
     SELECT
-    a.gz1lcz, a.gz2lcz, a.zglcz, a.qglcz, a.ngj, a.plz, a.czjj, a.lgzzgc, a.gzyfzgc
+    a.gz1lcz, a.gz2lcz, a.fzlcz, a.zglcz, a.qglcz, a.ngj, a.plz, a.czjj, a.lgzzgc, a.gzyfzgc
     FROM bus_jcb_jcxc a,
     (
     select max(update_time) as lastTime
@@ -512,6 +521,9 @@
       <if test="gz2lcz!=null and gz2lcz!=''">
         and t.gz2lcz=#{gz2lcz}
       </if>
+      <if test="fzlcz!=null and fzlcz!=''">
+        and t.fzlcz=#{fzlcz}
+      </if>
       <if test="zglcz!=null and zglcz!=''">
         and t.zglcz=#{zglcz}
       </if>