فهرست منبع

工作票统计导出

wangchangsheng 3 سال پیش
والد
کامیت
295064a541
22فایلهای تغییر یافته به همراه1071 افزوده شده و 253 حذف شده
  1. 2 2
      src/main/java/com/gyee/viewticket/MpGenerator.java
  2. 104 0
      src/main/java/com/gyee/viewticket/comm/base/ExcludeQueryWrapper.java
  3. 40 0
      src/main/java/com/gyee/viewticket/controller/viewticket/DatadictionaryController.java
  4. 18 15
      src/main/java/com/gyee/viewticket/controller/viewticket/EquoperationrecordController.java
  5. 38 0
      src/main/java/com/gyee/viewticket/controller/viewticket/WindfarmController.java
  6. 72 24
      src/main/java/com/gyee/viewticket/controller/viewticket/WorkticketController.java
  7. 20 0
      src/main/java/com/gyee/viewticket/mapper/ticket/DatadictionaryMapper.java
  8. 20 0
      src/main/java/com/gyee/viewticket/mapper/ticket/WindfarmMapper.java
  9. 11 0
      src/main/java/com/gyee/viewticket/mapper/ticket/WorkticketMapper.java
  10. 44 0
      src/main/java/com/gyee/viewticket/model/ticket/Datadictionary.java
  11. 77 0
      src/main/java/com/gyee/viewticket/model/ticket/Windfarm.java
  12. 41 0
      src/main/java/com/gyee/viewticket/service/impl/ticket/DatadictionaryServiceImpl.java
  13. 32 0
      src/main/java/com/gyee/viewticket/service/impl/ticket/WindfarmServiceImpl.java
  14. 100 24
      src/main/java/com/gyee/viewticket/service/impl/ticket/WorkticketServiceImpl.java
  15. 33 0
      src/main/java/com/gyee/viewticket/service/ticket/DatadictionaryService.java
  16. 26 0
      src/main/java/com/gyee/viewticket/service/ticket/WindfarmService.java
  17. 3 0
      src/main/java/com/gyee/viewticket/service/ticket/WorkriskpoolService.java
  18. 18 0
      src/main/java/com/gyee/viewticket/service/ticket/WorkticketService.java
  19. 3 1
      src/main/resources/application.yml
  20. 18 0
      src/main/resources/mapper/ticket/DatadictionaryMapper.xml
  21. 29 0
      src/main/resources/mapper/ticket/WindfarmMapper.xml
  22. 322 187
      src/main/resources/mapper/ticket/WorkticketMapper.xml

+ 2 - 2
src/main/java/com/gyee/viewticket/MpGenerator.java

