管理端 回显店铺信息
This commit is contained in:
@@ -6,7 +6,6 @@ import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.market.dto.MkPointsGoodsRecordDTO;
|
||||
import com.czg.market.dto.MkPointsGoodsRecordQueryDTO;
|
||||
import com.czg.market.service.MkPointsGoodsRecordService;
|
||||
import com.czg.market.service.MkPointsGoodsService;
|
||||
import com.czg.order.dto.PointGoodsRefundDTO;
|
||||
import com.czg.order.service.PointsGoodPayService;
|
||||
import com.czg.resp.CzgResult;
|
||||
@@ -29,8 +28,6 @@ public class PointsGoodsRecordController {
|
||||
@Resource
|
||||
private MkPointsGoodsRecordService goodsRecordService;
|
||||
@Resource
|
||||
private MkPointsGoodsService pointsGoodsService;
|
||||
@Resource
|
||||
private PointsGoodPayService goodPayService;
|
||||
|
||||
/**
|
||||
@@ -72,7 +69,7 @@ public class PointsGoodsRecordController {
|
||||
*/
|
||||
@PostMapping("/agreeRefund")
|
||||
public CzgResult<Boolean> agreeRefund(@RequestBody @Validated PointGoodsRefundDTO param) {
|
||||
return CzgResult.success(goodPayService.applyRefund(param, StpKit.USER.getShopId()));
|
||||
return CzgResult.success(goodPayService.agreeRefund(param, StpKit.USER.getShopId()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +77,7 @@ public class PointsGoodsRecordController {
|
||||
*/
|
||||
@PostMapping("/rejectRefund")
|
||||
public CzgResult<Boolean> rejectRefund(@RequestBody @Validated PointGoodsRefundDTO param) {
|
||||
return CzgResult.success(pointsGoodsService.cancelRefund(param, null, StpKit.USER.getShopId()));
|
||||
return CzgResult.success(goodPayService.cancelRefund(param, null, StpKit.USER.getShopId()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class UPointGoodsController {
|
||||
*/
|
||||
@PostMapping("/applyRefund")
|
||||
public CzgResult<Boolean> applyRefund(@RequestBody @Validated PointGoodsRefundDTO param) {
|
||||
return CzgResult.success(pointsGoodsService.applyRefund(param, StpKit.USER.getLoginIdAsLong()));
|
||||
return CzgResult.success(goodPayService.applyRefund(param, StpKit.USER.getLoginIdAsLong()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -76,7 +76,7 @@ public class UPointGoodsController {
|
||||
*/
|
||||
@PostMapping("/cancelRefund")
|
||||
public CzgResult<Boolean> cancelRefund(@RequestBody @Validated PointGoodsRefundDTO param) {
|
||||
return CzgResult.success(pointsGoodsService.cancelRefund(param, StpKit.USER.getLoginIdAsLong(), null));
|
||||
return CzgResult.success(goodPayService.cancelRefund(param, StpKit.USER.getLoginIdAsLong(), null));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class UPointGoodsController {
|
||||
@RequestParam(defaultValue = "10", required = false) int size,
|
||||
@RequestParam(required = false) String status,
|
||||
@RequestParam Long shopId) {
|
||||
Page<MkPointsGoodsRecord> pages = pointsGoodsService.getGoodsRecordPage(page, size, shopId, status, StpKit.USER.getLoginIdAsLong());
|
||||
Page<MkPointsGoodsRecord> pages = goodsRecordService.userGoodsRecordPage(page, size, shopId, status, StpKit.USER.getLoginIdAsLong());
|
||||
return CzgResult.success(pages);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,9 +15,21 @@ import com.czg.market.entity.MkPointsGoodsRecord;
|
||||
*/
|
||||
public interface MkPointsGoodsRecordService extends IService<MkPointsGoodsRecord> {
|
||||
|
||||
|
||||
/**
|
||||
* 积分兑换记录统计
|
||||
*/
|
||||
PointsExchangeSummaryVo total(MkPointsGoodsRecordQueryDTO param);
|
||||
|
||||
/**
|
||||
* 积分兑换记录列表 管理端
|
||||
*/
|
||||
Page<MkPointsGoodsRecordDTO> getGoodsRecordPage(MkPointsGoodsRecordQueryDTO param);
|
||||
|
||||
PointsExchangeSummaryVo total(MkPointsGoodsRecordQueryDTO param);
|
||||
/**
|
||||
* 积分兑换记录列表 用户端
|
||||
*/
|
||||
Page<MkPointsGoodsRecord> userGoodsRecordPage(Integer page, Integer size, Long shopId, String status, Long userId);
|
||||
|
||||
boolean checkout(String couponCode, Long shopId);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.czg.market.service;
|
||||
|
||||
import com.czg.BaseQueryParam;
|
||||
import com.czg.market.entity.MkPointsGoodsRecord;
|
||||
import com.czg.order.dto.PointGoodsRefundDTO;
|
||||
import com.czg.market.entity.MkPointsGoods;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.MkPointsGoods;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@@ -20,14 +18,6 @@ public interface MkPointsGoodsService extends IService<MkPointsGoods> {
|
||||
Page<MkPointsGoods> getPointsGoodsPage(BaseQueryParam param, Long shopId);
|
||||
|
||||
Map<String, Object> getPointsGoodsPageByUser(Integer page, Integer size, Long shopId, String goodsCategory, Long userId);
|
||||
|
||||
Page<MkPointsGoodsRecord> getGoodsRecordPage(Integer page, Integer size, Long shopId, String status, Long userId);
|
||||
|
||||
//用户申请退款
|
||||
boolean applyRefund(PointGoodsRefundDTO param, Long userId);
|
||||
|
||||
boolean cancelRefund(PointGoodsRefundDTO param, Long userId, Long shopId);
|
||||
|
||||
/**
|
||||
* 更新商品数量
|
||||
*
|
||||
|
||||
@@ -16,8 +16,14 @@ public interface PointsGoodPayService {
|
||||
//积分商品兑换
|
||||
CzgResult<Map<String, Object>> exchange(String ip, PointGoodsExchangeDTO param);
|
||||
|
||||
//用户申请退款
|
||||
boolean applyRefund(PointGoodsRefundDTO param, Long userId);
|
||||
|
||||
//取消退款
|
||||
boolean cancelRefund(PointGoodsRefundDTO param, Long userId, Long shopId);
|
||||
|
||||
//同意退款
|
||||
boolean applyRefund(PointGoodsRefundDTO param, Long shopId);
|
||||
boolean agreeRefund(PointGoodsRefundDTO param, Long shopId);
|
||||
|
||||
//支付回调 进行兑换内容发放
|
||||
void payCallBack(Long recordId, Long payOrderId);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.czg.service.market.service.impl;
|
||||
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
@@ -34,31 +34,6 @@ public class MkPointsGoodsRecordServiceImpl extends ServiceImpl<MkPointsGoodsRec
|
||||
@DubboReference
|
||||
private ShopUserService shopUserService;
|
||||
|
||||
@Override
|
||||
public Page<MkPointsGoodsRecordDTO> getGoodsRecordPage(MkPointsGoodsRecordQueryDTO param) {
|
||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(param.getShopId());
|
||||
Page<MkPointsGoodsRecordDTO> pages = pageAs(
|
||||
Page.of(param.getPage(), param.getSize())
|
||||
, query().eq(MkPointsGoodsRecord::getShopId, param.getShopId())
|
||||
.between(MkPointsGoodsRecord::getCreateTime, param.getStartTime(), param.getEndTime())
|
||||
.eq(MkPointsGoodsRecord::getShopUserId, param.getShopUserId())
|
||||
.eq(MkPointsGoodsRecord::getStatus, param.getStatus())
|
||||
.eq(MkPointsGoodsRecord::getIsDel, 0)
|
||||
.like(MkPointsGoodsRecord::getPointsGoodsName, param.getPointsGoodsName())
|
||||
.like(MkPointsGoodsRecord::getGoodsCategory, param.getGoodsCategory())
|
||||
.orderBy(MkPointsGoodsRecord::getCreateTime, false)
|
||||
, MkPointsGoodsRecordDTO.class);
|
||||
pages.getRecords().forEach(data -> {
|
||||
data.fillCouponInfo();
|
||||
ShopUser shopUser = shopUserService.getOne(query().eq(ShopUser::getId, data.getShopUserId()).eq(ShopUser::getMainShopId, mainIdByShopId));
|
||||
data.setHeadImg(shopUser.getHeadImg());
|
||||
data.setNickName(shopUser.getNickName());
|
||||
data.setPhone(shopUser.getPhone());
|
||||
});
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PointsExchangeSummaryVo total(MkPointsGoodsRecordQueryDTO param) {
|
||||
QueryWrapper queryWrapper = query().eq(MkPointsGoodsRecord::getShopId, param.getShopId())
|
||||
@@ -72,6 +47,64 @@ public class MkPointsGoodsRecordServiceImpl extends ServiceImpl<MkPointsGoodsRec
|
||||
return getOneAs(queryWrapper, PointsExchangeSummaryVo.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Page<MkPointsGoodsRecordDTO> getGoodsRecordPage(MkPointsGoodsRecordQueryDTO param) {
|
||||
Long mainIdByShopId = shopInfoService.getMainIdByShopId(param.getShopId());
|
||||
QueryWrapper queryWrapper = query().eq(MkPointsGoodsRecord::getShopId, param.getShopId())
|
||||
.between(MkPointsGoodsRecord::getCreateTime, param.getStartTime(), param.getEndTime())
|
||||
.eq(MkPointsGoodsRecord::getShopUserId, param.getShopUserId())
|
||||
.eq(MkPointsGoodsRecord::getIsDel, 0)
|
||||
.like(MkPointsGoodsRecord::getPointsGoodsName, param.getPointsGoodsName())
|
||||
.like(MkPointsGoodsRecord::getGoodsCategory, param.getGoodsCategory())
|
||||
.orderBy(MkPointsGoodsRecord::getCreateTime, false);
|
||||
|
||||
if (StrUtil.isNotBlank(param.getStatus())) {
|
||||
if ("售后".equals(param.getStatus())) {
|
||||
queryWrapper.and(wrapper -> {
|
||||
wrapper.eq(MkPointsGoodsRecord::getStatus, "退款中").or(MkPointsGoodsRecord::getStatus).eq("已退款");
|
||||
});
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getStatus, false);
|
||||
} else {
|
||||
queryWrapper.eq(MkPointsGoodsRecord::getStatus, param.getStatus());
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getStatus, false);
|
||||
}
|
||||
}
|
||||
Page<MkPointsGoodsRecordDTO> pages = pageAs(Page.of(param.getPage(), param.getSize()), queryWrapper, MkPointsGoodsRecordDTO.class);
|
||||
pages.getRecords().forEach(data -> {
|
||||
data.fillCouponInfo();
|
||||
ShopUser shopUser = shopUserService.getOne(query().eq(ShopUser::getId, data.getShopUserId()).eq(ShopUser::getMainShopId, mainIdByShopId));
|
||||
data.setHeadImg(shopUser.getHeadImg());
|
||||
data.setNickName(shopUser.getNickName());
|
||||
data.setPhone(shopUser.getPhone());
|
||||
});
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MkPointsGoodsRecord> userGoodsRecordPage(Integer page, Integer size, Long shopId, String status, Long userId) {
|
||||
QueryWrapper queryWrapper = query()
|
||||
.eq(MkPointsGoodsRecord::getUserId, userId)
|
||||
.eq(MkPointsGoodsRecord::getShopId, shopId)
|
||||
.eq(MkPointsGoodsRecord::getIsDel, 0);
|
||||
|
||||
if (StrUtil.isNotBlank(status)) {
|
||||
if ("售后".equals(status)) {
|
||||
queryWrapper.and(wrapper -> {
|
||||
wrapper.eq(MkPointsGoodsRecord::getStatus, "退款中").or(MkPointsGoodsRecord::getStatus).eq("已退款");
|
||||
});
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getStatus, false);
|
||||
} else {
|
||||
queryWrapper.eq(MkPointsGoodsRecord::getStatus, status);
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getStatus, false);
|
||||
}
|
||||
}
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getCreateTime, false);
|
||||
Page<MkPointsGoodsRecord> pages = page(Page.of(page, size), queryWrapper);
|
||||
pages.getRecords().forEach(MkPointsGoodsRecord::fillCouponInfo);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkout(String couponCode, Long shopId) {
|
||||
MkPointsGoodsRecord record = getOne(query().eq(MkPointsGoodsRecord::getCouponCode, couponCode).eq(MkPointsGoodsRecord::getShopId, shopId));
|
||||
|
||||
@@ -2,27 +2,21 @@ package com.czg.service.market.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.BaseQueryParam;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.market.entity.MkPointsGoods;
|
||||
import com.czg.market.entity.MkPointsGoodsRecord;
|
||||
import com.czg.market.entity.MkPointsUser;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
import com.czg.market.service.MkPointsGoodsRecordService;
|
||||
import com.czg.market.service.MkPointsGoodsService;
|
||||
import com.czg.market.service.MkPointsUserService;
|
||||
import com.czg.market.service.ShopCouponService;
|
||||
import com.czg.order.dto.PointGoodsRefundDTO;
|
||||
import com.czg.service.market.mapper.MkPointsGoodsMapper;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -35,9 +29,6 @@ import java.util.Map;
|
||||
*/
|
||||
@Service
|
||||
public class MkPointsGoodsServiceImpl extends ServiceImpl<MkPointsGoodsMapper, MkPointsGoods> implements MkPointsGoodsService {
|
||||
|
||||
@Resource
|
||||
private MkPointsGoodsRecordService goodsRecordService;
|
||||
@Resource
|
||||
private MkPointsUserService pointsUserService;
|
||||
@Resource
|
||||
@@ -84,70 +75,6 @@ public class MkPointsGoodsServiceImpl extends ServiceImpl<MkPointsGoodsMapper, M
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MkPointsGoodsRecord> getGoodsRecordPage(Integer page, Integer size, Long shopId, String status, Long userId) {
|
||||
QueryWrapper queryWrapper = query()
|
||||
.eq(MkPointsGoodsRecord::getUserId, userId)
|
||||
.eq(MkPointsGoodsRecord::getShopId, shopId)
|
||||
.eq(MkPointsGoodsRecord::getIsDel, 0);
|
||||
|
||||
if (StrUtil.isNotBlank(status)) {
|
||||
if ("售后".equals(status)) {
|
||||
queryWrapper.and(wrapper -> {
|
||||
wrapper.eq(MkPointsGoodsRecord::getStatus, "退款中").or(MkPointsGoodsRecord::getStatus).eq("已退款");
|
||||
});
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getStatus, false);
|
||||
} else {
|
||||
queryWrapper.eq(MkPointsGoodsRecord::getStatus, status);
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getStatus, false);
|
||||
}
|
||||
}
|
||||
queryWrapper.orderBy(MkPointsGoodsRecord::getCreateTime, false);
|
||||
Page<MkPointsGoodsRecord> pages = goodsRecordService.page(Page.of(page, size), queryWrapper);
|
||||
pages.getRecords().forEach(MkPointsGoodsRecord::fillCouponInfo);
|
||||
return pages;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyRefund(PointGoodsRefundDTO param, Long userId) {
|
||||
MkPointsGoodsRecord record = new MkPointsGoodsRecord();
|
||||
record.setStatus("退款中");
|
||||
record.setCancelOrRefundReason(param.getReason());
|
||||
record.setCancelOrRefundTime(LocalDateTime.now());
|
||||
|
||||
return goodsRecordService.update(record, query()
|
||||
.eq(MkPointsGoodsRecord::getId, param.getRecordId())
|
||||
.eq(MkPointsGoodsRecord::getOrderNo, param.getOrderNo())
|
||||
.eq(MkPointsGoodsRecord::getUserId, userId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelRefund(PointGoodsRefundDTO param, Long userId, Long shopId) {
|
||||
MkPointsGoodsRecord record1 = goodsRecordService.getById(param.getRecordId());
|
||||
if (record1 == null) {
|
||||
throw new CzgException("取消失败,订单不存在");
|
||||
}
|
||||
if (!"退款中".equals(record1.getStatus())) {
|
||||
throw new CzgException("取消失败,订单不处于退款中");
|
||||
}
|
||||
MkPointsGoodsRecord record = new MkPointsGoodsRecord();
|
||||
if (record1.getCheckoutTime() != null) {
|
||||
record.setStatus("已完成");
|
||||
} else {
|
||||
record.setStatus("待核销");
|
||||
}
|
||||
record.setCancelOrRefundReason(param.getReason());
|
||||
record.setCancelOrRefundTime(LocalDateTime.now());
|
||||
|
||||
return goodsRecordService.update(record, query()
|
||||
.eq(MkPointsGoodsRecord::getId, param.getRecordId())
|
||||
.eq(MkPointsGoodsRecord::getOrderNo, param.getOrderNo())
|
||||
.eq(MkPointsGoodsRecord::getUserId, userId)
|
||||
.eq(MkPointsGoodsRecord::getShopId, shopId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean upNumberById(Long id, Integer quantity, Integer totalExchangeCount) {
|
||||
MkPointsGoods goodUp = new MkPointsGoods();
|
||||
|
||||
@@ -123,7 +123,47 @@ public class PointsGoodPayServiceImpl implements PointsGoodPayService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applyRefund(PointGoodsRefundDTO param, Long shopId) {
|
||||
public boolean applyRefund(PointGoodsRefundDTO param, Long userId) {
|
||||
MkPointsGoodsRecord record = new MkPointsGoodsRecord();
|
||||
record.setStatus("退款中");
|
||||
record.setCancelOrRefundReason(param.getReason());
|
||||
record.setCancelOrRefundTime(LocalDateTime.now());
|
||||
|
||||
return goodsRecordService.update(record, QueryWrapper.create()
|
||||
.eq(MkPointsGoodsRecord::getId, param.getRecordId())
|
||||
.eq(MkPointsGoodsRecord::getOrderNo, param.getOrderNo())
|
||||
.eq(MkPointsGoodsRecord::getUserId, userId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cancelRefund(PointGoodsRefundDTO param, Long userId, Long shopId) {
|
||||
MkPointsGoodsRecord record1 = goodsRecordService.getById(param.getRecordId());
|
||||
if (record1 == null) {
|
||||
throw new CzgException("取消失败,订单不存在");
|
||||
}
|
||||
if (!"退款中".equals(record1.getStatus())) {
|
||||
throw new CzgException("取消失败,订单不处于退款中");
|
||||
}
|
||||
MkPointsGoodsRecord record = new MkPointsGoodsRecord();
|
||||
if (record1.getCheckoutTime() != null) {
|
||||
record.setStatus("已完成");
|
||||
} else {
|
||||
record.setStatus("待核销");
|
||||
}
|
||||
record.setCancelOrRefundReason(param.getReason());
|
||||
record.setCancelOrRefundTime(LocalDateTime.now());
|
||||
|
||||
return goodsRecordService.update(record, QueryWrapper.create()
|
||||
.eq(MkPointsGoodsRecord::getId, param.getRecordId())
|
||||
.eq(MkPointsGoodsRecord::getOrderNo, param.getOrderNo())
|
||||
.eq(MkPointsGoodsRecord::getUserId, userId)
|
||||
.eq(MkPointsGoodsRecord::getShopId, shopId)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean agreeRefund(PointGoodsRefundDTO param, Long shopId) {
|
||||
MkPointsGoodsRecord record = goodsRecordService.getOne(QueryWrapper.create()
|
||||
.eq(MkPointsGoodsRecord::getId, param.getRecordId())
|
||||
.eq(MkPointsGoodsRecord::getShopId, shopId));
|
||||
|
||||
Reference in New Issue
Block a user