易控异常消息通知

private void extracted(Boolean statusIsBad,String errorCode) {

    QueryWrapper queryWrapper = new QueryWrapper<>()
            .eq("sys_message_template_id","1876191512098779138")//线上id
            .ge("create_time", LocalDate.now().atStartOfDay())
            .le("create_time", LocalDate.now().atTime(LocalTime.MAX));
    ;
    BasMessageDTO basMessageDTO = basMessageService.get(queryWrapper);//获取当天异常通知

    BasMessageEntity basMessageEnerty = new BasMessageEntity();
    if(basMessageDTO != null){//当天有异常通知
        basMessageEnerty.setId(basMessageDTO.getId());
        if(statusIsBad) {//异常
            basMessageEnerty.setRelationCode(errorCode);
        }else {//正常
            basMessageEnerty.setRelationCode("异常已修复");
        }
        basMessageEnerty.setUpdateTime(new Date());
        basMessageService.updateById(basMessageEnerty);//更新异常通知
        BasMessageRecordEntity basMessageRecordEntity = new BasMessageRecordEntity();
        UpdateWrapper uw = new UpdateWrapper<>();
        uw.eq("bas_message_id", basMessageDTO.getId()+"");
        uw.set("message_title", errorCode);
        uw.set("update_time", new Date());
        basMessageRecordService.update(basMessageRecordEntity,uw);

    }else{//当天没有异常通知
        if (statusIsBad) {//异常
            //throw new RuntimeException("高压线路一异常");
            //异常通知
            CreateMessageDTO createMessageDTO = new CreateMessageDTO();
            createMessageDTO.setTemplateCode("A28");
            createMessageDTO.setRelationCode(errorCode);//易控连接高压设备1异常
            createMessageDTO.setPdfUrl("");
            basMessageService.CreateMessage(createMessageDTO);//创建当天第一条异常通知
        }else{//正常

        }
    }
}


参考:
if(c.contains("SysOrgCode")){
    re= dcBeltWeighterDataDateDao.update(dcBeltWeighterDataDateEntity,new UpdateWrapper<DcBeltWeighterDataDateEntity>().lambda()
    .set(DcBeltWeighterDataDateEntity::getSysOrgCode,value)
    .eq(DcBeltWeighterDataDateEntity::getCollectionPointNo,pointNo)
    .between(DcBeltWeighterDataDateEntity::getCollectionDate,date1,date2));
}
https://blog.csdn.net/J080624/article/details/108350032

发表回复