@@ -28,7 +28,7 @@ public class MpGenerator {
     //作者
     private static String authorName = "admin";
     //要生成的表名
-    private static String[] tables = {"POLINE"};
+    private static String[] tables = {"WINDFARM"};
     //table前缀
     private static String prefix = "";
 
@@ -36,7 +36,7 @@ public class MpGenerator {
     private static DbType dbType = DbType.SQL_SERVER;
     //数据库配置四要素
     private static String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
-    private static String url = "jdbc:sqlserver://10.155.32.2:1433;DatabaseName=test";
+    private static String url = "jdbc:sqlserver://10.155.32.2:1433;DatabaseName=fdtest";
 //    private static String driverName = "com.mysql.jdbc.Driver";
 //    private static String url = "jdbc:mysql://localhost:3306/assemb?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false";
     private static String username = "sa";

+ 104 - 0
src/main/java/com/gyee/viewticket/comm/base/ExcludeQueryWrapper.java

@@ -0,0 +1,104 @@
+package com.gyee.viewticket.comm.base;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+
+import java.util.Collection;
+
+public class ExcludeQueryWrapper <T> extends QueryWrapper<T> {
+
+    @Override
+    public QueryWrapper<T> eq(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.eq(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> in(boolean condition, String column, Collection<?> val) {
+        condition = !(null == val || val.size() <= 0);
+//        condition = !ObjectUtils.isEmpty(val);
+        return super.in(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> ne(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.ne(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> gt(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.gt(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> ge(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.ge(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> lt(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.lt(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> le(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.le(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> like(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.like(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> notLike(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.notLike(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> likeLeft(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.likeLeft(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> likeRight(boolean condition, String column, Object val) {
+        condition = !ObjectUtils.isEmpty(val);
+        return super.likeRight(condition, column, val);
+    }
+
+    @Override
+    public QueryWrapper<T> between(boolean condition, String column, Object val1, Object val2) {
+        if (ObjectUtils.isEmpty(val1) && ObjectUtils.isEmpty(val2)) {
+            condition = false;
+        } else if (ObjectUtils.isEmpty(val1)) {
+            return super.lt(true, column, val2);
+        } else if (ObjectUtils.isEmpty(val2)) {
+            return super.ge(true, column, val1);
+        }
+        return super.between(condition, column, val1, val2);
+    }
+
+    @Override
+    public QueryWrapper<T> notBetween(boolean condition, String column, Object val1, Object val2) {
+        if (ObjectUtils.isEmpty(val1) && ObjectUtils.isEmpty(val2)) {
+            condition = false;
+        } else if (ObjectUtils.isEmpty(val1)) {
+            return super.lt(true, column, val2);
+        } else if (ObjectUtils.isEmpty(val2)) {
+            return super.ge(true, column, val1);
+        }
+        return super.notBetween(condition, column, val1, val2);
+    }
+
+
+
+
+}

+ 40 - 0
src/main/java/com/gyee/viewticket/controller/viewticket/DatadictionaryController.java

@@ -0,0 +1,40 @@
+package com.gyee.viewticket.controller.viewticket;
+
+
+import com.gyee.viewticket.comm.domain.AjaxResult;
+import com.gyee.viewticket.model.ticket.Datadictionary;
+import com.gyee.viewticket.model.ticket.Windfarm;
+import com.gyee.viewticket.service.ticket.DatadictionaryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@RestController
+@RequestMapping("/datadictionary")
+public class DatadictionaryController {
+
+
+    @Autowired
+    private DatadictionaryService datadictionaryService;
+
+    @GetMapping(value = "gettypelist")
+    public AjaxResult getTypelistList(String type) {
+        List<Datadictionary> list = datadictionaryService.getTypelistList(type);
+
+        return AjaxResult.successData(list);
+    }
+
+}
+

+ 18 - 15
src/main/java/com/gyee/viewticket/controller/viewticket/EquoperationrecordController.java

@@ -79,21 +79,21 @@ public class EquoperationrecordController {
             if (null == stId || "0".equals(stId.trim())) {
                 stId = "";
             }
-            if ( null ==beginDate || "".equals(beginDate.trim()) || null == endDate || "".equals(endDate.trim())){
-                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                Calendar calendar = Calendar.getInstance();
-                // 时
-                calendar.set(Calendar.HOUR_OF_DAY, 0);
-                // 分
-                calendar.set(Calendar.MINUTE, 0);
-                // 秒
-                calendar.set(Calendar.SECOND, 0);
-                // 毫秒
-                calendar.set(Calendar.MILLISECOND, 0);
-                beginDate =  sdf.format(calendar.getTime());
-                calendar.add(Calendar.DATE,1);
-                endDate = sdf.format(calendar.getTime());
-            }
+//            if ( null ==beginDate || "".equals(beginDate.trim()) || null == endDate || "".equals(endDate.trim())){
+//                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//                Calendar calendar = Calendar.getInstance();
+//                // 时
+//                calendar.set(Calendar.HOUR_OF_DAY, 0);
+//                // 分
+//                calendar.set(Calendar.MINUTE, 0);
+//                // 秒
+//                calendar.set(Calendar.SECOND, 0);
+//                // 毫秒
+//                calendar.set(Calendar.MILLISECOND, 0);
+//                beginDate =  sdf.format(calendar.getTime());
+//                calendar.add(Calendar.DATE,1);
+//                endDate = sdf.format(calendar.getTime());
+//            }
             List<Map> list = equoperationrecordService.getEquoperationrecordTope(stId, wtId, beginDate, endDate);
             return AjaxResult.successData(list);
         } catch (Exception e) {
@@ -107,6 +107,9 @@ public class EquoperationrecordController {
     @GetMapping(value = "equupdatecount")
     public AjaxResult getEquUpdateCount(@RequestParam(value = "stId", required = false) String stId) {
         try {
+            if (null == stId || "0".equals(stId.trim())) {
+                stId = "";
+            }
             List<Map> list = equoperationrecordService.getEquUpdateCount(stId);
             return AjaxResult.successData(list);
         } catch (Exception e) {

+ 38 - 0
src/main/java/com/gyee/viewticket/controller/viewticket/WindfarmController.java

@@ -0,0 +1,38 @@
+package com.gyee.viewticket.controller.viewticket;
+
+
+import com.gyee.viewticket.comm.domain.AjaxResult;
+import com.gyee.viewticket.model.ticket.Windfarm;
+import com.gyee.viewticket.service.ticket.WindfarmService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 前端控制器
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@RestController
+@RequestMapping("/windfarm")
+public class WindfarmController {
+
+    @Autowired
+    private WindfarmService windfarmService;
+
+    @GetMapping(value = "getlist")
+    public AjaxResult getWindfarmList() {
+        List<Windfarm> list = windfarmService.getWindfarmList();
+        return AjaxResult.successData(list);
+    }
+
+
+}
+

+ 72 - 24
src/main/java/com/gyee/viewticket/controller/viewticket/WorkticketController.java

@@ -3,6 +3,7 @@ package com.gyee.viewticket.controller.viewticket;
 
 import com.gyee.viewticket.comm.domain.AjaxResult;
 import com.gyee.viewticket.model.ticket.Labor;
+import com.gyee.viewticket.model.ticket.Workticket;
 import com.gyee.viewticket.service.ticket.LaborService;
 import com.gyee.viewticket.service.ticket.WindturbineService;
 import com.gyee.viewticket.service.ticket.WorkriskpoolService;
@@ -17,7 +18,7 @@ import java.util.Map;
 
 /**
  * <p>
- *  前端控制器
+ * 前端控制器
  * </p>
  *
  * @author admin
@@ -27,7 +28,7 @@ import java.util.Map;
 @RequestMapping("/view/workticket")
 public class WorkticketController {
 
-    private static final Logger log = LoggerFactory.getLogger(WorkticketController.class);
+    private static final Logger logger = LoggerFactory.getLogger(WorkticketController.class);
     @Autowired
     WindturbineService windturbineService;
 
@@ -42,14 +43,15 @@ public class WorkticketController {
 
     /**
      * 按场站获取所有风机
+     *
      * @param deptnum 风机编号
      * @return
      */
     //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "windlist")
-    public AjaxResult getWindturbineid(@RequestParam("deptnum")String deptnum) {
-        if ("".equals(deptnum.trim())){
-            return AjaxResult.error(500,"查询条件为空");
+    public AjaxResult getWindturbineid(@RequestParam("deptnum") String deptnum) {
+        if ("".equals(deptnum.trim())) {
+            return AjaxResult.error(500, "查询条件为空");
         }
         List<Map> list = windturbineService.getWindturbineList(deptnum);
         return AjaxResult.successData(list);
@@ -57,14 +59,15 @@ public class WorkticketController {
 
     /**
      * 工作类型
+     *
      * @return
      */
     //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "list")
     public AjaxResult getWorkTypeList() {
         try {
-            List<Map> list =workriskpoolService.getWorkriskpoolList();
-            return  AjaxResult.successData(list);
+            List<Map> list = workriskpoolService.getWorkriskpoolList();
+            return AjaxResult.successData(list);
         } catch (Exception e) {
             return AjaxResult.error();
         }
@@ -73,44 +76,89 @@ public class WorkticketController {
 
     /**
      * 根据场站获取员工
+     *
      * @param deptnum 场站名称
      * @return
      */
     //@CrossOrigin(origins = "*",maxAge = 3600)
     @GetMapping(value = "getLaborList")
-    public AjaxResult getLaborNameList(@RequestParam("deptnum")String deptnum) {
+    public AjaxResult getLaborNameList(@RequestParam("deptnum") String deptnum) {
         List<Labor> labors = laborService.getLaborList(deptnum);
         return AjaxResult.successData(labors);
     }
 
     /**
      * 按场站获取所有风机
-     * @param workdept 工作单位
-     * @param location 风机编号
+     *
+     * @param workdept    工作单位
+     * @param location    风机编号
      * @param description 维修部件
-     * @param wspeed 风速
-     * @param worktypeid 作业类型
+     * @param wspeed      风速
+     * @param worktypeid  作业类型
      * @return
      */
     //@CrossOrigin(origins = "*",maxAge = 3600)
     @PostMapping(value = "addWindelec")
-    public AjaxResult addWorkticket(@RequestParam("workdept")String workdept,
-                                    @RequestParam("location")String location,
-                                    @RequestParam("description")String description,
-                                    @RequestParam("wspeed")String wspeed,
-                                    @RequestParam("worktypeid")String worktypeid,
-                                    @RequestParam("labornum")String labornum) {
-        log.debug("请求数据:workdept={}&location={}&description={}&wspeed={}&worktypeid={}&labornum={}",
-                workdept,location,description,wspeed,worktypeid,labornum);
-        Labor labor =  laborService.getLaborItem(labornum);
-        if (null!=labor){
-            boolean result = workticketService.saveWorkticket(workdept,location,description,wspeed,worktypeid,labor.getLaborname());
-            if (result){
+    public AjaxResult addWorkticket(@RequestParam("workdept") String workdept,
+                                    @RequestParam("location") String location,
+                                    @RequestParam("description") String description,
+                                    @RequestParam("wspeed") String wspeed,
+                                    @RequestParam("worktypeid") String worktypeid,
+                                    @RequestParam("labornum") String labornum) {
+        logger.debug("请求数据:workdept={}&location={}&description={}&wspeed={}&worktypeid={}&labornum={}",
+                workdept, location, description, wspeed, worktypeid, labornum);
+        Labor labor = laborService.getLaborItem(labornum);
+        if (null != labor) {
+            boolean result = workticketService.saveWorkticket(workdept, location, description, wspeed, worktypeid, labor.getLaborname());
+            if (result) {
                 return AjaxResult.success();
             }
         }
         return AjaxResult.error(500, "数据操作失败");
     }
 
+
+    /**
+     * @param workdepts
+     * @param types
+     * @return
+     */
+    @GetMapping(value = "getticketlist")
+    public AjaxResult getWorkticketList(
+            @RequestParam(value = "workdept", required = false) String[] workdepts,
+            @RequestParam(value = "wtickettype", required = false) String[] types,
+            @RequestParam(value = "st", required = false) String st,
+            @RequestParam(value = "et", required = false) String et
+    ) {
+        try {
+
+            Map<String,Object> list = workticketService.getWorkticketList(workdepts, types, st,et);
+
+            return AjaxResult.successData(list);
+        } catch (Exception e) {
+            logger.error("请求错误",e);
+
+            return AjaxResult.error(500, "数据操作失败");
+        }
+
+    }
+
+
+    @GetMapping(value = "getticketcountper")
+    public AjaxResult  getWorkticketCountPer(@RequestParam(value = "workdept", required = false) String[] workdepts,
+                          @RequestParam(value = "wtickettype", required = false) String[] types,
+                          @RequestParam(value = "st", required = false) String st,
+                          @RequestParam(value = "et", required = false) String et){
+
+        try {
+            List<Map> list = workticketService.getWorkticketCountPer(workdepts, types, st,et);
+            return AjaxResult.successData(list);
+        } catch (Exception e) {
+            logger.error("请求错误",e);
+            return AjaxResult.error(500, "数据操作失败");
+        }
+    }
+
+
 }
 

+ 20 - 0
src/main/java/com/gyee/viewticket/mapper/ticket/DatadictionaryMapper.java

@@ -0,0 +1,20 @@
+package com.gyee.viewticket.mapper.ticket;
+
+import com.gyee.viewticket.model.ticket.Datadictionary;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Repository
+@Mapper
+public interface DatadictionaryMapper extends BaseMapper<Datadictionary> {
+
+}

+ 20 - 0
src/main/java/com/gyee/viewticket/mapper/ticket/WindfarmMapper.java

@@ -0,0 +1,20 @@
+package com.gyee.viewticket.mapper.ticket;
+
+import com.gyee.viewticket.model.ticket.Windfarm;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Repository
+@Mapper
+public interface WindfarmMapper extends BaseMapper<Windfarm> {
+
+}

+ 11 - 0
src/main/java/com/gyee/viewticket/mapper/ticket/WorkticketMapper.java

@@ -3,8 +3,12 @@ package com.gyee.viewticket.mapper.ticket;
 import com.gyee.viewticket.model.ticket.Workticket;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  *  Mapper 接口
@@ -21,4 +25,11 @@ public interface WorkticketMapper extends BaseMapper<Workticket> {
 
     String selectTicketnum(String prefix);
 
+    List<Map> selectWorkticketList(String workdept, String type, String st, String et);
+
+    Map selectWorkticketPer(@Param("workdept")String[] workdept,
+                            @Param("type")String[] type,
+                            @Param("st")String st,
+                            @Param("et")String et);
+
 }

+ 44 - 0
src/main/java/com/gyee/viewticket/model/ticket/Datadictionary.java

@@ -0,0 +1,44 @@
+package com.gyee.viewticket.model.ticket;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("DATADICTIONARY")
+public class Datadictionary extends Model<Datadictionary> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private Double id;
+
+    @TableField("PARAM")
+    private String param;
+
+    @TableField("VALUE")
+    private String value;
+
+    @TableField("TYPE")
+    private String type;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 77 - 0
src/main/java/com/gyee/viewticket/model/ticket/Windfarm.java

@@ -0,0 +1,77 @@
+package com.gyee.viewticket.model.ticket;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@TableName("WINDFARM")
+public class Windfarm extends Model<Windfarm> {
+
+    private static final long serialVersionUID=1L;
+
+      @TableId("ID")
+    private Double id;
+
+    @TableField("WFNUM")
+    private Double wfnum;
+
+    @TableField("OWNERCOMP")
+    private String ownercomp;
+
+    @TableField("WFNAME")
+    private String wfname;
+
+    @TableField("WFSHORTNAME")
+    private String wfshortname;
+
+    @TableField("COMPADDRESS")
+    private String compaddress;
+
+    @TableField("COMPTEL")
+    private String comptel;
+
+    @TableField("COMPEMAIL")
+    private String compemail;
+
+    @TableField("DEPTNUM")
+    private String deptnum;
+
+    @TableField("ANOTHERNAME")
+    private String anothername;
+
+    @TableField("LOCATION")
+    private String location;
+
+    @TableField("COMPNAME")
+    private String compname;
+
+    @TableField("WFNAME2")
+    private String wfname2;
+
+    @TableField("WFNAME3")
+    private String wfname3;
+
+    @TableField("WPID")
+    private String wpid;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 41 - 0
src/main/java/com/gyee/viewticket/service/impl/ticket/DatadictionaryServiceImpl.java

@@ -0,0 +1,41 @@
+package com.gyee.viewticket.service.impl.ticket;
+
+import com.gyee.viewticket.comm.base.ExcludeQueryWrapper;
+import com.gyee.viewticket.model.ticket.Datadictionary;
+import com.gyee.viewticket.mapper.ticket.DatadictionaryMapper;
+import com.gyee.viewticket.model.ticket.Windfarm;
+import com.gyee.viewticket.service.ticket.DatadictionaryService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Service
+public class DatadictionaryServiceImpl extends ServiceImpl<DatadictionaryMapper, Datadictionary> implements DatadictionaryService {
+
+    @Override
+    public List<Datadictionary> getTypelistList(String type) {
+        ExcludeQueryWrapper<Datadictionary> wrapper = new ExcludeQueryWrapper<>();
+        wrapper.eq("type",type)
+        .orderByAsc("id");
+        List<Datadictionary> list = baseMapper.selectList(wrapper);
+        return list;
+    }
+
+    @Override
+    public List<Datadictionary> getValueList(String[] value) {
+        ExcludeQueryWrapper<Datadictionary> wrapper = new ExcludeQueryWrapper<>();
+        wrapper.in("value",value)
+                .orderByAsc("id");
+        List<Datadictionary> list = baseMapper.selectList(wrapper);
+        return list;
+    }
+}

+ 32 - 0
src/main/java/com/gyee/viewticket/service/impl/ticket/WindfarmServiceImpl.java

@@ -0,0 +1,32 @@
+package com.gyee.viewticket.service.impl.ticket;
+
+import com.gyee.viewticket.comm.base.ExcludeQueryWrapper;
+import com.gyee.viewticket.model.ticket.Windfarm;
+import com.gyee.viewticket.mapper.ticket.WindfarmMapper;
+import com.gyee.viewticket.model.ticket.Workticket;
+import com.gyee.viewticket.service.ticket.WindfarmService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Service
+public class WindfarmServiceImpl extends ServiceImpl<WindfarmMapper, Windfarm> implements WindfarmService {
+
+
+    @Override
+    public List<Windfarm> getWindfarmList() {
+        ExcludeQueryWrapper<Windfarm> wrapper = new ExcludeQueryWrapper<>();
+        wrapper.orderByAsc("WFNUM");
+        List<Windfarm> list = baseMapper.selectList(wrapper);
+        return list;
+    }
+}

+ 100 - 24
src/main/java/com/gyee/viewticket/service/impl/ticket/WorkticketServiceImpl.java

@@ -1,23 +1,24 @@
 package com.gyee.viewticket.service.impl.ticket;
 
 import com.gyee.viewticket.mapper.ticket.WoworktaskMapper;
-import com.gyee.viewticket.model.ticket.Ibsidgen;
-import com.gyee.viewticket.model.ticket.Workriskpool;
-import com.gyee.viewticket.model.ticket.Workticket;
+import com.gyee.viewticket.model.ticket.*;
 import com.gyee.viewticket.mapper.ticket.WorkticketMapper;
-import com.gyee.viewticket.model.ticket.Woworktask;
 import com.gyee.viewticket.service.ticket.*;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.gyee.viewticket.util.TicketUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import sun.text.resources.fr.FormatData_fr;
 
+import java.lang.reflect.Array;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.util.Date;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
- *  服务实现类
+ * 服务实现类
  * </p>
  *
  * @author admin
@@ -28,27 +29,30 @@ public class WorkticketServiceImpl extends ServiceImpl<WorkticketMapper, Worktic
 
 
     @Autowired
-    IbsidgenService ibsidgenService;
+    private IbsidgenService ibsidgenService;
     @Autowired
-    WoworktaskMapper woworktaskMapper;
+    private WoworktaskMapper woworktaskMapper;
     @Autowired
-    WorkticketMapper workticketMapper;
+    private WorkticketMapper workticketMapper;
     @Autowired
-    LocationsService locationsService;
+    private LocationsService locationsService;
     @Autowired
-    WorkriskpoolService workriskpoolService;
-
+    private WorkriskpoolService workriskpoolService;
+    @Autowired
+    private WindfarmService windfarmService;
 
+    @Autowired
+    private DatadictionaryService datadictionaryService;
 
 
     @Override
     public boolean saveWorkticket(String workdept, String location, String description, String wspeed, String worktypeid, String labornum) {
-        Workticket workticket =  new Workticket();
+        Workticket workticket = new Workticket();
         workticket.setWonum(String.valueOf(Integer.valueOf(workticketMapper.selectMaxWonum()) + 1));
         SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
         String prefix = TicketUtil.getStationPrefix(workdept) + sdf.format(new Date());
-        String endticketnum = workticketMapper.selectTicketnum("%"+prefix+"%");
-        String  ticketnum = TicketUtil.getTicketNum(prefix, endticketnum);
+        String endticketnum = workticketMapper.selectTicketnum("%" + prefix + "%");
+        String ticketnum = TicketUtil.getTicketNum(prefix, endticketnum);
         workticket.setTicketnum(ticketnum);//工作票编号
         workticket.setPrincipal(labornum);//工作负责人
         workticket.setStatus("流程未启动");//工作票状态
@@ -62,24 +66,24 @@ public class WorkticketServiceImpl extends ServiceImpl<WorkticketMapper, Worktic
         workticket.setWorkdept(workdept);//工作单位
         workticket.setWspeed(wspeed);//风速
         String wxbj = TicketUtil.getWxbj(description);
-        if (wxbj.length()>0){
-            String  loc = locationsService.gerDescription(location.trim(),wxbj.trim());
-            workticket.setWtnum(loc.length()>0? loc:location);
-        }else {
+        if (wxbj.length() > 0) {
+            String loc = locationsService.gerDescription(location.trim(), wxbj.trim());
+            workticket.setWtnum(loc.length() > 0 ? loc : location);
+        } else {
             workticket.setWtnum(location);//风电机编号
         }
         Ibsidgen gen = ibsidgenService.selectId("WORKTICKET");
         double id = gen.getIdvalue() + 1;
         ibsidgenService.updateGen(gen, id);
         workticket.setId(id);
-        int code  = baseMapper.insert(workticket);
-        if (code <= 0){
+        int code = baseMapper.insert(workticket);
+        if (code <= 0) {
             return false;
         }
 
         Workriskpool pool = workriskpoolService.getWorkriskpool(worktypeid);
         Ibsidgen genPool = ibsidgenService.selectId("WOWORKTASK");
-        double poolId = genPool.getIdvalue()+ 1;
+        double poolId = genPool.getIdvalue() + 1;
         ibsidgenService.updateGen(genPool, poolId);
         Woworktask woworktask = new Woworktask();
         woworktask.setId(poolId);
@@ -87,11 +91,83 @@ public class WorkticketServiceImpl extends ServiceImpl<WorkticketMapper, Worktic
         woworktask.setLocation(pool.getWorkrisknum());
         woworktask.setDescription(pool.getDescription());
         woworktask.setWonum(workticket.getWonum());
-        int code1  = woworktaskMapper.insert(woworktask);
-        if (code1 <= 0){
+        int code1 = woworktaskMapper.insert(woworktask);
+        if (code1 <= 0) {
             return false;
         }
         return true;
 
     }
+
+    @Override
+    public Map<String, Object> getWorkticketList(String[] workdepts, String[] types, String st, String et) throws Exception {
+        if (null == workdepts || workdepts.length <= 0) {
+            List<Windfarm> workdeptlist = windfarmService.getWindfarmList();
+            workdepts = new String[workdeptlist.size()];
+            workdepts = workdeptlist.stream().map(Windfarm::getWfshortname).collect(Collectors.toList()).stream().toArray(String[]::new);
+        }
+        List<Datadictionary> datalist;
+        if (null == types || types.length <= 0) {
+            datalist = datadictionaryService.getTypelistList("workordeptype");
+        } else {
+            datalist = datadictionaryService.getValueList(types);
+        }
+        Map<String, Object> objectType = new LinkedHashMap<>();
+
+        for (Datadictionary type : datalist) {
+
+            Map<String, List<Map>> wpMap = new LinkedHashMap<>();
+            for (String wp : workdepts) {
+                if ("风场风机".equals(type) && wp.endsWith("DZ")) {
+                    continue;
+                }
+                List<Map> map = workticketMapper.selectWorkticketList(wp, type.getParam(), st, et);
+                wpMap.put(wp, map);
+            }
+            objectType.put(type.getValue(), wpMap);
+        }
+        return objectType;
+    }
+
+    @Override
+    public List<Map> getWorkticketCountPer(String[] workdepts, String[] types, String st, String et) throws Exception {
+        if (null == workdepts || workdepts.length <= 0) {
+            List<Windfarm> workdeptlist = windfarmService.getWindfarmList();
+            workdepts = new String[workdeptlist.size()];
+            workdepts = workdeptlist.stream().map(Windfarm::getWfshortname).collect(Collectors.toList()).stream().toArray(String[]::new);
+        }
+        List<Datadictionary> datalist;
+        if (null == types || types.length <= 0) {
+            datalist = datadictionaryService.getTypelistList("workordeptype");
+            types = new String[datalist.size()];
+        } else {
+            datalist = datadictionaryService.getValueList(types);
+        }
+        types = datalist.stream().map(Datadictionary::getParam).collect(Collectors.toList()).stream().toArray(String[]::new);
+
+
+        List<Map> maps = new ArrayList<>();
+        for (Datadictionary type : datalist) {
+
+            String[] newtype = new String[]{type.getParam()};
+  /*            for (String wp : workdepts) {
+                if ("风场风机".equals(type) && wp.endsWith("DZ")) {
+                    continue;
+                }
+                String[] newwp = new String[]{wp};
+                Map map = workticketMapper.selectWorkticketPer(newwp, newtype, st, et);
+                map.put("wtickettype", type.getParam());
+                map.put("workdept", wp);
+                maps.add(map);
+            }*/
+            Map map = workticketMapper.selectWorkticketPer(workdepts, newtype, st, et);
+            map.put("wtickettype", type.getParam());
+            maps.add(map);
+
+        }
+        Map map = workticketMapper.selectWorkticketPer(workdepts, types, st, et);
+        map.put("wtickettype", "总计");
+        maps.add(map);
+        return maps;
+    }
 }

+ 33 - 0
src/main/java/com/gyee/viewticket/service/ticket/DatadictionaryService.java

@@ -0,0 +1,33 @@
+package com.gyee.viewticket.service.ticket;
+
+import com.gyee.viewticket.model.ticket.Datadictionary;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+public interface DatadictionaryService extends IService<Datadictionary> {
+
+
+    /**
+     * 通过type类型获取数据
+     * @param type
+     * @return
+     */
+   List<Datadictionary> getTypelistList(String type);
+
+    /**
+     * 通过value类型获取数据
+     * @param value
+     * @return
+     */
+    List<Datadictionary> getValueList(String[] value);
+
+}

+ 26 - 0
src/main/java/com/gyee/viewticket/service/ticket/WindfarmService.java

@@ -0,0 +1,26 @@
+package com.gyee.viewticket.service.ticket;
+
+import com.gyee.viewticket.model.ticket.Windfarm;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author admin
+ * @since 2021-12-01
+ */
+@Service
+public interface WindfarmService extends IService<Windfarm> {
+
+    /**
+     * 查询所有的数据
+     * @return
+     */
+    List<Windfarm> getWindfarmList();
+
+}

+ 3 - 0
src/main/java/com/gyee/viewticket/service/ticket/WorkriskpoolService.java

@@ -2,6 +2,7 @@ package com.gyee.viewticket.service.ticket;
 
 import com.gyee.viewticket.model.ticket.Workriskpool;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.gyee.viewticket.model.ticket.Workticket;
 import org.springframework.stereotype.Service;
 
 import java.util.List;
@@ -21,4 +22,6 @@ public interface WorkriskpoolService extends IService<Workriskpool> {
     List<Map> getWorkriskpoolList();
 
     Workriskpool getWorkriskpool(String workrisknum);
+
+
 }

+ 18 - 0
src/main/java/com/gyee/viewticket/service/ticket/WorkticketService.java

@@ -4,6 +4,10 @@ import com.gyee.viewticket.model.ticket.Workticket;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.springframework.stereotype.Service;
 
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+
 /**
  * <p>
  *  服务类
@@ -26,4 +30,18 @@ public interface WorkticketService extends IService<Workticket> {
      */
     boolean saveWorkticket(String workdept,String location,String description,String wspeed,String worktypeid,String labornum);
 
+    /**
+     * 获取工作票数据
+     * @param workdept 场站
+     * @param type 票类型
+     * @param st 开始时间
+     * @param et 结束时间
+     * @return
+     * @throws ParseException
+     */
+    Map<String,Object> getWorkticketList(String[] workdept, String[] type, String st, String et) throws Exception;
+
+
+    List<Map> getWorkticketCountPer(String[] workdept, String[] type, String st, String et) throws Exception;
+
 }

+ 3 - 1
src/main/resources/application.yml

@@ -1,6 +1,8 @@
 server:
   port: 9988
 mybatis-plus:
+  configuration:
+    call-setters-on-nulls: true
   mapper-locations: classpath:/mapper/ticket/*.xml
   global-config:
     db-config:
@@ -15,7 +17,7 @@ spring:
   datasource:
     driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
     type: com.alibaba.druid.pool.DruidDataSource
-    url: jdbc:sqlserver://10.155.32.2:1433;DatabaseName=fdtest
+    url: jdbc:sqlserver://10.155.32.2:1433;DatabaseName=fdeam
     username: sa
     password: Gyee@321#!
     maxActive: 20

+ 18 - 0
src/main/resources/mapper/ticket/DatadictionaryMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.viewticket.mapper.ticket.DatadictionaryMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.viewticket.model.ticket.Datadictionary">
+        <id column="ID" property="id" />
+        <result column="PARAM" property="param" />
+        <result column="VALUE" property="value" />
+        <result column="TYPE" property="type" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, PARAM, VALUE, TYPE
+    </sql>
+
+</mapper>

+ 29 - 0
src/main/resources/mapper/ticket/WindfarmMapper.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.viewticket.mapper.ticket.WindfarmMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.gyee.viewticket.model.ticket.Windfarm">
+        <id column="ID" property="id" />
+        <result column="WFNUM" property="wfnum" />
+        <result column="OWNERCOMP" property="ownercomp" />
+        <result column="WFNAME" property="wfname" />
+        <result column="WFSHORTNAME" property="wfshortname" />
+        <result column="COMPADDRESS" property="compaddress" />
+        <result column="COMPTEL" property="comptel" />
+        <result column="COMPEMAIL" property="compemail" />
+        <result column="DEPTNUM" property="deptnum" />
+        <result column="ANOTHERNAME" property="anothername" />
+        <result column="LOCATION" property="location" />
+        <result column="COMPNAME" property="compname" />
+        <result column="WFNAME2" property="wfname2" />
+        <result column="WFNAME3" property="wfname3" />
+        <result column="WPID" property="wpid" />
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        ID, WFNUM, OWNERCOMP, WFNAME, WFSHORTNAME, COMPADDRESS, COMPTEL, COMPEMAIL, DEPTNUM, ANOTHERNAME, LOCATION, COMPNAME, WFNAME2, WFNAME3, WPID
+    </sql>
+
+</mapper>

+ 322 - 187
src/main/resources/mapper/ticket/WorkticketMapper.xml

@@ -4,192 +4,192 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.gyee.viewticket.model.ticket.Workticket">
-        <id column="ID" property="id" />
-        <result column="WONUM" property="wonum" />
-        <result column="STATION" property="station" />
-        <result column="WTICKETTYPE" property="wtickettype" />
-        <result column="PRINCIPAL" property="principal" />
-        <result column="DEPTGROUP" property="deptgroup" />
-        <result column="FINALTYPE" property="finaltype" />
-        <result column="STARTDATE" property="startdate" />
-        <result column="ENDDATE" property="enddate" />
-        <result column="WORKTASK" property="worktask" />
-        <result column="WORKADDRESS" property="workaddress" />
-        <result column="STOPLINENAME" property="stoplinename" />
-        <result column="RUNDEPT" property="rundept" />
-        <result column="CONSDEPT" property="consdept" />
-        <result column="SIGNATORY" property="signatory" />
-        <result column="TKCHAMBER" property="tkchamber" />
-        <result column="REMARK1" property="remark1" />
-        <result column="INCEPTDATE" property="inceptdate" />
-        <result column="INCEPTMAN" property="inceptman" />
-        <result column="YORN" property="yorn" />
-        <result column="ADJUSTORADD" property="adjustoradd" />
-        <result column="ADJUSTUSER" property="adjustuser" />
-        <result column="PRESERVING" property="preserving" />
-        <result column="REMARK2" property="remark2" />
-        <result column="FIATQUOMODO" property="fiatquomodo" />
-        <result column="FIATDATE" property="fiatdate" />
-        <result column="FIATUSER1" property="fiatuser1" />
-        <result column="PRINCIPAL1" property="principal1" />
-        <result column="REMARK3" property="remark3" />
-        <result column="PROJECT" property="project" />
-        <result column="PRINCIPAL2" property="principal2" />
-        <result column="FIATUSER2" property="fiatuser2" />
-        <result column="SIGNATORY1" property="signatory1" />
-        <result column="CHANGEDATE" property="changedate" />
-        <result column="PRINCIPAL3" property="principal3" />
-        <result column="NEWPRINCIPAL" property="newprincipal" />
-        <result column="FIATUSER3" property="fiatuser3" />
-        <result column="NEWDATE" property="newdate" />
-        <result column="PRINCIPAL4" property="principal4" />
-        <result column="INCEPTMAN1" property="inceptman1" />
-        <result column="FINALTIME" property="finaltime" />
-        <result column="PRINCIPAL5" property="principal5" />
-        <result column="FIATUSER4" property="fiatuser4" />
-        <result column="LINENUM" property="linenum" />
-        <result column="STATUS" property="status" />
-        <result column="STATUSDATE" property="statusdate" />
-        <result column="EQNUM" property="eqnum" />
-        <result column="LOCATION" property="location" />
-        <result column="SECYORN" property="secyorn" />
-        <result column="OUTYORN" property="outyorn" />
-        <result column="SAFEYORN" property="safeyorn" />
-        <result column="SITENUM" property="sitenum" />
-        <result column="CORPNUM" property="corpnum" />
-        <result column="EQNUMDIS" property="eqnumdis" />
-        <result column="LOCATIONDIS" property="locationdis" />
-        <result column="WORKDEPT" property="workdept" />
-        <result column="SIGNDATE" property="signdate" />
-        <result column="MEMBERCHANGE" property="memberchange" />
-        <result column="UNLINENAME" property="unlinename" />
-        <result column="UNLINECOUNT" property="unlinecount" />
-        <result column="SWITCHCOUNT" property="switchcount" />
-        <result column="BAFFLECOUNT" property="bafflecount" />
-        <result column="FIATUSER5" property="fiatuser5" />
-        <result column="TICKETFINALTIME" property="ticketfinaltime" />
-        <result column="SUBNUM" property="subnum" />
-        <result column="SUBPRINCIPAL" property="subprincipal" />
-        <result column="FINALTYPE1" property="finaltype1" />
-        <result column="FINALTIME1" property="finaltime1" />
-        <result column="PRINCIPAL6" property="principal6" />
-        <result column="FIATUSER6" property="fiatuser6" />
-        <result column="FIATDATE1" property="fiatdate1" />
-        <result column="FIATUSER7" property="fiatuser7" />
-        <result column="SAFETY" property="safety" />
-        <result column="PRINCIPAL7" property="principal7" />
-        <result column="WORKLINE" property="workline" />
-        <result column="EQUI" property="equi" />
-        <result column="SAFENOTICE" property="safenotice" />
-        <result column="SEQUENCE" property="sequence" />
-        <result column="STANTICKETTYPE" property="stantickettype" />
-        <result column="STLITICKETTYPE" property="stlitickettype" />
-        <result column="INITIALUSER" property="initialuser" />
-        <result column="INITIALUSERDEPT" property="initialuserdept" />
-        <result column="WORKUSER" property="workuser" />
-        <result column="TICKETNUM" property="ticketnum" />
-        <result column="ADDPEOPLE" property="addpeople" />
-        <result column="ADDTIME" property="addtime" />
-        <result column="AWAYPEOPLE" property="awaypeople" />
-        <result column="AWAYTIME" property="awaytime" />
-        <result column="WORKSTEERPEOPLE" property="worksteerpeople" />
-        <result column="WORKADDPEOPLE" property="workaddpeople" />
-        <result column="STOPSCOPE" property="stopscope" />
-        <result column="COUNTERSIGNDATE" property="countersigndate" />
-        <result column="COUNTERSIGNPERSON" property="countersignperson" />
-        <result column="CHECKDATE" property="checkdate" />
-        <result column="CHECKPERSON" property="checkperson" />
-        <result column="CHECKQUESTION" property="checkquestion" />
-        <result column="REMARK4" property="remark4" />
-        <result column="CHECKSTATE" property="checkstate" />
-        <result column="STARTWORKTIME" property="startworktime" />
-        <result column="ENDWORKTIME" property="endworktime" />
-        <result column="PRINCIPAL8" property="principal8" />
-        <result column="BUGNUM" property="bugnum" />
-        <result column="WORKAREA" property="workarea" />
-        <result column="FIREPRINCIPAL" property="fireprincipal" />
-        <result column="FIRELOCATION" property="firelocation" />
-        <result column="SURVEYLOCATION" property="surveylocation" />
-        <result column="CONTENTS" property="contents" />
-        <result column="INSTRUMENT" property="instrument" />
-        <result column="SURVEYPERSON" property="surveyperson" />
-        <result column="SURVEYTIME" property="surveytime" />
-        <result column="APPLYFIRESTARTTIME" property="applyfirestarttime" />
-        <result column="APPLYFIREENDTIME" property="applyfireendtime" />
-        <result column="LEADERSHIP" property="leadership" />
-        <result column="SAFEPRINCIPAL" property="safeprincipal" />
-        <result column="FIREFIGHTINGPERSON" property="firefightingperson" />
-        <result column="SHIFTFOREMAN" property="shiftforeman" />
-        <result column="FIREOPERATOR" property="fireoperator" />
-        <result column="FIREPERMITTIME" property="firepermittime" />
-        <result column="FIREENDTIME" property="fireendtime" />
-        <result column="DEPTGROUP1" property="deptgroup1" />
-        <result column="FIREWORKCONTENT" property="fireworkcontent" />
-        <result column="FIATUSER8" property="fiatuser8" />
-        <result column="GUARDIAN" property="guardian" />
-        <result column="GUARDIAN1" property="guardian1" />
-        <result column="GUARDIAN2" property="guardian2" />
-        <result column="FIREOPERATOR1" property="fireoperator1" />
-        <result column="SHIFTFOREMAN1" property="shiftforeman1" />
-        <result column="DESCRIPTION" property="description" />
-        <result column="EQUNAME" property="equname" />
-        <result column="BARNAME" property="barname" />
-        <result column="BARNAME1" property="barname1" />
-        <result column="LINEADDDATE" property="lineadddate" />
-        <result column="LINEENDDATE" property="lineenddate" />
-        <result column="LINEAGREEMODE" property="lineagreemode" />
-        <result column="LINEAGEEPEOPLE" property="lineageepeople" />
-        <result column="LINEAGEEPEOPLE2" property="lineageepeople2" />
-        <result column="LINEBEGINDATE" property="linebegindate" />
-        <result column="LINEREPORTMODE" property="linereportmode" />
-        <result column="LINEAGEEPEOPLE4" property="lineageepeople4" />
-        <result column="LINEAGEEPEOPLE3" property="lineageepeople3" />
-        <result column="LINEREPOPTMODE" property="linerepoptmode" />
-        <result column="EQUIPMENT" property="equipment" />
-        <result column="SBMS" property="sbms" />
-        <result column="EQNAME" property="eqname" />
-        <result column="FIATUSER" property="fiatuser" />
-        <result column="INCEPTMAN2" property="inceptman2" />
-        <result column="LEADERSHIP1" property="leadership1" />
-        <result column="SAFEPRINCIPAL1" property="safeprincipal1" />
-        <result column="FIREFIGHTPERSON1" property="firefightperson1" />
-        <result column="WTNUM" property="wtnum" />
-        <result column="WORKREPORT" property="workreport" />
-        <result column="SAFEMEASURE" property="safemeasure" />
-        <result column="ADDSAFEMEASURE" property="addsafemeasure" />
-        <result column="PRINCIPALDATE" property="principaldate" />
-        <result column="FIATUSERDATE" property="fiatuserdate" />
-        <result column="GWNUM" property="gwnum" />
-        <result column="ISEND" property="isend" />
-        <result column="WSPEED" property="wspeed" />
-        <result column="COMPLETION" property="completion" />
-        <result column="RELINECOUNT" property="relinecount" />
-        <result column="UNSWITCHCOUNT" property="unswitchcount" />
-        <result column="RESWITCHCOUNT" property="reswitchcount" />
-        <result column="FIREMODE" property="firemode" />
-        <result column="FIREOPERATORNUM" property="fireoperatornum" />
-        <result column="SIGNATORYNUM" property="signatorynum" />
-        <result column="FIATUSER1NUM" property="fiatuser1num" />
-        <result column="PRINCIPAL2NUM" property="principal2num" />
-        <result column="SHIFTFOREMANNUM" property="shiftforemannum" />
-        <result column="FIATUSERNUM" property="fiatusernum" />
-        <result column="INCEPTMAN1NUM" property="inceptman1num" />
-        <result column="FIREFIGHTINGPERNUM" property="firefightingpernum" />
-        <result column="SAFEPRINCIPALNUM" property="safeprincipalnum" />
-        <result column="FIATUSER5NUM" property="fiatuser5num" />
-        <result column="FIATUSER8NUM" property="fiatuser8num" />
-        <result column="PRINCIPAL1NUM" property="principal1num" />
-        <result column="GUARDIANNUM" property="guardiannum" />
-        <result column="FIREOPERATOR1NUM" property="fireoperator1num" />
-        <result column="PRINCIPAL5NUM" property="principal5num" />
-        <result column="FIATUSER4NUM" property="fiatuser4num" />
-        <result column="SHIFTFORENUM1NUM" property="shiftforenum1num" />
-        <result column="INCEPTMANNUM" property="inceptmannum" />
-        <result column="PRINCIPAL3NUM" property="principal3num" />
-        <result column="GUARDIAN1NUM" property="guardian1num" />
-        <result column="FIATUSER7NUM" property="fiatuser7num" />
-        <result column="PRINCIPAL6NUM" property="principal6num" />
-        <result column="SAFEPRINCIPAL1NUM" property="safeprincipal1num" />
+        <id column="ID" property="id"/>
+        <result column="WONUM" property="wonum"/>
+        <result column="STATION" property="station"/>
+        <result column="WTICKETTYPE" property="wtickettype"/>
+        <result column="PRINCIPAL" property="principal"/>
+        <result column="DEPTGROUP" property="deptgroup"/>
+        <result column="FINALTYPE" property="finaltype"/>
+        <result column="STARTDATE" property="startdate"/>
+        <result column="ENDDATE" property="enddate"/>
+        <result column="WORKTASK" property="worktask"/>
+        <result column="WORKADDRESS" property="workaddress"/>
+        <result column="STOPLINENAME" property="stoplinename"/>
+        <result column="RUNDEPT" property="rundept"/>
+        <result column="CONSDEPT" property="consdept"/>
+        <result column="SIGNATORY" property="signatory"/>
+        <result column="TKCHAMBER" property="tkchamber"/>
+        <result column="REMARK1" property="remark1"/>
+        <result column="INCEPTDATE" property="inceptdate"/>
+        <result column="INCEPTMAN" property="inceptman"/>
+        <result column="YORN" property="yorn"/>
+        <result column="ADJUSTORADD" property="adjustoradd"/>
+        <result column="ADJUSTUSER" property="adjustuser"/>
+        <result column="PRESERVING" property="preserving"/>
+        <result column="REMARK2" property="remark2"/>
+        <result column="FIATQUOMODO" property="fiatquomodo"/>
+        <result column="FIATDATE" property="fiatdate"/>
+        <result column="FIATUSER1" property="fiatuser1"/>
+        <result column="PRINCIPAL1" property="principal1"/>
+        <result column="REMARK3" property="remark3"/>
+        <result column="PROJECT" property="project"/>
+        <result column="PRINCIPAL2" property="principal2"/>
+        <result column="FIATUSER2" property="fiatuser2"/>
+        <result column="SIGNATORY1" property="signatory1"/>
+        <result column="CHANGEDATE" property="changedate"/>
+        <result column="PRINCIPAL3" property="principal3"/>
+        <result column="NEWPRINCIPAL" property="newprincipal"/>
+        <result column="FIATUSER3" property="fiatuser3"/>
+        <result column="NEWDATE" property="newdate"/>
+        <result column="PRINCIPAL4" property="principal4"/>
+        <result column="INCEPTMAN1" property="inceptman1"/>
+        <result column="FINALTIME" property="finaltime"/>
+        <result column="PRINCIPAL5" property="principal5"/>
+        <result column="FIATUSER4" property="fiatuser4"/>
+        <result column="LINENUM" property="linenum"/>
+        <result column="STATUS" property="status"/>
+        <result column="STATUSDATE" property="statusdate"/>
+        <result column="EQNUM" property="eqnum"/>
+        <result column="LOCATION" property="location"/>
+        <result column="SECYORN" property="secyorn"/>
+        <result column="OUTYORN" property="outyorn"/>
+        <result column="SAFEYORN" property="safeyorn"/>
+        <result column="SITENUM" property="sitenum"/>
+        <result column="CORPNUM" property="corpnum"/>
+        <result column="EQNUMDIS" property="eqnumdis"/>
+        <result column="LOCATIONDIS" property="locationdis"/>
+        <result column="WORKDEPT" property="workdept"/>
+        <result column="SIGNDATE" property="signdate"/>
+        <result column="MEMBERCHANGE" property="memberchange"/>
+        <result column="UNLINENAME" property="unlinename"/>
+        <result column="UNLINECOUNT" property="unlinecount"/>
+        <result column="SWITCHCOUNT" property="switchcount"/>
+        <result column="BAFFLECOUNT" property="bafflecount"/>
+        <result column="FIATUSER5" property="fiatuser5"/>
+        <result column="TICKETFINALTIME" property="ticketfinaltime"/>
+        <result column="SUBNUM" property="subnum"/>
+        <result column="SUBPRINCIPAL" property="subprincipal"/>
+        <result column="FINALTYPE1" property="finaltype1"/>
+        <result column="FINALTIME1" property="finaltime1"/>
+        <result column="PRINCIPAL6" property="principal6"/>
+        <result column="FIATUSER6" property="fiatuser6"/>
+        <result column="FIATDATE1" property="fiatdate1"/>
+        <result column="FIATUSER7" property="fiatuser7"/>
+        <result column="SAFETY" property="safety"/>
+        <result column="PRINCIPAL7" property="principal7"/>
+        <result column="WORKLINE" property="workline"/>
+        <result column="EQUI" property="equi"/>
+        <result column="SAFENOTICE" property="safenotice"/>
+        <result column="SEQUENCE" property="sequence"/>
+        <result column="STANTICKETTYPE" property="stantickettype"/>
+        <result column="STLITICKETTYPE" property="stlitickettype"/>
+        <result column="INITIALUSER" property="initialuser"/>
+        <result column="INITIALUSERDEPT" property="initialuserdept"/>
+        <result column="WORKUSER" property="workuser"/>
+        <result column="TICKETNUM" property="ticketnum"/>
+        <result column="ADDPEOPLE" property="addpeople"/>
+        <result column="ADDTIME" property="addtime"/>
+        <result column="AWAYPEOPLE" property="awaypeople"/>
+        <result column="AWAYTIME" property="awaytime"/>
+        <result column="WORKSTEERPEOPLE" property="worksteerpeople"/>
+        <result column="WORKADDPEOPLE" property="workaddpeople"/>
+        <result column="STOPSCOPE" property="stopscope"/>
+        <result column="COUNTERSIGNDATE" property="countersigndate"/>
+        <result column="COUNTERSIGNPERSON" property="countersignperson"/>
+        <result column="CHECKDATE" property="checkdate"/>
+        <result column="CHECKPERSON" property="checkperson"/>
+        <result column="CHECKQUESTION" property="checkquestion"/>
+        <result column="REMARK4" property="remark4"/>
+        <result column="CHECKSTATE" property="checkstate"/>
+        <result column="STARTWORKTIME" property="startworktime"/>
+        <result column="ENDWORKTIME" property="endworktime"/>
+        <result column="PRINCIPAL8" property="principal8"/>
+        <result column="BUGNUM" property="bugnum"/>
+        <result column="WORKAREA" property="workarea"/>
+        <result column="FIREPRINCIPAL" property="fireprincipal"/>
+        <result column="FIRELOCATION" property="firelocation"/>
+        <result column="SURVEYLOCATION" property="surveylocation"/>
+        <result column="CONTENTS" property="contents"/>
+        <result column="INSTRUMENT" property="instrument"/>
+        <result column="SURVEYPERSON" property="surveyperson"/>
+        <result column="SURVEYTIME" property="surveytime"/>
+        <result column="APPLYFIRESTARTTIME" property="applyfirestarttime"/>
+        <result column="APPLYFIREENDTIME" property="applyfireendtime"/>
+        <result column="LEADERSHIP" property="leadership"/>
+        <result column="SAFEPRINCIPAL" property="safeprincipal"/>
+        <result column="FIREFIGHTINGPERSON" property="firefightingperson"/>
+        <result column="SHIFTFOREMAN" property="shiftforeman"/>
+        <result column="FIREOPERATOR" property="fireoperator"/>
+        <result column="FIREPERMITTIME" property="firepermittime"/>
+        <result column="FIREENDTIME" property="fireendtime"/>
+        <result column="DEPTGROUP1" property="deptgroup1"/>
+        <result column="FIREWORKCONTENT" property="fireworkcontent"/>
+        <result column="FIATUSER8" property="fiatuser8"/>
+        <result column="GUARDIAN" property="guardian"/>
+        <result column="GUARDIAN1" property="guardian1"/>
+        <result column="GUARDIAN2" property="guardian2"/>
+        <result column="FIREOPERATOR1" property="fireoperator1"/>
+        <result column="SHIFTFOREMAN1" property="shiftforeman1"/>
+        <result column="DESCRIPTION" property="description"/>
+        <result column="EQUNAME" property="equname"/>
+        <result column="BARNAME" property="barname"/>
+        <result column="BARNAME1" property="barname1"/>
+        <result column="LINEADDDATE" property="lineadddate"/>
+        <result column="LINEENDDATE" property="lineenddate"/>
+        <result column="LINEAGREEMODE" property="lineagreemode"/>
+        <result column="LINEAGEEPEOPLE" property="lineageepeople"/>
+        <result column="LINEAGEEPEOPLE2" property="lineageepeople2"/>
+        <result column="LINEBEGINDATE" property="linebegindate"/>
+        <result column="LINEREPORTMODE" property="linereportmode"/>
+        <result column="LINEAGEEPEOPLE4" property="lineageepeople4"/>
+        <result column="LINEAGEEPEOPLE3" property="lineageepeople3"/>
+        <result column="LINEREPOPTMODE" property="linerepoptmode"/>
+        <result column="EQUIPMENT" property="equipment"/>
+        <result column="SBMS" property="sbms"/>
+        <result column="EQNAME" property="eqname"/>
+        <result column="FIATUSER" property="fiatuser"/>
+        <result column="INCEPTMAN2" property="inceptman2"/>
+        <result column="LEADERSHIP1" property="leadership1"/>
+        <result column="SAFEPRINCIPAL1" property="safeprincipal1"/>
+        <result column="FIREFIGHTPERSON1" property="firefightperson1"/>
+        <result column="WTNUM" property="wtnum"/>
+        <result column="WORKREPORT" property="workreport"/>
+        <result column="SAFEMEASURE" property="safemeasure"/>
+        <result column="ADDSAFEMEASURE" property="addsafemeasure"/>
+        <result column="PRINCIPALDATE" property="principaldate"/>
+        <result column="FIATUSERDATE" property="fiatuserdate"/>
+        <result column="GWNUM" property="gwnum"/>
+        <result column="ISEND" property="isend"/>
+        <result column="WSPEED" property="wspeed"/>
+        <result column="COMPLETION" property="completion"/>
+        <result column="RELINECOUNT" property="relinecount"/>
+        <result column="UNSWITCHCOUNT" property="unswitchcount"/>
+        <result column="RESWITCHCOUNT" property="reswitchcount"/>
+        <result column="FIREMODE" property="firemode"/>
+        <result column="FIREOPERATORNUM" property="fireoperatornum"/>
+        <result column="SIGNATORYNUM" property="signatorynum"/>
+        <result column="FIATUSER1NUM" property="fiatuser1num"/>
+        <result column="PRINCIPAL2NUM" property="principal2num"/>
+        <result column="SHIFTFOREMANNUM" property="shiftforemannum"/>
+        <result column="FIATUSERNUM" property="fiatusernum"/>
+        <result column="INCEPTMAN1NUM" property="inceptman1num"/>
+        <result column="FIREFIGHTINGPERNUM" property="firefightingpernum"/>
+        <result column="SAFEPRINCIPALNUM" property="safeprincipalnum"/>
+        <result column="FIATUSER5NUM" property="fiatuser5num"/>
+        <result column="FIATUSER8NUM" property="fiatuser8num"/>
+        <result column="PRINCIPAL1NUM" property="principal1num"/>
+        <result column="GUARDIANNUM" property="guardiannum"/>
+        <result column="FIREOPERATOR1NUM" property="fireoperator1num"/>
+        <result column="PRINCIPAL5NUM" property="principal5num"/>
+        <result column="FIATUSER4NUM" property="fiatuser4num"/>
+        <result column="SHIFTFORENUM1NUM" property="shiftforenum1num"/>
+        <result column="INCEPTMANNUM" property="inceptmannum"/>
+        <result column="PRINCIPAL3NUM" property="principal3num"/>
+        <result column="GUARDIAN1NUM" property="guardian1num"/>
+        <result column="FIATUSER7NUM" property="fiatuser7num"/>
+        <result column="PRINCIPAL6NUM" property="principal6num"/>
+        <result column="SAFEPRINCIPAL1NUM" property="safeprincipal1num"/>
     </resultMap>
 
     <!-- 通用查询结果列 -->
@@ -198,7 +198,6 @@
     </sql>
 
 
-
     <select id="selectMaxWonum" resultType="String">
         SELECT
         wonum
@@ -232,7 +231,143 @@
         </where>
 
     </select>
+<!--    <select id="selectWorkticketList" resultType="java.util.Map">-->
+
+<!--        SELECT-->
+<!--        &#45;&#45; ROW_NUMBER () OVER ( ORDER BY w.ID DESC ) ROWNU,-->
+<!--        w.WONUM,-->
+<!--        w.WTICKETTYPE,-->
+<!--        w.PRINCIPAL,-->
+<!--        w.STARTDATE,-->
+<!--        w.STATUS,-->
+<!--        w.TICKETNUM,-->
+<!--        w.wtnum,-->
+<!--        w.WORKDEPT,-->
+<!--        e.DESCRIPTION-->
+<!--        FROM-->
+<!--        workticket w-->
+<!--        LEFT JOIN LOCATIONS e ON w.wtnum = e.LOCATION-->
+<!--        LEFT JOIN WINDFARM f ON  w.WORKDEPT = f.WFNAME-->
+<!--        <where>-->
+<!--            w.FINALTIME is not null-->
+<!--            <if test="'' != workdept and null != workdept">-->
+<!--                and  f.WFSHORTNAME = #{workdept}-->
+<!--            </if>-->
+
+<!--            <if test="'' != type and null != type">-->
+<!--                and  w.wtickettype = #{type}-->
+<!--            </if>-->
+
+<!--            <if test="st !=null and et !=null">-->
+<!--                and w.startdate >= #{st} and w.finaltime &lt;= #{et}-->
+<!--            </if>-->
+<!--        </where>-->
+<!--        ORDER BY w.STARTDATE DESC-->
+<!--    </select>-->
+
+
+
+    <select id="selectWorkticketList" resultType="java.util.Map">
+
+
+        WITH cte1 AS (
+        SELECT
+        w.ticketnum,
+        w.principal,
+        w.deptgroup1,
+        w.startdate,
+        w.enddate,
+        w.newdate,
+        w.finaltime,
+        w.status,
+        w.workdept,
+        e.description,
+        w.wtickettype,
+        CASE WHEN w.finaltime IS NULL THEN '1' ELSE '0' END AS tag,
+        CASE WHEN finaltime IS NULL  THEN '不合格' ELSE '正常' END as tagdes
+        FROM
+        workticket w
+        LEFT JOIN LOCATIONS e ON w.wtnum = e.LOCATION
+        LEFT JOIN WINDFARM f ON  w.WORKDEPT = f.WFNAME
+        <where>
+        <if test="st !=null and et !=null">
+            and ((w.startdate >= #{st}  and w.startdate  &lt;= #{et})
+            and  (w.enddate >= #{st}  and w.enddate  &lt;= #{et}
+            and (w.enddate &lt;= CONVERT(varchar,GETDATE(),20) or w.newdate &lt;= CONVERT(varchar,GETDATE(),20))
+            or  (w.finaltime >= #{st}  and w.finaltime  &lt;= #{et}))
+        </if>
+
+
+        <if test="'' != type and null != type">
+            and  w.wtickettype = #{type}
+        </if>
+
+        <if test="'' != workdept and null != workdept">
+            and  f.WFSHORTNAME = #{workdept}
+        </if>
+
+        </where>
+        ))
+        select  *  from cte1
+        where ticketnum not in (select c.ticketnum from cte1 c where   c.newdate is not null and c.finaltime is null) ORDER BY ticketnum
 
+    </select>
+    <select id="selectWorkticketPer" resultType="java.util.Map">
+        WITH cte1 AS (
+        SELECT
+        w.ticketnum,
+        w.principal,
+        w.deptgroup1,
+        w.startdate,
+        w.enddate,
+        w.newdate,
+        w.finaltime,
+        w.status,
+        w.workdept,
+        CASE WHEN w.finaltime IS NULL THEN '1' ELSE '0' END AS tag
+        FROM
+        workticket w
+        LEFT JOIN LOCATIONS e ON w.wtnum = e.LOCATION
+        LEFT JOIN WINDFARM f ON  w.WORKDEPT = f.WFNAME
+        <where>
+            <if test="st !=null and et !=null">
+
+                and ((w.startdate >= #{st}  and w.startdate  &lt;= #{et})
+                and  (w.enddate >= #{st}  and w.enddate  &lt;= #{et})
+                AND (w.enddate &lt;= CONVERT(varchar,GETDATE(),20) or w.newdate &lt;= CONVERT(varchar,GETDATE(),20))
+                or  (w.finaltime >= #{st}  and w.finaltime  &lt;= #{et}))
+            </if>
+
+
+            <if test="null != type">
+                and  w.wtickettype in
+                <foreach item="item" collection="type" open="(" separator="," close=")">
+                    #{item,jdbcType=VARCHAR}
+                </foreach>
+
+            </if>
+
+            <if test=" null != workdept">
+                and  f.WFSHORTNAME in
+                <foreach item="item" collection="workdept" open="(" separator="," close=")">
+                    #{item,jdbcType=VARCHAR}
+                </foreach>
+            </if>
+
+
+        </where>
+        )
+        select
+        count(tag) total,
+        SUM(CASE WHEN tag = 0 THEN 1 ELSE 0 END) AS quanum,
+        SUM(CASE WHEN tag = 1 THEN 1 ELSE 0 END) AS failnum,
+        ROUND(ISNULL(COALESCE(CAST(SUM(CASE WHEN tag = 0 THEN 1 ELSE 0 END) AS FLOAT), 0)/NULLIF(count(tag) ,0),0), 2)*100 per
+        from cte1
+        where ticketnum not in (select c.ticketnum from cte1 c where   c.newdate is not null and c.finaltime is null)
+
+
+
+    </select>
 
 
 </mapper>