分包
This commit is contained in:
@ -49,6 +49,7 @@ import org.dromara.project.domain.*;
|
|||||||
import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
|
import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
|
||||||
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
|
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
|
||||||
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
|
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
|
||||||
|
import org.dromara.project.domain.vo.projectteam.BusProjectTeamAppVo;
|
||||||
import org.dromara.project.service.*;
|
import org.dromara.project.service.*;
|
||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.SysUser;
|
||||||
import org.dromara.system.domain.SysUserRole;
|
import org.dromara.system.domain.SysUserRole;
|
||||||
@ -172,8 +173,24 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo<SubConstructionUserVo> queryPageList(SubConstructionUserQueryReq req, PageQuery pageQuery) {
|
public TableDataInfo<SubConstructionUserVo> queryPageList(SubConstructionUserQueryReq req, PageQuery pageQuery) {
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
SysUserVo sysUserVo = userService.selectUserById(userId);
|
||||||
|
String appUserType = sysUserVo.getAppUserType();
|
||||||
|
List<Long> list1 = new ArrayList<>();
|
||||||
|
if ("2".equals(appUserType)) {
|
||||||
|
List<BusProjectTeamAppVo> byUserId = projectTeamService.getByUserId(userId, req.getProjectId());
|
||||||
|
|
||||||
|
if(CollectionUtil.isEmpty(byUserId)){
|
||||||
|
return new TableDataInfo<>();
|
||||||
|
}
|
||||||
|
list1 = byUserId.stream().map(BusProjectTeamAppVo::getId).toList();
|
||||||
|
}
|
||||||
|
|
||||||
// 查询数据库
|
// 查询数据库
|
||||||
Page<SubConstructionUser> result = this.page(pageQuery.build(), this.buildQueryWrapper(req));
|
LambdaQueryWrapper<SubConstructionUser> wrapper = this.buildQueryWrapper(req);
|
||||||
|
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));
|
return TableDataInfo.build(getVoPage(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,11 +52,14 @@ import org.dromara.project.domain.BusAttendance;
|
|||||||
import org.dromara.project.domain.BusProject;
|
import org.dromara.project.domain.BusProject;
|
||||||
import org.dromara.project.domain.BusProjectTeam;
|
import org.dromara.project.domain.BusProjectTeam;
|
||||||
import org.dromara.project.domain.BusWorkWage;
|
import org.dromara.project.domain.BusWorkWage;
|
||||||
|
import org.dromara.project.domain.vo.projectteam.BusProjectTeamAppVo;
|
||||||
import org.dromara.project.service.IBusAttendanceService;
|
import org.dromara.project.service.IBusAttendanceService;
|
||||||
import org.dromara.project.service.IBusProjectService;
|
import org.dromara.project.service.IBusProjectService;
|
||||||
import org.dromara.project.service.IBusProjectTeamService;
|
import org.dromara.project.service.IBusProjectTeamService;
|
||||||
import org.dromara.project.service.IBusWorkWageService;
|
import org.dromara.project.service.IBusWorkWageService;
|
||||||
import org.dromara.project.service.impl.BusProjectTeamServiceImpl;
|
import org.dromara.project.service.impl.BusProjectTeamServiceImpl;
|
||||||
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
@ -110,6 +113,10 @@ public class SubUserSalaryDetailServiceImpl extends ServiceImpl<SubUserSalaryDet
|
|||||||
@Lazy
|
@Lazy
|
||||||
private IBusProjectTeamService projectTeamService;
|
private IBusProjectTeamService projectTeamService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private ISysUserService userService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询员工每日工资
|
* 查询员工每日工资
|
||||||
*
|
*
|
||||||
@ -280,10 +287,25 @@ public class SubUserSalaryDetailServiceImpl extends ServiceImpl<SubUserSalaryDet
|
|||||||
LocalDate start = parse.atDay(1);
|
LocalDate start = parse.atDay(1);
|
||||||
LocalDate end = parse.atEndOfMonth();
|
LocalDate end = parse.atEndOfMonth();
|
||||||
|
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
SysUserVo sysUserVo = userService.selectUserById(userId);
|
||||||
|
String appUserType = sysUserVo.getAppUserType();
|
||||||
|
List<Long> list1 = new ArrayList<>();
|
||||||
|
if ("2".equals(appUserType)) {
|
||||||
|
List<BusProjectTeamAppVo> byUserId = projectTeamService.getByUserId(userId, dto.getProjectId());
|
||||||
|
|
||||||
|
if(CollectionUtil.isEmpty(byUserId)){
|
||||||
|
return new TableDataInfo<>();
|
||||||
|
}
|
||||||
|
list1 = byUserId.stream().map(BusProjectTeamAppVo::getId).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QueryWrapper<SubUserSalaryDetail> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<SubUserSalaryDetail> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.select("user_id","max(team_id) as teamId","max(create_by) as createBy", "SUM(work_hour) as workHour", "SUM(total_salary) as totalSalary","max(create_time) as createTime")
|
queryWrapper.select("user_id","max(team_id) as teamId","max(create_by) as createBy", "SUM(work_hour) as workHour", "SUM(total_salary) as totalSalary","max(create_time) as createTime")
|
||||||
.eq("project_id", dto.getProjectId())
|
.eq("project_id", dto.getProjectId())
|
||||||
.between("report_date", start, end)
|
.between("report_date", start, end)
|
||||||
|
.in(dto.getTeamId()==null && "2".equals(appUserType),"team_id", list1)
|
||||||
.eq(dto.getTeamId()!=null,"team_id", dto.getTeamId())
|
.eq(dto.getTeamId()!=null,"team_id", dto.getTeamId())
|
||||||
.like(StringUtils.isNotBlank(dto.getUserName()),"user_name", dto.getUserName())
|
.like(StringUtils.isNotBlank(dto.getUserName()),"user_name", dto.getUserName())
|
||||||
.groupBy("user_id");
|
.groupBy("user_id");
|
||||||
|
|||||||
@ -83,6 +83,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private SseProperties sseProperties;
|
private SseProperties sseProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询卷册文件列表
|
* 分页查询卷册文件列表
|
||||||
*
|
*
|
||||||
@ -139,19 +140,19 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
desVolumeFileCodeVo.setProjectName(byId.getProjectName());
|
desVolumeFileCodeVo.setProjectName(byId.getProjectName());
|
||||||
desVolumeFileCodeVo.setType(desVolumeFile.getType());
|
desVolumeFileCodeVo.setType(desVolumeFile.getType());
|
||||||
|
|
||||||
if(DesVolumeFile.BLUEPRINT.equals(desVolumeFile.getType())){
|
if (DesVolumeFile.BLUEPRINT.equals(desVolumeFile.getType())) {
|
||||||
//查询图纸最新版
|
//查询图纸最新版
|
||||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
.eq(DesVolumeFile::getVolumeCatalogId, desVolumeFile.getVolumeCatalogId())
|
.eq(DesVolumeFile::getVolumeCatalogId, desVolumeFile.getVolumeCatalogId())
|
||||||
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
.orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
|
||||||
if(CollectionUtil.isNotEmpty(existingFiles)){
|
if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||||
DesVolumeFile desVolumeFile1 = existingFiles.getFirst();
|
DesVolumeFile desVolumeFile1 = existingFiles.getFirst();
|
||||||
if(!desVolumeFile1.getId().equals(id)){
|
if (!desVolumeFile1.getId().equals(id)) {
|
||||||
SysOssVo ossVo = ossService.getById(desVolumeFile1.getFileId());
|
SysOssVo ossVo = ossService.getById(desVolumeFile1.getFileId());
|
||||||
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
|
desVolumeFileCodeVo.setFileUrl(ossVo.getUrl());
|
||||||
}else {
|
} else {
|
||||||
desVolumeFileCodeVo.setIsLatest(true);
|
desVolumeFileCodeVo.setIsLatest(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -162,7 +163,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
.eq(DesVolumeFile::getType, DesVolumeFile.PROCESS)
|
.eq(DesVolumeFile::getType, DesVolumeFile.PROCESS)
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
.orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
|
||||||
if(!existingFiles.isEmpty()){
|
if (!existingFiles.isEmpty()) {
|
||||||
DesVolumeFile first = existingFiles.getFirst();
|
DesVolumeFile first = existingFiles.getFirst();
|
||||||
if (DesVolumeFile.WASTE.equals(desVolumeFile.getType())) {
|
if (DesVolumeFile.WASTE.equals(desVolumeFile.getType())) {
|
||||||
SysOssVo ossVo = ossService.getById(first.getFileId());
|
SysOssVo ossVo = ossService.getById(first.getFileId());
|
||||||
@ -198,7 +199,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
}
|
}
|
||||||
DesVolumeFileVo vo = getVo(volumeFile);
|
DesVolumeFileVo vo = getVo(volumeFile);
|
||||||
BusDrawingreviewReceiptsVo infoByReviewId = busDrawingreviewReceiptsService.getInfoByReviewId(volumeFile.getId());
|
BusDrawingreviewReceiptsVo infoByReviewId = busDrawingreviewReceiptsService.getInfoByReviewId(volumeFile.getId());
|
||||||
if(infoByReviewId != null && infoByReviewId.getApproveId()!=null){
|
if (infoByReviewId != null && infoByReviewId.getApproveId() != null) {
|
||||||
vo.setIsWindow(false);
|
vo.setIsWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,11 +249,11 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
|
|
||||||
|
|
||||||
//抄送信息
|
//抄送信息
|
||||||
if(CollectionUtil.isNotEmpty(req.getUserIds())){
|
if (CollectionUtil.isNotEmpty(req.getUserIds())) {
|
||||||
SseMessageDto dto = new SseMessageDto();
|
SseMessageDto dto = new SseMessageDto();
|
||||||
SeeMessageContentDto contentDto = new SeeMessageContentDto();
|
SeeMessageContentDto contentDto = new SeeMessageContentDto();
|
||||||
contentDto.setType(sseProperties.getDrawing());
|
contentDto.setType(sseProperties.getDrawing());
|
||||||
contentDto.setContent("<"+volumeCatalog.getDocumentName()+">"+"的蓝图已上传");
|
contentDto.setContent("<" + volumeCatalog.getDocumentName() + ">" + "的蓝图已上传");
|
||||||
dto.setMessage(JSONUtil.toJsonStr(contentDto));
|
dto.setMessage(JSONUtil.toJsonStr(contentDto));
|
||||||
dto.setUserIds(req.getUserIds());
|
dto.setUserIds(req.getUserIds());
|
||||||
SseMessageUtils.publishMessage(dto);
|
SseMessageUtils.publishMessage(dto);
|
||||||
@ -297,9 +298,126 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
* @param type 文件类型
|
* @param type 文件类型
|
||||||
* @param desVolumeFiles 文件集合
|
* @param desVolumeFiles 文件集合
|
||||||
*/
|
*/
|
||||||
|
// private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
||||||
|
// // 用于记录同一批次中已处理的文件名及对应的版本号
|
||||||
|
// Map<String, String> batchFileVersionMap = new HashMap<>();
|
||||||
|
//
|
||||||
|
// for (Long fileId : fileIds) {
|
||||||
|
// SysOssVo ossVo = ossService.getById(fileId);
|
||||||
|
// if (ossVo == null) {
|
||||||
|
// throw new ServiceException("对应文件不存在", HttpStatus.NOT_FOUND);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// DesVolumeFile file = new DesVolumeFile();
|
||||||
|
// BeanUtils.copyProperties(req, file);
|
||||||
|
// file.setFileId(fileId);
|
||||||
|
//
|
||||||
|
// String fileName = ossVo.getOriginalName();
|
||||||
|
//
|
||||||
|
// // 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
|
||||||
|
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
|
// .eq(DesVolumeFile.PROCESS.equals(type),DesVolumeFile::getType, type)
|
||||||
|
// .in(DesVolumeFile.BLUEPRINT.equals(type),DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||||
|
// .eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||||
|
//// .eq(DesVolumeFile::getFileName, fileName)
|
||||||
|
// .orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
//
|
||||||
|
// String versionStr = "1.0"; // 默认版本号
|
||||||
|
//
|
||||||
|
// if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||||
|
// // 蓝图文件:1.0, 2.0, 3.0...
|
||||||
|
// if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||||
|
// String lastVersion = existingFiles.getFirst().getVersion();
|
||||||
|
// int majorVersion = (int) Math.floor(Double.parseDouble(lastVersion)) + 1;
|
||||||
|
// versionStr = majorVersion + ".0";
|
||||||
|
// }
|
||||||
|
// } else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||||
|
// // 过程图纸:基于蓝图版本号,如蓝图是1.0,则过程图为1.1, 1.2...1.9, 1.10
|
||||||
|
// // 先查找对应的蓝图文件最新版本
|
||||||
|
// List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
|
// .in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE)) // 蓝图类型
|
||||||
|
// .eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||||
|
//// .eq(DesVolumeFile::getFileName, fileName)
|
||||||
|
// .orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
//
|
||||||
|
// String blueprintVersion = "0.0"; // 默认蓝图版本
|
||||||
|
// if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||||
|
// blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 解析蓝图版本号
|
||||||
|
// String[] blueprintParts = blueprintVersion.split("\\.");
|
||||||
|
// int blueprintMajor = Integer.parseInt(blueprintParts[0]);
|
||||||
|
//
|
||||||
|
// if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||||
|
// // 已存在过程图纸,需要递增次版本号
|
||||||
|
// String lastVersion = existingFiles.getFirst().getVersion();
|
||||||
|
// String[] parts = lastVersion.split("\\.");
|
||||||
|
// int major = Integer.parseInt(parts[0]);
|
||||||
|
// int minor = Integer.parseInt(parts[1]);
|
||||||
|
//
|
||||||
|
// if (major == blueprintMajor) {
|
||||||
|
// // 同一主版本,次版本号递增
|
||||||
|
// minor++;
|
||||||
|
// versionStr = major + "." + minor;
|
||||||
|
// } else {
|
||||||
|
// // 不同主版本,使用蓝图的主版本并从1开始
|
||||||
|
// versionStr = blueprintMajor + ".1";
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // 不存在过程图纸,从蓝图版本的.1开始
|
||||||
|
// versionStr = blueprintMajor + ".1";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 检查同一批次中是否已存在同名文件
|
||||||
|
// if (batchFileVersionMap.containsKey(fileName)) {
|
||||||
|
// String lastBatchVersion = String.valueOf(batchFileVersionMap.get(fileName));
|
||||||
|
// if ( DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||||
|
// // 蓝图文件批次处理
|
||||||
|
// int lastMajor = (int) Math.floor(Double.parseDouble(lastBatchVersion));
|
||||||
|
// versionStr = (lastMajor + 1) + ".0";
|
||||||
|
// } else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||||
|
// // 过程图纸批次处理
|
||||||
|
// String[] currentParts = versionStr.split("\\.");
|
||||||
|
// String[] batchParts = lastBatchVersion.split("\\.");
|
||||||
|
//
|
||||||
|
// int currentMajor = Integer.parseInt(currentParts[0]);
|
||||||
|
// int currentMinor = Integer.parseInt(currentParts[1]);
|
||||||
|
// int batchMajor = Integer.parseInt(batchParts[0]);
|
||||||
|
// int batchMinor = Integer.parseInt(batchParts[1]);
|
||||||
|
//
|
||||||
|
// if (currentMajor == batchMajor) {
|
||||||
|
// // 同一主版本,取较大的次版本号+1
|
||||||
|
// int newMinor = Math.max(currentMinor, batchMinor) + 1;
|
||||||
|
// versionStr = currentMajor + "." + newMinor;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 更新批次文件版本映射(存储为字符串形式)
|
||||||
|
// batchFileVersionMap.put(fileName, versionStr);
|
||||||
|
//
|
||||||
|
// file.setVersion(versionStr);
|
||||||
|
// file.setFileName(fileName);
|
||||||
|
// desVolumeFiles.add(file);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
||||||
// 用于记录同一批次中已处理的文件名及对应的版本号
|
// 用于记录同一批次中的索引
|
||||||
Map<String, String> batchFileVersionMap = new HashMap<>();
|
int fileIndex = 0;
|
||||||
|
|
||||||
|
// 先找出数据库中已存在的最高版本号
|
||||||
|
List<DesVolumeFile> existingFilesInDB = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
|
.eq(DesVolumeFile.PROCESS.equals(type), DesVolumeFile::getType, type)
|
||||||
|
.in(DesVolumeFile.BLUEPRINT.equals(type), DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||||
|
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||||
|
.orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
|
||||||
|
double maxBatchVersion = 0.0;
|
||||||
|
if (CollectionUtil.isNotEmpty(existingFilesInDB)) {
|
||||||
|
maxBatchVersion = Double.parseDouble(existingFilesInDB.getFirst().getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
for (Long fileId : fileIds) {
|
for (Long fileId : fileIds) {
|
||||||
SysOssVo ossVo = ossService.getById(fileId);
|
SysOssVo ossVo = ossService.getById(fileId);
|
||||||
@ -313,96 +431,58 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
|
|
||||||
String fileName = ossVo.getOriginalName();
|
String fileName = ossVo.getOriginalName();
|
||||||
|
|
||||||
// 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
|
|
||||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
|
||||||
.eq(DesVolumeFile.PROCESS.equals(type),DesVolumeFile::getType, type)
|
|
||||||
.in(DesVolumeFile.BLUEPRINT.equals(type),DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
|
||||||
.eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
|
||||||
// .eq(DesVolumeFile::getFileName, fileName)
|
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
|
||||||
|
|
||||||
String versionStr = "1.0"; // 默认版本号
|
String versionStr = "1.0"; // 默认版本号
|
||||||
|
|
||||||
if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||||
// 蓝图文件:1.0, 2.0, 3.0...
|
// 蓝图文件:1.0, 2.0, 3.0...
|
||||||
if (CollectionUtil.isNotEmpty(existingFiles)) {
|
// 每个文件递增主版本号
|
||||||
String lastVersion = existingFiles.getFirst().getVersion();
|
int majorVersion = (int) maxBatchVersion + fileIndex + 1;
|
||||||
int majorVersion = (int) Math.floor(Double.parseDouble(lastVersion)) + 1;
|
|
||||||
versionStr = majorVersion + ".0";
|
versionStr = majorVersion + ".0";
|
||||||
}
|
|
||||||
} else if (DesVolumeFile.PROCESS.equals(type)) {
|
} else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||||
// 过程图纸:基于蓝图版本号,如蓝图是1.0,则过程图为1.1, 1.2...1.9, 1.10
|
// 过程图纸:基于蓝图版本号
|
||||||
// 先查找对应的蓝图文件最新版本
|
|
||||||
List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||||
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE)) // 蓝图类型
|
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||||
.eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||||
// .eq(DesVolumeFile::getFileName, fileName)
|
|
||||||
.orderByDesc(DesVolumeFile::getVersion));
|
.orderByDesc(DesVolumeFile::getVersion));
|
||||||
|
|
||||||
String blueprintVersion = "0.0"; // 默认蓝图版本
|
String blueprintVersion = "0.0";
|
||||||
if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||||
blueprintVersion = blueprintFiles.getFirst().getVersion();
|
blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析蓝图版本号
|
|
||||||
String[] blueprintParts = blueprintVersion.split("\\.");
|
String[] blueprintParts = blueprintVersion.split("\\.");
|
||||||
int blueprintMajor = Integer.parseInt(blueprintParts[0]);
|
int blueprintMajor = Integer.parseInt(blueprintParts[0]);
|
||||||
|
|
||||||
if (CollectionUtil.isNotEmpty(existingFiles)) {
|
// 对于过程图纸,需要基于数据库中已存在的最高版本号来计算
|
||||||
// 已存在过程图纸,需要递增次版本号
|
if (CollectionUtil.isNotEmpty(existingFilesInDB) && existingFilesInDB.getFirst().getType().equals(DesVolumeFile.PROCESS)) {
|
||||||
String lastVersion = existingFiles.getFirst().getVersion();
|
// 如果数据库中已存在过程图纸,则基于最高版本号递增
|
||||||
String[] parts = lastVersion.split("\\.");
|
String lastProcessVersion = existingFilesInDB.getFirst().getVersion();
|
||||||
int major = Integer.parseInt(parts[0]);
|
String[] lastParts = lastProcessVersion.split("\\.");
|
||||||
int minor = Integer.parseInt(parts[1]);
|
int lastMajor = Integer.parseInt(lastParts[0]);
|
||||||
|
int lastMinor = Integer.parseInt(lastParts[1]);
|
||||||
|
|
||||||
if (major == blueprintMajor) {
|
// 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从1开始
|
||||||
// 同一主版本,次版本号递增
|
if (lastMajor == blueprintMajor) {
|
||||||
minor++;
|
int minorVersion = lastMinor + fileIndex + 1;
|
||||||
versionStr = major + "." + minor;
|
versionStr = lastMajor + "." + minorVersion;
|
||||||
} else {
|
} else {
|
||||||
// 不同主版本,使用蓝图的主版本并从1开始
|
int minorVersion = fileIndex + 1;
|
||||||
versionStr = blueprintMajor + ".1";
|
versionStr = blueprintMajor + "." + minorVersion;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 不存在过程图纸,从蓝图版本的.1开始
|
// 数据库中没有过程图纸,从蓝图版本的.1开始
|
||||||
versionStr = blueprintMajor + ".1";
|
int minorVersion = fileIndex + 1;
|
||||||
|
versionStr = blueprintMajor + "." + minorVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查同一批次中是否已存在同名文件
|
|
||||||
if (batchFileVersionMap.containsKey(fileName)) {
|
|
||||||
String lastBatchVersion = String.valueOf(batchFileVersionMap.get(fileName));
|
|
||||||
if ( DesVolumeFile.BLUEPRINT.equals(type)) {
|
|
||||||
// 蓝图文件批次处理
|
|
||||||
int lastMajor = (int) Math.floor(Double.parseDouble(lastBatchVersion));
|
|
||||||
versionStr = (lastMajor + 1) + ".0";
|
|
||||||
} else if (DesVolumeFile.PROCESS.equals(type)) {
|
|
||||||
// 过程图纸批次处理
|
|
||||||
String[] currentParts = versionStr.split("\\.");
|
|
||||||
String[] batchParts = lastBatchVersion.split("\\.");
|
|
||||||
|
|
||||||
int currentMajor = Integer.parseInt(currentParts[0]);
|
|
||||||
int currentMinor = Integer.parseInt(currentParts[1]);
|
|
||||||
int batchMajor = Integer.parseInt(batchParts[0]);
|
|
||||||
int batchMinor = Integer.parseInt(batchParts[1]);
|
|
||||||
|
|
||||||
if (currentMajor == batchMajor) {
|
|
||||||
// 同一主版本,取较大的次版本号+1
|
|
||||||
int newMinor = Math.max(currentMinor, batchMinor) + 1;
|
|
||||||
versionStr = currentMajor + "." + newMinor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 更新批次文件版本映射(存储为字符串形式)
|
|
||||||
batchFileVersionMap.put(fileName, versionStr);
|
|
||||||
|
|
||||||
file.setVersion(versionStr);
|
file.setVersion(versionStr);
|
||||||
file.setFileName(fileName);
|
file.setFileName(fileName);
|
||||||
desVolumeFiles.add(file);
|
desVolumeFiles.add(file);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
fileIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除卷册文件信息
|
* 批量删除卷册文件信息
|
||||||
@ -432,7 +512,7 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
|||||||
// 关联文件信息
|
// 关联文件信息
|
||||||
Long fileId = volumeFile.getFileId();
|
Long fileId = volumeFile.getFileId();
|
||||||
SysOssVo ossVo = ossService.getById(fileId);
|
SysOssVo ossVo = ossService.getById(fileId);
|
||||||
if(ossVo != null){
|
if (ossVo != null) {
|
||||||
vo.setFileUrl(ossVo.getUrl());
|
vo.setFileUrl(ossVo.getUrl());
|
||||||
}
|
}
|
||||||
return vo;
|
return vo;
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package org.dromara.project.domain.vo.attendance;
|
package org.dromara.project.domain.vo.attendance;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
import org.dromara.project.domain.dto.attendance.AttendanceCountDto;
|
import org.dromara.project.domain.dto.attendance.AttendanceCountDto;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
@ -8,6 +10,8 @@ import java.time.LocalDate;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
public class AttendanceCountVo {
|
public class AttendanceCountVo {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import org.dromara.project.domain.vo.BusAttendanceRuleVo;
|
|||||||
import org.dromara.project.domain.vo.BusAttendanceVo;
|
import org.dromara.project.domain.vo.BusAttendanceVo;
|
||||||
import org.dromara.project.domain.vo.BusMonthAttendanceVo;
|
import org.dromara.project.domain.vo.BusMonthAttendanceVo;
|
||||||
import org.dromara.project.domain.vo.attendance.*;
|
import org.dromara.project.domain.vo.attendance.*;
|
||||||
|
import org.dromara.project.domain.vo.projectteam.BusProjectTeamAppVo;
|
||||||
import org.dromara.project.mapper.BusAttendanceMapper;
|
import org.dromara.project.mapper.BusAttendanceMapper;
|
||||||
import org.dromara.project.service.*;
|
import org.dromara.project.service.*;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
@ -869,11 +870,25 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AttendanceCountVo getAttendanceCount(AttendanceCountDto dto) {
|
public AttendanceCountVo getAttendanceCount(AttendanceCountDto dto) {
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
SysUserVo sysUserVo = userService.selectUserById(userId);
|
||||||
|
String appUserType = sysUserVo.getAppUserType();
|
||||||
|
List<Long> list2 = new ArrayList<>();
|
||||||
|
if ("2".equals(appUserType)) {
|
||||||
|
List<BusProjectTeamAppVo> byUserId = projectTeamService.getByUserId(userId, dto.getProjectId());
|
||||||
|
|
||||||
|
if(CollectionUtil.isEmpty(byUserId)){
|
||||||
|
return new AttendanceCountVo(0,0);
|
||||||
|
}
|
||||||
|
list2 = byUserId.stream().map(BusProjectTeamAppVo::getId).toList();
|
||||||
|
}
|
||||||
|
|
||||||
AttendanceCountVo attendanceCountVo = new AttendanceCountVo();
|
AttendanceCountVo attendanceCountVo = new AttendanceCountVo();
|
||||||
//先查询人员有那些
|
//先查询人员有那些
|
||||||
List<SubConstructionUser> list = constructionUserService.list(Wrappers.lambdaQuery(SubConstructionUser.class)
|
List<SubConstructionUser> list = constructionUserService.list(Wrappers.lambdaQuery(SubConstructionUser.class)
|
||||||
.eq(SubConstructionUser::getProjectId, dto.getProjectId())
|
.eq(SubConstructionUser::getProjectId, dto.getProjectId())
|
||||||
.eq(dto.getTeamId() != null, SubConstructionUser::getTeamId, dto.getTeamId())
|
.eq(dto.getTeamId() != null, SubConstructionUser::getTeamId, dto.getTeamId())
|
||||||
|
.in(dto.getTeamId() == null && "2".equals(appUserType), SubConstructionUser::getTeamId, list2)
|
||||||
.eq(StringUtils.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork())
|
.eq(StringUtils.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork())
|
||||||
);
|
);
|
||||||
attendanceCountVo.setTotalCount(list.size());
|
attendanceCountVo.setTotalCount(list.size());
|
||||||
@ -901,6 +916,18 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<AttendanceUserVo> getAttendanceUser(AttendanceCountDto dto, PageQuery pageQuery) {
|
public TableDataInfo<AttendanceUserVo> getAttendanceUser(AttendanceCountDto dto, PageQuery pageQuery) {
|
||||||
//查询今天打卡人员
|
//查询今天打卡人员
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
SysUserVo sysUser = userService.selectUserById(userId);
|
||||||
|
String appUserType = sysUser.getAppUserType();
|
||||||
|
List<Long> list1 = new ArrayList<>();
|
||||||
|
if ("2".equals(appUserType)) {
|
||||||
|
List<BusProjectTeamAppVo> byUserId = projectTeamService.getByUserId(userId, dto.getProjectId());
|
||||||
|
|
||||||
|
if(CollectionUtil.isEmpty(byUserId)){
|
||||||
|
return new TableDataInfo<>();
|
||||||
|
}
|
||||||
|
list1 = byUserId.stream().map(BusProjectTeamAppVo::getId).toList();
|
||||||
|
}
|
||||||
|
|
||||||
List<BusAttendance> attendanceList = baseMapper.selectList(Wrappers.<BusAttendance>lambdaQuery()
|
List<BusAttendance> attendanceList = baseMapper.selectList(Wrappers.<BusAttendance>lambdaQuery()
|
||||||
.eq(BusAttendance::getProjectId, dto.getProjectId())
|
.eq(BusAttendance::getProjectId, dto.getProjectId())
|
||||||
@ -925,6 +952,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
wrapper.notIn("2".equals(dto.getClockStatus()) && CollectionUtil.isNotEmpty(attendanceUserIds), SubConstructionUser::getSysUserId, attendanceUserIds);
|
wrapper.notIn("2".equals(dto.getClockStatus()) && CollectionUtil.isNotEmpty(attendanceUserIds), SubConstructionUser::getSysUserId, attendanceUserIds);
|
||||||
wrapper.eq(StrUtil.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork());
|
wrapper.eq(StrUtil.isNotBlank(dto.getTypeOfWork()), SubConstructionUser::getTypeOfWork, dto.getTypeOfWork());
|
||||||
wrapper.eq(dto.getTeamId() != null, SubConstructionUser::getTeamId, dto.getTeamId());
|
wrapper.eq(dto.getTeamId() != null, SubConstructionUser::getTeamId, dto.getTeamId());
|
||||||
|
wrapper.in(dto.getTeamId() == null && "2".equals(appUserType), SubConstructionUser::getTeamId, list1);
|
||||||
Page<SubConstructionUser> result = constructionUserService.page(pageQuery.build(), wrapper);
|
Page<SubConstructionUser> result = constructionUserService.page(pageQuery.build(), wrapper);
|
||||||
List<SubConstructionUser> records = result.getRecords();
|
List<SubConstructionUser> records = result.getRecords();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user