Compare commits
3 Commits
1805dfc0d8
...
ea1e7576da
Author | SHA1 | Date |
---|---|---|
|
ea1e7576da | |
|
14b0b60562 | |
|
0f971f4689 |
|
@ -47,7 +47,7 @@ public class Schedule {
|
||||||
List<ImageEntity> successList = new ArrayList<>();
|
List<ImageEntity> successList = new ArrayList<>();
|
||||||
for (ImageEntity image : list) {
|
for (ImageEntity image : list) {
|
||||||
PartResp partResp = partRespMap.get(image.getPartId());
|
PartResp partResp = partRespMap.get(image.getPartId());
|
||||||
FilePathEnum pathEnum = image.getImagePath().contains("temp") ? FilePathEnum.IMAGE_TEMP : FilePathEnum.IMAGE;
|
FilePathEnum pathEnum = FilePathEnum.getFilePathEnum(image.getImagePath());
|
||||||
String inputFile = pathEnum.getFileAbsolutePath(image.getImagePath());
|
String inputFile = pathEnum.getFileAbsolutePath(image.getImagePath());
|
||||||
String outputDir = FilePathEnum.IMAGE.getFileAbsolutePathPrefix()
|
String outputDir = FilePathEnum.IMAGE.getFileAbsolutePathPrefix()
|
||||||
.concat("已调整")
|
.concat("已调整")
|
||||||
|
|
|
@ -27,6 +27,9 @@ public class ImageListReq implements Serializable {
|
||||||
@ApiModelProperty("部件id")
|
@ApiModelProperty("部件id")
|
||||||
private String partId;
|
private String partId;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目id")
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
@ApiModelProperty("图像类型")
|
@ApiModelProperty("图像类型")
|
||||||
private String[] imageTypes;
|
private String[] imageTypes;
|
||||||
|
|
||||||
|
|
|
@ -55,4 +55,23 @@ public enum FilePathEnum {
|
||||||
return StrUtil.replace(urlPath.concat(relativePath), FileUtil.FILE_SEPARATOR, StrUtil.SLASH);
|
return StrUtil.replace(urlPath.concat(relativePath), FileUtil.FILE_SEPARATOR, StrUtil.SLASH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能描述:根据文件路径前缀获取文件路径ENUM
|
||||||
|
*
|
||||||
|
* @param fileDownPath 文件路径
|
||||||
|
* @return {@link FilePathEnum }
|
||||||
|
* @author cuizhibin
|
||||||
|
* @date 2025/07/27 16:00
|
||||||
|
**/
|
||||||
|
public static FilePathEnum getFilePathEnum(String fileDownPath) {
|
||||||
|
if (StrUtil.startWith(fileDownPath, FilePathEnum.IMAGE_TEMP.getUrlPath())) {
|
||||||
|
return FilePathEnum.IMAGE_TEMP;
|
||||||
|
}
|
||||||
|
for (FilePathEnum pathEnum : FilePathEnum.values()) {
|
||||||
|
if (StrUtil.startWith(fileDownPath, FilePathEnum.IMAGE_TEMP.getUrlPath())) {
|
||||||
|
return pathEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FilePathEnum.ATTACH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
}
|
}
|
||||||
image.setImageType(ImageTypeEnum.DEFECT.getCode());
|
image.setImageType(ImageTypeEnum.DEFECT.getCode());
|
||||||
imageService.updateById(image);
|
imageService.updateById(image);
|
||||||
FilePathEnum pathEnum = image.getImagePath().contains("temp") ? FilePathEnum.IMAGE_TEMP : FilePathEnum.IMAGE;
|
FilePathEnum pathEnum = FilePathEnum.getFilePathEnum(image.getImagePath());
|
||||||
String inputPath = pathEnum.getFileAbsolutePath(image.getImagePath());
|
String inputPath = pathEnum.getFileAbsolutePath(image.getImagePath());
|
||||||
// 写入attach同层级文件夹下
|
// 写入attach同层级文件夹下
|
||||||
String attachPath = FilePathEnum.ATTACH.getUrlPath() + StrUtil.removePrefix(image.getImagePath(), pathEnum.getUrlPath());
|
String attachPath = FilePathEnum.ATTACH.getUrlPath() + StrUtil.removePrefix(image.getImagePath(), pathEnum.getUrlPath());
|
||||||
|
|
|
@ -8,8 +8,8 @@ import com.dite.znpt.converts.Converts;
|
||||||
import com.dite.znpt.domain.entity.ImageCollectEntity;
|
import com.dite.znpt.domain.entity.ImageCollectEntity;
|
||||||
import com.dite.znpt.domain.entity.ImageEntity;
|
import com.dite.znpt.domain.entity.ImageEntity;
|
||||||
import com.dite.znpt.domain.vo.ImageCollectReq;
|
import com.dite.znpt.domain.vo.ImageCollectReq;
|
||||||
|
import com.dite.znpt.domain.vo.ImageReq;
|
||||||
import com.dite.znpt.enums.FilePathEnum;
|
import com.dite.znpt.enums.FilePathEnum;
|
||||||
import com.dite.znpt.enums.ImageSourceEnum;
|
|
||||||
import com.dite.znpt.exception.ServiceException;
|
import com.dite.znpt.exception.ServiceException;
|
||||||
import com.dite.znpt.mapper.ImageCollectMapper;
|
import com.dite.znpt.mapper.ImageCollectMapper;
|
||||||
import com.dite.znpt.service.ImageCollectService;
|
import com.dite.znpt.service.ImageCollectService;
|
||||||
|
@ -20,9 +20,10 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: gaoxiong
|
* @Author: gaoxiong
|
||||||
|
@ -49,21 +50,21 @@ public class ImageCollectServiceImpl extends ServiceImpl<ImageCollectMapper, Ima
|
||||||
}
|
}
|
||||||
ImageCollectEntity imageCollect = Converts.INSTANCE.toImageCollectEntity(req);
|
ImageCollectEntity imageCollect = Converts.INSTANCE.toImageCollectEntity(req);
|
||||||
this.save(imageCollect);
|
this.save(imageCollect);
|
||||||
String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
Map<String, ImageReq> imageMap = req.getImageList().stream().collect(Collectors.toMap(ImageReq::getImageId, Function.identity(), (a,b) -> b));
|
||||||
List<ImageEntity> imageList = Converts.INSTANCE.toImageEntity(req.getImageList());
|
List<ImageEntity> imageList = imageService.listByIds(imageMap.keySet());
|
||||||
String permPathPrefix = FilePathEnum.IMAGE.getFileAbsolutePathPrefix().concat(ImageSourceEnum.COLLECT.getCode()).concat(FileUtil.FILE_SEPARATOR).concat(partId).concat(FileUtil.FILE_SEPARATOR).concat(dateStr).concat(FileUtil.FILE_SEPARATOR);
|
|
||||||
imageList.forEach(image -> {
|
imageList.forEach(image -> {
|
||||||
image.setPartId(partId);
|
image.setPartId(partId);
|
||||||
image.setCollectId(imageCollect.getCollectId());
|
image.setCollectId(imageCollect.getCollectId());
|
||||||
image.setImageType(req.getImageType());
|
image.setImageType(req.getImageType());
|
||||||
image.setImageTypeLabel(req.getImageTypeLabel());
|
image.setImageTypeLabel(req.getImageTypeLabel());
|
||||||
String path = permPathPrefix + image.getImageName();
|
if (FilePathEnum.getFilePathEnum(image.getImagePath()).equals(FilePathEnum.IMAGE_TEMP)) {
|
||||||
String fileAbsolutePath = FilePathEnum.IMAGE_TEMP.getFileAbsolutePath(image.getImagePath());
|
String newImagePath = image.getImagePath().replace(FilePathEnum.IMAGE_TEMP.getUrlPath(), FilePathEnum.IMAGE.getUrlPath());
|
||||||
File file = FileUtil.file(fileAbsolutePath);
|
String oldFileAbsolutePath = FilePathEnum.IMAGE_TEMP.getFileAbsolutePath(image.getImagePath());
|
||||||
if (file.exists()) {
|
File oldFile = FileUtil.file(oldFileAbsolutePath);
|
||||||
FileUtil.copy(file, FileUtil.file(path), true);
|
if (oldFile.exists()) {
|
||||||
image.setImagePath(FilePathEnum.IMAGE.getFileDownPath(path));
|
FileUtil.move(oldFile, FileUtil.file(newImagePath), true);
|
||||||
FileUtil.del(file);
|
image.setImagePath(newImagePath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
imageService.saveOrUpdateBatch(imageList);
|
imageService.saveOrUpdateBatch(imageList);
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
||||||
private PartService partService;
|
private PartService partService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AudioFileInfoService audioFileInfoService;
|
private AudioFileInfoService audioFileInfoService;
|
||||||
|
@Autowired
|
||||||
private ProjectService projectService;
|
private ProjectService projectService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@ -296,7 +297,7 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
||||||
if(CollUtil.isEmpty(imageList)){
|
if(CollUtil.isEmpty(imageList)){
|
||||||
imageCollectService.removeById(image.getCollectId());
|
imageCollectService.removeById(image.getCollectId());
|
||||||
}
|
}
|
||||||
FilePathEnum pathEnum = image.getImagePath().contains("temp") ? FilePathEnum.IMAGE_TEMP : FilePathEnum.IMAGE;
|
FilePathEnum pathEnum = FilePathEnum.getFilePathEnum(image.getImagePath());
|
||||||
FileUtil.del(pathEnum.getFileAbsolutePath(image.getImagePath()));
|
FileUtil.del(pathEnum.getFileAbsolutePath(image.getImagePath()));
|
||||||
FileUtil.del(FilePathEnum.IMAGE.getFileAbsolutePath(image.getPreImagePath()));
|
FileUtil.del(FilePathEnum.IMAGE.getFileAbsolutePath(image.getPreImagePath()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
<if test="partId != null and partId != ''">
|
<if test="partId != null and partId != ''">
|
||||||
AND p.part_id = #{partId}
|
AND p.part_id = #{partId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="projectId != null and projectId != ''">
|
||||||
|
AND i.project_id = #{projectId}
|
||||||
|
</if>
|
||||||
<if test="imageTypes != null and imageTypes.length > 0">
|
<if test="imageTypes != null and imageTypes.length > 0">
|
||||||
AND i.image_type in <foreach collection="imageTypes" item="imageType" open="(" close=")" separator=",">#{imageType}</foreach>
|
AND i.image_type in <foreach collection="imageTypes" item="imageType" open="(" close=")" separator=",">#{imageType}</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
|
|
@ -2,23 +2,27 @@
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.dite.znpt.mapper.ProjectMapper">
|
<mapper namespace="com.dite.znpt.mapper.ProjectMapper">
|
||||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ProjectListResp">
|
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ProjectListResp">
|
||||||
with taskProgress as (
|
with taskProgress as (SELECT count(1) task_count,
|
||||||
SELECT
|
sum(status = 0) taskPendingCount,
|
||||||
count(1) task_count,
|
sum(status = 1) task_progress_count,
|
||||||
sum(status=0) taskPendingCount,
|
sum(status = 2) task_complete_count,
|
||||||
sum(status=1) task_progress_count,
|
project_id
|
||||||
sum(status=2) task_complete_count,
|
FROM project_task
|
||||||
project_id
|
group by project_id),
|
||||||
FROM project_task
|
constructor as (
|
||||||
group by project_id
|
select project_id, GROUP_CONCAT(DISTINCT con.name) AS constructor_name
|
||||||
|
FROM project prj
|
||||||
|
LEFT JOIN user con ON FIND_IN_SET(con.user_id,prj.constructor_ids) > 0 AND con.del_flag = '0'
|
||||||
|
GROUP BY prj.project_id
|
||||||
)
|
)
|
||||||
SELECT
|
SELECT
|
||||||
prj.project_id, prj.project_name, prj.farm_name, prj.status, prj.cover_url, prj.farm_address, prj.client, prj.client_contact, prj.client_phone, prj.inspection_unit,
|
prj.project_id, prj.project_name, prj.farm_name, prj.status, prj.cover_url, prj.farm_address, prj.client, prj.client_contact, prj.client_phone, prj.inspection_unit,
|
||||||
prj.inspection_contact, prj.inspection_phone, prj.scale, prj.turbine_model, prj.project_manager_id, pm.name AS project_manager_name, prj.constructor_ids,
|
prj.inspection_contact, prj.inspection_phone, prj.scale, prj.turbine_model, prj.project_manager_id, pm.name AS project_manager_name, prj.constructor_ids,
|
||||||
GROUP_CONCAT(DISTINCT con.name) AS constructor_name, prj.start_date, prj.end_date, tp.taskPendingCount, tp.task_progress_count, tp.task_complete_count, tp.task_count
|
prj.start_date, prj.end_date, con.constructor_name, tp.taskPendingCount, tp.task_progress_count, tp.task_complete_count, tp.task_count, prj.auditor_id,
|
||||||
|
prj.construct_team_leader_id, prj.quality_officer_id
|
||||||
FROM project prj
|
FROM project prj
|
||||||
LEFT JOIN user pm ON pm.user_id = prj.project_manager_id
|
LEFT JOIN user pm ON pm.user_id = prj.project_manager_id
|
||||||
LEFT JOIN user con ON FIND_IN_SET(con.user_id,prj.constructor_ids) > 0 AND con.del_flag = '0'
|
LEFT JOIN constructor con on prj.project_id = con.project_id
|
||||||
left join taskProgress tp on prj.project_id = tp.project_id
|
left join taskProgress tp on prj.project_id = tp.project_id
|
||||||
<where>
|
<where>
|
||||||
<if test="projectName != null and projectName != ''">
|
<if test="projectName != null and projectName != ''">
|
||||||
|
@ -48,9 +52,6 @@
|
||||||
or prj.constructor_ids like concat('%', #{userId},'%'))
|
or prj.constructor_ids like concat('%', #{userId},'%'))
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY prj.project_id, prj.project_name, prj.farm_name, prj.status, prj.cover_url, prj.farm_address, prj.client, prj.client_contact, prj.client_phone, prj.inspection_unit,
|
|
||||||
prj.inspection_contact, prj.inspection_phone, prj.scale, prj.turbine_model, prj.project_manager_id, pm.name, prj.constructor_ids,
|
|
||||||
prj.start_date, prj.end_date, tp.taskPendingCount, tp.task_progress_count, tp.task_complete_count, tp.task_count
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.dite.znpt.constant.Constants;
|
import com.dite.znpt.constant.Constants;
|
||||||
import com.dite.znpt.domain.PageResult;
|
import com.dite.znpt.domain.PageResult;
|
||||||
import com.dite.znpt.domain.Result;
|
import com.dite.znpt.domain.Result;
|
||||||
import com.dite.znpt.domain.entity.ProjectTaskEntity;
|
|
||||||
import com.dite.znpt.domain.vo.*;
|
import com.dite.znpt.domain.vo.*;
|
||||||
import com.dite.znpt.service.ProjectTaskService;
|
import com.dite.znpt.service.ProjectTaskService;
|
||||||
import com.dite.znpt.util.PageUtil;
|
import com.dite.znpt.util.PageUtil;
|
||||||
|
@ -102,8 +101,7 @@ public class ProjectTaskController {
|
||||||
|
|
||||||
@ApiOperation(value = "查询我的任务", httpMethod = "GET")
|
@ApiOperation(value = "查询我的任务", httpMethod = "GET")
|
||||||
@GetMapping("/my")
|
@GetMapping("/my")
|
||||||
public Result<List<ProjectTaskResp>> my() {
|
public Result<List<ProjectTaskResp>> my(ProjectTaskListReq req) {
|
||||||
ProjectTaskListReq req = new ProjectTaskListReq();
|
|
||||||
req.setUserId(StpUtil.getLoginIdAsString());
|
req.setUserId(StpUtil.getLoginIdAsString());
|
||||||
return Result.ok(projectTaskService.selectList(req));
|
return Result.ok(projectTaskService.selectList(req));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue