rk
8 小时以前 2f65c9f0c9dae7c192a81a79d94b7eba614c8b23
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/WarningServiceImpl.java
@@ -13,6 +13,8 @@
import com.doumee.dao.business.*;
import com.doumee.dao.business.dao.MemberMapper;
import com.doumee.dao.business.model.*;
import com.doumee.dao.business.vo.CabinetBoardWaningRataDataVO;
import com.doumee.dao.system.model.SystemUser;
import com.doumee.service.business.third.model.LoginUserInfo;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
@@ -22,6 +24,7 @@
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -63,6 +66,9 @@
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
    private DdNoticeConfigMapper ddNoticeConfigMapper;
    @Override
@@ -315,9 +321,13 @@
                        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(memberList)&&memberList.size()>Constants.ZERO){
                            List<String> ddUserIdList = memberList.stream().map(j->j.getErpId()).collect(Collectors.toList());
                            //发送推送钉钉消息
                            Boolean isSuccess = dingTalk.workInfoOANotice(Long.valueOf(systemDictDataBiz.queryByCode(Constants.DD_TALK,Constants.AGENT_ID).getCode()),
                                    String.join(",",ddUserIdList),
                                    dingTalk.getWeatherNoticeMsg(title,text));
                                    ddNoticeConfigMapper.selectCount(new QueryWrapper<DdNoticeConfig>().lambda()
                                            .eq(DdNoticeConfig::getIsdeleted,Constants.ZERO).eq(DdNoticeConfig::getStatus,Constants.ZERO)
                                            .eq(DdNoticeConfig::getObjType,13))>Constants.ZERO?
                                    dingTalk.getWeatherNoticeMsg(title,text):null);
                            for (Member member:memberList) {
                                WarningPush warningPush = new WarningPush();
                                warningPush.setCreateDate(new Date());
@@ -339,12 +349,74 @@
        }catch (Exception e){
        }
    }
    @Override
    public PageData<WarningEvent> getCabinetBoardWarningPage(PageWrap<WarningEvent> pageWrap){
        IPage<WarningEvent> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        Utils.MP.blankToNull(pageWrap.getModel());
        IPage<WarningEvent> pageData = warningEventMapper.selectJoinPage(page,WarningEvent.class,
                new MPJLambdaWrapper<WarningEvent>()
                        .selectAll(WarningEvent.class)
                        .selectAs(SystemUser::getRealname,WarningEvent::getCreateUserName)
                        .leftJoin(SystemUser.class,SystemUser::getId,WarningEvent::getCreator)
                        .leftJoin(Warning.class,Warning::getId,WarningEvent::getWarningId)
                        .eq(WarningEvent::getIsdeleted,Constants.ZERO)
                        .in(Warning::getCode,Constants.WarningConfig.KEY_TIME_OUT_BACK.getKey(),Constants.WarningConfig.ALARM_TEST.getKey(),Constants.WarningConfig.GRID_TIME_OUT_INFO.getKey())
                        .like(WarningEvent::getCreateDate,DateUtil.getCurrDate())
                        .orderByDesc(WarningEvent::getId)
        );
        return PageData.from(pageData);
    }
    @Override
    public CabinetBoardWaningRataDataVO getCabinetBoardWarningRataData(Integer type){
        CabinetBoardWaningRataDataVO vo = new CabinetBoardWaningRataDataVO();
        vo.setAlcoholNum(Constants.ZERO);
        vo.setUnCloseNum(Constants.ZERO);
        vo.setTimeOutNum(Constants.ZERO);
        List<WarningEvent> warningEventList = warningEventMapper.selectJoinList(WarningEvent.class,
                new MPJLambdaWrapper<WarningEvent>().
                selectAll(WarningEvent.class)
                .selectAs(Warning::getCode,WarningEvent::getWarningId)
                .leftJoin(Warning.class,Warning::getId,WarningEvent::getWarningCode)
                .eq(WarningEvent::getIsdeleted,Constants.ZERO)
                .in(Warning::getCode,Constants.WarningConfig.KEY_TIME_OUT_BACK.getKey(),Constants.WarningConfig.ALARM_TEST.getKey(),Constants.WarningConfig.GRID_TIME_OUT_INFO.getKey())
                .like(Objects.nonNull(type)&&Constants.equalsInteger(Constants.ZERO,type),WarningEvent::getCreateDate,DateUtil.getCurrDate())
                .like(Objects.nonNull(type)&&Constants.equalsInteger(Constants.ONE,type),WarningEvent::getCreateDate,DateUtil.getFomartDate(new Date(),"yyyy-MM"))
                .like(Objects.nonNull(type)&&Constants.equalsInteger(Constants.TWO,type),WarningEvent::getCreateDate,DateUtil.getFomartDate(new Date(),"yyyy"))
        );
        if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(warningEventList)){
            vo.setAlcoholNum(
                    warningEventList.stream().filter(i->StringUtils.isNotBlank(i.getWarningCode())&&
                            i.getWarningCode().equals(Constants.WarningConfig.ALARM_TEST.getKey())).collect(Collectors.toList()).size()
            );
            vo.setUnCloseNum(
                    warningEventList.stream().filter(i->StringUtils.isNotBlank(i.getWarningCode())&&
                            i.getWarningCode().equals(Constants.WarningConfig.GRID_TIME_OUT_INFO.getKey())).collect(Collectors.toList()).size()
            );
            vo.setTimeOutNum(
                    warningEventList.stream().filter(i->StringUtils.isNotBlank(i.getWarningCode())&&
                            i.getWarningCode().equals(Constants.WarningConfig.KEY_TIME_OUT_BACK.getKey())).collect(Collectors.toList()).size()
            );
        }
        return vo;
    }
}