|
@@ -1,13 +1,16 @@
|
|
|
package com.gyee.health.service.auto.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.gyee.health.init.CacheContext;
|
|
|
+import com.gyee.health.mapper.auto.AlarmTsMapper;
|
|
|
import com.gyee.health.mapper.auto.ProEconWarningMapper;
|
|
|
import com.gyee.health.model.auto.ProBasicPowerstation;
|
|
|
import com.gyee.health.model.auto.ProEconWarning;
|
|
|
import com.gyee.health.model.custom.SimpleVo;
|
|
|
+import com.gyee.health.model.custom.SimpleVo2;
|
|
|
+import com.gyee.health.model.vo.AlarmSuperTalbeType;
|
|
|
import com.gyee.health.service.TokenService;
|
|
|
import com.gyee.health.service.auto.IProEconWarningService;
|
|
|
+import com.gyee.health.util.DateUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
@@ -32,7 +35,7 @@ import java.util.List;
|
|
|
public class ProEconWarningServiceImpl extends ServiceImpl<ProEconWarningMapper, ProEconWarning> implements IProEconWarningService {
|
|
|
|
|
|
@Resource
|
|
|
- private ProEconWarningMapper proEconWarningMapper;
|
|
|
+ private AlarmTsMapper alarmTsMapper;
|
|
|
@Resource
|
|
|
private TokenService tokenService;
|
|
|
/**
|
|
@@ -45,40 +48,29 @@ public class ProEconWarningServiceImpl extends ServiceImpl<ProEconWarningMapper,
|
|
|
List<SimpleVo> vos=new ArrayList<>();
|
|
|
SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
- Date endDate = cal.getTime();
|
|
|
+ Date endDate = DateUtils.truncate(cal.getTime());
|
|
|
+ cal.add(Calendar.DAY_OF_MONTH,-7);
|
|
|
+ Date beginDate = DateUtils.truncate(cal.getTime());
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
|
|
List<ProBasicPowerstation> wpls = tokenService.getWpls(request);
|
|
|
- for(ProBasicPowerstation wp: wpls)
|
|
|
- {
|
|
|
|
|
|
- if (wp.getId().endsWith("_FDC")) {
|
|
|
-
|
|
|
- SimpleVo vo=null;
|
|
|
-
|
|
|
- StringBuilder tablename = new StringBuilder();
|
|
|
- tablename.append("alarmhistory_");
|
|
|
- tablename.append(wp.getId().split("_")[0]);
|
|
|
- tablename.append("_");
|
|
|
- tablename.append(sdf_no_underline.format(endDate));
|
|
|
- List<SimpleVo> ls= proEconWarningMapper.countWpwarnByWp(String.valueOf(tablename));
|
|
|
- if(!ls.isEmpty())
|
|
|
- {
|
|
|
- vo=ls.get(0);
|
|
|
- vo.setName(wp.getName());
|
|
|
- }else
|
|
|
- {
|
|
|
- vo=new SimpleVo();
|
|
|
- vo.setId(wp.getId());
|
|
|
- vo.setName(wp.getName());
|
|
|
- vo.setValue(0);
|
|
|
- }
|
|
|
+ List<SimpleVo2> ls=alarmTsMapper.selectByWp(AlarmSuperTalbeType.WT.getCode(),beginDate.getTime(),endDate.getTime());
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+ if(!ls.isEmpty())
|
|
|
+ {
|
|
|
+ for(SimpleVo2 s :ls)
|
|
|
+ {
|
|
|
+ SimpleVo vo=new SimpleVo();
|
|
|
+ vo.setName(s.getName());
|
|
|
+ vo.setValue(s.getTotal());
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
return vos;
|
|
|
|
|
|
}
|
|
@@ -89,39 +81,29 @@ public class ProEconWarningServiceImpl extends ServiceImpl<ProEconWarningMapper,
|
|
|
List<SimpleVo> vos=new ArrayList<>();
|
|
|
SimpleDateFormat sdf_no_underline = new SimpleDateFormat("yyyyMM");
|
|
|
Calendar cal = Calendar.getInstance();
|
|
|
- Date endDate = cal.getTime();
|
|
|
+ Date endDate = DateUtils.truncate(cal.getTime());
|
|
|
+ cal.add(Calendar.DAY_OF_MONTH,-7);
|
|
|
+ Date beginDate = DateUtils.truncate(cal.getTime());
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) (RequestContextHolder.currentRequestAttributes())).getRequest();
|
|
|
List<ProBasicPowerstation> wpls = tokenService.getWpls(request);
|
|
|
- for(ProBasicPowerstation wp:wpls)
|
|
|
- {
|
|
|
|
|
|
- if (wp.getId().endsWith("_FDC")) {
|
|
|
-
|
|
|
- SimpleVo vo=null;
|
|
|
-
|
|
|
- StringBuilder tablename = new StringBuilder();
|
|
|
- tablename.append("alarmhistory_");
|
|
|
- tablename.append(wp.getId().split("_")[0]);
|
|
|
- tablename.append("_");
|
|
|
- tablename.append(sdf_no_underline.format(endDate));
|
|
|
- List<SimpleVo> ls= proEconWarningMapper.countWpwarnByPj(String.valueOf(tablename));
|
|
|
- if(!ls.isEmpty())
|
|
|
- {
|
|
|
- vo=ls.get(0);
|
|
|
- vo.setName(wp.getName());
|
|
|
- }else
|
|
|
- {
|
|
|
- vo=new SimpleVo();
|
|
|
- vo.setId(wp.getId());
|
|
|
- vo.setName(wp.getName());
|
|
|
- vo.setValue(0);
|
|
|
- }
|
|
|
|
|
|
+ List<SimpleVo2> ls=alarmTsMapper.selectByPj(AlarmSuperTalbeType.WT.getCode(),beginDate.getTime(),endDate.getTime());
|
|
|
+
|
|
|
+
|
|
|
+ if(!ls.isEmpty())
|
|
|
+ {
|
|
|
+ for(SimpleVo2 s :ls)
|
|
|
+ {
|
|
|
+ SimpleVo vo=new SimpleVo();
|
|
|
+ vo.setName(s.getName());
|
|
|
+ vo.setValue(s.getTotal());
|
|
|
vos.add(vo);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
return vos;
|
|
|
|
|
|
}
|