Commit 25de7421 authored by zhangyingbin's avatar zhangyingbin

1、工作台首页 消息预警 消息列表显示需要筛选规则

2、预警消息规则回调修改,新增消息的企业及企业区域 3、96333地图大屏消息滚动条内容查询接口修改
parent aa954fd0
......@@ -74,4 +74,8 @@ public class MsgLog extends BaseEntity {
*/
@TableField("is_read")
private Boolean isRead = false;
private String companyName;
private String regionCode;
}
......@@ -12,6 +12,11 @@ import java.util.regex.Pattern;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.WarningMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.enums.WarningEnum;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import liquibase.pro.packaged.L;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
......@@ -34,6 +39,7 @@ import com.yeejoin.amos.boot.module.tzs.biz.service.impl.WechatServiceImpl;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.CylinderInfoServiceImpl;
import com.yeejoin.amos.component.rule.RuleActionBean;
import com.yeejoin.amos.component.rule.RuleMethod;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
@Component
......@@ -66,9 +72,6 @@ public class WarningMsgAction{
logger.info("气瓶唯一标识码为 "+warningMsgDto.getCode()+" 的气瓶已有数据!");
return;
}
//更新气瓶等级
// logger.info("更新气瓶等级:"+level);
// logger.info("预警区间:"+warningMsgDto.getNum());
......@@ -78,6 +81,16 @@ public class WarningMsgAction{
if(ValidationUtil.isEmpty(msgLog)){
msgLog = new MsgLog();
}
//气瓶所属公司
String companyName = warningMsgDto.getCompanyName();
msgLog.setCompanyName(companyName);
//公司区域
if(!ValidationUtil.isEmpty(companyName)) {
CompanyModel companyModel = Privilege.companyClient.queryByCompanyName(companyName).getResult();
String regionCode = getCompanyRegionCode("", companyModel);
msgLog.setRegionCode(regionCode);
}
msgLog.setRelationCode(warningMsgDto.getCode());
msgLog.setMsgType(WarningEnum.getEumByLevel(level).getCode());
msgLog.setMsgTypeName(WarningEnum.getEumByLevel(level).getName());
......@@ -104,7 +117,24 @@ public class WarningMsgAction{
}
}
public String getCompanyRegionCode(String regionCode,CompanyModel companyModel){
Long companyId = companyModel.getParentId();
if(companyId!=0L){
CompanyModel parentCompany = Privilege.companyClient.seleteOne(companyId).getResult();
if(!ValidationUtil.isEmpty(parentCompany)) {
String regionSeq = parentCompany.getRegionSeq();
if (!ValidationUtil.isEmpty(regionSeq)) {
RegionModel regionModel = Systemctl.regionClient.getRegion(Long.valueOf(regionSeq)).getResult();
if (!ValidationUtil.isEmpty(regionCode)) {
regionCode = "#" + regionCode;
}
regionCode = regionModel.getRegionCode() + regionCode;
}
regionCode = getCompanyRegionCode(regionCode,parentCompany);
}
}
return regionCode;
}
@RuleMethod(methodLabel = "气瓶公众号", project = "气瓶监管")
public void sendCylWechatMessageTip(Object bizobj, String level,String orgUserName,String phone ,String text)
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
......@@ -39,6 +40,9 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto, MsgLog, MsgLogMapp
@Autowired
AlertCalledServiceImpl alertCalledService;
@Autowired
TzsCitInfoServiceImpl citInfoService;
/**
* 分页查询
*/
......@@ -74,7 +78,16 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto, MsgLog, MsgLogMapp
});
}
// 查询气瓶预警消息
List<MsgLog> msgLogList = this.list(new LambdaQueryWrapper<MsgLog>().eq(MsgLog::getTerminalType, "WEB"));
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(MsgLog::getTerminalType, "WEB");
//企业根据企业名称筛选,监管机构根据区域筛选
ReginParams reginParams = citInfoService.getReginParams();
if(!"company".equals(reginParams.getCompany().getLevel())){
wrapper.like(MsgLog::getRegionCode,reginParams.getCompany().getRegionCode());
} else {
wrapper.eq(MsgLog::getCompanyName,reginParams.getCompany().getCompanyName());
}
List<MsgLog> msgLogList = this.list(wrapper);
if (!ValidationUtil.isEmpty(msgLogList)) {
msgLogList.forEach(msg -> {
AlertMsgDto alertMsgDto = new AlertMsgDto();
......@@ -97,11 +110,19 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto, MsgLog, MsgLogMapp
public Page<MsgLogDto> queryForMsgLogByTerminalTypePage(Page<MsgLogDto> page, String terminalType, Boolean isRead, String sendTimeStart, String sendTimeEnd, String msgType, String body) {
Page<MsgLog> msgLogPage = new Page<>(page.getCurrent(), page.getSize());
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
//企业根据企业名称筛选,监管机构根据区域筛选
ReginParams reginParams = citInfoService.getReginParams();
if(!"company".equals(reginParams.getCompany().getLevel())){
wrapper.like(MsgLog::getRegionCode,reginParams.getCompany().getRegionCode());
} else {
wrapper.eq(MsgLog::getCompanyName,reginParams.getCompany().getCompanyName());
}
if (!StringUtils.hasText(terminalType)) {
terminalType = TerminalTypeEnum.TERMINAL_TYPE_WEB.getCode();
}
wrapper.eq(MsgLog::getTerminalType, terminalType);
wrapper.eq(isRead != null, MsgLog::getIsRead, isRead);
// wrapper.eq(isRead != null, MsgLog::getIsRead, isRead);
wrapper.ge(StringUtils.hasText(sendTimeStart), MsgLog::getSendTime, sendTimeStart);
wrapper.le(StringUtils.hasText(sendTimeEnd), MsgLog::getSendTime, sendTimeEnd);
wrapper.eq(StringUtils.hasText(msgType), MsgLog::getMsgType, msgType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment