用户订单故障上报查询接口实现
This commit is contained in:
parent
77489ee59d
commit
2dc1fed2e8
@ -4,8 +4,11 @@ import com.cdzy.common.model.JsonResult;
|
||||
import com.cdzy.common.model.EbikeUserFaultreportDto;
|
||||
import com.cdzy.common.model.EbikeUserFaultreportQueryDto;
|
||||
import com.cdzy.common.model.EbikeOrderAttachmentFileDto;
|
||||
import com.cdzy.orders.model.dto.req.UserOrderFaultQueryDto;
|
||||
import com.cdzy.orders.model.dto.res.OrderFaultReport;
|
||||
import com.cdzy.orders.service.EbikeOrderAttachmentFileService;
|
||||
import com.cdzy.orders.uitls.MinioUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -126,6 +129,7 @@ public class EbikeUserFaultreportController {
|
||||
}
|
||||
return JsonResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户上报故障信息userId获取列表信息。
|
||||
*
|
||||
@ -138,4 +142,19 @@ public class EbikeUserFaultreportController {
|
||||
return JsonResult.success(faultListByWeChatUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户订单故障上报记录列表。
|
||||
*
|
||||
* @param userOrderFaultQueryDto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("getUserOrderFaultRecord")
|
||||
public JsonResult<?> getUserOrderFaultRecord(@RequestBody UserOrderFaultQueryDto userOrderFaultQueryDto) {
|
||||
try {
|
||||
Page<OrderFaultReport> orderFaultReports = ebikeUserFaultreportService.getUserOrderFaultRecord(userOrderFaultQueryDto);
|
||||
return JsonResult.success(orderFaultReports);
|
||||
} catch (Exception e) {
|
||||
return JsonResult.failed("getUserOrderFaultRecord===>出错了");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.cdzy.orders.model.dto.req;
|
||||
|
||||
import com.cdzy.common.model.PageParam;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:Ding
|
||||
* @ClassName:UserOrderFaultQueryDto
|
||||
* @Package:com.cdzy.orders.model.dto.req.UserOrderFaultQueryDto
|
||||
* @Description:用户订单故障上报查询参数
|
||||
* @CreateDate:2025年05月22日
|
||||
* @Version:V1.0
|
||||
**/
|
||||
@Data
|
||||
public class UserOrderFaultQueryDto {
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderId;
|
||||
|
||||
/**
|
||||
* 分页参数
|
||||
*/
|
||||
@NotNull(message = "分页参数不能为空")
|
||||
private PageParam pageParam;
|
||||
}
|
||||
@ -1,8 +1,9 @@
|
||||
package com.cdzy.payment.model.dto;
|
||||
package com.cdzy.orders.model.dto.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:Ding
|
||||
@ -15,10 +16,12 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class OrderFaultReport {
|
||||
|
||||
private String faultReportId;
|
||||
|
||||
/**
|
||||
* 反馈用户
|
||||
*/
|
||||
private String userName;
|
||||
private String reportUser;
|
||||
|
||||
/**
|
||||
* 坐标
|
||||
@ -28,20 +31,20 @@ public class OrderFaultReport {
|
||||
/**
|
||||
* 故障类型
|
||||
*/
|
||||
private String faultType;
|
||||
private String faultPart;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String image;
|
||||
private List<String> image;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
private String faultDescription;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime reportAt;
|
||||
}
|
||||
@ -3,6 +3,7 @@ package com.cdzy.orders.model.entity;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@ -107,4 +108,9 @@ public class EbikeUserFaultreport implements Serializable {
|
||||
*/
|
||||
private String workorderId;
|
||||
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderCode;
|
||||
|
||||
}
|
||||
|
||||
@ -2,6 +2,9 @@ package com.cdzy.orders.service;
|
||||
|
||||
import com.cdzy.common.model.EbikeUserFaultreportQueryDto;
|
||||
import com.cdzy.common.model.EbikeUserFaultreportDto;
|
||||
import com.cdzy.orders.model.dto.req.UserOrderFaultQueryDto;
|
||||
import com.cdzy.orders.model.dto.res.OrderFaultReport;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.cdzy.orders.model.entity.EbikeUserFaultreport;
|
||||
|
||||
@ -46,4 +49,11 @@ public interface EbikeUserFaultreportService extends IService<EbikeUserFaultrepo
|
||||
* @return 用户上报故障信息userId获取列表信息
|
||||
*/
|
||||
List<EbikeUserFaultreport> getFaultListByWeChatUser( Map<String,Object> params);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param userOrderFaultQueryDto
|
||||
* @return
|
||||
*/
|
||||
Page<OrderFaultReport> getUserOrderFaultRecord(UserOrderFaultQueryDto userOrderFaultQueryDto);
|
||||
}
|
||||
|
||||
@ -4,12 +4,17 @@ import cn.hutool.core.map.MapUtil;
|
||||
import com.cdzy.common.model.EbikeOrderAttachmentFileDto;
|
||||
import com.cdzy.common.model.EbikeUserFaultreportQueryDto;
|
||||
import com.cdzy.common.model.EbikeUserFaultreportDto;
|
||||
import com.cdzy.orders.mapper.EbikeOrderAttachmentFileMapper;
|
||||
import com.cdzy.orders.model.dto.req.UserOrderFaultQueryDto;
|
||||
import com.cdzy.orders.model.dto.res.EbikeUserDto;
|
||||
import com.cdzy.orders.model.dto.res.OrderFaultReport;
|
||||
import com.cdzy.orders.model.entity.EbikeAttachefileAssociated;
|
||||
import com.cdzy.orders.model.entity.EbikeOrderAttachmentFile;
|
||||
import com.cdzy.orders.service.EbikeAttachefileAssociatedService;
|
||||
import com.cdzy.orders.service.EbikeOrderAttachmentFileService;
|
||||
import com.cdzy.orders.uitls.MinioUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryMethods;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.cdzy.orders.model.entity.EbikeUserFaultreport;
|
||||
@ -22,11 +27,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.cdzy.orders.model.entity.table.EbikeAttachefileAssociatedTableDef.EBIKE_ATTACHEFILE_ASSOCIATED;
|
||||
import static com.cdzy.orders.model.entity.table.EbikeOrderAttachmentFileTableDef.EBIKE_ORDER_ATTACHMENT_FILE;
|
||||
import static com.cdzy.orders.model.entity.table.EbikeUserFaultreportTableDef.EBIKE_USER_FAULTREPORT;
|
||||
import static com.cdzy.orders.model.entity.table.EbikeUserTableDef.EBIKE_USER;
|
||||
|
||||
/**
|
||||
* 用户上报故障信息 服务层实现。
|
||||
@ -47,6 +55,7 @@ public class EbikeUserFaultreportServiceImpl extends ServiceImpl<EbikeUserFaultr
|
||||
|
||||
@Autowired
|
||||
private EbikeUserFaultreportMapper ebikeUserFaultreportMapper;
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public boolean save(EbikeUserFaultreportDto ebikeUserFaultreport) {
|
||||
@ -148,4 +157,36 @@ public class EbikeUserFaultreportServiceImpl extends ServiceImpl<EbikeUserFaultr
|
||||
Page<EbikeUserFaultreport> paginate = ebikeUserFaultreportMapper.paginate(pageNum, pageSize, query);
|
||||
return paginate.getRecords();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<OrderFaultReport> getUserOrderFaultRecord(UserOrderFaultQueryDto userOrderFaultQueryDto) {
|
||||
|
||||
QueryWrapper query = QueryWrapper.create()
|
||||
.select(EBIKE_USER_FAULTREPORT.FAULT_PART, EBIKE_USER_FAULTREPORT.REPORT_AT,
|
||||
EBIKE_USER_FAULTREPORT.FAULT_DESCRIPTION, EBIKE_USER.NICKNAME.as("report_user"),
|
||||
QueryMethods.concat(EBIKE_USER_FAULTREPORT.LONGITUDE,
|
||||
EBIKE_USER_FAULTREPORT.LATITUDE).as("coordinate"),
|
||||
EBIKE_USER_FAULTREPORT.FAULT_REPORT_ID)
|
||||
.leftJoin(EBIKE_USER).on(EBIKE_USER_FAULTREPORT.REPORT_USER.eq(EBIKE_USER.USER_ID))
|
||||
.where(EBIKE_USER_FAULTREPORT.ORDER_CODE.eq(userOrderFaultQueryDto.getOrderId()));
|
||||
|
||||
Page<OrderFaultReport> page = userOrderFaultQueryDto.getPageParam().getPage();
|
||||
Page<OrderFaultReport> orderFaultReportPage = ebikeUserFaultreportMapper.paginateAs(page, query, OrderFaultReport.class);
|
||||
List<OrderFaultReport> records = orderFaultReportPage.getRecords();
|
||||
for (OrderFaultReport record : records) {
|
||||
QueryWrapper file = QueryWrapper.create()
|
||||
.leftJoin(EBIKE_ATTACHEFILE_ASSOCIATED)
|
||||
.on(EBIKE_ATTACHEFILE_ASSOCIATED.ATTACHE_FILE
|
||||
.eq(EBIKE_ORDER_ATTACHMENT_FILE.FILE_KEY))
|
||||
.where(EBIKE_ATTACHEFILE_ASSOCIATED.BUSI_ID.eq(record.getFaultReportId()));
|
||||
List<EbikeOrderAttachmentFile> list = ebikeOrderAttachmentFileService.list(file);
|
||||
List<String> fileUrl = new ArrayList<>();
|
||||
for (EbikeOrderAttachmentFile ebikeOrderAttachmentFile : list) {
|
||||
String url = minioUtil.getBucketFileUrl(ebikeOrderAttachmentFile.getFileKey());
|
||||
fileUrl.add(url);
|
||||
}
|
||||
record.setImage(fileUrl);
|
||||
}
|
||||
return orderFaultReportPage;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user