|
|
|
@ -1,16 +1,19 @@
|
|
|
|
package com.zhehekeji.web.controller;
|
|
|
|
package com.zhehekeji.web.controller;
|
|
|
|
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
|
|
|
|
import com.zhehekeji.common.util.ValidatorUtil;
|
|
|
|
import com.zhehekeji.core.pojo.Result;
|
|
|
|
import com.zhehekeji.core.pojo.Result;
|
|
|
|
import com.zhehekeji.core.util.Assert;
|
|
|
|
import com.zhehekeji.core.util.Assert;
|
|
|
|
import com.zhehekeji.filter.pojo.SessionHandler;
|
|
|
|
import com.zhehekeji.filter.pojo.SessionHandler;
|
|
|
|
import com.zhehekeji.filter.pojo.UserType;
|
|
|
|
import com.zhehekeji.filter.pojo.UserType;
|
|
|
|
import com.zhehekeji.web.entity.Order;
|
|
|
|
import com.zhehekeji.web.entity.Order;
|
|
|
|
|
|
|
|
import com.zhehekeji.web.pojo.OrderSaveReq;
|
|
|
|
import com.zhehekeji.web.pojo.OrderSearch;
|
|
|
|
import com.zhehekeji.web.pojo.OrderSearch;
|
|
|
|
import com.zhehekeji.web.service.OrderService;
|
|
|
|
import com.zhehekeji.web.service.OrderService;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -23,19 +26,26 @@ public class OrderController {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private OrderService orderService;
|
|
|
|
private OrderService orderService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private ValidatorUtil validatorUtil;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Value("${zhehe.filter.postToken}")
|
|
|
|
|
|
|
|
private String postToken;
|
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("新增")
|
|
|
|
@ApiOperation("新增")
|
|
|
|
@PostMapping("/")
|
|
|
|
@PostMapping("/")
|
|
|
|
//@SessionHandler(userType = UserType.ACCOUNT)
|
|
|
|
//@SessionHandler(userType = UserType.ACCOUNT)
|
|
|
|
public Result<Long> save(@RequestBody Order order){
|
|
|
|
public Result<Long> save(@RequestBody OrderSaveReq saveReq){
|
|
|
|
|
|
|
|
validatorUtil.validate(saveReq);
|
|
|
|
return Result.success(orderService.add(order));
|
|
|
|
Assert.isTrue(postToken.equals(saveReq.getToken()),"token不正确");
|
|
|
|
|
|
|
|
return Result.success(orderService.add(saveReq));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/list")
|
|
|
|
@PostMapping("/list")
|
|
|
|
@ApiOperation(value = "查询")
|
|
|
|
@ApiOperation(value = "查询")
|
|
|
|
//@SessionHandler(userType = UserType.ACCOUNT)
|
|
|
|
//@SessionHandler(userType = UserType.ACCOUNT)
|
|
|
|
public Result<List<Order>> findRoleList(@RequestBody OrderSearch orderSearch) {
|
|
|
|
public Result<List<Order>> findRoleList(@RequestBody OrderSearch orderSearch) {
|
|
|
|
|
|
|
|
validatorUtil.validate(orderSearch);
|
|
|
|
return new Result<>(orderService.orders(orderSearch));
|
|
|
|
return new Result<>(orderService.orders(orderSearch));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|