Merge remote-tracking branch 'origin/master'

This commit is contained in:
cuizhibin 2025-04-28 09:37:54 +08:00
commit af1c33856d
22 changed files with 506 additions and 103 deletions

View File

@ -15,4 +15,5 @@ public class Message implements Serializable {
public static final String IMAGE_IS_EMPTY = "图像信息为空"; public static final String IMAGE_IS_EMPTY = "图像信息为空";
public static final String IMAGE_PATH_IS_NOT_EXIST = "图像地址不存在"; public static final String IMAGE_PATH_IS_NOT_EXIST = "图像地址不存在";
public static final String IMAGE_ID_IS_NOT_EXIST = "图像id不存在"; public static final String IMAGE_ID_IS_NOT_EXIST = "图像id不存在";
public static final String DEFECT_ID_IS_NOT_EXIST = "缺陷id不存在";
} }

View File

@ -1,7 +1,10 @@
package com.dite.znpt.converts; package com.dite.znpt.converts;
import com.dite.znpt.domain.entity.DefectEntity;
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.DefectReq;
import com.dite.znpt.domain.vo.DefectResp;
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.domain.vo.ImageReq;
import org.mapstruct.Mapper; import org.mapstruct.Mapper;
@ -22,4 +25,8 @@ public interface Converts {
List<ImageEntity> toImageEntity(List<ImageReq> list); List<ImageEntity> toImageEntity(List<ImageReq> list);
ImageCollectEntity toImageCollectEntity(ImageCollectReq req); ImageCollectEntity toImageCollectEntity(ImageCollectReq req);
DefectEntity toDefectEntity(DefectReq req);
DefectResp toDefectResp(DefectEntity entity);
} }

View File

@ -2,6 +2,7 @@ package com.dite.znpt.domain.entity;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.dite.znpt.domain.AuditableEntity; import com.dite.znpt.domain.AuditableEntity;
@ -29,15 +30,25 @@ public class DefectEntity extends AuditableEntity implements Serializable {
@TableId(value = "defect_id", type = IdType.ASSIGN_UUID) @TableId(value = "defect_id", type = IdType.ASSIGN_UUID)
private String defectId; private String defectId;
@ExcelProperty("机组id") @ExcelProperty("图像id")
@ApiModelProperty("机组id") @ApiModelProperty("图像id")
@TableField("turbine_code") @TableField("image_id")
private String turbineId; private String imageId;
@ExcelProperty("部件id") @ExcelProperty("缺陷编码")
@ApiModelProperty("部件id") @ApiModelProperty("缺陷编码")
@TableField("part_id") @TableField("defect_code")
private String partId; private String defectCode;
@ExcelProperty("缺陷名称")
@ApiModelProperty("缺陷名称")
@TableField("defect_name")
private String defectName;
@ExcelProperty("缺陷部位")
@ApiModelProperty("缺陷部位")
@TableField("defect_position")
private String defectPosition;
@ExcelProperty("缺陷类型枚举DefectTypeEnum") @ExcelProperty("缺陷类型枚举DefectTypeEnum")
@ApiModelProperty("缺陷类型枚举DefectTypeEnum") @ApiModelProperty("缺陷类型枚举DefectTypeEnum")
@ -49,15 +60,45 @@ public class DefectEntity extends AuditableEntity implements Serializable {
@TableField("defect_level") @TableField("defect_level")
private String defectLevel; private String defectLevel;
@ExcelProperty("维修状态枚举RepairStatusEnum")
@ApiModelProperty("维修状态枚举RepairStatusEnum")
@TableField("repair_status")
private String repairStatus;
@ExcelProperty("图片路径") @ExcelProperty("检测时间")
@ApiModelProperty("图片路径") @ApiModelProperty("检测时间")
@TableField("defect_image_path") @TableField("detection_time")
private String defectImagePath; private LocalDateTime detectionTime;
@ExcelProperty("来源")
@ApiModelProperty("来源")
@TableField("source")
private String source;
@ExcelProperty("弦向")
@ApiModelProperty("弦向")
@TableField("chordwise")
private Integer chordwise;
@ExcelProperty("轴向")
@ApiModelProperty("轴向")
@TableField("axial")
private Integer axial;
@ExcelProperty("标注信息")
@ApiModelProperty("标注信息")
@TableField("label_info")
private String labelInfo;
@ExcelProperty("说明") @ExcelProperty("说明")
@ApiModelProperty("说明") @ApiModelProperty("说明")
@TableField("description") @TableField("description")
private String description; private String description;
@ExcelProperty("维修建议")
@ApiModelProperty("维修建议")
@TableField("repair_idea")
private String repairIdea;
} }

