parent
bd28cd577a
commit
a819d1e9ad
|
@ -19,4 +19,5 @@ public class Message implements Serializable {
|
|||
public static final String PROJECT_ID_IS_NOT_EXIST = "项目id不存在";
|
||||
public static final String TURBINE_ID_IS_NOT_EXIST = "机组id不存在";
|
||||
public static final String PART_ID_IS_NOT_EXIST = "部件id不存在";
|
||||
public static final String IMAGE_SOURCE_I_NOT_EXIST_OR_ILLEGAL = "部件id不存在";
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ public interface Converts {
|
|||
|
||||
List<ImageEntity> toImageEntity(List<ImageReq> list);
|
||||
|
||||
List<ImageSimpleReq> toImageSimpleReq(List<OutWorkDefectReq> list);
|
||||
|
||||
ImageCollectEntity toImageCollectEntity(ImageCollectReq req);
|
||||
|
||||
DefectEntity toDefectEntity(DefectReq req);
|
||||
|
|
|
@ -32,10 +32,6 @@ public class ImageCollectEntity extends AuditableEntity implements Serializable
|
|||
@TableId(value = "collect_id", type = IdType.ASSIGN_UUID)
|
||||
private String collectId;
|
||||
|
||||
@ApiModelProperty("部件id")
|
||||
@TableField("part_id")
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("拍摄时间-起")
|
||||
@TableField("shooting_time_begin")
|
||||
private LocalDateTime shootingTimeBegin;
|
||||
|
|
|
@ -33,6 +33,10 @@ public class ImageEntity extends AuditableEntity implements Serializable {
|
|||
@TableId(value = "image_id", type = IdType.ASSIGN_UUID)
|
||||
private String imageId;
|
||||
|
||||
@ApiModelProperty("部件id")
|
||||
@TableField("part_id")
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("图像采集id")
|
||||
@TableField("collect_id")
|
||||
private String collectId;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/11 22:29
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("图像简要信息请求实体")
|
||||
public class ImageSimpleReq implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 4813411833253078204L;
|
||||
|
||||
@ApiModelProperty(name = "部件id", required = true)
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty(name = "图像来源,枚举:ImageSourceEnum", required = true)
|
||||
private String imageSource;
|
||||
|
||||
@ApiModelProperty(name = "图像路径", required = true)
|
||||
private String imagePath;
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/11 21:20
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("外部工作上报缺陷请求实体")
|
||||
public class OutWorkDefectReq extends DefectReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -9109852601298547208L;
|
||||
|
||||
@ApiModelProperty(name = "图像路径", required = true)
|
||||
private String imagePath;
|
||||
|
||||
@ApiModelProperty(name = "部件id", required = true)
|
||||
private String partId;
|
||||
}
|
|
@ -14,7 +14,8 @@ import java.util.List;
|
|||
@Getter
|
||||
public enum DefectSourceEnum {
|
||||
AI("AI", "智能识别"),
|
||||
MANUAL("MANUAL", "人工标注");
|
||||
MANUAL("MANUAL", "人工标注"),
|
||||
OUT_WORK("MANUAL", "外部工作");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/11 23:35
|
||||
* @Description:
|
||||
*/
|
||||
@Getter
|
||||
public enum ImageSourceEnum {
|
||||
COLLECT("collect", "图像采集", Boolean.TRUE),
|
||||
OUT_WORK("out-work", "外部工作", Boolean.TRUE),
|
||||
LIGHTNING_PROTECTING_WORK("lightning-protection-work", "防雷工作", Boolean.FALSE);
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
private final boolean isDefectImage;
|
||||
|
||||
ImageSourceEnum(String code, String desc, boolean isDefectImage){
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
this.isDefectImage = isDefectImage;
|
||||
}
|
||||
|
||||
public static ImageSourceEnum getByCode(String code){
|
||||
for (ImageSourceEnum e : ImageSourceEnum.values() ) {
|
||||
if(e.code.equals(code)){
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code){
|
||||
ImageSourceEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> list(Boolean isDefectImage){
|
||||
List<JSONObject> list = new ArrayList<>(ImageSourceEnum.values().length);
|
||||
for (ImageSourceEnum e : ImageSourceEnum.values() ) {
|
||||
if(isDefectImage.equals(e.isDefectImage)){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -5,6 +5,7 @@ import com.dite.znpt.domain.entity.DefectEntity;
|
|||
import com.dite.znpt.domain.vo.DefectListReq;
|
||||
import com.dite.znpt.domain.vo.DefectReq;
|
||||
import com.dite.znpt.domain.vo.DefectResp;
|
||||
import com.dite.znpt.domain.vo.OutWorkDefectReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -47,6 +48,15 @@ public interface DefectService extends IService<DefectEntity> {
|
|||
**/
|
||||
void save(String imageId, DefectReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:新增外部工作缺陷记录
|
||||
*
|
||||
* @param list
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<DefectEntity> saveOutWorkDefect(List<OutWorkDefectReq> list);
|
||||
|
||||
/**
|
||||
* 功能描述:更新缺陷记录
|
||||
*
|
||||
|
|
|
@ -10,5 +10,5 @@ import com.dite.znpt.domain.vo.ImageCollectReq;
|
|||
* @Description:
|
||||
*/
|
||||
public interface ImageCollectService extends IService<ImageCollectEntity> {
|
||||
void save(String departId, ImageCollectReq req);
|
||||
void save(String partId, ImageCollectReq req);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,10 @@ package com.dite.znpt.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.ImageEntity;
|
||||
import com.dite.znpt.domain.vo.ImageListReq;
|
||||
import com.dite.znpt.domain.vo.ImageListResp;
|
||||
import com.dite.znpt.domain.vo.ImageReq;
|
||||
import com.dite.znpt.domain.vo.ImageResp;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -21,9 +19,13 @@ public interface ImageService extends IService<ImageEntity> {
|
|||
|
||||
List<ImageListResp> page(ImageListReq req);
|
||||
|
||||
List<ImageEntity> batchSaveByImageSimpleReq(List<ImageSimpleReq> list);
|
||||
|
||||
ImageResp detail(String imageId);
|
||||
|
||||
List<ImageReq> batchUpload(String departId, MultipartFile[] files);
|
||||
List<ImageReq> batchUploadDefectImage(String partId, String imageSource, MultipartFile[] files);
|
||||
|
||||
String uploadCommonImage(String imageSource, MultipartFile file) throws IOException;
|
||||
|
||||
void delete(String imageId);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.DefectEntity;
|
||||
import com.dite.znpt.domain.vo.DefectListReq;
|
||||
import com.dite.znpt.domain.vo.DefectReq;
|
||||
import com.dite.znpt.domain.vo.DefectResp;
|
||||
import com.dite.znpt.domain.entity.ImageEntity;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.enums.DefectSourceEnum;
|
||||
import com.dite.znpt.enums.DefectTypeEnum;
|
||||
import com.dite.znpt.enums.RepairStatusEnum;
|
||||
|
@ -15,13 +15,16 @@ import com.dite.znpt.service.DefectService;
|
|||
import com.dite.znpt.mapper.DefectMapper;
|
||||
import com.dite.znpt.service.ImageService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -87,9 +90,35 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
|||
throw new ServiceException(Message.IMAGE_ID_IS_NOT_EXIST);
|
||||
}
|
||||
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
||||
defectEntity.setImageId(imageId);
|
||||
this.save(defectEntity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:新增外部工作缺陷记录
|
||||
*
|
||||
* @param list
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<DefectEntity> saveOutWorkDefect(List<OutWorkDefectReq> list) {
|
||||
List<ImageSimpleReq> imageSimpleReqList = Converts.INSTANCE.toImageSimpleReq(list);
|
||||
List<ImageEntity> imageEntityList = imageService.batchSaveByImageSimpleReq(imageSimpleReqList);
|
||||
Map<String, ImageEntity> imageMap = imageEntityList.stream().collect(Collectors.toMap(k->k.getPartId().concat(StrUtil.COLON).concat(k.getImagePath()), Function.identity()));
|
||||
List<DefectEntity> defectEntityList = new ArrayList<>();
|
||||
list.stream().forEach(req -> {
|
||||
String key = req.getPartId().concat(StrUtil.COLON).concat(req.getImagePath());
|
||||
if(imageMap.containsKey(key)){
|
||||
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
||||
defectEntity.setImageId(imageMap.get(key).getImageId());
|
||||
defectEntityList.add(defectEntity);
|
||||
}
|
||||
});
|
||||
this.saveBatch(defectEntityList);
|
||||
return defectEntityList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:更新缺陷记录
|
||||
*
|
||||
|
|
|
@ -9,10 +9,12 @@ import com.dite.znpt.converts.Converts;
|
|||
import com.dite.znpt.domain.entity.ImageCollectEntity;
|
||||
import com.dite.znpt.domain.entity.ImageEntity;
|
||||
import com.dite.znpt.domain.vo.ImageCollectReq;
|
||||
import com.dite.znpt.enums.ImageSourceEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.ImageCollectMapper;
|
||||
import com.dite.znpt.service.ImageCollectService;
|
||||
import com.dite.znpt.service.ImageService;
|
||||
import com.dite.znpt.service.PartService;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -35,26 +37,32 @@ public class ImageCollectServiceImpl extends ServiceImpl<ImageCollectMapper, Ima
|
|||
@Resource
|
||||
private ImageService imageService;
|
||||
|
||||
@Resource
|
||||
private PartService partService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(String partId, ImageCollectReq req) {
|
||||
if(null == partService.getById(partId)){
|
||||
throw new ServiceException(Message.PART_ID_IS_NOT_EXIST);
|
||||
}
|
||||
if(CollUtil.isEmpty(req.getImageList())){
|
||||
throw new ServiceException(Message.IMAGE_IS_EMPTY);
|
||||
}
|
||||
ImageCollectEntity imageCollect = Converts.INSTANCE.toImageCollectEntity(req);
|
||||
imageCollect.setPartId(partId);
|
||||
this.save(imageCollect);
|
||||
List<ImageEntity> imageList = Converts.INSTANCE.toImageEntity(req.getImageList());
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(partId).concat(StrUtil.BACKSLASH);
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(ImageSourceEnum.COLLECT.getCode()).concat(StrUtil.BACKSLASH).concat(partId).concat(StrUtil.BACKSLASH);
|
||||
imageList.stream().forEach(image -> {
|
||||
image.setPartId(partId);
|
||||
image.setCollectId(imageCollect.getCollectId());
|
||||
String path = path_prefix + image.getImageName();
|
||||
File file = new File(image.getImagePath());
|
||||
if (file.exists()) {
|
||||
byte[] bytes = FileUtil.readBytes(file);
|
||||
FileUtil.writeBytes(bytes, path);
|
||||
FileUtil.del(file);
|
||||
image.setImagePath(path);
|
||||
FileUtil.del(file);
|
||||
}else {
|
||||
imageList.remove(image);
|
||||
}
|
||||
|
|
|
@ -8,19 +8,17 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.domain.entity.ImageEntity;
|
||||
import com.dite.znpt.domain.vo.ImageListReq;
|
||||
import com.dite.znpt.domain.vo.ImageListResp;
|
||||
import com.dite.znpt.domain.vo.ImageReq;
|
||||
import com.dite.znpt.domain.vo.ImageResp;
|
||||
import com.dite.znpt.enums.ImageTypeEnum;
|
||||
import com.dite.znpt.enums.ShootingMethodEnum;
|
||||
import com.dite.znpt.enums.WeatherEnum;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.enums.*;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.ImageMapper;
|
||||
import com.dite.znpt.service.ImageCollectService;
|
||||
import com.dite.znpt.service.ImageService;
|
||||
import com.dite.znpt.service.PartService;
|
||||
import com.dite.znpt.util.EXIFUtil;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -28,14 +26,19 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Bear.G
|
||||
|
@ -48,9 +51,14 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
@Resource
|
||||
private ImageCollectService imageCollectService;
|
||||
|
||||
@Resource
|
||||
private PartService partService;
|
||||
|
||||
@Value("${upload.temp-path}")
|
||||
private String tempPath;
|
||||
|
||||
@Value("${upload.perm-path}")
|
||||
private String permPath;
|
||||
@Override
|
||||
public List<ImageListResp> list(ImageListReq req) {
|
||||
List<ImageListResp> partList= this.baseMapper.queryImageList(req);
|
||||
|
@ -68,22 +76,54 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
return this.list(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ImageEntity> batchSaveByImageSimpleReq(List<ImageSimpleReq> list){
|
||||
List<ImageEntity> imageList = new ArrayList<>();
|
||||
List<String> partIds = list.stream().map(ImageSimpleReq::getPartId).collect(Collectors.toList());
|
||||
Map<String, PartEntity> partIdMap= partService.listByIds(partIds).stream().collect(Collectors.toMap(PartEntity::getPartId, Function.identity()));
|
||||
list.stream().forEach(req -> {
|
||||
if(partIdMap.containsKey(req.getPartId())){
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(req.getImageSource()).concat(StrUtil.BACKSLASH).concat(req.getPartId()).concat(StrUtil.BACKSLASH);
|
||||
String temp_path_prefix = tempPath.concat(StrUtil.BACKSLASH).concat(req.getImageSource()).concat(StrUtil.BACKSLASH).concat(req.getPartId()).concat(StrUtil.BACKSLASH);
|
||||
File file = new File(req.getImagePath());
|
||||
if(file.exists() && req.getImagePath().contains(temp_path_prefix)){
|
||||
ImageEntity entity = new ImageEntity();
|
||||
entity.setPartId(req.getPartId());
|
||||
String path = path_prefix + StrUtil.removePrefix(req.getImagePath(), temp_path_prefix);
|
||||
byte[] bytes = FileUtil.readBytes(file);
|
||||
FileUtil.writeBytes(bytes, path);
|
||||
FileUtil.del(file);
|
||||
entity.setImagePath(path);
|
||||
imageList.add(entity);
|
||||
}
|
||||
}
|
||||
});
|
||||
this.saveBatch(imageList);
|
||||
return imageList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImageResp detail(String imageId) {
|
||||
ImageResp imageResp = this.baseMapper.detail(imageId);
|
||||
if(null != imageResp && null != imageResp.getImageCollectInfo()){
|
||||
imageResp.getImageCollectInfo().setWeatherLabel(WeatherEnum.getDescByCode(imageResp.getImageCollectInfo().getWeather()));
|
||||
imageResp.getImageCollectInfo().setShootingMethodLabel(ShootingMethodEnum.getDescByCode(imageResp.getImageCollectInfo().getShootingMethodLabel()));
|
||||
}
|
||||
|
||||
return imageResp;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public List<ImageReq> batchUpload(String departId, MultipartFile[] files) {
|
||||
public List<ImageReq> batchUploadDefectImage(String partId, String imageSource, MultipartFile[] files) {
|
||||
if(null == partService.getById(partId)){
|
||||
throw new ServiceException(Message.PART_ID_IS_NOT_EXIST);
|
||||
}
|
||||
if(null == files || files.length == 0){
|
||||
throw new ServiceException(Message.IMAGE_IS_EMPTY);
|
||||
}
|
||||
List<ImageReq> list = new ArrayList<>(files.length);
|
||||
String path_prefix = tempPath.concat(StrUtil.BACKSLASH).concat(departId).concat(StrUtil.BACKSLASH);
|
||||
String path_prefix = tempPath.concat(StrUtil.BACKSLASH).concat(imageSource).concat(StrUtil.BACKSLASH).concat(partId).concat(StrUtil.BACKSLASH);
|
||||
for (MultipartFile file : files) {
|
||||
if (!file.isEmpty()) {
|
||||
try {
|
||||
|
@ -98,6 +138,22 @@ public class ImageServiceImpl extends ServiceImpl<ImageMapper, ImageEntity> impl
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uploadCommonImage(String imageSource, MultipartFile file) throws IOException {
|
||||
if(null == file){
|
||||
throw new ServiceException(Message.IMAGE_IS_EMPTY);
|
||||
}
|
||||
ImageSourceEnum imageSourceEnum = ImageSourceEnum.getByCode(imageSource);
|
||||
if(null == imageSourceEnum || imageSourceEnum.isDefectImage()){
|
||||
throw new ServiceException(Message.IMAGE_SOURCE_I_NOT_EXIST_OR_ILLEGAL);
|
||||
}
|
||||
String dateStr = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
String path_prefix = permPath.concat(StrUtil.BACKSLASH).concat(imageSource).concat(StrUtil.BACKSLASH).concat(dateStr).concat(StrUtil.BACKSLASH);
|
||||
String path = path_prefix + file.getOriginalFilename();
|
||||
FileUtil.writeBytes(file.getBytes(),path);
|
||||
return path;
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void delete(String imageId) {
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
<select id="queryImageList" resultType="com.dite.znpt.domain.vo.ImageListResp">
|
||||
SELECT
|
||||
i.image_id, i.image_name, ic.part_id, p.part_name, i.image_resolution, i.focal_distance, i.shooting_time, i.camera_manufacturer,
|
||||
i.image_id, i.image_name, i.part_id, p.part_name, i.image_resolution, i.focal_distance, i.shooting_time, i.camera_manufacturer,
|
||||
i.camera_model, i.GPS, ic.weather, ic.humidness, CONCAT(ic.temperature_min, '℃', '~',temperature_max, '℃') AS temperature, ic.wind_level,
|
||||
ic.shooting_method, ic.shooting_distance,ic.collector_name, i.image_type
|
||||
FROM image i
|
||||
LEFT JOIN image_collect ic ON i.collect_id = ic.collect_id
|
||||
LEFT JOIN part p ON ic.part_id = p.part_id
|
||||
LEFT JOIN part p ON i.part_id = p.part_id
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
AND i.image_name LIKE concat('%', #{keyword}, '%')
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.dite.znpt.web.controller;
|
|||
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.enums.*;
|
||||
import com.dite.znpt.service.ImageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
|
@ -19,6 +21,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequestMapping("/common")
|
||||
public class CommonController {
|
||||
|
||||
@Resource
|
||||
private ImageService imageService;
|
||||
|
||||
@ApiOperation(value = "查询缺陷级别", httpMethod = "GET")
|
||||
@GetMapping("/list/defect-level")
|
||||
public Result listDefectLevel(){
|
||||
|
@ -76,4 +81,14 @@ public class CommonController {
|
|||
public Result listWeather(){
|
||||
return Result.ok(WeatherEnum.listAll());
|
||||
}
|
||||
@ApiOperation(value = "查询通用图片来源", httpMethod = "GET")
|
||||
@GetMapping("/list/common-image-source")
|
||||
public Result listCommonImageSource(){
|
||||
return Result.ok(ImageSourceEnum.list(Boolean.FALSE));
|
||||
}
|
||||
@ApiOperation(value = "上传图片", httpMethod = "POST")
|
||||
@PostMapping("/upload-image/{imageSource}")
|
||||
public Result uploadImage(@PathVariable String imageSource, MultipartFile file) throws IOException {
|
||||
return Result.ok(imageService.uploadCommonImage(imageSource, file));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.dite.znpt.web.controller;
|
|||
import com.dite.znpt.domain.PageResult;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.enums.ImageSourceEnum;
|
||||
import com.dite.znpt.service.ImageCollectService;
|
||||
import com.dite.znpt.service.ImageService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -49,15 +50,22 @@ public class ImageController {
|
|||
}
|
||||
|
||||
@ApiOperation(value = "批量上传图像", httpMethod = "POST")
|
||||
@PostMapping("/upload-batch/{departId}")
|
||||
public Result<List<ImageReq>> uploadBatch(@PathVariable String departId, @RequestParam("files") MultipartFile[] files) {
|
||||
return Result.ok(imageService.batchUpload(departId, files));
|
||||
@PostMapping("/upload-batch/{partId}")
|
||||
public Result<List<ImageReq>> uploadBatch(@PathVariable String partId, @RequestParam("files") MultipartFile[] files) {
|
||||
return Result.ok(imageService.batchUploadDefectImage(partId, ImageSourceEnum.COLLECT.getCode(), files));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "外部工作上传图像", httpMethod = "POST")
|
||||
@PostMapping("/out-work/upload/{partId}")
|
||||
public Result<String> uploadOutWork( @PathVariable String partId, @RequestParam("file") MultipartFile file) {
|
||||
MultipartFile[] files = {file};
|
||||
return Result.ok(imageService.batchUploadDefectImage(partId, ImageSourceEnum.OUT_WORK.getCode(), files).get(0).getImagePath());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "设置信息", httpMethod = "POST")
|
||||
@PostMapping("/setting-info/{departId}")
|
||||
public Result save(@PathVariable String departId, @RequestBody ImageCollectReq req) {
|
||||
imageCollectService.save(departId, req);
|
||||
@PostMapping("/setting-info/{partId}")
|
||||
public Result save(@PathVariable String partId, @RequestBody ImageCollectReq req) {
|
||||
imageCollectService.save(partId, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -117,6 +117,6 @@ zlm-config:
|
|||
dynamicPortEnd: 30185
|
||||
|
||||
upload:
|
||||
temp-path: F:\Upload\Temp
|
||||
perm-path: F:\Upload\Perm
|
||||
temp-path: F:\Upload\Image\Temp
|
||||
perm-path: F:\Upload\Image
|
||||
|
||||
|
|
Loading…
Reference in New Issue