bug修改

This commit is contained in:
guo 2024-03-12 14:37:32 +08:00
parent 55ee46b341
commit 9b214946a6

View File

@ -3,12 +3,12 @@ package com.zhgd.xmgl.async;
import com.zhgd.xmgl.call.HousingDataCall;
import com.zhgd.xmgl.call.WkServiceuCall;
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise;
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService;
import com.zhgd.xmgl.modules.worker.entity.*;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -67,18 +67,19 @@ public class AsyncWorker {
@Async("sendWorkerExecutor")
public void sendBatchWokerDev(Map<String, Object> map, ProjectUfaceConfig projectUfaceConfig, List<UfaceDev> devList) {
try {
Long userId = MapUtils.getLong(map, "userId");
List<WorkerInfo> list = workerInfoMapper.selectProjectWorkerInfoList(map);
if (list.size() > 0) {
for (WorkerInfo info : list) {
try {
projectUfaceConfigService.sendBatchWorkerInfo(info, projectUfaceConfig, devList);
} catch (Exception e) {
log.error("下发人员异常:人员名称:{}", info.getWorkerName());
log.error("下发人员异常,人员名称:{}", info.getWorkerName());
noticeFail(info.getWorkerName(), userId);
e.printStackTrace();
}
}
}
Long userId = MapUtils.getLong(map, "userId");
if (userId != null) {
java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Notice notice = new Notice();
@ -94,8 +95,29 @@ public class AsyncWorker {
e.printStackTrace();
}
}
/**
* 下发人员失败的提示
*
* @param workerName
* @param userId
*/
private void noticeFail(String workerName, Long userId) {
if (userId != null) {
java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Notice notice = new Notice();
notice.setAccountId(userId);
notice.setMsg("下发人员异常,人员名称:" + workerName);
notice.setTitle("人员批量下发设备提醒");
notice.setSendTime(format1.format(new Date()));
notice.setType("1");
noticeService.addNotice(notice, true);
}
}
/**
* 单个人员数据发送任务
*
* @param info
*/
@Async("sendWorkerExecutor")
@ -154,6 +176,7 @@ public class AsyncWorker {
/**
* 向外部上传设备
*
* @param
*/
@Async("sendWorkerExecutor")
@ -168,6 +191,7 @@ public class AsyncWorker {
/**
* 单个人员数据发送任务
*
* @param info
*/
@Async("sendWorkerExecutor")
@ -182,6 +206,7 @@ public class AsyncWorker {
/**
* 添加企业
*
* @param enterpriseInfo
*/
@Async("sendWorkerExecutor")
@ -195,6 +220,7 @@ public class AsyncWorker {
/**
* 解除企业绑定
*
* @param projectEnterprise
*/
@Async("sendWorkerExecutor")