| | |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.core.wx.WxMiniUtilService; |
| | | import com.doumee.dao.business.LocksMapper; |
| | | import com.doumee.dao.business.SitesMapper; |
| | | import com.doumee.dao.business.model.Locks; |
| | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | |
| | | |
| | | @Override |
| | | public String create(Sites sites) { |
| | |
| | | update.setName(sites.getName()); |
| | | update.setLockNum(sites.getLockNum()); |
| | | update.setIp(sites.getIp()); |
| | | update.setNeedNotice(sites.getNeedNotice()); |
| | | sitesMapper.updateById(update); |
| | | } |
| | | |
| | |
| | | public List<Sites> findList(Sites sites) { |
| | | QueryWrapper<Sites> wrapper = new QueryWrapper<>(sites); |
| | | return sitesMapper.selectList(wrapper); |
| | | } |
| | | @Override |
| | | public void noticeNoLinkList(Sites sites) { |
| | | //发送钉钉通知 |
| | | int second =0; |
| | | try { |
| | | second = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.NOTICE_SITE_LINK_LIMIT).getCode()); |
| | | }catch (Exception e){ |
| | | |
| | | } |
| | | if(second <=0){ |
| | | return ; |
| | | } |
| | | sites.setIsdeleted(Constants.ZERO); |
| | | sites.setStatus(Constants.ZERO); |
| | | QueryWrapper<Sites> wrapper = new QueryWrapper<>(sites); |
| | | wrapper.lambda().orderByDesc(Sites::getLastLinkDate); |
| | | List<Sites> siteList =sitesMapper.selectList(wrapper); |
| | | List<Sites> errorList = new ArrayList<>(); |
| | | for(Sites site : siteList){ |
| | | //时间查过通信异常阈值 |
| | | if(Constants.formatIntegerNum(site.getNeedNotice()) == Constants.ZERO |
| | | && System.currentTimeMillis()-site.getLastLinkDate().getTime() > second*1000){ |
| | | errorList.add(site); |
| | | } |
| | | } |
| | | if(errorList.size()>0){ |
| | | try { |
| | | DingDingNotice.siteNoLink(errorList, |
| | | systemDictDataBiz.queryByCode(Constants.DINGDING,Constants.DINGDING_URL).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.DINGDING,Constants.DINGDING_SECRET).getCode()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (pageWrap.getModel().getClientVersion() != null) { |
| | | queryWrapper.lambda().eq(Sites::getClientVersion, pageWrap.getModel().getClientVersion()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | /*for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | }*/ |
| | | queryWrapper.lambda().orderByAsc(Sites::getCode); |
| | | return PageData.from(sitesMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | |
| | | } |
| | | BigDecimal warnMin = new BigDecimal(systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.WARN_MIN).getCode()); |
| | | BigDecimal warnMax = new BigDecimal(systemDictDataBiz.queryByCode(Constants.MINI_PROGRAMME,Constants.WARN_MAX).getCode()); |
| | | BigDecimal rata = new BigDecimal(s.getBikeCount()).divide(new BigDecimal(s.getAllLockNum()),2,BigDecimal.ROUND_HALF_UP); |
| | | BigDecimal rata = new BigDecimal(s.getBikeCount()).divide(new BigDecimal(s.getAllLockNum()),2,BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100L)); |
| | | if(rata.compareTo(warnMax)>Constants.ZERO){ |
| | | //发送钉钉通知 |
| | | DingDingNotice.reservesNotice(s.getName(), |
| | | DingDingNotice.reservesNotice(StringUtils.isBlank(s.getName())?s.getId() + " - 未知" :s.getId() + " - " + s.getName(), |
| | | systemDictDataBiz.queryByCode(Constants.DINGDING,Constants.DINGDING_URL).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.DINGDING,Constants.DINGDING_SECRET).getCode(),Constants.ZERO,warnMax); |
| | | }else if(rata.compareTo(warnMin)<Constants.ZERO){ |
| | | //发送钉钉通知 |
| | | DingDingNotice.reservesNotice(s.getName(), |
| | | DingDingNotice.reservesNotice(StringUtils.isBlank(s.getName())?s.getId() + " - 未知" :s.getId() + " - " + s.getName(), |
| | | systemDictDataBiz.queryByCode(Constants.DINGDING,Constants.DINGDING_URL).getCode(), |
| | | systemDictDataBiz.queryByCode(Constants.DINGDING,Constants.DINGDING_SECRET).getCode(),Constants.ONE,warnMin); |
| | | } |