因为数据库连接问题导致的插入数据库异常
This commit is contained in:
98
src/main/java/com/rj/controller/LbOrderRowController.java
Normal file
98
src/main/java/com/rj/controller/LbOrderRowController.java
Normal file
@@ -0,0 +1,98 @@
|
||||
package com.rj.controller;
|
||||
|
||||
import com.rj.dto.LbOrderRowSyncFromHxrRequest;
|
||||
import com.rj.entity.LbOrderRow;
|
||||
import com.rj.service.ILbOrderRowService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/lbOrderRow")
|
||||
@Tag(name = "LB 订单行", description = "lb_order_row 增删改查与分页")
|
||||
public class LbOrderRowController {
|
||||
|
||||
@Autowired
|
||||
private ILbOrderRowService lbOrderRowService;
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
@Parameter(description = "实体(id 为订单 id,需调用方指定)", required = true) @RequestBody LbOrderRow entity) {
|
||||
Map<String, Object> result = lbOrderRowService.add(entity);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "编辑")
|
||||
public ResponseEntity<Map<String, Object>> update(
|
||||
@Parameter(description = "实体", required = true) @RequestBody LbOrderRow entity) {
|
||||
Map<String, Object> result = lbOrderRowService.update(entity);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete/{id}")
|
||||
@Operation(summary = "删除")
|
||||
public ResponseEntity<Map<String, Object>> delete(
|
||||
@Parameter(description = "主键(订单 id)", required = true) @PathVariable Long id) {
|
||||
Map<String, Object> result = lbOrderRowService.deleteById(id);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "分页查询")
|
||||
public ResponseEntity<Map<String, Object>> list(
|
||||
@RequestParam(defaultValue = "1") Integer current,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String isResell,
|
||||
@RequestParam(required = false) String orderSn,
|
||||
@RequestParam(required = false) Long buyerId,
|
||||
@RequestParam(required = false) Long sellerId,
|
||||
@RequestParam(required = false) Integer status,
|
||||
@RequestParam(required = false) Long merchandiseId) {
|
||||
Map<String, Object> result =
|
||||
lbOrderRowService.pageQuery(
|
||||
current, size, isResell, orderSn, buyerId, sellerId, status, merchandiseId);
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.internalServerError().body(result);
|
||||
}
|
||||
|
||||
@PostMapping("/sync-order-from-third")
|
||||
@Operation(
|
||||
summary = "从 外部系统 同步订单",
|
||||
description = "按购买时间区间、租户 id、转卖状态调用后台 order/select,将结果写入 lb_order_row(按订单 id upsert)")
|
||||
public ResponseEntity<Map<String, Object>> syncFromHxr(
|
||||
@Parameter(description = "同步条件", required = true) @RequestBody LbOrderRowSyncFromHxrRequest request) {
|
||||
Map<String, Object> result =
|
||||
lbOrderRowService.syncFromHxrAdmin(
|
||||
request.getBuyTimeStart(),
|
||||
request.getBuyTimeEnd(),
|
||||
request.getTenantId(),
|
||||
request.getIsResell());
|
||||
Boolean success = (Boolean) result.get("success");
|
||||
if (success != null && success) {
|
||||
return ResponseEntity.ok(result);
|
||||
}
|
||||
return ResponseEntity.badRequest().body(result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user