Browse Source

Merge branch 'master' of http://124.70.43.205:3000/xieshengjie/sis-background

chenminghua 2 years ago
parent
commit
73e011e38c

+ 1 - 0
gyee-sample-impala/readme/readme.txt

@@ -0,0 +1 @@
+casefaultrepair检修数据表

+ 51 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/controller/sample/cases/CasefaultrepairController.java

@@ -0,0 +1,51 @@
+package com.gyee.impala.controller.sample.cases;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.gyee.impala.common.result.JsonResult;
+import com.gyee.impala.common.result.ResultCode;
+import com.gyee.impala.model.master.Casefaultrepair;
+import com.gyee.impala.model.master.ICasefaultrepairService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author gfhd
+ * @since 2022-10-13
+ */
+@RestController
+@RequestMapping("/case")
+public class CasefaultrepairController {
+
+    @Resource
+    private ICasefaultrepairService casefaultrepairService;
+
+    @GetMapping("/faultrepair/list")
+    public JSONObject faultRepairList(@RequestParam(value = "windturbineid",required = false) String windturbineid,
+                                      @RequestParam(value = "starttime",required = false) String starttime,
+                                      @RequestParam(value = "endtime",required = false) String endtime){
+        QueryWrapper<Casefaultrepair> wrapper = new QueryWrapper<>();
+        wrapper.eq(StringUtils.isNotEmpty(windturbineid),"windturbineid",windturbineid)
+                .gt(StringUtils.isNotEmpty(starttime),"starttime",starttime)
+                .lt(StringUtils.isNotEmpty(endtime),"starttime",endtime)
+                .orderByDesc("starttime");
+        List<Casefaultrepair> list = casefaultrepairService.list(wrapper);
+        return JsonResult.successData(ResultCode.SUCCESS, list);
+    }
+    @PostMapping("/faultrepair/addorupdate")
+    public JSONObject faultRepairAddOrUpdate(@RequestBody Casefaultrepair cf){
+        if(cf.getId()!=null){
+            casefaultrepairService.updateById(cf);
+        }else{
+            casefaultrepairService.save(cf);
+        }
+        return JsonResult.success();
+    }
+}

+ 7 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/mapper/master/CasefaultrepairMapper.java

@@ -2,6 +2,7 @@ package com.gyee.impala.mapper.master;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.impala.model.master.Casefaultrepair;
+import org.apache.ibatis.annotations.Select;
 
 /**
  * <p>
@@ -13,4 +14,10 @@ import com.gyee.impala.model.master.Casefaultrepair;
  */
 public interface CasefaultrepairMapper extends BaseMapper<Casefaultrepair> {
 
+    /**
+     * 查询时间最大的一条数据
+     * @return
+     */
+    @Select("SELECT max(endtime) from casefaultrepair")
+    String getMaxByTime();
 }

+ 2 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/model/master/ICasefaultrepairService.java

@@ -16,4 +16,6 @@ import java.util.List;
 public interface ICasefaultrepairService extends IService<Casefaultrepair> {
 
     void insertBatch(List<Casefaultrepair> list) throws KuduException;
+
+    String selectMaxTime();
 }

+ 4 - 3
gyee-sample-impala/src/main/java/com/gyee/impala/schdule/TaskEQInspect.java

@@ -47,8 +47,9 @@ public class TaskEQInspect {
      */
     @Scheduled(cron = "0 30 1 ? * 6")
     public void caseFaultRepair(){
+        String time = casefaultrepairService.selectMaxTime();
         QueryWrapper<EqQxjcljl> wrapper = new QueryWrapper<>();
-        wrapper.notLike("USE_DEPT", "光伏");
+        wrapper.notLike("USE_DEPT", "光伏").gt("ENDDATE",time);
         List<EqQxjcljl> list = iEqQxjcljlService.list(wrapper);
         List<Casefaultrepair> casefaultrepairs = new ArrayList<>();
         for (EqQxjcljl eqxjcljl : list) {
@@ -78,7 +79,7 @@ public class TaskEQInspect {
             e.printStackTrace();
         }
     }
-
+    //OA检修获取故障类型
     private String getFaultType(String qxname) {
         if(gzlx==null ||gzlx.size()==0){
             gzlx = new HashMap<>();
@@ -95,7 +96,7 @@ public class TaskEQInspect {
         }
         return "QT";
     }
-
+    //OA检修获取风机id
     private String getWtId(String stid, String equipmentName) {
         if(stid==null||equipmentName==null) return null;
         String fj = equipmentName.replace("#", "").replace("风机", "");

+ 5 - 0
gyee-sample-impala/src/main/java/com/gyee/impala/service/impl/master/CasefaultrepairServiceImpl.java

@@ -67,4 +67,9 @@ public class CasefaultrepairServiceImpl extends ServiceImpl<CasefaultrepairMappe
         // 关闭和kudu的会话
         kuduSession.close();
     }
+
+    @Override
+    public String selectMaxTime() {
+        return baseMapper.getMaxByTime();
+    }
 }