|
@@ -1,6 +1,5 @@
|
|
package com.txz.mall.controller.appcontroller;
|
|
package com.txz.mall.controller.appcontroller;
|
|
|
|
|
|
-import com.alibaba.fastjson.annotation.JSONField;
|
|
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.txz.mall.business.OrderServiceBusiness;
|
|
import com.txz.mall.business.OrderServiceBusiness;
|
|
@@ -18,13 +17,11 @@ import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
-import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import vo.MyRecord;
|
|
import vo.MyRecord;
|
|
import vo.StoreOrderCountItemVO;
|
|
import vo.StoreOrderCountItemVO;
|
|
import vo.StoreOrderVO;
|
|
import vo.StoreOrderVO;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
@@ -35,19 +32,19 @@ import java.util.List;
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/app/order")
|
|
@RequestMapping("/app/order")
|
|
public class AppOrderController {
|
|
public class AppOrderController {
|
|
-
|
|
|
|
|
|
+
|
|
private static Logger log = LoggerFactory.getLogger(AppOrderController.class);
|
|
private static Logger log = LoggerFactory.getLogger(AppOrderController.class);
|
|
-
|
|
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private StoreOrderService storeOrderService;
|
|
private StoreOrderService storeOrderService;
|
|
@Resource
|
|
@Resource
|
|
private OrderServiceBusiness orderServiceBusiness;
|
|
private OrderServiceBusiness orderServiceBusiness;
|
|
-
|
|
|
|
|
|
+
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
@ApiOperation(value = "创建订单")
|
|
@ApiOperation(value = "创建订单")
|
|
public Result add(@Validated @RequestBody CreateOrderRequest orderRequest) {
|
|
public Result add(@Validated @RequestBody CreateOrderRequest orderRequest) {
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
if (orderRequest == null) {
|
|
if (orderRequest == null) {
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
return Result.fail(ResultCode.OBJECT_IS_NULL);
|
|
}
|
|
}
|
|
@@ -56,7 +53,7 @@ public class AppOrderController {
|
|
MyRecord record = storeOrderService.createOrder(orderRequest);
|
|
MyRecord record = storeOrderService.createOrder(orderRequest);
|
|
return Result.success(record);
|
|
return Result.success(record);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@DeleteMapping("/delete")
|
|
@DeleteMapping("/delete")
|
|
@ApiOperation(value = "订单删除")
|
|
@ApiOperation(value = "订单删除")
|
|
public Result delete(@RequestParam Long id) {
|
|
public Result delete(@RequestParam Long id) {
|
|
@@ -74,7 +71,7 @@ public class AppOrderController {
|
|
}
|
|
}
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@PutMapping("/update")
|
|
@PutMapping("/update")
|
|
@ApiOperation(value = "订单更新")
|
|
@ApiOperation(value = "订单更新")
|
|
public Result update(@RequestBody StoreOrder storeOrder) {
|
|
public Result update(@RequestBody StoreOrder storeOrder) {
|
|
@@ -86,7 +83,7 @@ public class AppOrderController {
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
storeOrder.setUpdateTime(new Date());
|
|
storeOrder.setUpdateTime(new Date());
|
|
-// storeOrder.setUpdateUserId(userId);
|
|
|
|
|
|
+ // storeOrder.setUpdateUserId(userId);
|
|
storeOrderService.update(storeOrder);
|
|
storeOrderService.update(storeOrder);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("更新对象操作异常e:{}", e);
|
|
log.error("更新对象操作异常e:{}", e);
|
|
@@ -94,17 +91,17 @@ public class AppOrderController {
|
|
}
|
|
}
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@PutMapping("/binding/address")
|
|
@PutMapping("/binding/address")
|
|
@ApiOperation(value = "订单绑定地址")
|
|
@ApiOperation(value = "订单绑定地址")
|
|
public Result update(@RequestBody StoreOrderUpdateParam storeOrderUpdateParam) {
|
|
public Result update(@RequestBody StoreOrderUpdateParam storeOrderUpdateParam) {
|
|
-
|
|
|
|
|
|
+
|
|
try {
|
|
try {
|
|
StoreOrder storeOrder = new StoreOrder();
|
|
StoreOrder storeOrder = new StoreOrder();
|
|
storeOrder.setOrderId(storeOrderUpdateParam.getOrderId());
|
|
storeOrder.setOrderId(storeOrderUpdateParam.getOrderId());
|
|
storeOrder.setAddressId(storeOrderUpdateParam.getAddressId());
|
|
storeOrder.setAddressId(storeOrderUpdateParam.getAddressId());
|
|
- EasyToUseUtil.appUpdateAssignment(new Date(),storeOrder);
|
|
|
|
-
|
|
|
|
|
|
+ EasyToUseUtil.appUpdateAssignment(new Date(), storeOrder);
|
|
|
|
+
|
|
storeOrderService.bindingAddress(storeOrder);
|
|
storeOrderService.bindingAddress(storeOrder);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("更新对象操作异常e:{}", e);
|
|
log.error("更新对象操作异常e:{}", e);
|
|
@@ -112,8 +109,8 @@ public class AppOrderController {
|
|
}
|
|
}
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
@GetMapping("/detail")
|
|
@GetMapping("/detail")
|
|
@ApiOperation(value = "订单获取详情")
|
|
@ApiOperation(value = "订单获取详情")
|
|
public Result<StoreOrderVO> detail(@RequestParam Long id) {
|
|
public Result<StoreOrderVO> detail(@RequestParam Long id) {
|
|
@@ -123,26 +120,22 @@ public class AppOrderController {
|
|
StoreOrderVO vo = orderServiceBusiness.orderDetail(id);
|
|
StoreOrderVO vo = orderServiceBusiness.orderDetail(id);
|
|
return Result.success(vo);
|
|
return Result.success(vo);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
@ApiOperation(value = "订单获取列表")
|
|
@ApiOperation(value = "订单获取列表")
|
|
public Result<List<StoreOrderVO>> list(@RequestBody StoreOrderDTO dto) {
|
|
public Result<List<StoreOrderVO>> list(@RequestBody StoreOrderDTO dto) {
|
|
- PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
|
|
- PageInfo pageInfo = null;
|
|
|
|
try {
|
|
try {
|
|
- List<StoreOrderVO> arrayList = storeOrderService.orderList(dto);
|
|
|
|
- pageInfo = new PageInfo(arrayList);
|
|
|
|
|
|
+ return Result.success(storeOrderService.orderList(dto));
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("查询对象操作异常e:{}", e);
|
|
log.error("查询对象操作异常e:{}", e);
|
|
return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
return Result.fail(ResultCode.INTERNAL_SERVER_ERROR);
|
|
}
|
|
}
|
|
- return Result.success(pageInfo);
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@PostMapping("/app/list")
|
|
@PostMapping("/app/list")
|
|
@ApiOperation(value = "订单获取列表")
|
|
@ApiOperation(value = "订单获取列表")
|
|
public Result<List<StoreOrderVO>> appList(@RequestBody StoreOrderAppDTO dto) {
|
|
public Result<List<StoreOrderVO>> appList(@RequestBody StoreOrderAppDTO dto) {
|
|
-
|
|
|
|
|
|
+
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
dto.setUserId(tokenUserId);
|
|
dto.setUserId(tokenUserId);
|
|
PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
PageHelper.startPage(dto.getPage(), dto.getSize());
|
|
@@ -156,101 +149,102 @@ public class AppOrderController {
|
|
}
|
|
}
|
|
return Result.success(pageInfo);
|
|
return Result.success(pageInfo);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation(value = "获取订单各状态数量")
|
|
@ApiOperation(value = "获取订单各状态数量")
|
|
@GetMapping(value = "/status/num")
|
|
@GetMapping(value = "/status/num")
|
|
public Result<StoreOrderCountItemVO> getOrderStatusNum() {
|
|
public Result<StoreOrderCountItemVO> getOrderStatusNum() {
|
|
return Result.success(storeOrderService.getOrderStatusNum());
|
|
return Result.success(storeOrderService.getOrderStatusNum());
|
|
}
|
|
}
|
|
-
|
|
|
|
-// @ApiOperation("导出订单")
|
|
|
|
-// @PostMapping("/export")
|
|
|
|
-// public Result exportFile(@RequestBody StoreOrderDTO dto, HttpServletResponse response) {
|
|
|
|
-// storeOrderService.exportFile(dto, response);
|
|
|
|
-// return Result.success();
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// @ApiOperation("退款")
|
|
|
|
-// @PostMapping("/refund")
|
|
|
|
-// public Result refund(@RequestParam("id") Long id) {
|
|
|
|
-// storeOrderService.refund(id);
|
|
|
|
-// return Result.success();
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // @ApiOperation("导出订单")
|
|
|
|
+ // @PostMapping("/export")
|
|
|
|
+ // public Result exportFile(@RequestBody StoreOrderDTO dto, HttpServletResponse response) {
|
|
|
|
+ // storeOrderService.exportFile(dto, response);
|
|
|
|
+ // return Result.success();
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // @ApiOperation("退款")
|
|
|
|
+ // @PostMapping("/refund")
|
|
|
|
+ // public Result refund(@RequestParam("id") Long id) {
|
|
|
|
+ // storeOrderService.refund(id);
|
|
|
|
+ // return Result.success();
|
|
|
|
+ // }
|
|
|
|
+
|
|
@ApiOperation("关闭订单")
|
|
@ApiOperation("关闭订单")
|
|
@PostMapping("/close")
|
|
@PostMapping("/close")
|
|
public Result close(@RequestParam("id") Long id) {
|
|
public Result close(@RequestParam("id") Long id) {
|
|
storeOrderService.close(id);
|
|
storeOrderService.close(id);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("取消订单")
|
|
@ApiOperation("取消订单")
|
|
@PostMapping("/cancel")
|
|
@PostMapping("/cancel")
|
|
public Result cancel(@RequestParam("id") Long id) {
|
|
public Result cancel(@RequestParam("id") Long id) {
|
|
storeOrderService.cancel(id);
|
|
storeOrderService.cancel(id);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation("联系用户")
|
|
@ApiOperation("联系用户")
|
|
@PostMapping("/contactUser")
|
|
@PostMapping("/contactUser")
|
|
public Result contactUser(@RequestParam("userId") Long userId) {
|
|
public Result contactUser(@RequestParam("userId") Long userId) {
|
|
-// storeOrderService.contactUser(userId);
|
|
|
|
|
|
+ // storeOrderService.contactUser(userId);
|
|
return Result.success();
|
|
return Result.success();
|
|
}
|
|
}
|
|
-
|
|
|
|
-// @ApiOperation("批量发货")
|
|
|
|
-// @PostMapping("/batchDelivery")
|
|
|
|
-// public Result batchDelivery(@RequestBody List<StoreOrderDeliveryDTO> list) {
|
|
|
|
-// storeOrderService.batchDelivery(list);
|
|
|
|
-// return Result.success();
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // @ApiOperation("批量发货")
|
|
|
|
+ // @PostMapping("/batchDelivery")
|
|
|
|
+ // public Result batchDelivery(@RequestBody List<StoreOrderDeliveryDTO> list) {
|
|
|
|
+ // storeOrderService.batchDelivery(list);
|
|
|
|
+ // return Result.success();
|
|
|
|
+ // }
|
|
|
|
+
|
|
@ApiOperation(value = "预下单")
|
|
@ApiOperation(value = "预下单")
|
|
@PostMapping(value = "/pre/order")
|
|
@PostMapping(value = "/pre/order")
|
|
public Result preOrder(@RequestBody @Validated PreOrderRequest request) {
|
|
public Result preOrder(@RequestBody @Validated PreOrderRequest request) {
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
request.setUserId(tokenUserId);
|
|
request.setUserId(tokenUserId);
|
|
return Result.success(storeOrderService.preOrder(request));
|
|
return Result.success(storeOrderService.preOrder(request));
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
@ApiOperation(value = "加载预下单")
|
|
@ApiOperation(value = "加载预下单")
|
|
@PostMapping(value = "load/pre")
|
|
@PostMapping(value = "load/pre")
|
|
public Result<PreOrderResponse> loadPreOrder(@RequestParam String preOrderNo) {
|
|
public Result<PreOrderResponse> loadPreOrder(@RequestParam String preOrderNo) {
|
|
-
|
|
|
|
|
|
+
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
return Result.success(storeOrderService.loadPreOrder(preOrderNo));
|
|
return Result.success(storeOrderService.loadPreOrder(preOrderNo));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation(value = "计算订单价格")
|
|
@ApiOperation(value = "计算订单价格")
|
|
@PostMapping(value = "/computed/price")
|
|
@PostMapping(value = "/computed/price")
|
|
public Result<ComputedOrderPriceResponse> computedPrice(@Validated @RequestBody OrderComputedPriceRequest request) {
|
|
public Result<ComputedOrderPriceResponse> computedPrice(@Validated @RequestBody OrderComputedPriceRequest request) {
|
|
-
|
|
|
|
|
|
+
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
request.setUserId(tokenUserId);
|
|
request.setUserId(tokenUserId);
|
|
return Result.success(storeOrderService.computedOrderPrice(request));
|
|
return Result.success(storeOrderService.computedOrderPrice(request));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@ApiOperation(value = "去支付")
|
|
@ApiOperation(value = "去支付")
|
|
@PostMapping(value = "/goPay")
|
|
@PostMapping(value = "/goPay")
|
|
public Result getPayResult(@RequestBody GoPinkDTO dto) {
|
|
public Result getPayResult(@RequestBody GoPinkDTO dto) {
|
|
-
|
|
|
|
|
|
+
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
Long tokenUserId = AuthService.getTokenUserId(null);
|
|
dto.setUserId(tokenUserId);
|
|
dto.setUserId(tokenUserId);
|
|
Boolean result = storeOrderService.goPay(dto);
|
|
Boolean result = storeOrderService.goPay(dto);
|
|
return Result.success(result);
|
|
return Result.success(result);
|
|
}
|
|
}
|
|
-
|
|
|
|
-// @ApiOperation("导出发货单")
|
|
|
|
-// @PostMapping("/exportDelivery")
|
|
|
|
-// public Result exportDelivery(HttpServletResponse response) {
|
|
|
|
-// storeOrderService.exportDelivery(response);
|
|
|
|
-// return Result.success();
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// @ApiOperation("导入发货单")
|
|
|
|
-// @PostMapping("/importDelivery")
|
|
|
|
-// public Result importDelivery(@JSONField(serialize = false) @RequestParam("file") MultipartFile file) {
|
|
|
|
-// storeOrderService.importDelivery(file);
|
|
|
|
-// return Result.success();
|
|
|
|
-// }
|
|
|
|
|
|
+
|
|
|
|
+ // @ApiOperation("导出发货单")
|
|
|
|
+ // @PostMapping("/exportDelivery")
|
|
|
|
+ // public Result exportDelivery(HttpServletResponse response) {
|
|
|
|
+ // storeOrderService.exportDelivery(response);
|
|
|
|
+ // return Result.success();
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // @ApiOperation("导入发货单")
|
|
|
|
+ // @PostMapping("/importDelivery")
|
|
|
|
+ // public Result importDelivery(@JSONField(serialize = false) @RequestParam("file") MultipartFile file) {
|
|
|
|
+ // storeOrderService.importDelivery(file);
|
|
|
|
+ // return Result.success();
|
|
|
|
+ // }
|
|
}
|
|
}
|