bug修改
This commit is contained in:
parent
97ba255b3f
commit
250cf9cccb
@ -20,6 +20,7 @@ import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
|||||||
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||||
|
import com.zhgd.xmgl.modules.worker.mapper.EnterpriseInfoMapper;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.XzHikvisionSync;
|
import com.zhgd.xmgl.modules.xz.entity.XzHikvisionSync;
|
||||||
import com.zhgd.xmgl.modules.xz.mapper.XzHikvisionSyncMapper;
|
import com.zhgd.xmgl.modules.xz.mapper.XzHikvisionSyncMapper;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
@ -52,6 +53,9 @@ public class AsyncHikvision {
|
|||||||
ProjectVideoHkVqdMapper projectVideoHkVqdMapper;
|
ProjectVideoHkVqdMapper projectVideoHkVqdMapper;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
|
EnterpriseInfoMapper enterpriseInfoMapper;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
private INoticeService noticeService;
|
private INoticeService noticeService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -60,7 +64,6 @@ public class AsyncHikvision {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private XzHikvisionSyncMapper xzHikvisionSyncMapper;
|
private XzHikvisionSyncMapper xzHikvisionSyncMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加劳务人员-海康
|
* 添加劳务人员-海康
|
||||||
*
|
*
|
||||||
@ -189,6 +192,23 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.addEnterpriseInfoForHikvision(enterpriseInfo);
|
hikvisionCall.addEnterpriseInfoForHikvision(enterpriseInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(enterpriseInfo.getEnterpriseName(), e, "新增");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendNoticeForOrg(String name, Exception e, String action) {
|
||||||
|
if (SecurityUtils.getUser().getUserId() != null) {
|
||||||
|
String title = action + "组织到海康isc失败";
|
||||||
|
String type = "23";
|
||||||
|
String msg;
|
||||||
|
if (HttpUtils.isTimeOut(e)) {
|
||||||
|
msg = "同步失败,组织名称:" + name + "。失败原因:平台连接isc网络异常";
|
||||||
|
} else if (e instanceof OpenPromptException) {
|
||||||
|
msg = "同步失败,组织名称:" + name + "。失败原因:" + e.getMessage();
|
||||||
|
} else {
|
||||||
|
msg = "同步失败,组织名称:" + name + "。失败原因:下发异常";
|
||||||
|
}
|
||||||
|
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +218,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.editEnterpriseInfoForHikvision(enterpriseInfo);
|
hikvisionCall.editEnterpriseInfoForHikvision(enterpriseInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(enterpriseInfo.getEnterpriseName(), e, "编辑");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,6 +228,10 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.deleteEnterpriseInfoForHikvision(enterpriseId, projectSn);
|
hikvisionCall.deleteEnterpriseInfoForHikvision(enterpriseId, projectSn);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
EnterpriseInfo enterpriseInfo = enterpriseInfoMapper.selectById(enterpriseId);
|
||||||
|
if (enterpriseInfo != null) {
|
||||||
|
sendNoticeForOrg(enterpriseInfo.getEnterpriseName(), e, "删除");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,6 +241,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.editTeamInfoForHikvision(teamInfo);
|
hikvisionCall.editTeamInfoForHikvision(teamInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(teamInfo.getTeamName(), e, "编辑");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +251,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.deleteTeamInfoForHikvision(teamInfo);
|
hikvisionCall.deleteTeamInfoForHikvision(teamInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(teamInfo.getTeamName(), e, "删除");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +261,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.addTeamInfoForHikvision(teamInfo);
|
hikvisionCall.addTeamInfoForHikvision(teamInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(teamInfo.getTeamName(), e, "新增");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +271,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.editDepartmentInfoForHikvision(teamInfo);
|
hikvisionCall.editDepartmentInfoForHikvision(teamInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "编辑");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,6 +281,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.addDepartmentInfoForHikvision(teamInfo);
|
hikvisionCall.addDepartmentInfoForHikvision(teamInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "新增");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,6 +291,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.deleteDepartmentInfoForHikvision(teamInfo);
|
hikvisionCall.deleteDepartmentInfoForHikvision(teamInfo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "删除");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,6 +301,7 @@ public class AsyncHikvision {
|
|||||||
hikvisionCall.editProjectForHikvision(project);
|
hikvisionCall.editProjectForHikvision(project);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("海康:", e);
|
log.error("海康:", e);
|
||||||
|
sendNoticeForOrg(project.getProjectName(), e, "编辑");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -389,11 +389,6 @@ public class HikvisionCall {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.info("服务挂了主动获取门禁点事件的人员通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
log.info("服务挂了主动获取门禁点事件的人员通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
||||||
if (SecurityUtils.getUser().getUserId() != null) {
|
|
||||||
String title = "同步人员通行数据成功";
|
|
||||||
String msg = title + ",同步时间段:startTime:" + startTime + ",endTime:" + endTime;
|
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, "2");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return Result.ok("已在后台同步人员数据,请耐心等待!");
|
return Result.ok("已在后台同步人员数据,请耐心等待!");
|
||||||
}
|
}
|
||||||
@ -514,11 +509,6 @@ public class HikvisionCall {
|
|||||||
} while (total > 0 && listJa.size() > 0);
|
} while (total > 0 && listJa.size() > 0);
|
||||||
}
|
}
|
||||||
log.info("服务挂了主动获取车辆事件的车辆通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
log.info("服务挂了主动获取车辆事件的车辆通行记录执行完成,startTime:{},endTime:{}", startTime, endTime);
|
||||||
if (SecurityUtils.getUser().getUserId() != null) {
|
|
||||||
String title = "同步车辆通行数据成功";
|
|
||||||
String msg = title + ",同步时间段:startTime:" + startTime + ",endTime:" + endTime;
|
|
||||||
noticeService.addUserNotice(SecurityUtils.getUser().getUserId(), msg, title, "2");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return Result.ok("已在后台同步车辆通行数据,请耐心等待!");
|
return Result.ok("已在后台同步车辆通行数据,请耐心等待!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,6 @@ 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.zhgd.mqtt.bean.PushPayload;
|
import com.zhgd.mqtt.bean.PushPayload;
|
||||||
|
|
||||||
import com.zhgd.mqtt.server.IMqttSender;
|
import com.zhgd.mqtt.server.IMqttSender;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
@ -30,7 +29,6 @@ import java.util.Map;
|
|||||||
* @version: V1.0
|
* @version: V1.0
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {
|
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private NoticeMapper noticeMapper;
|
private NoticeMapper noticeMapper;
|
||||||
@ -47,38 +45,27 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
|
int pageNo = Integer.parseInt(map.getOrDefault("pageNo", 1).toString());
|
||||||
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
|
int pageSize = Integer.parseInt(map.getOrDefault("pageSize", 10).toString());
|
||||||
Page<Notice> page = new Page<>(pageNo, pageSize);
|
Page<Notice> page = new Page<>(pageNo, pageSize);
|
||||||
List<Notice> list=noticeMapper.selectNoticePageList(page, map);
|
List<Notice> list = noticeMapper.selectNoticePageList(page, map);
|
||||||
return page.setRecords(list);
|
return page.setRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addNotice(Notice notice, boolean sendNotice) {
|
public void addNotice(Notice notice, boolean sendNotice) {
|
||||||
noticeMapper.insert(notice);
|
noticeMapper.insert(notice);
|
||||||
if(sendNotice){
|
if (sendNotice) {
|
||||||
/*try {
|
|
||||||
PushPayload pushMessage = PushPayload.getPushPayloadBuider().setAccountId(notice.getAccountId().toString())
|
|
||||||
.setTitle(notice.getTitle())
|
|
||||||
.setContent(notice.getMsg())
|
|
||||||
.setType(notice.getType())
|
|
||||||
.bulid();
|
|
||||||
String kdTopic = scope+notice.getAccountId();
|
|
||||||
mqttPushClient.sendToMqtt(kdTopic, pushMessage.toString());
|
|
||||||
}catch (Exception e){
|
|
||||||
log.error("error:",e);
|
|
||||||
}*/
|
|
||||||
sendPushMessage(notice);
|
sendPushMessage(notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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<>();
|
||||||
queryWrapper.lambda().eq(Notice::getAccountId, MapUtils.getString(map,"userId"));
|
queryWrapper.lambda().eq(Notice::getAccountId, MapUtils.getString(map, "userId"));
|
||||||
noticeMapper.delete(queryWrapper);
|
noticeMapper.delete(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addUserNotice(Long accountId, String msg, String title,String type) {
|
public void addUserNotice(Long accountId, String msg, String title, String type) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
Notice notice = new Notice();
|
Notice notice = new Notice();
|
||||||
notice.setAccountId(accountId);
|
notice.setAccountId(accountId);
|
||||||
@ -93,25 +80,26 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
@Override
|
@Override
|
||||||
public void sendProjectNoicte(String projectSn, String title, String msg, String type) {
|
public void sendProjectNoicte(String projectSn, String title, String msg, String type) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
List<SystemUser> systemUserList=systemUserMapper.selectProjectSystemUserList(projectSn);
|
List<SystemUser> systemUserList = systemUserMapper.selectProjectSystemUserList(projectSn);
|
||||||
//向项目管理员和子账号推送通知
|
//向项目管理员和子账号推送通知
|
||||||
if(systemUserList.size()>0){
|
if (systemUserList.size() > 0) {
|
||||||
for (SystemUser systemUser:systemUserList){
|
for (SystemUser systemUser : systemUserList) {
|
||||||
addProjectNotice(systemUser.getUserId(),msg,title,sdf.format(new Date()),type);
|
addProjectNotice(systemUser.getUserId(), msg, title, sdf.format(new Date()), type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void addProjectNotice(Long accountId,String msg,String title,String time,String type){
|
|
||||||
|
private void addProjectNotice(Long accountId, String msg, String title, String time, String type) {
|
||||||
Notice notice = new Notice();
|
Notice notice = new Notice();
|
||||||
notice.setAccountId(accountId);
|
notice.setAccountId(accountId);
|
||||||
notice.setMsg(msg);
|
notice.setMsg(msg);
|
||||||
notice.setTitle(title);
|
notice.setTitle(title);
|
||||||
notice.setSendTime(time);
|
notice.setSendTime(time);
|
||||||
notice.setType(type);
|
notice.setType(type);
|
||||||
addNotice(notice,true);
|
addNotice(notice, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPushMessage(Notice notice){
|
private void sendPushMessage(Notice notice) {
|
||||||
try {
|
try {
|
||||||
PushPayload pushMessage = PushPayload.getPushPayloadBuider().setAccountId(notice.getAccountId().toString())
|
PushPayload pushMessage = PushPayload.getPushPayloadBuider().setAccountId(notice.getAccountId().toString())
|
||||||
.setTitle(notice.getTitle())
|
.setTitle(notice.getTitle())
|
||||||
@ -119,10 +107,10 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
|||||||
.setType(notice.getType())
|
.setType(notice.getType())
|
||||||
.setItemType("0")
|
.setItemType("0")
|
||||||
.bulid();
|
.bulid();
|
||||||
String kdTopic = scope+notice.getAccountId();
|
String kdTopic = scope + notice.getAccountId();
|
||||||
mqttPushClient.sendToMqtt(kdTopic, pushMessage.toString());
|
mqttPushClient.sendToMqtt(kdTopic, pushMessage.toString());
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
log.error("error:", e);
|
log.error("推送mq出现错误:", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user