Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -209,6 +209,30 @@ sms:
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2491776
|
||||
config4:
|
||||
# 质量工单逾期
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534747
|
||||
config5:
|
||||
# 设计图纸
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534750
|
||||
config6:
|
||||
# 安全工单
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534848
|
||||
|
||||
|
||||
--- # 三方授权
|
||||
|
||||
@ -213,6 +213,30 @@ sms:
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2491776
|
||||
config4:
|
||||
# 质量工单逾期
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534747
|
||||
config5:
|
||||
# 设计图纸
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534750
|
||||
config6:
|
||||
# 安全工单
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534848
|
||||
|
||||
--- # 三方授权
|
||||
justauth:
|
||||
|
||||
@ -129,6 +129,7 @@ security:
|
||||
- /resource/oss/upload
|
||||
# todo 仅测试
|
||||
- /facility/matrix/**
|
||||
- /hat/device/data
|
||||
|
||||
# 多租户配置
|
||||
tenant:
|
||||
|
||||
@ -30,11 +30,11 @@ public class RedisConfig {
|
||||
|
||||
RedisMessageListenerContainer container = new RedisMessageListenerContainer();
|
||||
container.setConnectionFactory(connectionFactory);
|
||||
List<String> wrjKeys = droProjectDroneService.getTopicsByKeyPrefix();
|
||||
for (String key : wrjKeys) {
|
||||
// 订阅 wrj:8UUXN4P00A06NK 频道
|
||||
container.addMessageListener(listenerAdapter, new PatternTopic("wrj:"+key));
|
||||
}
|
||||
// List<String> wrjKeys = droProjectDroneService.getTopicsByKeyPrefix();
|
||||
// for (String key : wrjKeys) {
|
||||
// // 订阅 wrj:8UUXN4P00A06NK 频道
|
||||
// container.addMessageListener(listenerAdapter, new PatternTopic("wrj:osd4"+key));
|
||||
// }
|
||||
return container;
|
||||
}
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.bigscreen.domain.dto.TanchuangInfoReq;
|
||||
import org.dromara.bigscreen.domain.dto.Ys7DeviceUpdateReq;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectLandVo;
|
||||
@ -410,4 +411,20 @@ public class ProjectBigScreenController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新无人机缓存
|
||||
*/
|
||||
@GetMapping("/setWrjHc")
|
||||
public void setWrjHc(){
|
||||
projectBigScreenService.setWrjHc();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新无人机缓存
|
||||
*/
|
||||
@GetMapping("/getInfoData")
|
||||
public R<Map<String, Map<String, Object>>> getInfoData(TanchuangInfoReq req){
|
||||
return R.ok(projectBigScreenService.getInfoData(req));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package org.dromara.bigscreen.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TanchuangInfoReq implements Serializable {
|
||||
|
||||
private Long id;
|
||||
}
|
||||
@ -46,19 +46,37 @@ public class RedisMessageListener implements MessageListener {
|
||||
// 处理消息
|
||||
// System.out.println("返回:"+stringRedisTemplate.getStringSerializer().deserialize(message.getBody()));
|
||||
String gateway = JSONUtil.parseObj(stringRedisTemplate.getStringSerializer().deserialize(message.getBody())).getStr("gateway");
|
||||
String key = "";
|
||||
if (JSONUtil.parseObj(stringRedisTemplate.getStringSerializer().deserialize(message.getBody())).getJSONObject("data").get("job_number") != null) {
|
||||
key = "wrj:osd1:"+gateway;
|
||||
}else if (JSONUtil.parseObj(stringRedisTemplate.getStringSerializer().deserialize(message.getBody())).getJSONObject("data").get("wireless_link") != null) {
|
||||
key = "wrj:osd2:"+gateway;
|
||||
}else if (JSONUtil.parseObj(stringRedisTemplate.getStringSerializer().deserialize(message.getBody())).getJSONObject("data").get("network_state") != null) {
|
||||
key = "wrj:osd3:"+gateway;
|
||||
DroProjectDrone droProjectDrone = droProjectDroneService.getBaseMapper().selectOne(new LambdaQueryWrapper<DroProjectDrone>().eq(DroProjectDrone::getDroneSn, gateway));
|
||||
setWs(message, gateway, droProjectDrone);
|
||||
}else{
|
||||
key = "wrj:osd4:"+gateway;
|
||||
DroProjectDrone droProjectDrone = droProjectDroneService.getBaseMapper().selectOne(new LambdaQueryWrapper<DroProjectDrone>().eq(DroProjectDrone::getDroneSn, gateway));
|
||||
setWs(message, gateway, droProjectDrone);
|
||||
|
||||
}
|
||||
stringRedisTemplate
|
||||
.opsForValue()
|
||||
.set("wrj:"+gateway
|
||||
.set(key
|
||||
, Objects.requireNonNull(stringRedisTemplate.getStringSerializer().deserialize(message.getBody())));
|
||||
DroProjectDrone droProjectDrone = droProjectDroneService.getBaseMapper().selectOne(new LambdaQueryWrapper<DroProjectDrone>().eq(DroProjectDrone::getDroneSn, gateway));
|
||||
String pushContent = buildPushMessage(gateway,stringRedisTemplate.getStringSerializer().deserialize(message.getBody()),droProjectDrone.getProjectId());
|
||||
|
||||
}
|
||||
|
||||
private void setWs(Message message, String gateway, DroProjectDrone droProjectDrone) {
|
||||
String pushContent = buildPushMessage(gateway,stringRedisTemplate.getStringSerializer().deserialize(message.getBody()), droProjectDrone.getProjectId());
|
||||
// 发送给指定用户(equipment.getUserId())
|
||||
WebSocketMessageDto messageDto = new WebSocketMessageDto();
|
||||
messageDto.setMessage(pushContent);
|
||||
messageDto.setSessionKeys(Collections.singletonList(droProjectDrone.getProjectId()));
|
||||
WebSocketUtils.publishMessage(messageDto);
|
||||
|
||||
}
|
||||
|
||||
private String buildPushMessage(String key, String message, Long projectId) {
|
||||
JSONObject messageObj = new JSONObject();
|
||||
messageObj.put("type", "wrj_DATA_UPDATE");
|
||||
|
||||
@ -0,0 +1,192 @@
|
||||
package org.dromara.bigscreen.manager;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.drone.service.IDroProjectDroneService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Redis 订阅管理器(定时任务动态更新订阅关系)
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RedisSubscribeManager {
|
||||
|
||||
// 1. 注入 Redis 核心组件
|
||||
@Resource
|
||||
private RedisMessageListenerContainer redisMessageListenerContainer;
|
||||
@Resource
|
||||
private MessageListenerAdapter redisMessageListenerAdapter;
|
||||
|
||||
// 2. 注入业务 Service(延迟加载,避免循环依赖)
|
||||
@Resource
|
||||
@Lazy
|
||||
private IDroProjectDroneService droProjectDroneService;
|
||||
|
||||
// 3. 维护已订阅的主题关系:key=完整主题(如wrj:8UUXN4P00A06NK),value=对应的PatternTopic
|
||||
private final Map<String, PatternTopic> subscribedTopics = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
* 项目启动后立即执行一次订阅(避免等待定时任务首次执行)
|
||||
*/
|
||||
@PostConstruct
|
||||
public void initSubscribe() {
|
||||
log.info("项目启动,初始化Redis订阅...");
|
||||
// 步骤1:从数据库获取最新的主题列表(原逻辑:getTopicsByKeyPrefix)
|
||||
List<String> latestKeys = droProjectDroneService.getTopicsByKeyPrefix();
|
||||
if (latestKeys == null || latestKeys.isEmpty()) {
|
||||
log.warn("未获取到任何主题,将取消所有现有订阅");
|
||||
cancelAllSubscribes();
|
||||
return;
|
||||
}
|
||||
|
||||
// 步骤2:构建最新的完整主题(格式:wrj:key)
|
||||
Set<String> latestFullTopics = new HashSet<>();
|
||||
for (String key : latestKeys) {
|
||||
latestFullTopics.add("wrj:osd1:" + key);
|
||||
latestFullTopics.add("wrj:osd2:" + key);
|
||||
latestFullTopics.add("wrj:osd3:" + key);
|
||||
latestFullTopics.add("wrj:osd4:" + key);
|
||||
}
|
||||
|
||||
|
||||
// 步骤3:对比现有订阅,删除过期主题
|
||||
cancelExpiredSubscribes(latestFullTopics);
|
||||
|
||||
// 步骤4:对比现有订阅,新增未订阅的主题
|
||||
addNewSubscribes(latestFullTopics);
|
||||
}
|
||||
|
||||
/**
|
||||
* 4. 定时任务:定期更新订阅(每5分钟执行一次,可调整cron表达式)
|
||||
* cron格式:秒 分 时 日 月 周 年(示例:0 0/5 * * * ? 表示每5分钟)
|
||||
*/
|
||||
@Scheduled(cron = "0 0/6 * * * ?")
|
||||
public void dynamicUpdateSubscribe() {
|
||||
try {
|
||||
Object object = RedisUtils.getCacheObject("xmjdap:ws");
|
||||
log.info("开始执行Redis订阅更新定时任务...");
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
long oldTime = Long.parseLong(String.valueOf(object));
|
||||
long now = System.currentTimeMillis();
|
||||
if (now-oldTime > 300000) {
|
||||
RedisUtils.deleteObject("xmjdap:ws");
|
||||
cancelAllSubscribes();
|
||||
return;
|
||||
}
|
||||
// 步骤1:从数据库获取最新的主题列表(原逻辑:getTopicsByKeyPrefix)
|
||||
List<String> latestKeys = droProjectDroneService.getTopicsByKeyPrefix();
|
||||
if (latestKeys == null || latestKeys.isEmpty()) {
|
||||
log.warn("定时任务未获取到任何主题,将取消所有现有订阅");
|
||||
cancelAllSubscribes();
|
||||
return;
|
||||
}
|
||||
|
||||
// 步骤2:构建最新的完整主题(格式:wrj:key)
|
||||
Set<String> latestFullTopics = new HashSet<>();
|
||||
for (String key : latestKeys) {
|
||||
latestFullTopics.add("wrj:osd1:" + key);
|
||||
latestFullTopics.add("wrj:osd2:" + key);
|
||||
latestFullTopics.add("wrj:osd3:" + key);
|
||||
latestFullTopics.add("wrj:osd4:" + key);
|
||||
}
|
||||
|
||||
// 步骤3:对比现有订阅,删除过期主题
|
||||
cancelExpiredSubscribes(latestFullTopics);
|
||||
|
||||
// 步骤4:对比现有订阅,新增未订阅的主题
|
||||
addNewSubscribes(latestFullTopics);
|
||||
|
||||
log.info("Redis订阅更新完成,当前已订阅主题数:{}", subscribedTopics.size());
|
||||
} catch (Exception e) {
|
||||
log.error("Redis订阅更新定时任务执行失败", e);
|
||||
// 异常时不修改现有订阅,避免误删
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消过期的订阅(现有订阅不在最新列表中的主题)
|
||||
*/
|
||||
private void cancelExpiredSubscribes(Set<String> latestFullTopics) {
|
||||
// 遍历现有订阅,找出需要删除的主题
|
||||
Set<String> expiredTopics = subscribedTopics.keySet().stream()
|
||||
.filter(topic -> !latestFullTopics.contains(topic))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (expiredTopics.isEmpty()) {
|
||||
log.info("无过期订阅主题,无需删除");
|
||||
return;
|
||||
}
|
||||
|
||||
// 取消每个过期主题的订阅
|
||||
for (String expiredTopic : expiredTopics) {
|
||||
PatternTopic topic = subscribedTopics.get(expiredTopic);
|
||||
if (topic != null) {
|
||||
// 从容器中移除监听器(取消订阅)
|
||||
redisMessageListenerContainer.removeMessageListener(redisMessageListenerAdapter, topic);
|
||||
subscribedTopics.remove(expiredTopic);
|
||||
log.info("已取消过期订阅:{}", expiredTopic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增未订阅的主题(最新列表中有但现有订阅没有的主题)
|
||||
*/
|
||||
private void addNewSubscribes(Set<String> latestFullTopics) {
|
||||
// 遍历最新主题,找出需要新增的主题
|
||||
Set<String> newTopics = latestFullTopics.stream()
|
||||
.filter(topic -> !subscribedTopics.containsKey(topic))
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (newTopics.isEmpty()) {
|
||||
log.info("无新增订阅主题,无需添加");
|
||||
return;
|
||||
}
|
||||
|
||||
// 为每个新主题添加订阅
|
||||
for (String newTopic : newTopics) {
|
||||
PatternTopic topic = new PatternTopic(newTopic);
|
||||
// 向容器中添加监听器(新增订阅)
|
||||
redisMessageListenerContainer.addMessageListener(redisMessageListenerAdapter, topic);
|
||||
subscribedTopics.put(newTopic, topic);
|
||||
log.info("已新增订阅:{}", newTopic);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消所有现有订阅(兜底方法)
|
||||
*/
|
||||
public void cancelAllSubscribes() {
|
||||
if (subscribedTopics.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
// 遍历所有已订阅主题,取消订阅
|
||||
for (Map.Entry<String, PatternTopic> entry : subscribedTopics.entrySet()) {
|
||||
redisMessageListenerContainer.removeMessageListener(redisMessageListenerAdapter, entry.getValue());
|
||||
log.info("已取消订阅:{}", entry.getKey());
|
||||
}
|
||||
subscribedTopics.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.bigscreen.service;
|
||||
|
||||
import org.dromara.bigscreen.domain.dto.TanchuangInfoReq;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
|
||||
@ -78,4 +79,11 @@ public interface ProjectBigScreenService {
|
||||
void setList(GpsEquipmentBo bo);
|
||||
|
||||
List<Map<String, Object>> getClientList(Long projectId);
|
||||
|
||||
/**
|
||||
* 更新无人机缓存
|
||||
*/
|
||||
void setWrjHc();
|
||||
|
||||
Map<String, Map<String, Object>> getInfoData(TanchuangInfoReq req);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.bigscreen.domain.dto.TanchuangInfoReq;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
|
||||
@ -18,7 +19,9 @@ import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.drone.service.IDroProjectDroneService;
|
||||
import org.dromara.gps.domain.bo.GpsEquipmentBo;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
|
||||
import org.dromara.gps.service.IDeviceService;
|
||||
import org.dromara.gps.service.IGpsEquipmentService;
|
||||
import org.dromara.manager.weathermanager.vo.WeatherVo;
|
||||
import org.dromara.other.domain.OthYs7Device;
|
||||
@ -88,6 +91,9 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
@Lazy
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
private IDeviceService deviceService;
|
||||
|
||||
/**
|
||||
* 获取项目天气
|
||||
*
|
||||
@ -189,6 +195,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
if (CollUtil.isNotEmpty(attendancePeopleList)) {
|
||||
List<SubConstructionUser> users = constructionUserService.lambdaQuery()
|
||||
.in(SubConstructionUser::getSysUserId, attendancePeopleList)
|
||||
.isNotNull(SubConstructionUser::getTeamId)
|
||||
.list();
|
||||
userTeamMap = users.stream()
|
||||
.collect(Collectors.groupingBy(SubConstructionUser::getTeamId));
|
||||
@ -472,6 +479,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<GpsEquipmentSonVo> voList = gpsEquipmentService.getClientList(projectId, startOfDay, now);
|
||||
List<GpsEquipmentSonVo> appList = gpsEquipmentService.getUserListByProjectId(projectId, startOfDay, now);
|
||||
List<DeviceVo> anqmList = deviceService.getUserListByProjectId(projectId, startOfDay, now);
|
||||
List<OthYs7Device> othYs7DeviceList = othYs7DeviceService.lambdaQuery()
|
||||
.eq(OthYs7Device::getProjectId, projectId)
|
||||
.between(OthYs7Device::getUpdateTime, startOfDay, now)
|
||||
@ -484,23 +492,40 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
Map<String, Object> sbMap = new HashMap<>();
|
||||
Map<String, Object> wrjMap = new HashMap<>();
|
||||
Map<String, Object> sxtMap = new HashMap<>();
|
||||
Map<String, Object> wrjMap1 = new HashMap<>();
|
||||
Map<String, Object> sxtMap1 = new HashMap<>();
|
||||
List<Map<String, Object>> gpsChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> sbChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> appChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> anqmChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> wrjChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> wrjChildrenMap1 = new ArrayList<>();
|
||||
List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> sxtChildrenMap1 = new ArrayList<>();
|
||||
|
||||
Map<String, Object> sxt = new HashMap<>();
|
||||
sxt.put("id", 4545555);
|
||||
sxt.put("label", "");
|
||||
sxt.put("name", "摄像头");
|
||||
sxt.put("type", "shexiangtou");
|
||||
sxt.put("lat", 23.81524718);
|
||||
sxt.put("lng", 107.13038137);
|
||||
sxt.put("alt", 0);
|
||||
sxtChildrenMap.add(sxt);
|
||||
Map<String, Object> anqm = new HashMap<>();
|
||||
anqm.put("id", 45454455154L);
|
||||
anqm.put("label", "");
|
||||
anqm.put("name", "安全帽");
|
||||
anqm.put("type", "positioningDevice");
|
||||
anqm.put("lat", 23.81488041);
|
||||
anqm.put("lng", 107.12917371);
|
||||
anqm.put("alt", 0);
|
||||
|
||||
anqmChildrenMap.add(anqm);
|
||||
if (voList != null && !voList.isEmpty()) {
|
||||
for (GpsEquipmentSonVo item : voList) {
|
||||
Map<String, Object> gps = new HashMap<>();
|
||||
gps.put("id", item.getClientId());
|
||||
gps.put("userId", item.getUserId());
|
||||
gps.put("label", item.getClientId());
|
||||
gps.put("name", item.getDeviceName());
|
||||
gps.put("type", "positioningDevice");
|
||||
gps.put("type", "gps");
|
||||
gps.put("lat", item.getLocLatitude());
|
||||
gps.put("lng", item.getLocLongitude());
|
||||
gps.put("alt", item.getLocAltitude());
|
||||
@ -511,32 +536,39 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
for (GpsEquipmentSonVo item : appList) {
|
||||
Map<String, Object> app = new HashMap<>();
|
||||
app.put("id", item.getClientId());
|
||||
app.put("userId", item.getUserId());
|
||||
app.put("label", item.getClientId());
|
||||
app.put("name", item.getDeviceName());
|
||||
app.put("type", "positioningDevice");
|
||||
app.put("type", "app");
|
||||
app.put("lat", item.getLocLatitude());
|
||||
app.put("lng", item.getLocLongitude());
|
||||
app.put("alt", item.getLocAltitude());
|
||||
appChildrenMap.add(app);
|
||||
}
|
||||
}
|
||||
if (othYs7DeviceList != null && !othYs7DeviceList.isEmpty()) {
|
||||
for (OthYs7Device item : othYs7DeviceList) {
|
||||
Map<String, Object> sxt = new HashMap<>();
|
||||
sxt.put("id", item.getDeviceSerial());
|
||||
sxt.put("label", item.getDeviceSerial());
|
||||
sxt.put("name", item.getDeviceName());
|
||||
sxt.put("type", "shexiangtou");
|
||||
sxt.put("lat", item.getLatitude());
|
||||
sxt.put("lng", item.getLongitude());
|
||||
sxt.put("alt", item.getAltitude());
|
||||
sxt.put("detail", item.getDetail());
|
||||
sxtChildrenMap1.add(sxt);
|
||||
}
|
||||
}
|
||||
// if (othYs7DeviceList != null && !othYs7DeviceList.isEmpty()) {
|
||||
// for (OthYs7Device item : othYs7DeviceList) {
|
||||
// Map<String, Object> sxt = new HashMap<>();
|
||||
// sxt.put("id", item.getDeviceSerial());
|
||||
// sxt.put("label", item.getDeviceSerial());
|
||||
// sxt.put("name", item.getDeviceName());
|
||||
// sxt.put("type", "shexiangtou");
|
||||
// sxt.put("lat", item.getLatitude());
|
||||
// sxt.put("lng", item.getLongitude());
|
||||
// sxt.put("alt", item.getAltitude());
|
||||
// sxt.put("detail", item.getDetail());
|
||||
// sxtChildrenMap.add(sxt);
|
||||
// }
|
||||
// }
|
||||
if (wrjKeys != null && !wrjKeys.isEmpty()) {
|
||||
for (String key : wrjKeys) {
|
||||
Object object = stringRedisTemplate.opsForValue().get("wrj:" + key);
|
||||
Object object = stringRedisTemplate.opsForValue().get("wrj:osd4:" + key);
|
||||
Object object6 = stringRedisTemplate.opsForValue().get("wrj:osd2:" + key);
|
||||
String status = "";
|
||||
if (object6 != null) {
|
||||
JSONObject object1 = JSONUtil.parseObj(object6);
|
||||
status = object1.getJSONObject("data").get("flighttask_step_code").toString();
|
||||
}
|
||||
if (object != null) {
|
||||
JSONObject object1 = JSONUtil.parseObj(object);
|
||||
Map<String, Object> wrj = new HashMap<>();
|
||||
@ -544,17 +576,32 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
wrj.put("label", key);
|
||||
wrj.put("name", key);
|
||||
wrj.put("type", "wurenji");
|
||||
wrj.put("status", status);
|
||||
wrj.put("lat", object1.getJSONObject("data").get("latitude"));
|
||||
wrj.put("lng", object1.getJSONObject("data").get("longitude"));
|
||||
wrjChildrenMap1.add(wrj);
|
||||
wrj.put("alt", object1.getJSONObject("data").get("height"));
|
||||
wrjChildrenMap.add(wrj);
|
||||
}else {
|
||||
Object object2 = stringRedisTemplate.opsForValue().get("wrj:osd3:" + key);
|
||||
if (object2 != null) {
|
||||
JSONObject object3 = JSONUtil.parseObj(object2);
|
||||
Map<String, Object> wrj = new HashMap<>();
|
||||
wrj.put("id", key);
|
||||
wrj.put("label", key);
|
||||
wrj.put("name", key);
|
||||
wrj.put("type", "wurenji");
|
||||
wrj.put("status", status);
|
||||
wrj.put("lat", object3.getJSONObject("data").get("latitude"));
|
||||
wrj.put("lng", object3.getJSONObject("data").get("longitude"));
|
||||
wrj.put("alt", object3.getJSONObject("data").get("height"));
|
||||
wrjChildrenMap.add(wrj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
gpsChildrenMap.add(sbMap);
|
||||
gpsChildrenMap.add(appMap);
|
||||
gpsChildrenMap.add(anqmMap);
|
||||
sxtChildrenMap.add(sxtMap1);
|
||||
wrjChildrenMap.add(wrjMap1);
|
||||
|
||||
gpsMap.put("id", 1);
|
||||
gpsMap.put("label", "人员定位");
|
||||
@ -571,15 +618,9 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
sxtMap.put("id", 2);
|
||||
sxtMap.put("label", "摄像头");
|
||||
sxtMap.put("children", sxtChildrenMap);
|
||||
sxtMap1.put("id", 7);
|
||||
sxtMap1.put("label", "摄像头");
|
||||
sxtMap1.put("children", sxtChildrenMap1);
|
||||
wrjMap.put("id", 3);
|
||||
wrjMap.put("label", "无人机");
|
||||
wrjMap.put("children", wrjChildrenMap);
|
||||
wrjMap1.put("id", 8);
|
||||
wrjMap1.put("label", "无人机");
|
||||
wrjMap1.put("children", wrjChildrenMap1);
|
||||
|
||||
|
||||
maps.add(gpsMap);
|
||||
@ -587,4 +628,14 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
maps.add(sxtMap);
|
||||
return maps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWrjHc() {
|
||||
RedisUtils.setCacheObject("xmjdap:ws",System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Map<String, Object>> getInfoData(TanchuangInfoReq req) {
|
||||
return projectService.getInfoData(req);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package org.dromara.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MessageUtils;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsyncUtil {
|
||||
|
||||
//发送短信
|
||||
@Async
|
||||
public void sendSms(List<String> mobileList, String config) {
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend(config);
|
||||
for (String mobile : mobileList) {
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(mobile, (String) null);
|
||||
if (!smsResponse.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//发送sse
|
||||
@Async
|
||||
public void sendSse(List<Long> userId, String message) {
|
||||
SseMessageDto sseMessageDto = new SseMessageDto();
|
||||
sseMessageDto.setUserIds(userId);
|
||||
sseMessageDto.setMessage(message);
|
||||
SseMessageUtils.publishMessage(sseMessageDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1510,6 +1510,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
lqw.eq(ObjectUtils.isNotEmpty(typeOfWork), SubConstructionUser::getTypeOfWork, typeOfWork);
|
||||
|
||||
lqw.isNull(SubConstructionUser::getTeamId);
|
||||
lqw.eq(SubConstructionUser::getUserRole, "0");
|
||||
if (req.getProjectId() == null) {
|
||||
lqw.isNull(SubConstructionUser::getProjectId);
|
||||
} else {
|
||||
|
||||
@ -651,13 +651,18 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
|
||||
List<DesVolumeFile> list = volumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
|
||||
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, volumeCatalog.getDesign())
|
||||
.orderByDesc(DesVolumeFile::getVersion)
|
||||
.last("ORDER BY CAST(SUBSTRING(version, 4) AS DECIMAL(10, 2)) DESC")
|
||||
);
|
||||
String version = "1.0";
|
||||
String version = "LT-1.0";
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
String lastVersion = list.getFirst().getVersion();
|
||||
int majorVersion = (int) Math.floor(Double.parseDouble(lastVersion)) + 1;
|
||||
version = majorVersion + ".0";
|
||||
// 提取版本号数字部分(去除LT-前缀)
|
||||
String versionNumber = lastVersion;
|
||||
if (lastVersion.startsWith("LT-")) {
|
||||
versionNumber = lastVersion.substring(3); // 去除"LT-"前缀
|
||||
}
|
||||
int majorVersion = (int) Math.floor(Double.parseDouble(versionNumber)) + 1;
|
||||
version = "LT-" + majorVersion + ".0";
|
||||
}
|
||||
|
||||
for (SysOssVo ossVo : ossVoList1) {
|
||||
|
||||
@ -24,6 +24,7 @@ import org.dromara.common.sse.config.SseProperties;
|
||||
import org.dromara.common.sse.dto.SeeMessageContentDto;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.common.utils.AsyncUtil;
|
||||
import org.dromara.design.domain.DesVolumeCatalog;
|
||||
import org.dromara.design.domain.DesVolumeFile;
|
||||
import org.dromara.design.domain.bo.DesVolumeFileBo;
|
||||
@ -39,8 +40,11 @@ import org.dromara.design.service.IDesVolumeCatalogService;
|
||||
import org.dromara.design.service.IDesVolumeFileService;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysRoleService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.event.EventListener;
|
||||
@ -82,6 +86,16 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
@Resource
|
||||
private SseProperties sseProperties;
|
||||
|
||||
@Resource
|
||||
private AsyncUtil asyncUtil;
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
@Resource
|
||||
private ISysRoleService roleService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询卷册文件列表
|
||||
*
|
||||
@ -262,15 +276,15 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
|
||||
private void validUpload(DesVolumeFileCreateReq req) {
|
||||
// 蓝图文件
|
||||
if (CollectionUtil.isNotEmpty(req.getFileIds())) {
|
||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
||||
.orderByDesc(DesVolumeFile::getVersion));
|
||||
if (!existingFiles.isEmpty()) {
|
||||
throw new ServiceException("蓝图已上传");
|
||||
}
|
||||
}
|
||||
// if (CollectionUtil.isNotEmpty(req.getFileIds())) {
|
||||
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
// .eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
||||
// .orderByDesc(DesVolumeFile::getVersion));
|
||||
// if (!existingFiles.isEmpty()) {
|
||||
// throw new ServiceException("蓝图已上传");
|
||||
// }
|
||||
// }
|
||||
// 过程文件
|
||||
// if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
|
||||
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
@ -288,17 +302,21 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理文件上传
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @param fileIds 文件ID列表
|
||||
* @param type 文件类型
|
||||
* @param desVolumeFiles 文件集合
|
||||
*/
|
||||
// private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
||||
// // 用于记录同一批次中已处理的文件名及对应的版本号
|
||||
// Map<String, String> batchFileVersionMap = new HashMap<>();
|
||||
// // 用于记录同一批次中的索引
|
||||
// int fileIndex = 0;
|
||||
//
|
||||
// // 先找出数据库中已存在的最高版本号
|
||||
// List<DesVolumeFile> existingFilesInDB = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .eq(DesVolumeFile.PROCESS.equals(type), DesVolumeFile::getType, type)
|
||||
// .in(DesVolumeFile.BLUEPRINT.equals(type), DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
// .last("ORDER BY CAST(SUBSTRING(version_str, 4) AS DECIMAL(10, 2)) DESC"));
|
||||
//
|
||||
// double maxBatchVersion = 0.0;
|
||||
// if (CollectionUtil.isNotEmpty(existingFilesInDB)) {
|
||||
// maxBatchVersion = Double.parseDouble(existingFilesInDB.getFirst().getVersion());
|
||||
// }
|
||||
//
|
||||
// for (Long fileId : fileIds) {
|
||||
// SysOssVo ossVo = ossService.getById(fileId);
|
||||
@ -312,95 +330,60 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
//
|
||||
// String fileName = ossVo.getOriginalName();
|
||||
//
|
||||
// // 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
|
||||
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .eq(DesVolumeFile.PROCESS.equals(type),DesVolumeFile::getType, type)
|
||||
// .in(DesVolumeFile.BLUEPRINT.equals(type),DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||
//// .eq(DesVolumeFile::getFileName, fileName)
|
||||
// .orderByDesc(DesVolumeFile::getVersion));
|
||||
//
|
||||
// String versionStr = "1.0"; // 默认版本号
|
||||
//
|
||||
// if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||
// // 蓝图文件:1.0, 2.0, 3.0...
|
||||
// if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||
// String lastVersion = existingFiles.getFirst().getVersion();
|
||||
// int majorVersion = (int) Math.floor(Double.parseDouble(lastVersion)) + 1;
|
||||
// versionStr = majorVersion + ".0";
|
||||
// }
|
||||
// // 每个文件递增主版本号
|
||||
// int majorVersion = (int) maxBatchVersion + fileIndex + 1;
|
||||
// versionStr = majorVersion + ".0";
|
||||
// } else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||
// // 过程图纸:基于蓝图版本号,如蓝图是1.0,则过程图为1.1, 1.2...1.9, 1.10
|
||||
// // 先查找对应的蓝图文件最新版本
|
||||
// // 过程图纸:基于蓝图版本号
|
||||
// List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE)) // 蓝图类型
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||
//// .eq(DesVolumeFile::getFileName, fileName)
|
||||
// .in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
// .orderByDesc(DesVolumeFile::getVersion));
|
||||
//
|
||||
// String blueprintVersion = "0.0"; // 默认蓝图版本
|
||||
// String blueprintVersion = "0.0";
|
||||
// if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||
// blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||
// }
|
||||
//
|
||||
// // 解析蓝图版本号
|
||||
// String[] blueprintParts = blueprintVersion.split("\\.");
|
||||
// int blueprintMajor = Integer.parseInt(blueprintParts[0]);
|
||||
//
|
||||
// if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||
// // 已存在过程图纸,需要递增次版本号
|
||||
// String lastVersion = existingFiles.getFirst().getVersion();
|
||||
// String[] parts = lastVersion.split("\\.");
|
||||
// int major = Integer.parseInt(parts[0]);
|
||||
// int minor = Integer.parseInt(parts[1]);
|
||||
// // 对于过程图纸,需要基于数据库中已存在的最高版本号来计算
|
||||
// if (CollectionUtil.isNotEmpty(existingFilesInDB) && existingFilesInDB.getFirst().getType().equals(DesVolumeFile.PROCESS)) {
|
||||
// // 如果数据库中已存在过程图纸,则基于最高版本号递增
|
||||
// String lastProcessVersion = existingFilesInDB.getFirst().getVersion();
|
||||
// String[] lastParts = lastProcessVersion.split("\\.");
|
||||
// int lastMajor = Integer.parseInt(lastParts[0]);
|
||||
// int lastMinor = Integer.parseInt(lastParts[1]);
|
||||
//
|
||||
// if (major == blueprintMajor) {
|
||||
// // 同一主版本,次版本号递增
|
||||
// minor++;
|
||||
// versionStr = major + "." + minor;
|
||||
// // 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从1开始
|
||||
// if (lastMajor == blueprintMajor) {
|
||||
// int minorVersion = lastMinor + fileIndex + 1;
|
||||
// versionStr = lastMajor + "." + minorVersion;
|
||||
// } else {
|
||||
// // 不同主版本,使用蓝图的主版本并从1开始
|
||||
// versionStr = blueprintMajor + ".1";
|
||||
// int minorVersion = fileIndex + 1;
|
||||
// versionStr = blueprintMajor + "." + minorVersion;
|
||||
// }
|
||||
// } else {
|
||||
// // 不存在过程图纸,从蓝图版本的.1开始
|
||||
// versionStr = blueprintMajor + ".1";
|
||||
// // 数据库中没有过程图纸,从蓝图版本的.1开始
|
||||
// int minorVersion = fileIndex + 1;
|
||||
// versionStr = blueprintMajor + "." + minorVersion;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 检查同一批次中是否已存在同名文件
|
||||
// if (batchFileVersionMap.containsKey(fileName)) {
|
||||
// String lastBatchVersion = String.valueOf(batchFileVersionMap.get(fileName));
|
||||
// if ( DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||
// // 蓝图文件批次处理
|
||||
// int lastMajor = (int) Math.floor(Double.parseDouble(lastBatchVersion));
|
||||
// versionStr = (lastMajor + 1) + ".0";
|
||||
// } else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||
// // 过程图纸批次处理
|
||||
// String[] currentParts = versionStr.split("\\.");
|
||||
// String[] batchParts = lastBatchVersion.split("\\.");
|
||||
//
|
||||
// int currentMajor = Integer.parseInt(currentParts[0]);
|
||||
// int currentMinor = Integer.parseInt(currentParts[1]);
|
||||
// int batchMajor = Integer.parseInt(batchParts[0]);
|
||||
// int batchMinor = Integer.parseInt(batchParts[1]);
|
||||
//
|
||||
// if (currentMajor == batchMajor) {
|
||||
// // 同一主版本,取较大的次版本号+1
|
||||
// int newMinor = Math.max(currentMinor, batchMinor) + 1;
|
||||
// versionStr = currentMajor + "." + newMinor;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 更新批次文件版本映射(存储为字符串形式)
|
||||
// batchFileVersionMap.put(fileName, versionStr);
|
||||
//
|
||||
// file.setVersion(versionStr);
|
||||
// file.setFileName(fileName);
|
||||
// desVolumeFiles.add(file);
|
||||
//
|
||||
// fileIndex++;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
||||
// 用于记录同一批次中的索引
|
||||
int fileIndex = 0;
|
||||
@ -410,13 +393,18 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
.eq(DesVolumeFile.PROCESS.equals(type), DesVolumeFile::getType, type)
|
||||
.in(DesVolumeFile.BLUEPRINT.equals(type), DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
.orderByDesc(DesVolumeFile::getVersion));
|
||||
.last("ORDER BY CAST(SUBSTRING(version, 4) AS DECIMAL(10, 2)) DESC"));
|
||||
|
||||
double maxBatchVersion = 0.0;
|
||||
String maxBatchVersion = "0.0";
|
||||
if (CollectionUtil.isNotEmpty(existingFilesInDB)) {
|
||||
maxBatchVersion = Double.parseDouble(existingFilesInDB.getFirst().getVersion());
|
||||
String version = existingFilesInDB.getFirst().getVersion();
|
||||
// 提取版本号数字部分(去除前缀)
|
||||
if (version.contains("-")) {
|
||||
maxBatchVersion = version.substring(version.indexOf("-") + 1);
|
||||
} else {
|
||||
maxBatchVersion = version;
|
||||
}
|
||||
}
|
||||
|
||||
for (Long fileId : fileIds) {
|
||||
SysOssVo ossVo = ossService.getById(fileId);
|
||||
if (ossVo == null) {
|
||||
@ -432,20 +420,34 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
String versionStr = "1.0"; // 默认版本号
|
||||
|
||||
if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||
// 蓝图文件:1.0, 2.0, 3.0...
|
||||
// 每个文件递增主版本号
|
||||
int majorVersion = (int) maxBatchVersion + fileIndex + 1;
|
||||
versionStr = majorVersion + ".0";
|
||||
// 蓝图文件:LT-1.0, LT-1.1, LT-1.2...
|
||||
double maxVersion = Double.parseDouble(maxBatchVersion);
|
||||
int majorVersion = (int) Math.floor(maxVersion);
|
||||
int minorVersion = (int) ((maxVersion - majorVersion) * 10) + fileIndex + 1;
|
||||
|
||||
// 如果是第一个文件且没有历史版本,则从1.0开始
|
||||
if (fileIndex == 0 && CollectionUtil.isEmpty(existingFilesInDB)) {
|
||||
versionStr = "1.0";
|
||||
} else {
|
||||
versionStr = majorVersion + "." + minorVersion;
|
||||
}
|
||||
versionStr = "LT-" + versionStr;
|
||||
} else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||
// 过程图纸:基于蓝图版本号
|
||||
List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
.orderByDesc(DesVolumeFile::getVersion));
|
||||
.last("ORDER BY CAST(SUBSTRING(version, 4) AS DECIMAL(10, 2)) DESC"));
|
||||
|
||||
String blueprintVersion = "0.0";
|
||||
String blueprintVersion = "1.0";
|
||||
if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||
blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||
String version = blueprintFiles.getFirst().getVersion();
|
||||
// 提取蓝图版本号数字部分
|
||||
if (version.contains("-")) {
|
||||
blueprintVersion = version.substring(version.indexOf("-") + 1);
|
||||
} else {
|
||||
blueprintVersion = version;
|
||||
}
|
||||
}
|
||||
|
||||
String[] blueprintParts = blueprintVersion.split("\\.");
|
||||
@ -455,25 +457,32 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
if (CollectionUtil.isNotEmpty(existingFilesInDB) && existingFilesInDB.getFirst().getType().equals(DesVolumeFile.PROCESS)) {
|
||||
// 如果数据库中已存在过程图纸,则基于最高版本号递增
|
||||
String lastProcessVersion = existingFilesInDB.getFirst().getVersion();
|
||||
String[] lastParts = lastProcessVersion.split("\\.");
|
||||
String versionNumber = lastProcessVersion;
|
||||
if (lastProcessVersion.contains("-")) {
|
||||
versionNumber = lastProcessVersion.substring(lastProcessVersion.indexOf("-") + 1);
|
||||
}
|
||||
|
||||
String[] lastParts = versionNumber.split("\\.");
|
||||
int lastMajor = Integer.parseInt(lastParts[0]);
|
||||
int lastMinor = Integer.parseInt(lastParts[1]);
|
||||
|
||||
// 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从1开始
|
||||
// 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从0开始
|
||||
if (lastMajor == blueprintMajor) {
|
||||
int minorVersion = lastMinor + fileIndex + 1;
|
||||
versionStr = lastMajor + "." + minorVersion;
|
||||
} else {
|
||||
int minorVersion = fileIndex + 1;
|
||||
int minorVersion = fileIndex;
|
||||
versionStr = blueprintMajor + "." + minorVersion;
|
||||
}
|
||||
} else {
|
||||
// 数据库中没有过程图纸,从蓝图版本的.1开始
|
||||
int minorVersion = fileIndex + 1;
|
||||
// 数据库中没有过程图纸,从蓝图版本的.0开始
|
||||
int minorVersion = fileIndex;
|
||||
versionStr = blueprintMajor + "." + minorVersion;
|
||||
}
|
||||
versionStr = "GC-" + versionStr;
|
||||
}
|
||||
|
||||
|
||||
file.setVersion(versionStr);
|
||||
file.setFileName(fileName);
|
||||
desVolumeFiles.add(file);
|
||||
@ -492,9 +501,9 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteByIds(Collection<Long> ids) {
|
||||
try {
|
||||
ossService.deleteWithValidByIds(ids,false);
|
||||
}catch (Exception e){
|
||||
log.error("删除卷册文件存储失败",e);
|
||||
ossService.deleteWithValidByIds(ids, false);
|
||||
} catch (Exception e) {
|
||||
log.error("删除卷册文件存储失败", e);
|
||||
}
|
||||
|
||||
return this.removeBatchByIds(ids);
|
||||
@ -565,7 +574,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
public AuditFileVo auditFile(AuditFileDto dto) {
|
||||
List<Long> volumeCatalogIds = dto.getVolumeCatalogIds();
|
||||
List<DesVolumeFileVo> desVolumeFileVos = baseMapper.selectVoList(Wrappers.lambdaQuery(DesVolumeFile.class)
|
||||
.in(CollectionUtil.isNotEmpty(volumeCatalogIds),DesVolumeFile::getVolumeCatalogId, volumeCatalogIds)
|
||||
.in(CollectionUtil.isNotEmpty(volumeCatalogIds), DesVolumeFile::getVolumeCatalogId, volumeCatalogIds)
|
||||
.eq(DesVolumeFile::getAuditStatus, "draft")
|
||||
);
|
||||
List<DesVolumeFileVo> list1 = desVolumeFileVos.stream().filter(vo -> "1".equals(vo.getType())).toList();
|
||||
@ -609,6 +618,15 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
|
||||
return null;
|
||||
});
|
||||
|
||||
//异步发送消息 项目经理 设计部主任(1961028169115197442)
|
||||
DesVolumeCatalog byId = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId());
|
||||
List<Long> longs = roleService.selectRoleIdsByName("项目经理");
|
||||
longs.add(1961028169115197442L);
|
||||
|
||||
List<SysUser> sysUsers = userService.selectUserByRoleIdsAndProjectId(longs, byId.getProjectId());
|
||||
asyncUtil.sendSms(sysUsers.stream().map(SysUser::getPhonenumber).toList(), "config5");
|
||||
asyncUtil.sendSse(sysUsers.stream().map(SysUser::getUserId).toList(), "有新的蓝图审批完成");
|
||||
}
|
||||
|
||||
}
|
||||
@ -672,6 +690,14 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
|
||||
return null;
|
||||
});
|
||||
//异步发送消息 项目经理 设计部主任(1961028169115197442)
|
||||
DesVolumeCatalog byId = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId());
|
||||
List<Long> longs = roleService.selectRoleIdsByName("项目经理");
|
||||
longs.add(1961028169115197442L);
|
||||
|
||||
List<SysUser> sysUsers = userService.selectUserByRoleIdsAndProjectId(longs, byId.getProjectId());
|
||||
asyncUtil.sendSms(sysUsers.stream().map(SysUser::getPhonenumber).toList(), "config5");
|
||||
asyncUtil.sendSse(sysUsers.stream().map(SysUser::getUserId).toList(), "有新的蓝图审批完成");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,166 @@
|
||||
package org.dromara.gps.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.domain.dto.constructionuser.SubConstructionUserQueryReq;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.gps.domain.bo.GpsEquipmentBo;
|
||||
import org.dromara.gps.domain.vo.ConstructionUser;
|
||||
import org.dromara.gps.domain.vo.GpsProjectVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.bo.DeviceBo;
|
||||
import org.dromara.gps.service.IDeviceService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 安全帽设备
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/gps/device")
|
||||
public class DeviceController extends BaseController {
|
||||
|
||||
private final IDeviceService deviceService;
|
||||
|
||||
private final ISubConstructionUserService constructionUserService;
|
||||
|
||||
/**
|
||||
* 查询安全帽设备列表
|
||||
*/
|
||||
@SaCheckPermission("gps:device:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<DeviceVo> list(DeviceBo bo, PageQuery pageQuery) {
|
||||
return deviceService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出安全帽设备列表
|
||||
*/
|
||||
@SaCheckPermission("gps:device:export")
|
||||
@Log(title = "安全帽设备", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(DeviceBo bo, HttpServletResponse response) {
|
||||
List<DeviceVo> list = deviceService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "安全帽设备", DeviceVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取安全帽设备详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("gps:device:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<DeviceVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(deviceService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全帽设备
|
||||
*/
|
||||
@SaCheckPermission("gps:device:add")
|
||||
@Log(title = "安全帽设备", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceBo bo) {
|
||||
return toAjax(deviceService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改安全帽设备
|
||||
*/
|
||||
@SaCheckPermission("gps:device:edit")
|
||||
@Log(title = "安全帽设备", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceBo bo) {
|
||||
return toAjax(deviceService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除安全帽设备
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("gps:device:remove")
|
||||
@Log(title = "安全帽设备", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(deviceService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 项目列表
|
||||
*/
|
||||
@SaCheckPermission("gps:device:getProjectList")
|
||||
@GetMapping("/getProjectList")
|
||||
public R<List<GpsProjectVo>> getProjectList() {
|
||||
return R.ok(deviceService.getProjectList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询施工人员列表
|
||||
*/
|
||||
@SaCheckPermission("gps:device:userList")
|
||||
@GetMapping("/userList")
|
||||
public R<List<ConstructionUser>> list(SubConstructionUserQueryReq req) {
|
||||
List<SubConstructionUser> list = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
.eq(SubConstructionUser::getProjectId, req.getProjectId())
|
||||
);
|
||||
return R.ok(BeanUtil.copyToList(list,ConstructionUser.class ));
|
||||
}
|
||||
|
||||
/**
|
||||
* GPS人机关联绑定
|
||||
*/
|
||||
@SaCheckPermission("gps:device:bindManmachine")
|
||||
@Log(title = "GPS设备详细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/bindManmachine")
|
||||
public R<Void> bindManmachine(@RequestBody DeviceBo bo) {
|
||||
if (bo.getDevNum() == null) {
|
||||
throw new ServiceException("设备id不能为空!!!");
|
||||
}
|
||||
return toAjax(deviceService.bindManmachine(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* GPS人机关联解绑
|
||||
*/
|
||||
@SaCheckPermission("gps:device:unbindManmachine")
|
||||
@Log(title = "GPS设备详细", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping("/unbindManmachine")
|
||||
public R<Void> unbindManmachine(@RequestBody DeviceBo bo) {
|
||||
if (bo.getDevNum() == null) {
|
||||
throw new ServiceException("设备id不能为空!!!");
|
||||
}
|
||||
return toAjax(deviceService.unbindManmachine(bo));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package org.dromara.gps.controller;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
import static org.dromara.gps.utils.AuthUtil.*;
|
||||
import static org.dromara.gps.utils.JsonUtil.*;
|
||||
|
||||
@Tag(name = "安全帽管理")
|
||||
@RestController
|
||||
@RequestMapping("/hat")
|
||||
public class HatController {
|
||||
@Operation(summary = "服务下发定位(把线上接口给服务商)")
|
||||
@PostMapping(value = "/device/data")
|
||||
public ResponseEntity<?> data(@RequestBody String body, @RequestHeader("timestamp") String timestamp, @RequestHeader("signature") String signature) {
|
||||
// 验证签名的有效性
|
||||
if (!verifySignature(body + timestamp, signature, SECRET)) {
|
||||
return ResponseEntity.badRequest().body("验证签名失败");
|
||||
}
|
||||
System.out.println("接收到三方服务发送的数据:" + body);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@Operation(summary = "刷新设备定位")
|
||||
@PostMapping("/refresh")
|
||||
public String refresh(@RequestParam @Parameter(description = "设备号") String data) throws NoSuchAlgorithmException, IOException {
|
||||
long timestamp = System.currentTimeMillis() / 1000;
|
||||
// 准备生成签名的参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("appid", APPID);
|
||||
params.put("data", data);
|
||||
params.put("secret", SECRET);
|
||||
params.put("timestamp", String.valueOf(timestamp));
|
||||
// 生成签名
|
||||
String sign = generateSignature(params);
|
||||
// 构造请求体
|
||||
Map<String, Object> payload = new HashMap<>();
|
||||
payload.put("appid", APPID);
|
||||
payload.put("data", data);
|
||||
payload.put("secret", SECRET);
|
||||
payload.put("timestamp", timestamp);
|
||||
payload.put("sign", sign);
|
||||
// 使用Jackson转换为JSON
|
||||
String jsonPayload;
|
||||
try {
|
||||
jsonPayload = objectMapper.writeValueAsString(payload);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException("JSON序列化失败", e);
|
||||
}
|
||||
// 发送POST请求
|
||||
URL url = new URL("https://www.loctp.com/api/crm/v1/refresh/location");
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
connection.setDoOutput(true);
|
||||
|
||||
try (OutputStream os = connection.getOutputStream()) {
|
||||
byte[] input = jsonPayload.getBytes(StandardCharsets.UTF_8);
|
||||
os.write(input, 0, input.length);
|
||||
}
|
||||
// 读取响应内容
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
|
||||
StringBuilder response = new StringBuilder();
|
||||
String responseLine;
|
||||
while ((responseLine = br.readLine()) != null) {
|
||||
response.append(responseLine.trim());
|
||||
}
|
||||
return response.toString();
|
||||
} finally {
|
||||
connection.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package org.dromara.gps.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.gps.domain.bo.GpsEquipmentSonBo;
|
||||
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.gps.domain.vo.LocationVo;
|
||||
import org.dromara.gps.domain.bo.LocationBo;
|
||||
import org.dromara.gps.service.ILocationService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/gps/location")
|
||||
public class LocationController extends BaseController {
|
||||
|
||||
private final ILocationService locationService;
|
||||
|
||||
/**
|
||||
* 查询安全帽经纬度数据列表
|
||||
*/
|
||||
@SaCheckPermission("gps:location:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<LocationVo> list(LocationBo bo, PageQuery pageQuery) {
|
||||
return locationService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出安全帽经纬度数据列表
|
||||
*/
|
||||
@SaCheckPermission("gps:location:export")
|
||||
@Log(title = "安全帽经纬度数据", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(LocationBo bo, HttpServletResponse response) {
|
||||
List<LocationVo> list = locationService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "安全帽经纬度数据", LocationVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取安全帽经纬度数据详细信息
|
||||
*
|
||||
* @param devNum 主键
|
||||
*/
|
||||
@SaCheckPermission("gps:location:query")
|
||||
@GetMapping("/{devNum}")
|
||||
public R<LocationVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable String devNum) {
|
||||
return R.ok(locationService.queryById(devNum));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全帽经纬度数据
|
||||
*/
|
||||
@SaCheckPermission("gps:location:add")
|
||||
@Log(title = "安全帽经纬度数据", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody LocationBo bo) {
|
||||
return toAjax(locationService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改安全帽经纬度数据
|
||||
*/
|
||||
@SaCheckPermission("gps:location:edit")
|
||||
@Log(title = "安全帽经纬度数据", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody LocationBo bo) {
|
||||
return toAjax(locationService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除安全帽经纬度数据
|
||||
*
|
||||
* @param devNums 主键串
|
||||
*/
|
||||
@SaCheckPermission("gps:location:remove")
|
||||
@Log(title = "安全帽经纬度数据", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{devNums}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable String[] devNums) {
|
||||
return toAjax(locationService.deleteWithValidByIds(List.of(devNums), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询GPS设备定位信息列表
|
||||
*/
|
||||
@SaCheckPermission("gps:equipmentSon:getList")
|
||||
@GetMapping("/getList")
|
||||
public R<List<LocationVo>> getList(LocationBo bo) {
|
||||
return R.ok(locationService.queryList(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询GPS设备定位信息列表(大屏获取人员最后一次位置)
|
||||
*/
|
||||
// @SaCheckPermission("gps:equipmentSon:getList")
|
||||
@GetMapping("/largerScreen/getList")
|
||||
public R<List<LocationVo>> getLargerScreenList(LocationBo bo) {
|
||||
return R.ok(locationService.getLargerScreenList(bo));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询GPS设备定位信息列表
|
||||
*/
|
||||
// @SaCheckPermission("gps:equipmentSon:appGetList")
|
||||
// @GetMapping("/app/getList")
|
||||
// public R<Map<String,Object>> getAppList(GpsEquipmentSonBo bo) {
|
||||
// if (bo.getUserId() == null) {
|
||||
// throw new ServiceException("用户id不能为空!!!");
|
||||
// }
|
||||
// if (bo.getProjectId() == null) {
|
||||
// throw new ServiceException("项目id不能为空!!!");
|
||||
// }
|
||||
// if (bo.getStartTime() == null ) {
|
||||
// throw new ServiceException("开始时间不能为空!!!");
|
||||
// }
|
||||
// if (bo.getEndTime() == null) {
|
||||
// throw new ServiceException("结束时间不能为空!!!");
|
||||
// }
|
||||
// if (bo.getStartTime().isAfter(bo.getEndTime())) {
|
||||
// throw new ServiceException("结束时间不能在开始时间之前!!!");
|
||||
// }
|
||||
// return R.ok(locationService.getAppList(bo));
|
||||
// }
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package org.dromara.gps.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* GPS人机关联对象 gps_manmachine
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-28
|
||||
*/
|
||||
@Data
|
||||
@TableName("anqm_manmachine")
|
||||
public class AnqmManmachine implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "client_id")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package org.dromara.gps.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 安全帽设备对象 device
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("device")
|
||||
public class Device extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String devNum;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
|
||||
/**
|
||||
* 设备采集温度
|
||||
*/
|
||||
private Long temperature;
|
||||
|
||||
/**
|
||||
* 设备采集湿度
|
||||
*/
|
||||
private Long humidity;
|
||||
|
||||
/**
|
||||
* 姿势 1正常 -1脱帽 -2倒地
|
||||
*/
|
||||
private Long posture;
|
||||
|
||||
/**
|
||||
* 电池温度
|
||||
*/
|
||||
private Long batteryTemp;
|
||||
|
||||
/**
|
||||
* 定位方
|
||||
*/
|
||||
private String fixedBy;
|
||||
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Long batteryLevel;
|
||||
|
||||
/**
|
||||
* 是否处于低电量,1代表低电量,0则不是低电量
|
||||
*/
|
||||
private Long isLowBattery;
|
||||
|
||||
/**
|
||||
* 电池开机时间
|
||||
*/
|
||||
private String batteryOn;
|
||||
|
||||
/**
|
||||
* 电池关机时间
|
||||
*/
|
||||
private String batteryOff;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package org.dromara.gps.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据对象 location
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("location")
|
||||
public class Location extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String devNum;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 告警信息
|
||||
*/
|
||||
private Long alarm;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private Long latitude;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private Long longitude;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private Long elevation;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
private Long speed;
|
||||
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
private Long direction;
|
||||
|
||||
/**
|
||||
* 里程数
|
||||
*/
|
||||
private Long mileage;
|
||||
|
||||
/**
|
||||
* ACC开关
|
||||
*/
|
||||
private Long accEnable;
|
||||
|
||||
/**
|
||||
* 定位开关
|
||||
*/
|
||||
private Long locateEnable;
|
||||
|
||||
/**
|
||||
* 纬度类型(0:北纬,1:南纬)
|
||||
*/
|
||||
private Long latitudeType;
|
||||
|
||||
/**
|
||||
* 经度类型(0:东经,1:西经)
|
||||
*/
|
||||
private Long longitudeType;
|
||||
|
||||
/**
|
||||
* 超速报警
|
||||
*/
|
||||
private Long speedingWarn;
|
||||
|
||||
/**
|
||||
* 电压告警
|
||||
*/
|
||||
private Long powerVoltageWarn;
|
||||
|
||||
/**
|
||||
* 电源掉电
|
||||
*/
|
||||
private Long powerFailure;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package org.dromara.gps.domain.bo;
|
||||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
|
||||
/**
|
||||
* GPS人机关联业务对象 gps_manmachine
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = AnqmManmachine.class, reverseConvertGenerate = false)
|
||||
public class AnqmManmachineBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@NotBlank(message = "不能为空", groups = { EditGroup.class })
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package org.dromara.gps.domain.bo;
|
||||
|
||||
import org.dromara.gps.domain.Device;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 安全帽设备业务对象 device
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = Device.class, reverseConvertGenerate = false)
|
||||
public class DeviceBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@NotBlank(message = "设备编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String devNum;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备采集温度
|
||||
*/
|
||||
private Long temperature;
|
||||
|
||||
/**
|
||||
* 设备采集湿度
|
||||
*/
|
||||
private Long humidity;
|
||||
|
||||
/**
|
||||
* 姿势 1正常 -1脱帽 -2倒地
|
||||
*/
|
||||
private Long posture;
|
||||
|
||||
/**
|
||||
* 电池温度
|
||||
*/
|
||||
private Long batteryTemp;
|
||||
|
||||
/**
|
||||
* 定位方
|
||||
*/
|
||||
private String fixedBy;
|
||||
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
private Long batteryLevel;
|
||||
|
||||
/**
|
||||
* 是否处于低电量,1代表低电量,0则不是低电量
|
||||
*/
|
||||
private Long isLowBattery;
|
||||
|
||||
/**
|
||||
* 电池开机时间
|
||||
*/
|
||||
private String batteryOn;
|
||||
|
||||
/**
|
||||
* 电池关机时间
|
||||
*/
|
||||
private String batteryOff;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,138 @@
|
||||
package org.dromara.gps.domain.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import org.dromara.gps.domain.Location;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据业务对象 location
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = Location.class, reverseConvertGenerate = false)
|
||||
public class LocationBo extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@NotBlank(message = "设备编号不能为空", groups = { EditGroup.class })
|
||||
private String devNum;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@NotBlank(message = "时间不能为空", groups = { EditGroup.class })
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 告警信息
|
||||
*/
|
||||
private Long alarm;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private Long latitude;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private Long longitude;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
private Long elevation;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
private Long speed;
|
||||
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
private Long direction;
|
||||
|
||||
/**
|
||||
* 里程数
|
||||
*/
|
||||
private Long mileage;
|
||||
|
||||
/**
|
||||
* ACC开关
|
||||
*/
|
||||
private Long accEnable;
|
||||
|
||||
/**
|
||||
* 定位开关
|
||||
*/
|
||||
private Long locateEnable;
|
||||
|
||||
/**
|
||||
* 纬度类型(0:北纬,1:南纬)
|
||||
*/
|
||||
private Long latitudeType;
|
||||
|
||||
/**
|
||||
* 经度类型(0:东经,1:西经)
|
||||
*/
|
||||
private Long longitudeType;
|
||||
|
||||
/**
|
||||
* 超速报警
|
||||
*/
|
||||
private Long speedingWarn;
|
||||
|
||||
/**
|
||||
* 电压告警
|
||||
*/
|
||||
private Long powerVoltageWarn;
|
||||
|
||||
/**
|
||||
* 电源掉电
|
||||
*/
|
||||
private Long powerFailure;
|
||||
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private LocalDateTime startTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private LocalDateTime endTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package org.dromara.gps.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* GPS人机关联视图对象 gps_manmachine
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-28
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = AnqmManmachine.class)
|
||||
public class AnqmManmachineVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private String clientId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ExcelProperty(value = "")
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package org.dromara.gps.domain.vo;
|
||||
|
||||
import org.dromara.gps.domain.Device;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 安全帽设备视图对象 device
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = Device.class)
|
||||
public class DeviceVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ExcelProperty(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelProperty(value = "设备编号")
|
||||
private String devNum;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String devName;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ExcelProperty(value = "状态")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
@ExcelProperty(value = "项目id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备采集温度
|
||||
*/
|
||||
@ExcelProperty(value = "设备采集温度")
|
||||
private Long temperature;
|
||||
|
||||
/**
|
||||
* 设备采集湿度
|
||||
*/
|
||||
@ExcelProperty(value = "设备采集湿度")
|
||||
private Long humidity;
|
||||
|
||||
/**
|
||||
* 姿势 1正常 -1脱帽 -2倒地
|
||||
*/
|
||||
@ExcelProperty(value = "姿势 1正常 -1脱帽 -2倒地")
|
||||
private Long posture;
|
||||
|
||||
/**
|
||||
* 电池温度
|
||||
*/
|
||||
@ExcelProperty(value = "电池温度")
|
||||
private Long batteryTemp;
|
||||
|
||||
/**
|
||||
* 定位方
|
||||
*/
|
||||
@ExcelProperty(value = "定位方")
|
||||
private String fixedBy;
|
||||
|
||||
/**
|
||||
* 电量
|
||||
*/
|
||||
@ExcelProperty(value = "电量")
|
||||
private Long batteryLevel;
|
||||
|
||||
/**
|
||||
* 是否处于低电量,1代表低电量,0则不是低电量
|
||||
*/
|
||||
@ExcelProperty(value = "是否处于低电量,1代表低电量,0则不是低电量")
|
||||
private Long isLowBattery;
|
||||
|
||||
/**
|
||||
* 电池开机时间
|
||||
*/
|
||||
@ExcelProperty(value = "电池开机时间")
|
||||
private String batteryOn;
|
||||
|
||||
/**
|
||||
* 电池关机时间
|
||||
*/
|
||||
@ExcelProperty(value = "电池关机时间")
|
||||
private String batteryOff;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,154 @@
|
||||
package org.dromara.gps.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import org.dromara.gps.domain.Location;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据视图对象 location
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = Location.class)
|
||||
public class LocationVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
@ExcelProperty(value = "设备编号")
|
||||
private String devNum;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 时间
|
||||
*/
|
||||
@ExcelProperty(value = "时间")
|
||||
private String time;
|
||||
|
||||
/**
|
||||
* 告警信息
|
||||
*/
|
||||
@ExcelProperty(value = "告警信息")
|
||||
private Long alarm;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ExcelProperty(value = "状态")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@ExcelProperty(value = "纬度")
|
||||
private Long latitude;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@ExcelProperty(value = "经度")
|
||||
private Long longitude;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
@ExcelProperty(value = "海拔")
|
||||
private Long elevation;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
@ExcelProperty(value = "速度")
|
||||
private Long speed;
|
||||
|
||||
/**
|
||||
* 方向
|
||||
*/
|
||||
@ExcelProperty(value = "方向")
|
||||
private Long direction;
|
||||
|
||||
/**
|
||||
* 里程数
|
||||
*/
|
||||
@ExcelProperty(value = "里程数")
|
||||
private Long mileage;
|
||||
|
||||
/**
|
||||
* ACC开关
|
||||
*/
|
||||
@ExcelProperty(value = "ACC开关")
|
||||
private Long accEnable;
|
||||
|
||||
/**
|
||||
* 定位开关
|
||||
*/
|
||||
@ExcelProperty(value = "定位开关")
|
||||
private Long locateEnable;
|
||||
|
||||
/**
|
||||
* 纬度类型(0:北纬,1:南纬)
|
||||
*/
|
||||
@ExcelProperty(value = "纬度类型(0:北纬,1:南纬)")
|
||||
private Long latitudeType;
|
||||
|
||||
/**
|
||||
* 经度类型(0:东经,1:西经)
|
||||
*/
|
||||
@ExcelProperty(value = "经度类型(0:东经,1:西经)")
|
||||
private Long longitudeType;
|
||||
|
||||
/**
|
||||
* 超速报警
|
||||
*/
|
||||
@ExcelProperty(value = "超速报警")
|
||||
private Long speedingWarn;
|
||||
|
||||
/**
|
||||
* 电压告警
|
||||
*/
|
||||
@ExcelProperty(value = "电压告警")
|
||||
private Long powerVoltageWarn;
|
||||
|
||||
/**
|
||||
* 电源掉电
|
||||
*/
|
||||
@ExcelProperty(value = "电源掉电")
|
||||
private Long powerFailure;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package org.dromara.gps.mapper;
|
||||
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
import org.dromara.gps.domain.GpsManmachine;
|
||||
import org.dromara.gps.domain.vo.AnqmManmachineVo;
|
||||
import org.dromara.gps.domain.vo.GpsManmachineVo;
|
||||
|
||||
/**
|
||||
* GPS人机关联Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-28
|
||||
*/
|
||||
public interface AnqmManmachineMapper extends BaseMapperPlus<AnqmManmachine, AnqmManmachineVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.gps.mapper;
|
||||
|
||||
import org.dromara.gps.domain.Device;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 安全帽设备Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
public interface DeviceMapper extends BaseMapperPlus<Device, DeviceVo> {
|
||||
|
||||
}
|
||||
@ -25,7 +25,7 @@ public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, G
|
||||
" gps_equipment_son \n" +
|
||||
"WHERE \n" +
|
||||
"project_id = #{projectId} \n " +
|
||||
"AND create_time BETWEEN #{startTime} AND #{endTime}\n" +
|
||||
// "AND create_time BETWEEN #{startTime} AND #{endTime}\n" +
|
||||
")\n" +
|
||||
"SELECT\n" +
|
||||
" *\n" +
|
||||
@ -67,7 +67,7 @@ public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, G
|
||||
"WHERE \n" +
|
||||
"project_id = #{projectId}\n " +
|
||||
"AND client_id IS NULL \n" +
|
||||
"AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
|
||||
// "AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
|
||||
")\n" +
|
||||
"SELECT\n" +
|
||||
" *\n" +
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
package org.dromara.gps.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.dromara.gps.domain.Location;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.vo.LocationVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
public interface LocationMapper extends BaseMapperPlus<Location, LocationVo> {
|
||||
|
||||
@Select(" WITH ges AS (" +
|
||||
" SELECT user_id,latitude,longitude,create_time,id , " +
|
||||
"ROW_NUMBER() OVER(" +
|
||||
"PARTITION BY user_id " +
|
||||
"ORDER BY create_time DESC, id DESC) AS rn " +
|
||||
"FROM location WHERE project_id = #{projectId})" +
|
||||
"SELECT user_id AS userId," +
|
||||
"latitude AS latitude, " +
|
||||
"longitude AS longitude " +
|
||||
"FROM ges " +
|
||||
"WHERE rn=1;")
|
||||
List<LocationVo> selectVoFristList(@Param("projectId") Long projectId);
|
||||
|
||||
|
||||
@Select("WITH RankedData AS (\n" +
|
||||
" SELECT\n" +
|
||||
" *,\n" +
|
||||
" ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY create_time DESC) AS rn\n" +
|
||||
" FROM\n" +
|
||||
" location \n " +
|
||||
"WHERE \n" +
|
||||
"project_id = #{projectId}\n " +
|
||||
// "AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
|
||||
")\n" +
|
||||
"SELECT\n" +
|
||||
" *\n" +
|
||||
"FROM\n" +
|
||||
" RankedData\n" +
|
||||
"WHERE\n" +
|
||||
" rn = 1;")
|
||||
List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
}
|
||||
@ -0,0 +1,71 @@
|
||||
package org.dromara.gps.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
import org.dromara.gps.domain.GpsManmachine;
|
||||
import org.dromara.gps.domain.bo.AnqmManmachineBo;
|
||||
import org.dromara.gps.domain.vo.AnqmManmachineVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* GPS人机关联Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-28
|
||||
*/
|
||||
public interface IAnqmManmachineService extends IService<AnqmManmachine>{
|
||||
|
||||
/**
|
||||
* 查询GPS人机关联
|
||||
*
|
||||
* @param clientId 主键
|
||||
* @return GPS人机关联
|
||||
*/
|
||||
AnqmManmachineVo queryById(String clientId);
|
||||
|
||||
/**
|
||||
* 分页查询GPS人机关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return GPS人机关联分页列表
|
||||
*/
|
||||
TableDataInfo<AnqmManmachineVo> queryPageList(AnqmManmachineBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的GPS人机关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return GPS人机关联列表
|
||||
*/
|
||||
List<AnqmManmachineVo> queryList(AnqmManmachineBo bo);
|
||||
|
||||
/**
|
||||
* 新增GPS人机关联
|
||||
*
|
||||
* @param bo GPS人机关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(AnqmManmachineBo bo);
|
||||
|
||||
/**
|
||||
* 修改GPS人机关联
|
||||
*
|
||||
* @param bo GPS人机关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(AnqmManmachineBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除GPS人机关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
package org.dromara.gps.service;
|
||||
|
||||
import org.dromara.gps.domain.bo.GpsEquipmentBo;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.bo.DeviceBo;
|
||||
import org.dromara.gps.domain.Device;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.gps.domain.vo.GpsProjectVo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全帽设备Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
public interface IDeviceService extends IService<Device>{
|
||||
|
||||
/**
|
||||
* 查询安全帽设备
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 安全帽设备
|
||||
*/
|
||||
DeviceVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询安全帽设备列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 安全帽设备分页列表
|
||||
*/
|
||||
TableDataInfo<DeviceVo> queryPageList(DeviceBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的安全帽设备列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 安全帽设备列表
|
||||
*/
|
||||
List<DeviceVo> queryList(DeviceBo bo);
|
||||
|
||||
/**
|
||||
* 新增安全帽设备
|
||||
*
|
||||
* @param bo 安全帽设备
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(DeviceBo bo);
|
||||
|
||||
/**
|
||||
* 修改安全帽设备
|
||||
*
|
||||
* @param bo 安全帽设备
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(DeviceBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除安全帽设备信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<GpsProjectVo> getProjectList();
|
||||
|
||||
Boolean bindManmachine(DeviceBo bo);
|
||||
|
||||
Boolean unbindManmachine(DeviceBo bo);
|
||||
|
||||
List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package org.dromara.gps.service;
|
||||
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.vo.LocationVo;
|
||||
import org.dromara.gps.domain.bo.LocationBo;
|
||||
import org.dromara.gps.domain.Location;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
public interface ILocationService extends IService<Location>{
|
||||
|
||||
/**
|
||||
* 查询安全帽经纬度数据
|
||||
*
|
||||
* @param devNum 主键
|
||||
* @return 安全帽经纬度数据
|
||||
*/
|
||||
LocationVo queryById(String devNum);
|
||||
|
||||
/**
|
||||
* 分页查询安全帽经纬度数据列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 安全帽经纬度数据分页列表
|
||||
*/
|
||||
TableDataInfo<LocationVo> queryPageList(LocationBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的安全帽经纬度数据列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 安全帽经纬度数据列表
|
||||
*/
|
||||
List<LocationVo> queryList(LocationBo bo);
|
||||
|
||||
/**
|
||||
* 新增安全帽经纬度数据
|
||||
*
|
||||
* @param bo 安全帽经纬度数据
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(LocationBo bo);
|
||||
|
||||
/**
|
||||
* 修改安全帽经纬度数据
|
||||
*
|
||||
* @param bo 安全帽经纬度数据
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(LocationBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除安全帽经纬度数据信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid);
|
||||
|
||||
List<LocationVo> getLargerScreenList(LocationBo bo);
|
||||
|
||||
List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package org.dromara.gps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
import org.dromara.gps.domain.bo.AnqmManmachineBo;
|
||||
import org.dromara.gps.domain.vo.AnqmManmachineVo;
|
||||
import org.dromara.gps.domain.vo.AnqmManmachineVo;
|
||||
import org.dromara.gps.mapper.AnqmManmachineMapper;
|
||||
import org.dromara.gps.mapper.AnqmManmachineMapper;
|
||||
import org.dromara.gps.service.IAnqmManmachineService;
|
||||
import org.dromara.gps.service.IAnqmManmachineService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* GPS人机关联Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-28
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class AnqmManmachineServiceImpl extends ServiceImpl<AnqmManmachineMapper, AnqmManmachine> implements IAnqmManmachineService {
|
||||
|
||||
private final AnqmManmachineMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询GPS人机关联
|
||||
*
|
||||
* @param clientId 主键
|
||||
* @return GPS人机关联
|
||||
*/
|
||||
@Override
|
||||
public AnqmManmachineVo queryById(String clientId){
|
||||
return baseMapper.selectVoById(clientId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询GPS人机关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return GPS人机关联分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<AnqmManmachineVo> queryPageList(AnqmManmachineBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<AnqmManmachine> lqw = buildQueryWrapper(bo);
|
||||
Page<AnqmManmachineVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的GPS人机关联列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return GPS人机关联列表
|
||||
*/
|
||||
@Override
|
||||
public List<AnqmManmachineVo> queryList(AnqmManmachineBo bo) {
|
||||
LambdaQueryWrapper<AnqmManmachine> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<AnqmManmachine> buildQueryWrapper(AnqmManmachineBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<AnqmManmachine> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(AnqmManmachine::getClientId);
|
||||
lqw.eq(bo.getUserId() != null, AnqmManmachine::getUserId, bo.getUserId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增GPS人机关联
|
||||
*
|
||||
* @param bo GPS人机关联
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(AnqmManmachineBo bo) {
|
||||
AnqmManmachine add = MapstructUtils.convert(bo, AnqmManmachine.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setClientId(add.getClientId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改GPS人机关联
|
||||
*
|
||||
* @param bo GPS人机关联
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(AnqmManmachineBo bo) {
|
||||
AnqmManmachine update = MapstructUtils.convert(bo, AnqmManmachine.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(AnqmManmachine entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除GPS人机关联信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,225 @@
|
||||
package org.dromara.gps.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.gps.domain.AnqmManmachine;
|
||||
import org.dromara.gps.domain.GpsEquipment;
|
||||
import org.dromara.gps.domain.GpsManmachine;
|
||||
import org.dromara.gps.domain.vo.GpsProjectVo;
|
||||
import org.dromara.gps.mapper.AnqmManmachineMapper;
|
||||
import org.dromara.gps.service.ILocationService;
|
||||
import org.dromara.project.domain.vo.project.BusProjectVo;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.gps.domain.bo.DeviceBo;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.Device;
|
||||
import org.dromara.gps.mapper.DeviceMapper;
|
||||
import org.dromara.gps.service.IDeviceService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 安全帽设备Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements IDeviceService {
|
||||
|
||||
private final DeviceMapper baseMapper;
|
||||
|
||||
@Autowired
|
||||
private IBusProjectService projectService;
|
||||
|
||||
@Autowired
|
||||
private AnqmManmachineMapper anqmManmachineMapper;
|
||||
|
||||
@Autowired
|
||||
private ILocationService locationService;
|
||||
|
||||
/**
|
||||
* 查询安全帽设备
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 安全帽设备
|
||||
*/
|
||||
@Override
|
||||
public DeviceVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询安全帽设备列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 安全帽设备分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<DeviceVo> queryPageList(DeviceBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<Device> lqw = buildQueryWrapper(bo);
|
||||
Page<DeviceVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的安全帽设备列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 安全帽设备列表
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceVo> queryList(DeviceBo bo) {
|
||||
LambdaQueryWrapper<Device> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Device> buildQueryWrapper(DeviceBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<Device> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(Device::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDevNum()), Device::getDevNum, bo.getDevNum());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDevName()), Device::getDevName, bo.getDevName());
|
||||
lqw.eq(bo.getStatus() != null, Device::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getProjectId() != null, Device::getProjectId, bo.getProjectId());
|
||||
lqw.eq(bo.getTemperature() != null, Device::getTemperature, bo.getTemperature());
|
||||
lqw.eq(bo.getHumidity() != null, Device::getHumidity, bo.getHumidity());
|
||||
lqw.eq(bo.getPosture() != null, Device::getPosture, bo.getPosture());
|
||||
lqw.eq(bo.getBatteryTemp() != null, Device::getBatteryTemp, bo.getBatteryTemp());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFixedBy()), Device::getFixedBy, bo.getFixedBy());
|
||||
lqw.eq(bo.getBatteryLevel() != null, Device::getBatteryLevel, bo.getBatteryLevel());
|
||||
lqw.eq(bo.getIsLowBattery() != null, Device::getIsLowBattery, bo.getIsLowBattery());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBatteryOn()), Device::getBatteryOn, bo.getBatteryOn());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBatteryOff()), Device::getBatteryOff, bo.getBatteryOff());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全帽设备
|
||||
*
|
||||
* @param bo 安全帽设备
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(DeviceBo bo) {
|
||||
Device add = MapstructUtils.convert(bo, Device.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改安全帽设备
|
||||
*
|
||||
* @param bo 安全帽设备
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(DeviceBo bo) {
|
||||
Device update = MapstructUtils.convert(bo, Device.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(Device entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除安全帽设备信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GpsProjectVo> getProjectList() {
|
||||
List<BusProjectVo> projectVos = projectService.selectProjectVoList();
|
||||
if (projectVos == null || projectVos.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
List<GpsProjectVo> list = new ArrayList<>();
|
||||
projectVos.forEach(item -> {
|
||||
GpsProjectVo vo = new GpsProjectVo();
|
||||
vo.setProjectId(item.getId());
|
||||
vo.setProjectName(item.getProjectName());
|
||||
list.add(vo);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean bindManmachine(DeviceBo bo) {
|
||||
if (bo.getProjectId() == null) {
|
||||
throw new ServiceException("请选择绑定项目");
|
||||
}
|
||||
if (bo.getUserId() == null) {
|
||||
throw new ServiceException("请选择绑定用户");
|
||||
}
|
||||
List<AnqmManmachine> gpsManmachines = anqmManmachineMapper.selectList(Wrappers.<AnqmManmachine>lambdaQuery()
|
||||
.eq(AnqmManmachine::getUserId, bo.getUserId()));
|
||||
if(CollectionUtil.isNotEmpty(gpsManmachines)){
|
||||
throw new ServiceException("选中用户已绑定设备");
|
||||
}
|
||||
baseMapper.update(new LambdaUpdateWrapper<Device>()
|
||||
.set(Device::getUserId,bo.getUserId())
|
||||
.set(Device::getProjectId,bo.getProjectId())
|
||||
.eq(Device::getId,bo.getId()));
|
||||
//只能绑定一个设备
|
||||
|
||||
AnqmManmachine gpsManmachine = new AnqmManmachine();
|
||||
gpsManmachine.setClientId(bo.getDevNum());
|
||||
gpsManmachine.setUserId(bo.getUserId());
|
||||
return anqmManmachineMapper.insert(gpsManmachine) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean unbindManmachine(DeviceBo bo) {
|
||||
baseMapper.update(new LambdaUpdateWrapper<Device>()
|
||||
.set(Device::getUserId,null)
|
||||
.eq(Device::getId,bo.getId()));
|
||||
AnqmManmachine gpsManmachine = new AnqmManmachine();
|
||||
gpsManmachine.setClientId(bo.getDevNum());
|
||||
return anqmManmachineMapper.delete(new LambdaQueryWrapper<AnqmManmachine>()
|
||||
.eq(AnqmManmachine::getClientId, gpsManmachine.getClientId()))> 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
|
||||
return locationService.getUserListByProjectId(projectId,startOfDay,now);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,162 @@
|
||||
package org.dromara.gps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.gps.domain.GpsEquipmentSon;
|
||||
import org.dromara.gps.domain.vo.DeviceVo;
|
||||
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.gps.domain.bo.LocationBo;
|
||||
import org.dromara.gps.domain.vo.LocationVo;
|
||||
import org.dromara.gps.domain.Location;
|
||||
import org.dromara.gps.mapper.LocationMapper;
|
||||
import org.dromara.gps.service.ILocationService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 安全帽经纬度数据Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-10-11
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements ILocationService {
|
||||
|
||||
private final LocationMapper baseMapper;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
/**
|
||||
* 查询安全帽经纬度数据
|
||||
*
|
||||
* @param devNum 主键
|
||||
* @return 安全帽经纬度数据
|
||||
*/
|
||||
@Override
|
||||
public LocationVo queryById(String devNum){
|
||||
return baseMapper.selectVoById(devNum);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询安全帽经纬度数据列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 安全帽经纬度数据分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<LocationVo> queryPageList(LocationBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<Location> lqw = buildQueryWrapper(bo);
|
||||
Page<LocationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的安全帽经纬度数据列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 安全帽经纬度数据列表
|
||||
*/
|
||||
@Override
|
||||
public List<LocationVo> queryList(LocationBo bo) {
|
||||
LambdaQueryWrapper<Location> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Location> buildQueryWrapper(LocationBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<Location> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(Location::getDevNum);
|
||||
lqw.orderByDesc(Location::getTime);
|
||||
lqw.eq(bo.getProjectId() != null, Location::getProjectId, bo.getProjectId());
|
||||
lqw.eq(bo.getUserId() != null, Location::getUserId, bo.getUserId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDevNum()), Location::getDevNum, bo.getDevNum());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增安全帽经纬度数据
|
||||
*
|
||||
* @param bo 安全帽经纬度数据
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(LocationBo bo) {
|
||||
Location add = MapstructUtils.convert(bo, Location.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setDevNum(add.getDevNum());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改安全帽经纬度数据
|
||||
*
|
||||
* @param bo 安全帽经纬度数据
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(LocationBo bo) {
|
||||
Location update = MapstructUtils.convert(bo, Location.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(Location entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除安全帽经纬度数据信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocationVo> getLargerScreenList(LocationBo bo) {
|
||||
List<LocationVo> gpsEquipmentSonVoList = baseMapper.selectVoFristList(bo.getProjectId());
|
||||
for (LocationVo vo : gpsEquipmentSonVoList) {
|
||||
SysUserVo sysUserVo = sysUserService.selectUserById(vo.getUserId());
|
||||
if (sysUserVo != null) {
|
||||
vo.setUserName(sysUserVo.getNickName());
|
||||
}
|
||||
}
|
||||
return gpsEquipmentSonVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
|
||||
return baseMapper.getUserListByProjectId(projectId,startOfDay,now);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,79 @@
|
||||
package org.dromara.gps.utils;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AuthUtil {
|
||||
// 定义签名的 APPID 和密钥常量
|
||||
public static final String SECRET = "5366474e589c4dcfadeef223a466ca0b";
|
||||
public static final String APPID = "0c9ab925c6684ab4a33350e15ee35062";
|
||||
|
||||
public static String generateSignature(Map<String, String> params) throws NoSuchAlgorithmException {
|
||||
// 获取所有键并按ASCII排序
|
||||
List<String> keys = new ArrayList<>(params.keySet());
|
||||
Collections.sort(keys);
|
||||
|
||||
// 按排序后的键拼接值
|
||||
StringBuilder signStrBuilder = new StringBuilder();
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
if (i > 0) {
|
||||
signStrBuilder.append("&");
|
||||
}
|
||||
signStrBuilder.append(params.get(keys.get(i)));
|
||||
}
|
||||
String signStr = signStrBuilder.toString();
|
||||
|
||||
// 转换为小写后进行MD5加密
|
||||
signStr = signStr.toLowerCase();
|
||||
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||
byte[] hashInBytes = md.digest(signStr.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
// 转换为十六进制字符串
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : hashInBytes) {
|
||||
sb.append(String.format("%02x", b));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证请求的签名
|
||||
*/
|
||||
public static boolean verifySignature(String message, String messageSignature, String secret) {
|
||||
try {
|
||||
// 初始化HMAC-SHA1
|
||||
Mac mac = Mac.getInstance("HmacSHA1");
|
||||
SecretKeySpec secretKeySpec = new SecretKeySpec(secret.getBytes(StandardCharsets.UTF_8), "HmacSHA1");
|
||||
mac.init(secretKeySpec);
|
||||
// 计算消息的摘要
|
||||
byte[] expectedMac = mac.doFinal(message.getBytes(StandardCharsets.UTF_8));
|
||||
// 将签名从十六进制字符串解码
|
||||
byte[] signatureBytes = hexStringToByteArray(messageSignature);
|
||||
// 比较计算得到的摘要和传入的签名
|
||||
return MessageDigest.isEqual(expectedMac, signatureBytes);
|
||||
} catch (NoSuchAlgorithmException | InvalidKeyException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将十六进制字符串转换为字节数组
|
||||
*/
|
||||
private static byte[] hexStringToByteArray(String s) {
|
||||
int len = s.length();
|
||||
byte[] data = new byte[len / 2];
|
||||
for (int i = 0; i < len; i += 2) {
|
||||
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
|
||||
+ Character.digit(s.charAt(i + 1), 16));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package org.dromara.gps.utils;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
public class JsonUtil {
|
||||
public static ObjectMapper objectMapper = new ObjectMapper();
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package org.dromara.job.inspection;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.quality.domain.QltQualityInspection;
|
||||
import org.dromara.quality.service.IQltQualityInspectionService;
|
||||
import org.dromara.safety.domain.HseSafetyInspection;
|
||||
import org.dromara.safety.service.IHseSafetyInspectionService;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class InspectionJob {
|
||||
|
||||
@Resource
|
||||
private IQltQualityInspectionService qltQualityInspectionService;
|
||||
|
||||
@Resource
|
||||
private IHseSafetyInspectionService safetyInspectionService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
@JobExecutor(name = "qltInspection")
|
||||
public void qltInspection() {
|
||||
log.info("执行定时任务:质量工单短信提醒");
|
||||
List<QltQualityInspection> list = qltQualityInspectionService.list(Wrappers.<QltQualityInspection>lambdaQuery()
|
||||
.eq(QltQualityInspection::getInspectionStatus, "1")
|
||||
.eq(QltQualityInspection::getIsReply, "1")
|
||||
.lt(QltQualityInspection::getReplyPeriodDate, LocalDate.now())
|
||||
);
|
||||
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend("config4");
|
||||
|
||||
// 每500条记录作为一批进行处理
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, list.size());
|
||||
List<QltQualityInspection> batch = list.subList(i, endIndex);
|
||||
|
||||
for (QltQualityInspection qualityInspection : batch) {
|
||||
Long correctorId = qualityInspection.getCorrectorId();
|
||||
String phonenumber = userService.queryById(correctorId).getPhonenumber();
|
||||
if (phonenumber == null) {
|
||||
continue;
|
||||
}
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, (String) null);
|
||||
if (!smsResponse.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("质量工单短信提醒批次发送完成,当前批次数量: {}", batch.size());
|
||||
}
|
||||
|
||||
log.info("执行定时任务:质量工单短信提醒完成,总处理数量: {}", list.size());
|
||||
}
|
||||
|
||||
@JobExecutor(name = "safeInspection")
|
||||
public void safeInspection() {
|
||||
log.info("执行定时任务:安全工单短信提醒");
|
||||
List<HseSafetyInspection> list = safetyInspectionService.list(Wrappers.<HseSafetyInspection>lambdaQuery()
|
||||
.eq(HseSafetyInspection::getStatus, "1")
|
||||
.eq(HseSafetyInspection::getIsReply, "1")
|
||||
.lt(HseSafetyInspection::getRectificationDeadline, LocalDate.now())
|
||||
);
|
||||
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend("config6");
|
||||
|
||||
// 每500条记录作为一批进行处理
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, list.size());
|
||||
List<HseSafetyInspection> batch = list.subList(i, endIndex);
|
||||
|
||||
for (HseSafetyInspection safetyInspection : batch) {
|
||||
Long correctorId = safetyInspection.getCorrectorId();
|
||||
String phonenumber = userService.queryById(correctorId).getPhonenumber();
|
||||
if (phonenumber == null) {
|
||||
continue;
|
||||
}
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, (String) null);
|
||||
if (!smsResponse.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("安全工单短信提醒批次发送完成,当前批次数量: {}", batch.size());
|
||||
}
|
||||
|
||||
log.info("执行定时任务:安全工单短信提醒完成,总处理数量: {}", list.size());
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAddReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAuditDto;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
@ -45,7 +46,7 @@ public class BusLeaveAppController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前登录用户补卡审批列表
|
||||
* 查询当前登录用户请假审批列表
|
||||
*/
|
||||
@GetMapping("/list/auditUser")
|
||||
public TableDataInfo<BusLeaveVo> listByAuditUser(BusLeaveQueryReq req, PageQuery pageQuery) {
|
||||
@ -55,7 +56,7 @@ public class BusLeaveAppController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 查询角色补卡审批列表
|
||||
* 查询角色请假审批列表
|
||||
*/
|
||||
@GetMapping("/list/auditRole")
|
||||
public TableDataInfo<BusLeaveVo> listByAuditRole(BusLeaveQueryReq req, PageQuery pageQuery) {
|
||||
@ -63,8 +64,6 @@ public class BusLeaveAppController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 提交请假
|
||||
*/
|
||||
@ -75,5 +74,14 @@ public class BusLeaveAppController extends BaseController {
|
||||
return R.ok(leaveService.add(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批
|
||||
*/
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Boolean> audit(@RequestBody BusLeaveAuditDto dto) {
|
||||
return R.ok(leaveService.audit(dto));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.project.domain.dto.leave;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BusLeaveAuditDto {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 意见(1未读 2同意 3拒绝)
|
||||
*/
|
||||
private String gangerOpinion;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package org.dromara.project.domain.vo.reissuecard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuditUserVo {
|
||||
private Long userId;
|
||||
private String nickName;
|
||||
private String avatar;
|
||||
}
|
||||
@ -7,11 +7,13 @@ import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.project.domain.BusReissueCard;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -161,4 +163,15 @@ public class BusReissueCardVo implements Serializable {
|
||||
* 补卡类型(1上班 2下班)
|
||||
*/
|
||||
private String reissueCardType;
|
||||
|
||||
|
||||
/**
|
||||
* 申请人类型(0-施工人员 1-管理人员 2-分包人员)
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 审批人列表
|
||||
*/
|
||||
private List<AuditUserVo> auditors;
|
||||
}
|
||||
|
||||
@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.project.domain.BusLeave;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAddReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveGangerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveManagerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.dto.leave.*;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
import org.dromara.project.domain.vo.reissuecard.BusReissueCardVo;
|
||||
@ -128,6 +125,6 @@ public interface IBusLeaveService extends IService<BusLeave> {
|
||||
TableDataInfo<BusLeaveVo> listByAuditRole(BusLeaveQueryReq req, PageQuery pageQuery);
|
||||
|
||||
|
||||
|
||||
Boolean audit(BusLeaveAuditDto dto);
|
||||
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package org.dromara.project.service;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.bigscreen.domain.dto.TanchuangInfoReq;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.manager.weathermanager.vo.WeatherVo;
|
||||
@ -237,4 +238,5 @@ public interface IBusProjectService extends IService<BusProject> {
|
||||
*/
|
||||
Map<String, Map<String, String>> getProjectCapacity();
|
||||
|
||||
Map<String, Map<String, Object>> getInfoData(TanchuangInfoReq req);
|
||||
}
|
||||
|
||||
@ -592,18 +592,20 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
.eq(BusUserProjectRelevancy::getProjectId, projectId)
|
||||
.last("limit 1"));
|
||||
if (relevancy == null) {
|
||||
throw new ServiceException("当前用户未加入项目", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("当前用户未加入项目", HttpStatus.ERROR);
|
||||
}
|
||||
//判断是否是管理员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围
|
||||
boolean isAdmin = "2".equals(relevancy.getUserType());
|
||||
SysUserVo sysUserVo = userService.queryById(userId);
|
||||
|
||||
//判断是否是施工人员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围
|
||||
boolean isWork = "0".equals(sysUserVo.getAppUserType());
|
||||
List<Long> rangeIds = new ArrayList<>();
|
||||
if (!isAdmin) {
|
||||
if (isWork) {
|
||||
BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.lambdaQuery(BusProjectTeamMember.class)
|
||||
.eq(BusProjectTeamMember::getMemberId, userId)
|
||||
.eq(BusProjectTeamMember::getProjectId, projectId)
|
||||
.last("limit 1"));
|
||||
if (one == null) {
|
||||
throw new ServiceException("当前用户未加入班组", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("当前用户未加入班组", HttpStatus.ERROR);
|
||||
}
|
||||
BusProjectTeam team = projectTeamService.getById(one.getTeamId());
|
||||
try {
|
||||
|
||||
@ -29,12 +29,9 @@ import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.*;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAddReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveGangerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.*;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.enums.*;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveManagerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
import org.dromara.project.domain.vo.reissuecard.BusReissueCardVo;
|
||||
import org.dromara.project.mapper.BusLeaveMapper;
|
||||
@ -391,7 +388,7 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
public Long add(BusLeaveAddReq req) {
|
||||
// 1. 转换请求对象
|
||||
BusLeave leave = new BusLeave();
|
||||
BeanUtils.copyProperties(leave, req);
|
||||
BeanUtils.copyProperties(req, leave);
|
||||
|
||||
// 2. 获取当前用户ID和时间区间
|
||||
Long userId = req.getUserId();
|
||||
@ -483,17 +480,73 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean audit(BusLeaveAuditDto dto) {
|
||||
BusLeave busLeave = baseMapper.selectById(dto.getId());
|
||||
if (busLeave == null) {
|
||||
throw new ServiceException("未找到该申请");
|
||||
}
|
||||
String gangerOpinion = dto.getGangerOpinion();
|
||||
busLeave.setGangerOpinion(gangerOpinion);
|
||||
int i = baseMapper.updateById(busLeave);
|
||||
|
||||
if(gangerOpinion.equals("2")){
|
||||
if(busLeave.getTimeType().equals("1")){
|
||||
LocalDateTime startTime = busLeave.getStartTime();
|
||||
LocalDateTime endTime = busLeave.getEndTime();
|
||||
LocalDate startDate = startTime.toLocalDate();
|
||||
LocalDate endDate = endTime.toLocalDate();
|
||||
|
||||
List<BusAttendance> list = attendanceService.list(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, busLeave.getProjectId())
|
||||
.le(BusAttendance::getClockDate, endDate)
|
||||
.ge(BusAttendance::getClockDate, startDate)
|
||||
.eq(BusAttendance::getUserId, busLeave.getUserId())
|
||||
);
|
||||
for (BusAttendance attendance : list) {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LATE.getValue());
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
attendanceService.updateBatchById(list);
|
||||
}
|
||||
}else if(busLeave.getTimeType().equals("2")){
|
||||
if(busLeave.getPeriodType().equals("1")){
|
||||
LocalDateTime startTime = busLeave.getStartTime();
|
||||
LocalDate localDate = startTime.toLocalDate();
|
||||
List<BusAttendance> list = attendanceService.list(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, busLeave.getProjectId())
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.eq(BusAttendance::getClockType, "1")
|
||||
.eq(BusAttendance::getUserId, busLeave.getUserId())
|
||||
);
|
||||
for (BusAttendance attendance : list) {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LATE.getValue());
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
attendanceService.updateBatchById(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}else if(busLeave.getPeriodType().equals("2")){
|
||||
LocalDateTime endTime = busLeave.getEndTime();
|
||||
LocalDate localDate = endTime.toLocalDate();
|
||||
List<BusAttendance> list = attendanceService.list(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, busLeave.getProjectId())
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.eq(BusAttendance::getClockType, "2")
|
||||
.eq(BusAttendance::getUserId, busLeave.getUserId())
|
||||
);
|
||||
for (BusAttendance attendance : list) {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LATE.getValue());
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
attendanceService.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return i>0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.PhoneUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
@ -14,6 +15,7 @@ import com.github.benmanes.caffeine.cache.Cache;
|
||||
import com.github.benmanes.caffeine.cache.Caffeine;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.bigscreen.domain.dto.TanchuangInfoReq;
|
||||
import org.dromara.common.core.constant.CacheNames;
|
||||
import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.constant.SystemConstants;
|
||||
@ -27,7 +29,9 @@ import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.domain.SubContractor;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.design.service.IDesTechnicalStandardService;
|
||||
import org.dromara.facility.domain.FacMatrix;
|
||||
@ -37,6 +41,8 @@ import org.dromara.facility.service.IFacMatrixService;
|
||||
import org.dromara.manager.weathermanager.WeatherConstant;
|
||||
import org.dromara.manager.weathermanager.WeatherManager;
|
||||
import org.dromara.manager.weathermanager.vo.WeatherVo;
|
||||
import org.dromara.other.domain.OthYs7Device;
|
||||
import org.dromara.other.service.IOthYs7DeviceService;
|
||||
import org.dromara.progress.domain.PgsProgressCategory;
|
||||
import org.dromara.progress.domain.enums.PgsRelevancyStructureEnum;
|
||||
import org.dromara.progress.domain.vo.progresscategory.PgsProgressCategoryStructureVo;
|
||||
@ -141,6 +147,10 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
||||
@Resource
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private ISubConstructionUserService constructionUserService;
|
||||
|
||||
private final Cache<String, String> WEATHER_CACHE =
|
||||
Caffeine.newBuilder().initialCapacity(1024)
|
||||
.maximumSize(10000L)
|
||||
@ -1177,6 +1187,21 @@ public class BusProjectServiceImpl extends ServiceImpl<BusProjectMapper, BusProj
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Map<String, Object>> getInfoData(TanchuangInfoReq req) {
|
||||
Map<String, Map<String, Object>> map = new HashMap<>();
|
||||
SubConstructionUser byUserId = constructionUserService.getByUserId(req.getId());
|
||||
SubContractor contractor = contractorService.getById(byUserId.getContractorId());
|
||||
Map<String, Object> renyuan = new HashMap<>();
|
||||
renyuan.put("name", byUserId.getUserName());
|
||||
renyuan.put("teamName", byUserId.getTeamName());
|
||||
renyuan.put("phone", byUserId.getPhone());
|
||||
renyuan.put("typeOfWork", dictDataService.selectDictLabel("type_of_work", byUserId.getTypeOfWork()));
|
||||
renyuan.put("contractorNmae", contractor.getName());
|
||||
map.put("renyuan", renyuan);
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造分项工程树
|
||||
*/
|
||||
|
||||
@ -2,6 +2,7 @@ package org.dromara.project.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -34,9 +35,12 @@ import org.dromara.project.domain.enums.BusOpinionStatusEnum;
|
||||
import org.dromara.project.domain.enums.BusReviewStatusEnum;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardManagerReviewReq;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.vo.reissuecard.AuditUserVo;
|
||||
import org.dromara.project.domain.vo.reissuecard.BusReissueCardVo;
|
||||
import org.dromara.project.mapper.BusReissueCardMapper;
|
||||
import org.dromara.project.service.*;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.domain.SysUserRole;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@ -108,13 +112,41 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
|
||||
}
|
||||
BusProject byId = projectService.getById(busReissueCardVo.getProjectId());
|
||||
busReissueCardVo.setProjectName(byId.getProjectName());
|
||||
String userType = busReissueCardVo.getUserType();
|
||||
//两个角色 一个审核分包的=6,一个审核管理的=7
|
||||
List<SysUser> sysUsers = new ArrayList<>();
|
||||
if("1".equals(userType)){
|
||||
sysUsers = userService.selectUserByRoleIdAndProjectId(6L, busReissueCardVo.getProjectId());
|
||||
} else if ("2".equals(userType)) {
|
||||
sysUsers = userService.selectUserByRoleIdAndProjectId(7L, busReissueCardVo.getProjectId());
|
||||
}else{
|
||||
SysUserVo sysUserVo = userService.selectUserById(busReissueCardVo.getGangerId());
|
||||
if(sysUserVo != null){
|
||||
busReissueCardVo.setGangerName(sysUserVo.getNickName());
|
||||
if(sysUserVo.getAvatar() != null){
|
||||
SysOssVo byId1 = ossService.getById(sysUserVo.getAvatar());
|
||||
if(byId1 != null){
|
||||
busReissueCardVo.setAvatar(byId1.getUrl());
|
||||
}
|
||||
|
||||
SysUserVo sysUserVo = userService.selectUserById(busReissueCardVo.getGangerId());
|
||||
busReissueCardVo.setGangerName(sysUserVo.getNickName());
|
||||
if(sysUserVo.getAvatar() != null){
|
||||
SysOssVo byId1 = ossService.getById(sysUserVo.getAvatar());
|
||||
busReissueCardVo.setAvatar(byId1.getUrl());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(sysUsers)){
|
||||
busReissueCardVo.setAuditors(sysUsers.stream().map(sysUser -> {
|
||||
AuditUserVo userVo = new AuditUserVo();
|
||||
userVo.setUserId(sysUser.getUserId());
|
||||
userVo.setNickName(sysUser.getNickName());
|
||||
if(sysUser.getAvatar() != null){
|
||||
SysOssVo byId1 = ossService.getById(sysUser.getAvatar());
|
||||
if(byId1 != null){
|
||||
userVo.setAvatar(byId1.getUrl());
|
||||
}
|
||||
}
|
||||
return userVo;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
return busReissueCardVo;
|
||||
}
|
||||
|
||||
@ -64,6 +64,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.dromara.common.core.constant.TenantConstants.SUPER_ADMIN_ID;
|
||||
|
||||
/**
|
||||
* 安全巡检工单Service业务层处理
|
||||
*
|
||||
@ -519,7 +521,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
Long correctorId = safetyInspection.getCorrectorId();
|
||||
// 只有指定用户可以整改
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if (!correctorId.equals(userId)) {
|
||||
if (!correctorId.equals(userId) && !SUPER_ADMIN_ID.equals(userId)) {
|
||||
throw new ServiceException("当前用户不是指定整改人", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
HseSafetyInspection updateInspection = new HseSafetyInspection();
|
||||
@ -534,7 +536,6 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// 填充默认值
|
||||
updateInspection.setId(id);
|
||||
|
||||
@ -218,4 +218,7 @@ public interface ISysRoleService {
|
||||
|
||||
|
||||
List<Long> selectRoleIdsByUserIdAndProjectId(Long userId,Long projectId);
|
||||
|
||||
|
||||
List<Long> selectRoleIdsByName(String roleName);
|
||||
}
|
||||
|
||||
@ -276,4 +276,8 @@ public interface ISysUserService {
|
||||
List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId);
|
||||
|
||||
Boolean updateFb(Long userId,Long contractorId);
|
||||
|
||||
List<SysUser> selectUserByRoleIdAndProjectId(Long roleId,Long projectId);
|
||||
|
||||
List<SysUser> selectUserByRoleIdsAndProjectId(List<Long> roleIds,Long projectId);
|
||||
}
|
||||
|
||||
@ -653,4 +653,11 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectRoleIdsByName(String roleName) {
|
||||
return baseMapper.selectList(Wrappers.lambdaQuery(SysRole.class)
|
||||
.eq(SysRole::getRoleName, roleName)
|
||||
).stream().map(SysRole::getRoleId).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -940,6 +940,17 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
}
|
||||
userRoleMapper.insertBatch(sysUserRoles);
|
||||
|
||||
if(CollectionUtil.isNotEmpty(projectIds)){
|
||||
List<BusUserProjectRelevancy> relevancies = new ArrayList<>();
|
||||
for (Long project : projectIds) {
|
||||
BusUserProjectRelevancy relevancy = new BusUserProjectRelevancy();
|
||||
relevancy.setProjectId(project);
|
||||
relevancy.setUserId(userId);
|
||||
relevancies.add(relevancy);
|
||||
}
|
||||
userProjectRelevancyService.saveBatch(relevancies);
|
||||
}
|
||||
|
||||
return baseMapper.update(null,
|
||||
new LambdaUpdateWrapper<SysUser>()
|
||||
.set(SysUser::getAppUserType, appUserType)
|
||||
@ -1226,6 +1237,41 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
return baseMapper.updateById(sysUser)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserByRoleIdAndProjectId(Long roleId, Long projectId) {
|
||||
|
||||
List<SysUserRole> sysUserRoles = userRoleMapper.selectList(Wrappers.lambdaQuery(SysUserRole.class)
|
||||
.eq(SysUserRole::getRoleId, roleId)
|
||||
.eq(SysUserRole::getProjectId, projectId)
|
||||
);
|
||||
List<Long> list1 = sysUserRoles.stream().map(SysUserRole::getUserId).toList();
|
||||
if (CollUtil.isNotEmpty(list1)) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserId, SysUser::getNickName, SysUser::getAvatar,SysUser::getPhonenumber)
|
||||
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
||||
.in(SysUser::getUserId, list1)
|
||||
);
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserByRoleIdsAndProjectId(List<Long> roleIds, Long projectId) {
|
||||
List<SysUserRole> sysUserRoles = userRoleMapper.selectList(Wrappers.lambdaQuery(SysUserRole.class)
|
||||
.in(SysUserRole::getRoleId, roleIds)
|
||||
.eq(SysUserRole::getProjectId, projectId)
|
||||
);
|
||||
List<Long> list1 = sysUserRoles.stream().map(SysUserRole::getUserId).toList();
|
||||
if (CollUtil.isNotEmpty(list1)) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserId, SysUser::getNickName, SysUser::getAvatar,SysUser::getPhonenumber)
|
||||
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
||||
.in(SysUser::getUserId, list1)
|
||||
);
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO selectUser(Long userId) {
|
||||
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.gps.mapper.DeviceMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.gps.mapper.LocationMapper">
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user