Browse Source

两票导出功能修改

wangchangsheng 2 years ago
parent
commit
e2a1378a30

+ 27 - 0
pom.xml

@@ -116,6 +116,33 @@
             <artifactId>feign-jackson</artifactId>
             <version>8.18.0</version>
         </dependency>
+
+
+
+
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna</artifactId>
+            <version>5.6.0</version>
+        </dependency>
+        <dependency>
+            <groupId>net.java.dev.jna</groupId>
+            <artifactId>jna-platform</artifactId>
+            <version>5.6.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github.oshi</groupId>
+            <artifactId>oshi-core</artifactId>
+            <version>5.3.7</version>
+        </dependency>
+        <dependency>
+            <groupId>cn.hutool</groupId>
+            <artifactId>hutool-all</artifactId>
+            <version>5.5.6</version>
+        </dependency>
+
+
+
     </dependencies>
 
     <build>

+ 12 - 11
src/main/java/com/gyee/viewticket/comm/task/TaskThreadCallable.java

@@ -34,17 +34,18 @@ public class TaskThreadCallable implements Callable {
     public Map<String,List<Map>> call() throws Exception {
 
         Map<String,List<Map>> m = new LinkedHashMap<>();
-
-        List<Map> map = this.workticketMapper.selectWorkticketList(this.workdept, this.type.getParam(), this.st, this.et);
-
-        if ("风场风机".equals(this.type.getParam())){
-            map.stream().forEach(i->{
-                String  wtnum = i.get("wtnum").toString();
-                String location = this.locationsService.getLocations(wtnum);
-                i.put("location",location);
-            });
-
-        }
+        List<Map> map;
+
+        map = this.workticketMapper.selectWorkticketList(this.workdept, this.type.getParam(), this.st, this.et);
+
+//        if ("风场风机".equals(this.type.getParam())){
+//            map.stream().forEach(i->{
+//                String  wtnum = i.get("wtnum").toString();
+//                String location = this.locationsService.getLocations(wtnum);
+//                i.put("location",location);
+//            });
+//
+//        }
         m.put(this.workdept,map);
 
         return m;

+ 2 - 1
src/main/java/com/gyee/viewticket/mapper/ticket/WorkticketMapper.java

@@ -27,8 +27,9 @@ public interface WorkticketMapper extends BaseMapper<Workticket> {
 
     List<Map> selectWorkticketList(String workdept, String type, String st, String et);
 
+
     Map selectWorkticketPer(@Param("workdept")String[] workdept,
-                            @Param("type")String[] type,
+                            @Param("type")String type,
                             @Param("st")String st,
                             @Param("et")String et);
 

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

@@ -40,7 +40,7 @@ public class WindfarmServiceImpl extends ServiceImpl<WindfarmMapper, Windfarm> i
     public List<Windfarm> getWindfarmFdList() {
         if (null == fd || fd.size() <= 0) {
             ExcludeQueryWrapper<Windfarm> wrapper = new ExcludeQueryWrapper<>();
-            wrapper.like("WFSHORTNAME", "%MHS_FDC%");
+            wrapper.like("WFSHORTNAME", "%_FDC%");
             wrapper.orderByAsc("WFNUM");
             fd = baseMapper.selectList(wrapper);
         }

+ 20 - 4
src/main/java/com/gyee/viewticket/service/impl/ticket/WorkticketServiceImpl.java

@@ -10,6 +10,8 @@ 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 java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.Callable;
@@ -175,6 +177,10 @@ public class WorkticketServiceImpl extends ServiceImpl<WorkticketMapper, Worktic
 
 
         List<Map> maps = new ArrayList<>();
+        Map  totalmap =  new HashMap();
+        int total =0;
+        int failnum= 0;
+        int quanum = 0;
         for (Datadictionary type : datalist) {
 
             String[] newtype = new String[]{type.getParam()};
@@ -188,14 +194,24 @@ public class WorkticketServiceImpl extends ServiceImpl<WorkticketMapper, Worktic
                 map.put("workdept", wp);
                 maps.add(map);
             }*/
-            Map map = workticketMapper.selectWorkticketPer(workdepts, newtype, st, et);
+            Map map = workticketMapper.selectWorkticketPer(workdepts, type.getParam(), st, et);
+            total += Integer.valueOf(map.get("total").toString());
+            failnum += Integer.valueOf(map.get("failnum").toString());
+            quanum += Integer.valueOf(map.get("quanum").toString());
+            totalmap.put("per",Integer.valueOf(map.get("quanum").toString())/Integer.valueOf(map.get("total").toString())*100);
             map.put("wtickettype", type.getParam());
             maps.add(map);
 
         }
-        Map map = workticketMapper.selectWorkticketPer(workdepts, types, st, et);
-        map.put("wtickettype", "总计");
-        maps.add(map);
+//        Map map = workticketMapper.selectWorkticketPer(workdepts, types, st, et);
+        totalmap.put("wtickettype", "总计");
+        totalmap.put("total",total);
+        totalmap.put("failnum",failnum);
+        totalmap.put("quanum",quanum);
+        DecimalFormat df = new DecimalFormat("#.000");
+        Double per = Double.valueOf(df.format((double)quanum/total))*100;
+        totalmap.put("per",per);
+        maps.add(totalmap);
         return maps;
     }
 }

+ 3 - 1
src/main/java/com/gyee/viewticket/tasks/warningTask.java

@@ -41,7 +41,7 @@ public class warningTask {
 
     //"0 15 10 ? * MON-FRI" 周一至周五的上午10:15触发
     @Scheduled(cron = "0 25 10 ? * FRI")
-//    @Scheduled(fixedDelay = 2000)
+    //@Scheduled(fixedDelay = 2000)
     public void task() {
 
         SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
@@ -84,6 +84,8 @@ public class warningTask {
                         alarmstat.setTime(i.getTime());
                         alarmstat.setLevel(getLevel(i.getRelateParts()));
                         alarmstat.setLocation(CacheContext.wdmap.get(i.getWindturbineId()).getLocation());
+                        alarmstat.setConfirm("N");
+                        alarmstat.setProcess("N");
                         alarmstatService.insetAlarmstat(alarmstat);
                     } catch (ParseException e) {
                         e.printStackTrace();

+ 87 - 31
src/main/resources/mapper/ticket/WorkticketMapper.xml

@@ -282,20 +282,31 @@
         w.wspeed,
         CASE WHEN w.startdate IS NULL THEN w.applyfirestarttime ELSE w.startdate END AS startdate,
         CASE WHEN w.enddate IS NULL THEN w.applyfireendtime ELSE w.enddate END AS enddate,
-        w.signatory,
         CASE WHEN w.inceptdate IS NULL THEN  w.signdate ELSE w.inceptdate END AS inceptdate,
-        CASE WHEN w.fiatuser1 IS NULL THEN w.fiatuser ELSE w.fiatuser1 END AS fiatuser1,
-        w.fiatdate,
+        w.signatory,
         w.startworktime,
         w.newdate,
-        w.finaltime,
+        CASE WHEN w.finaltime IS NULL THEN w.fireendtime ELSE w.finaltime END AS finaltime,
         w.status,
         w.workdept,
         w.remark3 persons,
         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
+        w.applyfirestarttime,
+        w.applyfireendtime,
+        w.fireendtime,
+        <if test="'风场动火' == type or '二级动火' == type">
+            w.fiatuser8 AS fiatuser1,
+            w.fiatdate1 as fiatdate1,
+            CASE WHEN w.fireendtime IS NULL THEN '1' ELSE '0' END AS tag,
+            CASE WHEN w.fireendtime IS NULL  THEN '不合格' ELSE '正常' END as tagdes
+        </if>
+        <if test="'风场动火' != type and '二级动火' != type">
+            CASE WHEN w.fiatuser1 IS NULL THEN w.fiatuser ELSE w.fiatuser1 END AS fiatuser1,
+            w.fiatdate,
+            CASE WHEN w.finaltime IS NULL THEN '1' ELSE '0' END AS tag,
+            CASE WHEN w.finaltime IS NULL  THEN '不合格' ELSE '正常' END as tagdes
+        </if>
         FROM
         workticket w
         LEFT JOIN LOCATIONS e ON w.wtnum = e.LOCATION
@@ -304,17 +315,34 @@
         <where>
         <if test="st !=null and et !=null">
 
-            and ((w.finaltime >= #{st} and w.finaltime &lt;= #{et})
-            or (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 )
-            and  w.finaltime is  null
-            and  w.newdate is  null)
-            or (  w.newdate IS not null
-            and w.startdate >= #{st} and w.startdate &lt;= #{et}
-            AND w.enddate >= #{st} and w.enddate &lt;= #{et}
-            AND w.newdate >= #{st} and w.newdate &lt;= #{et}
-            and w.newdate &lt;= CONVERT ( VARCHAR, GETDATE ( ), 20 )))
+
+            <if test="'风场动火' == type or '二级动火' == type">
+                and ((w.fireendtime >= #{st} and w.fireendtime &lt;= #{et})
+                or (w.applyfirestarttime >= #{st} and w.applyfirestarttime &lt;= #{et}
+                and w.applyfireendtime >= #{st} and w.applyfireendtime &lt;= #{et}
+                AND w.applyfireendtime &lt;= CONVERT ( VARCHAR, GETDATE ( ), 20 )
+                and  w.fireendtime is  null
+                and  w.newdate is  null)
+                or (  w.newdate IS not null
+                and w.applyfirestarttime >= #{st} and w.applyfirestarttime &lt;= #{et}
+                AND w.applyfireendtime >= #{st} and w.applyfireendtime &lt;= #{et}
+                AND w.newdate >= #{st} and w.newdate &lt;= #{et}
+                and w.newdate &lt;= CONVERT ( VARCHAR, GETDATE (), 20 )))
+            </if>
+
+            <if test="'风场动火' != type and '二级动火' != type">
+                and ((w.finaltime >= #{st} and w.finaltime &lt;= #{et})
+                or (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 )
+                and  w.finaltime is  null
+                and  w.newdate is  null)
+                or (  w.newdate IS not null
+                and w.startdate >= #{st} and w.startdate &lt;= #{et}
+                AND w.enddate >= #{st} and w.enddate &lt;= #{et}
+                AND w.newdate >= #{st} and w.newdate &lt;= #{et}
+                and w.newdate &lt;= CONVERT ( VARCHAR, GETDATE ( ), 20 )))
+            </if>
 
         </if>
 
@@ -345,7 +373,17 @@
         w.finaltime,
         w.status,
         w.workdept,
-        CASE WHEN w.finaltime IS NULL THEN '1' ELSE '0' END AS tag
+        w.applyfirestarttime,
+        w.applyfireendtime,
+        w.fireendtime,
+        <if test="'风场动火' == type or '二级动火' == type">
+            CASE WHEN w.fireendtime IS NULL THEN '1' ELSE '0' END AS tag,
+            CASE WHEN w.fireendtime IS NULL  THEN '不合格' ELSE '正常' END as tagdes
+        </if>
+        <if test="'风场动火' != type and '二级动火' != type">
+            CASE WHEN w.finaltime IS NULL THEN '1' ELSE '0' END AS tag,
+            CASE WHEN w.finaltime IS NULL  THEN '不合格' ELSE '正常' END as tagdes
+        </if>
         FROM
         workticket w
         LEFT JOIN LOCATIONS e ON w.wtnum = e.LOCATION
@@ -353,26 +391,44 @@
         <where>
             <if test="st !=null and et !=null">
 
-                and ((w.finaltime >= #{st} and w.finaltime &lt;= #{et})
-                or (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 )
-                and  w.finaltime is  null
-                and  w.newdate is  null)
-                or (  w.newdate IS not null
-                and w.startdate >= #{st} and w.startdate &lt;= #{et}
-                AND w.enddate >= #{st} and w.enddate &lt;= #{et}
-                AND w.newdate >= #{st} and w.newdate &lt;= #{et}
-                and w.newdate &lt;= CONVERT ( VARCHAR, GETDATE ( ), 20 )))
+                <if test="'风场动火' == type or '二级动火' == type">
+                    and ((w.fireendtime >= #{st} and w.fireendtime &lt;= #{et})
+                    or (w.applyfirestarttime >= #{st} and w.applyfirestarttime &lt;= #{et}
+                    and w.applyfireendtime >= #{st} and w.applyfireendtime &lt;= #{et}
+                    AND w.applyfireendtime &lt;= CONVERT ( VARCHAR, GETDATE ( ), 20 )
+                    and  w.fireendtime is  null
+                    and  w.newdate is  null)
+                    or (  w.newdate IS not null
+                    and w.applyfirestarttime >= #{st} and w.applyfirestarttime &lt;= #{et}
+                    AND w.applyfireendtime >= #{st} and w.applyfireendtime &lt;= #{et}
+                    AND w.newdate >= #{st} and w.newdate &lt;= #{et}
+                    and w.newdate &lt;= CONVERT ( VARCHAR, GETDATE (), 20 )))
+                </if>
+
+                <if test="'风场动火' != type and '二级动火' != type">
+                    and ((w.finaltime >= #{st} and w.finaltime &lt;= #{et})
+                    or (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 )
+                    and  w.finaltime is  null
+                    and  w.newdate is  null)
+                    or (  w.newdate IS not null
+                    and w.startdate >= #{st} and w.startdate &lt;= #{et}
+                    AND w.enddate >= #{st} and w.enddate &lt;= #{et}
+                    AND w.newdate >= #{st} and w.newdate &lt;= #{et}
+                    and w.newdate &lt;= CONVERT ( VARCHAR, GETDATE ( ), 20 )))
+                </if>
 
             </if>
 
 
             <if test="null != type">
-                and  w.wtickettype in
+
+                and  w.wtickettype = #{type}
+   <!--             and  w.wtickettype in
                 <foreach item="item" collection="type" open="(" separator="," close=")">
                     #{item,jdbcType=VARCHAR}
-                </foreach>
+                </foreach>-->
 
             </if>