--升级兼容pc端
This commit is contained in:
@ -45,6 +45,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@ -83,7 +84,7 @@ public class StoreCombinationController {
|
|||||||
@ApiOperation(value = "拼团产品列表",notes = "拼团产品列表")
|
@ApiOperation(value = "拼团产品列表",notes = "拼团产品列表")
|
||||||
public ApiResult<CombinationQueryVo> getList(@RequestParam(value = "page",defaultValue = "1") int page,
|
public ApiResult<CombinationQueryVo> getList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
return ApiResult.ok(storeCombinationService.getList(page, limit));
|
return ApiResult.resultPage(storeCombinationService.getList(page, limit),limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,6 +42,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@ -76,7 +77,8 @@ public class StoreSeckillController {
|
|||||||
if (StrUtil.isBlank(time) || !NumberUtil.isNumber(time)){
|
if (StrUtil.isBlank(time) || !NumberUtil.isNumber(time)){
|
||||||
throw new YshopException("参数错误");
|
throw new YshopException("参数错误");
|
||||||
}
|
}
|
||||||
return ApiResult.ok(yxStoreSeckillService.getList(page, limit, Integer.valueOf(time)));
|
return ApiResult.resultPage(yxStoreSeckillService.getList(page, limit, Integer.valueOf(time)),limit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,9 +97,10 @@ public class ShoperController {
|
|||||||
@AuthCheck
|
@AuthCheck
|
||||||
@GetMapping("/admin/order/list")
|
@GetMapping("/admin/order/list")
|
||||||
@ApiOperation(value = "订单列表",notes = "订单列表")
|
@ApiOperation(value = "订单列表",notes = "订单列表")
|
||||||
public ApiResult<List<YxStoreOrderQueryVo>> orderList(ShoperQueryParam queryParam) {
|
public ApiResult<Object> orderList(ShoperQueryParam queryParam) {
|
||||||
return ApiResult.ok(storeOrderService.orderList(null, queryParam.getStatus(),
|
Map<String, Object> map = storeOrderService.orderList(null, queryParam.getStatus(),
|
||||||
queryParam.getPage(), queryParam.getLimit()));
|
queryParam.getPage(), queryParam.getLimit());
|
||||||
|
return ApiResult.ok(map.get("list"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,10 +64,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -171,6 +168,7 @@ public class StoreOrderController {
|
|||||||
orderDTO.setOrderId(orderId);
|
orderDTO.setOrderId(orderId);
|
||||||
map.put("status",OrderLogEnum.CREATE_ORDER_SUCCESS.getValue());
|
map.put("status",OrderLogEnum.CREATE_ORDER_SUCCESS.getValue());
|
||||||
map.put("result",orderDTO);
|
map.put("result",orderDTO);
|
||||||
|
map.put("createTime",order.getCreateTime());
|
||||||
|
|
||||||
//开始处理支付
|
//开始处理支付
|
||||||
//处理金额为0的情况
|
//处理金额为0的情况
|
||||||
@ -239,16 +237,17 @@ public class StoreOrderController {
|
|||||||
@AuthCheck
|
@AuthCheck
|
||||||
@GetMapping("/order/list")
|
@GetMapping("/order/list")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "type", value = "商品状态,默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款", paramType = "query", dataType = "int"),
|
@ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款", paramType = "query", dataType = "int"),
|
||||||
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"),
|
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"),
|
||||||
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int")
|
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int")
|
||||||
})
|
})
|
||||||
@ApiOperation(value = "订单列表",notes = "订单列表")
|
@ApiOperation(value = "订单列表",notes = "订单列表")
|
||||||
public ApiResult<List<YxStoreOrderQueryVo>> orderList(@RequestParam(value = "type",defaultValue = "0") int type,
|
public ApiResult<Object> orderList(@RequestParam(value = "type",defaultValue = "0") int type,
|
||||||
@RequestParam(value = "page",defaultValue = "1") int page,
|
@RequestParam(value = "page",defaultValue = "1") int page,
|
||||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
return ApiResult.ok(storeOrderService.orderList(uid,type, page,limit));
|
Map<String, Object> map = storeOrderService.orderList(uid, type, page, limit);
|
||||||
|
return ApiResult.resultPage((Integer) map.get("total"),(Integer) map.get("totalPage"),map.get("list"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,11 +221,12 @@ public class OrderSupplyService {
|
|||||||
}else if(AppFromEnum.PC.getValue().equals(from)){ //扫码支付
|
}else if(AppFromEnum.PC.getValue().equals(from)){ //扫码支付
|
||||||
map.put("status","WECHAT_PC_PAY");
|
map.put("status","WECHAT_PC_PAY");
|
||||||
WxPayNativeOrderResult wxPayNativeOrderResult = (WxPayNativeOrderResult)weixinPayService
|
WxPayNativeOrderResult wxPayNativeOrderResult = (WxPayNativeOrderResult)weixinPayService
|
||||||
.unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"APP商品购买");
|
.unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"pc商品购买");
|
||||||
jsConfig.put("codeUrl",wxPayNativeOrderResult.getCodeUrl());
|
jsConfig.put("codeUrl",wxPayNativeOrderResult.getCodeUrl());
|
||||||
orderDTO.setJsConfig(jsConfig);
|
orderDTO.setJsConfig(jsConfig);
|
||||||
map.put("result",orderDTO);
|
map.put("result",orderDTO);
|
||||||
map.put("payMsg","订单创建成功");
|
map.put("payMsg","订单创建成功");
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
else{//公众号
|
else{//公众号
|
||||||
map.put("status","WECHAT_PAY");
|
map.put("status","WECHAT_PAY");
|
||||||
|
@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +61,7 @@ public class ArticleController {
|
|||||||
@ApiOperation(value = "文章列表",notes = "文章列表")
|
@ApiOperation(value = "文章列表",notes = "文章列表")
|
||||||
public ApiResult<List<YxArticleQueryVo>> getYxArticlePageList(@RequestParam(value = "page",defaultValue = "1") int page,
|
public ApiResult<List<YxArticleQueryVo>> getYxArticlePageList(@RequestParam(value = "page",defaultValue = "1") int page,
|
||||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||||
return ApiResult.ok(articleService.getList(page,limit));
|
return ApiResult.resultPage(articleService.getList(page,limit),limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -43,10 +43,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName UserBillController
|
* @ClassName UserBillController
|
||||||
@ -186,7 +183,7 @@ public class UserBillController {
|
|||||||
newType = Integer.valueOf(type);
|
newType = Integer.valueOf(type);
|
||||||
}
|
}
|
||||||
Long uid = LocalUser.getUser().getUid();
|
Long uid = LocalUser.getUser().getUid();
|
||||||
return ApiResult.ok(userBillService.getUserBillList(page,limit,uid,newType));
|
return ApiResult.resultPage(Collections.singletonList(userBillService.getUserBillList(page,limit,uid,newType)),limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -178,7 +178,8 @@ public class ApiResult<T> implements Serializable {
|
|||||||
return result(ApiCode.FAIL,map);
|
return result(ApiCode.FAIL,map);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> ApiResult<T> resultPage(List<T> list, int limit){
|
public static <T> ApiResult<T> resultPage(T t, int limit){
|
||||||
|
List<Object> list = (List<Object>) t;
|
||||||
int count = list.size() / limit;
|
int count = list.size() / limit;
|
||||||
if (list.size() == 0) {
|
if (list.size() == 0) {
|
||||||
return (ApiResult<T>) ApiResult.builder()
|
return (ApiResult<T>) ApiResult.builder()
|
||||||
|
@ -18,6 +18,7 @@ import java.util.stream.Stream;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum OrderStatusEnum {
|
public enum OrderStatusEnum {
|
||||||
|
|
||||||
|
STATUS__1(-1,"全部订单"),
|
||||||
STATUS_0(0,"未支付"),
|
STATUS_0(0,"未支付"),
|
||||||
STATUS_1(1,"待发货"),
|
STATUS_1(1,"待发货"),
|
||||||
STATUS_2(2,"待收货"),
|
STATUS_2(2,"待收货"),
|
||||||
|
@ -164,7 +164,7 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
|||||||
* @param limit limit
|
* @param limit limit
|
||||||
* @return list
|
* @return list
|
||||||
*/
|
*/
|
||||||
List<YxStoreOrderQueryVo> orderList(Long uid,int type,int page,int limit);
|
Map<String,Object> orderList(Long uid,int type,int page,int limit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取某个用户的订单统计数据
|
* 获取某个用户的订单统计数据
|
||||||
|
@ -1099,7 +1099,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
* @return list
|
* @return list
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<YxStoreOrderQueryVo> orderList(Long uid, int type, int page, int limit) {
|
public Map<String,Object> orderList(Long uid, int type, int page, int limit) {
|
||||||
LambdaQueryWrapper<YxStoreOrder> wrapper= new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<YxStoreOrder> wrapper= new LambdaQueryWrapper<>();
|
||||||
if(uid != null) {
|
if(uid != null) {
|
||||||
wrapper.eq(YxStoreOrder::getUid,uid);
|
wrapper.eq(YxStoreOrder::getUid,uid);
|
||||||
@ -1107,6 +1107,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
wrapper.orderByDesc(YxStoreOrder::getId);
|
wrapper.orderByDesc(YxStoreOrder::getId);
|
||||||
|
|
||||||
switch (OrderStatusEnum.toType(type)){
|
switch (OrderStatusEnum.toType(type)){
|
||||||
|
case STATUS__1:
|
||||||
|
break;
|
||||||
//未支付
|
//未支付
|
||||||
case STATUS_0:
|
case STATUS_0:
|
||||||
wrapper.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_0.getValue())
|
wrapper.eq(YxStoreOrder::getPaid,OrderInfoEnum.PAY_STATUS_0.getValue())
|
||||||
@ -1159,10 +1161,13 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
Page<YxStoreOrder> pageModel = new Page<>(page, limit);
|
Page<YxStoreOrder> pageModel = new Page<>(page, limit);
|
||||||
IPage<YxStoreOrder> pageList = yxStoreOrderMapper.selectPage(pageModel,wrapper);
|
IPage<YxStoreOrder> pageList = yxStoreOrderMapper.selectPage(pageModel,wrapper);
|
||||||
List<YxStoreOrderQueryVo> list = generator.convert(pageList.getRecords(),YxStoreOrderQueryVo.class);
|
List<YxStoreOrderQueryVo> list = generator.convert(pageList.getRecords(),YxStoreOrderQueryVo.class);
|
||||||
|
Map<String,Object> map = new HashMap<>();
|
||||||
return list.stream()
|
map.put("list",list.stream()
|
||||||
.map(this::handleOrder)
|
.map(this::handleOrder)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList()));
|
||||||
|
map.put("total",pageList.getTotal());
|
||||||
|
map.put("totalPage",pageList.getPages());
|
||||||
|
return map;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
*/
|
*/
|
||||||
package co.yixiang.modules.mp.service;
|
package co.yixiang.modules.mp.service;
|
||||||
|
import cn.hutool.core.lang.UUID;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@ -135,6 +135,7 @@ public class WeixinPayService {
|
|||||||
orderRequest.setTradeType("APP");
|
orderRequest.setTradeType("APP");
|
||||||
}else if(AppFromEnum.PC.getValue().equals(from)){
|
}else if(AppFromEnum.PC.getValue().equals(from)){
|
||||||
orderRequest.setTradeType("NATIVE");
|
orderRequest.setTradeType("NATIVE");
|
||||||
|
orderRequest.setProductId( UUID.fastUUID().toString());
|
||||||
} else{
|
} else{
|
||||||
orderRequest.setTradeType("JSAPI");
|
orderRequest.setTradeType("JSAPI");
|
||||||
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
if(AppFromEnum.ROUNTINE.getValue().equals(from)){
|
||||||
|
Reference in New Issue
Block a user