优化
This commit is contained in:
@ -209,6 +209,30 @@ sms:
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2491776
|
||||
config4:
|
||||
# 质量工单逾期
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534747
|
||||
config5:
|
||||
# 设计图纸
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534750
|
||||
config6:
|
||||
# 安全工单
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534848
|
||||
|
||||
|
||||
--- # 三方授权
|
||||
|
||||
@ -213,6 +213,30 @@ sms:
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2491776
|
||||
config4:
|
||||
# 质量工单逾期
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534747
|
||||
config5:
|
||||
# 设计图纸
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534750
|
||||
config6:
|
||||
# 安全工单
|
||||
supplier: tencent
|
||||
access-key-id: AKIDb3JK5dx4wa0DCxWqvxlKejvysZ3ITVJv
|
||||
access-key-secret: c5LPFsJI8k7GDxTkoeFj4A1ukQr66rPi
|
||||
signature: 重庆远界大数据研究院
|
||||
sdk-app-id: 1401018866
|
||||
template-id: 2534848
|
||||
|
||||
--- # 三方授权
|
||||
justauth:
|
||||
|
||||
@ -189,6 +189,7 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService {
|
||||
if (CollUtil.isNotEmpty(attendancePeopleList)) {
|
||||
List<SubConstructionUser> users = constructionUserService.lambdaQuery()
|
||||
.in(SubConstructionUser::getSysUserId, attendancePeopleList)
|
||||
.isNotNull(SubConstructionUser::getTeamId)
|
||||
.list();
|
||||
userTeamMap = users.stream()
|
||||
.collect(Collectors.groupingBy(SubConstructionUser::getTeamId));
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
package org.dromara.common.utils;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.utils.MessageUtils;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsyncUtil {
|
||||
|
||||
//发送短信
|
||||
@Async
|
||||
public void sendSms(List<String> mobileList, String config) {
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend(config);
|
||||
for (String mobile : mobileList) {
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(mobile, (String) null);
|
||||
if (!smsResponse.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//发送sse
|
||||
@Async
|
||||
public void sendSse(List<Long> userId, String message) {
|
||||
SseMessageDto sseMessageDto = new SseMessageDto();
|
||||
sseMessageDto.setUserIds(userId);
|
||||
sseMessageDto.setMessage(message);
|
||||
SseMessageUtils.publishMessage(sseMessageDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1510,6 +1510,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
|
||||
lqw.eq(ObjectUtils.isNotEmpty(typeOfWork), SubConstructionUser::getTypeOfWork, typeOfWork);
|
||||
|
||||
lqw.isNull(SubConstructionUser::getTeamId);
|
||||
lqw.eq(SubConstructionUser::getUserRole, "0");
|
||||
if (req.getProjectId() == null) {
|
||||
lqw.isNull(SubConstructionUser::getProjectId);
|
||||
} else {
|
||||
|
||||
@ -651,13 +651,18 @@ public class DesDesignChangeServiceImpl extends ServiceImpl<DesDesignChangeMappe
|
||||
List<DesVolumeFile> list = volumeFileService.list(Wrappers.lambdaQuery(DesVolumeFile.class)
|
||||
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, volumeCatalog.getDesign())
|
||||
.orderByDesc(DesVolumeFile::getVersion)
|
||||
.last("ORDER BY CAST(SUBSTRING(version, 4) AS DECIMAL(10, 2)) DESC")
|
||||
);
|
||||
String version = "1.0";
|
||||
String version = "LT-1.0";
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
String lastVersion = list.getFirst().getVersion();
|
||||
int majorVersion = (int) Math.floor(Double.parseDouble(lastVersion)) + 1;
|
||||
version = majorVersion + ".0";
|
||||
// 提取版本号数字部分(去除LT-前缀)
|
||||
String versionNumber = lastVersion;
|
||||
if (lastVersion.startsWith("LT-")) {
|
||||
versionNumber = lastVersion.substring(3); // 去除"LT-"前缀
|
||||
}
|
||||
int majorVersion = (int) Math.floor(Double.parseDouble(versionNumber)) + 1;
|
||||
version = "LT-" + majorVersion + ".0";
|
||||
}
|
||||
|
||||
for (SysOssVo ossVo : ossVoList1) {
|
||||
|
||||
@ -24,6 +24,7 @@ import org.dromara.common.sse.config.SseProperties;
|
||||
import org.dromara.common.sse.dto.SeeMessageContentDto;
|
||||
import org.dromara.common.sse.dto.SseMessageDto;
|
||||
import org.dromara.common.sse.utils.SseMessageUtils;
|
||||
import org.dromara.common.utils.AsyncUtil;
|
||||
import org.dromara.design.domain.DesVolumeCatalog;
|
||||
import org.dromara.design.domain.DesVolumeFile;
|
||||
import org.dromara.design.domain.bo.DesVolumeFileBo;
|
||||
@ -39,8 +40,11 @@ import org.dromara.design.service.IDesVolumeCatalogService;
|
||||
import org.dromara.design.service.IDesVolumeFileService;
|
||||
import org.dromara.project.domain.BusProject;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
import org.dromara.system.service.ISysRoleService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.context.event.EventListener;
|
||||
@ -82,6 +86,16 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
@Resource
|
||||
private SseProperties sseProperties;
|
||||
|
||||
@Resource
|
||||
private AsyncUtil asyncUtil;
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
@Resource
|
||||
private ISysRoleService roleService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询卷册文件列表
|
||||
*
|
||||
@ -262,15 +276,15 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
|
||||
private void validUpload(DesVolumeFileCreateReq req) {
|
||||
// 蓝图文件
|
||||
if (CollectionUtil.isNotEmpty(req.getFileIds())) {
|
||||
List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
.eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
||||
.orderByDesc(DesVolumeFile::getVersion));
|
||||
if (!existingFiles.isEmpty()) {
|
||||
throw new ServiceException("蓝图已上传");
|
||||
}
|
||||
}
|
||||
// if (CollectionUtil.isNotEmpty(req.getFileIds())) {
|
||||
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
// .eq(DesVolumeFile::getType, DesVolumeFile.BLUEPRINT)
|
||||
// .orderByDesc(DesVolumeFile::getVersion));
|
||||
// if (!existingFiles.isEmpty()) {
|
||||
// throw new ServiceException("蓝图已上传");
|
||||
// }
|
||||
// }
|
||||
// 过程文件
|
||||
// if (CollectionUtil.isNotEmpty(req.getCancellationIds())) {
|
||||
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
@ -288,17 +302,21 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理文件上传
|
||||
*
|
||||
* @param req 请求参数
|
||||
* @param fileIds 文件ID列表
|
||||
* @param type 文件类型
|
||||
* @param desVolumeFiles 文件集合
|
||||
*/
|
||||
// private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
||||
// // 用于记录同一批次中已处理的文件名及对应的版本号
|
||||
// Map<String, String> batchFileVersionMap = new HashMap<>();
|
||||
// // 用于记录同一批次中的索引
|
||||
// int fileIndex = 0;
|
||||
//
|
||||
// // 先找出数据库中已存在的最高版本号
|
||||
// List<DesVolumeFile> existingFilesInDB = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .eq(DesVolumeFile.PROCESS.equals(type), DesVolumeFile::getType, type)
|
||||
// .in(DesVolumeFile.BLUEPRINT.equals(type), DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
// .last("ORDER BY CAST(SUBSTRING(version_str, 4) AS DECIMAL(10, 2)) DESC"));
|
||||
//
|
||||
// double maxBatchVersion = 0.0;
|
||||
// if (CollectionUtil.isNotEmpty(existingFilesInDB)) {
|
||||
// maxBatchVersion = Double.parseDouble(existingFilesInDB.getFirst().getVersion());
|
||||
// }
|
||||
//
|
||||
// for (Long fileId : fileIds) {
|
||||
// SysOssVo ossVo = ossService.getById(fileId);
|
||||
@ -312,95 +330,60 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
//
|
||||
// String fileName = ossVo.getOriginalName();
|
||||
//
|
||||
// // 根据文件类型和文件名判断是否存在文件,存在则版本号往上增
|
||||
// List<DesVolumeFile> existingFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .eq(DesVolumeFile.PROCESS.equals(type),DesVolumeFile::getType, type)
|
||||
// .in(DesVolumeFile.BLUEPRINT.equals(type),DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||
//// .eq(DesVolumeFile::getFileName, fileName)
|
||||
// .orderByDesc(DesVolumeFile::getVersion));
|
||||
//
|
||||
// String versionStr = "1.0"; // 默认版本号
|
||||
//
|
||||
// if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||
// // 蓝图文件:1.0, 2.0, 3.0...
|
||||
// if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||
// String lastVersion = existingFiles.getFirst().getVersion();
|
||||
// int majorVersion = (int) Math.floor(Double.parseDouble(lastVersion)) + 1;
|
||||
// // 每个文件递增主版本号
|
||||
// int majorVersion = (int) maxBatchVersion + fileIndex + 1;
|
||||
// versionStr = majorVersion + ".0";
|
||||
// }
|
||||
// } else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||
// // 过程图纸:基于蓝图版本号,如蓝图是1.0,则过程图为1.1, 1.2...1.9, 1.10
|
||||
// // 先查找对应的蓝图文件最新版本
|
||||
// // 过程图纸:基于蓝图版本号
|
||||
// List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
// .in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE)) // 蓝图类型
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, file.getVolumeCatalogId())
|
||||
//// .eq(DesVolumeFile::getFileName, fileName)
|
||||
// .in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
// .eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
// .orderByDesc(DesVolumeFile::getVersion));
|
||||
//
|
||||
// String blueprintVersion = "0.0"; // 默认蓝图版本
|
||||
// String blueprintVersion = "0.0";
|
||||
// if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||
// blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||
// }
|
||||
//
|
||||
// // 解析蓝图版本号
|
||||
// String[] blueprintParts = blueprintVersion.split("\\.");
|
||||
// int blueprintMajor = Integer.parseInt(blueprintParts[0]);
|
||||
//
|
||||
// if (CollectionUtil.isNotEmpty(existingFiles)) {
|
||||
// // 已存在过程图纸,需要递增次版本号
|
||||
// String lastVersion = existingFiles.getFirst().getVersion();
|
||||
// String[] parts = lastVersion.split("\\.");
|
||||
// int major = Integer.parseInt(parts[0]);
|
||||
// int minor = Integer.parseInt(parts[1]);
|
||||
// // 对于过程图纸,需要基于数据库中已存在的最高版本号来计算
|
||||
// if (CollectionUtil.isNotEmpty(existingFilesInDB) && existingFilesInDB.getFirst().getType().equals(DesVolumeFile.PROCESS)) {
|
||||
// // 如果数据库中已存在过程图纸,则基于最高版本号递增
|
||||
// String lastProcessVersion = existingFilesInDB.getFirst().getVersion();
|
||||
// String[] lastParts = lastProcessVersion.split("\\.");
|
||||
// int lastMajor = Integer.parseInt(lastParts[0]);
|
||||
// int lastMinor = Integer.parseInt(lastParts[1]);
|
||||
//
|
||||
// if (major == blueprintMajor) {
|
||||
// // 同一主版本,次版本号递增
|
||||
// minor++;
|
||||
// versionStr = major + "." + minor;
|
||||
// // 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从1开始
|
||||
// if (lastMajor == blueprintMajor) {
|
||||
// int minorVersion = lastMinor + fileIndex + 1;
|
||||
// versionStr = lastMajor + "." + minorVersion;
|
||||
// } else {
|
||||
// // 不同主版本,使用蓝图的主版本并从1开始
|
||||
// versionStr = blueprintMajor + ".1";
|
||||
// int minorVersion = fileIndex + 1;
|
||||
// versionStr = blueprintMajor + "." + minorVersion;
|
||||
// }
|
||||
// } else {
|
||||
// // 不存在过程图纸,从蓝图版本的.1开始
|
||||
// versionStr = blueprintMajor + ".1";
|
||||
// // 数据库中没有过程图纸,从蓝图版本的.1开始
|
||||
// int minorVersion = fileIndex + 1;
|
||||
// versionStr = blueprintMajor + "." + minorVersion;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 检查同一批次中是否已存在同名文件
|
||||
// if (batchFileVersionMap.containsKey(fileName)) {
|
||||
// String lastBatchVersion = String.valueOf(batchFileVersionMap.get(fileName));
|
||||
// if ( DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||
// // 蓝图文件批次处理
|
||||
// int lastMajor = (int) Math.floor(Double.parseDouble(lastBatchVersion));
|
||||
// versionStr = (lastMajor + 1) + ".0";
|
||||
// } else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||
// // 过程图纸批次处理
|
||||
// String[] currentParts = versionStr.split("\\.");
|
||||
// String[] batchParts = lastBatchVersion.split("\\.");
|
||||
//
|
||||
// int currentMajor = Integer.parseInt(currentParts[0]);
|
||||
// int currentMinor = Integer.parseInt(currentParts[1]);
|
||||
// int batchMajor = Integer.parseInt(batchParts[0]);
|
||||
// int batchMinor = Integer.parseInt(batchParts[1]);
|
||||
//
|
||||
// if (currentMajor == batchMajor) {
|
||||
// // 同一主版本,取较大的次版本号+1
|
||||
// int newMinor = Math.max(currentMinor, batchMinor) + 1;
|
||||
// versionStr = currentMajor + "." + newMinor;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 更新批次文件版本映射(存储为字符串形式)
|
||||
// batchFileVersionMap.put(fileName, versionStr);
|
||||
//
|
||||
// file.setVersion(versionStr);
|
||||
// file.setFileName(fileName);
|
||||
// desVolumeFiles.add(file);
|
||||
//
|
||||
// fileIndex++;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
private void processFiles(DesVolumeFileCreateReq req, List<Long> fileIds, String type, List<DesVolumeFile> desVolumeFiles) {
|
||||
// 用于记录同一批次中的索引
|
||||
int fileIndex = 0;
|
||||
@ -410,13 +393,18 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
.eq(DesVolumeFile.PROCESS.equals(type), DesVolumeFile::getType, type)
|
||||
.in(DesVolumeFile.BLUEPRINT.equals(type), DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
.orderByDesc(DesVolumeFile::getVersion));
|
||||
.last("ORDER BY CAST(SUBSTRING(version, 4) AS DECIMAL(10, 2)) DESC"));
|
||||
|
||||
double maxBatchVersion = 0.0;
|
||||
String maxBatchVersion = "0.0";
|
||||
if (CollectionUtil.isNotEmpty(existingFilesInDB)) {
|
||||
maxBatchVersion = Double.parseDouble(existingFilesInDB.getFirst().getVersion());
|
||||
String version = existingFilesInDB.getFirst().getVersion();
|
||||
// 提取版本号数字部分(去除前缀)
|
||||
if (version.contains("-")) {
|
||||
maxBatchVersion = version.substring(version.indexOf("-") + 1);
|
||||
} else {
|
||||
maxBatchVersion = version;
|
||||
}
|
||||
}
|
||||
|
||||
for (Long fileId : fileIds) {
|
||||
SysOssVo ossVo = ossService.getById(fileId);
|
||||
if (ossVo == null) {
|
||||
@ -432,20 +420,34 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
String versionStr = "1.0"; // 默认版本号
|
||||
|
||||
if (DesVolumeFile.BLUEPRINT.equals(type)) {
|
||||
// 蓝图文件:1.0, 2.0, 3.0...
|
||||
// 每个文件递增主版本号
|
||||
int majorVersion = (int) maxBatchVersion + fileIndex + 1;
|
||||
versionStr = majorVersion + ".0";
|
||||
// 蓝图文件:LT-1.0, LT-1.1, LT-1.2...
|
||||
double maxVersion = Double.parseDouble(maxBatchVersion);
|
||||
int majorVersion = (int) Math.floor(maxVersion);
|
||||
int minorVersion = (int) ((maxVersion - majorVersion) * 10) + fileIndex + 1;
|
||||
|
||||
// 如果是第一个文件且没有历史版本,则从1.0开始
|
||||
if (fileIndex == 0 && CollectionUtil.isEmpty(existingFilesInDB)) {
|
||||
versionStr = "1.0";
|
||||
} else {
|
||||
versionStr = majorVersion + "." + minorVersion;
|
||||
}
|
||||
versionStr = "LT-" + versionStr;
|
||||
} else if (DesVolumeFile.PROCESS.equals(type)) {
|
||||
// 过程图纸:基于蓝图版本号
|
||||
List<DesVolumeFile> blueprintFiles = baseMapper.selectList(new LambdaQueryWrapper<DesVolumeFile>()
|
||||
.in(DesVolumeFile::getType, Arrays.asList(DesVolumeFile.BLUEPRINT, DesVolumeFile.WASTE))
|
||||
.eq(DesVolumeFile::getVolumeCatalogId, req.getVolumeCatalogId())
|
||||
.orderByDesc(DesVolumeFile::getVersion));
|
||||
.last("ORDER BY CAST(SUBSTRING(version, 4) AS DECIMAL(10, 2)) DESC"));
|
||||
|
||||
String blueprintVersion = "0.0";
|
||||
String blueprintVersion = "1.0";
|
||||
if (CollectionUtil.isNotEmpty(blueprintFiles)) {
|
||||
blueprintVersion = blueprintFiles.getFirst().getVersion();
|
||||
String version = blueprintFiles.getFirst().getVersion();
|
||||
// 提取蓝图版本号数字部分
|
||||
if (version.contains("-")) {
|
||||
blueprintVersion = version.substring(version.indexOf("-") + 1);
|
||||
} else {
|
||||
blueprintVersion = version;
|
||||
}
|
||||
}
|
||||
|
||||
String[] blueprintParts = blueprintVersion.split("\\.");
|
||||
@ -455,25 +457,32 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
if (CollectionUtil.isNotEmpty(existingFilesInDB) && existingFilesInDB.getFirst().getType().equals(DesVolumeFile.PROCESS)) {
|
||||
// 如果数据库中已存在过程图纸,则基于最高版本号递增
|
||||
String lastProcessVersion = existingFilesInDB.getFirst().getVersion();
|
||||
String[] lastParts = lastProcessVersion.split("\\.");
|
||||
String versionNumber = lastProcessVersion;
|
||||
if (lastProcessVersion.contains("-")) {
|
||||
versionNumber = lastProcessVersion.substring(lastProcessVersion.indexOf("-") + 1);
|
||||
}
|
||||
|
||||
String[] lastParts = versionNumber.split("\\.");
|
||||
int lastMajor = Integer.parseInt(lastParts[0]);
|
||||
int lastMinor = Integer.parseInt(lastParts[1]);
|
||||
|
||||
// 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从1开始
|
||||
// 如果主版本号相同,则次版本号递增;否则使用蓝图主版本号,次版本号从0开始
|
||||
if (lastMajor == blueprintMajor) {
|
||||
int minorVersion = lastMinor + fileIndex + 1;
|
||||
versionStr = lastMajor + "." + minorVersion;
|
||||
} else {
|
||||
int minorVersion = fileIndex + 1;
|
||||
int minorVersion = fileIndex;
|
||||
versionStr = blueprintMajor + "." + minorVersion;
|
||||
}
|
||||
} else {
|
||||
// 数据库中没有过程图纸,从蓝图版本的.1开始
|
||||
int minorVersion = fileIndex + 1;
|
||||
// 数据库中没有过程图纸,从蓝图版本的.0开始
|
||||
int minorVersion = fileIndex;
|
||||
versionStr = blueprintMajor + "." + minorVersion;
|
||||
}
|
||||
versionStr = "GC-" + versionStr;
|
||||
}
|
||||
|
||||
|
||||
file.setVersion(versionStr);
|
||||
file.setFileName(fileName);
|
||||
desVolumeFiles.add(file);
|
||||
@ -609,6 +618,15 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
|
||||
return null;
|
||||
});
|
||||
|
||||
//异步发送消息 项目经理 设计部主任(1961028169115197442)
|
||||
DesVolumeCatalog byId = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId());
|
||||
List<Long> longs = roleService.selectRoleIdsByName("项目经理");
|
||||
longs.add(1961028169115197442L);
|
||||
|
||||
List<SysUser> sysUsers = userService.selectUserByRoleIdsAndProjectId(longs, byId.getProjectId());
|
||||
asyncUtil.sendSms(sysUsers.stream().map(SysUser::getPhonenumber).toList(), "config5");
|
||||
asyncUtil.sendSse(sysUsers.stream().map(SysUser::getUserId).toList(), "有新的蓝图审批完成");
|
||||
}
|
||||
|
||||
}
|
||||
@ -672,6 +690,14 @@ public class DesVolumeFileServiceImpl extends ServiceImpl<DesVolumeFileMapper, D
|
||||
log.error("图纸[{}-{}]添加二维码失败", desVolumeFile.getFileName(), desVolumeFile.getId(), ex);
|
||||
return null;
|
||||
});
|
||||
//异步发送消息 项目经理 设计部主任(1961028169115197442)
|
||||
DesVolumeCatalog byId = volumeCatalogService.getById(desVolumeFile.getVolumeCatalogId());
|
||||
List<Long> longs = roleService.selectRoleIdsByName("项目经理");
|
||||
longs.add(1961028169115197442L);
|
||||
|
||||
List<SysUser> sysUsers = userService.selectUserByRoleIdsAndProjectId(longs, byId.getProjectId());
|
||||
asyncUtil.sendSms(sysUsers.stream().map(SysUser::getPhonenumber).toList(), "config5");
|
||||
asyncUtil.sendSse(sysUsers.stream().map(SysUser::getUserId).toList(), "有新的蓝图审批完成");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,108 @@
|
||||
package org.dromara.job.inspection;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.project.service.IBusProjectService;
|
||||
import org.dromara.quality.domain.QltQualityInspection;
|
||||
import org.dromara.quality.service.IQltQualityInspectionService;
|
||||
import org.dromara.safety.domain.HseSafetyInspection;
|
||||
import org.dromara.safety.service.IHseSafetyInspectionService;
|
||||
import org.dromara.sms4j.api.SmsBlend;
|
||||
import org.dromara.sms4j.api.entity.SmsResponse;
|
||||
import org.dromara.sms4j.core.factory.SmsFactory;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class InspectionJob {
|
||||
|
||||
@Resource
|
||||
private IQltQualityInspectionService qltQualityInspectionService;
|
||||
|
||||
@Resource
|
||||
private IHseSafetyInspectionService safetyInspectionService;
|
||||
|
||||
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
@JobExecutor(name = "qltInspection")
|
||||
public void qltInspection() {
|
||||
log.info("执行定时任务:质量工单短信提醒");
|
||||
List<QltQualityInspection> list = qltQualityInspectionService.list(Wrappers.<QltQualityInspection>lambdaQuery()
|
||||
.eq(QltQualityInspection::getInspectionStatus, "1")
|
||||
.eq(QltQualityInspection::getIsReply, "1")
|
||||
.lt(QltQualityInspection::getReplyPeriodDate, LocalDate.now())
|
||||
);
|
||||
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend("config4");
|
||||
|
||||
// 每500条记录作为一批进行处理
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, list.size());
|
||||
List<QltQualityInspection> batch = list.subList(i, endIndex);
|
||||
|
||||
for (QltQualityInspection qualityInspection : batch) {
|
||||
Long correctorId = qualityInspection.getCorrectorId();
|
||||
String phonenumber = userService.queryById(correctorId).getPhonenumber();
|
||||
if (phonenumber == null) {
|
||||
continue;
|
||||
}
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, (String) null);
|
||||
if (!smsResponse.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("质量工单短信提醒批次发送完成,当前批次数量: {}", batch.size());
|
||||
}
|
||||
|
||||
log.info("执行定时任务:质量工单短信提醒完成,总处理数量: {}", list.size());
|
||||
}
|
||||
|
||||
@JobExecutor(name = "safeInspection")
|
||||
public void safeInspection() {
|
||||
log.info("执行定时任务:安全工单短信提醒");
|
||||
List<HseSafetyInspection> list = safetyInspectionService.list(Wrappers.<HseSafetyInspection>lambdaQuery()
|
||||
.eq(HseSafetyInspection::getStatus, "1")
|
||||
.eq(HseSafetyInspection::getIsReply, "1")
|
||||
.lt(HseSafetyInspection::getRectificationDeadline, LocalDate.now())
|
||||
);
|
||||
|
||||
SmsBlend smsBlend = SmsFactory.getSmsBlend("config6");
|
||||
|
||||
// 每500条记录作为一批进行处理
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < list.size(); i += batchSize) {
|
||||
int endIndex = Math.min(i + batchSize, list.size());
|
||||
List<HseSafetyInspection> batch = list.subList(i, endIndex);
|
||||
|
||||
for (HseSafetyInspection safetyInspection : batch) {
|
||||
Long correctorId = safetyInspection.getCorrectorId();
|
||||
String phonenumber = userService.queryById(correctorId).getPhonenumber();
|
||||
if (phonenumber == null) {
|
||||
continue;
|
||||
}
|
||||
SmsResponse smsResponse = smsBlend.sendMessage(phonenumber, (String) null);
|
||||
if (!smsResponse.isSuccess()) {
|
||||
log.error("验证码短信发送异常 => {}", smsResponse);
|
||||
}
|
||||
}
|
||||
|
||||
log.info("安全工单短信提醒批次发送完成,当前批次数量: {}", batch.size());
|
||||
}
|
||||
|
||||
log.info("执行定时任务:安全工单短信提醒完成,总处理数量: {}", list.size());
|
||||
}
|
||||
}
|
||||
@ -11,6 +11,7 @@ import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAddReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAuditDto;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
@ -45,7 +46,7 @@ public class BusLeaveAppController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前登录用户补卡审批列表
|
||||
* 查询当前登录用户请假审批列表
|
||||
*/
|
||||
@GetMapping("/list/auditUser")
|
||||
public TableDataInfo<BusLeaveVo> listByAuditUser(BusLeaveQueryReq req, PageQuery pageQuery) {
|
||||
@ -55,7 +56,7 @@ public class BusLeaveAppController extends BaseController {
|
||||
|
||||
|
||||
/**
|
||||
* 查询角色补卡审批列表
|
||||
* 查询角色请假审批列表
|
||||
*/
|
||||
@GetMapping("/list/auditRole")
|
||||
public TableDataInfo<BusLeaveVo> listByAuditRole(BusLeaveQueryReq req, PageQuery pageQuery) {
|
||||
@ -63,8 +64,6 @@ public class BusLeaveAppController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 提交请假
|
||||
*/
|
||||
@ -75,5 +74,14 @@ public class BusLeaveAppController extends BaseController {
|
||||
return R.ok(leaveService.add(req));
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批
|
||||
*/
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Boolean> audit(@RequestBody BusLeaveAuditDto dto) {
|
||||
return R.ok(leaveService.audit(dto));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.project.domain.dto.leave;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BusLeaveAuditDto {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 意见(1未读 2同意 3拒绝)
|
||||
*/
|
||||
private String gangerOpinion;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package org.dromara.project.domain.vo.reissuecard;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuditUserVo {
|
||||
private Long userId;
|
||||
private String nickName;
|
||||
private String avatar;
|
||||
}
|
||||
@ -7,11 +7,13 @@ import lombok.Data;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import org.dromara.project.domain.BusReissueCard;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
@ -161,4 +163,15 @@ public class BusReissueCardVo implements Serializable {
|
||||
* 补卡类型(1上班 2下班)
|
||||
*/
|
||||
private String reissueCardType;
|
||||
|
||||
|
||||
/**
|
||||
* 申请人类型(0-施工人员 1-管理人员 2-分包人员)
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
/**
|
||||
* 审批人列表
|
||||
*/
|
||||
private List<AuditUserVo> auditors;
|
||||
}
|
||||
|
||||
@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.project.domain.BusLeave;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAddReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveGangerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveManagerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.dto.leave.*;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
import org.dromara.project.domain.vo.reissuecard.BusReissueCardVo;
|
||||
@ -128,6 +125,6 @@ public interface IBusLeaveService extends IService<BusLeave> {
|
||||
TableDataInfo<BusLeaveVo> listByAuditRole(BusLeaveQueryReq req, PageQuery pageQuery);
|
||||
|
||||
|
||||
|
||||
Boolean audit(BusLeaveAuditDto dto);
|
||||
|
||||
}
|
||||
|
||||
@ -592,18 +592,20 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
.eq(BusUserProjectRelevancy::getProjectId, projectId)
|
||||
.last("limit 1"));
|
||||
if (relevancy == null) {
|
||||
throw new ServiceException("当前用户未加入项目", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("当前用户未加入项目", HttpStatus.ERROR);
|
||||
}
|
||||
//判断是否是管理员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围
|
||||
boolean isAdmin = "2".equals(relevancy.getUserType());
|
||||
SysUserVo sysUserVo = userService.queryById(userId);
|
||||
|
||||
//判断是否是施工人员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围
|
||||
boolean isWork = "0".equals(sysUserVo.getAppUserType());
|
||||
List<Long> rangeIds = new ArrayList<>();
|
||||
if (!isAdmin) {
|
||||
if (isWork) {
|
||||
BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.lambdaQuery(BusProjectTeamMember.class)
|
||||
.eq(BusProjectTeamMember::getMemberId, userId)
|
||||
.eq(BusProjectTeamMember::getProjectId, projectId)
|
||||
.last("limit 1"));
|
||||
if (one == null) {
|
||||
throw new ServiceException("当前用户未加入班组", HttpStatus.BAD_REQUEST);
|
||||
throw new ServiceException("当前用户未加入班组", HttpStatus.ERROR);
|
||||
}
|
||||
BusProjectTeam team = projectTeamService.getById(one.getTeamId());
|
||||
try {
|
||||
|
||||
@ -29,12 +29,9 @@ import org.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.*;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveAddReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveGangerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.*;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.enums.*;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveManagerReviewReq;
|
||||
import org.dromara.project.domain.dto.leave.BusLeaveQueryReq;
|
||||
import org.dromara.project.domain.vo.leave.BusLeaveVo;
|
||||
import org.dromara.project.domain.vo.reissuecard.BusReissueCardVo;
|
||||
import org.dromara.project.mapper.BusLeaveMapper;
|
||||
@ -391,7 +388,7 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
public Long add(BusLeaveAddReq req) {
|
||||
// 1. 转换请求对象
|
||||
BusLeave leave = new BusLeave();
|
||||
BeanUtils.copyProperties(leave, req);
|
||||
BeanUtils.copyProperties(req, leave);
|
||||
|
||||
// 2. 获取当前用户ID和时间区间
|
||||
Long userId = req.getUserId();
|
||||
@ -483,17 +480,73 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave>
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean audit(BusLeaveAuditDto dto) {
|
||||
BusLeave busLeave = baseMapper.selectById(dto.getId());
|
||||
if (busLeave == null) {
|
||||
throw new ServiceException("未找到该申请");
|
||||
}
|
||||
String gangerOpinion = dto.getGangerOpinion();
|
||||
busLeave.setGangerOpinion(gangerOpinion);
|
||||
int i = baseMapper.updateById(busLeave);
|
||||
|
||||
if(gangerOpinion.equals("2")){
|
||||
if(busLeave.getTimeType().equals("1")){
|
||||
LocalDateTime startTime = busLeave.getStartTime();
|
||||
LocalDateTime endTime = busLeave.getEndTime();
|
||||
LocalDate startDate = startTime.toLocalDate();
|
||||
LocalDate endDate = endTime.toLocalDate();
|
||||
|
||||
List<BusAttendance> list = attendanceService.list(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, busLeave.getProjectId())
|
||||
.le(BusAttendance::getClockDate, endDate)
|
||||
.ge(BusAttendance::getClockDate, startDate)
|
||||
.eq(BusAttendance::getUserId, busLeave.getUserId())
|
||||
);
|
||||
for (BusAttendance attendance : list) {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LATE.getValue());
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
attendanceService.updateBatchById(list);
|
||||
}
|
||||
}else if(busLeave.getTimeType().equals("2")){
|
||||
if(busLeave.getPeriodType().equals("1")){
|
||||
LocalDateTime startTime = busLeave.getStartTime();
|
||||
LocalDate localDate = startTime.toLocalDate();
|
||||
List<BusAttendance> list = attendanceService.list(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, busLeave.getProjectId())
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.eq(BusAttendance::getClockType, "1")
|
||||
.eq(BusAttendance::getUserId, busLeave.getUserId())
|
||||
);
|
||||
for (BusAttendance attendance : list) {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LATE.getValue());
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
attendanceService.updateBatchById(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}else if(busLeave.getPeriodType().equals("2")){
|
||||
LocalDateTime endTime = busLeave.getEndTime();
|
||||
LocalDate localDate = endTime.toLocalDate();
|
||||
List<BusAttendance> list = attendanceService.list(Wrappers.lambdaQuery(BusAttendance.class)
|
||||
.eq(BusAttendance::getProjectId, busLeave.getProjectId())
|
||||
.eq(BusAttendance::getClockDate, localDate)
|
||||
.eq(BusAttendance::getClockType, "2")
|
||||
.eq(BusAttendance::getUserId, busLeave.getUserId())
|
||||
);
|
||||
for (BusAttendance attendance : list) {
|
||||
attendance.setClockStatus(BusAttendanceClockStatusEnum.LATE.getValue());
|
||||
}
|
||||
if(!list.isEmpty()){
|
||||
attendanceService.updateBatchById(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return i>0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||
|
||||
@ -2,6 +2,7 @@ package org.dromara.project.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -34,9 +35,12 @@ import org.dromara.project.domain.enums.BusOpinionStatusEnum;
|
||||
import org.dromara.project.domain.enums.BusReviewStatusEnum;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardManagerReviewReq;
|
||||
import org.dromara.project.domain.dto.reissuecard.BusReissueCardQueryReq;
|
||||
import org.dromara.project.domain.vo.reissuecard.AuditUserVo;
|
||||
import org.dromara.project.domain.vo.reissuecard.BusReissueCardVo;
|
||||
import org.dromara.project.mapper.BusReissueCardMapper;
|
||||
import org.dromara.project.service.*;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.domain.SysUserRole;
|
||||
import org.dromara.system.domain.vo.SysOssVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysOssService;
|
||||
@ -108,14 +112,42 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
|
||||
}
|
||||
BusProject byId = projectService.getById(busReissueCardVo.getProjectId());
|
||||
busReissueCardVo.setProjectName(byId.getProjectName());
|
||||
|
||||
String userType = busReissueCardVo.getUserType();
|
||||
//两个角色 一个审核分包的=6,一个审核管理的=7
|
||||
List<SysUser> sysUsers = new ArrayList<>();
|
||||
if("1".equals(userType)){
|
||||
sysUsers = userService.selectUserByRoleIdAndProjectId(6L, busReissueCardVo.getProjectId());
|
||||
} else if ("2".equals(userType)) {
|
||||
sysUsers = userService.selectUserByRoleIdAndProjectId(7L, busReissueCardVo.getProjectId());
|
||||
}else{
|
||||
SysUserVo sysUserVo = userService.selectUserById(busReissueCardVo.getGangerId());
|
||||
if(sysUserVo != null){
|
||||
busReissueCardVo.setGangerName(sysUserVo.getNickName());
|
||||
if(sysUserVo.getAvatar() != null){
|
||||
SysOssVo byId1 = ossService.getById(sysUserVo.getAvatar());
|
||||
if(byId1 != null){
|
||||
busReissueCardVo.setAvatar(byId1.getUrl());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if(CollectionUtil.isNotEmpty(sysUsers)){
|
||||
busReissueCardVo.setAuditors(sysUsers.stream().map(sysUser -> {
|
||||
AuditUserVo userVo = new AuditUserVo();
|
||||
userVo.setUserId(sysUser.getUserId());
|
||||
userVo.setNickName(sysUser.getNickName());
|
||||
if(sysUser.getAvatar() != null){
|
||||
SysOssVo byId1 = ossService.getById(sysUser.getAvatar());
|
||||
if(byId1 != null){
|
||||
userVo.setAvatar(byId1.getUrl());
|
||||
}
|
||||
}
|
||||
return userVo;
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
return busReissueCardVo;
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +64,8 @@ import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.dromara.common.core.constant.TenantConstants.SUPER_ADMIN_ID;
|
||||
|
||||
/**
|
||||
* 安全巡检工单Service业务层处理
|
||||
*
|
||||
@ -519,7 +521,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
Long correctorId = safetyInspection.getCorrectorId();
|
||||
// 只有指定用户可以整改
|
||||
Long userId = LoginHelper.getUserId();
|
||||
if (!correctorId.equals(userId)) {
|
||||
if (!correctorId.equals(userId) && !SUPER_ADMIN_ID.equals(userId)) {
|
||||
throw new ServiceException("当前用户不是指定整改人", HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
HseSafetyInspection updateInspection = new HseSafetyInspection();
|
||||
@ -534,7 +536,6 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl<HseSafetyInspect
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
// 填充默认值
|
||||
updateInspection.setId(id);
|
||||
|
||||
@ -218,4 +218,7 @@ public interface ISysRoleService {
|
||||
|
||||
|
||||
List<Long> selectRoleIdsByUserIdAndProjectId(Long userId,Long projectId);
|
||||
|
||||
|
||||
List<Long> selectRoleIdsByName(String roleName);
|
||||
}
|
||||
|
||||
@ -276,4 +276,8 @@ public interface ISysUserService {
|
||||
List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId);
|
||||
|
||||
Boolean updateFb(Long userId,Long contractorId);
|
||||
|
||||
List<SysUser> selectUserByRoleIdAndProjectId(Long roleId,Long projectId);
|
||||
|
||||
List<SysUser> selectUserByRoleIdsAndProjectId(List<Long> roleIds,Long projectId);
|
||||
}
|
||||
|
||||
@ -653,4 +653,11 @@ public class SysRoleServiceImpl implements ISysRoleService, RoleService {
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectRoleIdsByName(String roleName) {
|
||||
return baseMapper.selectList(Wrappers.lambdaQuery(SysRole.class)
|
||||
.eq(SysRole::getRoleName, roleName)
|
||||
).stream().map(SysRole::getRoleId).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@ -940,6 +940,17 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
}
|
||||
userRoleMapper.insertBatch(sysUserRoles);
|
||||
|
||||
if(CollectionUtil.isNotEmpty(projectIds)){
|
||||
List<BusUserProjectRelevancy> relevancies = new ArrayList<>();
|
||||
for (Long project : projectIds) {
|
||||
BusUserProjectRelevancy relevancy = new BusUserProjectRelevancy();
|
||||
relevancy.setProjectId(project);
|
||||
relevancy.setUserId(userId);
|
||||
relevancies.add(relevancy);
|
||||
}
|
||||
userProjectRelevancyService.saveBatch(relevancies);
|
||||
}
|
||||
|
||||
return baseMapper.update(null,
|
||||
new LambdaUpdateWrapper<SysUser>()
|
||||
.set(SysUser::getAppUserType, appUserType)
|
||||
@ -1226,6 +1237,41 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
||||
return baseMapper.updateById(sysUser)>0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserByRoleIdAndProjectId(Long roleId, Long projectId) {
|
||||
|
||||
List<SysUserRole> sysUserRoles = userRoleMapper.selectList(Wrappers.lambdaQuery(SysUserRole.class)
|
||||
.eq(SysUserRole::getRoleId, roleId)
|
||||
.eq(SysUserRole::getProjectId, projectId)
|
||||
);
|
||||
List<Long> list1 = sysUserRoles.stream().map(SysUserRole::getUserId).toList();
|
||||
if (CollUtil.isNotEmpty(list1)) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserId, SysUser::getNickName, SysUser::getAvatar,SysUser::getPhonenumber)
|
||||
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
||||
.in(SysUser::getUserId, list1)
|
||||
);
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysUser> selectUserByRoleIdsAndProjectId(List<Long> roleIds, Long projectId) {
|
||||
List<SysUserRole> sysUserRoles = userRoleMapper.selectList(Wrappers.lambdaQuery(SysUserRole.class)
|
||||
.in(SysUserRole::getRoleId, roleIds)
|
||||
.eq(SysUserRole::getProjectId, projectId)
|
||||
);
|
||||
List<Long> list1 = sysUserRoles.stream().map(SysUserRole::getUserId).toList();
|
||||
if (CollUtil.isNotEmpty(list1)) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysUser>()
|
||||
.select(SysUser::getUserId, SysUser::getNickName, SysUser::getAvatar,SysUser::getPhonenumber)
|
||||
.eq(SysUser::getStatus, SystemConstants.NORMAL)
|
||||
.in(SysUser::getUserId, list1)
|
||||
);
|
||||
}
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserDTO selectUser(Long userId) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user