Просмотр исходного кода

移植新版健康管理后台项目

shilin 1 год назад
Родитель
Сommit
4f04231248

+ 262 - 0
web/health/src/main/java/com/gyee/health/controller/health/HealthMainController.java

@@ -3,6 +3,12 @@ package com.gyee.health.controller.health;
 
 import com.gyee.health.dto.AjaxResult;
 import com.gyee.health.dto.AjaxStatus;
+import com.gyee.health.init.CacheContext;
+import com.gyee.health.model.auto.ProBasicEquipment;
+import com.gyee.health.model.auto.ProBasicLine;
+import com.gyee.health.model.auto.ProBasicPowerstation;
+import com.gyee.health.model.auto.ProBasicProject;
+import com.gyee.health.model.custom.StopTypeTreeVo;
 import com.gyee.health.service.health.HealthMainService;
 import com.gyee.health.util.StringUtils;
 import io.swagger.annotations.Api;
@@ -10,12 +16,15 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 @Controller
@@ -119,4 +128,257 @@ public class HealthMainController {
         }
 
     }
+
+
+    /**
+     * 风场下拉接口
+     * @return
+     */
+    @GetMapping("/windfarmAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "查询风电场数据列表", notes = "查询风电场数据列表")
+    public AjaxResult windfarmAjax() {
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+
+        for (ProBasicPowerstation station : CacheContext.wpls) {
+            StopTypeTreeVo vo = new StopTypeTreeVo();
+            vo.setId(station.getId());
+            vo.setName(station.getName());
+            vo.setpId("0");
+            vos.add(vo);
+        }
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
+
+
+
+    /**
+     * 项目下拉接口
+     * @return
+     */
+    @GetMapping("/projectAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "通过风场编号查询项目数据列表", notes = "通过风场编号查询项目数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpIds", value = "风场编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult projectAjax(String wpIds) {
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+        if (StringUtils.notEmp(wpIds) && CacheContext.projmap.containsKey(wpIds)) {
+
+            List<ProBasicProject>  pjls = CacheContext.projmap.get(wpIds);
+
+            for (ProBasicProject project : pjls) {
+
+                StopTypeTreeVo vo = new StopTypeTreeVo();
+                vo.setId(project.getId());
+                vo.setName(project.getName());
+                vo.setpId("0");
+                vos.add(vo);
+            }
+        }
+
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
+
+
+    /**
+     * 所有风电场项目下拉接口
+     * @return
+     */
+    @GetMapping("/projectAllAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "查询风电项目数据列表", notes = "查询风电项目数据列表")
+    public AjaxResult projectAllAjax() {
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+        for (ProBasicProject project : CacheContext.pjls) {
+
+            StopTypeTreeVo vo = new StopTypeTreeVo();
+            vo.setId(project.getId());
+            vo.setName(project.getName());
+            vo.setpId("0");
+            vos.add(vo);
+        }
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
+
+
+    /**
+     * 线路下拉接口
+     * @return
+     */
+    @GetMapping("/lineAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "通过项目编号查询线路数据列表", notes = "通过项目编号查询线路数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pjIds", value = "项目编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult lineAjax(String pjIds) {
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+        if (StringUtils.notEmp(pjIds) && CacheContext.prolinemap.containsKey(pjIds)) {
+
+
+                List<ProBasicLine>  lnls = CacheContext.prolinemap.get(pjIds);
+
+                for (ProBasicLine line : lnls) {
+
+                    StopTypeTreeVo vo = new StopTypeTreeVo();
+                    vo.setId(line.getId());
+                    vo.setName(line.getName());
+                    vo.setpId("0");
+                    vos.add(vo);
+                }
+
+
+
+        }
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
+
+    /**
+     * 通过风电场ID获取风机下拉接口
+     * @return
+     */
+    @GetMapping("/windturbineAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "通过风场编号查询风机数据列表", notes = "通过风场编号查询风机数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult windturbineAjax(String wpId) {
+
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(wpId) && CacheContext.wpwtmap.containsKey(wpId)){
+
+            List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wpId);
+
+            for (ProBasicEquipment wt : wtls) {
+                StopTypeTreeVo vo = new StopTypeTreeVo();
+                vo.setId(wt.getId());
+                vo.setName(wt.getName());
+                vo.setpId("0");
+                vos.add(vo);
+            }
+        }
+
+
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
+
+
+    /**
+     * 通过项目D获取风机下拉接口
+     * @return
+     */
+    @GetMapping("/windturbineByPjIdAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "通过项目编号查询风机数据列表", notes = "通过项目编号查询风机数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pjId", value = "项目编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult windturbineByPjIdAjax(String pjId) throws Exception {
+
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(pjId) && CacheContext.pjwtmap.containsKey(pjId)){
+
+            List<ProBasicEquipment> wtls=CacheContext.pjwtmap.get(pjId);
+
+            for (ProBasicEquipment wt : wtls) {
+                StopTypeTreeVo vo = new StopTypeTreeVo();
+                vo.setId(wt.getId());
+                vo.setName(wt.getName());
+                vo.setpId("0");
+                vos.add(vo);
+            }
+        }
+
+
+
+
+
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
+
+
+    /**
+     * 通过线路ID获取风机下拉接口
+     * @return
+     */
+    @GetMapping("/windturbineByLnIdAjax")
+    @ResponseBody
+    @CrossOrigin
+    @ApiOperation(value = "通过线路编号查询风机数据列表", notes = "通过线路编号查询风机数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "lnId", value = "项目编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult windturbineByLnIdAjax(String lnId) throws Exception {
+
+        List<StopTypeTreeVo> vos = new ArrayList<>();
+
+        if (StringUtils.isNotEmpty(lnId) && CacheContext.lnwtmap.containsKey(lnId)){
+
+            List<ProBasicEquipment> wtls=CacheContext.lnwtmap.get(lnId);
+
+            for (ProBasicEquipment wt : wtls) {
+                StopTypeTreeVo vo = new StopTypeTreeVo();
+                vo.setId(wt.getId());
+                vo.setName(wt.getName());
+                vo.setpId("0");
+                vos.add(vo);
+            }
+        }
+
+
+        if(vos !=null && !vos.isEmpty())
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }else
+        {
+            return	AjaxResult.successData(AjaxStatus.success.code,vos);
+        }
+    }
 }

+ 8 - 8
web/health/src/main/java/com/gyee/health/controller/health/HealthReportController.java

@@ -35,7 +35,7 @@ public class HealthReportController {
 
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getEconHealthReportMain(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getEconHealthReportMain(String recordDate, String wtId) throws Exception {
 
 
         ProEconHealthReportMain vos = new ProEconHealthReportMain();
@@ -59,7 +59,7 @@ public class HealthReportController {
 
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getconHealthReportTargetMap(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getconHealthReportTargetMap(String recordDate, String wtId) throws Exception {
 
 
         Map<String, List<ProEconHealthReportTarget>> vos = new HashMap<>();
@@ -83,7 +83,7 @@ public class HealthReportController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getStateJudgment(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getStateJudgment(String recordDate, String wtId) throws Exception {
 
 
         StateJudgmentVo vos = new StateJudgmentVo();
@@ -106,7 +106,7 @@ public class HealthReportController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getHealthNumVoList(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getHealthNumVoList(String recordDate, String wtId) throws Exception {
 
 
         List<HealthNumVo> vos = new ArrayList<>();
@@ -130,7 +130,7 @@ public class HealthReportController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getEquipmentInfoDayTopVoList(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getEquipmentInfoDayTopVoList(String recordDate, String wtId) throws Exception {
 
 
         List<EquipmentInfoDayTopVo> vos = new ArrayList<>();
@@ -155,7 +155,7 @@ public class HealthReportController {
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "type", value = "类型(clx 齿轮箱,fdj 发电机,bj 变桨,zz 主轴)", required = true, dataType = "string", paramType = "query")
     })
-    public AjaxResult getHealthDataVlueVo(Date recordDate, String wtId, String type) throws Exception {
+    public AjaxResult getHealthDataVlueVo(String recordDate, String wtId, String type) throws Exception {
 
 
         List<DataVlueVo> vos = new ArrayList<>();
@@ -178,7 +178,7 @@ public class HealthReportController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getAlarmcountVoList(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getAlarmcountVoList(String recordDate, String wtId) throws Exception {
 
 
         List<AlarmcountResultVo> vos = new ArrayList<>();
@@ -201,7 +201,7 @@ public class HealthReportController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "wtId", value = "设备编号", required = true, dataType = "string", paramType = "query"),
             @ApiImplicitParam(name = "recordDate", value = "日期", required = true, dataType = "string", paramType = "query")})
-    public AjaxResult getHealthReportQxpc(Date recordDate, String wtId) throws Exception {
+    public AjaxResult getHealthReportQxpc(String recordDate, String wtId) throws Exception {
 
 
         List<DataVlueVo> vos = new ArrayList<>();

+ 522 - 0
web/health/src/main/java/com/gyee/health/controller/health/RecommenController.java

@@ -0,0 +1,522 @@
+package com.gyee.health.controller.health;
+
+
+import com.gyee.health.dto.AjaxResult;
+import com.gyee.health.dto.AjaxStatus;
+import com.gyee.health.model.auto.ProEconRecommenMain;
+import com.gyee.health.service.recommen.RecommenService;
+import com.gyee.health.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Controller
+@RequestMapping("/recommen")
+@Api(value = "健康风机推荐",tags =  "健康风机推荐")
+public class RecommenController {
+
+    @Resource
+    private RecommenService recommenService;
+
+    /**
+     * 获得当日健康推荐检修风机
+     * @return
+     */
+    @GetMapping("/getRecommenmainDay1")
+    @ResponseBody
+    @ApiOperation(value = "获得当日健康推荐检修风机", notes = "获得当日健康推荐检修风机")
+     public AjaxResult getRecommenmainDay1() {
+
+        List<ProEconRecommenMain> vos=new ArrayList<>();
+
+        vos=recommenService.getRecommenmainDay1();
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+    }
+
+    /**
+     * 获得3日健康推荐检修风机
+     * @return
+     */
+    @GetMapping("/getRecommenmainDay3")
+    @ResponseBody
+    @ApiOperation(value = "获得3日健康推荐检修风机", notes = "获得3日健康推荐检修风机")
+    public AjaxResult getRecommenmainDay3() {
+
+        List<ProEconRecommenMain> vos=new ArrayList<>();
+
+        vos=recommenService.getRecommenmainDay3();
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+    }
+
+    /**
+     * 获得7日健康推荐检修风机
+     * @return
+     */
+    @GetMapping("/getRecommenmainDay7")
+    @ResponseBody
+    @ApiOperation(value = "获得7日健康推荐检修风机", notes = "获得7日健康推荐检修风机")
+    public AjaxResult getRecommenmainDay7() {
+
+        List<ProEconRecommenMain> vos=new ArrayList<>();
+
+        vos=recommenService.getRecommenmainDay7();
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+    }
+
+    /**
+     * 确认推荐检修风机,并添加记录到生产系统
+     * @param rid
+     */
+    @PostMapping("/confirpush")
+    @ResponseBody
+    @ApiOperation(value = "确认推荐检修风机,并添加记录到生产系统", notes = "确认推荐检修风机,并添加记录到生产系统")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "rid", value = "推荐记录编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult confirpush(String rid)
+    {
+        int result=0;
+        if(StringUtils.notEmp(rid))
+        {
+            result= recommenService.confirpush(rid);
+        }
+
+        return AjaxResult.successData(AjaxStatus.success.code, result);
+    }
+
+    /**
+     * 全部确认不同时间段的推荐检修风机
+     * @param typeid 1代表全部确认当日推荐  2 代表全部确认三天推荐 3 代表全部确认未来七天推荐
+     */
+    @PostMapping("/confirpushAll")
+    @ResponseBody
+    @ApiOperation(value = "全部确认不同时间段的推荐检修风机", notes = "全部确认不同时间段的推荐检修风机")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "typeid", value = "类型编号 1代表全部确认当日推荐  2 代表全部确认三天推荐 3 代表全部确认未来七天推荐", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult confirpushAll(String typeid)
+    {
+
+        List<ProEconRecommenMain> vos=new ArrayList<>();
+
+        if (StringUtils.notEmp(typeid)) {
+            switch(typeid) {
+                case "1":
+                    vos=recommenService.getRecommenmainDay1();
+                    if(!vos.isEmpty())
+                    {
+                        for(ProEconRecommenMain vo:vos)
+                        {
+                            recommenService.confirpush(vo.getId());
+                        }
+                    }
+                    break;
+                case "2":
+                    vos=recommenService.getRecommenmainDay3();
+                    if(!vos.isEmpty())
+                    {
+                        for(ProEconRecommenMain vo:vos)
+                        {
+                            recommenService.confirpush(vo.getId());
+                        }
+                    }
+                    break;
+                case "3":
+                    vos=recommenService.getRecommenmainDay7();
+                    if(!vos.isEmpty())
+                    {
+                        for(ProEconRecommenMain vo:vos)
+                        {
+                            recommenService.confirpush(vo.getId());
+                        }
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        return AjaxResult.successData(AjaxStatus.success.code, 1);
+    }
+    /**
+     * 取消推荐检修风机
+     * @param rid
+     */
+    @PostMapping("/ignorepush")
+    @ResponseBody
+    @ApiOperation(value = "取消推荐检修风机", notes = "取消推荐检修风机")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "rid", value = "推荐记录编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult ignorepush(String rid)
+    {
+        int result=0;
+        if(StringUtils.notEmp(rid))
+        {
+            result= recommenService.ignorepush(rid);
+        }
+
+        return AjaxResult.successData(AjaxStatus.success.code, result);
+    }
+
+    /**
+     * 全部取消不同时间段的推荐检修风机
+     * @param typeid 1代表全部取消当日推荐  2 代表全部取消三天推荐 3 代表全部取消未来七天推荐
+     */
+    @PostMapping("/ignorepushAll")
+    @ResponseBody
+    @ApiOperation(value = "全部取消不同时间段的推荐检修风机", notes = "全部取消不同时间段的推荐检修风机")
+    @ApiImplicitParams({
+
+            @ApiImplicitParam(name = "typeid", value = "类型编号 1代表全部取消当日推荐  2 代表全部取消三天推荐 3 代表全部取消未来七天推荐", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult ignorepushAll(String typeid)
+    {
+
+        List<ProEconRecommenMain> vos=new ArrayList<>();
+
+        if (StringUtils.notEmp(typeid)) {
+            switch(typeid) {
+                case "1":
+                    vos=recommenService.getRecommenmainDay1();
+                    if(!vos.isEmpty())
+                    {
+                        for(ProEconRecommenMain vo:vos)
+                        {
+                            recommenService.ignorepush(vo.getId());
+                        }
+                    }
+                    break;
+                case "2":
+                    vos=recommenService.getRecommenmainDay3();
+                    if(!vos.isEmpty())
+                    {
+                        for(ProEconRecommenMain vo:vos)
+                        {
+                            recommenService.ignorepush(vo.getId());
+                        }
+                    }
+                    break;
+                case "3":
+                    vos=recommenService.getRecommenmainDay7();
+                    if(!vos.isEmpty())
+                    {
+                        for(ProEconRecommenMain vo:vos)
+                        {
+                            recommenService.ignorepush(vo.getId());
+                        }
+                    }
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        return AjaxResult.successData(AjaxStatus.success.code, 1);
+    }
+
+    /**
+     * 获得已经确认检修风机
+     * @return
+     */
+    @GetMapping("/recommenConfirmedList")
+    @ResponseBody
+    @ApiOperation(value = "获得已经确认检修风机", notes = "获得已经确认检修风机")
+
+    public AjaxResult recommenConfirmedList() {
+
+        List<ProEconRecommenMain> vos=new ArrayList<>();
+
+        vos=recommenService.recommenConfirmedList();
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+
+
+    }
+
+    /**
+     * 获得健康状态预测
+     * @param wpId
+     * @param type 1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势,
+     * @return map.put(" yslchart ", yslchart); //优数量
+     *             map.put("lslchart", lslchart);//良数量
+     *             map.put("cslchart", cslchart);//差数量
+     *             map.put("lvchart", lvchart);//健康率
+     *             map.put("datechart", datechart);//日期
+     * @throws Exception
+     */
+    @GetMapping("/findAllChartjz")
+    @ResponseBody
+    @ApiOperation(value = "获得健康状态预测", notes = "获得健康状态预测")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
+            @ApiImplicitParam(name = "type", value = "类型编号 1 表示24小时健康趋势,2 表示七天健康趋势 3 表示30天健康趋势", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult findAllChartjz(String wpId,  String type) throws Exception {
+
+        Map<String, Object[]> map = new HashMap<String, Object[]>();
+
+        if (StringUtils.notEmp(wpId) && StringUtils.notEmp(type) ) {
+
+            map=recommenService.findAllChartjz(wpId, type);
+
+        }
+        if (null!=map) {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, map);
+        }
+
+    }
+
+
+//    /**
+//     * 通过消缺单获得详细信息
+//     * @param rid
+//     * @return
+//     */
+//    @GetMapping("/findMainTrack")
+//    @ResponseBody
+//    @ApiOperation(value = "通过消缺单获得详细信息", notes = "通过消缺单获得详细信息")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "rid", value = "推荐检修编号", required = true, dataType = "string", paramType = "query")
+//        })
+//
+//    public AjaxResult findMainTrack(String rid) {
+//
+//        MainTrackVo vo = new MainTrackVo();
+//
+//        if(StringUtils.notEmp(rid))
+//        {
+//            vo =recommenService.findMainTrack(rid);
+//        }
+//
+//        return AjaxResult.successData(AjaxStatus.success.code, vo);
+//
+//    }
+//
+//    /**
+//     * 获得未完成消缺单列表
+//     * @return
+//     */
+//    @GetMapping("/unfinishedList")
+//    @ResponseBody
+//    @ApiOperation(value = "获得未完成消缺单列表", notes = "获得未完成消缺单列表")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")
+//    })
+//
+//    public AjaxResult unfinishedList(String wpId, String wtId, String beginDate, String endDate) {
+//
+//        List<WoBugEqVo> vos=new ArrayList<>();
+//
+//        if(StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate))
+//        {
+//            vos=recommenService.unfinishedList(wpId,wtId, DateUtils.parseDate(beginDate),DateUtils.parseDate(endDate));
+//        }
+//
+//        if (null!=vos) {
+//            return AjaxResult.successData(AjaxStatus.success.code, vos);
+//        } else {
+//            return AjaxResult.successData(AjaxStatus.success.code, vos);
+//        }
+//
+//    }
+//    /**
+//     * 获得完成消缺单列表
+//     * @return
+//     */
+//    @GetMapping("/finishedList")
+//    @ResponseBody
+//    @ApiOperation(value = "获得完成消缺单列表", notes = "获得完成消缺单列表")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "wpId", value = "风场编号", required = false, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")
+//    })
+//
+//    public AjaxResult finishedList(String wpId, String wtId, String beginDate, String endDate) {
+//
+//        List<WoBugEqVo> vos=new ArrayList<>();
+//
+//        if(StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate))
+//        {
+//            vos=recommenService.finishedList(wpId,wtId, DateUtils.parseDate(beginDate),DateUtils.parseDate(endDate) );
+//        }
+//
+//        if (null!=vos) {
+//            return AjaxResult.successData(AjaxStatus.success.code, vos);
+//        } else {
+//            return AjaxResult.successData(AjaxStatus.success.code, vos);
+//        }
+//
+//    }
+//
+//
+//    /**
+//     * 通过用户姓名和开始检修时间和结束检修时间获取手环实时和历史数据
+//     * @param name
+//     * @param beginDate
+//     * @param endDate
+//     * @return
+//     * @throws Exception
+//     */
+//    @GetMapping("/findShbraceletList")
+//    @ResponseBody
+//    @ApiOperation(value = "通过用户姓名和开始检修时间和结束检修时间获取手环实时和历史数据", notes = "通过用户姓名和开始检修时间和结束检修时间获取手环实时和历史数据")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "name", value = "名称", required = false, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "beginDate", value = "开始日期", required = true, dataType = "string", paramType = "query"),
+//            @ApiImplicitParam(name = "endDate", value = "结束日期", required = true, dataType = "string", paramType = "query")
+//    })
+//
+//    public AjaxResult findShbraceletList(String name,String beginDate,String endDate) throws Exception {
+//
+//        Map<String,Map<String,Object>> result=new HashMap<>();
+//
+//        if(StringUtils.notEmp(beginDate) && StringUtils.notEmp(endDate))
+//        {
+//            result=recommenService.findShbraceletList(name,beginDate,endDate);
+//        }
+//
+//        if (null!=result) {
+//            return AjaxResult.successData(AjaxStatus.success.code, result);
+//        } else {
+//            return AjaxResult.successData(AjaxStatus.success.code, result);
+//        }
+//
+//    }
+//
+//
+//    /**
+//     * 获取部件结构树
+//     * @return
+//     */
+//    @GetMapping("/findLocationTreeByWtId")
+//    @ResponseBody
+//    @ApiOperation(value = "获取部件结构树", notes = "获取部件结构树")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "wtId", value = "风机编号", required = false, dataType = "string", paramType = "query")
+//    })
+//
+//    public AjaxResult findLocationTreeByWtId(String wtId) throws Exception {
+//
+//        List<ElementNode> vos=new ArrayList<>();
+//
+//        if(StringUtils.notEmp(wtId))
+//        {
+//
+//            vos=recommenService.findLocationTreeByWtId(wtId);
+//        }
+//
+//        return AjaxResult.successData(AjaxStatus.success.code, vos);
+//
+//    }
+//
+//    /**
+//     * 通过位置编号获得缺陷单信息
+//     * @return
+//     */
+//    @PostMapping("/findWobugeqByLocation")
+//    @ResponseBody
+//    @ApiOperation(value = "通过位置编号获得缺陷单信息", notes = "通过位置编号获得缺陷单信息")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "tablepar", value = "分页对象1", required = false, dataType = "Tablepar", paramType = "query"),
+//            @ApiImplicitParam(name = "location", value = "位置", required = true, dataType = "string", paramType = "query")
+//    })
+//    public AjaxResult findWobugeqByLocation(Tablepar tablepar, String location) throws Exception {
+//
+//        List<WoBugVo> vos=new ArrayList<>();
+//
+//        if(StringUtils.notEmp(tablepar) && StringUtils.notEmp(location))
+//        {
+//            Calendar c = Calendar.getInstance();
+//
+//            c.set(Calendar.HOUR_OF_DAY, 0);
+//            c.set(Calendar.MINUTE, 0);
+//            c.set(Calendar.SECOND, 0);
+//            c.set(Calendar.MILLISECOND,0);
+//
+//            c.set(Calendar.DAY_OF_YEAR, c.getActualMinimum(Calendar.DAY_OF_YEAR));
+//            Date beginDate = DateUtils.truncate(c.getTime());
+//            c.set(Calendar.DAY_OF_YEAR, c.getActualMaximum(Calendar.DAY_OF_YEAR));
+//            Date endDate = DateUtils.truncate(c.getTime());
+//            vos=recommenService.findWobugeqByLocation(tablepar,location, beginDate, endDate);
+//        }
+//
+//        if (null!=vos) {
+//            return AjaxResult.successData(AjaxStatus.success.code, vos);
+//        } else {
+//            return AjaxResult.successData(AjaxStatus.success.code, vos);
+//        }
+//
+//    }
+//
+//
+//    /**
+//     * 获得对应风机的1个月健康推荐检修记录
+//     * @return
+//     */
+//    @GetMapping("/getRecommenmainMonth")
+//    @ResponseBody
+//    @ApiOperation(value = "获得对应风机的1个月健康推荐检修记录", notes = "获得对应风机的1个月健康推荐检修记录")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "wtId", value = "风机编号", required = true, dataType = "string", paramType = "query")
+//    })
+//
+//    public AjaxResult getRecommenmainMonth(String wtId) throws Exception {
+//
+//        List<ProEconRecommenMain> result=new ArrayList<>();
+//
+//        if(StringUtils.notEmp(wtId))
+//        {
+//
+//            result=recommenService.getRecommenmainMonth(wtId);
+//        }
+//
+//        if (null!=result) {
+//            return AjaxResult.successData(AjaxStatus.success.code, result);
+//        } else {
+//            return AjaxResult.successData(AjaxStatus.success.code, result);
+//        }
+//
+//    }
+}

+ 55 - 0
web/health/src/main/java/com/gyee/health/controller/health/WindTurbineHealthListController.java

@@ -0,0 +1,55 @@
+package com.gyee.health.controller.health;
+
+
+import com.gyee.health.dto.AjaxResult;
+import com.gyee.health.dto.AjaxStatus;
+import com.gyee.health.model.custom.HealthmodelrecordsVo;
+import com.gyee.health.service.health.WindTurbineHealthListService;
+import com.gyee.health.util.StringUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+@Controller
+@RequestMapping("/wtHealthList")
+@Api(value = "风机健康列表" ,tags =  "风机健康列表")
+public class WindTurbineHealthListController {
+
+    @Resource
+    private WindTurbineHealthListService windTurbineHealthListService;
+
+    /**风机健康列表**/
+    @GetMapping("/windTurbineHealthList")
+    @ResponseBody
+    @ApiOperation(value = "风机健康列表", notes = "风机健康列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")})
+
+    public AjaxResult windTurbineHealthList(String wpId) throws Exception {
+
+        List<HealthmodelrecordsVo> vos = new ArrayList<HealthmodelrecordsVo>();
+        if (StringUtils.notEmp(wpId))
+        {
+            vos=windTurbineHealthListService.windTurbineHealthList(wpId);
+        }
+
+        if (null!=vos) {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        } else {
+            return AjaxResult.successData(AjaxStatus.success.code, vos);
+        }
+
+    }
+
+
+
+}

+ 1 - 1
web/health/src/main/java/com/gyee/health/init/CacheContext.java

@@ -157,7 +157,7 @@ public class CacheContext implements CommandLineRunner {
         //       wptempls.stream().filter(i->i.getId().equals("FS_FDC")).forEach(i->{
         wptempls.stream().forEach(i->{
 
-            if(!i.getId().contains("GDC"))
+            if(!i.getId().contains("GDC") && !i.getId().contains("MLJ"))
             {
                 wpls.add(i);
                 wpmap.put(i.getId(),i);

+ 5 - 3
web/health/src/main/java/com/gyee/health/mapper/auto/AlarmcountMapper.java

@@ -1,5 +1,6 @@
 package com.gyee.health.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.health.model.auto.Alarmcount;
 import com.gyee.health.model.vo.AlarmcountVo;
@@ -17,19 +18,20 @@ import java.util.List;
  * @author 石林
  * @since 2022-01-21
  */
+@DS("slave")
 public interface AlarmcountMapper extends BaseMapper<Alarmcount> {
-
+    @DS("slave")
     @Select(" select * from alarmcount where time is not null and snapid=#{snapid} and  alarmdate>=#{beginDate} and alarmdate<=#{endDate}   ")
     public List<Alarmcount> findAlarmcount(@Param(value = "snapid") Long snapid,@Param(value = "beginDate") Date beginDate, @Param(value = "endDate")Date endDate);
 
-
+    @DS("slave")
     @Select(" select s.alerttext as alertText,p.name as name ,s.windturbineid as wtId ,a.count as counts,a.time as times " +
             "    from   (select snapid,sum(count) as count,sum(time) as time from alarmcount" +
             "    where alarmdate>=#{beginDate} and  alarmdate<=#{endDate} group by snapid )" +
             "    a,alarmsnap s,windturbine_parts p where s.id=a.snapid and s.category3=p.id" +
             " and s.windturbineid=#{wtId}  ")
     public List<AlarmcountVo> findAlarmCountByWt(@Param(value = "wtId") String wtId, @Param(value = "beginDate") Date beginDate, @Param(value = "endDate")Date endDate);
-
+    @DS("slave")
 
     @Select(" select s.alerttext as alertText,p.name as name ,w.modelid as modelId ,a.count as counts,a.time as times " +
             "    from   (select snapid,sum(count) as count,sum(time) as time from alarmcount" +

+ 6 - 3
web/health/src/main/java/com/gyee/health/mapper/auto/AlarmsnapMapper.java

@@ -1,5 +1,6 @@
 package com.gyee.health.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.health.model.auto.Alarmsnap;
 import com.gyee.health.model.custom.TotalNumVo;
@@ -17,17 +18,19 @@ import java.util.List;
  * @author 石林
  * @since 2022-01-21
  */
+@DS("slave")
 public interface AlarmsnapMapper extends BaseMapper<Alarmsnap> {
 
+    @DS("slave")
     @Select(" select * from alarmsnap where alertvalue=#{alertvalue}  and windturbineid=#{wtid} ")
     List<Alarmsnap> getAlarmsnapList(  @Param(value = "wtid")String wtid,@Param(value = "alertvalue") Long alertvalue);
-
+    @DS("slave")
     @Select(" select distinct b.windturbineid,b.alertvalue from ${tname} a,alarmsnap b" +
             "    where a.snapid = b.id and category1='windturbine' and b.category2 is not null" +
             "    and b.category2!='other' " +
-            "    and a.alerttime>= ${beginDate} and a.alerttime &lt; ${endDate}")
+            "    and a.alerttime>= '${beginDate}' and a.alerttime < '${endDate}'")
     List<TotalNumsVo> getAlarmhistoryList(@Param("tname") String tname, @Param("beginDate") String beginDate, @Param("endDate") String endDate);
-
+    @DS("slave")
     @Select(" select t.altype typeId,r.ednavalue numbers,r.id,t.name from alertrule2 r,alertrulefailuresub t where t.tid=r.id and t.altype is not null ")
     List<TotalNumVo> findAlertrulefailuresubMap();
 

+ 3 - 2
web/health/src/main/java/com/gyee/health/mapper/auto/Alertrule2Mapper.java

@@ -1,5 +1,6 @@
 package com.gyee.health.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.health.model.auto.Alertrule2;
 import org.apache.ibatis.annotations.Param;
@@ -17,11 +18,11 @@ import java.util.List;
  */
 public interface Alertrule2Mapper extends BaseMapper<Alertrule2> {
 
-
+    @DS("slave")
     @Select(" select * from alertrule2 where station=#{station} and modelid=#{modelid} ")
     List<Alertrule2> findAlertRuleList(@Param(value = "station") String station, @Param(value = "modelid")String modelid);
 
-
+    @DS("slave")
     @Select(" select * from alertrule2 where station=#{station} and modelid=#{modelid} and name=#{name} ")
     List<Alertrule2> getAlertRuleIdByName(@Param(value = "station") String station, @Param(value = "modelid")String modelid, @Param(value = "name")String name);
 

+ 3 - 1
web/health/src/main/java/com/gyee/health/mapper/auto/AlertrulefailureMapper.java

@@ -1,5 +1,6 @@
 package com.gyee.health.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.health.model.auto.Alertrulefailure;
 import org.apache.ibatis.annotations.Param;
@@ -15,9 +16,10 @@ import java.util.List;
  * @author 石林
  * @since 2022-01-21
  */
+@DS("slave")
 public interface AlertrulefailureMapper extends BaseMapper<Alertrulefailure> {
 
-
+    @DS("slave")
     @Select(" select * from public.alertrulefailure f " +
             "where name=#{name} and model= #{model} order by name")
     public List<Alertrulefailure> getPartByAlertrule(@Param(value = "name") String name,@Param(value = "model") String model);

+ 3 - 1
web/health/src/main/java/com/gyee/health/mapper/auto/AlertrulefailuresubMapper.java

@@ -1,5 +1,6 @@
 package com.gyee.health.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.health.model.auto.Alertrulefailuresub;
 import org.apache.ibatis.annotations.Param;
@@ -15,8 +16,9 @@ import java.util.List;
  * @author 石林
  * @since 2022-01-21
  */
+@DS("slave")
 public interface AlertrulefailuresubMapper extends BaseMapper<Alertrulefailuresub> {
-
+    @DS("slave")
     @Select(" select altype from alertrulefailuresub where tid=#{tid}  ")
     public List<String> getPartByAlertruleid(@Param(value = "tid") String tid);
 

+ 2 - 0
web/health/src/main/java/com/gyee/health/mapper/auto/AlertrulesubMapper.java

@@ -1,5 +1,6 @@
 package com.gyee.health.mapper.auto;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.gyee.health.model.auto.Alertrulesub;
 
@@ -11,6 +12,7 @@ import com.gyee.health.model.auto.Alertrulesub;
  * @author 石林
  * @since 2022-01-20
  */
+@DS("slave")
 public interface AlertrulesubMapper extends BaseMapper<Alertrulesub> {
 
 }

+ 124 - 161
web/health/src/main/java/com/gyee/health/service/health/HealthOperationService.java

@@ -96,45 +96,45 @@ public class HealthOperationService {
             List<ProBasicPowerstation> wpList = CacheContext.wpls;
             for (int i = 0; i < wpList.size(); i++) {
 
-                    List<String> idls=new ArrayList<>();
-
-                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLHG001);
-                    idls.add(point.getNemCode());// 合格(正常)
-               // System.out.println("测点编号" +point.getNemCode());
-                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLLH001);
-                    idls.add(point.getNemCode());// 良好
-               // System.out.println("测点编号" +point.getNemCode());
-                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLZY001);
-                    idls.add(point.getNemCode());// 注意
-               // System.out.println("测点编号" +point.getNemCode());
-                    point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLYZ001);
-                    idls.add(point.getNemCode());// 严重
+                List<String> idls=new ArrayList<>();
+
+                ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLHG001);
+                idls.add(point.getNemCode());// 合格(正常)
+                // System.out.println("测点编号" +point.getNemCode());
+                point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLLH001);
+                idls.add(point.getNemCode());// 良好
+                // System.out.println("测点编号" +point.getNemCode());
+                point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLZY001);
+                idls.add(point.getNemCode());// 注意
+                // System.out.println("测点编号" +point.getNemCode());
+                point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLYZ001);
+                idls.add(point.getNemCode());// 严重
 
                 //System.out.println("测点编号" +point.getNemCode());
-                    List<PointData> pols=realApiUtil.getRealData(idls);
+                List<PointData> pols=realApiUtil.getRealData(idls);
 
-                    if(!pols.isEmpty() && pols.size()==idls.size())
-                    {
-                     //   System.out.println("取实时数据");
-                        Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
+                if(!pols.isEmpty() && pols.size()==idls.size())
+                {
+                    //   System.out.println("取实时数据");
+                    Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
                     //    System.out.println("ZC---"+zc);
-                        Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
-                     //   System.out.println("lh---"+lh);
-                        Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
-                       // System.out.println("zy---"+zy);
-                        Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
-                      //  System.out.println("yz---"+yz);
-
-                        hgList.add(zc);
-                        lhList.add(lh);
-                        zyList.add(zy);
-                        yzList.add(yz);
-
-                    }
+                    Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
+                    //   System.out.println("lh---"+lh);
+                    Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
+                    // System.out.println("zy---"+zy);
+                    Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
+                    //  System.out.println("yz---"+yz);
+
+                    hgList.add(zc);
+                    lhList.add(lh);
+                    zyList.add(zy);
+                    yzList.add(yz);
 
-                    name.add(wpList.get(i).getName());
                 }
 
+                name.add(wpList.get(i).getName());
+            }
+
             mapstatus.put("hgList", hgList);
             mapstatus.put("lhList", lhList);
             mapstatus.put("zyList", zyList);
@@ -145,34 +145,34 @@ public class HealthOperationService {
             List<ProBasicProject> pList = CacheContext.pjls;
             for (int i = 0; i < pList.size(); i++) {
 
-                    List<String> idls=new ArrayList<>();
+                List<String> idls=new ArrayList<>();
 
-                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLHG001);
-                    idls.add(point.getNemCode());// 合格(正常)
-                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLLH001);
-                    idls.add(point.getNemCode());// 良好
-                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLZY001);
-                    idls.add(point.getNemCode());// 注意
-                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLYZ001);
-                    idls.add(point.getNemCode());// 严重
+                ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLHG001);
+                idls.add(point.getNemCode());// 合格(正常)
+                point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLLH001);
+                idls.add(point.getNemCode());// 良好
+                point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLZY001);
+                idls.add(point.getNemCode());// 注意
+                point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLYZ001);
+                idls.add(point.getNemCode());// 严重
 
-                    List<PointData> pols=realApiUtil.getRealData(idls);
+                List<PointData> pols=realApiUtil.getRealData(idls);
 
-                    if(!pols.isEmpty() && pols.size()==idls.size())
-                    {
-                        Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
-                        Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
-                        Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
-                        Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
+                if(!pols.isEmpty() && pols.size()==idls.size())
+                {
+                    Integer zc = ((Double) pols.get(0).getPointValueInDouble()).intValue();
+                    Integer lh = ((Double) pols.get(1).getPointValueInDouble()).intValue();
+                    Integer zy = ((Double) pols.get(2).getPointValueInDouble()).intValue();
+                    Integer yz = ((Double) pols.get(3).getPointValueInDouble()).intValue();
 
-                        hgList.add(zc);
-                        lhList.add(lh);
-                        zyList.add(zy);
-                        yzList.add(yz);
+                    hgList.add(zc);
+                    lhList.add(lh);
+                    zyList.add(zy);
+                    yzList.add(yz);
 
-                    }
-                    name.add(pList.get(i).getName());
                 }
+                name.add(pList.get(i).getName());
+            }
 
             mapstatus.put("hgList", hgList);
             mapstatus.put("lhList", lhList);
@@ -189,50 +189,40 @@ public class HealthOperationService {
         Map<String, Object> mapstatus = new HashMap<String, Object>();
 
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
-        List<Integer> lhList = new ArrayList<Integer>();
-        List<Integer> zyList = new ArrayList<Integer>();
-        List<Integer> yzList = new ArrayList<Integer>();
+
         Calendar cl = Calendar.getInstance();
         cl.set(Calendar.HOUR_OF_DAY, 0);
         cl.set(Calendar.MINUTE, 0);
         cl.set(Calendar.SECOND, 0);
         Long start = cl.getTimeInMillis();
         Long end = new Date().getTime();
-        List<Map<String,String>> nameList = new ArrayList<Map<String,String>>();
+        List<Map<String,String>> nameList = new ArrayList<>();
         if ("1".equals(type)) {
             List<ProBasicPowerstation> wpList = CacheContext.wpls;
             Map<String,String> map=new HashMap<>();
             for (int i = 0; i < wpList.size(); i++) {
-                List<Integer> hgList = new ArrayList<Integer>();
-                List<String> tList = new ArrayList<String>();
+                List<Integer> hgList = new ArrayList<>();
+                List<String> tList = new ArrayList<>();
 
                 if ("1".equals(status)) {
                     ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLHG001);
                     String hgCode = point.getNemCode();// 合格(正常)
                     point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLLH001);
                     String lhCode = point.getNemCode();// 良好
-                    List<PointData> phgList = realApiUtil.getHistoryDatasSnap(hgCode, start / 1000, end / 1000, 1L,
-                            15 * 60L);
-                    List<PointData> plhList = realApiUtil.getHistoryDatasSnap(lhCode, start / 1000, end / 1000, 1L,
-                            15 * 60L);
+                    List<PointData> phgList = realApiUtil.getHistoryDatasSnap(hgCode, start / 1000, end / 1000, null,
+                            60 * 60L);
+                    List<PointData> plhList = realApiUtil.getHistoryDatasSnap(lhCode, start / 1000, end / 1000, null,
+                            60 * 60L);
 
-                    if (!phgList.isEmpty() && !plhList.isEmpty() && phgList.size() >= plhList.size()) {
+                    if (!phgList.isEmpty() && !plhList.isEmpty() && phgList.size() == plhList.size()) {
                         for (int ii = 0; ii < phgList.size(); ii++) {
-                            if (plhList.get(ii) == null) {
-                                Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue();
-                                String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
-                                time = time.substring(time.length() - 5);
-                                hgList.add(total);
-                                tList.add(time);
-                            } else {
-                                Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue()
-                                        + ((Double) plhList.get(ii).getPointValueInDouble()).intValue();
-                                String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
-                                time = time.substring(time.length() - 5);
-                                hgList.add(total);
-                                tList.add(time);
-                            }
 
+                            Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue()
+                                    + ((Double) plhList.get(ii).getPointValueInDouble()).intValue();
+                            String time = sdf.format(new Date(phgList.get(ii).getPointTime() ));
+                            time = time.substring(time.length() - 5);
+                            hgList.add(total);
+                            tList.add(time);
 
                         }
 
@@ -247,27 +237,20 @@ public class HealthOperationService {
                     String zyCode = point.getNemCode();// 注意
                     point = proBasicPowerstationPointService.getPowerstationPoint(wpList.get(i).getId(), ContantXk.JKSLYZ001);
                     String yzCode = point.getNemCode();// 严重
-                    List<PointData> pzyList = realApiUtil.getHistoryDatasSnap(zyCode, start / 1000, end / 1000, 0L,
-                            15 * 60L);
-                    List<PointData> pyzList = realApiUtil.getHistoryDatasSnap(yzCode, start / 1000, end / 1000, 0L,
-                            15 * 60L);
+                    List<PointData> pzyList = realApiUtil.getHistoryDatasSnap(zyCode, start / 1000, end / 1000, null,
+                            60 * 60L);
+                    List<PointData> pyzList = realApiUtil.getHistoryDatasSnap(yzCode, start / 1000, end / 1000, null,
+                            60 * 60L);
 
-                    if (!pzyList.isEmpty() && !pyzList.isEmpty() && pzyList.size() >= pyzList.size()) {
+                    if (!pzyList.isEmpty() && !pyzList.isEmpty() && pzyList.size() == pyzList.size()) {
                         for (int ii = 0; ii < pzyList.size(); ii++) {
-                            if (pyzList.get(ii) == null) {
-                                Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue();
-                                String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
-                                time = time.substring(time.length() - 5);
-                                hgList.add(total);
-                                tList.add(time);
-                            } else {
-                                Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue()
-                                        + ((Double) pyzList.get(ii).getPointValueInDouble()).intValue();
-                                String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
-                                time = time.substring(time.length() - 5);
-                                hgList.add(total);
-                                tList.add(time);
-                            }
+
+                            Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue()
+                                    + ((Double) pyzList.get(ii).getPointValueInDouble()).intValue();
+                            String time = sdf.format(new Date(pzyList.get(ii).getPointTime() ));
+                            time = time.substring(time.length() - 5);
+                            hgList.add(total);
+                            tList.add(time);
 
                             mapstatus.put(wpList.get(i).getId(), hgList);
                             mapstatus.put("time", tList);
@@ -291,79 +274,59 @@ public class HealthOperationService {
                 List<String> tList = new ArrayList<String>();
 
 
-                    if ("1".equals(status)) {
-                        ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLHG001);
-                        String hgCode = point.getNemCode();// 合格(正常)
-                        point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLLH001);
-                        String lhCode = point.getNemCode();// 良好
-                        List<PointData> phgList = realApiUtil.getHistoryDatasSnap(hgCode, start / 1000, end / 1000, 0L,
-                                15 * 60L);
-                        List<PointData> plhList = realApiUtil.getHistoryDatasSnap(lhCode, start / 1000, end / 1000, 0L,
-                                15 * 60L);
-
-                        if (!phgList.isEmpty() && !plhList.isEmpty() && phgList.size() >= plhList.size()) {
-                            for (int ii = 0; ii < phgList.size(); ii++) {
-                                if (plhList.get(ii) == null) {
-                                    Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue();
-                                    String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
-                                    time = time.substring(time.length() - 5);
-                                    hgList.add(total);
-                                    tList.add(time);
-                                } else {
-                                    Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue()
-                                            + ((Double) plhList.get(ii).getPointValueInDouble()).intValue();
-                                    String time = sdf.format(new Date(phgList.get(ii).getPointTime() * 1000));
-                                    time = time.substring(time.length() - 5);
-                                    hgList.add(total);
-                                    tList.add(time);
-                                }
-
-                            }
-
-                            mapstatus.put(pList.get(i).getNemCode(), hgList);
-                            mapstatus.put("time", tList);
+                if ("1".equals(status)) {
+                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLHG001);
+                    String hgCode = point.getNemCode();// 合格(正常)
+                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLLH001);
+                    String lhCode = point.getNemCode();// 良好
+                    List<PointData> phgList = realApiUtil.getHistoryDatasSnap(hgCode, start / 1000, end / 1000, null,
+                            60 * 60L);
+                    List<PointData> plhList = realApiUtil.getHistoryDatasSnap(lhCode, start / 1000, end / 1000, null,
+                            60 * 60L);
+
+                    if (!phgList.isEmpty() && !plhList.isEmpty() && phgList.size() == plhList.size()) {
+                        for (int ii = 0; ii < phgList.size(); ii++) {
 
+                            Integer total = ((Double) phgList.get(ii).getPointValueInDouble()).intValue()
+                                    + ((Double) plhList.get(ii).getPointValueInDouble()).intValue();
+                            String time = sdf.format(new Date(phgList.get(ii).getPointTime() ));
+                            time = time.substring(time.length() - 5);
+                            hgList.add(total);
+                            tList.add(time);
                         }
 
-                    } else {
-                        ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLZY001);
-                        String zyCode = point.getNemCode();// 注意
-                        point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLYZ001);
-                        String yzCode = point.getNemCode();// 严重
-                        List<PointData> pzyList = realApiUtil.getHistoryDatasSnap(zyCode, start / 1000, end / 1000, 0L,
-                                15 * 60L);
-                        List<PointData> pyzList = realApiUtil.getHistoryDatasSnap(yzCode, start / 1000, end / 1000, 0L,
-                                15 * 60L);
-
-                        if (!pzyList.isEmpty() && !pyzList.isEmpty() && pzyList.size() >= pyzList.size()) {
-                            for (int ii = 0; ii < pzyList.size(); ii++) {
-                                if (pyzList.get(ii) == null) {
-                                    Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue();
-                                    String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
-                                    time = time.substring(time.length() - 5);
-                                    hgList.add(total);
-                                    tList.add(time);
-                                } else {
-                                    Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue()
-                                            + ((Double) pyzList.get(ii).getPointValueInDouble()).intValue();
-                                    String time = sdf.format(new Date(pzyList.get(ii).getPointTime() * 1000));
-                                    time = time.substring(time.length() - 5);
-                                    hgList.add(total);
-                                    tList.add(time);
-                                }
-                            }
-
-                            mapstatus.put(pList.get(i).getNemCode(), hgList);
-                            mapstatus.put("time", tList);
+                        mapstatus.put(pList.get(i).getNemCode(), hgList);
+                        mapstatus.put("time", tList);
 
+                    }
+
+                } else {
+                    ProBasicPowerstationPoint point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLZY001);
+                    String zyCode = point.getNemCode();// 注意
+                    point = proBasicPowerstationPointService.getPowerstationPoint(pList.get(i).getId(), ContantXk.JKSLYZ001);
+                    String yzCode = point.getNemCode();// 严重
+                    List<PointData> pzyList = realApiUtil.getHistoryDatasSnap(zyCode, start / 1000, end / 1000, 0L,
+                            60 * 60L);
+                    List<PointData> pyzList = realApiUtil.getHistoryDatasSnap(yzCode, start / 1000, end / 1000, 0L,
+                            60 * 60L);
+
+                    if (!pzyList.isEmpty() && !pyzList.isEmpty() && pzyList.size() == pyzList.size()) {
+                        for (int ii = 0; ii < pzyList.size(); ii++) {
+                            Integer total = ((Double) pzyList.get(ii).getPointValueInDouble()).intValue()
+                                    + ((Double) pyzList.get(ii).getPointValueInDouble()).intValue();
+                            String time = sdf.format(new Date(pzyList.get(ii).getPointTime() ));
+                            time = time.substring(time.length() - 5);
+                            hgList.add(total);
+                            tList.add(time);
                         }
 
+                        mapstatus.put(pList.get(i).getNemCode(), hgList);
+                        mapstatus.put("time", tList);
                     }
-
+                }
 
                 map.put(pList.get(i).getId(),pList.get(i).getName());
 
-
             }
             nameList.add(map);
             mapstatus.put("name", nameList);

+ 268 - 0
web/health/src/main/java/com/gyee/health/service/health/WindTurbineHealthListService.java

@@ -0,0 +1,268 @@
+package com.gyee.health.service.health;
+
+
+import com.gyee.common.contant.ContantXk;
+import com.gyee.common.model.PointData;
+import com.gyee.health.init.CacheContext;
+import com.gyee.health.mapper.auto.AlarmsnapMapper;
+import com.gyee.health.model.auto.ProBasicEquipment;
+import com.gyee.health.model.auto.ProBasicEquipmentPoint;
+import com.gyee.health.model.custom.HealthmodelrecordsVo;
+import com.gyee.health.model.custom.TotalNumVo;
+import com.gyee.health.model.custom.TotalNumsVo;
+import com.gyee.health.service.auto.IProBasicEquipmentPointService;
+import com.gyee.health.util.IRealTimeDataBaseUtil;
+import com.gyee.health.util.RealTimeDataBaseFactory;
+import com.gyee.health.util.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@Service
+public class WindTurbineHealthListService {
+
+    @Resource
+    private AlarmsnapMapper alarmsnapMapper;
+    @Resource
+    private IProBasicEquipmentPointService proBasicEquipmentPointService;
+
+
+    IRealTimeDataBaseUtil realApiUtil = RealTimeDataBaseFactory.createRealTimeDataBase();
+    private final int digit = 2;
+
+    public List<HealthmodelrecordsVo> windTurbineHealthList(String wpId) throws Exception {
+
+        List<String> codels = new ArrayList<String>();
+        codels.add(ContantXk.JKZT100);
+        codels.add(ContantXk.JKZT002);
+        codels.add(ContantXk.JKZT003);
+        codels.add(ContantXk.JKZT004);
+        codels.add(ContantXk.JKZT005);
+
+        Calendar cal = Calendar.getInstance();
+        cal.set(Calendar.HOUR_OF_DAY, 0);
+        cal.set(Calendar.MINUTE, 0);
+        cal.set(Calendar.SECOND, 0);
+
+
+        Date beginDate = cal.getTime();
+
+        Map<String, List<PointData>> pointDataMap=new HashMap<>();
+        List<String> points = new ArrayList<>();
+        List<ProBasicEquipment> wtls=CacheContext.wpwtmap.get(wpId);
+        for (ProBasicEquipment wt : CacheContext.wpwtmap.get(wpId)) {
+
+            for (int i = 0; i < codels.size(); i++) {
+                ProBasicEquipmentPoint ai =proBasicEquipmentPointService.getEquipmentPoint(wt.getId(),codels.get(i));
+                points.add( ai.getNemCode());
+            }
+        }
+        // 获得风机健康状态结果数组
+        List<PointData> pointDataList = realApiUtil.getRealData(points);
+
+
+        if(!pointDataList.isEmpty())
+        {
+            for(int i=0;i<wtls.size();i++)
+            {
+                ProBasicEquipment wt=wtls.get(i);
+                List<PointData> templs=new ArrayList<>();
+                for(int j=0;j<5;j++)
+                {
+                    templs.add(pointDataList.get(i*5+j));
+                }
+                pointDataMap.put(wt.getId(),templs);
+            }
+
+        }
+
+
+
+        Map<String, List<String>> ahmap =getAlarmhistoryLMap(wpId);
+
+        Map<String, String> altypemap = findAlertrulefailuresubMap();
+
+        List<HealthmodelrecordsVo> vos = new ArrayList<>();
+        int id = 0;
+        if(CacheContext.wpwtmap.containsKey(wpId))
+        {
+            for (ProBasicEquipment wt : CacheContext.wpwtmap.get(wpId)) {
+                HealthmodelrecordsVo vo = new HealthmodelrecordsVo();
+                vo.setId(id);
+                vo.setRecodedate(beginDate);
+                vo.setWpid(wt.getWindpowerstationId());
+                vo.setWpname(CacheContext.wpmap.get(wt.getWindpowerstationId()).getName());
+                vo.setWtid(wt.getId());
+                vo.setWtname(wt.getId());
+                vo.setModel(wt.getModelId());
+
+
+                // 获得风机健康状态结果数组
+                List<PointData> jkvalues = pointDataMap.get(wt.getId());
+
+                double score = jkvalues.get(0).getPointValueInDouble();
+                double clxzt = jkvalues.get(1).getPointValueInDouble();
+                double fdjzt = jkvalues.get(2).getPointValueInDouble();
+                double bjzt = jkvalues.get(3).getPointValueInDouble();
+                double zkzt = jkvalues.get(4).getPointValueInDouble();
+
+
+                vo.setScore(StringUtils.round(score, 2));
+
+                vo.setClx(getStateValue(clxzt));
+                vo.setFdj(getStateValue(fdjzt));
+                vo.setBj(getStateValue(bjzt));
+                vo.setZk(getStateValue(zkzt));
+
+                vo.setBpq("优");
+                vo.setPh("优");
+                vo.setJc("优");
+                vo.setZz("优");
+
+                if(ahmap.containsKey(wt.getId()))
+                {
+                    List<String> ahtypels=ahmap.get(wt.getId());
+
+                    if(!ahtypels.isEmpty())
+                    {
+                        for(String type:ahtypels)
+                        {
+                            if(altypemap.containsKey(type))
+                            {
+                                String typetext=altypemap.get(type);
+
+                                switch (typetext) {
+                                    case "CLX":
+                                        vo.setClx("差");
+                                        break;
+                                    case "FDJ":
+                                        vo.setFdj("差");
+                                        break;
+                                    case "BJ":
+                                        vo.setBj("差");
+                                        break;
+                                    case "ZK":
+                                        vo.setZk("差");
+                                        break;
+                                    case "PH":
+                                        vo.setPh("差");
+                                        break;
+                                    case "JC":
+                                        vo.setJc("差");
+                                        break;
+                                    case "ZZ":
+                                        vo.setZz("差");
+                                        break;
+                                    default:
+                                        break;
+                                }
+                            }
+
+                        }
+                    }
+
+                }
+
+                Integer[] futureHealth = new Integer[12];
+                Random random = new Random();
+                for (int i = 0; i < 12; i++) {
+                    futureHealth[i] = random.nextInt(4) + 1;
+                }
+                vo.setFutureHealth(futureHealth);
+
+                int max = 100;
+                int min = 80;
+
+                double zxd = random.nextInt(max) % (max - min + 1) + min;
+                vo.setZxd(StringUtils.round(zxd, 2));
+                vos.add(vo);
+                id++;
+            }
+        }
+
+
+        return vos;
+    }
+
+    private String getStateValue(double value) {
+        String name;
+        if (value == 1 || value == 2) {
+            name = "优";
+        } else if (value == 3) {
+            name = "良";
+        } else {
+            name = "差";
+        }
+        return name;
+    }
+
+    private Map<String, List<String>> getAlarmhistoryLMap(String wpId) {
+
+        SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+        Map<String, List<String>> map = new HashMap<String, List<String>>();
+
+        Calendar cal = Calendar.getInstance();
+        Date endDate = cal.getTime();
+        cal.add(Calendar.MINUTE, -3);
+        Date beginDate = cal.getTime();
+
+//        for (Windpowerstation wp : CacheContext.wpls) {
+        if (wpId.endsWith("_FDC")) {
+
+            StringBuilder tablename = new StringBuilder();
+            tablename.append("alarmhistory_");
+            tablename.append(wpId.split("_")[0]);
+            tablename.append("_");
+            tablename.append(sdf_no_underline.format(endDate));
+
+
+
+            List<TotalNumsVo> list = alarmsnapMapper.getAlarmhistoryList(String.valueOf(tablename),sdf.format(beginDate),sdf.format(endDate));
+
+            if (!list.isEmpty()) {
+
+                for (TotalNumsVo vo : list) {
+
+                    if(map.containsKey(vo.getWindturbineid()))
+                    {
+                        List<String> ls=map.get(vo.getWindturbineid());
+                        ls.add(String.valueOf(vo.getAlertvalue()));
+                        map.put(vo.getWindturbineid(), ls);
+                    }else
+                    {
+                        List<String> ls=new ArrayList<>();
+                        ls.add(String.valueOf(vo.getAlertvalue()));
+                        map.put(vo.getWindturbineid(), ls);
+                    }
+
+                }
+            }
+        }
+//        }
+
+        return map;
+    }
+
+    private Map<String, String> findAlertrulefailuresubMap() {
+
+        Map<String, String> map = new HashMap<String, String>();
+
+        List<TotalNumVo> list =alarmsnapMapper.findAlertrulefailuresubMap();
+
+        if (!list.isEmpty()) {
+            for (TotalNumVo vo : list) {
+
+                map.put(String.valueOf(vo.getNumbers()),vo.getTypeId());
+            }
+        }
+
+        return map;
+    }
+
+}
+
+