Commit 6c8808ff by 章家宝

feat:检测端h5接口提交

1 parent fe6683a8
package com.glsx.usedcar.controller;
import com.glsx.usedcar.module.inspect.entity.InspectionReport;
import com.glsx.usedcar.module.inspect.service.InspectionReportService;
import com.glsx.usedcar.module.inspect.vo.InspectionReportRespVO;
import com.glsx.usedcar.module.security.entity.User;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.security.core.Authentication;
import org.springframework.web.bind.annotation.*;
import org.summerframework.orm.paging.Pagination;
@Slf4j
@Tag(name = "检测报告接口", description = "检测报告的增删改查、绑定解绑操作")
@RestController
@RequiredArgsConstructor
@RequestMapping("/rest/inspect/report")
public class InspectionReportController {
private final InspectionReportService inspectionReportService;
@Operation(summary = "分页查询检测报告", description = "支持关键词模糊查询(报告编号、工单号、VIN等)")
@PostMapping("/page")
public Page<InspectionReportRespVO> pageList(@Valid @RequestBody Pagination<InspectionReport> pagination, Authentication authentication) {
log.info("【接口请求】分页查询检测报告,操作人={},页码={},条数={}", getUserName(authentication), pagination.getOffset(), pagination.getLimit());
try {
Page<InspectionReportRespVO> result = inspectionReportService.pageList(pagination);
return result;
} catch (Exception e) {
log.error("【接口响应】分页查询检测报告失败!操作人={},系统异常!", getUserName(authentication), e);
return null;
}
}
/**
* 安全获取操作人姓名(避免空指针)
*/
private String getUserName(Authentication authentication) {
try {
return authentication != null ? ((User) authentication.getPrincipal()).getUserName() : "未知用户";
} catch (Exception e) {
return "未知用户";
}
}
}
\ No newline at end of file \ No newline at end of file
package com.glsx.usedcar.controller;
import com.glsx.usedcar.module.inspect.entity.InspectionWorkOrder;
import com.glsx.usedcar.module.inspect.service.InspectionWorkOrderService;
import com.glsx.usedcar.module.inspect.vo.InspectionWODetailRespVO;
import com.glsx.usedcar.module.inspect.vo.InspectionWORespVO;
import com.glsx.usedcar.resp.BaseResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.summerframework.orm.paging.Pagination;
@Slf4j
@Tag(name = "检测工单接口", description = "检测工单的增删改查操作")
@RestController
@RequiredArgsConstructor
@RequestMapping("/rest/inspect/wo")
public class InspectionWorkOrderController {
private final InspectionWorkOrderService inspectionWorkOrderService;
@Operation(summary = "分页检测工单", description = "分页查询检测工单列表")
@PostMapping("/page")
public Page<InspectionWORespVO> pageList(@Valid @RequestBody Pagination<InspectionWorkOrder> pagination) {
log.info("分页查询检测工单请求: offset={}, limit={}", pagination.getOffset(), pagination.getLimit());
try {
Page<InspectionWORespVO> result = inspectionWorkOrderService.pageList(pagination);
return result;
} catch (Exception e) {
log.error("分页查询检测工单失败!系统异常!", e);
return null;
}
}
@Operation(summary = "获取检测工单详情", description = "获取检测工单详情")
@PostMapping("/detail/{id}")
public BaseResp<InspectionWODetailRespVO> pageList(@PathVariable("id") Long id) {
log.info("获取检测工单详情: {}", id);
try {
InspectionWODetailRespVO result = inspectionWorkOrderService.detail(id);
return BaseResp.success(result);
} catch (Exception e) {
log.error("获取检测工单详情失败!系统异常!", e);
return BaseResp.fail("系统异常: " + e.getMessage());
}
}
}
package com.glsx.usedcar.controller;
import cn.hutool.core.util.StrUtil;
import com.glsx.usedcar.module.inspect.service.InspectorService;
import com.glsx.usedcar.module.inspect.vo.InspectorDetailRespVO;
import com.glsx.usedcar.resp.BaseResp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.summerframework.core.exception.BusinessCodeException;
/**
* 检测师控制器
*
* @author yangwei
* @version 1.0
* @since 2026/02/09 15:45
*/
@Slf4j
@Tag(name = "检测师管理接口", description = "检测师信息的增删改查操作")
@RestController
@RequiredArgsConstructor
@RequestMapping("/rest/inspect")
public class InspectorController {
private final InspectorService inspectorService;
@Operation(summary = "查询检测师详情", description = "查询检测师账号基本信息和操作日志")
@GetMapping("/detail/{id}")
public BaseResp<InspectorDetailRespVO> getDetail(
@Parameter(description = "检测师ID", required = true)
@NotNull(message = "检测师ID不能为空")
@Positive(message = "检测师ID必须为正数")
@PathVariable("id") Long id) {
log.info("查询检测师详情请求: ID={}", id);
try {
InspectorDetailRespVO result = inspectorService.getDetail(id);
return BaseResp.success(result);
} catch (BusinessCodeException be) {
log.error("查询检测师详情失败!业务异常!", be);
return BaseResp.fail(StrUtil.toString(be.getCode()), be.getMessage());
} catch (Exception e) {
log.error("查询检测师详情失败!系统异常!", e);
return BaseResp.fail("系统异常: " + e.getMessage());
}
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!