|
@@ -1,92 +1,136 @@
|
|
package com.gyee.frame.service;
|
|
package com.gyee.frame.service;
|
|
|
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
import com.gyee.frame.common.base.BaseService;
|
|
import com.gyee.frame.common.base.BaseService;
|
|
|
|
+import com.gyee.frame.common.spring.InitialRunner;
|
|
import com.gyee.frame.common.support.Convert;
|
|
import com.gyee.frame.common.support.Convert;
|
|
import com.gyee.frame.mapper.auto.AlarmsnapMapper;
|
|
import com.gyee.frame.mapper.auto.AlarmsnapMapper;
|
|
import com.gyee.frame.model.auto.Alarmsnap;
|
|
import com.gyee.frame.model.auto.Alarmsnap;
|
|
import com.gyee.frame.model.auto.AlarmsnapExample;
|
|
import com.gyee.frame.model.auto.AlarmsnapExample;
|
|
|
|
+import com.gyee.frame.model.auto.Windturbine;
|
|
|
|
+import com.gyee.frame.model.custom.SawVo;
|
|
|
|
+import com.gyee.frame.model.custom.Tablepar;
|
|
|
|
+import com.gyee.frame.util.StringUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.Calendar;
|
|
|
|
+import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class AlarmsnapService implements BaseService<Alarmsnap, AlarmsnapExample> {
|
|
public class AlarmsnapService implements BaseService<Alarmsnap, AlarmsnapExample> {
|
|
- @Resource
|
|
|
|
- private AlarmsnapMapper alarmsnapMapper;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public int deleteByPrimaryKey(String ids) {
|
|
|
|
-
|
|
|
|
- List<Integer> lista=Convert.toIntArrayList(ids);
|
|
|
|
- AlarmsnapExample example=new AlarmsnapExample();
|
|
|
|
- example.createCriteria().andIdIn(lista);
|
|
|
|
- return alarmsnapMapper.deleteByExample(example);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public Alarmsnap selectByPrimaryKey(String id) {
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.selectByPrimaryKey(Integer.valueOf(id));
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public int updateByPrimaryKeySelective(Alarmsnap record) {
|
|
|
|
- return alarmsnapMapper.updateByPrimaryKeySelective(record);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public int insertSelective(Alarmsnap record) {
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.insertSelective(record);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public int updateByExampleSelective(Alarmsnap record, AlarmsnapExample example) {
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.updateByExampleSelective(record, example);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public int updateByExample(Alarmsnap record, AlarmsnapExample example) {
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.updateByExample(record, example);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public List<Alarmsnap> selectByExample(AlarmsnapExample example) {
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.selectByExample(example);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public long countByExample(AlarmsnapExample example) {
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.countByExample(example);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public int deleteByExample(AlarmsnapExample example) {
|
|
|
|
-
|
|
|
|
- return alarmsnapMapper.deleteByExample(example);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private AlarmsnapMapper alarmsnapMapper;
|
|
|
|
+ private final String ALARMHISTORY="ALARMHISTORY";
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ @Override
|
|
|
|
+ public int deleteByPrimaryKey(String ids) {
|
|
|
|
+
|
|
|
|
+ List<Integer> lista=Convert.toIntArrayList(ids);
|
|
|
|
+ AlarmsnapExample example=new AlarmsnapExample();
|
|
|
|
+ example.createCriteria().andIdIn(lista);
|
|
|
|
+ return alarmsnapMapper.deleteByExample(example);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Alarmsnap selectByPrimaryKey(String id) {
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.selectByPrimaryKey(Integer.valueOf(id));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int updateByPrimaryKeySelective(Alarmsnap record) {
|
|
|
|
+ return alarmsnapMapper.updateByPrimaryKeySelective(record);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public int insertSelective(Alarmsnap record) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.insertSelective(record);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int updateByExampleSelective(Alarmsnap record, AlarmsnapExample example) {
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.updateByExampleSelective(record, example);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int updateByExample(Alarmsnap record, AlarmsnapExample example) {
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.updateByExample(record, example);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<Alarmsnap> selectByExample(AlarmsnapExample example) {
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.selectByExample(example);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public long countByExample(AlarmsnapExample example) {
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.countByExample(example);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int deleteByExample(AlarmsnapExample example) {
|
|
|
|
+
|
|
|
|
+ return alarmsnapMapper.deleteByExample(example);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<SawVo> getWarningRecordsTop(Tablepar tablepar, String wtId, Date beginDate, Date endDate) {
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ PageHelper.startPage(tablepar.getPageNum(), tablepar.getPageSize());
|
|
|
|
+ PageInfo<SawVo> pageInfo = new PageInfo<SawVo>();
|
|
|
|
+
|
|
|
|
+ if (StringUtils.notEmp(wtId) && InitialRunner.wtmap.containsKey(wtId)) {
|
|
|
|
+ Windturbine wt=InitialRunner.wtmap.get(wtId);
|
|
|
|
+ String wpname=wt.getWindpowerstationid().substring(0,wt.getWindpowerstationid().indexOf("_"));
|
|
|
|
+ StringBuilder alerthistory=new StringBuilder(ALARMHISTORY).append("_").append(wpname).append("_");
|
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
|
+ cal.setTime(beginDate);
|
|
|
|
+ int year=cal.get(Calendar.YEAR);
|
|
|
|
+ int month=cal.get(Calendar.MONTH)+1;
|
|
|
|
+
|
|
|
|
+ alerthistory.append(year);
|
|
|
|
+ if(month<10)
|
|
|
|
+ {
|
|
|
|
+ alerthistory.append("0").append(month);
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ alerthistory.append(month);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<SawVo> list=alarmsnapMapper.getWarningRecordsTop(wtId,String.valueOf(alerthistory),dateFormat.format(beginDate),dateFormat.format(endDate));
|
|
|
|
+ pageInfo = new PageInfo<SawVo>(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return pageInfo.getList();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|