bug修复

This commit is contained in:
GUO 2024-05-07 15:43:03 +08:00
parent b333e21a1a
commit 9d85ce9ce6
10 changed files with 65 additions and 16 deletions

View File

@ -192,7 +192,19 @@ public class DataScopeHandler implements DataPermissionHandler {
}
if (!DataScopeInterceptor.isNotSqlTest()) {
equalsTo("'qqq'", "'qqq'", plainSelect);
String sql = " ('1qqq')";
try {
Expression expression = CCJSqlParserUtil.parseCondExpression(sql);
Expression where = plainSelect.getWhere();
if (where != null) {
where = new AndExpression(where, expression);
} else {
where = expression;
}
plainSelect.setWhere(where);
} catch (JSQLParserException e) {
throw new RuntimeException(e);
}
}
//List<String> scopeIds = systemUserDataScopeService.list(Wrappers.<SystemUserDataScope>lambdaQuery().eq(SystemUserDataScope::getUserId, user.getUserId()))

View File

@ -63,4 +63,7 @@ public class Notice implements Serializable {
@Excel(name = "推送的时间", width = 15)
@ApiModelProperty(value = "推送的时间")
private java.lang.String sendTime;
@ApiModelProperty(value = "载荷")
private java.lang.String payload;
}

View File

@ -18,8 +18,12 @@ public interface INoticeService extends IService<Notice> {
void addNotice(Notice notice, boolean sendNotice);
void addNoticeAndApp(Notice notice, boolean sendNotice);
void cleanAllNotice(Map<String, Object> map);
void addUserNotice(Long accountId, String msg, String title, String type, String payload);
/**
* 发通知给某人
*

View File

@ -1,5 +1,8 @@
package com.zhgd.xmgl.modules.basicdata.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -61,6 +64,20 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
}
}
@Override
public void addNoticeAndApp(Notice notice, boolean sendNotice) {
noticeMapper.insert(notice);
if (sendNotice) {
sendPushMessage(notice);
}
SystemUser systemUser = systemUserMapper.selectById(notice.getAccountId());
if (systemUser == null) {
return;
}
uniPushService.pushToSingleByAlias(systemUser.getClientId(), notice.getTitle(), notice.getMsg(), null);
}
@Override
public void cleanAllNotice(Map<String, Object> map) {
QueryWrapper<Notice> queryWrapper = new QueryWrapper<>();
@ -69,7 +86,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
}
@Override
public void addUserNotice(Long accountId, String msg, String title, String type) {
public void addUserNotice(Long accountId, String msg, String title, String type, String payload) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Notice notice = new Notice();
notice.setAccountId(accountId);
@ -77,18 +94,26 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
notice.setTitle(title);
notice.setSendTime(sdf.format(new Date()));
notice.setType(type);
notice.setPayload(payload);
noticeMapper.insert(notice);
sendPushMessage(notice);
}
@Override
public void addUserNotice(Long accountId, String msg, String title, String type) {
addUserNotice(accountId, msg, title, type, null);
}
@Override
public void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object payload) {
addUserNotice(accountId, msg, title, type);
final SerializeConfig config = new SerializeConfig();
config.put(Long.class, ToStringSerializer.instance);
addUserNotice(accountId, msg, title, type, JSONObject.toJSONString(payload, config));
SystemUser systemUser = systemUserMapper.selectById(accountId);
if (systemUser == null) {
return;
}
uniPushService.pushToSingleByAlias(systemUser.getClientId(), title, msg, payload);
uniPushService.pushToSingleByAlias(systemUser.getClientId(), title, msg, null);
}
@Override

View File

@ -34,7 +34,6 @@ public class QualityRectifyRecord implements Serializable {
*/
@Excel(name = "质量检查记录ID", width = 15)
@ApiModelProperty(value = "质量检查记录ID")
private java.lang.Long qualityId;
/**
* 类型1整改记录2复查记录3核验记录

View File

@ -50,7 +50,7 @@
ifnull((CASE
WHEN a.status = 5 THEN (select rectify_time
from quality_rectify_record
where quality_id = a.id and type = 3 and status = 2) > a.change_limit_time
where quality_id = a.id and type = 3 and status = 2 ORDER BY create_time desc LIMIT 1) > a.change_limit_time
ELSE a.change_limit_time <![CDATA[<]]> now() END),0) overTime
from quality_inspection_record a
LEFT JOIN enterprise_info b ON a.enterprise_sn = b.enterprise_sn

View File

@ -2,6 +2,8 @@ package com.zhgd.xmgl.modules.video.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhgd.xmgl.modules.basicdata.entity.DictionariesRecord;
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
@ -13,6 +15,7 @@ import com.zhgd.xmgl.modules.video.entity.VideoAlarm;
import com.zhgd.xmgl.modules.video.entity.VideoItem;
import com.zhgd.xmgl.modules.video.service.IVideoAlarmService;
import com.zhgd.xmgl.modules.video.service.IVideoItemService;
import com.zhgd.xmgl.push.config.PushPayloads;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@ -109,14 +112,14 @@ public class VideoCallbackController {
//向项目管理员推送通知
if(systemUserList.size()>0){
for (SystemUser systemUser:systemUserList){
addNotice(systemUser.getUserId(),msg,title,sdf.format(new Date()),videoAlarm.getImageUrl());
addNotice(systemUser.getUserId(),msg,title,sdf.format(new Date()),videoAlarm.getImageUrl(),videoAlarm);
}
}
//向配置的推送人推送通知
if(StringUtils.isNotEmpty(item.getAlarmPushWorkerId())&&item.getAlarmPushWorkerId().length()>0){
String[] person=item.getAlarmPushWorkerId().split(",");
for (int i = 0; i <person.length ; i++) {
addNotice(Long.valueOf(person[i]),msg,title,sdf.format(new Date()),videoAlarm.getImageUrl());
addNotice(Long.valueOf(person[i]),msg,title,sdf.format(new Date()),videoAlarm.getImageUrl(),videoAlarm);
}
}
}
@ -129,7 +132,7 @@ public class VideoCallbackController {
return result;
}
private void addNotice(Long accountId,String msg,String title,String time,String url){
private void addNotice(Long accountId,String msg,String title,String time,String url,Object videoAlarm){
Notice notice = new Notice();
notice.setAccountId(accountId);
notice.setMsg(msg);
@ -137,6 +140,9 @@ public class VideoCallbackController {
notice.setSendTime(time);
notice.setImageUrl(url);
notice.setType("8");
final SerializeConfig config = new SerializeConfig();
config.put(Long.class, ToStringSerializer.instance);
notice.setPayload(JSONObject.toJSONString(PushPayloads.buildPushPayload(8, videoAlarm), config));
noticeService.addNotice(notice,true);
}

View File

@ -7,7 +7,7 @@ import lombok.Data;
@Data
public class PushPayloads {
/**
* 10安全11质量
* 8AI10安全11质量
*/
private Integer type;
private Object data;

View File

@ -13,7 +13,7 @@ import java.util.Map;
**/
public interface UniPushService {
ApiResult pushToSingleByAlias(String alias, String title, String content, Object payload);
ApiResult pushToSingleByAlias(String alias, String title, String content, String payload);
ApiResult bindAlias(String alias, String clientId);//别名绑定

View File

@ -37,7 +37,7 @@ public class UniPushServiceImpl implements UniPushService {
private PushApiHelper pushApiHelper;
@Override
public ApiResult pushToSingleByAlias(String alias, String title, String content, Object payload) {
public ApiResult pushToSingleByAlias(String alias, String title, String content, String payload) {
PushDTO<Audience> pushDTO = this.buildPushDTO(title, content, payload);
// log.info("payload-----" + pushDTO.getPushMessage().getNotification().getPayload());
log.info("alias----{},title-----{},content-----{}", alias, title, content);
@ -65,7 +65,7 @@ public class UniPushServiceImpl implements UniPushService {
}
private PushDTO<Audience> buildPushDTO(String title, String content, Object payload) {
private PushDTO<Audience> buildPushDTO(String title, String content, String payload) {
PushDTO<Audience> pushDTO = new PushDTO<>();
// 设置推送参数
//requestid需要每次变化唯一
@ -100,7 +100,7 @@ public class UniPushServiceImpl implements UniPushService {
aps.setSound("default");
aps.setAlert(alert);
IosDTO iosDTO = new IosDTO();
iosDTO.setPayload(payload.toString());
iosDTO.setPayload(payload);
iosDTO.setAps(aps);
iosDTO.setType("notify");
@ -117,8 +117,8 @@ public class UniPushServiceImpl implements UniPushService {
notification1.setBody(content);
notification1.setClickType("intent");
notification1.setIntent("intent:#Intent;action=android.intent.action.oppopush;launchFlags=0x14000000;component=com.weixiaobao/io.dcloud.PandoraEntry;S.UP-OL-SU=true;S.title=" + title + ";S.content=" + content + ";S.payload=" + payload + ";end");
notification1.setPayload(payload.toString());
notification1.setUrl(payload.toString());
notification1.setPayload(payload);
notification1.setUrl(payload);
//各厂商自有功能单项设置
//ups.addOption("HW", "/message/android/notification/badge/class", "io.dcloud.PandoraEntry ");
//ups.addOption("HW", "/message/android/notification/badge/add_num", 1);