Browse Source

健康配置

xieshengjie 2 years ago
parent
commit
1321e15538

+ 49 - 0
common/src/main/java/com/gyee/common/model/Healthconfig.java

@@ -0,0 +1,49 @@
+package com.gyee.common.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-09-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("HEALTHCONFIG")
+public class Healthconfig extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("WPID")
+    private String wpid;
+
+    @TableField("WPNAME")
+    private String wpname;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("FORMULA")
+    private String formula;
+
+    @TableField("FORMULAMAX")
+    private String formulamax;
+
+    @TableField("FORMULASCORE")
+    private Double formulascore;
+
+
+}

+ 28 - 0
web/consumer/src/main/java/com/gyee/consumer/api/knowleage/KnowledgeApi.java

@@ -235,4 +235,32 @@ public interface KnowledgeApi {
      */
     @DeleteMapping("/ratingremove")
     public R ratingremove(@RequestBody Evaluationdatasource evaluationdatasource);
+
+    /**
+     * 健康配置
+     * @param wpid
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/health")
+    public R health(@RequestParam(value = "wpid",required = true) String wpid,
+                    @RequestParam(value = "pageNum",required = true) String pageNum,
+                    @RequestParam(value = "pageSize",required = true) String pageSize
+    );
+
+
+    /**
+     * 健康编辑
+     * @return
+     */
+    @PostMapping("/healthedit")
+    public R healthedit(@RequestBody Healthconfig healthconfig);
+
+    /**
+     * 健康删除
+     * @return
+     */
+    @DeleteMapping("/healthremove")
+    public R healthremove(@RequestBody Healthconfig healthconfig);
 }

+ 41 - 0
web/consumer/src/main/java/com/gyee/consumer/controller/knowleage/KnowleageController.java

@@ -327,4 +327,45 @@ public class KnowleageController {
     public R ratingremove(@RequestBody Evaluationdatasource evaluationdatasource){
         return knowledgeApi.ratingremove(evaluationdatasource);
     }
+
+
+    /**
+     * 健康配置
+     * @param wpid
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/consumer/knowledge//health")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R health(@RequestParam(value = "wpid",required = true) String wpid,
+                    @RequestParam(value = "pageNum",required = true) String pageNum,
+                    @RequestParam(value = "pageSize",required = true) String pageSize
+    ){
+        return knowledgeApi.health(wpid,pageNum,pageSize);
+    }
+
+
+    /**
+     * 健康编辑
+     * @return
+     */
+    @PostMapping("/consumer/knowledge//healthedit")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R healthedit(@RequestBody Healthconfig healthconfig){
+        return knowledgeApi.healthedit(healthconfig);
+    }
+
+    /**
+     * 健康删除
+     * @return
+     */
+    @DeleteMapping("/consumer/knowledge/healthremove")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R healthremove(@RequestBody Healthconfig healthconfig){
+        return knowledgeApi.healthremove(healthconfig);
+    }
 }

+ 20 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/controller/auto/HealthconfigController.java

@@ -0,0 +1,20 @@
+package com.gyee.knowledge.controller.auto;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-09-24
+ */
+@RestController
+@RequestMapping("//healthconfig")
+public class HealthconfigController {
+
+}

+ 59 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/controller/knowledge/KnowledgeController.java

@@ -506,5 +506,64 @@ public class KnowledgeController {
         }
     }
 
+    /**
+     * 健康配置
+     * @param wpid
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/health")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R health(@RequestParam(value = "wpid",required = true) String wpid,
+                    @RequestParam(value = "pageNum",required = true) String pageNum,
+                    @RequestParam(value = "pageSize",required = true) String pageSize
+    )  {
+
+        List<Healthconfig> resultlist = knowledgeService.health(wpid,pageNum,pageSize);
+        if (StringUtils.isNotNull(resultlist)) {
+            return R.ok(resultlist.size()).data(resultlist);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+
+    /**
+     * 等级评估编辑
+     * @return
+     */
+    @PostMapping("/healthedit")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R healthedit(@RequestBody Healthconfig healthconfig)  {
+
+        Boolean result = knowledgeService.healthedit(healthconfig);
+        if (StringUtils.isNotNull(result)) {
+            return R.ok().data(result);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+    /**
+     * 等级评估删除
+     * @return
+     */
+    @DeleteMapping("/healthremove")
+    @ResponseBody
+    @CrossOrigin(origins = "*", maxAge = 3600)
+    public R healthremove(@RequestBody Healthconfig healthconfig)  {
+
+        Boolean result = knowledgeService.healthremove(healthconfig);
+        if (StringUtils.isNotNull(result)) {
+            return R.ok().data(result);
+        }else{
+            return R.error().message("访问失败");
+        }
+    }
+
+
 
 }

+ 16 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/mapper/auto/HealthconfigMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.knowledge.mapper.auto;
+
+import com.gyee.knowledge.model.auto.Healthconfig;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-09-24
+ */
+public interface HealthconfigMapper extends BaseMapper<Healthconfig> {
+
+}

+ 50 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/model/auto/Healthconfig.java

@@ -0,0 +1,50 @@
+package com.gyee.knowledge.model.auto;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-09-24
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@TableName("HEALTHCONFIG")
+public class Healthconfig extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableField("ID")
+    private String id;
+
+    @TableField("WPID")
+    private String wpid;
+
+    @TableField("WPNAME")
+    private String wpname;
+
+    @TableField("MODELID")
+    private String modelid;
+
+    @TableField("NAME")
+    private String name;
+
+    @TableField("FORMULA")
+    private String formula;
+
+    @TableField("FORMULAMAX")
+    private String formulamax;
+
+    @TableField("FORMULASCORE")
+    private Double formulascore;
+
+
+}

+ 16 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/service/auto/IHealthconfigService.java

@@ -0,0 +1,16 @@
+package com.gyee.knowledge.service.auto;
+
+import com.gyee.knowledge.model.auto.Healthconfig;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-09-24
+ */
+public interface IHealthconfigService extends IService<Healthconfig> {
+
+}

+ 20 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/service/auto/impl/HealthconfigServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.knowledge.service.auto.impl;
+
+import com.gyee.knowledge.model.auto.Healthconfig;
+import com.gyee.knowledge.mapper.auto.HealthconfigMapper;
+import com.gyee.knowledge.service.auto.IHealthconfigService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 谢生杰
+ * @since 2022-09-24
+ */
+@Service
+public class HealthconfigServiceImpl extends ServiceImpl<HealthconfigMapper, Healthconfig> implements IHealthconfigService {
+
+}

+ 23 - 0
web/knowledge-hb/src/main/java/com/gyee/knowledge/service/knowledge/KnowledgeService.java

@@ -32,6 +32,8 @@ public class KnowledgeService {
     private IRiskprecService iRiskprecService;
     @Resource
     private IEvaluationdatasourceService evaluationdatasourceService;
+    @Resource
+    private IHealthconfigService healthconfigService;
 
 
     public List<P3DeviceFault> faultKnowledge(String gzjb, String tjlx, String cxnr, String pageNum, String pageSize) {
@@ -227,4 +229,25 @@ public class KnowledgeService {
         boolean b = evaluationdatasourceService.removeById(evaluationdatasource.getTargetid());
         return b;
     }
+
+    public List<Healthconfig> health(String wpid, String pageNum, String pageSize) {
+        QueryWrapper<Healthconfig> qw = new QueryWrapper<>();
+        if (StringUtils.isNotEmpty(wpid)){
+            qw.like("wpid",wpid);
+        }
+        Page<Healthconfig> page = new Page<>(Integer.parseInt(pageNum),Integer.parseInt(pageSize));
+        Page<Healthconfig> p3DeviceFaultPage = healthconfigService.getBaseMapper().selectPage(page, qw);
+        List<Healthconfig> list = p3DeviceFaultPage.getRecords();
+        return list;
+    }
+
+    public Boolean healthedit(Healthconfig healthconfig) {
+        boolean b = healthconfigService.saveOrUpdate(healthconfig);
+        return b;
+    }
+
+    public Boolean healthremove(Healthconfig healthconfig) {
+        boolean b = healthconfigService.removeById(healthconfig.getId());
+        return b;
+    }
 }