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.TeamInfo;
|
||||
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.mapper.XzHikvisionSyncMapper;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
@ -52,6 +53,9 @@ public class AsyncHikvision {
|
||||
ProjectVideoHkVqdMapper projectVideoHkVqdMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
EnterpriseInfoMapper enterpriseInfoMapper;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private INoticeService noticeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
@ -60,7 +64,6 @@ public class AsyncHikvision {
|
||||
@Autowired
|
||||
private XzHikvisionSyncMapper xzHikvisionSyncMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 添加劳务人员-海康
|
||||
*
|
||||
@ -189,6 +192,23 @@ public class AsyncHikvision {
|
||||
hikvisionCall.addEnterpriseInfoForHikvision(enterpriseInfo);
|
||||
} catch (Exception 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);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(enterpriseInfo.getEnterpriseName(), e, "编辑");
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,6 +228,10 @@ public class AsyncHikvision {
|
||||
hikvisionCall.deleteEnterpriseInfoForHikvision(enterpriseId, projectSn);
|
||||
} catch (Exception 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);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(teamInfo.getTeamName(), e, "编辑");
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,6 +251,7 @@ public class AsyncHikvision {
|
||||
hikvisionCall.deleteTeamInfoForHikvision(teamInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(teamInfo.getTeamName(), e, "删除");
|
||||
}
|
||||
}
|
||||
|
||||
@ -234,6 +261,7 @@ public class AsyncHikvision {
|
||||
hikvisionCall.addTeamInfoForHikvision(teamInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(teamInfo.getTeamName(), e, "新增");
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,6 +271,7 @@ public class AsyncHikvision {
|
||||
hikvisionCall.editDepartmentInfoForHikvision(teamInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "编辑");
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,6 +281,7 @@ public class AsyncHikvision {
|
||||
hikvisionCall.addDepartmentInfoForHikvision(teamInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "新增");
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,6 +291,7 @@ public class AsyncHikvision {
|
||||
hikvisionCall.deleteDepartmentInfoForHikvision(teamInfo);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(teamInfo.getDepartmentName(), e, "删除");
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,6 +301,7 @@ public class AsyncHikvision {
|
||||
hikvisionCall.editProjectForHikvision(project);
|
||||
} catch (Exception e) {
|
||||
log.error("海康:", e);
|
||||
sendNoticeForOrg(project.getProjectName(), e, "编辑");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -389,11 +389,6 @@ public class HikvisionCall {
|
||||
}
|
||||
}
|
||||
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("已在后台同步人员数据,请耐心等待!");
|
||||
}
|
||||
@ -514,11 +509,6 @@ public class HikvisionCall {
|
||||
} while (total > 0 && listJa.size() > 0);
|
||||
}
|
||||
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("已在后台同步车辆通行数据,请耐心等待!");
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.mqtt.bean.PushPayload;
|
||||
|
||||
import com.zhgd.mqtt.server.IMqttSender;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
@ -30,7 +29,6 @@ import java.util.Map;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {
|
||||
@Autowired
|
||||
private NoticeMapper noticeMapper;
|
||||
@ -55,17 +53,6 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
public void addNotice(Notice notice, boolean sendNotice) {
|
||||
noticeMapper.insert(notice);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -101,6 +88,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addProjectNotice(Long accountId, String msg, String title, String time, String type) {
|
||||
Notice notice = new Notice();
|
||||
notice.setAccountId(accountId);
|
||||
@ -122,7 +110,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
String kdTopic = scope + notice.getAccountId();
|
||||
mqttPushClient.sendToMqtt(kdTopic, pushMessage.toString());
|
||||
} catch (Exception e) {
|
||||
log.error("error:", e);
|
||||
log.error("推送mq出现错误:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user