View File

@ -27,9 +27,6 @@ public class DefectListReq implements Serializable {
@ApiModelProperty("机组id") @ApiModelProperty("机组id")
private String turbineId; private String turbineId;
@ApiModelProperty("部件id")
private String partId;
@ApiModelProperty("缺陷类型枚举DefectTypeEnum") @ApiModelProperty("缺陷类型枚举DefectTypeEnum")
private String defectType; private String defectType;

View File

@ -0,0 +1,35 @@
package com.dite.znpt.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author: gaoxiong
* @Date: 2025/4/27 21:23
* @Description:
*/
@Data
@ApiModel("缺陷记录列表响应实体")
public class DefectListResp implements Serializable {
@ApiModelProperty("缺陷id")
private String defectId;
@ApiModelProperty("缺陷名称")
private String defectName;
@ApiModelProperty("缺陷编码")
private String defectCode;
@ApiModelProperty("部件名称")
private String partName;
@ApiModelProperty("缺陷未知")
private String defectPosition;
@ApiModelProperty("说明")
private String description;
}

View File

@ -0,0 +1,59 @@
package com.dite.znpt.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDate;
/**
* @Author: gaoxiong
* @Date: 2025/4/27 21:16
* @Description:
*/
@Data
@ApiModel("缺陷记录请求实体")
public class DefectReq implements Serializable {
@ApiModelProperty("缺陷编码")
private String defectCode;
@ApiModelProperty("缺陷名称")
private String defectName;
@ApiModelProperty("缺陷部位")
private String defectPosition;
@ApiModelProperty("缺陷类型枚举DefectTypeEnum")
private String defectType;
@ApiModelProperty("危重等级枚举DefectLevelEnum")
private String defectLevel;
@ApiModelProperty("维修状态枚举RepairStatusEnum")
private String repairStatus;
@JsonFormat(pattern = "yyyy-MM-dd")
@ApiModelProperty("检测时间")
private LocalDate detectionDate;
@ApiModelProperty("来源枚举DefectSourceEnum")
private String source;
@ApiModelProperty("弦向")
private Integer chordwise;
@ApiModelProperty("轴向")
private Integer axial;
@ApiModelProperty("标注信息")
private String labelInfo;
@ApiModelProperty("说明")
private String description;
@ApiModelProperty("维修建议")
private String repairIdea;
}

View File

@ -1,9 +1,16 @@
package com.dite.znpt.domain.vo; package com.dite.znpt.domain.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import com.dite.znpt.domain.entity.DefectEntity; import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDate;
/** /**
* @author huise23 * @author huise23
@ -11,8 +18,26 @@ import com.dite.znpt.domain.entity.DefectEntity;
* @Description: 缺陷记录响应实体 * @Description: 缺陷记录响应实体
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("缺陷记录响应实体") @ApiModel("缺陷记录响应实体")
public class DefectResp extends DefectEntity { public class DefectResp extends DefectReq implements Serializable {
@Serial
private static final long serialVersionUID = 7723957970600470768L;
@ApiModelProperty("缺陷id")
private String defectId;
@ApiModelProperty("缺陷类型描述")
private String defectTypeLabel;
@ApiModelProperty("危重等级描述")
private String defectLevelLabel;
@ApiModelProperty("维修状态描述")
private String repairStatusLabel;
@ApiModelProperty("来源描述")
private String sourceLabel;
} }

View File

@ -21,6 +21,9 @@ public class ImageListReq implements Serializable {
@ApiModelProperty("关键字") @ApiModelProperty("关键字")
private String keyword; private String keyword;
@ApiModelProperty("机组id")
private String turbineId;
@ApiModelProperty("图像类型") @ApiModelProperty("图像类型")
private String[] imageTypes; private String[] imageTypes;

View File

@ -1,9 +0,0 @@
package com.dite.znpt.enums;
/**
* @Author: gaoxiong
* @Date: 2025/4/24 21:44
* @Description:
*/
public enum DefectLevel {
}

View File

@ -0,0 +1,52 @@
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/4/24 21:44
* @Description:
*/
@Getter
public enum DefectLevelEnum {
SLIGHT("SLIGHT", "轻微缺陷"),
GENERAL("GENERAL", "一般缺陷"),
SERIOUS("SERIOUS", "比较严重"),
CRITICAL("CRITICAL", "非常严重");
private final String code;
private final String desc;
DefectLevelEnum(String code, String desc){
this.code = code;
this.desc = desc;
}
public static DefectLevelEnum getByCode(String code){
for (DefectLevelEnum e : DefectLevelEnum.values() ) {
if(e.code.equals(code)){
return e;
}
}
return null;
}
public static String getDescByCode(String code){
DefectLevelEnum e = getByCode(code);
return null == e ? null : e.desc;
}
public static List<JSONObject> listAll(){
List<JSONObject> list = new ArrayList<>(DefectLevelEnum.values().length);
for (DefectLevelEnum e : DefectLevelEnum.values() ) {
JSONObject jsonObject = new JSONObject();
jsonObject.set(e.code, e.desc);
list.add(jsonObject);
}
return list;
}
}

View File

@ -0,0 +1,50 @@
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/4/27 20:55
* @Description:
*/
@Getter
public enum DefectSourceEnum {
AI("AI", "智能识别"),
MANUAL("MANUAL", "人工标注");
private final String code;
private final String desc;
DefectSourceEnum(String code, String desc){
this.code = code;
this.desc = desc;
}
public static DefectSourceEnum getByCode(String code){
for (DefectSourceEnum e : DefectSourceEnum.values() ) {
if(e.code.equals(code)){
return e;
}
}
return null;
}
public static String getDescByCode(String code){
DefectSourceEnum e = getByCode(code);
return null == e ? null : e.desc;
}
public static List<JSONObject> listAll(){
List<JSONObject> list = new ArrayList<>(DefectSourceEnum.values().length);
for (DefectSourceEnum e : DefectSourceEnum.values() ) {
JSONObject jsonObject = new JSONObject();
jsonObject.set(e.code, e.desc);
list.add(jsonObject);
}
return list;
}
}

View File

@ -1,9 +1,60 @@
package com.dite.znpt.enums; package com.dite.znpt.enums;
import cn.hutool.json.JSONObject;
import lombok.Getter;
import java.util.ArrayList;
import java.util.List;
/** /**
* @Author: gaoxiong * @Author: gaoxiong
* @Date: 2025/4/24 21:43 * @Date: 2025/4/24 21:43
* @Description: * @Description:
*/ */
@Getter
public enum DefectTypeEnum { public enum DefectTypeEnum {
CRAZE("CRAZE", "合缝开裂"),
ABRASION("ABRASION", "合缝磨损"),
LEATHER_BREAKAGE("LEATHER_BREAKAGE", "蒙皮破损"),
FABRIC_BREAKAGE("FABRIC_BREAKAGE", "布层破损"),
PART_BREAKAGE(" PART_BREAKAGE", "局部破损"),
TOTAL_DAMAGE("TOTAL_DAMAGE", "累计损伤"),
LAYER_SHED("LAYER_SHED", "涂层脱落"),
PAINT_SHEDDING("PAINT_SHEDDING", "风损掉漆"),
SURFACE_CRACK("SURFACE_CRACK", "表面裂纹"),
CHORDWISE_CRACK("CHORDWISE_CRACK", "弦向裂纹"),
AXIAL_CRACK("AXIAL_CRACK", "轴向裂纹"),
WRINKLE("WRINKLE", "褶皱");
private final String code;
private final String desc;
DefectTypeEnum(String code, String desc){
this.code = code;
this.desc = desc;
}
public static DefectTypeEnum getByCode(String code){
for (DefectTypeEnum e : DefectTypeEnum.values() ) {
if(e.code.equals(code)){
return e;
}
}
return null;
}
public static String getDescByCode(String code){
DefectTypeEnum e = getByCode(code);
return null == e ? null : e.desc;
}
public static List<JSONObject> listAll(){
List<JSONObject> list = new ArrayList<>(DefectTypeEnum.values().length);
for (DefectTypeEnum e : DefectTypeEnum.values() ) {
JSONObject jsonObject = new JSONObject();
jsonObject.set(e.code, e.desc);
list.add(jsonObject);
}
return list;
}
} }

View File

@ -1,6 +1,7 @@
package com.dite.znpt.enums; package com.dite.znpt.enums;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import lombok.Getter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -10,6 +11,7 @@ import java.util.List;
* @Date: 2025/4/24 21:25 * @Date: 2025/4/24 21:25
* @Description: * @Description:
*/ */
@Getter
public enum ImageTypeEnum { public enum ImageTypeEnum {
DEFECT("DEFECT", "缺陷影像"), DEFECT("DEFECT", "缺陷影像"),
TYPICAL("TYPICAL", "典型影像"), TYPICAL("TYPICAL", "典型影像"),

View File

@ -0,0 +1,51 @@
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/4/27 20:55
* @Description:
*/
@Getter
public enum RepairStatusEnum {
INCOMPLETE("INCOMPLETE","未维修"),
COMPLETED("COMPLETED","已维修"),
UNKNOWN("UNKNOWN","未知");
private final String code;
private final String desc;
RepairStatusEnum(String code, String desc){
this.code = code;
this.desc = desc;
}
public static RepairStatusEnum getByCode(String code){
for (RepairStatusEnum e : RepairStatusEnum.values() ) {
if(e.code.equals(code)){
return e;
}
}
return null;
}
public static String getDescByCode(String code){
RepairStatusEnum e = getByCode(code);
return null == e ? null : e.desc;
}
public static List<JSONObject> listAll(){
List<JSONObject> list = new ArrayList<>(RepairStatusEnum.values().length);
for (RepairStatusEnum e : RepairStatusEnum.values() ) {
JSONObject jsonObject = new JSONObject();
jsonObject.set(e.code, e.desc);
list.add(jsonObject);
}
return list;
}
}

View File

@ -15,5 +15,6 @@ import java.util.List;
*/ */
public interface DefectMapper extends BaseMapper<DefectEntity> { public interface DefectMapper extends BaseMapper<DefectEntity> {
List<DefectResp> queryBySelective(DefectListReq defectReq); List<DefectResp> queryBySelective(DefectListReq defectReq);
DefectResp detail(String defectId);
} }

View File

@ -3,6 +3,7 @@ package com.dite.znpt.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.dite.znpt.domain.entity.DefectEntity; import com.dite.znpt.domain.entity.DefectEntity;
import com.dite.znpt.domain.vo.DefectListReq; 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.DefectResp;
import java.util.List; import java.util.List;
@ -17,12 +18,14 @@ public interface DefectService extends IService<DefectEntity> {
/** /**
* 功能描述查询缺陷记录列表 * 功能描述查询缺陷记录列表
* *
* @param defectReq 缺陷记录 * @param req 缺陷记录
* @return {@link List }<{@link DefectEntity }> * @return {@link List }<{@link DefectEntity }>
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
List<DefectResp> selectList(DefectListReq defectReq); List<DefectResp> page(DefectListReq req);
List<DefectResp> list(DefectListReq req);
/** /**
* 功能描述查询单条缺陷记录 * 功能描述查询单条缺陷记录
@ -32,25 +35,27 @@ public interface DefectService extends IService<DefectEntity> {
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
DefectResp selectById(String defectId); DefectResp detail(String defectId);
/** /**
* 功能描述新增缺陷记录 * 功能描述新增缺陷记录
* *
* @param defect 缺陷记录 * @param imageId 缺陷记录
* @param req 缺陷记录
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
void saveData(DefectEntity defect); void save(String imageId, DefectReq req);
/** /**
* 功能描述更新缺陷记录 * 功能描述更新缺陷记录
* *
* @param defect 缺陷记录 * @param defectId 缺陷记录
* @param req 缺陷记录
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
void updateData(DefectEntity defect); void update(String defectId, DefectReq req);
/** /**
* 功能描述删除缺陷记录 * 功能描述删除缺陷记录

View File

@ -1,16 +1,26 @@
package com.dite.znpt.service.impl; package com.dite.znpt.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.entity.DefectEntity;
import com.dite.znpt.domain.vo.DefectListReq; 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.DefectResp;
import com.dite.znpt.enums.DefectSourceEnum;
import com.dite.znpt.enums.DefectTypeEnum;
import com.dite.znpt.enums.RepairStatusEnum;
import com.dite.znpt.exception.ServiceException;
import com.dite.znpt.service.DefectService; import com.dite.znpt.service.DefectService;
import com.dite.znpt.mapper.DefectMapper; import com.dite.znpt.mapper.DefectMapper;
import com.dite.znpt.service.ImageService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import com.dite.znpt.util.PageUtil; import com.dite.znpt.util.PageUtil;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -21,22 +31,26 @@ import java.util.List;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> implements DefectService { public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> implements DefectService {
@Resource
private ImageService imageService;
/** /**
* 功能描述查询缺陷记录列表 * 功能描述查询缺陷记录列表
* *
* @param defectReq 缺陷记录信息 * @param req 缺陷记录信息
* @return {@link List }<{@link DefectResp }> * @return {@link List }<{@link DefectResp }>
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
@Override @Override
public List<DefectResp> selectList(DefectListReq defectReq) { public List<DefectResp> page(DefectListReq req) {
PageUtil.startPage(); PageUtil.startPage();
List<DefectResp> defectList= this.baseMapper.queryBySelective(defectReq); return this.list(req);
defectList.forEach(resp -> { }
}); @Override
public List<DefectResp> list(DefectListReq req) {
List<DefectResp> defectList= this.baseMapper.queryBySelective(req);
return defectList; return defectList;
} }
@ -49,37 +63,49 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
@Override @Override
public DefectResp selectById(String defectId) { public DefectResp detail(String defectId) {
DefectListReq defectReq = new DefectListReq(); DefectResp defectResp = this.baseMapper.detail(defectId);
defectReq.setDefectId(defectId); defectResp.setDefectTypeLabel(DefectTypeEnum.getDescByCode(defectResp.getDefectType()));
List<DefectResp> list = selectList(defectReq); defectResp.setDefectLevel(DefectTypeEnum.getDescByCode(defectResp.getDefectLevel()));
return list.isEmpty() ? CollUtil.getFirst(list) : new DefectResp(); defectResp.setRepairStatusLabel(RepairStatusEnum.getDescByCode(defectResp.getRepairStatus()));
defectResp.setSourceLabel(DefectSourceEnum.getDescByCode(defectResp.getSourceLabel()));
return defectResp;
} }
/** /**
* 功能描述新增缺陷记录 * 功能描述新增缺陷记录
* *
* @param defect 缺陷记录 * @param imageId
* @param req
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void saveData(DefectEntity defect) { public void save(String imageId, DefectReq req) {
// todo 校验 if(null == imageService.getById(imageId)){
save(defect); throw new ServiceException(Message.IMAGE_ID_IS_NOT_EXIST);
}
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
this.save(defectEntity);
} }
/** /**
* 功能描述更新缺陷记录 * 功能描述更新缺陷记录
* *
* @param defect 缺陷记录 * @param defectId
* @param req
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void updateData(DefectEntity defect) { public void update(String defectId, DefectReq req) {
// todo 校验 if(null == this.getById(defectId)){
updateById(defect); throw new ServiceException(Message.DEFECT_ID_IS_NOT_EXIST);
}
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
this.updateById(defectEntity);
} }
/** /**
@ -89,10 +115,10 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
* @author huise23 * @author huise23
* @date 2025/04/11 23:17 * @date 2025/04/11 23:17
**/ **/
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void deleteById(String defectId) { public void deleteById(String defectId) {
// todo 校验 this.removeById(defectId);
removeById(defectId);
} }
} }

View File

@ -2,29 +2,35 @@
<!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.DefectMapper"> <mapper namespace="com.dite.znpt.mapper.DefectMapper">
<sql id="Base_Column_List">
a.defect_id, a.turbine_id, a.part_id, a.defect_code, a.defect_name, a.defect_type, a.defect_level, a.defect_image_path, a.description
</sql>
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.DefectResp"> <select id="queryBySelective" resultType="com.dite.znpt.domain.vo.DefectListResp">
select SELECT
<include refid="Base_Column_List"/> d.defect_id, d.defect_name, d.defect_code, p.part_name, d.defect_position, d.description
from defect a FROM defect d
LEFT JOIN image i ON d.image_id = i.image_id
LEFT JOIN image_collect ic ON ic.collect_id = i.collect_id
LEFT JOIN part p ON ic.part_id = p.part_id
<where> <where>
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
# and (a.defect_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.defect_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%')) # AND (d.defect_name LIKE concat('%', #{keyword,jdbcType=VARCHAR}, '%') OR d.defect_code LIKE concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
</if> </if>
<if test="partId != null and partId != ''"> <if test="turbineId != null and turbineId != ''">
and a.part_id = #{turbineCode} AND p.turbine_id = #{turbineId}
</if> </if>
<if test="defectType != null and defectType != ''"> <if test="defectType != null and defectType != ''">
and a.defect_type = #{defectType} AND d.defect_type = #{defectType}
</if> </if>
<if test="defectLevel != null and defectLevel != ''"> <if test="defectLevel != null and defectLevel != ''">
and a.defect_level = #{defectLevel} AND d.defect_level = #{defectLevel}
</if> </if>
</where> </where>
</select> </select>
<select id="detail" resultType="com.dite.znpt.domain.vo.DefectResp">
SELECT
d.defect_id, d.defect_code, d.defect_name, d.defect_position, d.defect_type, d.defect_level, d.repair_status, d.detection_date, d.source,
d.chordwise, d.axial, d.area, d.label_info, d.description, d.description
FROM defect d
WHERE d.defect_id = #{defectId}
</select>
</mapper> </mapper>

View File

@ -2,15 +2,5 @@
<!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.ImageCollectMapper"> <mapper namespace="com.dite.znpt.mapper.ImageCollectMapper">
<sql id="Base_Column_List">
a.collect_id, a.shooting_time_begin, a.shooting_time_end, a.weather, a.humidness, a.temperature_min, a.temperature_max, a.wind_level, a.shooting_method,
a.shooting_distance, a.collector_name,
</sql>
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ImageCollectInfo">
select
<include refid="Base_Column_List"/>
from image_collect_info a
</select>
</mapper> </mapper>

View File

@ -13,6 +13,9 @@
<if test="keyword != null and keyword != ''"> <if test="keyword != null and keyword != ''">
AND i.image_name LIKE concat('%', #{keyword}, '%') AND i.image_name LIKE concat('%', #{keyword}, '%')
</if> </if>
<if test="turbineId != null and turbineId != ''">
AND p.turbine_id = #{turbineId}
</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>

View File

@ -3,6 +3,7 @@ package com.dite.znpt.web.controller;
import com.dite.znpt.domain.Constants; import com.dite.znpt.domain.Constants;
import com.dite.znpt.domain.vo.DefectListReq; 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.DefectResp;
import com.dite.znpt.domain.entity.DefectEntity; import com.dite.znpt.domain.entity.DefectEntity;
import com.dite.znpt.service.DefectService; import com.dite.znpt.service.DefectService;
@ -30,35 +31,41 @@ public class DefectController {
@Resource @Resource
private DefectService defectService; private DefectService defectService;
@ApiOperation(value = "获取缺陷记录列表", httpMethod = "GET") @ApiOperation(value = "分页查询缺陷记录列表", httpMethod = "GET")
@GetMapping("/list") @GetMapping("/page")
public PageResult<DefectResp> list(DefectListReq defectReq) { public PageResult<DefectResp> page(@RequestBody DefectListReq req) {
return PageResult.ok(defectService.selectList(defectReq)); return PageResult.ok(defectService.page(req));
} }
@ApiOperation(value = "根据缺陷记录Id获取详细信息", httpMethod = "GET") @ApiOperation(value = "查询缺陷记录列表", httpMethod = "GET")
@GetMapping("/{defectId}") @GetMapping("/page")
public Result<DefectResp> getInfo(@PathVariable String defectId) { public Result<List<DefectResp>> list(@RequestBody DefectListReq req) {
return Result.ok(defectService.selectById(defectId)); return Result.ok(defectService.list(req));
}
@ApiOperation(value = "查询缺详细", httpMethod = "GET")
@GetMapping("/detail/{defectId}")
public Result<DefectResp> detail(@PathVariable String defectId) {
return Result.ok(defectService.detail(defectId));
} }
@ApiOperation(value = "新增缺陷记录", httpMethod = "POST") @ApiOperation(value = "新增缺陷记录", httpMethod = "POST")
@PostMapping @PostMapping("/{imageId}")
public Result<Object> add(@RequestBody DefectEntity defect) { public Result save(@PathVariable String imageId, @RequestBody DefectReq req) {
defectService.saveData(defect); defectService.save(imageId, req);
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "修改缺陷记录", httpMethod = "PUT") @ApiOperation(value = "修改缺陷记录", httpMethod = "PUT")
@PutMapping @PutMapping("/{defectId}")
public Result<Object> edit(@RequestBody DefectEntity defect) { public Result edit(@PathVariable String defectId, @RequestBody DefectReq req) {
defectService.updateData(defect); defectService.update(defectId, req);
return Result.ok(); return Result.ok();
} }
@ApiOperation(value = "删除缺陷记录", httpMethod = "DELETE") @ApiOperation(value = "删除缺陷记录", httpMethod = "DELETE")
@DeleteMapping("/{defectId}") @DeleteMapping("/{defectId}")
public Result<Object> remove(@PathVariable String defectId) { public Result remove(@PathVariable String defectId) {
defectService.deleteById(defectId); defectService.deleteById(defectId);
return Result.ok(); return Result.ok();
} }
@ -67,7 +74,7 @@ public class DefectController {
@GetMapping("/export") @GetMapping("/export")
@ResponseExcel(name = "缺陷记录") @ResponseExcel(name = "缺陷记录")
public List<DefectResp> export(DefectListReq defectReq) { public List<DefectResp> export(DefectListReq defectReq) {
return defectService.selectList(defectReq); return defectService.page(defectReq);
} }
@ApiOperation(value = "导入缺陷记录", httpMethod = "POST") @ApiOperation(value = "导入缺陷记录", httpMethod = "POST")

View File

@ -84,7 +84,7 @@ spring:
sip-config: sip-config:
name: 信令服务 name: 信令服务
ip: 127.0.0.1 ip: 192.168.0.207
port: 1074 port: 1074
charset: gb2312 charset: gb2312
domain: 3402000000 domain: 3402000000
@ -100,23 +100,23 @@ zlm-config:
# 公网ip # 公网ip
publicHost: publicHost:
# 接口ip # 接口ip
apiHost: 127.0.0.1 apiHost: 192.168.0.207
# 接口端口 # 接口端口
apiPort: 30186 apiPort: 8080
# 密钥 # 密钥
secretKey: JvVotkdN01y4qZHlrJsdq4gD7n9rK6wV secretKey: 6Q76ivvVOQDsnnfOSKbtVzcYpbgy4n1G
# 流id前缀 # 流id前缀
streamPrefix: streamPrefix:
# rtp ip # rtp ip
rtpHost: 127.0.0.1 rtpHost: 192.168.0.207
# rtp 端口 # rtp 端口
rtpPort: 30186 rtpPort: 8080
# 动态端口起始值 # 动态端口起始值
dynamicPortStart: 30150 dynamicPortStart: 30150
# 动态端口结束值 # 动态端口结束值
dynamicPortEnd: 30185 dynamicPortEnd: 30185
upload: upload:
temp-path: D:\Upload\Temp temp-path: F:\Upload\Temp
perm-path: D:\Upload\Perm perm-path: F:\Upload\Perm