用户退款

This commit is contained in:
yanglei 2025-11-19 09:41:49 +08:00
parent b28994f9b9
commit 8a2e209581
16 changed files with 337 additions and 48 deletions

View File

@ -61,7 +61,7 @@ public class EbikeRefund implements Serializable {
private LocalDateTime refundTime;
/**
* 退款状态; 0退款成功 1关闭 2退款中 3异常
* 状态;0退款成功 1关闭 2退款中 3异常
*/
private Integer refundStatus;
@ -86,9 +86,14 @@ public class EbikeRefund implements Serializable {
private BigDecimal total;
/**
* 退款原因
* 问题类型:1-还车点误判 2-禁停区误判 3-服务区外误判 4-车辆故障 5-开启失败 6-无法换车 7-车辆没电
*/
private String reason;
private Integer problemType;
/**
* 退款问题描述
*/
private String problemDescription;
/**
* 审核状态;0申请中 1处理中 2已处理 3已关闭

View File

@ -416,7 +416,7 @@ public class EbikeWxPayServiceImpl implements EbikeWxPayService {
request.setTransactionId(transactionId);
request.setOutTradeNo(String.valueOf(ebikePayment.getTradeId()));
request.setOutRefundNo(ebikeRefund.getRefundOrderId());
request.setReason(ebikeRefund.getReason());
request.setReason(ebikeRefund.getProblemDescription());
request.setNotifyUrl(wxPayConfig.getRefundNotifyUrl());
AmountReq amountReq = new AmountReq();
amountReq.setRefund(yuanToCent(amount.getRefund()));

View File

@ -64,8 +64,8 @@ public class EbikeFaultReportController {
*/
@PostMapping("save")
public JsonResult<?> saveFaultReport(@RequestBody EbikeFaultReportDto ebikeFaultReportDto) {
ebikeFaultReportService.saveFaultReport(ebikeFaultReportDto);
return JsonResult.success();
Long reportId = ebikeFaultReportService.saveFaultReport(ebikeFaultReportDto);
return JsonResult.success(reportId);
}
/**
@ -131,7 +131,7 @@ public class EbikeFaultReportController {
* @param ebikeOrderFaultReportDto 订单请求参数
*/
@PostMapping("queryOrderFaultReport")
public JsonResult<?> queryFaultReportByUserId(EbikeOrderFaultReportDto ebikeOrderFaultReportDto) {
public JsonResult<?> queryFaultReportByUserId(@RequestBody EbikeOrderFaultReportDto ebikeOrderFaultReportDto) {
Page<EbikeOrderFaultReportVo> faultReportVoPage = ebikeFaultReportService.queryOrderFaultReport(ebikeOrderFaultReportDto);
return JsonResult.success(faultReportVoPage);
}

View File

@ -0,0 +1,14 @@
package com.cdzy.user.mapper;
import com.cdzy.user.model.entity.EbikeFaultPart;
import com.mybatisflex.core.BaseMapper;
/**
* 用户故障上报损坏部件 映射层
*
* @author yanglei
* @since 2025-11-18 16:29
*/
public interface EbikeFaultPartMapper extends BaseMapper<EbikeFaultPart> {
}

View File

@ -48,7 +48,7 @@ public class EbikeFaultReportDto {
/**
* 损坏部件
*/
private Integer faultPart;
private List<Integer> faultPart;
/**
* 故障说明

View File

@ -0,0 +1,74 @@
package com.cdzy.user.model.entity;
import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.Table;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 用户故障上报损坏部件实体类
*
* @author yanglei
* @since 2025-11-18 16:26
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table("ebike_fault_part")
public class EbikeFaultPart implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
@Id
private Long partId;
/**
* 报告id
*/
private Long reportId;
/**
* 损坏部件
*/
private Integer faultPart;
/**
* 创建人
*/
private Long createBy;
/**
* 创建时间
*/
@Column(onInsertValue = "now()")
private LocalDateTime createTime;
/**
* 更新人
*/
private Long updateBy;
/**
* 更新时间
*/
@Column(onUpdateValue = "now()")
private LocalDateTime updateTime;
/**
* 删除状态true表示已删除
*/
private Boolean isDeleted;
}

View File

@ -51,11 +51,6 @@ public class EbikeFaultReport implements Serializable {
*/
private String bikeCode;
/**
* 损坏部件
*/
private Integer faultPart;
/**
* 故障说明
*/

View File

@ -46,7 +46,7 @@ public class EbikeFaultReportVo {
/**
* 损坏部件
*/
private Integer faultPart;
private List<Integer> faultPart;
/**
* 故障说明

View File

@ -41,7 +41,7 @@ public class EbikeOrderFaultReportVo {
/**
* 故障类型
*/
private Integer faultPart;
private List<Integer> faultPart;
/**
* 图片

View File

@ -28,4 +28,11 @@ public interface EbikeAttachmentFileService extends IService<EbikeAttachmentFile
* @param reportId 故障上报主键id
*/
void deleteFileByReportId(Long reportId);
/**
* 文件
*
* @param reportIds 故障上报id
*/
List<EbikeAttachmentFile> queryFilesByReportIds(List<Long> reportIds);
}

View File

@ -0,0 +1,30 @@
package com.cdzy.user.service;
import com.cdzy.user.model.entity.EbikeFaultPart;
import com.mybatisflex.core.service.IService;
import java.util.List;
/**
* 用户故障上报部件 服务层
*
* @author yanglei
* @since 2025-11-18 16:49
*/
public interface EbikeFaultPartService extends IService<EbikeFaultPart> {
/**
* 根据故障上报主键id查询损坏部件
*
* @param reportId 故障上报主键id
*/
List<Integer> getFaultPartByReportId(Long reportId);
/**
* 根据故障上报主键id查询损坏部件
*
* @param reportIds 故障上报主键id
*/
List<EbikeFaultPart> getFaultPart(List<Long> reportIds);
}

View File

@ -27,7 +27,7 @@ public interface EbikeFaultReportService extends IService<EbikeFaultReport> {
*
* @param ebikeFaultReportDto 用户故障上报请求参数
*/
void saveFaultReport(EbikeFaultReportDto ebikeFaultReportDto);
Long saveFaultReport(EbikeFaultReportDto ebikeFaultReportDto);
/**
* 上传文件到minio

View File

@ -7,6 +7,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import static com.cdzy.user.model.entity.table.EbikeAttachmentFileTableDef.EBIKE_ATTACHMENT_FILE;
@ -35,4 +36,14 @@ public class EbikeAttachmentFileServiceImpl extends ServiceImpl<EbikeAttachmentF
.where(EBIKE_ATTACHMENT_FILE.REPORT_ID.eq(reportId));
this.mapper.deleteByQuery(query);
}
@Override
public List<EbikeAttachmentFile> queryFilesByReportIds(List<Long> reportIds) {
if (reportIds == null || reportIds.isEmpty()) {
return Collections.emptyList();
}
QueryWrapper query = QueryWrapper.create()
.and(EBIKE_ATTACHMENT_FILE.REPORT_ID.in(reportIds));
return this.list(query);
}
}

View File

@ -0,0 +1,46 @@
package com.cdzy.user.service.impl;
import com.cdzy.user.mapper.EbikeFaultPartMapper;
import com.cdzy.user.model.entity.EbikeFaultPart;
import com.cdzy.user.service.EbikeFaultPartService;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
import static com.cdzy.user.model.entity.table.EbikeFaultPartTableDef.EBIKE_FAULT_PART;
/**
* 用户故障上报部件 实现类
*
* @author yanglei
* @since 2025-11-18 16:50
*/
@Service
public class EbikeFaultPartServiceImpl extends ServiceImpl<EbikeFaultPartMapper, EbikeFaultPart> implements EbikeFaultPartService {
@Override
public List<Integer> getFaultPartByReportId(Long reportId) {
QueryWrapper query = QueryWrapper.create()
.select(EBIKE_FAULT_PART.ALL_COLUMNS)
.from(EBIKE_FAULT_PART)
.where(EBIKE_FAULT_PART.REPORT_ID.eq(reportId));
return this.mapper.selectListByQuery(query)
.stream()
.map(EbikeFaultPart::getFaultPart)
.collect(Collectors.toList());
}
@Override
public List<EbikeFaultPart> getFaultPart(List<Long> reportIds) {
QueryWrapper query = QueryWrapper.create()
.select(EBIKE_FAULT_PART.ALL_COLUMNS)
.from(EBIKE_FAULT_PART)
.where(EBIKE_FAULT_PART.REPORT_ID.in(reportIds));
return this.mapper.selectListByQuery(query);
}
}

View File

@ -10,11 +10,13 @@ import com.cdzy.user.model.dto.EbikeFaultReportDto;
import com.cdzy.user.model.dto.EbikeFaultReportQueryDto;
import com.cdzy.user.model.dto.EbikeOrderFaultReportDto;
import com.cdzy.user.model.entity.EbikeAttachmentFile;
import com.cdzy.user.model.entity.EbikeFaultPart;
import com.cdzy.user.model.entity.EbikeFaultReport;
import com.cdzy.user.model.vo.EbikeAttachmentFileVo;
import com.cdzy.user.model.vo.EbikeFaultReportVo;
import com.cdzy.user.model.vo.EbikeOrderFaultReportVo;
import com.cdzy.user.service.EbikeAttachmentFileService;
import com.cdzy.user.service.EbikeFaultPartService;
import com.cdzy.user.service.EbikeFaultReportService;
import com.cdzy.user.utils.MinioUtil;
import com.ebike.feign.clients.OperationsFeignClient;
@ -35,6 +37,7 @@ import java.util.*;
import java.util.stream.Collectors;
import static com.cdzy.user.model.entity.table.EbikeAttachmentFileTableDef.EBIKE_ATTACHMENT_FILE;
import static com.cdzy.user.model.entity.table.EbikeFaultPartTableDef.EBIKE_FAULT_PART;
import static com.cdzy.user.model.entity.table.EbikeFaultReportTableDef.EBIKE_FAULT_REPORT;
import static com.cdzy.user.model.entity.table.EbikeUserTableDef.EBIKE_USER;
@ -53,18 +56,20 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
@Resource
private OperationsFeignClient operationsFeignClient;
@Resource
private EbikeFaultPartService ebikeFaultPartService;
@Resource
private MinioUtil minioUtil;
@Transactional
@Override
public void saveFaultReport(EbikeFaultReportDto ebikeFaultReportDto) {
public Long saveFaultReport(EbikeFaultReportDto ebikeFaultReportDto) {
//获取车辆信息
FeignEbikeUserBikeInfo bikeInfo = getBikeInfo(ebikeFaultReportDto.getBikeCode());
EbikeFaultReport userFaultReport = EbikeFaultReport.builder()
.operatorId(bikeInfo.getOperatorId())
.bikeCode(ebikeFaultReportDto.getBikeCode())
.faultPart(ebikeFaultReportDto.getFaultPart())
.faultDescription(ebikeFaultReportDto.getFaultDescription())
.userMobile(ebikeFaultReportDto.getUserMobile())
.reportSource(ebikeFaultReportDto.getReportSource())
@ -85,10 +90,21 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
.fileType(dto.getFileType())
.fileUrl(dto.getFileUrl())
.fileSize(dto.getFileSize())
.createBy(ebikeFaultReportDto.getUserId())
.build())
.collect(Collectors.toList());
ebikeAttachmentFileService.saveBatch(fileEntities);
}
// 保存故障上报部位
List<Integer> faultPart = ebikeFaultReportDto.getFaultPart();
List<EbikeFaultPart> fileEntities = faultPart.stream().map(e -> EbikeFaultPart.builder()
.reportId(reportId)
.faultPart(e)
.createBy(ebikeFaultReportDto.getUserId())
.build())
.toList();
ebikeFaultPartService.saveBatch(fileEntities);
return reportId;
}
@Override
@ -145,6 +161,7 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
}
}
@Transactional
@Override
public void updateFaultReport(EbikeFaultReportDto ebikeFaultReportDto) {
if (ebikeFaultReportDto.getReportId() == null) {
@ -156,7 +173,6 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
.reportId(ebikeFaultReportDto.getReportId())
.operatorId(bikeInfo.getOperatorId())
.bikeCode(ebikeFaultReportDto.getBikeCode())
.faultPart(ebikeFaultReportDto.getFaultPart())
.faultDescription(ebikeFaultReportDto.getFaultDescription())
.userMobile(ebikeFaultReportDto.getUserMobile())
.reportSource(ebikeFaultReportDto.getReportSource())
@ -212,6 +228,32 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
ebikeAttachmentFileService.saveBatch(filesToInsert);
}
}
List<Integer> faultPart = ebikeFaultReportDto.getFaultPart();
List<Integer> existingFaultParts = ebikeFaultPartService.getFaultPartByReportId(ebikeFaultReportDto.getReportId());
// 需要删除的
List<Integer> toDelete = existingFaultParts.stream()
.filter(part -> !faultPart.contains(part))
.toList();
// 需要新增的
List<Integer> toInsert = faultPart.stream()
.filter(part -> !existingFaultParts.contains(part))
.toList();
List<EbikeFaultPart> partsToSave = toInsert.stream()
.map(fp -> EbikeFaultPart.builder()
.reportId(ebikeFaultReportDto.getReportId())
.faultPart(fp)
.isDeleted(false)
.createBy(ebikeFaultReportDto.getUserId())
.build())
.toList();
if (!toDelete.isEmpty()) {
ebikeFaultPartService.removeByIds(toDelete);
}
if (!partsToSave.isEmpty()) {
ebikeFaultPartService.saveBatch(partsToSave);
}
}
@Override
@ -231,12 +273,13 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
.fileSize(file.getFileSize())
.build())
.collect(Collectors.toList());
// 获取损坏部件
List<Integer> ebikeFaultParts = ebikeFaultPartService.getFaultPartByReportId(reportId);
return EbikeFaultReportVo.builder()
.reportId(report.getReportId())
.operatorId(report.getOperatorId())
.bikeCode(report.getBikeCode())
.faultPart(report.getFaultPart())
.faultPart(ebikeFaultParts)
.faultDescription(report.getFaultDescription())
.userMobile(report.getUserMobile())
.reportSource(report.getReportSource())
@ -249,23 +292,42 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
@Override
public List<EbikeFaultReportVo> queryBikeFaultReport(EbikeFaultReportQueryDto ebikeFaultReportQueryDto) {
// 主表查询
QueryWrapper query = QueryWrapper.create()
.where(EBIKE_FAULT_REPORT.BIKE_CODE.eq(ebikeFaultReportQueryDto.getBikeCode()));
.where(EBIKE_FAULT_REPORT.BIKE_CODE.eq(ebikeFaultReportQueryDto.getBikeCode()))
.and(EBIKE_FAULT_REPORT.IS_DELETED.eq(false));
if (ebikeFaultReportQueryDto.getReviewId() != null) {
query.and(EBIKE_FAULT_REPORT.REVIEW_ID.eq(ebikeFaultReportQueryDto.getReviewId()));
}
if (ebikeFaultReportQueryDto.getFaultPart() != null) {
query.and(EBIKE_FAULT_REPORT.FAULT_PART.eq(ebikeFaultReportQueryDto.getFaultPart()));
List<EbikeFaultReport> reports = this.list(query);
if (reports.isEmpty()) {
return Collections.emptyList();
}
List<Long> reportIds = reports.stream()
.map(EbikeFaultReport::getReportId)
.collect(Collectors.toList());
List<EbikeFaultReport> list = this.list(query);
// 查询附件文件
Map<Long, List<EbikeAttachmentFile>> fileMap = ebikeAttachmentFileService
.queryFilesByReportIds(reportIds)
.stream()
.collect(Collectors.groupingBy(EbikeAttachmentFile::getReportId));
// 转换为 DTO
return list.stream().map(report -> {
List<EbikeAttachmentFile> files = ebikeAttachmentFileService.queryFiles(report.getReportId());
List<EbikeAttachmentFileDto> fileDtos = files.stream()
// 查询故障部件
List<EbikeFaultPart> faultParts = ebikeFaultPartService.list(
QueryWrapper.create()
.and(EBIKE_FAULT_PART.REPORT_ID.in(reportIds))
);
Map<Long, List<Integer>> faultPartMap = faultParts.stream()
.collect(Collectors.groupingBy(
EbikeFaultPart::getReportId,
Collectors.mapping(EbikeFaultPart::getFaultPart, Collectors.toList())
));
return reports.stream().map(report -> {
List<EbikeAttachmentFileDto> fileDtos = Optional.ofNullable(fileMap.get(report.getReportId()))
.orElse(Collections.emptyList())
.stream()
.map(file -> EbikeAttachmentFileDto.builder()
.fileId(file.getFileId())
.fileName(file.getFileName())
@ -275,11 +337,13 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
.build())
.collect(Collectors.toList());
List<Integer> parts = faultPartMap.getOrDefault(report.getReportId(), Collections.emptyList());
return EbikeFaultReportVo.builder()
.reportId(report.getReportId())
.operatorId(report.getOperatorId())
.bikeCode(report.getBikeCode())
.faultPart(report.getFaultPart())
.faultPart(parts)
.faultDescription(report.getFaultDescription())
.userMobile(report.getUserMobile())
.reportSource(report.getReportSource())
@ -295,7 +359,6 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
public Page<EbikeOrderFaultReportVo> queryOrderFaultReport(EbikeOrderFaultReportDto ebikeOrderFaultReportDto) {
QueryWrapper query = QueryWrapper.create()
.select(
EBIKE_FAULT_REPORT.FAULT_PART,
EBIKE_FAULT_REPORT.FAULT_DESCRIPTION,
EBIKE_USER.NICKNAME.as("username"),
EBIKE_FAULT_REPORT.LOCATION,
@ -311,19 +374,26 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
if (records.isEmpty()) {
return reportVoPage;
}
List<Long> reportIds = records.stream()
.map(EbikeOrderFaultReportVo::getReportId)
.collect(Collectors.toList());
// 获取上传图片 按照reportId分组
QueryWrapper attachmentQuery = QueryWrapper.create()
.select(EBIKE_ATTACHMENT_FILE.ALL_COLUMNS)
.where(EBIKE_ATTACHMENT_FILE.REPORT_ID.in(reportIds));
List<EbikeAttachmentFile> allAttachments = ebikeAttachmentFileService.list(attachmentQuery);
Map<Long, List<EbikeAttachmentFile>> attachmentsByReportId = allAttachments.stream()
.collect(Collectors.groupingBy(EbikeAttachmentFile::getReportId));
// 获取部件 按照reportId分组
List<EbikeFaultPart> faultPart = ebikeFaultPartService.getFaultPart(reportIds);
Map<Long, List<Integer>> faultPartMap = faultPart.stream()
.collect(Collectors.groupingBy(
EbikeFaultPart::getReportId,
Collectors.mapping(EbikeFaultPart::getFaultPart, Collectors.toList())
));
for (EbikeOrderFaultReportVo record : records) {
List<EbikeAttachmentFile> files = attachmentsByReportId.get(record.getReportId());
List<String> fileUrls = new ArrayList<>();
@ -338,6 +408,7 @@ public class EbikeFaultReportServiceImpl extends ServiceImpl<EbikeFaultReportMap
}
}
record.setImage(fileUrls);
record.setFaultPart(faultPartMap.getOrDefault(record.getReportId(), Collections.emptyList()));
}
return reportVoPage;
}

View File

@ -81,6 +81,14 @@ CREATE SEQUENCE IF NOT EXISTS ebike_fault_report_report_id_seq
MAXVALUE 9223372036854775807
CACHE 1;
-- 创建 ebike_fault_part_part_id_seq 序列
CREATE SEQUENCE IF NOT EXISTS ebike_fault_part_part_id_seq
START WITH 1
INCREMENT BY 1
MINVALUE 1
MAXVALUE 9223372036854775807
CACHE 1;
-- 创建 ebike_attachment_file_file_id_seq 序列
CREATE SEQUENCE IF NOT EXISTS ebike_attachment_file_file_id_seq
@ -384,7 +392,7 @@ CREATE TABLE "public"."ebike_refund_file" (
"refund_id" int8 NOT NULL,
"file_name" varchar(100) COLLATE "pg_catalog"."default",
"file_type" varchar(10) COLLATE "pg_catalog"."default",
"file_url" varchar(200) COLLATE "pg_catalog"."default",
"file_url" varchar(500) COLLATE "pg_catalog"."default",
"file_size" int8,
"create_by" int8,
"create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
@ -392,17 +400,17 @@ CREATE TABLE "public"."ebike_refund_file" (
"update_time" timestamp(6),
"is_deleted" bool NOT NULL DEFAULT false
);
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_id" IS '主键ID';
COMMENT ON COLUMN "public"."ebike_attachment_file"."refund_id" IS '退款主键id';
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_name" IS '附件文件名';
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_type" IS '附件类型';
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_url" IS '附件地址';
COMMENT ON COLUMN "public"."ebike_attachment_file"."file_size" IS '附件大小';
COMMENT ON COLUMN "public"."ebike_attachment_file"."create_by" IS '创建人ID';
COMMENT ON COLUMN "public"."ebike_attachment_file"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."ebike_attachment_file"."update_by" IS '最后修改人ID';
COMMENT ON COLUMN "public"."ebike_attachment_file"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_attachment_file" IS '还款相关附件文件记录';
COMMENT ON COLUMN "public"."ebike_refund_file"."file_id" IS '主键ID';
COMMENT ON COLUMN "public"."ebike_refund_file"."refund_id" IS '退款主键id';
COMMENT ON COLUMN "public"."ebike_refund_file"."file_name" IS '附件文件名';
COMMENT ON COLUMN "public"."ebike_refund_file"."file_type" IS '附件类型';
COMMENT ON COLUMN "public"."ebike_refund_file"."file_url" IS '附件地址';
COMMENT ON COLUMN "public"."ebike_refund_file"."file_size" IS '附件大小';
COMMENT ON COLUMN "public"."ebike_refund_file"."create_by" IS '创建人ID';
COMMENT ON COLUMN "public"."ebike_refund_file"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."ebike_refund_file"."update_by" IS '最后修改人ID';
COMMENT ON COLUMN "public"."ebike_refund_file"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_refund_file" IS '还款相关附件文件记录';
-- ----------------------------
-- Table structure for ebike_fault_report
@ -445,6 +453,29 @@ COMMENT ON COLUMN "public"."ebike_fault_report"."update_time" IS '最后修改
COMMENT ON TABLE "public"."ebike_fault_report" IS '用户上报故障信息表';
-- ----------------------------
-- Table structure for ebike_fault_part
-- ----------------------------
DROP TABLE IF EXISTS "public"."ebike_fault_part";
CREATE TABLE "public"."ebike_fault_part" (
"part_id" int8 NOT NULL DEFAULT nextval('ebike_fault_part_part_id_seq'::regclass),
"report_id" int8 NOT NULL,
"fault_part" int2,
"create_by" int8,
"create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
"update_by" int8,
"update_time" timestamp(6),
"is_deleted" bool NOT NULL DEFAULT false
);
COMMENT ON COLUMN "public"."ebike_fault_part"."part_id" IS '主键ID';
COMMENT ON COLUMN "public"."ebike_fault_part"."report_id" IS '报告id';
COMMENT ON COLUMN "public"."ebike_fault_part"."fault_part" IS '损坏部件';
COMMENT ON COLUMN "public"."ebike_fault_part"."create_by" IS '创建人ID';
COMMENT ON COLUMN "public"."ebike_fault_part"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."ebike_fault_part"."update_by" IS '最后修改人ID';
COMMENT ON COLUMN "public"."ebike_fault_part"."update_time" IS '最后修改时间';
COMMENT ON TABLE "public"."ebike_fault_part" IS '用户上报故障部位表';
-- ----------------------------
-- Table structure for ebike_attachment_file
-- ----------------------------
@ -454,7 +485,7 @@ CREATE TABLE "public"."ebike_attachment_file" (
"report_id" int8 NOT NULL,
"file_name" varchar(100) COLLATE "pg_catalog"."default",
"file_type" varchar(10) COLLATE "pg_catalog"."default",
"file_url" varchar(200) COLLATE "pg_catalog"."default",
"file_url" varchar(500) COLLATE "pg_catalog"."default",
"file_size" int8,
"create_by" int8,
"create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
@ -564,6 +595,11 @@ ALTER TABLE "public"."ebike_fault_report" ADD CONSTRAINT "ebike_refund_report_pk
CREATE INDEX idx_ebike_refund_report_bike_code ON public.ebike_fault_report (bike_code);
CREATE INDEX idx_ebike_refund_report_operator_id ON public.ebike_fault_report (operator_id);
-- ----------------------------
-- Primary Key structure for table ebike_fault_part
-- ----------------------------
ALTER TABLE "public"."ebike_fault_part" ADD CONSTRAINT "ebike_refund_part_pkey" PRIMARY KEY ("part_id");
-- ----------------------------
-- Primary Key structure for table ebike_attachment_file
-- ----------------------------