应急的bug修复

This commit is contained in:
guoshengxiong 2024-05-20 20:13:39 +08:00
parent cbb335e668
commit c8eb09de4e
9 changed files with 97 additions and 18 deletions

View File

@ -30,7 +30,7 @@ public class Notice implements Serializable {
private java.lang.Long id;
@ApiModelProperty(value = "类型1考勤提醒2人员报警,3车辆4混凝土监测5卸料平台6配电箱7扬尘,8视频9标养室,10安全检查,11质量检查,12塔吊,13升降机," +
"14电表,15水表,16访客,17,防疫人员通知18访客通知,19巡检点,20人员的资质证书即将到期,21人员的合同信息即将到期22人员的保险信息即将到期," +
"23同步人员到海康isc,24同步车辆到海康isc,25同步组织到海康isc 30工作流审批通知31大屏的安全和质量,32大屏的危大")
"23同步人员到海康isc,24同步车辆到海康isc,25同步组织到海康isc 30工作流审批通知31大屏的安全和质量,32大屏的危大33应急处置")
private java.lang.String type;
/**
* 消息内容

View File

@ -120,7 +120,7 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
public void addUserNoticeAndApp(Long accountId, String msg, String title, String type, Object payload) {
final SerializeConfig config = new SerializeConfig();
config.put(Long.class, ToStringSerializer.instance);
addUserNotice(accountId, msg, title, type, JSONObject.toJSONString(payload, config));
addUserNotice(accountId, msg, title, type, payload != null ? JSONObject.toJSONString(payload, config) : null);
SystemUser systemUser = systemUserMapper.selectById(accountId);
if (systemUser == null) {
return;

View File

@ -112,15 +112,7 @@ public class WorkerInfoController {
@ApiImplicitParam(name = "id", value = "劳务人员ID", paramType = "body", required = true, dataType = "Integer")
@PostMapping(value = "/queryById")
public Result<WorkerInfo> queryById(@RequestBody Map<String, Object> map) {
Result<WorkerInfo> result = new Result<WorkerInfo>();
WorkerInfo workerInfo = workerInfoService.getById(MapUtils.getString(map, "id"));
if (workerInfo == null) {
result.error500(MessageUtil.get("notFindErr"));
} else {
result.setResult(workerInfo);
result.setSuccess(true);
}
return result;
return Result.success(workerInfoService.queryById(map));
}

View File

@ -48,6 +48,9 @@
and create_time>=current_date group by person_sn ) wa on wa.person_sn = a.person_sn
</if>
WHERE 1 = 1
<if test="param.id != null and param.id != ''">
and a.id = #{param.id}
</if>
<if test="param.isFilterQualityRegionEnterprise != null and param.isFilterQualityRegionEnterprise == '1'.toString() and param.accountType == '6'.toString()">
and a.enterprise_id in(
select distinct qrte.enterprise_id from quality_region_to_enterprise qrte join quality_region_to_user qrtu

View File

@ -139,4 +139,6 @@ public interface IWorkerInfoService extends IService<WorkerInfo> {
List<TrendOneVo> statsEnterprise(Map<String, Object> map);
List<StatsTrendVo> statsEnterpriseRisk(Map<String, Object> map);
WorkerInfo queryById(Map<String, Object> map);
}

View File

@ -2153,6 +2153,17 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
return baseMapper.statsEnterpriseRisk(map);
}
@Override
public WorkerInfo queryById(Map<String, Object> map) {
String id = MapUtils.getString(map, "id");
map.put("id", id);
IPage<WorkerInfo> page = selectWorkerInfoList(map);
if (CollUtil.isEmpty(page.getRecords())) {
return null;
}
return page.getRecords().get(0);
}
/**
* 真正递归的方法
*

View File

@ -126,4 +126,16 @@ public class XzEmergencyRecordController {
public Result<StatsDispositionStatusVo> statsDispositionStatus(@ApiIgnore @RequestBody Map<String, Object> param) {
return Result.success(xzEmergencyRecordService.statsDispositionStatus(param));
}
@ApiOperation(value = "发送通知", notes = "发送通知", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "星纵-应急-处置台账ID", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/sendNotice")
public Result sendNotice(@ApiIgnore @RequestBody Map<String, Object> param) {
xzEmergencyRecordService.sendNotice(param);
return Result.ok();
}
}

View File

@ -30,4 +30,6 @@ public interface IXzEmergencyRecordService extends IService<XzEmergencyRecord> {
XzEmergencyRecord queryById(String id);
StatsDispositionStatusVo statsDispositionStatus(Map<String, Object> param);
void sendNotice(Map<String, Object> param);
}

View File

@ -11,13 +11,18 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
import com.zhgd.xmgl.modules.xz.emergency.entity.XzEmergencyPush;
import com.zhgd.xmgl.modules.xz.emergency.entity.XzEmergencyRecord;
import com.zhgd.xmgl.modules.xz.emergency.entity.XzEmergencyRescueSituation;
import com.zhgd.xmgl.modules.xz.emergency.entity.XzEmergencyType;
import com.zhgd.xmgl.modules.xz.emergency.entity.vo.StatsDispositionStatusVo;
import com.zhgd.xmgl.modules.xz.emergency.mapper.XzEmergencyPushMapper;
import com.zhgd.xmgl.modules.xz.emergency.mapper.XzEmergencyRecordMapper;
import com.zhgd.xmgl.modules.xz.emergency.mapper.XzEmergencyRescueSituationMapper;
import com.zhgd.xmgl.modules.xz.emergency.mapper.XzEmergencyTypeMapper;
import com.zhgd.xmgl.modules.xz.emergency.service.IXzEmergencyRecordService;
import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
@ -42,9 +47,15 @@ import java.util.Map;
@Service
@Transactional(rollbackFor = Exception.class)
public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordMapper, XzEmergencyRecord> implements IXzEmergencyRecordService {
@Autowired
WorkerInfoServiceImpl workerInfoService;
@Autowired
NoticeServiceImpl noticeService;
@Autowired
ISystemUserService systemUserService;
@Autowired
XzEmergencyTypeMapper xzEmergencyTypeMapper;
@Autowired
private XzEmergencyRecordMapper xzEmergencyRecordMapper;
@Autowired
private XzEmergencyRescueSituationMapper xzEmergencyRescueSituationMapper;
@ -72,8 +83,21 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
String alias = "t.";
QueryWrapper<XzEmergencyRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(XzEmergencyRecord.class, paramMap, alias);
String enterpriseId = MapUtils.getString(paramMap, "enterpriseId");
String alarmPersonName = MapUtils.getString(paramMap, "alarmPersonName");
String projectSn = MapUtils.getString(paramMap, "projectSn");
//只能看到自己的负责的企业
//项目子账号只能看到自己的负责的企业
querySelfEnterpriseIfSub(enterpriseId, projectSn);
if (StrUtil.isNotBlank(enterpriseId)) {
queryWrapper.eq("ei.id", enterpriseId);
}
if (StrUtil.isNotBlank(alarmPersonName)) {
queryWrapper.like("wi.worker_name", alarmPersonName);
}
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(XzEmergencyRecord::getUpdateDate));
return queryWrapper;
}
private String querySelfEnterpriseIfSub(String enterpriseId, String projectSn) {
UserInfo user = SecurityUtils.getUser();
if (user.getAccountType() == 6) {
List<SystemUser> systemUserList = systemUserService.getProjectChilderSystemUserList(new MapBuilder<String, Object>().put("projectSn", projectSn).put("userId", user.getUserId()).build());
@ -87,7 +111,7 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
if (push == null) {
enterpriseId = "-1";
} else {
List<String> userIds = StrUtil.split(",", push.getEmergencyManagerId());
List<String> userIds = StrUtil.split(push.getEmergencyManagerId(), ",");
if (userIds.contains(user.getUserId() + "")) {
enterpriseId = String.valueOf(push.getEnterpriseId());
} else {
@ -96,11 +120,7 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
}
}
}
if (StrUtil.isNotBlank(enterpriseId)) {
queryWrapper.eq("ei.id", enterpriseId);
}
queryWrapper.orderByDesc(alias + RefUtil.fieldNameUlc(XzEmergencyRecord::getId));
return queryWrapper;
return enterpriseId;
}
private List<XzEmergencyRecord> dealList(List<XzEmergencyRecord> list) {
@ -141,6 +161,9 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
throw new OpenAlertException("未找到对应实体");
}
baseMapper.deleteById(id);
xzEmergencyRescueSituationMapper.delete(new LambdaQueryWrapper<XzEmergencyRescueSituation>()
.eq(XzEmergencyRescueSituation::getXzEmergencyRecordId, id));
}
@Override
@ -160,4 +183,38 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
return baseMapper.statsDispositionStatus(param);
}
@Override
public void sendNotice(Map<String, Object> param) {
String id = MapUtils.getString(param, "id");
XzEmergencyRecord entity = baseMapper.queryById(id);
if (entity == null) {
throw new OpenAlertException("未找到对应实体");
}
WorkerInfo wi = workerInfoService.queryById(new MapBuilder<String, Object>().put("id", entity.getAlarmPersonId()).build());
if (wi == null) {
return;
}
XzEmergencyPush push = xzEmergencyPushMapper.selectOne(new LambdaQueryWrapper<XzEmergencyPush>()
.eq(XzEmergencyPush::getEnterpriseId, wi.getEnterpriseId())
.eq(XzEmergencyPush::getProjectSn, wi.getProjectSn())
);
if (push == null) {
return;
}
List<String> userIds = StrUtil.split(push.getEmergencyManagerId(), ",");
if (CollUtil.isEmpty(userIds)) {
return;
}
XzEmergencyType type = xzEmergencyTypeMapper.selectById(entity.getEmergencyTypeId());
for (String userId : userIds) {
if (entity.getEmergencyTypeId() == -1) {
noticeService.addUserNoticeAndApp(Long.valueOf(userId), StrUtil.format("{}人员在{}位置发起一键报警,请及时救援!", wi.getWorkerName(), entity.getLongitude() == null || entity.getLatitude() == null ? "未知" : entity.getLongitude() + "," + entity.getLatitude()),
"有应急消息待处理", "33");
} else {
noticeService.addUserNoticeAndApp(Long.valueOf(userId), StrUtil.format("{}人员在{}位置发起【{}】应急报警,请及时救援!", wi.getWorkerName(), entity.getLongitude() == null || entity.getLatitude() == null ? "未知" : entity.getLongitude() + "," + entity.getLatitude(), type != null ? type.getEmergencyType() : "其他类型"),
"有应急消息待处理", "33");
}
}
}
}