parent
f2f28b402f
commit
71a6abe081
@ -0,0 +1,76 @@ |
|||||||
|
package com.cweb.controller.order; |
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper; |
||||||
|
import com.github.pagehelper.PageInfo; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.security.UserCenter; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.UserSessionObject; |
||||||
|
import com.hfkj.service.gas.BsGasOrderService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Controller |
||||||
|
@RequestMapping(value = "/gasOrder") |
||||||
|
@Api(value = "加油订单业务") |
||||||
|
public class GasOrderController { |
||||||
|
private static Logger log = LoggerFactory.getLogger(GasOrderController.class); |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
@Resource |
||||||
|
private BsGasOrderService gasOrderService; |
||||||
|
|
||||||
|
@RequestMapping(value="/queryUserOilOrder",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询用户加油订单") |
||||||
|
public ResponseData queryUserOilOrder(@RequestParam(name = "orderNo", required = false) String orderNo, |
||||||
|
@RequestParam(name = "orderStatus", required = false) Integer orderStatus, |
||||||
|
@RequestParam(name = "pageNum", required = true) Integer pageNum, |
||||||
|
@RequestParam(name = "pageSize", required = true) Integer pageSize) { |
||||||
|
try { |
||||||
|
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); |
||||||
|
if (userSession == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
param.put("userId", userSession.getUser().getId()); |
||||||
|
param.put("orderNo", orderNo); |
||||||
|
param.put("orderStatus", orderStatus); |
||||||
|
|
||||||
|
PageHelper.startPage(pageNum,pageSize); |
||||||
|
return ResponseMsgUtil.success(new PageInfo<>(gasOrderService.getGasOrderList(param))); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/queryOilOrder",method = RequestMethod.GET) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询加油订单详情") |
||||||
|
public ResponseData queryOilOrder(@RequestParam(name = "orderNo", required = true) String orderNo) { |
||||||
|
try { |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(gasOrderService.getDetailByOrderNo(orderNo)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
log.error("error!",e); |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue