bug修复

This commit is contained in:
guoshengxiong 2024-06-04 16:02:14 +08:00
parent 8337728613
commit ad2e38738c
11 changed files with 97 additions and 74 deletions

View File

@ -7,6 +7,7 @@ import org.apache.catalina.connector.Connector;
import org.junit.Test; import org.junit.Test;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
@ -39,8 +40,11 @@ import org.springframework.security.web.firewall.StrictHttpFirewall;
@EnableDistributedLock @EnableDistributedLock
public class WisdomSiteApplication extends SpringBootServletInitializer { public class WisdomSiteApplication extends SpringBootServletInitializer {
public static boolean runSucess = false;
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(WisdomSiteApplication.class, args); SpringApplication.run(WisdomSiteApplication.class, args);
WisdomSiteApplication.runSucess = true;
} }
@Bean @Bean
@ -159,10 +163,4 @@ public class WisdomSiteApplication extends SpringBootServletInitializer {
firewall.setAllowUrlEncodedSlash(true); firewall.setAllowUrlEncodedSlash(true);
return firewall; return firewall;
} }
@Test
public void test() {
System.out.println();
}
} }

View File

@ -1,9 +1,13 @@
package com.zhgd.config; package com.zhgd.config;
import com.WisdomSiteApplication;
import com.zhgd.xmgl.config.TaskAspect; import com.zhgd.xmgl.config.TaskAspect;
import com.zhgd.xmgl.constant.Cts; import com.zhgd.xmgl.constant.Cts;
import com.zhgd.xmgl.util.ThreadLocalUtil; import com.zhgd.xmgl.util.ThreadLocalUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.logging.Log; import org.apache.ibatis.logging.Log;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.Objects; import java.util.Objects;
@ -17,7 +21,7 @@ public class StdOutImplCustom implements Log {
if (!Objects.equals(TaskAspect.onlyPrintInterface, 1)) { if (!Objects.equals(TaskAspect.onlyPrintInterface, 1)) {
return true; return true;
} }
return Objects.equals(ThreadLocalUtil.getByKey(Cts.TL_IS_FROM_WEB, Boolean.class), true); return WisdomSiteApplication.runSucess && Objects.equals(ThreadLocalUtil.getByKey(Cts.TL_IS_FROM_WEB, Boolean.class), true);
} }
@Override @Override

View File

@ -2,6 +2,7 @@ package com.zhgd.mqtt.bean;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -13,8 +14,7 @@ import lombok.extern.slf4j.Slf4j;
* @date 2019/11/14$ 15:52$ * @date 2019/11/14$ 15:52$
*/ */
@Slf4j @Slf4j
@Setter @Data
@Getter
public class PushPayload { public class PushPayload {
//推送类型 //推送类型
@ -29,21 +29,34 @@ public class PushPayload {
private String title; private String title;
//内容 //内容
private String content; private String content;
//载荷
private String payload;
//数量 //数量
private Integer badge = 1; private Integer badge = 1;
//铃声 //铃声
private String sound = "default"; private String sound = "default";
public PushPayload(String type, String accountId, String title, String content, Integer badge , String sound,String itemType){
public PushPayload(String type, String accountId, String title, String content, String payload, Integer badge, String sound, String itemType) {
this.type = type; this.type = type;
this.accountId = accountId; this.accountId = accountId;
this.title = title; this.title = title;
this.content = content; this.content = content;
this.payload = payload;
this.badge = badge; this.badge = badge;
this.sound = sound; this.sound = sound;
this.itemType = itemType; this.itemType = itemType;
} }
public static class Builder{ public static Builder getPushPayloadBuider() {
return new Builder();
}
@Override
public String toString() {
return JSON.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect);
}
public static class Builder {
//推送类型 //推送类型
private String type; private String type;
//推送子类型 //推送子类型
@ -54,6 +67,8 @@ public class PushPayload {
private String title; private String title;
//内容 //内容
private String content; private String content;
//载荷
private String payload;
//数量 //数量
private Integer badge = 1; private Integer badge = 1;
//铃声 //铃声
@ -84,6 +99,11 @@ public class PushPayload {
return this; return this;
} }
public Builder setPayload(String payload) {
this.payload = payload;
return this;
}
public Builder setBadge(Integer badge) { public Builder setBadge(Integer badge) {
this.badge = badge; this.badge = badge;
return this; return this;
@ -94,20 +114,9 @@ public class PushPayload {
return this; return this;
} }
public PushPayload bulid(){ public PushPayload bulid() {
return new PushPayload(type,accountId,title,content,badge,sound,itemType); return new PushPayload(type, accountId, title, content, payload, badge, sound, itemType);
} }
} }
public static Builder getPushPayloadBuider(){
return new Builder();
}
@Override
public String toString() {
return JSON.toJSONString(this, SerializerFeature.DisableCircularReferenceDetect);
}
} }

View File

@ -18,8 +18,6 @@ public interface INoticeService extends IService<Notice> {
void addNotice(Notice notice, boolean isSendMqtt); void addNotice(Notice notice, boolean isSendMqtt);
void addNoticeAndApp(Notice notice, boolean isSendMqtt);
void cleanAllNotice(Map<String, Object> map); void cleanAllNotice(Map<String, Object> map);
void addUserNotice(Long accountId, String msg, String title, String type, String payload); void addUserNotice(Long accountId, String msg, String title, String type, String payload);
@ -34,7 +32,7 @@ public interface INoticeService extends IService<Notice> {
*/ */
void addUserNotice(Long accountId, String msg, String title, String type); void addUserNotice(Long accountId, String msg, String title, String type);
void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object payload); void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object jsonPayload);
/** /**
* 发通知给某人和app通知 * 发通知给某人和app通知
@ -49,4 +47,8 @@ public interface INoticeService extends IService<Notice> {
void sendProjectNoicte(String projectSn, String title, String msg, String type); void sendProjectNoicte(String projectSn, String title, String msg, String type);
void edit(Notice notice); void edit(Notice notice);
void sendMqttMessage(Notice notice);
void sendMqttMessage(Notice notice, String subTopic);
} }

View File

@ -21,6 +21,13 @@ import java.util.Map;
*/ */
public interface ISystemUserService extends IService<SystemUser> { public interface ISystemUserService extends IService<SystemUser> {
/**
* 根据企业或项目SN查找账号列表
*
* @return
*/
List<SystemUser> getSystemUsersBySn(Map<String, Object> map);
Map<String, Object> login(Map<String, Object> map); Map<String, Object> login(Map<String, Object> map);
void register(Map<String, Object> map); void register(Map<String, Object> map);
@ -29,13 +36,6 @@ public interface ISystemUserService extends IService<SystemUser> {
void updateUserPassWord(Map<String, Object> map); void updateUserPassWord(Map<String, Object> map);
/**
* 根据企业或项目SN查找账号列表
*
* @return
*/
List<SystemUser> getSystemUsersBySn(Map<String, Object> map);
Long saveSystemUser(SystemUser systemUser); Long saveSystemUser(SystemUser systemUser);
void editSystemUser(SystemUser systemUser); void editSystemUser(SystemUser systemUser);
@ -74,8 +74,6 @@ public interface ISystemUserService extends IService<SystemUser> {
public void deleteTenantOrSupplier(String userId, String projectSn); public void deleteTenantOrSupplier(String userId, String projectSn);
List<SystemUser> getSystemUserList(Map<String, Object> map);
Map<String, Object> md5Login(Map<String, Object> map); Map<String, Object> md5Login(Map<String, Object> map);
void xzUpdatePw(SystemUser systemUser); void xzUpdatePw(SystemUser systemUser);

View File

@ -72,24 +72,10 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
public void addNotice(Notice notice, boolean isSendMqtt) { public void addNotice(Notice notice, boolean isSendMqtt) {
noticeMapper.insert(notice); noticeMapper.insert(notice);
if (isSendMqtt) { if (isSendMqtt) {
sendPushMessage(notice); sendMqttMessage(notice);
} }
} }
@Override
public void addNoticeAndApp(Notice notice, boolean isSendMqtt) {
noticeMapper.insert(notice);
if (isSendMqtt) {
sendPushMessage(notice);
}
SystemUser systemUser = systemUserMapper.selectById(notice.getAccountId());
if (systemUser == null) {
return;
}
uniPushService.pushToSingleByAlias(systemUser.getClientId(), notice.getTitle(), notice.getMsg(), null);
}
@Override @Override
public void cleanAllNotice(Map<String, Object> map) { public void cleanAllNotice(Map<String, Object> map) {
QueryWrapper<Notice> queryWrapper = new QueryWrapper<>(); QueryWrapper<Notice> queryWrapper = new QueryWrapper<>();
@ -108,7 +94,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
notice.setType(type); notice.setType(type);
notice.setPayload(payload); notice.setPayload(payload);
noticeMapper.insert(notice); noticeMapper.insert(notice);
sendPushMessage(notice); sendMqttMessage(notice);
} }
@Override @Override
@ -117,10 +103,10 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
} }
@Override @Override
public void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object payload) { public void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object jsonPayload) {
final SerializeConfig config = new SerializeConfig(); final SerializeConfig config = new SerializeConfig();
config.put(Long.class, ToStringSerializer.instance); config.put(Long.class, ToStringSerializer.instance);
addUserNotice(accountId, msg, title, type, payload != null ? JSONObject.toJSONString(payload, config) : null); addUserNotice(accountId, msg, title, type, jsonPayload != null ? JSONObject.toJSONString(jsonPayload, config) : null);
SystemUser systemUser = systemUserMapper.selectById(accountId); SystemUser systemUser = systemUserMapper.selectById(accountId);
if (systemUser == null) { if (systemUser == null) {
return; return;
@ -165,18 +151,28 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
addNotice(notice, true); addNotice(notice, true);
} }
private void sendPushMessage(Notice notice) { @Override
public void sendMqttMessage(Notice notice) {
sendMqttMessage(notice, "");
}
@Override
public void sendMqttMessage(Notice notice, String subTopic) {
try { try {
PushPayload pushMessage = PushPayload.getPushPayloadBuider().setAccountId(notice.getAccountId().toString()) PushPayload pushMessage = PushPayload.getPushPayloadBuider().setAccountId(notice.getAccountId().toString())
.setTitle(notice.getTitle()) .setTitle(notice.getTitle())
.setContent(notice.getMsg()) .setContent(notice.getMsg())
.setType(notice.getType()) .setType(notice.getType())
.setItemType("0") .setItemType("0")
.setPayload(notice.getPayload())
.bulid(); .bulid();
String kdTopic = scope + notice.getAccountId(); String kdTopic = scope + notice.getAccountId() + subTopic;
mqttPushClient.sendToMqtt(kdTopic, pushMessage.toString()); String payload = pushMessage.toString();
mqttPushClient.sendToMqtt(kdTopic, payload);
} catch (Exception e) { } catch (Exception e) {
log.error("推送mq出现错误", e); log.error("推送mq出现错误", e);
} }
} }
} }

View File

@ -1261,13 +1261,6 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
baseRoleUserMapper.delete(new LambdaQueryWrapper<BaseRoleUser>().eq(BaseRoleUser::getUserId, id)); baseRoleUserMapper.delete(new LambdaQueryWrapper<BaseRoleUser>().eq(BaseRoleUser::getUserId, id));
} }
@Override
public List<SystemUser> getSystemUserList(Map<String, Object> map) {
companyService.getCompanyType(map);
return companyMapper.getSystemUserList(map);
}
@Override @Override
public Map<String, Object> md5Login(Map<String, Object> map) { public Map<String, Object> md5Login(Map<String, Object> map) {
try { try {

View File

@ -341,6 +341,8 @@ public class WorkerInfo implements Serializable {
private Double safeScore; private Double safeScore;
@ApiModelProperty(value = "下发状态1成功2失败3部分成功") @ApiModelProperty(value = "下发状态1成功2失败3部分成功")
private Integer sendSuccessStatus; private Integer sendSuccessStatus;
@ApiModelProperty(value = "退场的安全分数")
private Double exitSafeScore;
@TableField(exist = false) @TableField(exist = false)
@ApiModelProperty(value = "人脸分数") @ApiModelProperty(value = "人脸分数")
private java.lang.Integer faceScore; private java.lang.Integer faceScore;

View File

@ -280,18 +280,17 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
ThreadLocalUtil.addInKey("now", new Date()); ThreadLocalUtil.addInKey("now", new Date());
String workerIdStr = MapUtils.getString(map, "workerIdStr"); String workerIdStr = MapUtils.getString(map, "workerIdStr");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
checkExistAccount(workerIdStr);
if (StringUtils.isNotEmpty(workerIdStr)) { if (StringUtils.isNotEmpty(workerIdStr)) {
for (String id : workerIdStr.split(",")) { for (String id : workerIdStr.split(",")) {
WorkerInfo info = new WorkerInfo(); WorkerInfo info = workerInfoMapper.selectById(id);
info.setId(Long.valueOf(id));
info.setInserviceType(2); info.setInserviceType(2);
info.setExitDate(sdf.format(new Date())); info.setExitDate(sdf.format(new Date()));
info.setExitSafeScore(info.getSafeScore());
info.setSafeScore(0D);
workerInfoMapper.updateById(info); workerInfoMapper.updateById(info);
WorkerInfo workerInfo = workerInfoMapper.selectById(info.getId()); projectUfaceConfigService.deleteWorkerInfo(info);
projectUfaceConfigService.deleteWorkerInfo(workerInfo);
//上传住建 //上传住建
asyncWorker.sendExitWorkById(workerInfo, 2); asyncWorker.sendExitWorkById(info, 2);
} }
} }
} }
@ -433,6 +432,9 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
workerInfo.setExitDate(""); workerInfo.setExitDate("");
} }
WorkerInfo oldWorkerInfo = workerInfoMapper.selectById(workerInfo.getId()); WorkerInfo oldWorkerInfo = workerInfoMapper.selectById(workerInfo.getId());
if (Objects.equals(oldWorkerInfo.getInserviceType(), 2) && Objects.equals(workerInfo.getInserviceType(), 1)) {
workerInfo.setSafeScore(oldWorkerInfo.getExitSafeScore());
}
workerInfoMapper.updateById(workerInfo); workerInfoMapper.updateById(workerInfo);
//同步海康 //同步海康
asyncHikvision.editWorkerForHikvision(workerInfo); asyncHikvision.editWorkerForHikvision(workerInfo);

View File

@ -1,17 +1,22 @@
package com.zhgd.xmgl.modules.xz.emergency.service.impl; package com.zhgd.xmgl.modules.xz.emergency.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gexin.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.zhgd.jeecg.common.execption.OpenAlertException; import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator; import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.base.entity.vo.SectorOneVo; import com.zhgd.xmgl.base.entity.vo.SectorOneVo;
import com.zhgd.xmgl.base.entity.vo.SectorVo; import com.zhgd.xmgl.base.entity.vo.SectorVo;
import com.zhgd.xmgl.constant.Cts;
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService; import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl; import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo; import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
@ -211,6 +216,20 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
"有应急消息待处理", "33"); "有应急消息待处理", "33");
} }
} }
//大屏弹窗
List<SystemUser> projectUsers = systemUserService.getSystemUsersBySn(new MapBuilder<String, Object>().put(Cts.SN, entity.getProjectSn()).put(Cts.QUERY_TYPE, Cts.PROJECT_LEVEL).build());
for (SystemUser user : projectUsers) {
Notice notice = new Notice();
notice.setType("0");
notice.setMsg("大屏报警弹窗");
notice.setAccountId(user.getUserId());
notice.setTitle("大屏报警弹窗");
notice.setSendTime(DateUtil.now());
notice.setPayload(JSON.toJSONString(entity));
noticeService.sendMqttMessage(notice, "/bigScreen/emergency/alert");
}
} }
@Override @Override

