| @@ -92,16 +92,14 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation(value = "分页订单列表接口", notes = "{\"pageNum\":Integer,\"pageSize\":Integer,\"orderStatus\":\"0-已下单/待付款;1-已支付;2-已取消(限定时间内未付款)\"}") | |||||
| @ApiOperation("分页订单列表接口") | |||||
| @GetMapping("list") | @GetMapping("list") | ||||
| public ResultData list(@RequestBody Map<String, Object> paramMap) { | |||||
| Integer pageNum = (Integer) paramMap.get("pageNum"); | |||||
| Integer pageSize = (Integer) paramMap.get("pageSize"); | |||||
| Integer orderStatus = (Integer) paramMap.get("orderStatus"); | |||||
| if (pageNum <= 0) | |||||
| pageNum = 1; | |||||
| if (pageSize <= 0) | |||||
| pageSize = 10; | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name="pageNum",value="页数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="pageSize",value="每页条数",dataType="int", paramType = "query",required=true), | |||||
| @ApiImplicitParam(name="orderStatus",value="订单状态0-已下单/待付款;1-已支付;2-已取消",dataType="int", paramType = "query",required=false) | |||||
| }) | |||||
| public ResultData list(Integer orderStatus, Integer pageNum, Integer pageSize) { | |||||
| // c端用户应该只能看到自己的订单 | // c端用户应该只能看到自己的订单 | ||||
| WxCUser user = getUser(); | WxCUser user = getUser(); | ||||
| WxOrder wxOrderQ = new WxOrder(); | WxOrder wxOrderQ = new WxOrder(); | ||||
| @@ -111,11 +109,20 @@ public class WxOrderController extends BaseController { | |||||
| return new ResultData(page); | return new ResultData(page); | ||||
| } | } | ||||
| @ApiOperation("根据id查询接口") | |||||
| @ApiOperation(value = "根据orderId查询接口", notes = "{\"orderId\":\"string\"}") | |||||
| @GetMapping("/findById") | @GetMapping("/findById") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| public ResultData findById(Long id) { | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxOrderService.getById(id)); | |||||
| public ResultData findById(@RequestBody Map<String, String> paramMap) { | |||||
| String orderIdStr = paramMap.get("orderId"); | |||||
| if (StringUtils.isBlank(orderIdStr)) { | |||||
| return new ResultData(ErrorCode.PARAMETER_NOT_NULL.getCode(), "orderId不能为空"); | |||||
| } | |||||
| Long orderId = 0L; | |||||
| try { | |||||
| orderId = Long.valueOf(orderIdStr); | |||||
| } catch (NumberFormatException e) { | |||||
| logger.error("parse orderId failed"); | |||||
| } | |||||
| return new ResultData(Result.SUCCESS, "查询成功", wxOrderService.getById(orderId)); | |||||
| } | } | ||||
| @@ -51,6 +51,9 @@ public class WxOrder implements Serializable { | |||||
| /*c端用户id**/ | /*c端用户id**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | @io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId") | ||||
| private Long cUserId; | private Long cUserId; | ||||
| /*商户ID**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户ID",name="merchantId") | |||||
| private Long merchantId; | |||||
| /*操作券B端小程序用户ID**/ | /*操作券B端小程序用户ID**/ | ||||
| @io.swagger.annotations.ApiModelProperty(value="操作券B端小程序用户ID",name="bUserId") | @io.swagger.annotations.ApiModelProperty(value="操作券B端小程序用户ID",name="bUserId") | ||||
| private Long bUserId; | private Long bUserId; | ||||
| @@ -93,6 +96,12 @@ public class WxOrder implements Serializable { | |||||
| public void setCUserId(Long _cUserId) { | public void setCUserId(Long _cUserId) { | ||||
| cUserId = _cUserId; | cUserId = _cUserId; | ||||
| } | } | ||||
| public Long getMerchantId() { | |||||
| return merchantId; | |||||
| } | |||||
| public void setMerchantId(Long _merchantId) { | |||||
| merchantId = _merchantId; | |||||
| } | |||||
| public Long getBUserId() { | public Long getBUserId() { | ||||
| return bUserId; | return bUserId; | ||||
| } | } | ||||
| @@ -150,6 +159,7 @@ public class WxOrder implements Serializable { | |||||
| ,OrderNumber_ASC("`orderNumber` ASC"),OrderNumber_DESC("`orderNumber` DESC") | ,OrderNumber_ASC("`orderNumber` ASC"),OrderNumber_DESC("`orderNumber` DESC") | ||||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | ||||
| ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | ,CUserId_ASC("`cUserId` ASC"),CUserId_DESC("`cUserId` DESC") | ||||
| ,MerchantId_ASC("`merchantId` ASC"),MerchantId_DESC("`merchantId` DESC") | |||||
| ,BUserId_ASC("`bUserId` ASC"),BUserId_DESC("`bUserId` DESC") | ,BUserId_ASC("`bUserId` ASC"),BUserId_DESC("`bUserId` DESC") | ||||
| ,PaymentType_ASC("`paymentType` ASC"),PaymentType_DESC("`paymentType` DESC") | ,PaymentType_ASC("`paymentType` ASC"),PaymentType_DESC("`paymentType` DESC") | ||||
| ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | ,Payment_ASC("`payment` ASC"),Payment_DESC("`payment` DESC") | ||||
| @@ -158,6 +158,7 @@ public class WxOrderServiceImpl implements WxOrderService { | |||||
| record.setTenantId(user.getTenantId()); | record.setTenantId(user.getTenantId()); | ||||
| record.setOrderNumber(orderNumber); | record.setOrderNumber(orderNumber); | ||||
| record.setCUserId(user.getId()); | record.setCUserId(user.getId()); | ||||
| record.setMerchantId(coupon.getMerchantId()); | |||||
| record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | record.setPaymentType(EnumPayType.PAY_PAYMENT.getCode()); | ||||
| record.setPayment(payment); | record.setPayment(payment); | ||||
| record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | record.setOrderStatus(EnumOrderStatus.ORDER_STATUS_PENDING_PAYMENT.getCode()); | ||||
| @@ -6,6 +6,7 @@ | |||||
| <result column="order_number" jdbcType="BIGINT" property="orderNumber" /> | <result column="order_number" jdbcType="BIGINT" property="orderNumber" /> | ||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" /> | ||||
| <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | <result column="c_user_id" jdbcType="BIGINT" property="cUserId" /> | ||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | <result column="b_user_id" jdbcType="BIGINT" property="bUserId" /> | ||||
| <result column="payment_type" jdbcType="INTEGER" property="paymentType" /> | <result column="payment_type" jdbcType="INTEGER" property="paymentType" /> | ||||
| <result column="payment" jdbcType="INTEGER" property="payment" /> | <result column="payment" jdbcType="INTEGER" property="payment" /> | ||||
| @@ -17,7 +18,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail` | |||||
| `id`,`order_number`,`tenant_id`,`c_user_id`,`merchant_id`,`b_user_id`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -43,6 +44,11 @@ | |||||
| </if> | </if> | ||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != bUserId "> | <if test=" null != bUserId "> | ||||
| and `b_user_id` = #{bUserId} | and `b_user_id` = #{bUserId} | ||||