更新
This commit is contained in:
parent
564d36f2d8
commit
a8a8fa0aea
@ -14,7 +14,7 @@ public class InspectionConstants {
|
||||
public static final String INSPECTION_BASE_STAFF_ROLE = "jcworker";
|
||||
|
||||
/**
|
||||
* 文件类型:文件加
|
||||
* 文件类型:文件夹
|
||||
*/
|
||||
public static final String INSPECTION_FOLDER = "1";
|
||||
|
||||
@ -32,4 +32,14 @@ public class InspectionConstants {
|
||||
* 是员工附件
|
||||
*/
|
||||
public static final Integer INSPECTION_IS_STAFF_FILE = 0;
|
||||
|
||||
/**
|
||||
* key的类型为员工
|
||||
*/
|
||||
public static final String INSPECTION_STAFF_KEY = "staff";
|
||||
|
||||
/**
|
||||
* key的类型为设备
|
||||
*/
|
||||
public static final String INSPECTION_STAFF_EQUIPMENT_KEY = "equipment";
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.constant;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @Description: 文件默认key
|
||||
* @Author: 86187
|
||||
* @Date: 2025/03/24 15:03
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Getter
|
||||
public enum InspectionFileEnum {
|
||||
FOLDER("staff", "员工文件夹"),
|
||||
FILE("equipment", "设备文件夹");
|
||||
|
||||
private final String type;
|
||||
private final String desc;
|
||||
|
||||
InspectionFileEnum(String type, String desc) {
|
||||
this.type = type;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据type 获取desc
|
||||
*/
|
||||
public static String getDescByType(String type) {
|
||||
for (InspectionFileEnum value : values()) {
|
||||
if (value.getType().equals(type)) {
|
||||
return value.getDesc();
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
}
|
@ -199,4 +199,13 @@ public class InspectionFileController extends BaseController {
|
||||
List<Long> userIds = inspectionFileService.getUserIdsByFileId(fileId);
|
||||
return success(userIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件夹树
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryTreeFolder")
|
||||
public CommonResult<?> queryTreeFolder(){
|
||||
return success(inspectionFileService.queryTreeFolder());
|
||||
}
|
||||
}
|
||||
|
@ -50,6 +50,9 @@ public class InspectionFile extends TenantBaseDO
|
||||
@Excel(name = "提醒时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date warnTime;
|
||||
|
||||
/** 员工、设备的默认文件夹*/
|
||||
private String defaultKey;
|
||||
|
||||
/**
|
||||
* 是否为员工附 0-是 1-否
|
||||
*/
|
||||
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.inspection.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Treeselect树结构实体类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Data
|
||||
public class TreeCommonResult implements Serializable
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 节点ID */
|
||||
private Long value;
|
||||
|
||||
/** 节点名称 */
|
||||
private String label;
|
||||
|
||||
/** 子节点 */
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<TreeCommonResult> children;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.inspection.service;
|
||||
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
|
||||
import cn.iocoder.yudao.module.inspection.entity.TreeCommonResult;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -115,5 +116,11 @@ public interface IInspectionFileService extends IService<InspectionFile> {
|
||||
* @param folderName 文件夹名称
|
||||
* @return 文件夹id
|
||||
*/
|
||||
Long addFolder(String folderName);
|
||||
Long addFolder(String folderName, String key);
|
||||
|
||||
/**
|
||||
* 查询文件夹树
|
||||
* @return 文件夹树
|
||||
*/
|
||||
List<TreeCommonResult> queryTreeFolder();
|
||||
}
|
||||
|
@ -148,35 +148,40 @@ public class InspectionAppointmentServiceImpl extends ServiceImpl<InspectionAppo
|
||||
//给联系人发送
|
||||
SendSmsUtil.sendMsgCommon(new String[]{Optional.ofNullable(appointment.getCarNo()).orElse(""),
|
||||
appointment.getAppointmentDay(),partners.getPartnerName(),partners.getAddress(),sysUser.getNickname()+" "+sysUser.getMobile()
|
||||
},appointment.getOtherPhone(),"1400852709","机动车管家小程序","2112754");
|
||||
// },appointment.getOtherPhone(),"1400852709","机动车管家小程序","2112754");
|
||||
},appointment.getOtherPhone(),"1400852709","机动车管家小程序","2386324");
|
||||
|
||||
}else {
|
||||
//给本人发送
|
||||
//给联系人发送
|
||||
//给联系人发送
|
||||
SendSmsUtil.sendMsgCommon(new String[]{Optional.ofNullable(appointment.getCarNo()).orElse(""),
|
||||
appointment.getAppointmentDay(),partners.getPartnerName(),partners.getAddress(),sysUser.getNickname()+" "+sysUser.getMobile()
|
||||
},ownUser.getMobile(),"1400852709","机动车管家小程序","2112754");
|
||||
// },ownUser.getMobile(),"1400852709","机动车管家小程序","2112754");
|
||||
},ownUser.getMobile(),"1400852709","机动车管家小程序","2386324");
|
||||
}
|
||||
}else {
|
||||
if (StringUtils.isNotEmpty(appointment.getOtherPhone())){
|
||||
//给联系人发送
|
||||
SendSmsUtil.sendMsgCommon(new String[]{Optional.ofNullable(appointment.getCarNo()).orElse("")
|
||||
,partners.getPartnerName(),sysUser.getNickname(),sysUser.getMobile()
|
||||
},appointment.getOtherPhone(),"1400852709","机动车管家小程序","2112792");
|
||||
// },appointment.getOtherPhone(),"1400852709","机动车管家小程序","2112792");
|
||||
},appointment.getOtherPhone(),"1400852709","机动车管家小程序","2386324");
|
||||
|
||||
}else {
|
||||
//给本人发送
|
||||
//给联系人发送
|
||||
SendSmsUtil.sendMsgCommon(new String[]{Optional.ofNullable(appointment.getCarNo()).orElse("")
|
||||
,partners.getPartnerName(),sysUser.getNickname(),sysUser.getMobile()
|
||||
},ownUser.getMobile(),"1400852709","机动车管家小程序","2112792");
|
||||
// },ownUser.getMobile(),"1400852709","机动车管家小程序","2112792");
|
||||
},ownUser.getMobile(),"1400852709","机动车管家小程序","2386324");
|
||||
}
|
||||
}
|
||||
//给检测站发送
|
||||
//给联系人发送
|
||||
SendSmsUtil.sendMsgCommon(new String[]{Optional.ofNullable(appointment.getCarNo()).orElse("")
|
||||
,appointment.getGoodsTitle()
|
||||
},sysUser.getMobile(),"1400852709","机动车管家小程序","2112868");
|
||||
// },sysUser.getMobile(),"1400852709","机动车管家小程序","2112868");
|
||||
},sysUser.getMobile(),"1400852709","机动车管家小程序","2386324");
|
||||
}catch (Exception ignored){
|
||||
log.error(ignored.getMessage());
|
||||
}
|
||||
|
@ -227,7 +227,7 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
|
||||
public Long addFolder(Long id) {
|
||||
InspectionEquInfo inspectionEquInfo = this.getById(id);
|
||||
if (ObjectUtil.isNotEmpty(inspectionEquInfo)) {
|
||||
Long folderId = inspectionFileService.addFolder(inspectionEquInfo.getEquName());
|
||||
Long folderId = inspectionFileService.addFolder(inspectionEquInfo.getEquName(), InspectionConstants.INSPECTION_STAFF_EQUIPMENT_KEY);
|
||||
//修改文件夹id
|
||||
this.update(Wrappers.<InspectionEquInfo>lambdaUpdate().eq(InspectionEquInfo::getId, id).set(InspectionEquInfo::getFolderId, folderId));
|
||||
return folderId;
|
||||
|
@ -7,10 +7,8 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.module.constant.InspectionConstants;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionFileRecord;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionFileUser;
|
||||
import cn.iocoder.yudao.module.inspection.entity.WarnMessage;
|
||||
import cn.iocoder.yudao.module.constant.InspectionFileEnum;
|
||||
import cn.iocoder.yudao.module.inspection.entity.*;
|
||||
import cn.iocoder.yudao.module.inspection.mapper.InspectionFileMapper;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
|
||||
import cn.iocoder.yudao.module.inspection.service.IWarnMessageService;
|
||||
@ -171,7 +169,12 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
||||
//保存记录
|
||||
fileRecordService.save(inspectionFileRecord);
|
||||
}
|
||||
return baseMapper.updateById(inspectionFile);
|
||||
return baseMapper.update(Wrappers.lambdaUpdate(InspectionFile.class).set(InspectionFile::getUpdateTime, new Date())
|
||||
.set(InspectionFile::getFileName, inspectionFile.getFileName())
|
||||
.set(ObjectUtil.isNotEmpty(inspectionFile.getFilePath()), InspectionFile::getFilePath, inspectionFile.getFilePath())
|
||||
.set(ObjectUtil.isNotEmpty(inspectionFile.getWarnTime()), InspectionFile::getWarnTime, inspectionFile.getWarnTime())
|
||||
.set(InspectionFile::getFatherId, inspectionFile.getFatherId())
|
||||
.eq(InspectionFile::getId, inspectionFile.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -393,8 +396,23 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
||||
* @return 文件夹id
|
||||
*/
|
||||
@Override
|
||||
public Long addFolder(String folderName) {
|
||||
public Long addFolder(String folderName, String key) {
|
||||
//根据key找到对应的文件夹id
|
||||
InspectionFile fatherFolder = baseMapper.selectOne(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getDefaultKey, key));
|
||||
|
||||
//如果默认文件夹为空就新建
|
||||
if (fatherFolder == null) {
|
||||
fatherFolder = new InspectionFile();
|
||||
fatherFolder.setFileName(InspectionFileEnum.getDescByType(key));
|
||||
fatherFolder.setType(InspectionConstants.INSPECTION_FOLDER);
|
||||
fatherFolder.setDefaultKey(key);
|
||||
baseMapper.insert(fatherFolder);
|
||||
fatherFolder.setFileCode(fatherFolder.getId() + ",");
|
||||
baseMapper.updateById(fatherFolder);
|
||||
}
|
||||
|
||||
InspectionFile inspectionFile = new InspectionFile();
|
||||
inspectionFile.setFatherId(fatherFolder.getId());
|
||||
inspectionFile.setFileName(folderName + InspectionConstants.INSPECTION_FOLDER_SUFFIX);
|
||||
inspectionFile.setType(InspectionConstants.INSPECTION_FOLDER);
|
||||
inspectionFile.setIsStaffFile(InspectionConstants.INSPECTION_IS_STAFF_FILE);
|
||||
@ -405,6 +423,63 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
||||
return inspectionFile.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件夹树
|
||||
*
|
||||
* @return 文件夹树
|
||||
*/
|
||||
@Override
|
||||
public List<TreeCommonResult> queryTreeFolder() {
|
||||
//查询出所有文件夹
|
||||
List<InspectionFile> inspectionFiles = baseMapper.selectList(new LambdaQueryWrapper<InspectionFile>()
|
||||
.eq(InspectionFile::getType, InspectionConstants.INSPECTION_FOLDER)
|
||||
.orderBy(false, false, InspectionFile::getCreateTime));
|
||||
|
||||
//组成属性结构
|
||||
return buildTree(inspectionFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建树形结构
|
||||
*
|
||||
* @param files
|
||||
* @return
|
||||
*/
|
||||
public static List<TreeCommonResult> buildTree(List<InspectionFile> files) {
|
||||
// 1. 先创建一个 Map,方便查找每个节点
|
||||
Map<Long, TreeCommonResult> nodeMap = files.stream().collect(Collectors.toMap(
|
||||
InspectionFile::getId,
|
||||
file -> {
|
||||
TreeCommonResult node = new TreeCommonResult();
|
||||
node.setValue(file.getId());
|
||||
node.setLabel(file.getFileName());
|
||||
return node;
|
||||
}
|
||||
));
|
||||
|
||||
List<TreeCommonResult> rootNodes = new ArrayList<>();
|
||||
|
||||
// 2. 遍历文件列表,找到每个节点的父节点
|
||||
for (InspectionFile file : files) {
|
||||
TreeCommonResult node = nodeMap.get(file.getId());
|
||||
Long parentId = file.getFatherId();
|
||||
|
||||
if (parentId == null || !nodeMap.containsKey(parentId)) {
|
||||
// 根节点(父ID为空或不存在于Map)
|
||||
rootNodes.add(node);
|
||||
} else {
|
||||
// 不是根节点,加入父节点的 children
|
||||
TreeCommonResult parentNode = nodeMap.get(parentId);
|
||||
if (parentNode.getChildren() == null) {
|
||||
parentNode.setChildren(new ArrayList<>());
|
||||
}
|
||||
parentNode.getChildren().add(node);
|
||||
}
|
||||
}
|
||||
|
||||
return rootNodes;
|
||||
}
|
||||
|
||||
// 获取文件夹内的所有文件(包括子文件夹的内容)
|
||||
private List<InspectionFile> getFilesInFolder(Long folderId, List<Long> accessibleFileIds, Map<Long, InspectionFile> fileCache) {
|
||||
List<InspectionFile> filesInFolder = new ArrayList<>();
|
||||
|
@ -735,7 +735,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
// 定义一个数组来保存所有的CompletableFuture
|
||||
CompletableFuture<Void>[] futures = new CompletableFuture[6];
|
||||
|
||||
for (int i = 0; i < 6; i++) {
|
||||
for (int i = 1; i < 6; i++) {
|
||||
final String status = String.valueOf(i);
|
||||
|
||||
// 复制一份inspectionInfo对象,避免多线程修改同一个对象导致的问题
|
||||
|
@ -145,21 +145,12 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
|
||||
if (ObjectUtil.isNotEmpty(inspectionStaffSaveVo.getDriverLicenseType())) {
|
||||
inspectionStaffSaveVo.setDriverLicenseTypeArr(Arrays.asList(inspectionStaffSaveVo.getDriverLicenseType().split(",")));
|
||||
}
|
||||
//查询文件附件
|
||||
//查询文件表文件夹id是否存在
|
||||
if (ObjectUtil.isNotEmpty(inspectionStaffSaveVo.getFolderId())) {
|
||||
List<InspectionFile> fileList = inspectionFileService.list(Wrappers.<InspectionFile>lambdaQuery()
|
||||
.eq(InspectionFile::getFatherId, inspectionStaffSaveVo.getFolderId())
|
||||
.eq(InspectionFile::getIsStaffFile, InspectionConstants.INSPECTION_IS_STAFF_FILE));
|
||||
|
||||
List<FileDO> copyFileList = new ArrayList<>();
|
||||
for (InspectionFile inspectionFile : fileList) {
|
||||
FileDO fileDO = new FileDO();
|
||||
//把文件名后缀截取掉
|
||||
fileDO.setUrl(inspectionFile.getFilePath());
|
||||
fileDO.setName(inspectionFile.getFileName());
|
||||
copyFileList.add(fileDO);
|
||||
InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery().eq(InspectionFile::getId, inspectionStaffSaveVo.getFolderId()));
|
||||
if (ObjectUtil.isNull(folder)) {
|
||||
inspectionStaffSaveVo.setFolderId(null);
|
||||
}
|
||||
inspectionStaffSaveVo.setFileList(copyFileList);
|
||||
}
|
||||
return inspectionStaffSaveVo;
|
||||
}
|
||||
@ -236,7 +227,7 @@ public class InspectionStaffServiceImpl extends ServiceImpl<InspectionStaffMappe
|
||||
public Long addFolder(Long userId) {
|
||||
AdminUserDO user = userService.getUser(userId);
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
Long folderId = inspectionFileService.addFolder(user.getNickname());
|
||||
Long folderId = inspectionFileService.addFolder(user.getNickname(), InspectionConstants.INSPECTION_STAFF_KEY);
|
||||
|
||||
//查询员工子表是否存在数据
|
||||
InspectionStaff staff = this.getOne(Wrappers.<InspectionStaff>lambdaQuery().eq(InspectionStaff::getUserId, userId));
|
||||
|
@ -62,7 +62,7 @@ public class SendSmsUtil {
|
||||
req.setSmsSdkAppId(sdkAppId);
|
||||
req.setSignName(signName);
|
||||
req.setTemplateId(templateId);
|
||||
req.setTemplateParamSet(templateParamSet);
|
||||
// req.setTemplateParamSet(templateParamSet);
|
||||
// 返回的resp是一个SendSmsResponse的实例,与请求对象对应
|
||||
SendSmsResponse resp = client.SendSms(req);
|
||||
// 输出json格式的字符串回包
|
||||
|
@ -37,6 +37,8 @@ public class SecurityConfiguration {
|
||||
.antMatchers(adminSeverContextPath + "/**").anonymous();
|
||||
// 文件读取
|
||||
registry.antMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll();
|
||||
//腾讯cos
|
||||
registry.antMatchers(buildAdminApi("/cos/**")).permitAll();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -306,6 +306,7 @@ yudao:
|
||||
- /admin-api/jx/auth/**
|
||||
- /admin-api/jx/**
|
||||
- /admin-api/jx/auth/getAppInfo
|
||||
- /admin-api/cos/**
|
||||
ignore-tables:
|
||||
- system_tenant
|
||||
- system_tenant_package
|
||||
|
Loading…
Reference in New Issue
Block a user