View File

@ -60,12 +60,12 @@ public class XzHikvisionCompareDataServiceImpl extends ServiceImpl<XzHikvisionCo
private ICarInfoService carInfoService; private ICarInfoService carInfoService;
@Lazy @Lazy
@Autowired @Autowired
private AsyncXzHikvisionCompareData asyncXzHikvisionCompareData;
@Lazy
@Autowired
private XzHikvisionCompareDataServiceImpl xzHikvisionCompareDataService; private XzHikvisionCompareDataServiceImpl xzHikvisionCompareDataService;
@Lazy @Lazy
@Autowired @Autowired
private AsyncXzHikvisionCompareData asyncXzHikvisionCompareData;
@Lazy
@Autowired
private HikvisionTask hikvisionTask; private HikvisionTask hikvisionTask;
@Autowired @Autowired
private XzHikvisionCompareDataMapper xzHikvisionCompareDataMapper; private XzHikvisionCompareDataMapper xzHikvisionCompareDataMapper;
@ -488,7 +488,7 @@ public class XzHikvisionCompareDataServiceImpl extends ServiceImpl<XzHikvisionCo
public void manualCompareData(Map<String, Object> param) { public void manualCompareData(Map<String, Object> param) {
String projectSn = MapUtils.getString(param, Cts.PROJECT_SN); String projectSn = MapUtils.getString(param, Cts.PROJECT_SN);
try { try {
manualCompareDataAsync(param, projectSn); xzHikvisionCompareDataService.manualCompareDataAsync(param, projectSn);
} catch (Exception e) { } catch (Exception e) {
log.error("", e); log.error("", e);
addExceptionShowIfNull(projectSn); addExceptionShowIfNull(projectSn);