| | |
| | | import com.moral.common.bean.Constants;
|
| | | import com.moral.common.bean.PageBean;
|
| | | import com.moral.common.bean.PageResult;
|
| | | import com.moral.common.exception.BusinessException;
|
| | | import com.moral.common.util.ExampleUtil;
|
| | | import com.moral.common.util.RedisUtils;
|
| | | import com.moral.mapper.MonitorPointMapper;
|
| | | import org.apache.commons.collections.MapUtils;
|
| | | import org.apache.commons.lang3.BooleanUtils;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | | import org.apache.log4j.Logger;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | |
|
| | | @Service
|
| | | public class DeviceServiceImpl implements DeviceService {
|
| | | Logger log = Logger.getLogger(DeviceServiceImpl.class);
|
| | | //-----------------------redis key前缀-开始---------------------------------
|
| | | private static String AlARM = "alarm";//警报阀值储存key前缀
|
| | | private static String ADJUST="adjust";//校准值存储key前缀
|
| | |
| | | }
|
| | | }
|
| | | @Override
|
| | | public PageBean queryByPageBean(PageBean pageBean) {
|
| | | public int countByExample(PageBean pageBean){
|
| | | Example example = ExampleUtil.generateExample(ENTITY_CLASS,pageBean);
|
| | | addDeletesToExample(example);
|
| | | return deviceMapper.selectCountByExample(example);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 增加删除条件过滤
|
| | | * @param example
|
| | | */
|
| | | private void addDeletesToExample(Example example){
|
| | | List<Example.Criteria> criteriaList = example.getOredCriteria();
|
| | | if(criteriaList!=null&&criteriaList.size()>0){
|
| | | for(Example.Criteria cri : criteriaList){
|
| | |
| | | }else {
|
| | | example.or().andNotEqualTo("isDelete",Constants.IS_DELETE_TRUE);
|
| | | }
|
| | | }
|
| | | @Override
|
| | | public PageBean queryByPageBean(PageBean pageBean) {
|
| | | Example example = ExampleUtil.generateExample(ENTITY_CLASS,pageBean);
|
| | | addDeletesToExample(example);
|
| | | if(pageBean.getPageSize()>0){
|
| | | PageHelper.startPage(pageBean.getPageIndex(),pageBean.getPageSize());
|
| | | }
|
| | |
| | | throw ex;
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Map> countByTimes(Date start,Date end,String format){
|
| | | if(start==null||end==null||StringUtils.isBlank(format)){
|
| | | log.error("some params is null");
|
| | | throw new BusinessException("some params is null");
|
| | | }
|
| | | return deviceMapper.countByTimes(start, end, format);
|
| | | }
|
| | | @Override
|
| | | public List<Device> getDevicesByMonitorPointId(Integer monitorPointId) {
|
| | | Device device = new Device();
|