售后流程
This commit is contained in:
@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -106,6 +107,23 @@ public class CouponController {
|
||||
return ApiResult.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户已领取优惠券pc
|
||||
*/
|
||||
@AppLog(value = "用户已领取优惠券pc", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/coupons/user/pc/{type}")
|
||||
@ApiOperation(value = "用户已领取优惠券pc",notes = "用户已领取优惠券pc")
|
||||
public ApiResult<Object> getUserPCList(
|
||||
@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int limit, @PathVariable(value = "type") Integer type){
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
Map<String, Object> map = storeCouponUserService.getUserPCCoupon(uid,page,limit,type);
|
||||
Long total = (Long) map.get("total");
|
||||
Long totalPage = (Long) map.get("totalPage");
|
||||
return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 优惠券 订单获取
|
||||
*/
|
||||
|
@ -13,27 +13,21 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.api.ApiResult;
|
||||
import co.yixiang.api.YshopException;
|
||||
import co.yixiang.enums.*;
|
||||
import co.yixiang.logging.aop.log.AppLog;
|
||||
import co.yixiang.common.aop.NoRepeatSubmit;
|
||||
import co.yixiang.common.bean.LocalUser;
|
||||
import co.yixiang.common.interceptor.AuthCheck;
|
||||
import co.yixiang.enums.*;
|
||||
import co.yixiang.logging.aop.log.AppLog;
|
||||
import co.yixiang.modules.mp.domain.YxWechatTemplate;
|
||||
import co.yixiang.modules.mp.service.WeixinPayService;
|
||||
import co.yixiang.modules.mp.service.YxWechatTemplateService;
|
||||
import co.yixiang.modules.order.domain.YxStoreOrder;
|
||||
import co.yixiang.modules.order.domain.YxStoreOrderCartInfo;
|
||||
import co.yixiang.modules.order.dto.OrderExtendDto;
|
||||
import co.yixiang.modules.order.param.ComputeOrderParam;
|
||||
import co.yixiang.modules.order.param.ConfirmOrderParam;
|
||||
import co.yixiang.modules.order.param.DoOrderParam;
|
||||
import co.yixiang.modules.order.param.ExpressParam;
|
||||
import co.yixiang.modules.order.param.HandleOrderParam;
|
||||
import co.yixiang.modules.order.param.OrderParam;
|
||||
import co.yixiang.modules.order.param.OrderVerifyParam;
|
||||
import co.yixiang.modules.order.param.PayParam;
|
||||
import co.yixiang.modules.order.param.ProductOrderParam;
|
||||
import co.yixiang.modules.order.param.ProductReplyParam;
|
||||
import co.yixiang.modules.order.param.RefundParam;
|
||||
import co.yixiang.modules.order.param.*;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderCartInfoService;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderService;
|
||||
import co.yixiang.modules.order.service.YxStoreOrderStatusService;
|
||||
import co.yixiang.modules.order.service.dto.YxStoreOrderDto;
|
||||
import co.yixiang.modules.order.vo.ComputeVo;
|
||||
import co.yixiang.modules.order.vo.ConfirmOrderVo;
|
||||
@ -45,6 +39,7 @@ import co.yixiang.modules.user.domain.YxUser;
|
||||
import co.yixiang.tools.express.ExpressService;
|
||||
import co.yixiang.tools.express.config.ExpressAutoConfiguration;
|
||||
import co.yixiang.tools.express.dao.ExpressInfo;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.vdurmont.emoji.EmojiParser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -55,16 +50,14 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -85,6 +78,10 @@ public class StoreOrderController {
|
||||
private final OrderSupplyService orderSupplyService;
|
||||
private final CreatShareProductService creatShareProductService;
|
||||
private final YxWechatTemplateService yxWechatTemplateService;
|
||||
private final YxStoreOrderStatusService orderStatusService;
|
||||
|
||||
private final YxStoreOrderCartInfoService storeOrderCartInfoService;
|
||||
private final WeixinPayService weixinPayService;
|
||||
|
||||
@Value("${file.path}")
|
||||
private String path;
|
||||
@ -96,10 +93,10 @@ public class StoreOrderController {
|
||||
@AppLog(value = "订单确认", type = 1)
|
||||
@AuthCheck
|
||||
@PostMapping("/order/confirm")
|
||||
@ApiOperation(value = "订单确认",notes = "订单确认")
|
||||
public ApiResult<ConfirmOrderVo> confirm(@Validated @RequestBody ConfirmOrderParam param){
|
||||
@ApiOperation(value = "订单确认", notes = "订单确认")
|
||||
public ApiResult<ConfirmOrderVo> confirm(@Validated @RequestBody ConfirmOrderParam param) {
|
||||
YxUser yxUser = LocalUser.getUser();
|
||||
return ApiResult.ok(storeOrderService.confirmOrder(yxUser,param.getCartId()));
|
||||
return ApiResult.ok(storeOrderService.confirmOrder(yxUser, param.getCartId()));
|
||||
|
||||
}
|
||||
|
||||
@ -111,25 +108,25 @@ public class StoreOrderController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "计算订单金额",notes = "计算订单金额")
|
||||
public ApiResult<Map<String,Object>> computedOrder(@Validated @RequestBody ComputeOrderParam param,
|
||||
@PathVariable String key){
|
||||
@ApiOperation(value = "计算订单金额", notes = "计算订单金额")
|
||||
public ApiResult<Map<String, Object>> computedOrder(@Validated @RequestBody ComputeOrderParam param,
|
||||
@PathVariable String key) {
|
||||
YxUser yxUser = LocalUser.getUser();
|
||||
Map<String,Object> map = orderSupplyService.check(yxUser.getUid(),key,param);
|
||||
if(OrderLogEnum.EXTEND_ORDER.getValue().equals(map.get("status"))
|
||||
Map<String, Object> map = orderSupplyService.check(yxUser.getUid(), key, param);
|
||||
if (OrderLogEnum.EXTEND_ORDER.getValue().equals(map.get("status"))
|
||||
|| OrderLogEnum.PINK_ORDER_FAIL_1.getValue().equals(map.get("status"))
|
||||
|| OrderLogEnum.PINK_ORDER_FAIL_2.getValue().equals(map.get("status")) ){
|
||||
return ApiResult.ok(map,map.get("msg").toString());
|
||||
|| OrderLogEnum.PINK_ORDER_FAIL_2.getValue().equals(map.get("status"))) {
|
||||
return ApiResult.ok(map, map.get("msg").toString());
|
||||
}
|
||||
|
||||
ComputeVo computeVo = storeOrderService.computedOrder(yxUser,key,
|
||||
ComputeVo computeVo = storeOrderService.computedOrder(yxUser, key,
|
||||
param.getCouponId(),
|
||||
param.getUseIntegral(),
|
||||
param.getShippingType(),
|
||||
param.getAddressId());
|
||||
|
||||
map.put("result",computeVo);
|
||||
map.put("status",OrderLogEnum.NONE_ORDER.getValue());
|
||||
map.put("result", computeVo);
|
||||
map.put("status", OrderLogEnum.NONE_ORDER.getValue());
|
||||
return ApiResult.ok(map);
|
||||
}
|
||||
|
||||
@ -140,24 +137,24 @@ public class StoreOrderController {
|
||||
@AuthCheck
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/order/create/{key}")
|
||||
@ApiOperation(value = "订单创建",notes = "订单创建")
|
||||
public ApiResult<Map<String,Object>> create(@Valid @RequestBody OrderParam param,
|
||||
@PathVariable String key){
|
||||
@ApiOperation(value = "订单创建", notes = "订单创建")
|
||||
public ApiResult<Map<String, Object>> create(@Valid @RequestBody OrderParam param,
|
||||
@PathVariable String key) {
|
||||
YxUser yxUser = LocalUser.getUser();
|
||||
ComputeOrderParam computeOrderParam = new ComputeOrderParam();
|
||||
BeanUtil.copyProperties(param,computeOrderParam);
|
||||
Map<String,Object> map = orderSupplyService.check(yxUser.getUid(),key,computeOrderParam);
|
||||
if(OrderLogEnum.EXTEND_ORDER.getValue().equals(map.get("status"))
|
||||
BeanUtil.copyProperties(param, computeOrderParam);
|
||||
Map<String, Object> map = orderSupplyService.check(yxUser.getUid(), key, computeOrderParam);
|
||||
if (OrderLogEnum.EXTEND_ORDER.getValue().equals(map.get("status"))
|
||||
|| OrderLogEnum.PINK_ORDER_FAIL_2.getValue().equals(map.get("status"))
|
||||
|| OrderLogEnum.PINK_ORDER_FAIL_1.getValue().equals(map.get("status")) ){
|
||||
return ApiResult.ok(map,map.get("msg").toString());
|
||||
|| OrderLogEnum.PINK_ORDER_FAIL_1.getValue().equals(map.get("status"))) {
|
||||
return ApiResult.ok(map, map.get("msg").toString());
|
||||
}
|
||||
|
||||
|
||||
//创建订单
|
||||
YxStoreOrder order = storeOrderService.createOrder(yxUser,key,param);
|
||||
YxStoreOrder order = storeOrderService.createOrder(yxUser, key, param);
|
||||
|
||||
if(ObjectUtil.isNull(order)) {
|
||||
if (ObjectUtil.isNull(order)) {
|
||||
throw new YshopException("订单生成失败");
|
||||
}
|
||||
|
||||
@ -166,9 +163,9 @@ public class StoreOrderController {
|
||||
OrderExtendDto orderDTO = new OrderExtendDto();
|
||||
orderDTO.setKey(key);
|
||||
orderDTO.setOrderId(orderId);
|
||||
map.put("status",OrderLogEnum.CREATE_ORDER_SUCCESS.getValue());
|
||||
map.put("result",orderDTO);
|
||||
map.put("createTime",order.getCreateTime());
|
||||
map.put("status", OrderLogEnum.CREATE_ORDER_SUCCESS.getValue());
|
||||
map.put("result", orderDTO);
|
||||
map.put("createTime", order.getCreateTime());
|
||||
|
||||
//开始处理支付
|
||||
//处理金额为0的情况
|
||||
@ -180,28 +177,27 @@ public class StoreOrderController {
|
||||
|
||||
orderSupplyService.goPay(map,orderId,yxUser.getUid(),
|
||||
param.getPayType(),param.getFrom(),orderDTO);
|
||||
|
||||
return ApiResult.ok(map,map.get("payMsg").toString());
|
||||
return ApiResult.ok(map, map.get("payMsg").toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* 订单支付
|
||||
*/
|
||||
@AppLog(value = "订单支付", type = 1)
|
||||
@AuthCheck
|
||||
@PostMapping("/order/pay")
|
||||
@ApiOperation(value = "订单支付",notes = "订单支付")
|
||||
public ApiResult<Map<String,Object>> pay(@Valid @RequestBody PayParam param){
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
@ApiOperation(value = "订单支付", notes = "订单支付")
|
||||
public ApiResult<Map<String, Object>> pay(@Valid @RequestBody PayParam param) {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
YxStoreOrderQueryVo storeOrder = storeOrderService
|
||||
.getOrderInfo(param.getUni(),uid);
|
||||
if(ObjectUtil.isNull(storeOrder)) {
|
||||
.getOrderInfo(param.getUni(), uid);
|
||||
if (ObjectUtil.isNull(storeOrder)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
|
||||
if(OrderInfoEnum.REFUND_STATUS_1.getValue().equals(storeOrder.getPaid())) {
|
||||
if (OrderInfoEnum.REFUND_STATUS_1.getValue().equals(storeOrder.getPaid())) {
|
||||
throw new YshopException("该订单已支付");
|
||||
}
|
||||
|
||||
@ -209,22 +205,22 @@ public class StoreOrderController {
|
||||
|
||||
OrderExtendDto orderDTO = new OrderExtendDto();
|
||||
orderDTO.setOrderId(orderId);
|
||||
map.put("status","SUCCESS");
|
||||
map.put("result",orderDTO);
|
||||
map.put("status", "SUCCESS");
|
||||
map.put("result", orderDTO);
|
||||
|
||||
|
||||
if(storeOrder.getPayPrice().compareTo(BigDecimal.ZERO) <= 0&&!param.getPaytype().equals(PayTypeEnum.INTEGRAL.getValue())){
|
||||
storeOrderService.yuePay(orderId,uid);
|
||||
return ApiResult.ok(map,"支付成功");
|
||||
if (storeOrder.getPayPrice().compareTo(BigDecimal.ZERO) <= 0 && !param.getPaytype().equals(PayTypeEnum.INTEGRAL.getValue())) {
|
||||
storeOrderService.yuePay(orderId, uid);
|
||||
return ApiResult.ok(map, "支付成功");
|
||||
}
|
||||
|
||||
//处理是否已经修改过订单价格,如果修改用新的单号去拉起支付
|
||||
if(StrUtil.isNotBlank(storeOrder.getExtendOrderId())) {
|
||||
if (StrUtil.isNotBlank(storeOrder.getExtendOrderId())) {
|
||||
orderId = storeOrder.getExtendOrderId();
|
||||
}
|
||||
|
||||
|
||||
orderSupplyService.goPay(map,orderId,uid, param.getPaytype(),param.getFrom(),orderDTO);
|
||||
orderSupplyService.goPay(map, orderId, uid, param.getPaytype(), param.getFrom(), orderDTO);
|
||||
|
||||
return ApiResult.ok(map);
|
||||
}
|
||||
@ -241,15 +237,15 @@ public class StoreOrderController {
|
||||
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int")
|
||||
})
|
||||
@ApiOperation(value = "订单列表",notes = "订单列表")
|
||||
public ApiResult<Object> orderList(@RequestParam(value = "type",defaultValue = "0") int type,
|
||||
@RequestParam(value = "page",defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit",defaultValue = "10") int limit){
|
||||
@ApiOperation(value = "订单列表", notes = "订单列表")
|
||||
public ApiResult<Object> orderList(@RequestParam(value = "type", defaultValue = "0") int type,
|
||||
@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int limit) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
Map<String, Object> map = storeOrderService.orderList(uid, type, page, limit);
|
||||
Long total = (Long)map.get("total");
|
||||
Long totalPage = (Long)map.get("totalPage");
|
||||
return ApiResult.resultPage(total.intValue(),totalPage.intValue(),map.get("list"));
|
||||
Long total = (Long) map.get("total");
|
||||
Long totalPage = (Long) map.get("totalPage");
|
||||
return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list"));
|
||||
}
|
||||
|
||||
|
||||
@ -262,34 +258,32 @@ public class StoreOrderController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "订单详情",notes = "订单详情")
|
||||
public ApiResult<YxStoreOrderQueryVo> detail(@PathVariable String key){
|
||||
@ApiOperation(value = "订单详情", notes = "订单详情")
|
||||
public ApiResult<YxStoreOrderQueryVo> detail(@PathVariable String key) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
if(StrUtil.isEmpty(key)) {
|
||||
if (StrUtil.isEmpty(key)) {
|
||||
throw new YshopException("参数错误");
|
||||
}
|
||||
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key,uid);
|
||||
if(ObjectUtil.isNull(storeOrder)){
|
||||
YxStoreOrderQueryVo storeOrder = storeOrderService.getOrderInfo(key, uid);
|
||||
if (ObjectUtil.isNull(storeOrder)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
storeOrder = creatShareProductService.handleQrcode(storeOrder,path);
|
||||
storeOrder = creatShareProductService.handleQrcode(storeOrder, path);
|
||||
|
||||
return ApiResult.ok(storeOrderService.handleOrder(storeOrder));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单收货
|
||||
*/
|
||||
@AppLog(value = "订单收货", type = 1)
|
||||
@AuthCheck
|
||||
@PostMapping("/order/take")
|
||||
@ApiOperation(value = "订单收货",notes = "订单收货")
|
||||
public ApiResult<Boolean> orderTake(@Validated @RequestBody DoOrderParam param){
|
||||
@ApiOperation(value = "订单收货", notes = "订单收货")
|
||||
public ApiResult<Boolean> orderTake(@Validated @RequestBody DoOrderParam param) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
storeOrderService.takeOrder(param.getUni(),uid);
|
||||
storeOrderService.takeOrder(param.getUni(), uid);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@ -297,8 +291,8 @@ public class StoreOrderController {
|
||||
* 订单产品信息
|
||||
*/
|
||||
@PostMapping("/order/product")
|
||||
@ApiOperation(value = "订单产品信息",notes = "订单产品信息")
|
||||
public ApiResult<OrderCartInfoVo> product(@Validated @RequestBody ProductOrderParam param){
|
||||
@ApiOperation(value = "订单产品信息", notes = "订单产品信息")
|
||||
public ApiResult<OrderCartInfoVo> product(@Validated @RequestBody ProductOrderParam param) {
|
||||
return ApiResult.ok(orderSupplyService.getProductOrder(param.getUnique()));
|
||||
}
|
||||
|
||||
@ -309,12 +303,49 @@ public class StoreOrderController {
|
||||
@AuthCheck
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/order/comment")
|
||||
@ApiOperation(value = "订单评价",notes = "订单评价")
|
||||
public ApiResult<Boolean> comment(@Valid @RequestBody ProductReplyParam param){
|
||||
@ApiOperation(value = "订单评价", notes = "订单评价")
|
||||
public ApiResult<Boolean> comment(@Valid @RequestBody ProductReplyParam param) {
|
||||
YxUser user = LocalUser.getUser();
|
||||
storeOrderService.orderComment(user,param.getUnique(),
|
||||
YxStoreOrderCartInfo orderCartInfo = storeOrderCartInfoService
|
||||
.getOne(Wrappers.<YxStoreOrderCartInfo>lambdaQuery()
|
||||
.eq(YxStoreOrderCartInfo::getUnique,param.getUnique()));
|
||||
storeOrderService.orderComment(orderCartInfo, user, param.getUnique(),
|
||||
param.getComment(),
|
||||
param.getPics(),param.getProductScore(),param.getServiceScore());
|
||||
param.getPics(), param.getProductScore(), param.getServiceScore());
|
||||
|
||||
//增加状态
|
||||
orderStatusService.create(orderCartInfo.getOid(),
|
||||
OrderLogEnum.EVAL_ORDER.getValue(),
|
||||
OrderLogEnum.EVAL_ORDER.getDesc());
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单评价
|
||||
*/
|
||||
@AppLog(value = "订单评价", type = 1)
|
||||
@AuthCheck
|
||||
@NoRepeatSubmit
|
||||
@PostMapping("/order/comments")
|
||||
@ApiOperation(value = "订单评价", notes = "订单评价")
|
||||
public ApiResult<Boolean> comments(@Valid @RequestBody List<ProductReplyParam> param) {
|
||||
YxUser user = LocalUser.getUser();
|
||||
if (param.size() > 0) {
|
||||
YxStoreOrderCartInfo orderCartInfo = storeOrderCartInfoService
|
||||
.getOne(Wrappers.<YxStoreOrderCartInfo>lambdaQuery()
|
||||
.eq(YxStoreOrderCartInfo::getUnique,param.get(0).getUnique()));
|
||||
|
||||
for (ProductReplyParam productReplyParam : param) {
|
||||
storeOrderService.orderComment(orderCartInfo , user, productReplyParam.getUnique(),
|
||||
productReplyParam.getComment(),
|
||||
productReplyParam.getPics(), productReplyParam.getProductScore(), productReplyParam.getServiceScore());
|
||||
}
|
||||
|
||||
//增加状态
|
||||
orderStatusService.create(orderCartInfo.getOid(),
|
||||
OrderLogEnum.EVAL_ORDER.getValue(),
|
||||
OrderLogEnum.EVAL_ORDER.getDesc());
|
||||
}
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@ -325,10 +356,10 @@ public class StoreOrderController {
|
||||
@AppLog(value = "订单删除", type = 1)
|
||||
@AuthCheck
|
||||
@PostMapping("/order/del")
|
||||
@ApiOperation(value = "订单删除",notes = "订单删除")
|
||||
public ApiResult<Boolean> orderDel(@Validated @RequestBody DoOrderParam param){
|
||||
@ApiOperation(value = "订单删除", notes = "订单删除")
|
||||
public ApiResult<Boolean> orderDel(@Validated @RequestBody DoOrderParam param) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
storeOrderService.removeOrder(param.getUni(),uid);
|
||||
storeOrderService.removeOrder(param.getUni(), uid);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@ -336,8 +367,8 @@ public class StoreOrderController {
|
||||
* 订单退款理由
|
||||
*/
|
||||
@GetMapping("/order/refund/reason")
|
||||
@ApiOperation(value = "订单退款理由",notes = "订单退款理由")
|
||||
public ApiResult<Object> refundReason(){
|
||||
@ApiOperation(value = "订单退款理由", notes = "订单退款理由")
|
||||
public ApiResult<Object> refundReason() {
|
||||
ArrayList<String> list = new ArrayList<>();
|
||||
list.add("收货地址填错了");
|
||||
list.add("与描述不符");
|
||||
@ -356,13 +387,13 @@ public class StoreOrderController {
|
||||
@NoRepeatSubmit
|
||||
@AuthCheck
|
||||
@PostMapping("/order/refund/verify")
|
||||
@ApiOperation(value = "订单退款审核",notes = "订单退款审核")
|
||||
public ApiResult<Boolean> refundVerify(@RequestBody RefundParam param){
|
||||
@ApiOperation(value = "订单退款审核", notes = "订单退款审核")
|
||||
public ApiResult<Boolean> refundVerify(@RequestBody RefundParam param) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
storeOrderService.orderApplyRefund(param.getRefundReasonWapExplain(),
|
||||
param.getRefundReasonWapImg(),
|
||||
EmojiParser.removeAllEmojis(param.getText()),
|
||||
param.getUni(),uid);
|
||||
param.getUni(), uid);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@ -373,10 +404,22 @@ public class StoreOrderController {
|
||||
@NoRepeatSubmit
|
||||
@AuthCheck
|
||||
@PostMapping("/order/cancel")
|
||||
@ApiOperation(value = "订单取消",notes = "订单取消")
|
||||
public ApiResult<Boolean> cancelOrder(@Validated @RequestBody HandleOrderParam param){
|
||||
@ApiOperation(value = "订单取消", notes = "订单取消")
|
||||
public ApiResult<Boolean> cancelOrder(@Validated @RequestBody HandleOrderParam param) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
storeOrderService.cancelOrder(param.getId(),uid);
|
||||
YxStoreOrderQueryVo orderInfo = storeOrderService.getOrderInfo(param.getId(), uid);
|
||||
if (ObjectUtil.isNull(orderInfo)) {
|
||||
throw new YshopException("订单不存在");
|
||||
}
|
||||
if (orderInfo.getStatus() != 0) {
|
||||
throw new YshopException("订单不能取消");
|
||||
}
|
||||
if (orderInfo.getPaid() == 1) {
|
||||
BigDecimal bigDecimal = new BigDecimal("100");
|
||||
int payPrice = bigDecimal.multiply(orderInfo.getPayPrice()).intValue();
|
||||
weixinPayService.refundOrder(param.getId(),payPrice);
|
||||
}
|
||||
storeOrderService.cancelOrder(param.getId(), uid);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@ -386,8 +429,8 @@ public class StoreOrderController {
|
||||
*/
|
||||
@AuthCheck
|
||||
@PostMapping("/order/express")
|
||||
@ApiOperation(value = "获取物流信息",notes = "获取物流信息")
|
||||
public ApiResult<ExpressInfo> express( @RequestBody ExpressParam expressInfoDo){
|
||||
@ApiOperation(value = "获取物流信息", notes = "获取物流信息")
|
||||
public ApiResult<ExpressInfo> express(@RequestBody ExpressParam expressInfoDo) {
|
||||
|
||||
//顺丰轨迹查询处理
|
||||
String lastFourNumber = "";
|
||||
@ -395,15 +438,15 @@ public class StoreOrderController {
|
||||
YxStoreOrderDto yxStoreOrderDto;
|
||||
yxStoreOrderDto = storeOrderService.getOrderDetail(Long.valueOf(expressInfoDo.getOrderCode()));
|
||||
lastFourNumber = yxStoreOrderDto.getUserPhone();
|
||||
if (lastFourNumber.length()==11) {
|
||||
lastFourNumber = StrUtil.sub(lastFourNumber,lastFourNumber.length(),-4);
|
||||
if (lastFourNumber.length() == 11) {
|
||||
lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
|
||||
}
|
||||
}
|
||||
|
||||
ExpressService expressService = ExpressAutoConfiguration.expressService();
|
||||
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
|
||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode(),lastFourNumber);
|
||||
if(!expressInfo.isSuccess()) {
|
||||
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode(), lastFourNumber);
|
||||
if (!expressInfo.isSuccess()) {
|
||||
throw new YshopException(expressInfo.getReason());
|
||||
}
|
||||
return ApiResult.ok(expressInfo);
|
||||
@ -416,12 +459,12 @@ public class StoreOrderController {
|
||||
@NoRepeatSubmit
|
||||
@AuthCheck
|
||||
@PostMapping("/order/order_verific")
|
||||
@ApiOperation(value = "订单核销",notes = "订单核销")
|
||||
public ApiResult<Object> orderVerify( @RequestBody OrderVerifyParam param){
|
||||
@ApiOperation(value = "订单核销", notes = "订单核销")
|
||||
public ApiResult<Object> orderVerify(@RequestBody OrderVerifyParam param) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
YxStoreOrderQueryVo orderQueryVo = storeOrderService.verifyOrder(param.getVerifyCode(),
|
||||
param.getIsConfirm(),uid);
|
||||
if(orderQueryVo != null) {
|
||||
param.getIsConfirm(), uid);
|
||||
if (orderQueryVo != null) {
|
||||
return ApiResult.ok(orderQueryVo);
|
||||
}
|
||||
|
||||
@ -429,16 +472,14 @@ public class StoreOrderController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@AuthCheck
|
||||
@GetMapping("/order/getSubscribeTemplate")
|
||||
@ApiOperation(value = "获取订阅消息模板ID",notes = "获取订阅消息模板ID")
|
||||
public ApiResult<List<String>> getSubscribeTemplate(){
|
||||
@ApiOperation(value = "获取订阅消息模板ID", notes = "获取订阅消息模板ID")
|
||||
public ApiResult<List<String>> getSubscribeTemplate() {
|
||||
List<YxWechatTemplate> yxWechatTemplate = yxWechatTemplateService.lambdaQuery()
|
||||
.eq(YxWechatTemplate::getType,"subscribe")
|
||||
.eq(YxWechatTemplate::getType, "subscribe")
|
||||
.eq(YxWechatTemplate::getStatus, ShopCommonEnum.IS_STATUS_1.getValue()).list();
|
||||
List<String> temId = yxWechatTemplate.stream().map(tem-> tem.getTempid()).collect(Collectors.toList());
|
||||
List<String> temId = yxWechatTemplate.stream().map(tem -> tem.getTempid()).collect(Collectors.toList());
|
||||
return ApiResult.ok(temId);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,20 @@
|
||||
package co.yixiang.modules.product.param;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author : gzlv 2021/6/26 19:17
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@ApiModel("查询参数对象")
|
||||
public class CollectDelFootParam {
|
||||
|
||||
private List<Long> ids;
|
||||
}
|
@ -9,6 +9,7 @@
|
||||
package co.yixiang.modules.product.rest;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@ -26,6 +27,7 @@ import co.yixiang.enums.AppFromEnum;
|
||||
import co.yixiang.enums.ProductEnum;
|
||||
import co.yixiang.enums.ShopCommonEnum;
|
||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||
import co.yixiang.modules.product.param.CollectDelFootParam;
|
||||
import co.yixiang.modules.product.param.YxStoreProductQueryParam;
|
||||
import co.yixiang.modules.product.param.YxStoreProductRelationQueryParam;
|
||||
import co.yixiang.modules.product.service.YxStoreProductRelationService;
|
||||
@ -49,12 +51,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.awt.FontFormatException;
|
||||
import java.io.File;
|
||||
@ -263,6 +260,22 @@ public class StoreProductController {
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏/足跡
|
||||
*/
|
||||
@AppLog(value = "删除足跡", type = 1)
|
||||
@NoRepeatSubmit
|
||||
@AuthCheck
|
||||
@DeleteMapping("/collect/delFoot")
|
||||
@ApiOperation(value = "删除足跡",notes = "删除足跡")
|
||||
public ApiResult<Boolean> collectDelFoot(@Validated @RequestBody CollectDelFootParam param){
|
||||
if (CollectionUtil.isEmpty(param.getIds())){
|
||||
throw new YshopException("参数非法");
|
||||
}
|
||||
productRelationService.collectDelFoot(param.getIds());
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取产品评论
|
||||
*/
|
||||
|
@ -0,0 +1,178 @@
|
||||
package co.yixiang.sales.rest;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import co.yixiang.api.ApiResult;
|
||||
import co.yixiang.api.YshopException;
|
||||
import co.yixiang.common.bean.LocalUser;
|
||||
import co.yixiang.common.interceptor.AuthCheck;
|
||||
import co.yixiang.logging.aop.log.AppLog;
|
||||
import co.yixiang.modules.order.domain.YxExpress;
|
||||
import co.yixiang.modules.order.service.YxExpressService;
|
||||
import co.yixiang.modules.order.service.dto.YxExpressQueryCriteria;
|
||||
import co.yixiang.modules.sales.param.StoreAfterSalesParam;
|
||||
import co.yixiang.modules.sales.service.StoreAfterSalesItemService;
|
||||
import co.yixiang.modules.sales.service.StoreAfterSalesService;
|
||||
import co.yixiang.modules.sales.service.StoreAfterSalesStatusService;
|
||||
import co.yixiang.modules.sales.service.vo.StoreAfterSalesVo;
|
||||
import co.yixiang.modules.sales.service.vo.YxStoreOrderCartInfoVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author : gzlv 2021/6/27 16:00
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
@Api(value = "售后记录", tags = "用户:售后记录")
|
||||
public class StoreAfterSalesController {
|
||||
|
||||
@Autowired
|
||||
private StoreAfterSalesService storeAfterSalesService;
|
||||
@Autowired
|
||||
private StoreAfterSalesItemService storeAfterSalesItemService;
|
||||
@Autowired
|
||||
private StoreAfterSalesStatusService storeAfterSalesStatusService;
|
||||
@Autowired
|
||||
private YxExpressService yxExpressService;
|
||||
|
||||
@AuthCheck
|
||||
@PostMapping("/applyForAfterSales")
|
||||
@ApiOperation(value = "申请售后", notes = "申请售后")
|
||||
public ApiResult<Boolean> applyForAfterSales(@RequestBody StoreAfterSalesParam storeAfterSalesParam) {
|
||||
storeAfterSalesService.applyForAfterSales(LocalUser.getUser().getUid(), LocalUser.getUser().getNickname(), storeAfterSalesParam);
|
||||
return ApiResult.ok();
|
||||
}
|
||||
|
||||
@AuthCheck
|
||||
@GetMapping("/applyForAfterSales/{key}")
|
||||
@ApiOperation(value = "查询订单详情", notes = "查询订单详情")
|
||||
public ApiResult<List<YxStoreOrderCartInfoVo>> checkOrderDetails(@PathVariable String key) {
|
||||
return ApiResult.ok(storeAfterSalesService.checkOrderDetails(key));
|
||||
}
|
||||
|
||||
@AppLog(value = "查看售后列表", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/storeAfterSales/list")
|
||||
@ApiOperation(value = "售后列表", notes = "售后列表")
|
||||
public ApiResult<Object> salesList(@RequestParam(value = "type", defaultValue = "0") int type,
|
||||
@RequestParam(value = "page", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int limit) {
|
||||
Map<String, Object> map = storeAfterSalesService.salesList(LocalUser.getUser().getUid(), type,
|
||||
page, null, limit);
|
||||
Long total = (Long) map.get("total");
|
||||
Long totalPage = (Long) map.get("totalPage");
|
||||
return ApiResult.resultPage(total.intValue(), totalPage.intValue(), map.get("list"));
|
||||
}
|
||||
|
||||
@AppLog(value = "查看售後详情", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/store/detail/{key}/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "订单详情", notes = "订单详情")
|
||||
public ApiResult<StoreAfterSalesVo> detail(@PathVariable String key, @PathVariable Long id) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
if (StrUtil.isEmpty(key)) {
|
||||
throw new YshopException("参数错误");
|
||||
}
|
||||
List<StoreAfterSalesVo> storeInfo = storeAfterSalesService.getStoreInfo(key, id, uid);
|
||||
if (storeInfo.size() < 1) {
|
||||
throw new YshopException("售后订单不存在");
|
||||
}
|
||||
storeAfterSalesService.handleSales(storeInfo.get(0));
|
||||
return ApiResult.ok(storeInfo.get(0));
|
||||
}
|
||||
|
||||
@AppLog(value = "通过订单号搜索", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/store/detail/{key}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "key", value = "唯一的key", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "订单详情", notes = "订单详情")
|
||||
public ApiResult<List<StoreAfterSalesVo>> detail(@PathVariable String key) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
if (StrUtil.isEmpty(key)) {
|
||||
throw new YshopException("参数错误");
|
||||
}
|
||||
List<StoreAfterSalesVo> storeInfo = storeAfterSalesService.getStoreInfo(key, null, uid);
|
||||
for (StoreAfterSalesVo storeAfterSalesVo : storeInfo) {
|
||||
storeAfterSalesService.handleSales(storeAfterSalesVo);
|
||||
}
|
||||
if (ObjectUtil.isNull(storeInfo)) {
|
||||
throw new YshopException("售后订单不存在");
|
||||
}
|
||||
return ApiResult.ok(storeInfo);
|
||||
}
|
||||
|
||||
@AppLog(value = "撤销申请", type = 1)
|
||||
@AuthCheck
|
||||
@GetMapping("/revoke/{key}/{id}")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "key", value = "订单号", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "撤销申请", notes = "撤销申请")
|
||||
public ApiResult<Boolean> revoke(@PathVariable String key, @PathVariable Long id) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
if (StrUtil.isEmpty(key)) {
|
||||
throw new YshopException("参数错误");
|
||||
}
|
||||
Boolean revoke = storeAfterSalesService.revoke(key, id, uid);
|
||||
return ApiResult.ok(revoke);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询快递")
|
||||
@GetMapping(value = "/yxExpress")
|
||||
public ApiResult<List<YxExpress>> getYxExpresss(YxExpressQueryCriteria criteria) {
|
||||
return ApiResult.ok(yxExpressService.queryAll(criteria));
|
||||
}
|
||||
|
||||
@AppLog(value = "添加物流信息", type = 1)
|
||||
@AuthCheck
|
||||
@PostMapping("/addLogisticsInformation")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "code", value = "快递公司编码", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "name", value = "快递公司名称", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "postalCode", value = "快递编号", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "orderCode", value = "订单编号", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "添加物流信息", notes = "添加物流信息")
|
||||
public ApiResult<Boolean> addLogisticsInformation(@RequestParam String code, @RequestParam String name, @RequestParam String postalCode, @RequestParam String orderCode) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
if (StrUtil.isEmpty(code) || StrUtil.isEmpty(name) || StrUtil.isEmpty(postalCode)) {
|
||||
throw new YshopException("参数错误");
|
||||
}
|
||||
Boolean revoke = storeAfterSalesService.addLogisticsInformation(code, name, postalCode, orderCode);
|
||||
return ApiResult.ok(revoke);
|
||||
}
|
||||
|
||||
@AppLog(value = "删除售后订单", type = 1)
|
||||
@AuthCheck
|
||||
@DeleteMapping("/deleteAfterSalesOrder")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "orderCode", value = "订单编码", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "删除售后订单", notes = "删除售后订单")
|
||||
public ApiResult<Boolean> deleteAfterSalesOrder(@RequestParam String orderCode, @RequestParam Long id) {
|
||||
Long uid = LocalUser.getUser().getUid();
|
||||
if (StrUtil.isEmpty(orderCode) || ObjectUtil.isEmpty(id)) {
|
||||
throw new YshopException("参数错误");
|
||||
}
|
||||
Boolean revoke = storeAfterSalesService.deleteAfterSalesOrder(orderCode, id);
|
||||
return ApiResult.ok(revoke);
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user