Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -297,7 +297,9 @@ dxf2GeoJson:
|
||||
file-name: main.exe
|
||||
ys7:
|
||||
app-key: 3acf9f1a43dc4209841e0893003db0a2
|
||||
app-secret: 4bbf3e9394f55d3af6e3af27b2d3db36
|
||||
app-secret: 09e29c70ae1161fbc3ce2030fc09ba2e
|
||||
job:
|
||||
capture-enabled: false # 控制是否启用萤石抓拍任务
|
||||
#ys7:
|
||||
# app-key: 081b0d6d5f7f4de8bc5c7fa350fb26ec
|
||||
# app-secret: caa37b9f60ef02deb57e563bc190e6db
|
||||
|
||||
@ -301,6 +301,8 @@ dxf2GeoJson:
|
||||
ys7:
|
||||
app-key: 3acf9f1a43dc4209841e0893003db0a2
|
||||
app-secret: 4bbf3e9394f55d3af6e3af27b2d3db36
|
||||
job:
|
||||
capture-enabled: true # 控制是否启用萤石抓拍任务
|
||||
# 斯巴达算法
|
||||
sparta:
|
||||
url: http://119.3.204.120:8040
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package org.dromara.bigscreen.config;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.bigscreen.listener.RedisMessageListener;
|
||||
import org.dromara.drone.service.IDroProjectDroneService;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.listener.PatternTopic;
|
||||
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
|
||||
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
public class RedisConfig {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private IDroProjectDroneService droProjectDroneService;
|
||||
|
||||
/**
|
||||
* 配置Redis消息监听容器
|
||||
*/
|
||||
@Bean
|
||||
public RedisMessageListenerContainer container(RedisConnectionFactory connectionFactory,
|
||||
MessageListenerAdapter listenerAdapter) {
|
||||
|
||||
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));
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置消息监听适配器,将消息转发给自定义的监听器
|
||||
*/
|
||||
@Bean
|
||||
public MessageListenerAdapter listenerAdapter(RedisMessageListener listener) {
|
||||
return new MessageListenerAdapter(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置StringRedisTemplate
|
||||
*/
|
||||
@Bean
|
||||
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory connectionFactory) {
|
||||
return new StringRedisTemplate(connectionFactory);
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,13 @@
|
||||
package org.dromara.bigscreen.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
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.WurenjiQueryReq;
|
||||
import org.dromara.bigscreen.domain.dto.Ys7DeviceUpdateReq;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectLandVo;
|
||||
@ -17,7 +20,9 @@ import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.drone.service.IDroProjectDroneService;
|
||||
import org.dromara.gps.domain.bo.GpsEquipmentBo;
|
||||
import org.dromara.gps.domain.vo.GpsEquipmentSonVo;
|
||||
import org.dromara.gps.service.IGpsEquipmentService;
|
||||
@ -48,6 +53,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -69,7 +75,6 @@ public class ProjectBigScreenController extends BaseController {
|
||||
|
||||
private final IBusLandBlockService busLandBlockService;
|
||||
|
||||
private final IGpsEquipmentService gpsEquipmentService;
|
||||
|
||||
private final IOthYs7DeviceService othYs7DeviceService;
|
||||
|
||||
@ -167,7 +172,7 @@ public class ProjectBigScreenController extends BaseController {
|
||||
// vo.setContent(event.getContent());
|
||||
// return vo;
|
||||
// }).toList());
|
||||
return R.ok(projectNewsService.getLimtVoByProjectId(projectId));
|
||||
return R.ok(projectBigScreenService.getProjectNews(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -290,64 +295,7 @@ public class ProjectBigScreenController extends BaseController {
|
||||
@GetMapping("/getClientList/{projectId}")
|
||||
public R<List<Map<String, Object>>> getClientList(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
List<GpsEquipmentSonVo> voList = gpsEquipmentService.getClientList(projectId);
|
||||
List<OthYs7Device> othYs7DeviceList = othYs7DeviceService.lambdaQuery()
|
||||
.eq(OthYs7Device::getProjectId, projectId)
|
||||
.list();
|
||||
List<Map<String, Object>> maps = new ArrayList<>();
|
||||
Map<String, Object> gpsMap = new HashMap<>();
|
||||
Map<String, Object> wrjMap = new HashMap<>();
|
||||
Map<String, Object> sxtMap = new HashMap<>();
|
||||
List<Map<String, Object>> gpsChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> wrjChildrenMap = new ArrayList<>();
|
||||
List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
|
||||
if (voList != null && !voList.isEmpty()) {
|
||||
for (GpsEquipmentSonVo item : voList) {
|
||||
Map<String, Object> gps = new HashMap<>();
|
||||
gps.put("id", item.getClientId());
|
||||
gps.put("label", item.getClientId());
|
||||
gps.put("name", item.getDeviceName());
|
||||
gps.put("type", "positioningDevice");
|
||||
gps.put("lat", item.getLocLatitude());
|
||||
gps.put("lng", item.getLocLongitude());
|
||||
gps.put("alt", item.getLocAltitude());
|
||||
gpsChildrenMap.add(gps);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
// List<Map<String, Object>> maps1 = setSxt();
|
||||
List<Map<String, Object>> maps2 = setWrj();
|
||||
|
||||
gpsMap.put("id", 1);
|
||||
gpsMap.put("label", "定位设备");
|
||||
gpsMap.put("children", gpsChildrenMap);
|
||||
sxtMap.put("id", 2);
|
||||
sxtMap.put("label", "摄像头");
|
||||
sxtMap.put("children", sxtChildrenMap);
|
||||
// sxtMap.put("children", maps1);
|
||||
wrjMap.put("id", 3);
|
||||
wrjMap.put("label", "无人机");
|
||||
// wrjMap.put("children",wrjChildrenMap);
|
||||
wrjMap.put("children", maps2);
|
||||
|
||||
|
||||
maps.add(gpsMap);
|
||||
maps.add(wrjMap);
|
||||
maps.add(sxtMap);
|
||||
return R.ok(maps);
|
||||
return R.ok(projectBigScreenService.getClientList(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -450,133 +398,4 @@ public class ProjectBigScreenController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
// public List<Map<String, Object>> setSxt() {
|
||||
// List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
|
||||
// HashMap<String, Object> map1 = new HashMap<>();
|
||||
// map1.put("id", "55");
|
||||
// map1.put("label", "那荷4号方阵-1");
|
||||
// map1.put("name", "22");
|
||||
// map1.put("type", "camera");
|
||||
// map1.put("lng", 107.111325);
|
||||
// map1.put("lat", 23.820919);
|
||||
// map1.put("alt", 0);
|
||||
// HashMap<String, Object> map2 = new HashMap<>();
|
||||
// map2.put("id", "56");
|
||||
// map2.put("label", "甫必 1号方阵");
|
||||
// map2.put("name", "23");
|
||||
// map2.put("type", "camera");
|
||||
// map2.put("lng", 107.091297);
|
||||
// map2.put("lat", 23.813567);
|
||||
// map2.put("alt", 0);
|
||||
// HashMap<String, Object> map3 = new HashMap<>();
|
||||
// map3.put("id", "57");
|
||||
// map3.put("label", "1222224");
|
||||
// map3.put("name", "24");
|
||||
// map3.put("type", "camera");
|
||||
// map3.put("lng", 107.085442);
|
||||
// map3.put("lat", 23.811958);
|
||||
// map3.put("alt", 0);
|
||||
// HashMap<String, Object> map4 = new HashMap<>();
|
||||
// map4.put("id", "58");
|
||||
// map4.put("label", "甫必2号方阵-1");
|
||||
// map4.put("name", "25");
|
||||
// map4.put("type", "camera");
|
||||
// map4.put("lng", 107.085181);
|
||||
// map4.put("lat", 23.810556);
|
||||
// map4.put("alt", 0);
|
||||
// HashMap<String, Object> map5 = new HashMap<>();
|
||||
// map5.put("id", "58");
|
||||
// map5.put("label", "甫必 4号方阵");
|
||||
// map5.put("name", "25");
|
||||
// map5.put("type", "camera");
|
||||
// map5.put("lng", 107.081747);
|
||||
// map5.put("lat", 23.808131);
|
||||
// map5.put("alt", 0);
|
||||
// HashMap<String, Object> map6 = new HashMap<>();
|
||||
// map6.put("id", "58");
|
||||
// map6.put("label", "甫必 7号方阵-1");
|
||||
// map6.put("name", "25");
|
||||
// map6.put("type", "camera");
|
||||
// map6.put("lng", 107.077922);
|
||||
// map6.put("lat", 23.798344);
|
||||
// map6.put("alt", 0);
|
||||
// HashMap<String, Object> map7 = new HashMap<>();
|
||||
// map7.put("id", "58");
|
||||
// map7.put("label", "68甫必6");
|
||||
// map7.put("name", "25");
|
||||
// map7.put("type", "camera");
|
||||
// map7.put("lng", 107.077333);
|
||||
// map7.put("lat", 23.797969);
|
||||
// map7.put("alt", 0);
|
||||
// HashMap<String, Object> map8 = new HashMap<>();
|
||||
// map8.put("id", "58");
|
||||
// map8.put("label", "甫必5号方阵");
|
||||
// map8.put("name", "25");
|
||||
// map8.put("type", "camera");
|
||||
// map8.put("lng", 107.075853);
|
||||
// map8.put("lat", 23.796711);
|
||||
// map8.put("alt", 0);
|
||||
// HashMap<String, Object> map9 = new HashMap<>();
|
||||
// map9.put("id", "58");
|
||||
// map9.put("label", "西牛2号方阵");
|
||||
// map9.put("name", "25");
|
||||
// map9.put("type", "camera");
|
||||
// map9.put("lng", 107.078942);
|
||||
// map9.put("lat", 23.789306);
|
||||
// map9.put("alt", 0);
|
||||
// HashMap<String, Object> map10 = new HashMap<>();
|
||||
// map10.put("id", "58");
|
||||
// map10.put("label", "福绿1号方阵");
|
||||
// map10.put("name", "25");
|
||||
// map10.put("type", "camera");
|
||||
// map10.put("lng", 107.090061);
|
||||
// map10.put("lat", 23.790411);
|
||||
// map10.put("alt", 0);
|
||||
// HashMap<String, Object> map11 = new HashMap<>();
|
||||
// map11.put("id", "58");
|
||||
// map11.put("label", "福绿6号方阵-2");
|
||||
// map11.put("name", "25");
|
||||
// map11.put("type", "camera");
|
||||
// map11.put("lng", 107.112883);
|
||||
// map11.put("lat", 23.771378);
|
||||
// map11.put("alt", 0);
|
||||
//
|
||||
// sxtChildrenMap.add(map1);
|
||||
// sxtChildrenMap.add(map2);
|
||||
// sxtChildrenMap.add(map3);
|
||||
// sxtChildrenMap.add(map4);
|
||||
// sxtChildrenMap.add(map5);
|
||||
// sxtChildrenMap.add(map6);
|
||||
// sxtChildrenMap.add(map7);
|
||||
// sxtChildrenMap.add(map8);
|
||||
// sxtChildrenMap.add(map9);
|
||||
// sxtChildrenMap.add(map10);
|
||||
// sxtChildrenMap.add(map11);
|
||||
//
|
||||
// return sxtChildrenMap;
|
||||
// }
|
||||
|
||||
public List<Map<String, Object>> setWrj() {
|
||||
List<Map<String, Object>> sxtChildrenMap = new ArrayList<>();
|
||||
HashMap<String, Object> map1 = new HashMap<>();
|
||||
map1.put("id", "65");
|
||||
map1.put("label", "田东无人机");
|
||||
map1.put("name", "32");
|
||||
map1.put("type", "drone");
|
||||
map1.put("lng", 107.12744694624267);
|
||||
map1.put("lat", 23.615965741917278);
|
||||
map1.put("alt", 0);
|
||||
// HashMap<String, Object> map2 = new HashMap<>();
|
||||
// map2.put("id", "66");
|
||||
// map2.put("label", "长顺无人机");
|
||||
// map2.put("name", "33");
|
||||
// map2.put("type", "drone");
|
||||
// map2.put("lng", 106.49142431645038);
|
||||
// map2.put("lat", 29.534472802500083);
|
||||
// map2.put("alt", 0);
|
||||
sxtChildrenMap.add(map1);
|
||||
// sxtChildrenMap.add(map2);
|
||||
|
||||
return sxtChildrenMap;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package org.dromara.bigscreen.domain.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-09-09 15:16
|
||||
*/
|
||||
@Data
|
||||
public class WurenjiQueryReq {
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String latitude;
|
||||
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
package org.dromara.bigscreen.listener;
|
||||
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.websocket.dto.WebSocketMessageDto;
|
||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
||||
import org.dromara.drone.domain.DroProjectDrone;
|
||||
import org.dromara.drone.service.IDroProjectDroneService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.connection.Message;
|
||||
import org.springframework.data.redis.connection.MessageListener;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Redis消息监听器,用于处理订阅频道收到的消息
|
||||
*/
|
||||
@Component
|
||||
public class RedisMessageListener implements MessageListener {
|
||||
|
||||
@Lazy
|
||||
private final StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private IDroProjectDroneService droProjectDroneService;
|
||||
|
||||
// 构造函数注入StringRedisTemplate
|
||||
public RedisMessageListener(StringRedisTemplate stringRedisTemplate) {
|
||||
this.stringRedisTemplate = stringRedisTemplate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理接收到的消息
|
||||
* @param message 消息对象
|
||||
* @param pattern 订阅的模式
|
||||
*/
|
||||
@Override
|
||||
public void onMessage(Message message, byte[] pattern) {
|
||||
// 处理消息
|
||||
// System.out.println("返回:"+stringRedisTemplate.getStringSerializer().deserialize(message.getBody()));
|
||||
String gateway = JSONUtil.parseObj(stringRedisTemplate.getStringSerializer().deserialize(message.getBody())).getStr("gateway");
|
||||
stringRedisTemplate
|
||||
.opsForValue()
|
||||
.set("wrj:"+gateway
|
||||
, 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());
|
||||
// 发送给指定用户(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");
|
||||
messageObj.put("projectId",projectId);
|
||||
messageObj.put("clientId",key);
|
||||
// 位置信息
|
||||
JSONObject locationObj = new JSONObject();
|
||||
locationObj.put("latitude", JSONUtil.parseObj(message).getJSONObject("data").get("latitude")); // 纬度
|
||||
locationObj.put("longitude", JSONUtil.parseObj(message).getJSONObject("data").get("longitude")); // 经度
|
||||
messageObj.put("location", locationObj);
|
||||
return messageObj.toString();
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package org.dromara.bigscreen.service;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectSafetyInspectionVo;
|
||||
@ -9,6 +10,7 @@ import org.dromara.project.domain.vo.project.BusProjectSafetyDayVo;
|
||||
import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
@ -75,4 +77,6 @@ public interface ProjectBigScreenService {
|
||||
List<String> getList(Long projectId);
|
||||
|
||||
void setList(GpsEquipmentBo bo);
|
||||
|
||||
List<Map<String, Object>> getClientList(Long projectId);
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@ package org.dromara.bigscreen.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectImageProgressVo;
|
||||
import org.dromara.bigscreen.domain.vo.ProjectPeopleVo;
|
||||
@ -13,10 +15,17 @@ import org.dromara.common.core.constant.HttpStatus;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.redis.utils.RedisUtils;
|
||||
import org.dromara.common.utils.BigDecimalUtil;
|
||||
import org.dromara.common.websocket.dto.WebSocketMessageDto;
|
||||
import org.dromara.common.websocket.utils.WebSocketUtils;
|
||||
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.GpsEquipmentSonVo;
|
||||
import org.dromara.gps.service.IGpsEquipmentService;
|
||||
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.PgsProgressUnitTypeEnum;
|
||||
import org.dromara.progress.service.IPgsProgressCategoryService;
|
||||
@ -28,12 +37,19 @@ import org.dromara.project.domain.vo.projectnews.BusProjectNewsVo;
|
||||
import org.dromara.project.service.*;
|
||||
import org.dromara.safety.domain.HseRecognizeRecord;
|
||||
import org.dromara.safety.service.IHseRecognizeRecordService;
|
||||
import org.redisson.api.RTopic;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.api.listener.MessageListener;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -68,6 +84,17 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
@Resource
|
||||
private IPgsProgressCategoryService progressCategoryService;
|
||||
|
||||
@Resource
|
||||
private IDroProjectDroneService droProjectDroneService;
|
||||
@Resource
|
||||
private IGpsEquipmentService gpsEquipmentService;
|
||||
@Resource
|
||||
private IOthYs7DeviceService othYs7DeviceService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
/**
|
||||
* 获取项目天气
|
||||
*
|
||||
@ -141,8 +168,12 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
// 获取大屏数据
|
||||
ProjectPeopleVo vo = new ProjectPeopleVo();
|
||||
// 获取施工人员总数
|
||||
Long count = constructionUserService.lambdaQuery()
|
||||
.eq(SubConstructionUser::getProjectId, projectId).count();
|
||||
List<SubConstructionUser> list = constructionUserService.lambdaQuery()
|
||||
.eq(SubConstructionUser::getProjectId, projectId)
|
||||
.eq(SubConstructionUser::getUserRole, "0")
|
||||
.isNotNull(SubConstructionUser::getTeamId).list();
|
||||
List<Long> sysUserIdList = list.stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
int count = list.size();
|
||||
BigDecimal countDec = BigDecimal.valueOf(count);
|
||||
vo.setPeopleCount(countDec);
|
||||
// 获取考勤数据
|
||||
@ -156,13 +187,16 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
List<BusProjectTeamMember> memberList = projectTeamMemberService.lambdaQuery()
|
||||
.select(BusProjectTeamMember::getId, BusProjectTeamMember::getTeamId)
|
||||
.eq(BusProjectTeamMember::getProjectId, projectId)
|
||||
.in(BusProjectTeamMember::getMemberId, sysUserIdList)
|
||||
.list();
|
||||
Map<Long, List<BusProjectTeamMember>> memberMap = memberList.stream()
|
||||
.collect(Collectors.groupingBy(BusProjectTeamMember::getTeamId));
|
||||
// 统计班组考勤数据
|
||||
Map<Long, List<SubConstructionUser>> userTeamMap = new HashMap<>();
|
||||
if (CollUtil.isNotEmpty(attendancePeopleList)) {
|
||||
List<SubConstructionUser> users = constructionUserService.listByIds(attendancePeopleList);
|
||||
List<SubConstructionUser> users = constructionUserService.lambdaQuery()
|
||||
.in(SubConstructionUser::getSysUserId, attendancePeopleList)
|
||||
.list();
|
||||
userTeamMap = users.stream()
|
||||
.collect(Collectors.groupingBy(SubConstructionUser::getTeamId));
|
||||
}
|
||||
@ -173,7 +207,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
String punchTime = "";
|
||||
if (punchRange != null) {
|
||||
String start = punchRange.split(",")[0];
|
||||
punchTime = LocalDate.now() + " " + start;
|
||||
punchTime = LocalDate.now() + " ";
|
||||
}
|
||||
List<ProjectTeamAttendanceVo> listVo = new ArrayList<>();
|
||||
for (BusProjectTeam projectTeam : teamList) {
|
||||
@ -218,7 +252,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
return vo;
|
||||
}
|
||||
// 子项目id列表
|
||||
List<Long> subProjectIds = subProjectList.stream().map(BusProject::getId).toList();
|
||||
List<Long> projectIds = new ArrayList<>(subProjectList.stream().map(BusProject::getId).toList());
|
||||
// 计算集电线路
|
||||
vo.setCollectorLinePercentage(BigDecimal.valueOf(0.00));
|
||||
// 计算送出线路
|
||||
@ -232,8 +266,9 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
// 计算箱变
|
||||
vo.setBoxTransformerPercentage(BigDecimal.ZERO);
|
||||
// 获取集电线路、送出线路、升压站数据
|
||||
projectIds.add(projectId);
|
||||
List<PgsProgressCategory> progressCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||
.in(PgsProgressCategory::getProjectId, projectIds)
|
||||
.in(PgsProgressCategory::getName, "集电线路", "送出线路", "升压站", "光伏场区")
|
||||
.eq(PgsProgressCategory::getParentId, 0L)
|
||||
.list();
|
||||
@ -301,7 +336,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
}
|
||||
// 计算道路
|
||||
List<PgsProgressCategory> roadCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||
.in(PgsProgressCategory::getProjectId, projectIds)
|
||||
.like(PgsProgressCategory::getName, "道路")
|
||||
.ne(PgsProgressCategory::getUnitType, PgsProgressUnitTypeEnum.NULL.getValue())
|
||||
.list();
|
||||
@ -313,7 +348,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
}
|
||||
// 计算箱变
|
||||
List<PgsProgressCategory> boxTransformerCategoryList = progressCategoryService.lambdaQuery()
|
||||
.in(PgsProgressCategory::getProjectId, subProjectIds)
|
||||
.in(PgsProgressCategory::getProjectId, projectIds)
|
||||
.like(PgsProgressCategory::getName, "箱变")
|
||||
.ne(PgsProgressCategory::getUnitType, PgsProgressUnitTypeEnum.NULL.getValue())
|
||||
.list();
|
||||
@ -384,4 +419,129 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
}
|
||||
RedisUtils.setCacheObject("xmjdp:"+bo.getProjectId(), bo.getIdList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getClientList(Long projectId) {
|
||||
// 获取当天的开始时间(00:00:00)
|
||||
LocalDateTime startOfDay = LocalDateTime.now().with(LocalTime.MIN);
|
||||
|
||||
// 获取当前时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<GpsEquipmentSonVo> voList = gpsEquipmentService.getClientList(projectId,startOfDay,now);
|
||||
List<GpsEquipmentSonVo> appList = gpsEquipmentService.getUserListByProjectId(projectId,startOfDay,now);
|
||||
List<OthYs7Device> othYs7DeviceList = othYs7DeviceService.lambdaQuery()
|
||||
.eq(OthYs7Device::getProjectId, projectId)
|
||||
.between(OthYs7Device::getUpdateTime, startOfDay, now)
|
||||
.list();
|
||||
List<String> wrjKeys = droProjectDroneService.getTopicsByProjectId(projectId);
|
||||
List<Map<String, Object>> maps = new ArrayList<>();
|
||||
Map<String, Object> gpsMap = new HashMap<>();
|
||||
Map<String, Object> anqmMap = new HashMap<>();
|
||||
Map<String, Object> appMap = new HashMap<>();
|
||||
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<>();
|
||||
if (voList != null && !voList.isEmpty()) {
|
||||
for (GpsEquipmentSonVo item : voList) {
|
||||
Map<String, Object> gps = new HashMap<>();
|
||||
gps.put("id", item.getClientId());
|
||||
gps.put("label", item.getClientId());
|
||||
gps.put("name", item.getDeviceName());
|
||||
gps.put("type", "positioningDevice");
|
||||
gps.put("lat", item.getLocLatitude());
|
||||
gps.put("lng", item.getLocLongitude());
|
||||
gps.put("alt", item.getLocAltitude());
|
||||
sbChildrenMap.add(gps);
|
||||
}
|
||||
}
|
||||
if (appList != null && !appList.isEmpty()) {
|
||||
for (GpsEquipmentSonVo item : appList) {
|
||||
Map<String, Object> app = new HashMap<>();
|
||||
app.put("id", item.getClientId());
|
||||
app.put("label", item.getClientId());
|
||||
app.put("name", item.getDeviceName());
|
||||
app.put("type", "positioningDevice");
|
||||
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 (wrjKeys != null && !wrjKeys.isEmpty()) {
|
||||
for (String key : wrjKeys) {
|
||||
Object object = stringRedisTemplate.opsForValue().get("wrj:" + key);
|
||||
if (object != null) {
|
||||
JSONObject object1 = JSONUtil.parseObj(object);
|
||||
Map<String, Object> wrj = new HashMap<>();
|
||||
wrj.put("id", key);
|
||||
wrj.put("label", key);
|
||||
wrj.put("name", key);
|
||||
wrj.put("type", "wurenji");
|
||||
wrj.put("lat", object1.getJSONObject("data").get("latitude"));
|
||||
wrj.put("lng", object1.getJSONObject("data").get("longitude"));
|
||||
wrjChildrenMap1.add(wrj);
|
||||
}
|
||||
}
|
||||
}
|
||||
gpsChildrenMap.add(sbMap);
|
||||
gpsChildrenMap.add(appMap);
|
||||
gpsChildrenMap.add(anqmMap);
|
||||
sxtChildrenMap.add(sxtMap1);
|
||||
wrjChildrenMap.add(wrjMap1);
|
||||
|
||||
gpsMap.put("id", 1);
|
||||
gpsMap.put("label", "人员定位");
|
||||
gpsMap.put("children", gpsChildrenMap);
|
||||
sbMap.put("id", 4);
|
||||
sbMap.put("label", "设备定位");
|
||||
sbMap.put("children", sbChildrenMap);
|
||||
appMap.put("id", 5);
|
||||
appMap.put("label", "app定位");
|
||||
appMap.put("children", appChildrenMap);
|
||||
anqmMap.put("id", 6);
|
||||
anqmMap.put("label", "安全帽定位");
|
||||
anqmMap.put("children", anqmChildrenMap);
|
||||
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);
|
||||
maps.add(wrjMap);
|
||||
maps.add(sxtMap);
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,6 +76,8 @@ import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.dromara.project.domain.enums.BusAttendanceClockStatusEnum.ATTENDANCE_LIST;
|
||||
|
||||
/**
|
||||
* 施工人员Service业务层处理
|
||||
*
|
||||
@ -180,7 +182,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
if ("2".equals(appUserType)) {
|
||||
List<BusProjectTeamAppVo> byUserId = projectTeamService.getByUserId(userId, req.getProjectId());
|
||||
|
||||
if(CollectionUtil.isEmpty(byUserId)){
|
||||
if (CollectionUtil.isEmpty(byUserId)) {
|
||||
return new TableDataInfo<>();
|
||||
}
|
||||
list1 = byUserId.stream().map(BusProjectTeamAppVo::getId).toList();
|
||||
@ -188,7 +190,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
|
||||
// 查询数据库
|
||||
LambdaQueryWrapper<SubConstructionUser> wrapper = this.buildQueryWrapper(req);
|
||||
wrapper.in(req.getTeamId() == null && "2".equals(appUserType), SubConstructionUser::getTeamId,list1);
|
||||
wrapper.in(req.getTeamId() == null && "2".equals(appUserType), SubConstructionUser::getTeamId, list1);
|
||||
wrapper.eq(SubConstructionUser::getUserRole, "0");
|
||||
Page<SubConstructionUser> result = this.page(pageQuery.build(), wrapper);
|
||||
return TableDataInfo.build(getVoPage(result));
|
||||
@ -230,14 +232,14 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean allocate(AllocateDto dto) {
|
||||
SubConstructionUser constructionUser = baseMapper.selectById(dto.getId());
|
||||
if(constructionUser == null){
|
||||
if (constructionUser == null) {
|
||||
throw new ServiceException("施工人员信息不存在", HttpStatus.ERROR);
|
||||
}
|
||||
constructionUser.setProjectId(dto.getProjectId());
|
||||
constructionUser.setContractorId(dto.getContractorId());
|
||||
|
||||
BusProjectTeam team = projectTeamService.getById(dto.getTeamId());
|
||||
if(team == null){
|
||||
if (team == null) {
|
||||
throw new ServiceException("班组信息不存在", HttpStatus.ERROR);
|
||||
}
|
||||
constructionUser.setTeamId(dto.getTeamId());
|
||||
@ -287,7 +289,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
//强退
|
||||
roleService.cleanOnlineUser(Collections.singletonList(constructionUser.getSysUserId()));
|
||||
|
||||
return i>0;
|
||||
return i > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -853,7 +855,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
String decrypt = constructionUserVo.getSfzNumber();
|
||||
try {
|
||||
decrypt = idCardEncryptorUtil.decrypt(constructionUserVo.getSfzNumber());
|
||||
}catch (Exception e) {
|
||||
} catch (Exception e) {
|
||||
log.error("身份证号码解密失败", e);
|
||||
}
|
||||
constructionUserVo.setSfzNumber(decrypt);
|
||||
@ -1064,7 +1066,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
constructionUserVo.setPostId(one.getPostId());
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
constructionUserVo.setTeamName(null);
|
||||
}
|
||||
|
||||
@ -1084,37 +1086,51 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
@Override
|
||||
public Page<SubConstructionUserAttendanceTotalVo> getAttendanceTotalVoPage(SubConstructionUserAttendanceQueryReq req,
|
||||
PageQuery pageQuery) {
|
||||
String clockMonth = req.getClockDate();
|
||||
if (!DateConstant.YEAR_MONTH_PATTERN.matcher(clockMonth).matches()) {
|
||||
throw new ServiceException("月份格式不正确", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 解析月份
|
||||
YearMonth yearMonth = YearMonth.parse(clockMonth);
|
||||
// 判断是否大于当前月份
|
||||
if (yearMonth.isAfter(YearMonth.now())) {
|
||||
throw new ServiceException("不能查看大于当前月份的记录", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 计算当月第一天 / 最后一天
|
||||
LocalDate start = yearMonth.atDay(1);
|
||||
LocalDate end = yearMonth.atEndOfMonth();
|
||||
|
||||
LambdaQueryWrapper<SubConstructionUser> lqw = Wrappers.lambdaQuery();
|
||||
// 从对象中取值
|
||||
String userName = req.getUserName();
|
||||
Long projectId = req.getProjectId();
|
||||
Long teamId = req.getTeamId();
|
||||
String typeOfWork = req.getTypeOfWork();
|
||||
String clockMonth = req.getClockDate();
|
||||
|
||||
// 联表查询
|
||||
LambdaQueryWrapper<BusAttendance> attendanceLqw = Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, projectId);
|
||||
if (ObjectUtils.isNotEmpty(clockMonth)) {
|
||||
// 校验月份格式
|
||||
if (!DateConstant.YEAR_MONTH_PATTERN.matcher(clockMonth).matches()) {
|
||||
throw new ServiceException("月份格式不正确", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 解析月份
|
||||
YearMonth yearMonth = YearMonth.parse(clockMonth);
|
||||
// 判断是否大于当前月份
|
||||
if (yearMonth.isAfter(YearMonth.now())) {
|
||||
throw new ServiceException("不能查看大于当前月份的记录", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
// 计算当月第一天 / 最后一天
|
||||
LocalDate start = yearMonth.atDay(1);
|
||||
LocalDate end = yearMonth.atEndOfMonth();
|
||||
attendanceLqw.between(BusAttendance::getClockDate, start, end);
|
||||
List<Long> userIdList = attendanceService.list(attendanceLqw)
|
||||
.stream().map(BusAttendance::getUserId).toList();
|
||||
if (CollUtil.isNotEmpty(userIdList)) {
|
||||
lqw.in(SubConstructionUser::getSysUserId, userIdList);
|
||||
}
|
||||
}
|
||||
// if (ObjectUtils.isNotEmpty(clockMonth)) {
|
||||
// // 校验月份格式
|
||||
// if (!DateConstant.YEAR_MONTH_PATTERN.matcher(clockMonth).matches()) {
|
||||
// throw new ServiceException("月份格式不正确", HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
// // 解析月份
|
||||
// YearMonth yearMonth = YearMonth.parse(clockMonth);
|
||||
// // 判断是否大于当前月份
|
||||
// if (yearMonth.isAfter(YearMonth.now())) {
|
||||
// throw new ServiceException("不能查看大于当前月份的记录", HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
// // 计算当月第一天 / 最后一天
|
||||
// LocalDate start = yearMonth.atDay(1);
|
||||
// LocalDate end = yearMonth.atEndOfMonth();
|
||||
// attendanceLqw.between(BusAttendance::getClockDate, start, end);
|
||||
// List<Long> userIdList = attendanceService.list(attendanceLqw)
|
||||
// .stream().map(BusAttendance::getUserId).toList();
|
||||
// if (CollUtil.isNotEmpty(userIdList)) {
|
||||
// lqw.in(SubConstructionUser::getSysUserId, userIdList);
|
||||
// }
|
||||
// }
|
||||
// 模糊查询
|
||||
lqw.like(StringUtils.isNotBlank(userName), SubConstructionUser::getUserName, userName);
|
||||
// 精确查询
|
||||
@ -1129,6 +1145,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
}
|
||||
//只查施工人员
|
||||
lqw.eq(SubConstructionUser::getUserRole, "0");
|
||||
lqw.isNotNull(SubConstructionUser::getTeamId);
|
||||
// 分页查询获取数据
|
||||
Page<SubConstructionUser> constructionUserPage = this.page(pageQuery.build(), lqw);
|
||||
List<SubConstructionUser> constructionUserList = constructionUserPage.getRecords();
|
||||
@ -1143,6 +1160,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
List<Long> userIdList = constructionUserList.stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
// 关联查询施工人员考勤列表
|
||||
attendanceLqw.in(BusAttendance::getUserId, userIdList);
|
||||
attendanceLqw.between(BusAttendance::getClockDate, start, end);
|
||||
Map<Long, List<BusAttendance>> userIdBusAttendanceListMap = attendanceService.list(attendanceLqw)
|
||||
.stream().collect(Collectors.groupingBy(BusAttendance::getUserId));
|
||||
// 填充信息
|
||||
@ -1194,8 +1212,12 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
unClockDays++;
|
||||
}
|
||||
}
|
||||
if ((clockInStatus != null && ATTENDANCE_LIST.contains(clockInStatus))
|
||||
|| (clockOutStatus != null && ATTENDANCE_LIST.contains(clockOutStatus))) {
|
||||
attendanceDays++;
|
||||
}
|
||||
|
||||
}
|
||||
attendanceDays = dailyMap.size() - leaveDays;
|
||||
}
|
||||
}
|
||||
constructionUserAttendanceTotalResp.setAttendanceDays(attendanceDays);
|
||||
@ -1261,12 +1283,12 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
vo.setGender(wordsResult.getGender() != null ? wordsResult.getGender().getWords() : "");
|
||||
vo.setImage(upload);
|
||||
} else {
|
||||
if (wordsResult.getExpiryDate() != null ) {
|
||||
if (wordsResult.getExpiryDate() != null) {
|
||||
vo.setExpiryDate(wordsResult.getExpiryDate().getWords());
|
||||
if ("长期".equals(wordsResult.getExpiryDate().getWords())) {
|
||||
vo.setExpiryDate("99991231");
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
vo.setExpiryDate("");
|
||||
}
|
||||
vo.setIssuingAuthority(wordsResult.getIssuingAuthority() != null ? wordsResult.getIssuingAuthority().getWords() : "");
|
||||
@ -1488,9 +1510,9 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
lqw.eq(ObjectUtils.isNotEmpty(typeOfWork), SubConstructionUser::getTypeOfWork, typeOfWork);
|
||||
|
||||
lqw.isNull(SubConstructionUser::getTeamId);
|
||||
if(req.getProjectId() == null){
|
||||
if (req.getProjectId() == null) {
|
||||
lqw.isNull(SubConstructionUser::getProjectId);
|
||||
}else{
|
||||
} else {
|
||||
lqw.eq(SubConstructionUser::getProjectId, req.getProjectId());
|
||||
}
|
||||
Page<SubConstructionUser> result = this.page(pageQuery.build(), lqw);
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
package org.dromara.drone.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.drone.domain.DroProjectDrone;
|
||||
import org.dromara.drone.domain.vo.DroProjectDroneVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目无人机信息Mapper接口
|
||||
*
|
||||
@ -12,4 +15,7 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
*/
|
||||
public interface DroProjectDroneMapper extends BaseMapperPlus<DroProjectDrone, DroProjectDroneVo> {
|
||||
|
||||
List<String> getTopicsByKeyPrefix();
|
||||
|
||||
List<String> getTopicsByProjectId(@Param("projectId") Long projectId);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package org.dromara.drone.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.drone.domain.DroProjectDrone;
|
||||
@ -74,4 +75,12 @@ public interface IDroProjectDroneService extends IService<DroProjectDrone> {
|
||||
* @param projectId 项目id
|
||||
*/
|
||||
Boolean addDroneMsgByProject(Long projectId);
|
||||
|
||||
/**
|
||||
* 查询所有无人机序列号
|
||||
* @return
|
||||
*/
|
||||
List<String> getTopicsByKeyPrefix();
|
||||
|
||||
List<String> getTopicsByProjectId(Long projectId);
|
||||
}
|
||||
|
||||
@ -145,4 +145,14 @@ public class DroProjectDroneServiceImpl extends ServiceImpl<DroProjectDroneMappe
|
||||
droneManager.addAirportInfoByProject(list.stream().map(DroProjectDrone::getDroneSn).toList(), projectId);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTopicsByKeyPrefix() {
|
||||
return baseMapper.getTopicsByKeyPrefix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTopicsByProjectId(Long projectId) {
|
||||
return baseMapper.getTopicsByProjectId(projectId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,8 @@ public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, G
|
||||
" FROM\n" +
|
||||
" gps_equipment_son \n" +
|
||||
"WHERE \n" +
|
||||
"project_id = #{projectId}\n" +
|
||||
"project_id = #{projectId} \n " +
|
||||
"AND create_time BETWEEN #{startTime} AND #{endTime}\n" +
|
||||
")\n" +
|
||||
"SELECT\n" +
|
||||
" *\n" +
|
||||
@ -32,7 +33,7 @@ public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, G
|
||||
" RankedData\n" +
|
||||
"WHERE\n" +
|
||||
" rn = 1;")
|
||||
List<GpsEquipmentSonVo> getClientList(@Param("projectId") Long projectId);
|
||||
List<GpsEquipmentSonVo> getClientList(@Param("projectId") Long projectId, @Param("startTime") LocalDateTime startOfDay, @Param("endTime") LocalDateTime now);
|
||||
|
||||
@Select("SELECT loc_latitude AS locLatitude," +
|
||||
" loc_longitude AS locLongitude " +
|
||||
@ -56,4 +57,23 @@ public interface GpsEquipmentSonMapper extends BaseMapperPlus<GpsEquipmentSon, G
|
||||
"FROM ges " +
|
||||
"WHERE rn=1;")
|
||||
List<GpsEquipmentSonVo> 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" +
|
||||
" gps_equipment_son \n " +
|
||||
"WHERE \n" +
|
||||
"project_id = #{projectId}\n " +
|
||||
"AND client_id IS NULL \n" +
|
||||
"AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
|
||||
")\n" +
|
||||
"SELECT\n" +
|
||||
" *\n" +
|
||||
"FROM\n" +
|
||||
" RankedData\n" +
|
||||
"WHERE\n" +
|
||||
" rn = 1;")
|
||||
List<GpsEquipmentSonVo> getUserListByProjectId(@Param("projectId") Long projectId, @Param("startTime") LocalDateTime startOfDay, @Param("endTime") LocalDateTime now);
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.gps.domain.vo.GpsProjectVo;
|
||||
import org.dromara.gps.domain.vo.GpsUserVo;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -96,7 +97,9 @@ public interface IGpsEquipmentService extends IService<GpsEquipment>{
|
||||
|
||||
List<GpsProjectVo> getProjectList();
|
||||
|
||||
List<GpsEquipmentSonVo> getClientList(Long projectId);
|
||||
List<GpsEquipmentSonVo> getClientList(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
|
||||
void setData(String jsonData);
|
||||
|
||||
List<GpsEquipmentSonVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ 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;
|
||||
import java.util.Map;
|
||||
@ -69,9 +71,11 @@ public interface IGpsEquipmentSonService extends IService<GpsEquipmentSon>{
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
List<GpsEquipmentSonVo> getClientList(Long projectId);
|
||||
List<GpsEquipmentSonVo> getClientList(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
|
||||
Map<String, Object> getAppList(GpsEquipmentSonBo bo);
|
||||
|
||||
List<GpsEquipmentSonVo> getLargerScreenList(GpsEquipmentSonBo bo);
|
||||
|
||||
List<GpsEquipmentSonVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now);
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package org.dromara.gps.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
@ -45,6 +44,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -432,8 +432,8 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GpsEquipmentSonVo> getClientList(Long projectId) {
|
||||
return gpsEquipmentSonService.getClientList(projectId);
|
||||
public List<GpsEquipmentSonVo> getClientList(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
|
||||
return gpsEquipmentSonService.getClientList(projectId,startOfDay,now);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -477,5 +477,10 @@ public class GpsEquipmentServiceImpl extends ServiceImpl<GpsEquipmentMapper, Gps
|
||||
updateDeviceAliveStatus(gpsEquipment.getClientId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GpsEquipmentSonVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
|
||||
return gpsEquipmentSonService.getUserListByProjectId(projectId,startOfDay,now);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
package org.dromara.gps.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.dromara.common.core.service.OssService;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
@ -26,6 +24,7 @@ import org.dromara.gps.domain.GpsEquipmentSon;
|
||||
import org.dromara.gps.mapper.GpsEquipmentSonMapper;
|
||||
import org.dromara.gps.service.IGpsEquipmentSonService;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -157,8 +156,8 @@ public class GpsEquipmentSonServiceImpl extends ServiceImpl<GpsEquipmentSonMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GpsEquipmentSonVo> getClientList(Long projectId) {
|
||||
return baseMapper.getClientList(projectId);
|
||||
public List<GpsEquipmentSonVo> getClientList(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
|
||||
return baseMapper.getClientList(projectId,startOfDay,now);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -190,4 +189,9 @@ public class GpsEquipmentSonServiceImpl extends ServiceImpl<GpsEquipmentSonMappe
|
||||
}
|
||||
return gpsEquipmentSonVoList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GpsEquipmentSonVo> getUserListByProjectId(Long projectId, LocalDateTime startOfDay, LocalDateTime now) {
|
||||
return baseMapper.getUserListByProjectId(projectId,startOfDay,now);
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,7 +148,8 @@ public class AttendanceJob {
|
||||
busAttendance.setClockDate(date);
|
||||
busAttendance.setClockType(BusAttendanceCommuterEnum.CLOCKIN.getValue());
|
||||
busAttendance.setRuleTime(rule.getClockInTime());
|
||||
if (leaveService.isLeave(date, sysUserId)) {
|
||||
LocalDateTime localDateTime = date.atTime(clockInTime);
|
||||
if (leaveService.isLeave(localDateTime, sysUserId)) {
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue());
|
||||
} else {
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.UNCLOCK.getValue());
|
||||
@ -268,7 +269,8 @@ public class AttendanceJob {
|
||||
busAttendance.setClockDate(date);
|
||||
busAttendance.setClockType(BusAttendanceCommuterEnum.CLOCKOUT.getValue());
|
||||
busAttendance.setRuleTime(rule.getClockOutTime());
|
||||
if (leaveService.isLeave(date, sysUserId)) {
|
||||
LocalDateTime localDateTime = date.atTime(clockOutTime);
|
||||
if (leaveService.isLeave(localDateTime, sysUserId)) {
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue());
|
||||
} else {
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.UNCLOCK.getValue());
|
||||
|
||||
@ -10,6 +10,7 @@ import org.dromara.other.domain.enums.OthDeviceStatusEnum;
|
||||
import org.dromara.other.service.IOthDevicePresetService;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
import org.dromara.other.service.IOthYs7DeviceService;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -26,7 +27,8 @@ import java.util.stream.Collectors;
|
||||
* @date 2025/6/18 15:59
|
||||
*/
|
||||
@Slf4j
|
||||
//@Component
|
||||
@Component
|
||||
@ConditionalOnProperty(prefix = "ys7.job", name = "capture-enabled", havingValue = "true")
|
||||
public class IncSyncYs7DeviceCapturePicData {
|
||||
|
||||
@Resource
|
||||
@ -43,9 +45,10 @@ public class IncSyncYs7DeviceCapturePicData {
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||
|
||||
// 每 30 分钟执行一次
|
||||
@Scheduled(cron = "0 */30 7-19 * * ?")
|
||||
// 每 15 分钟执行一次
|
||||
@Scheduled(cron = "0 */10 7-19 * * ?")
|
||||
public void run() {
|
||||
log.info("执行萤石设备抓拍图片");
|
||||
// 查询所有在线的摄像头设备,仅获取必要字段
|
||||
List<OthYs7Device> deviceList = ys7DeviceService.lambdaQuery()
|
||||
.select(OthYs7Device::getId, OthYs7Device::getDeviceSerial, OthYs7Device::getDeviceName)
|
||||
|
||||
@ -102,7 +102,7 @@ public class OthYs7DeviceController extends BaseController {
|
||||
/**
|
||||
* 修改萤石摄像头所属项目
|
||||
*/
|
||||
@SaCheckPermission("other:ys7Device:withProject")
|
||||
@SaCheckPermission("other:ys7Device:edit")
|
||||
@Log(title = "萤石摄像头", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/with/project")
|
||||
@ -113,7 +113,7 @@ public class OthYs7DeviceController extends BaseController {
|
||||
/**
|
||||
* 修改萤石摄像头视频加密
|
||||
*/
|
||||
@SaCheckPermission("other:ys7Device:videoEncrypted")
|
||||
@SaCheckPermission("other:ys7Device:edit")
|
||||
@Log(title = "萤石摄像头", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/video/encrypted")
|
||||
|
||||
@ -12,6 +12,7 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
@ -66,6 +67,16 @@ public class OthYs7DeviceImgController extends BaseController {
|
||||
return R.ok(othYs7DeviceImgService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 萤石摄像头图片抓图
|
||||
*/
|
||||
@SaCheckPermission("other:ys7DeviceImg:capture")
|
||||
@Log(title = "萤石摄像头图片", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/capture")
|
||||
public R<Void> capture(@RequestBody OthYs7DeviceImgCaptureReq req) {
|
||||
return toAjax(othYs7DeviceImgService.capturePic(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除萤石摄像头图片
|
||||
*
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package org.dromara.other.domain.dto.ys7deviceimg;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author lilemy
|
||||
* @date 2025-10-10 19:14
|
||||
*/
|
||||
@Data
|
||||
public class OthYs7DeviceImgCaptureReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 678123111752523000L;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@NotBlank(message = "设备序列号不能为空")
|
||||
private String deviceSerial;
|
||||
}
|
||||
@ -6,6 +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.other.domain.OthYs7DeviceImg;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCreateByCapture;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
@ -93,4 +94,12 @@ public interface IOthYs7DeviceImgService extends IService<OthYs7DeviceImg> {
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 抓拍图片
|
||||
*
|
||||
* @param req 抓拍图片参数
|
||||
* @return 是否抓拍成功
|
||||
*/
|
||||
Boolean capturePic(OthYs7DeviceImgCaptureReq req);
|
||||
}
|
||||
|
||||
@ -20,13 +20,17 @@ import org.dromara.manager.recognizermanager.enums.RecognizerTypeEnum;
|
||||
import org.dromara.manager.recognizermanager.vo.RecognizeImageStreamResult;
|
||||
import org.dromara.manager.recognizermanager.vo.RecognizeTargetVo;
|
||||
import org.dromara.manager.recognizermanager.vo.RecognizeVo;
|
||||
import org.dromara.manager.ys7manager.Ys7Manager;
|
||||
import org.dromara.other.constant.Ys7DeviceImgConstant;
|
||||
import org.dromara.other.domain.OthYs7Device;
|
||||
import org.dromara.other.domain.OthYs7DeviceImg;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCaptureReq;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgCreateByCapture;
|
||||
import org.dromara.other.domain.dto.ys7deviceimg.OthYs7DeviceImgQueryReq;
|
||||
import org.dromara.other.domain.vo.ys7deviceimg.OthYs7DeviceImgVo;
|
||||
import org.dromara.other.mapper.OthYs7DeviceImgMapper;
|
||||
import org.dromara.other.service.IOthYs7DeviceImgService;
|
||||
import org.dromara.other.service.IOthYs7DeviceService;
|
||||
import org.dromara.safety.domain.dto.recognizerecord.HseRecognizeRecordCreateDto;
|
||||
import org.dromara.safety.domain.enums.HseRecordCategoryEnum;
|
||||
import org.dromara.safety.service.IHseRecognizeRecordService;
|
||||
@ -62,6 +66,12 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
||||
@Resource
|
||||
private IHseRecognizeRecordService recognizeRecordService;
|
||||
|
||||
@Resource
|
||||
private IOthYs7DeviceService ys7DeviceService;
|
||||
|
||||
@Resource
|
||||
private Ys7Manager ys7Manager;
|
||||
|
||||
/**
|
||||
* 查询萤石摄像头图片
|
||||
*
|
||||
@ -317,6 +327,40 @@ public class OthYs7DeviceImgServiceImpl extends ServiceImpl<OthYs7DeviceImgMappe
|
||||
return this.removeBatchByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 抓拍图片
|
||||
*
|
||||
* @param req 抓拍图片参数
|
||||
* @return 是否抓拍成功
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean capturePic(OthYs7DeviceImgCaptureReq req) {
|
||||
OthYs7Device ys7Device = ys7DeviceService.lambdaQuery()
|
||||
.eq(OthYs7Device::getDeviceSerial, req.getDeviceSerial())
|
||||
.last("limit 1")
|
||||
.one();
|
||||
if (ys7Device == null) {
|
||||
throw new ServiceException("设备不存在", HttpStatus.ERROR);
|
||||
}
|
||||
String deviceSerial = ys7Device.getDeviceSerial();
|
||||
// 如果没有预置位,则直接对默认通道抓图
|
||||
OthYs7DeviceImgCreateByCapture img = new OthYs7DeviceImgCreateByCapture();
|
||||
img.setProjectId(ys7Device.getProjectId());
|
||||
img.setDeviceSerial(deviceSerial);
|
||||
img.setDeviceName(ys7Device.getDeviceName());
|
||||
try {
|
||||
String url = ys7Manager.getCaptureDevicePic(deviceSerial, 1, 2);
|
||||
img.setCreateTime(new Date());
|
||||
img.setUrl(url);
|
||||
} catch (Exception e) {
|
||||
log.error("摄像头 {} 抓图失败:{}", deviceSerial, e.getMessage());
|
||||
throw new ServiceException("摄像头 " + deviceSerial + " 抓图失败:" + e.getMessage(), HttpStatus.ERROR);
|
||||
}
|
||||
this.saveCapturePic(List.of(img));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取文件名
|
||||
*
|
||||
|
||||
@ -7,7 +7,10 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.project.domain.dto.attendance.*;
|
||||
import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq;
|
||||
import org.dromara.project.domain.vo.attendance.*;
|
||||
import org.dromara.project.domain.vo.projectteam.BusProjectTeamVo;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@ -38,6 +41,8 @@ public class BusAttendanceController extends BaseController {
|
||||
|
||||
private final IBusAttendanceService busAttendanceService;
|
||||
|
||||
private final IBusProjectTeamService projectTeamService;
|
||||
|
||||
/**
|
||||
* 查询考勤列表
|
||||
*/
|
||||
@ -114,10 +119,19 @@ public class BusAttendanceController extends BaseController {
|
||||
return toAjax(busAttendanceService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询项目施工人员前14天考勤状况
|
||||
*/
|
||||
@GetMapping("/list/clockDate/twoWeek")
|
||||
public R<List<BusAttendanceClockDateForTwoWeekVo>> getClockDateForTwoWeekList(Long projectId) {
|
||||
return R.ok(busAttendanceService.getClockDateForTwoWeekList(projectId));
|
||||
public R<List<BusAttendanceClockDateForTwoWeekVo>> getClockDateForTwoWeekList(TwoWeekDto dto) {
|
||||
return R.ok(busAttendanceService.getClockDateForTwoWeekList(dto));
|
||||
}
|
||||
/**
|
||||
* 查询项目施工人员当天考勤状况
|
||||
*/
|
||||
@GetMapping("/list/clockDate/today")
|
||||
public R<BusAttendanceClockDateForTwoWeekVo> getTodayAttendanceData(TwoWeekDto dto) {
|
||||
return R.ok(busAttendanceService.getTodayAttendanceData(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/exportList")
|
||||
@ -125,4 +139,13 @@ public class BusAttendanceController extends BaseController {
|
||||
busAttendanceService.getExportList(dto, response);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/listByProject/{projectid}")
|
||||
public R<List<BusProjectTeamVo>> listByProject(@NotNull(message = "项目id不能为空")
|
||||
@PathVariable Long projectid) {
|
||||
BusProjectTeamQueryReq busProjectTeamQueryReq = new BusProjectTeamQueryReq();
|
||||
busProjectTeamQueryReq.setProjectId(projectid);
|
||||
return R.ok(projectTeamService.queryList(busProjectTeamQueryReq));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,6 +14,9 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.domain.dto.contractor.SubContractorQueryReq;
|
||||
import org.dromara.contractor.domain.vo.contractor.SubContractorVo;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.bo.BusProjectPunchrangeBo;
|
||||
import org.dromara.project.domain.dto.projectteam.BusProjectTeamCreateReq;
|
||||
import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq;
|
||||
@ -48,6 +51,8 @@ public class BusProjectTeamController extends BaseController {
|
||||
private final IBusProjectPunchrangeService busProjectPunchrangeService;
|
||||
|
||||
private final ISysUserService userService;
|
||||
|
||||
private final ISubContractorService contractorService;
|
||||
/**
|
||||
* 查询项目班组列表
|
||||
*/
|
||||
@ -138,8 +143,8 @@ public class BusProjectTeamController extends BaseController {
|
||||
* 获取所有分包管理人员
|
||||
*/
|
||||
@GetMapping("/listSubContractor")
|
||||
public R<List<SysUserVo>> listSubContractor(Long projectId) {
|
||||
return R.ok(userService.selectUserListByAppUserType("2",projectId));
|
||||
public R<List<SysUserVo>> listSubContractor(Long projectId,Long contractorId) {
|
||||
return R.ok(userService.selectUserListByAppUserType("2",projectId,contractorId));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,4 +165,12 @@ public class BusProjectTeamController extends BaseController {
|
||||
return R.ok(busProjectTeamService.deleteUserId(id,userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询分包单位列表
|
||||
*/
|
||||
@GetMapping("/contractorList")
|
||||
public R<List<SubContractorVo>> contractorList(SubContractorQueryReq req) {
|
||||
return R.ok(contractorService.queryList(req));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -128,8 +128,8 @@ public class BusAttendanceAppController extends BaseController {
|
||||
* 获取用户打卡异常记录
|
||||
*/
|
||||
@GetMapping("/getAbnormalAttendance/{projectId}")
|
||||
public R<List<BusAttendanceVo>> getAbnormalAttendance(@NotNull @PathVariable("projectId") Long projectId){
|
||||
return R.ok(attendanceService.getAbnormalAttendance(projectId));
|
||||
public TableDataInfo<BusAttendanceVo> getAbnormalAttendance(@NotNull @PathVariable("projectId") Long projectId, PageQuery pageQuery){
|
||||
return attendanceService.getAbnormalAttendance(projectId,pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -108,4 +108,9 @@ public class BusAttendance extends BaseEntity {
|
||||
* 薪水
|
||||
*/
|
||||
private BigDecimal salary;
|
||||
|
||||
/**
|
||||
* 代打卡人员Id
|
||||
*/
|
||||
private Long replaceId;
|
||||
}
|
||||
|
||||
@ -140,4 +140,13 @@ public class BusLeave extends BaseEntity {
|
||||
*/
|
||||
private String auditStatus;
|
||||
|
||||
/**
|
||||
* 时间类型 1-天 2-小时
|
||||
*/
|
||||
private String timeType;
|
||||
|
||||
/**
|
||||
* 时间段类型 1-上午 2-下午
|
||||
*/
|
||||
private String periodType;
|
||||
}
|
||||
|
||||
@ -57,4 +57,9 @@ public class BusProjectTeam extends BaseEntity {
|
||||
* 管理员Id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 分包公司Id
|
||||
*/
|
||||
private Long contractorId;
|
||||
}
|
||||
|
||||
@ -36,4 +36,9 @@ public class BusAttendancePunchCardByFaceReq implements Serializable {
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 用户Id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package org.dromara.project.domain.dto.attendance;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TwoWeekDto {
|
||||
|
||||
/**
|
||||
* 人员姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 班组id
|
||||
*/
|
||||
private Long teamId;
|
||||
|
||||
/**
|
||||
* 工种
|
||||
*/
|
||||
private String typeOfWork;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
}
|
||||
@ -51,4 +51,9 @@ public class BusProjectTeamCreateReq implements Serializable {
|
||||
* 管理员Id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 分包公司Id
|
||||
*/
|
||||
private Long contractorId;
|
||||
}
|
||||
|
||||
@ -52,4 +52,9 @@ public class BusProjectTeamUpdateReq implements Serializable {
|
||||
* 管理员Id
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 分包公司Id
|
||||
*/
|
||||
private Long contractorId;
|
||||
}
|
||||
|
||||
@ -88,4 +88,11 @@ public class BusProjectTeamVo implements Serializable {
|
||||
* 打卡范围
|
||||
*/
|
||||
List<String> punchRangeList;
|
||||
|
||||
/**
|
||||
* 分包公司Id
|
||||
*/
|
||||
private Long contractorId;
|
||||
|
||||
private String contractorName;
|
||||
}
|
||||
|
||||
@ -76,4 +76,9 @@ public class BusProjectTeamMemberVo implements Serializable {
|
||||
@ExcelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package org.dromara.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.project.domain.dto.attendance.*;
|
||||
import org.dromara.project.domain.vo.BusAttendanceVo;
|
||||
import org.dromara.project.domain.bo.BusAttendanceBo;
|
||||
@ -13,12 +13,9 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.project.domain.vo.BusMonthAttendanceVo;
|
||||
import org.dromara.project.domain.vo.attendance.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -132,9 +129,9 @@ public interface IBusAttendanceService extends IService<BusAttendance>{
|
||||
List<BusMonthAttendanceVo> getMonthAttendance(Long projectId, String month);
|
||||
|
||||
/**
|
||||
* 获取用户指定月份的打卡记录
|
||||
* 获取用户打卡异常记录
|
||||
*/
|
||||
List<BusAttendanceVo> getAbnormalAttendance(@NotNull @PathVariable("projectId") Long projectId);
|
||||
TableDataInfo<BusAttendanceVo> getAbnormalAttendance(@NotNull @PathVariable("projectId") Long projectId, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 统计指定日期的打卡人员
|
||||
@ -165,7 +162,12 @@ public interface IBusAttendanceService extends IService<BusAttendance>{
|
||||
/**
|
||||
* 近两周打卡统计
|
||||
*/
|
||||
List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(Long projectId);
|
||||
List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(TwoWeekDto dto);
|
||||
|
||||
/**
|
||||
* 获取项目当天的考勤数据
|
||||
*/
|
||||
BusAttendanceClockDateForTwoWeekVo getTodayAttendanceData(TwoWeekDto dto);
|
||||
|
||||
/**
|
||||
* 获取导出的考勤数据
|
||||
|
||||
@ -13,6 +13,7 @@ import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -101,7 +102,7 @@ public interface IBusLeaveService extends IService<BusLeave> {
|
||||
/**
|
||||
* 查询是否请假
|
||||
*/
|
||||
Boolean isLeave(LocalDate date,Long userId);
|
||||
Boolean isLeave(LocalDateTime clockTime, Long userId);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -64,6 +65,8 @@ import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.dromara.project.domain.enums.BusAttendanceClockStatusEnum.ATTENDANCE_LIST;
|
||||
|
||||
/**
|
||||
* 考勤Service业务层处理
|
||||
*
|
||||
@ -316,25 +319,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
public Boolean punchCardByFace(MultipartFile file, BusAttendancePunchCardByFaceReq req) {
|
||||
// 获取当前用户
|
||||
Long userId = LoginHelper.getUserId();
|
||||
Long replaceId = null;
|
||||
if(req.getUserId()!=null){
|
||||
userId = req.getUserId();
|
||||
replaceId = LoginHelper.getUserId();
|
||||
}
|
||||
synchronized (userId.toString().intern()) {
|
||||
// 记录当前打卡时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
//打卡范围
|
||||
if (!checkInRange(req)) {
|
||||
throw new ServiceException("打卡位置不在范围内", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("打卡位置不在范围内", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
//用户信息校验
|
||||
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(userId);
|
||||
final String status = "1";
|
||||
if (constructionUser.getStatus().equals(status)) {
|
||||
throw new ServiceException("当前用户已离职", HttpStatus.BAD_REQUEST);
|
||||
if ("1".equals(constructionUser.getStatus())) {
|
||||
throw new ServiceException("当前用户已离职", HttpStatus.ERROR);
|
||||
}
|
||||
final String noClock = "1";
|
||||
if (constructionUser.getClock().equals(noClock)) {
|
||||
throw new ServiceException("当前用户已被禁止打卡", HttpStatus.BAD_REQUEST);
|
||||
if ("1".equals(constructionUser.getClock())) {
|
||||
throw new ServiceException("当前用户已被禁止打卡", HttpStatus.ERROR);
|
||||
}
|
||||
//施工人员需要判断工资
|
||||
if("0".equals(constructionUser.getUserRole())){
|
||||
String typeOfWork = constructionUser.getTypeOfWork();
|
||||
BusWorkWage workWageByWorkType = workWageService.getWorkWageByWorkType(typeOfWork);
|
||||
if(constructionUser.getSalary().compareTo(BigDecimal.ZERO)==0 && workWageByWorkType == null){
|
||||
throw new ServiceException("当前用户没有设置工资,禁止打卡", HttpStatus.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
// 判断用户是否已经被拉黑
|
||||
constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), req.getProjectId());
|
||||
Boolean result = false;
|
||||
@ -342,30 +357,25 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
try {
|
||||
result = constructionUserService.faceComparison(file);
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
//打卡规则
|
||||
BusAttendanceRuleVo busAttendanceRuleVo = attendanceRuleService.queryByProjectId(req.getProjectId());
|
||||
|
||||
if (busAttendanceRuleVo == null) {
|
||||
throw new ServiceException("未设置打卡规则", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("未设置打卡规则", HttpStatus.ERROR);
|
||||
}
|
||||
|
||||
// 考勤时间
|
||||
//确定考勤日期
|
||||
LocalDate localDate = calculateAttendanceDate(now, busAttendanceRuleVo);
|
||||
|
||||
if (leaveService.isLeave(localDate, userId)) {
|
||||
throw new ServiceException("当前用户正在请假中", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
// 判断当前用户打卡状态
|
||||
|
||||
int clockTypeByTime = getClockTypeByTime(localDate, now, busAttendanceRuleVo);
|
||||
|
||||
List<BusAttendance> attendances = this.lambdaQuery()
|
||||
@ -390,24 +400,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
} else {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue());
|
||||
}
|
||||
//只要请假,直接归为请假
|
||||
LocalDateTime localDateTime = localDate.atTime(busAttendanceRuleVo.getClockInTime());
|
||||
if(leaveService.isLeave(localDateTime,userId)){
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue());
|
||||
}
|
||||
|
||||
// 填充信息
|
||||
attendance.setUserId(userId);
|
||||
attendance.setProjectId(req.getProjectId());
|
||||
attendance.setClockDate(localDate);
|
||||
attendance.setClockTime(now);
|
||||
attendance.setUserName(constructionUser.getUserName());
|
||||
attendance.setReplaceId(replaceId);
|
||||
// 记录打卡坐标
|
||||
attendance.setLat(req.getLat());
|
||||
attendance.setLng(req.getLng());
|
||||
attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng()));
|
||||
try {
|
||||
attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng()));
|
||||
}catch (Exception e) {
|
||||
log.error("获取打卡位置失败", e);
|
||||
}
|
||||
|
||||
// 上传人脸照
|
||||
SysOssVo upload = ossService.upload(file);
|
||||
attendance.setFacePic(upload.getOssId().toString());
|
||||
Long finalUserId = userId;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
chatServerHandler.sendSystemMessageToUser(userId, "打卡成功", "1");
|
||||
chatServerHandler.sendSystemMessageToUser(finalUserId, "打卡成功", "1");
|
||||
} catch (Exception e) {
|
||||
log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", userId, "打卡成功", e);
|
||||
log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", finalUserId, "打卡成功", e);
|
||||
}
|
||||
});
|
||||
//计算工资
|
||||
@ -431,6 +454,11 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue());
|
||||
busAttendance.setMinuteCount(0);
|
||||
}
|
||||
//只要请假,直接归为请假
|
||||
LocalDateTime localDateTime = localDate.atTime(busAttendanceRuleVo.getClockInTime());
|
||||
if(leaveService.isLeave(localDateTime,userId)){
|
||||
busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue());
|
||||
}
|
||||
updateById(busAttendance);
|
||||
} else {
|
||||
BusAttendance attendance = new BusAttendance();
|
||||
@ -444,25 +472,36 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
} else {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue());
|
||||
}
|
||||
//只要请假,直接归为请假
|
||||
LocalDateTime localDateTime = localDate.atTime(busAttendanceRuleVo.getClockInTime());
|
||||
if(leaveService.isLeave(localDateTime,userId)){
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue());
|
||||
}
|
||||
// 填充信息
|
||||
attendance.setUserId(userId);
|
||||
attendance.setProjectId(req.getProjectId());
|
||||
attendance.setClockDate(localDate);
|
||||
attendance.setClockTime(now);
|
||||
attendance.setUserName(constructionUser.getUserName());
|
||||
attendance.setReplaceId(replaceId);
|
||||
// 记录打卡坐标
|
||||
attendance.setLat(req.getLat());
|
||||
attendance.setLng(req.getLng());
|
||||
attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng()));
|
||||
try {
|
||||
attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng()));
|
||||
}catch (Exception e) {
|
||||
log.error("获取打卡位置失败", e);
|
||||
}
|
||||
// 上传人脸照
|
||||
SysOssVo upload = ossService.upload(file);
|
||||
attendance.setFacePic(upload.getOssId().toString());
|
||||
|
||||
Long finalUserId1 = userId;
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
chatServerHandler.sendSystemMessageToUser(userId, "打卡成功", "1");
|
||||
chatServerHandler.sendSystemMessageToUser(finalUserId1, "打卡成功", "1");
|
||||
} catch (Exception e) {
|
||||
log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", userId, "打卡成功", e);
|
||||
log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", finalUserId1, "打卡成功", e);
|
||||
}
|
||||
});
|
||||
//计算工资
|
||||
@ -589,6 +628,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
Long userId = LoginHelper.getUserId();
|
||||
Long projectId = req.getProjectId();
|
||||
|
||||
SysUserVo sysUserVo = userService.queryById(userId);
|
||||
|
||||
//判断是否要求范围内打卡
|
||||
BusUserProjectRelevancy relevancy = userProjectRelevancyService.getOne(Wrappers.lambdaQuery(BusUserProjectRelevancy.class)
|
||||
.eq(BusUserProjectRelevancy::getUserId, userId)
|
||||
@ -598,7 +639,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
throw new ServiceException("当前用户未加入项目", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
//判断是否是施工员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围
|
||||
boolean isConstruct = "1".equals(relevancy.getUserType());
|
||||
boolean isConstruct = "0".equals(sysUserVo.getAppUserType());
|
||||
List<Long> rangeIds = new ArrayList<>();
|
||||
if (isConstruct) {
|
||||
BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.lambdaQuery(BusProjectTeamMember.class)
|
||||
@ -636,7 +677,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
.toList();
|
||||
|
||||
if (CollUtil.isEmpty(punchRangeList)) {
|
||||
throw new ServiceException(isConstruct ? "班组未配置考勤范围" : "项目未配置考勤范围", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException(isConstruct ? "班组未配置考勤范围" : "项目未配置考勤范围", HttpStatus.ERROR);
|
||||
}
|
||||
List<GeoPoint> matchingRange = JSTUtil.findMatchingRange(req.getLat(), req.getLng(), punchRangeList);
|
||||
return matchingRange != null;
|
||||
@ -707,7 +748,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
|
||||
|
||||
@Override
|
||||
public List<BusAttendanceVo> getAbnormalAttendance(Long projectId) {
|
||||
public TableDataInfo<BusAttendanceVo> getAbnormalAttendance(Long projectId, PageQuery pageQuery) {
|
||||
|
||||
List<String> abnormalList = Arrays.asList(BusAttendanceClockStatusEnum.LATE.getValue(),
|
||||
BusAttendanceClockStatusEnum.LEAVEEARLY.getValue(),
|
||||
@ -722,16 +763,18 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
|
||||
boolean b = relevancyList.stream().allMatch(relevancy -> "1".equals(relevancy.getUserType()));
|
||||
|
||||
List<BusAttendanceVo> busAttendanceVos = baseMapper.selectVoList(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
IPage<BusAttendanceVo> busAttendanceVoIPage = baseMapper.selectVoPage(pageQuery.build(), Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getUserId, userId)
|
||||
.eq(b, BusAttendance::getProjectId, projectId)
|
||||
.in(BusAttendance::getClockStatus, abnormalList)
|
||||
.orderByDesc(BusAttendance::getClockDate)
|
||||
.orderByDesc(BusAttendance::getRuleTime)
|
||||
);
|
||||
//转换星期几
|
||||
for (BusAttendanceVo busAttendanceVo : busAttendanceVos) {
|
||||
for (BusAttendanceVo busAttendanceVo : busAttendanceVoIPage.getRecords()) {
|
||||
busAttendanceVo.setWeek(busAttendanceVo.getClockDate().getDayOfWeek().getValue());
|
||||
}
|
||||
return busAttendanceVos;
|
||||
return TableDataInfo.build(busAttendanceVoIPage);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1145,28 +1188,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(Long projectId) {
|
||||
public List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(TwoWeekDto dto) {
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
//查询所有管理员和分包人员 排除
|
||||
List<Long> excludeUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
.ne(SubConstructionUser::getUserRole, "0")
|
||||
).stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
// List<Long> excludeUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
// .ne(SubConstructionUser::getUserRole, "0")
|
||||
// ).stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
|
||||
List<Long> allUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
.eq(SubConstructionUser::getUserRole, "0")
|
||||
.eq(SubConstructionUser::getProjectId,projectId)
|
||||
.eq(SubConstructionUser::getProjectId,dto.getProjectId())
|
||||
.eq(dto.getTeamId()!=null,SubConstructionUser::getTeamId,dto.getTeamId())
|
||||
.eq(StrUtil.isNotBlank(dto.getTypeOfWork()),SubConstructionUser::getTypeOfWork,dto.getTypeOfWork())
|
||||
.like(StrUtil.isNotBlank(dto.getUserName()),SubConstructionUser::getUserName,dto.getUserName())
|
||||
.isNotNull(SubConstructionUser::getTeamId)
|
||||
).stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
|
||||
|
||||
// 往前14天,包含今天
|
||||
LocalDate startDate = now.minusDays(14);
|
||||
List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery()
|
||||
.eq(BusAttendance::getProjectId, projectId)
|
||||
.notIn(CollectionUtil.isNotEmpty(excludeUserIds),BusAttendance::getUserId, excludeUserIds)
|
||||
.between(BusAttendance::getClockDate, startDate, now)
|
||||
.orderByAsc(BusAttendance::getClockDate)
|
||||
);
|
||||
LocalDate endDate = now.minusDays(1);
|
||||
List<BusAttendance> list;
|
||||
if(CollectionUtil.isEmpty(allUserIds)){
|
||||
list = new ArrayList<>();
|
||||
}else {
|
||||
list = list(Wrappers.<BusAttendance>lambdaQuery()
|
||||
.in(BusAttendance::getUserId, allUserIds)
|
||||
.between(BusAttendance::getClockDate, startDate, endDate)
|
||||
.orderByAsc(BusAttendance::getClockDate)
|
||||
);
|
||||
}
|
||||
|
||||
// 按日期分组
|
||||
Map<LocalDate, List<BusAttendance>> groupedByDate = list.stream()
|
||||
@ -1183,10 +1235,9 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
|
||||
// 统计全勤、半勤、缺卡人数
|
||||
List<BusAttendanceClockDateForTwoWeekVo> result = new ArrayList<>();
|
||||
List<String> validStatusList = Arrays.asList("1", "2", "3", "5");
|
||||
|
||||
LocalDate currentDate = startDate;
|
||||
while (!currentDate.isAfter(now)) {
|
||||
while (!currentDate.isAfter(endDate)) {
|
||||
Map<Long, List<BusAttendance>> userAttendanceMap = dateUserMap.getOrDefault(currentDate, new HashMap<>());
|
||||
|
||||
int full = 0, half = 0, absent = 0;
|
||||
@ -1196,13 +1247,11 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
|
||||
long validCount = records.stream()
|
||||
.map(BusAttendance::getClockStatus)
|
||||
.filter(validStatusList::contains)
|
||||
.filter(ATTENDANCE_LIST::contains)
|
||||
.count();
|
||||
|
||||
if (validCount >= 2) {
|
||||
if (validCount >= 1) {
|
||||
full++;
|
||||
} else if (validCount == 1) {
|
||||
half++;
|
||||
} else {
|
||||
absent++;
|
||||
}
|
||||
@ -1213,14 +1262,6 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
vo.setAttendance(full);
|
||||
vo.setHalfAttendance(half);
|
||||
vo.setAbsenteeism(absent);
|
||||
//如果是当天,则计算考勤率
|
||||
if (currentDate.equals(now)) {
|
||||
vo.setAllUserNum(allUserIds.size());
|
||||
vo.setClockNum(full+half);
|
||||
vo.setAttendanceRate(BigDecimalUtil.toPercentage(new BigDecimal(full+half),
|
||||
new BigDecimal(allUserIds.size())));
|
||||
}
|
||||
|
||||
result.add(vo);
|
||||
currentDate = currentDate.plusDays(1);
|
||||
}
|
||||
@ -1228,6 +1269,82 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BusAttendanceClockDateForTwoWeekVo getTodayAttendanceData(TwoWeekDto dto) {
|
||||
|
||||
LocalDate now = LocalDate.now();
|
||||
|
||||
// //查询所有管理员和分包人员 排除
|
||||
// List<Long> excludeUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
// .ne(SubConstructionUser::getUserRole, "0")
|
||||
// ).stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
|
||||
List<Long> allUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
|
||||
.eq(SubConstructionUser::getUserRole, "0")
|
||||
.eq(SubConstructionUser::getProjectId,dto.getProjectId())
|
||||
.eq(dto.getTeamId()!=null,SubConstructionUser::getTeamId,dto.getTeamId())
|
||||
.eq(StrUtil.isNotBlank(dto.getTypeOfWork()),SubConstructionUser::getTypeOfWork,dto.getTypeOfWork())
|
||||
.like(StrUtil.isNotBlank(dto.getUserName()),SubConstructionUser::getUserName,dto.getUserName())
|
||||
.isNotNull(SubConstructionUser::getTeamId)
|
||||
).stream().map(SubConstructionUser::getSysUserId).toList();
|
||||
|
||||
//当天请假人数
|
||||
String todayStr = now.format(DateTimeFormatter.ISO_LOCAL_DATE); // 结果:"2024-10-10"
|
||||
|
||||
// 2. 拼接 SQL 时添加单引号,确保语法正确
|
||||
int count = (int)leaveService.count(Wrappers.<BusLeave>lambdaQuery()
|
||||
.eq(BusLeave::getTimeType, "2")
|
||||
// 关键:给日期字符串加单引号,避免 SQL 语法错误
|
||||
.apply("DATE(start_time) <= {0}", todayStr)
|
||||
.apply("DATE(end_time) >= {0}", todayStr)
|
||||
);
|
||||
|
||||
List<BusAttendance> list;
|
||||
if(CollectionUtil.isEmpty(allUserIds)){
|
||||
list = new ArrayList<>();
|
||||
}else {
|
||||
list = list(Wrappers.<BusAttendance>lambdaQuery()
|
||||
.in(CollectionUtil.isNotEmpty(allUserIds),BusAttendance::getUserId, allUserIds)
|
||||
.eq(BusAttendance::getClockDate, now)
|
||||
.orderByAsc(BusAttendance::getClockDate)
|
||||
);
|
||||
}
|
||||
|
||||
Map<Long, List<BusAttendance>> collect = list.stream().collect(Collectors.groupingBy(BusAttendance::getUserId));
|
||||
|
||||
int full = 0, half = 0, absent = 0;
|
||||
|
||||
for (Map.Entry<Long, List<BusAttendance>> userEntry : collect.entrySet()) {
|
||||
List<BusAttendance> records = userEntry.getValue();
|
||||
|
||||
long validCount = records.stream()
|
||||
.map(BusAttendance::getClockStatus)
|
||||
.filter(ATTENDANCE_LIST::contains)
|
||||
.count();
|
||||
|
||||
if (validCount >= 2) {
|
||||
full++;
|
||||
} else if (validCount == 1) {
|
||||
half++;
|
||||
} else {
|
||||
absent++;
|
||||
}
|
||||
}
|
||||
|
||||
BusAttendanceClockDateForTwoWeekVo vo = new BusAttendanceClockDateForTwoWeekVo();
|
||||
vo.setClockDate(now);
|
||||
vo.setAttendance(full);
|
||||
vo.setHalfAttendance(half);
|
||||
vo.setAbsenteeism(absent);
|
||||
//计算考勤率
|
||||
vo.setAllUserNum(allUserIds.size()- count);
|
||||
vo.setClockNum(full+half);
|
||||
vo.setAttendanceRate(BigDecimalUtil.toPercentage(new BigDecimal(full+half),
|
||||
new BigDecimal(vo.getAllUserNum())));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getExportList(AttendanceExportDto dto, HttpServletResponse response) {
|
||||
try (OutputStream outputStream = response.getOutputStream()) {
|
||||
|
||||
@ -371,15 +371,13 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean isLeave(LocalDate date, Long userId) {
|
||||
LocalDateTime dateStart = LocalDateTime.of(date, LocalTime.MIN);
|
||||
LocalDateTime dateEnd = LocalDateTime.of(date, LocalTime.MAX);
|
||||
public Boolean isLeave(LocalDateTime clockTime, Long userId) {
|
||||
|
||||
LambdaQueryWrapper<BusLeave> wrappers = new LambdaQueryWrapper<>();
|
||||
wrappers.eq(BusLeave::getUserId, userId)
|
||||
.eq(BusLeave::getAuditStatus, BusinessStatusEnum.FINISH.getStatus())
|
||||
.le(BusLeave::getStartTime, dateEnd) // 请假开始时间 <= 当天结束时间
|
||||
.ge(BusLeave::getEndTime, dateStart); // 请假结束时间 >= 当天开始时间
|
||||
.le(BusLeave::getStartTime, clockTime) // 请假开始时间 <= 当天打卡时间
|
||||
.ge(BusLeave::getEndTime, clockTime); // 请假结束时间 >= 当天打卡时间
|
||||
|
||||
return count(wrappers) > 0;
|
||||
}
|
||||
|
||||
@ -33,8 +33,10 @@ import org.dromara.project.mapper.BusProjectTeamMemberMapper;
|
||||
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.mapper.SysUserRoleMapper;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysRoleService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -84,6 +86,9 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
||||
@Resource
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Resource
|
||||
private ISysOssService ossService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询项目班组下的成员
|
||||
@ -366,6 +371,13 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
|
||||
SysUserVo userVo = userService.selectUserById(memberId);
|
||||
if (userVo != null) {
|
||||
projectTeamMemberVo.setMemberName(userVo.getNickName());
|
||||
Long avatar = userVo.getAvatar();
|
||||
if(avatar != null){
|
||||
SysOssVo byId = ossService.getById(avatar);
|
||||
if(byId != null){
|
||||
projectTeamMemberVo.setAvatar(byId.getUrl());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SubConstructionUser user = constructionUserService.getBySysUserId(memberId);
|
||||
projectTeamMemberVo.setMemberName(user.getUserName());
|
||||
|
||||
@ -16,7 +16,10 @@ 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.project.domain.BusProject;
|
||||
import org.dromara.project.domain.BusProjectPunchrange;
|
||||
import org.dromara.project.domain.BusProjectTeam;
|
||||
import org.dromara.project.domain.BusProjectTeamMember;
|
||||
@ -70,6 +73,9 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper,
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
@Resource
|
||||
private ISubContractorService contractorService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询项目班组
|
||||
@ -345,6 +351,14 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper,
|
||||
return projectTeamVo;
|
||||
}
|
||||
BeanUtils.copyProperties(projectTeam, projectTeamVo);
|
||||
if (projectTeam.getContractorId() != null) {
|
||||
SubContractor subContractor = contractorService.getById(projectTeam.getContractorId());
|
||||
if (subContractor != null) {
|
||||
projectTeamVo.setContractorName(subContractor.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 获取班组人数
|
||||
Long peopleNumber = projectTeamMemberService.lambdaQuery()
|
||||
.eq(BusProjectTeamMember::getTeamId, projectTeam.getId())
|
||||
@ -436,7 +450,9 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper,
|
||||
List<SysUserVo> sysUserVos = userService.selectUserByIds(userIdList, null);
|
||||
Map<Long, String> collect = sysUserVos.stream().collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName));
|
||||
|
||||
|
||||
List<Long> list1 = projectTeamList.stream().map(BusProjectTeam::getContractorId).toList();
|
||||
List<SubContractor> subContractors = contractorService.listByIds(list1);
|
||||
Map<Long, String> contractorMap = subContractors.stream().collect(Collectors.toMap(SubContractor::getId, SubContractor::getName));
|
||||
|
||||
// 对象列表 => 封装对象列表
|
||||
List<BusProjectTeamVo> projectTeamVoList = projectTeamList.stream().map(projectTeam -> {
|
||||
@ -449,6 +465,7 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper,
|
||||
String[] split = userId.split(",");
|
||||
projectTeamVo.setUserName(Arrays.stream(split).map(s -> collect.getOrDefault(Long.valueOf(s.trim()), "")).collect(Collectors.joining(",")));
|
||||
}
|
||||
projectTeamVo.setContractorName(contractorMap.getOrDefault(projectTeam.getContractorId(), ""));
|
||||
return projectTeamVo;
|
||||
}).toList();
|
||||
projectTeamVoPage.setRecords(projectTeamVoList);
|
||||
|
||||
@ -189,30 +189,34 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
List<HseTeamMeeting> teamMeetings = teamMeetingService.lambdaQuery()
|
||||
.eq(HseTeamMeeting::getProjectId, projectId)
|
||||
.list();
|
||||
if (CollUtil.isEmpty(teamMeetings)) {
|
||||
return gisVo;
|
||||
if (CollUtil.isNotEmpty(teamMeetings)) {
|
||||
// 获取最新的班组列表
|
||||
List<HseTeamMeeting> topList = teamMeetings.stream()
|
||||
.sorted(Comparator.comparing(HseTeamMeeting::getCreateTime).reversed())
|
||||
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
|
||||
.toList();
|
||||
List<Long> teamIds = topList.stream().map(HseTeamMeeting::getTeamId).toList();
|
||||
Map<Long, List<BusProjectTeam>> teamMap = projectTeamService.lambdaQuery()
|
||||
.in(BusProjectTeam::getId, teamIds)
|
||||
.list().stream().collect(Collectors.groupingBy(BusProjectTeam::getId));
|
||||
List<HseTeamMeetingGis> gisList = topList.stream().map(teamMeeting -> {
|
||||
HseTeamMeetingGis gis = new HseTeamMeetingGis();
|
||||
BeanUtils.copyProperties(teamMeeting, gis);
|
||||
gis.setName("站班会");
|
||||
if (teamMap.containsKey(teamMeeting.getTeamId())) {
|
||||
gis.setTeamName(teamMap.get(teamMeeting.getTeamId()).getFirst().getTeamName());
|
||||
}
|
||||
return gis;
|
||||
}).toList();
|
||||
gisVo.setTeamMeetingList(gisList);
|
||||
} else {
|
||||
gisVo.setTeamMeetingList(new ArrayList<>());
|
||||
}
|
||||
// 获取最新的班组列表
|
||||
List<HseTeamMeeting> topList = teamMeetings.stream()
|
||||
.sorted(Comparator.comparing(HseTeamMeeting::getCreateTime).reversed())
|
||||
.limit(Optional.ofNullable(req.getPageSize()).orElse(20))
|
||||
.toList();
|
||||
List<Long> teamIds = topList.stream().map(HseTeamMeeting::getTeamId).toList();
|
||||
Map<Long, List<BusProjectTeam>> teamMap = projectTeamService.lambdaQuery()
|
||||
.in(BusProjectTeam::getId, teamIds)
|
||||
.list().stream().collect(Collectors.groupingBy(BusProjectTeam::getId));
|
||||
List<HseTeamMeetingGis> gisList = topList.stream().map(teamMeeting -> {
|
||||
HseTeamMeetingGis gis = new HseTeamMeetingGis();
|
||||
BeanUtils.copyProperties(teamMeeting, gis);
|
||||
gis.setName("站班会");
|
||||
if (teamMap.containsKey(teamMeeting.getTeamId())) {
|
||||
gis.setTeamName(teamMap.get(teamMeeting.getTeamId()).getFirst().getTeamName());
|
||||
}
|
||||
return gis;
|
||||
}).toList();
|
||||
// 获取整改情况
|
||||
List<HseSafetyInspection> safetyInspectionList = this.lambdaQuery()
|
||||
.eq(HseSafetyInspection::getProjectId, projectId).list();
|
||||
.select(HseSafetyInspection::getId, HseSafetyInspection::getStatus, HseSafetyInspection::getIsReply)
|
||||
.eq(HseSafetyInspection::getProjectId, projectId)
|
||||
.list();
|
||||
long passCount = 0L;
|
||||
for (HseSafetyInspection safetyInspection : safetyInspectionList) {
|
||||
if (HseSafetyInspectionStatusEnum.REVIEW.getValue().equals(safetyInspection.getStatus())
|
||||
@ -220,11 +224,18 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
passCount++;
|
||||
}
|
||||
}
|
||||
gisVo.setTeamMeetingList(gisList);
|
||||
int safetyInspectionCount = safetyInspectionList.stream()
|
||||
.filter(inspection -> inspection.getIsReply().equals("2"))
|
||||
.toList()
|
||||
.size();
|
||||
int correctSituationCount = safetyInspectionList.stream()
|
||||
.filter(inspection -> inspection.getIsReply().equals("1") && !inspection.getStatus().equals("1"))
|
||||
.toList()
|
||||
.size();
|
||||
gisVo.setTeamMeetingCount((long) teamMeetings.size());
|
||||
gisVo.setSafetyInspectionCount((long) safetyInspectionList.size());
|
||||
gisVo.setCorrectSituationCount(passCount);
|
||||
gisVo.setCorrectSituation(String.format("%.2f", passCount * 100.0 / safetyInspectionList.size()));
|
||||
gisVo.setSafetyInspectionCount((long) safetyInspectionCount);
|
||||
gisVo.setCorrectSituationCount((long) correctSituationCount);
|
||||
gisVo.setCorrectSituation(String.format("%.2f", correctSituationCount * 100.0 / safetyInspectionCount));
|
||||
return gisVo;
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.system.domain.SysMenu;
|
||||
import org.dromara.system.domain.bo.SysMenuBo;
|
||||
import org.dromara.system.domain.vo.MenuTreeSelectVo;
|
||||
import org.dromara.system.domain.vo.MetaVo;
|
||||
import org.dromara.system.domain.vo.RouterVo;
|
||||
import org.dromara.system.domain.vo.SysMenuVo;
|
||||
import org.dromara.system.service.ISysMenuService;
|
||||
@ -56,6 +57,17 @@ public class SysMenuController extends BaseController {
|
||||
return R.ok(menuService.buildMenus(menus));
|
||||
}
|
||||
|
||||
@GetMapping("/getAppRouters/{projectId}")
|
||||
public R<List<SysMenuVo>> getRoutersList(@NotNull(message = "项目主键不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
Long userId = LoginHelper.getUserId();
|
||||
SysMenuBo sysMenuBo = new SysMenuBo();
|
||||
sysMenuBo.setMenuSource("2");
|
||||
sysMenuBo.setProjectId(projectId);
|
||||
List<SysMenuVo> menus = menuService.selectMenuList(sysMenuBo, userId);
|
||||
return R.ok(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
|
||||
@ -387,7 +387,7 @@ public class SysUserController extends BaseController {
|
||||
* 获取分包单位列表
|
||||
*/
|
||||
@SaCheckPermission("system:user:updateFb")
|
||||
@PutMapping("/{projectId}")
|
||||
@GetMapping("/fb/{projectId}")
|
||||
public R<List<SubContractor>> getFbList(@PathVariable("projectId") Long projectId) {
|
||||
List<SubContractor> list = contractorService.list(Wrappers.<SubContractor>lambdaQuery()
|
||||
.select(SubContractor::getId, SubContractor::getName)
|
||||
@ -400,7 +400,7 @@ public class SysUserController extends BaseController {
|
||||
* 修改分包单位
|
||||
*/
|
||||
@SaCheckPermission("system:user:updateFb")
|
||||
@PutMapping("/{userId}/{contractorId}")
|
||||
@PutMapping("/fb/{userId}/{contractorId}")
|
||||
public R<Boolean> updateFb(@PathVariable("userId") Long userId,
|
||||
@PathVariable("contractorId") Long contractorId) {
|
||||
return R.ok(userService.updateFb(userId, contractorId));
|
||||
|
||||
@ -113,4 +113,7 @@ public class SysMenuBo extends BaseEntity {
|
||||
*/
|
||||
private String menuSource;
|
||||
|
||||
|
||||
private Long projectId;
|
||||
|
||||
}
|
||||
|
||||
@ -136,5 +136,5 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
||||
|
||||
|
||||
|
||||
List<SysUserVo> selectUserListByAppUserType(@Param("appUserType") String appUserType, @Param("projectId")Long projectId);
|
||||
List<SysUserVo> selectUserListByAppUserType(@Param("appUserType") String appUserType, @Param("projectId")Long projectId, @Param("contractorId")Long contractorId);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ public interface ISysUserService {
|
||||
|
||||
Boolean queryProjectRelevancy(Long userId);
|
||||
|
||||
List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId);
|
||||
List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId);
|
||||
|
||||
Boolean updateFb(Long userId,Long contractorId);
|
||||
}
|
||||
|
||||
@ -77,7 +77,14 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
.orderByAsc(SysMenu::getOrderNum));
|
||||
} else {
|
||||
QueryWrapper<SysMenu> wrapper = Wrappers.query();
|
||||
wrapper.inSql("r.role_id", "select role_id from sys_user_role where user_id = " + userId)
|
||||
// 构建子查询的基础SQL
|
||||
StringBuilder subSql = new StringBuilder("select role_id from sys_user_role where user_id = " + userId);
|
||||
|
||||
// 如果projectId有值,追加条件
|
||||
if (menu.getProjectId() != null) {
|
||||
subSql.append(" and project_id = ").append(menu.getProjectId());
|
||||
}
|
||||
wrapper.inSql("r.role_id", subSql.toString())
|
||||
.like(StringUtils.isNotBlank(menu.getMenuName()), "m.menu_name", menu.getMenuName())
|
||||
.eq(StringUtils.isNotBlank(menu.getVisible()), "m.visible", menu.getVisible())
|
||||
.eq(StringUtils.isNotBlank(menu.getStatus()), "m.status", menu.getStatus())
|
||||
|
||||
@ -960,8 +960,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId) {
|
||||
return baseMapper.selectUserListByAppUserType(appUserType,projectId);
|
||||
public List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId) {
|
||||
return baseMapper.selectUserListByAppUserType(appUserType,projectId,contractorId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -4,4 +4,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.drone.mapper.DroProjectDroneMapper">
|
||||
|
||||
<select id="getTopicsByKeyPrefix" resultType="java.lang.String">
|
||||
SELECT
|
||||
drone_sn
|
||||
FROM
|
||||
`dro_project_drone`
|
||||
GROUP BY drone_sn
|
||||
</select>
|
||||
<select id="getTopicsByProjectId" resultType="java.lang.String">
|
||||
SELECT
|
||||
drone_sn
|
||||
FROM
|
||||
`dro_project_drone`
|
||||
WHERE project_id = #{projectId}
|
||||
GROUP BY drone_sn
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -135,6 +135,7 @@
|
||||
WHERE
|
||||
bur.project_id = #{projectId}
|
||||
AND su.app_user_type = #{appUserType}
|
||||
AND su.contractor_id = #{contractorId}
|
||||
AND su.del_flag = '0'
|
||||
AND su.status = '0'
|
||||
</select>
|
||||
|
||||
0
xinnengyuan/script/sql/bhbzj.sql
Normal file
0
xinnengyuan/script/sql/bhbzj.sql
Normal file
297
xinnengyuan/script/sql/lxjcb.sql
Normal file
297
xinnengyuan/script/sql/lxjcb.sql
Normal file
@ -0,0 +1,297 @@
|
||||
use xinnengyuandev;
|
||||
|
||||
CREATE TABLE `xzd_project_manager_approval`
|
||||
(
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
|
||||
`document_number` VARCHAR(50) NOT NULL COMMENT '单据编号',
|
||||
`title` VARCHAR(255) NULL COMMENT '标题',
|
||||
`record_date` DATE NULL COMMENT '日期',
|
||||
`project_name` VARCHAR(255) NOT NULL COMMENT '项目名称',
|
||||
`customer_name` VARCHAR(255) NULL COMMENT '客户名称',
|
||||
`project_scale` VARCHAR(255) NULL COMMENT '项目规模',
|
||||
`contract_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '合同金额',
|
||||
`prospective_manager_name` VARCHAR(100) NULL COMMENT '拟任项目经理',
|
||||
`id_card_number` VARCHAR(30) NULL COMMENT '身份证号',
|
||||
`education_level` VARCHAR(50) NULL COMMENT '教育程度',
|
||||
`work_experience_years` DECIMAL(5, 1) NULL COMMENT '工作年限',
|
||||
`professional_experience_years` DECIMAL(5, 1) NULL COMMENT '专业年限',
|
||||
`contract_employment_type` VARCHAR(100) NULL COMMENT '合同用工形式',
|
||||
`qualification_certificates` TEXT NULL COMMENT '资格证书',
|
||||
`is_historical_data` varchar(16) NULL COMMENT '是否属于历史数据补录',
|
||||
`file_id` varchar(1024) NULL COMMENT '文件ID',
|
||||
`remark` TEXT NULL COMMENT '备注',
|
||||
`audit_status` VARCHAR(32) default 'draft' NULL COMMENT '审核状态',
|
||||
`create_by` bigint NULL COMMENT '创建者',
|
||||
`update_by` bigint NULL COMMENT '更新者',
|
||||
`create_dept` bigint NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间'
|
||||
) COMMENT ='项目经理推荐及审批';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project`
|
||||
(
|
||||
`id` BIGINT PRIMARY KEY AUTO_INCREMENT COMMENT '主键ID',
|
||||
`project_number` VARCHAR(100) NOT NULL COMMENT '项目编号',
|
||||
`project_name` VARCHAR(512) NOT NULL COMMENT '项目名称',
|
||||
`project_abbreviation` VARCHAR(255) NULL COMMENT '项目简称',
|
||||
`project_type` BIGINT NULL COMMENT '项目类型',
|
||||
`project_status` VARCHAR(50) NULL COMMENT '项目状态',
|
||||
`planned_start_date` DATE NULL COMMENT '计划开工日期',
|
||||
`planned_completion_date` DATE NULL COMMENT '计划竣工日期',
|
||||
`actual_start_date` DATE NULL COMMENT '实际开工日期',
|
||||
`actual_completion_date` DATE NULL COMMENT '实际竣工日期',
|
||||
`management_organization` VARCHAR(255) NULL COMMENT '管理组织',
|
||||
`project_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '项目金额',
|
||||
`filing_manager` BIGINT NULL COMMENT '项目备案经理',
|
||||
`manager_execution` BIGINT NULL COMMENT '项目执行经理',
|
||||
`manager_responsible` BIGINT NULL COMMENT '项目责任人',
|
||||
`winning_bid_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '项目中标金额',
|
||||
`planned_duration` INT NULL COMMENT '计划工期',
|
||||
`actual_duration` INT NULL COMMENT '实际工期',
|
||||
`default_financial_organization` VARCHAR(255) NULL COMMENT '默认财务组织',
|
||||
`contracting_method` VARCHAR(100) NULL COMMENT '承包方式',
|
||||
`involved_financial_organization` VARCHAR(255) NULL COMMENT '涉及财务组织',
|
||||
`business_model` VARCHAR(64) NULL COMMENT '经营模式',
|
||||
`construction_unit` VARCHAR(255) NULL COMMENT '建设单位',
|
||||
`project_attribute` VARCHAR(64) NULL COMMENT '项目属性',
|
||||
`group_project` VARCHAR(64) NULL COMMENT '集团项目',
|
||||
`description` TEXT NULL COMMENT '说明',
|
||||
`project_establishment_date` DATE NULL COMMENT '立项日期',
|
||||
`planned_total_investment` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '计划总投资',
|
||||
`gov_filing_project_name` VARCHAR(255) NULL COMMENT '政府备案项目名称',
|
||||
`manager_execution_phone` VARCHAR(50) NULL COMMENT '项目执行经理电话',
|
||||
`sharing_organization` VARCHAR(255) NULL COMMENT '共享组织',
|
||||
`target_winning_bid_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '目标中标金额',
|
||||
`target_contract_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '目标合同金额',
|
||||
`target_output_value_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '目标产值金额',
|
||||
`target_collection_amount` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '目标收款金额',
|
||||
`file_id` VARCHAR(1024) NULL COMMENT '文件ID',
|
||||
`remark` TEXT NULL COMMENT '备注',
|
||||
`audit_status` VARCHAR(32) default 'draft' NULL COMMENT '审核状态',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间'
|
||||
) COMMENT ='项目信息';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_profile`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`country` VARCHAR(128) NULL COMMENT '国家',
|
||||
`province` VARCHAR(128) NULL COMMENT '省',
|
||||
`city` VARCHAR(128) NULL COMMENT '城市',
|
||||
`district` VARCHAR(128) NULL COMMENT '区县',
|
||||
`project_address` VARCHAR(255) NOT NULL COMMENT '项目地址',
|
||||
`building_area` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '建筑面积',
|
||||
`building_area_unit` VARCHAR(64) NULL COMMENT '建筑面积单位',
|
||||
`floor_count` DECIMAL(16, 2) DEFAULT 0.00 NULL COMMENT '层数',
|
||||
`height` DECIMAL(20, 2) DEFAULT 0.0000 NULL COMMENT '高度(米)',
|
||||
`parent_project_id` BIGINT NULL COMMENT '所属父级项目',
|
||||
`contract_amount` DECIMAL(20, 2) DEFAULT 0.0000 NULL COMMENT '合同金额',
|
||||
`quality_evaluation_grade` VARCHAR(128) NULL COMMENT '质量评价等级',
|
||||
`safety_production_grade` VARCHAR(128) NULL COMMENT '安全生产等级',
|
||||
`project_contract_record_number` VARCHAR(128) NULL COMMENT '工程合同备案号',
|
||||
`project_profile` TEXT NULL COMMENT '项目概括',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-项目概况';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_personnel`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`employee_id` VARCHAR(128) NULL COMMENT '员工号',
|
||||
`employee_name` VARCHAR(128) NULL COMMENT '人员姓名',
|
||||
`gender` VARCHAR(10) NULL COMMENT '性别',
|
||||
`project_role` VARCHAR(128) NULL COMMENT '项目角色',
|
||||
`project_post` VARCHAR(128) NULL COMMENT '项目岗位',
|
||||
`archival_post` VARCHAR(128) NULL COMMENT '备案岗位',
|
||||
`dept` VARCHAR(128) NULL COMMENT '部门',
|
||||
`mobile_phone` VARCHAR(30) NULL COMMENT '手机',
|
||||
`id_card_number` VARCHAR(64) NULL COMMENT '身份证',
|
||||
`certificate_number` VARCHAR(128) NULL COMMENT '员工证书编号',
|
||||
`certificate_name` VARCHAR(128) NULL COMMENT '员工证书名称',
|
||||
`issuing_authority` VARCHAR(128) NULL COMMENT '发证机关',
|
||||
`is_summary_flag` VARCHAR(16) NULL COMMENT '摘要标志',
|
||||
`is_salary_paid` VARCHAR(16) NULL COMMENT '是否到薪',
|
||||
`organization` VARCHAR(128) NULL COMMENT '组织',
|
||||
`file_id` VARCHAR(1024) NULL COMMENT '文件ID',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-项目人员';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_tax_info`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`tax_levy_method` VARCHAR(128) NULL COMMENT '计征方式',
|
||||
`tax_levy_area` VARCHAR(128) NULL COMMENT '计征区域',
|
||||
`advance_levy_rate` DECIMAL(5, 2) DEFAULT 0.00 NULL COMMENT '预征率',
|
||||
`prepay_tax_organization` VARCHAR(255) NULL COMMENT '预缴税务机构',
|
||||
`tax_organization` VARCHAR(255) NULL COMMENT '税务机构',
|
||||
`invoice_type_issued` VARCHAR(128) NULL COMMENT '开具发票类型',
|
||||
`receiving_email_account` VARCHAR(100) NULL COMMENT '收票邮箱账号',
|
||||
`receiving_email_password` VARCHAR(255) NULL COMMENT '收票邮箱密码',
|
||||
`is_realty_project` VARCHAR(16) NULL COMMENT '房地产项目',
|
||||
`cumulative_invoicing` DECIMAL(20, 2) DEFAULT 0.00 NULL COMMENT '累计开票',
|
||||
`cumulative_output_tax_amount` DECIMAL(5, 2) DEFAULT 0.00 NULL COMMENT '累计销项税额',
|
||||
`already_deducted` DECIMAL(20, 2) DEFAULT 0.00 NULL COMMENT '已抵扣进项',
|
||||
`value_add_tax` DECIMAL(5, 2) DEFAULT 0.00 NULL COMMENT '应缴纳增值税',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-税务信息';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_accounting_info`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`fill_mode` VARCHAR(255) NULL COMMENT '填报模式',
|
||||
`boq_mode` VARCHAR(16) NULL COMMENT '承包合同启用工程量清单模式控制',
|
||||
`boq_control_subitem` VARCHAR(16) NULL COMMENT '工程量清单管控到定额子目',
|
||||
`cost_calculation` VARCHAR(16) NULL COMMENT '是否启用成本测算',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-核算信息';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_warehouses`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`warehouse_code` VARCHAR(100) NULL COMMENT '编号',
|
||||
`warehouse_name` VARCHAR(255) NULL COMMENT '仓库名称',
|
||||
`is_default` VARCHAR(16) NULL COMMENT '是否默认',
|
||||
`remark` TEXT NULL COMMENT '备注',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-项目仓库';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_internal_accounts`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`account_code` VARCHAR(100) NULL COMMENT '内部资金账户编码',
|
||||
`account_name` VARCHAR(255) NULL COMMENT '内部资金账户名称',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-内部资金账户';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_participating_units`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`unit_type` VARCHAR(128) NULL COMMENT '单位性质',
|
||||
`unit_name` VARCHAR(255) NULL COMMENT '单位名称',
|
||||
`total_investment` DECIMAL(20, 4) NULL COMMENT '投资总额',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_project_id` (`xzd_project_id`)
|
||||
) COMMENT ='项目信息-参建单位';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_cbs`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`cbs_code` VARCHAR(128) NOT NULL COMMENT 'CBS编码',
|
||||
`cbs_name` VARCHAR(255) NULL COMMENT 'CBS名称',
|
||||
`subject_description` TEXT NULL COMMENT '科目说明',
|
||||
`subject_short_code` VARCHAR(50) NULL COMMENT '科目简码',
|
||||
`subject_attribute` VARCHAR(128) NULL COMMENT '科目属性',
|
||||
`financial_subject_code` VARCHAR(128) NULL COMMENT '对应财务科目编码',
|
||||
`financial_subject` VARCHAR(255) NULL COMMENT '对应财务科目',
|
||||
`parent_cbs_id` BIGINT DEFAULT 0 NOT NULL COMMENT '父项目CBS编码',
|
||||
`is_non_leaf` VARCHAR(16) NULL COMMENT '非末级编制标志',
|
||||
`is_frozen` VARCHAR(16) NULL COMMENT '科目冻结标志',
|
||||
`measurement_unit` VARCHAR(50) NULL COMMENT '计量单位',
|
||||
`remark` TEXT NULL COMMENT '备注',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_project_cbs_code` (`xzd_project_id`, `cbs_code`)
|
||||
) COMMENT ='项目CBS (成本分解结构)';
|
||||
|
||||
|
||||
CREATE TABLE `xzd_project_wbs`
|
||||
(
|
||||
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '唯一ID',
|
||||
`xzd_project_id` BIGINT NOT NULL COMMENT '关联的项目表ID',
|
||||
`wbs_code` VARCHAR(128) NOT NULL COMMENT 'WBS编码',
|
||||
`wbs_name` VARCHAR(255) NOT NULL COMMENT 'WBS名称',
|
||||
`total_quantity` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '工程总量',
|
||||
`measurement_unit` VARCHAR(64) NULL COMMENT '单位',
|
||||
`unit_price` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '单价',
|
||||
`total_price` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '工程总价',
|
||||
`planned_start_time` DATE NULL COMMENT '计划开始时间',
|
||||
`planned_end_time` DATE NULL COMMENT '计划结束时间',
|
||||
`actual_start_time` DATE NULL COMMENT '实际开始时间',
|
||||
`actual_end_time` DATE NULL COMMENT '实际结束时间',
|
||||
`status` VARCHAR(64) NULL COMMENT '状态',
|
||||
`progress` DECIMAL(5, 2) DEFAULT 0.00 NOT NULL COMMENT '进度',
|
||||
`parent_wbs_id` BIGINT DEFAULT 0 NOT NULL COMMENT '父级WBS',
|
||||
`enterprise_wbs_code` VARCHAR(128) NULL COMMENT '企业级WBS编码',
|
||||
`enterprise_wbs_name` VARCHAR(255) NULL COMMENT '企业级WBS名称',
|
||||
`accounting_type` VARCHAR(100) NULL COMMENT '核算类型',
|
||||
`financial_account` VARCHAR(100) NULL COMMENT '对应财务科目',
|
||||
`attribute` VARCHAR(100) NULL COMMENT '属性',
|
||||
`income` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '收入',
|
||||
`cost` DECIMAL(20, 4) DEFAULT 0.0000 NULL COMMENT '成本',
|
||||
`national_standard_code` VARCHAR(100) NULL COMMENT '国标码',
|
||||
`remark` TEXT NULL COMMENT '备注',
|
||||
`create_by` BIGINT NULL COMMENT '创建者',
|
||||
`update_by` BIGINT NULL COMMENT '更新者',
|
||||
`create_dept` BIGINT NULL COMMENT '创建部门',
|
||||
`create_time` DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
|
||||
`update_time` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_project_wbs_code` (`xzd_project_id`, `wbs_code`)
|
||||
) COMMENT ='项目WBS (工作分解结构)';
|
||||
Reference in New Issue
Block a user