Compare commits
61 Commits
7d640b4f9c
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
| a53911aaa5 | |||
| 746c5c83da | |||
| 625df4c353 | |||
| 9784695482 | |||
| 257977a000 | |||
| 624abd31b4 | |||
| 7b9dcafc53 | |||
| 04d75589a8 | |||
| bb76930920 | |||
| 8ae847d458 | |||
| bb7ca6d05b | |||
| ee78543ab8 | |||
| 4deba098ce | |||
| 9da67fc67f | |||
|
|
65f6978612 | ||
|
|
ad24a91a28 | ||
| ec1bc6a156 | |||
| c9a432b786 | |||
| 0ebe2b1787 | |||
| 9a62fcaddf | |||
| d58b4d9aed | |||
| 8dc7f3e8f1 | |||
| ab955c6b8a | |||
| 76567aef53 | |||
| 36ab1ae3c2 | |||
| d9143f9b82 | |||
| 9c5b8ea53f | |||
|
|
77334e3e73 | ||
|
|
c9e154299b | ||
|
|
0d4b1ace60 | ||
| a74e099346 | |||
| d6d6477c6d | |||
| e3f58e41ca | |||
| c04a5b8fb1 | |||
| ccc18fc229 | |||
|
|
f92a593ff8 | ||
| 4a6af60352 | |||
| f32212928a | |||
|
|
c974f9e092 | ||
|
|
496c931678 | ||
| 73929aaac5 | |||
| 6238260b3b | |||
| bac24f9ba1 | |||
| 6c41777b7c | |||
| 87e89721d8 | |||
| 2b594193ee | |||
|
|
d71819bd08 | ||
|
|
fcd70b24a8 | ||
|
|
2d15315b79 | ||
| abcd0fbc7b | |||
| fc8599d36c | |||
| 66d3c8ad0b | |||
| abdbe89082 | |||
| e3887148c1 | |||
|
|
c984867e4e | ||
|
|
9e2cf024eb | ||
| 25b9a5b389 | |||
| 6cd6ac74ea | |||
| ae67fb6f8e | |||
| 52e8a209fb | |||
| f2024d5be5 |
@@ -8,10 +8,11 @@ import com.czg.account.vo.HandoverProductListVo;
|
|||||||
import com.czg.account.vo.HandoverTotalVo;
|
import com.czg.account.vo.HandoverTotalVo;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.constants.SystemConstants;
|
import com.czg.constants.SystemConstants;
|
||||||
|
import com.czg.excel.ExcelExportUtil;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -62,12 +63,12 @@ public class HandoverRecordController {
|
|||||||
*
|
*
|
||||||
* @param id 交班记录ID
|
* @param id 交班记录ID
|
||||||
*/
|
*/
|
||||||
@ResponseExcel(name = "交班售出商品明细")
|
|
||||||
@GetMapping("/export/{id}")
|
@GetMapping("/export/{id}")
|
||||||
@OperationLog("交班记录-导出")
|
@OperationLog("交班记录-导出")
|
||||||
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:export", name = "交班记录-导出")
|
@SaAdminCheckPermission(parentName = "交班记录", value = "handoverRecord:export", name = "交班记录-导出")
|
||||||
public List<HandoverProductListVo> export(@PathVariable Long id) {
|
public void export(@PathVariable Long id, HttpServletResponse response) {
|
||||||
return handoverRecordService.getHandoverProductListById(id);
|
List<HandoverProductListVo> list = handoverRecordService.getHandoverProductListById(id);
|
||||||
|
ExcelExportUtil.exportToResponse(list, HandoverProductListVo.class, "交班售出商品明细", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ public class ShopInfoController {
|
|||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
@SaAdminCheckPermission(parentName = "店铺管理接口", value = "shopInfo:list", name = "店铺列表")
|
@SaAdminCheckPermission(parentName = "店铺管理接口", value = "shopInfo:list", name = "店铺列表")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop) {
|
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop) {
|
||||||
return CzgResult.success(shopInfoService.get(pageDTO, shopName, status, isHeadShop));
|
return CzgResult.success(shopInfoService.get(pageDTO, profiles, phone, shopName, status, isHeadShop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -97,6 +97,17 @@ public class ShopUserController {
|
|||||||
return CzgResult.success(shopUserService.getPage(key, isVip, amount));
|
return CzgResult.success(shopUserService.getPage(key, isVip, amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出用户列表
|
||||||
|
*
|
||||||
|
* @param key 昵称或手机号
|
||||||
|
* @param isVip 0 非vip 1 vip
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
public void exportUserList(String key, Integer isVip, HttpServletResponse response) {
|
||||||
|
shopUserService.exportUserList(key, isVip, response);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/getPage")
|
@GetMapping("/getPage")
|
||||||
public CzgResult<Page<ShopUser>> getPage(@RequestParam(required = false)String key,@RequestParam(required = false) Integer isVip) {
|
public CzgResult<Page<ShopUser>> getPage(@RequestParam(required = false)String key,@RequestParam(required = false) Integer isVip) {
|
||||||
return CzgResult.success(shopUserService.getPage(key, isVip));
|
return CzgResult.success(shopUserService.getPage(key, isVip));
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.market.dto.MkCarouselDTO;
|
||||||
|
import com.czg.market.entity.MkCarousel;
|
||||||
|
import com.czg.market.service.MkCarouselService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/carousel")
|
||||||
|
public class ACarouselController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MkCarouselService mkCarouselService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:config", name = "轮播图-列表")
|
||||||
|
public CzgResult<List<MkCarousel>> getCarousels(MkCarouselDTO carouselDTO) {
|
||||||
|
carouselDTO.setShopId(StpKit.USER.getShopId());
|
||||||
|
return CzgResult.success(mkCarouselService.getCarousels(carouselDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置:新增/修改
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:up", name = "轮播图-新增/修改")
|
||||||
|
public CzgResult<Boolean> editCarousel(@RequestBody @Validated MkCarousel carousel) {
|
||||||
|
carousel.setShopId(StpKit.USER.getShopId());
|
||||||
|
if (carousel.getId() == null) {
|
||||||
|
return CzgResult.success(mkCarouselService.save(carousel));
|
||||||
|
} else {
|
||||||
|
return CzgResult.success(mkCarouselService.updateById(carousel, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置:删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
@SaAdminCheckPermission(parentName = "轮播图配置", value = "carousel:up", name = "轮播图-新增/修改")
|
||||||
|
public CzgResult<Boolean> deleteCarousel(@PathVariable("id") Long id) {
|
||||||
|
return CzgResult.success(mkCarouselService.remove(QueryWrapper.create().eq(MkCarousel::getId, id).eq(MkCarousel::getShopId, StpKit.USER.getShopId())));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.market.entity.MkDistributionGroup;
|
||||||
|
import com.czg.market.service.MkDistributionGroupService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东群聊
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/disGroup")
|
||||||
|
public class ADisGroupController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MkDistributionGroupService mkDistributionGroupService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东群聊
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
@SaAdminCheckPermission(parentName = "全民股东群聊", value = "share:config", name = "全民股东群聊-配置")
|
||||||
|
public CzgResult<MkDistributionGroup> getShareBase() {
|
||||||
|
return CzgResult.success(mkDistributionGroupService.getById(StpKit.USER.getShopId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东群聊:新增/修改
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
@SaAdminCheckPermission(parentName = "全民股东群聊", value = "share:up", name = "全民股东群聊-新增/修改")
|
||||||
|
public CzgResult<Boolean> editShareBase(@RequestBody MkDistributionGroup group) {
|
||||||
|
group.setShopId(StpKit.USER.getShopId());
|
||||||
|
MkDistributionGroup share = mkDistributionGroupService.getById(group.getShopId());
|
||||||
|
if (share == null) {
|
||||||
|
return CzgResult.success(mkDistributionGroupService.save(group));
|
||||||
|
} else {
|
||||||
|
return CzgResult.success(mkDistributionGroupService.updateById(group));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.market.entity.MkShareBase;
|
||||||
|
import com.czg.market.service.MkShareBaseService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/shareBase")
|
||||||
|
public class AShareBaseController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MkShareBaseService mkShareBaseService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础
|
||||||
|
*/
|
||||||
|
@GetMapping
|
||||||
|
@SaAdminCheckPermission(parentName = "分享奖励基础", value = "share:config", name = "分享-配置")
|
||||||
|
public CzgResult<MkShareBase> getShareBase() {
|
||||||
|
return CzgResult.success(mkShareBaseService.getShareBase(StpKit.USER.getShopId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础:新增/修改
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
@SaAdminCheckPermission(parentName = "分享奖励基础", value = "share:up", name = "分享-新增/修改")
|
||||||
|
public CzgResult<Boolean> editShareBase(@RequestBody MkShareBase shareBase) {
|
||||||
|
shareBase.setShopId(StpKit.USER.getShopId());
|
||||||
|
MkShareBase share = mkShareBaseService.getById(shareBase.getShopId());
|
||||||
|
if (share == null) {
|
||||||
|
return CzgResult.success(mkShareBaseService.save(shareBase));
|
||||||
|
} else {
|
||||||
|
shareBase.setCreateTime(share.getCreateTime());
|
||||||
|
return CzgResult.success(mkShareBaseService.updateById(shareBase, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.annotation.Debounce;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.market.dto.MkDistributionUserDTO;
|
import com.czg.market.dto.MkDistributionUserDTO;
|
||||||
@@ -57,6 +58,7 @@ public class DistributionUserController {
|
|||||||
*
|
*
|
||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
|
@Debounce
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@OperationLog("分销员-添加")
|
@OperationLog("分销员-添加")
|
||||||
@SaAdminCheckPermission(parentName = "分销相关",value = "distribution:user:add", name = "分销员添加")
|
@SaAdminCheckPermission(parentName = "分销相关",value = "distribution:user:add", name = "分销员添加")
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.czg.controller.user;
|
||||||
|
|
||||||
|
import com.czg.market.dto.MkCarouselDTO;
|
||||||
|
import com.czg.market.entity.MkCarousel;
|
||||||
|
import com.czg.market.entity.MkShareBase;
|
||||||
|
import com.czg.market.service.MkCarouselService;
|
||||||
|
import com.czg.market.service.MkShareBaseService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user")
|
||||||
|
public class UCarouselController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MkCarouselService mkCarouselService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MkShareBaseService mkShareBaseService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/carousel")
|
||||||
|
public CzgResult<List<MkCarousel>> getCarousels(MkCarouselDTO carouselDTO) {
|
||||||
|
carouselDTO.setShopId(StpKit.USER.getShopId());
|
||||||
|
carouselDTO.setIsEnabled(1);
|
||||||
|
return CzgResult.success(mkCarouselService.getCarousels(carouselDTO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享 领取触发
|
||||||
|
*
|
||||||
|
* @param tagType
|
||||||
|
* @param shopId
|
||||||
|
* @param fromUserId 分享人的shopUserId
|
||||||
|
* @param toUserId 被分享人的shopUserId
|
||||||
|
*/
|
||||||
|
public record ShareClaim(String tagType, Long shopId, Long fromUserId, Long toUserId) {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享 基础配置
|
||||||
|
*/
|
||||||
|
@GetMapping("/share")
|
||||||
|
public CzgResult<MkShareBase> share(@RequestParam Long shopId) {
|
||||||
|
return CzgResult.success(mkShareBaseService.getShareBase(shopId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享 领取触发
|
||||||
|
* 会绑定上下级关系
|
||||||
|
*/
|
||||||
|
@PostMapping("/shareClaim")
|
||||||
|
public CzgResult<Void> shareClaim(@RequestBody ShareClaim shareClaim) {
|
||||||
|
mkShareBaseService.shareClaim(shareClaim.tagType, shareClaim.shopId, shareClaim.fromUserId, shareClaim.toUserId);
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.czg.controller.user;
|
|||||||
import com.czg.account.entity.UserInfo;
|
import com.czg.account.entity.UserInfo;
|
||||||
import com.czg.market.dto.MkDistributionUserDTO;
|
import com.czg.market.dto.MkDistributionUserDTO;
|
||||||
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
|
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
|
||||||
|
import com.czg.market.entity.MkDistributionUser;
|
||||||
import com.czg.market.entity.MkDistributionWithdrawFlow;
|
import com.czg.market.entity.MkDistributionWithdrawFlow;
|
||||||
import com.czg.market.service.MkDistributionConfigService;
|
import com.czg.market.service.MkDistributionConfigService;
|
||||||
import com.czg.market.service.MkDistributionFlowService;
|
import com.czg.market.service.MkDistributionFlowService;
|
||||||
@@ -16,17 +17,16 @@ import com.czg.sa.StpKit;
|
|||||||
import com.czg.task.DistributionTask;
|
import com.czg.task.DistributionTask;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import io.seata.core.exception.TransactionException;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.core.NestedExceptionUtils;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销相关
|
* 全民股东相关
|
||||||
*
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +60,7 @@ public class UDistributionController {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-获取配置
|
* 全民股东=-获取配置
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getConfig")
|
@GetMapping("/getConfig")
|
||||||
public CzgResult<MkDistributionConfigVO> getConfig(@RequestParam Long shopId) {
|
public CzgResult<MkDistributionConfigVO> getConfig(@RequestParam Long shopId) {
|
||||||
@@ -68,7 +68,7 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-首页
|
* 全民股东-首页
|
||||||
*/
|
*/
|
||||||
@PostMapping("/centerUser")
|
@PostMapping("/centerUser")
|
||||||
public CzgResult<Map<String, Object>> centerUser() {
|
public CzgResult<Map<String, Object>> centerUser() {
|
||||||
@@ -76,7 +76,7 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-已开通的店铺
|
* 全民股东界-已开通的店铺
|
||||||
*/
|
*/
|
||||||
@GetMapping("/centerUser/activates")
|
@GetMapping("/centerUser/activates")
|
||||||
public CzgResult<Page<DistributionCenterShopVO>> activates(@RequestParam(required = false, defaultValue = "1") Integer page, @RequestParam(required = false, defaultValue = "10") Integer size) {
|
public CzgResult<Page<DistributionCenterShopVO>> activates(@RequestParam(required = false, defaultValue = "1") Integer page, @RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||||
@@ -84,7 +84,7 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-未开通的店铺
|
* 全民股东-未开通的店铺
|
||||||
*/
|
*/
|
||||||
@GetMapping("/centerUser/unActivates")
|
@GetMapping("/centerUser/unActivates")
|
||||||
public CzgResult<Page<DistributionCenterShopVO>> unActivates(@RequestParam(required = false, defaultValue = "1") Integer page, @RequestParam(required = false, defaultValue = "10") Integer size) {
|
public CzgResult<Page<DistributionCenterShopVO>> unActivates(@RequestParam(required = false, defaultValue = "1") Integer page, @RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||||
@@ -92,7 +92,7 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-配置信息
|
* 全民股东-配置信息
|
||||||
*/
|
*/
|
||||||
@GetMapping("/centerConfig")
|
@GetMapping("/centerConfig")
|
||||||
public CzgResult<Map<String, Object>> centerConfig(@RequestParam Long shopId) {
|
public CzgResult<Map<String, Object>> centerConfig(@RequestParam Long shopId) {
|
||||||
@@ -100,29 +100,27 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-获取邀请码
|
* 全民股东界面-进入过标识
|
||||||
|
*/
|
||||||
|
@GetMapping("/editIn")
|
||||||
|
public CzgResult<Boolean> editIn(@RequestParam Long shopUserId) {
|
||||||
|
MkDistributionUser distributionUser = new MkDistributionUser();
|
||||||
|
distributionUser.setFirstIn(1);
|
||||||
|
distributionUserService.update(distributionUser, QueryWrapper.create().eq(MkDistributionUser::getId, shopUserId));
|
||||||
|
return CzgResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东-获取邀请码
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getInviteCode")
|
@GetMapping("/getInviteCode")
|
||||||
public CzgResult<String> getInviteCode(@RequestParam Long shopId, @RequestParam Long shopUserId) {
|
public CzgResult<String> getInviteCode(@RequestParam Long shopId, @RequestParam Long shopUserId) {
|
||||||
return CzgResult.success(distributionUserService.getInviteCode(shopId, shopUserId));
|
return CzgResult.success(distributionUserService.getInviteCode(shopId, shopUserId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 分销员中心-获取邀请码
|
|
||||||
*/
|
|
||||||
@GetMapping("/autoGetInviteCode")
|
|
||||||
public CzgResult<String> autoGetInviteCode(@RequestParam Long shopId, @RequestParam Long shopUserId) {
|
|
||||||
try {
|
|
||||||
return CzgResult.success(distributionUserService.getInviteCode(shopId, shopUserId));
|
|
||||||
} catch (Exception e) {
|
|
||||||
String rootMsg = NestedExceptionUtils.getMostSpecificCause(e).getMessage();
|
|
||||||
log.error("获取邀请码失败用户:{},:{}", shopUserId, rootMsg);
|
|
||||||
return CzgResult.success("");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-实名认证
|
* 全民股东-实名认证
|
||||||
*/
|
*/
|
||||||
@PostMapping("/realNameAuth")
|
@PostMapping("/realNameAuth")
|
||||||
public CzgResult<Map<String, Object>> realNameAuth(@RequestBody UserInfo userInfo) {
|
public CzgResult<Map<String, Object>> realNameAuth(@RequestBody UserInfo userInfo) {
|
||||||
@@ -134,21 +132,7 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-无感-绑定邀请人
|
* 全民股东-绑定邀请人
|
||||||
*/
|
|
||||||
@PostMapping("/autoBindInviteUser")
|
|
||||||
public CzgResult<Map<String, Object>> autoBindInviteUser(@RequestBody MkDistributionUserDTO param) throws TransactionException {
|
|
||||||
try {
|
|
||||||
bindInviteUser(param);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("无感绑定邀请人失败:{}", param, e);
|
|
||||||
}
|
|
||||||
return CzgResult.success();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 分销员中心-绑定邀请人
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/bindInviteUser")
|
@PostMapping("/bindInviteUser")
|
||||||
public CzgResult<Map<String, Object>> bindInviteUser(@RequestBody MkDistributionUserDTO param) {
|
public CzgResult<Map<String, Object>> bindInviteUser(@RequestBody MkDistributionUserDTO param) {
|
||||||
@@ -160,7 +144,7 @@ public class UDistributionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员:获取邀请人分页列表
|
* 全民股东:获取邀请人分页列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/inviteUser")
|
@GetMapping("/inviteUser")
|
||||||
public CzgResult<Page<InviteUserVO>> getInviteUser(
|
public CzgResult<Page<InviteUserVO>> getInviteUser(
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.order.dto.FinanceStsDTO;
|
||||||
|
import com.czg.order.param.FinanceStsQueryParam;
|
||||||
|
import com.czg.order.service.FinanceStsService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理端/财务报表
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/finance")
|
||||||
|
public class FinanceStsController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FinanceStsService financeStsService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询财务报表
|
||||||
|
*/
|
||||||
|
@GetMapping("/sts")
|
||||||
|
public CzgResult<FinanceStsDTO> getFinanceSts(@Validated(FinanceStsQueryParam.Query.class) FinanceStsQueryParam param) {
|
||||||
|
return CzgResult.success(financeStsService.getFinanceSts(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出财务报表
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
public void exportFinanceSts(@Validated(FinanceStsQueryParam.Export.class) FinanceStsQueryParam param, HttpServletResponse response) {
|
||||||
|
financeStsService.exportFinanceSts(param, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.excel.ExcelExportUtil;
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.order.entity.ShopProdStatistic;
|
import com.czg.order.entity.ShopProdStatistic;
|
||||||
import com.czg.order.param.SaleSummaryCountParam;
|
import com.czg.order.param.SaleSummaryCountParam;
|
||||||
@@ -7,8 +8,8 @@ import com.czg.order.service.ShopProdStatisticService;
|
|||||||
import com.czg.order.vo.SaleSummaryCountVo;
|
import com.czg.order.vo.SaleSummaryCountVo;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -59,13 +60,12 @@ public class SaleSummaryController {
|
|||||||
return CzgResult.success(list);
|
return CzgResult.success(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseExcel(name = "销售统计明细")
|
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
public List<ShopProdStatistic> summaryExport(SaleSummaryCountParam param) {
|
public void summaryExport(SaleSummaryCountParam param, HttpServletResponse response) {
|
||||||
if (param.getShopId() == null) {
|
if (param.getShopId() == null) {
|
||||||
param.setShopId(StpKit.USER.getShopId());
|
param.setShopId(StpKit.USER.getShopId());
|
||||||
}
|
}
|
||||||
return prodStatisticService.getArchiveTradeData(param);
|
ExcelExportUtil.exportToResponse(prodStatisticService.getArchiveTradeData(param), ShopProdStatistic.class, "销售统计明细", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
import com.czg.handel.ExcelMergeHandler;
|
|
||||||
import com.czg.handel.TableRefundCellHandel;
|
|
||||||
import com.czg.log.annotation.OperationLog;
|
import com.czg.log.annotation.OperationLog;
|
||||||
import com.czg.order.entity.ShopTableOrderStatistic;
|
import com.czg.order.entity.ShopTableOrderStatistic;
|
||||||
import com.czg.order.param.DataSummaryTradeParam;
|
import com.czg.order.param.DataSummaryTradeParam;
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.service.ShopTableOrderStatisticService;
|
import com.czg.order.service.ShopTableOrderStatisticService;
|
||||||
import com.czg.order.service.TableSummaryService;
|
import com.czg.order.service.TableSummaryService;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -54,15 +51,14 @@ public class TableSummaryController {
|
|||||||
/**
|
/**
|
||||||
* 导出
|
* 导出
|
||||||
*/
|
*/
|
||||||
@ResponseExcel(name = "台桌统计", writeHandler = {ExcelMergeHandler.class, TableRefundCellHandel.class})
|
|
||||||
@GetMapping("export")
|
@GetMapping("export")
|
||||||
@OperationLog("导出")
|
@OperationLog("导出")
|
||||||
//@SaAdminCheckPermission("tableSummary:export")
|
//@SaAdminCheckPermission("tableSummary:export")
|
||||||
public List<TableSummaryExportVo> summaryExport(TableSummaryParam param) {
|
public void summaryExport(TableSummaryParam param, HttpServletResponse response) {
|
||||||
if (param.getShopId() == null) {
|
if (param.getShopId() == null) {
|
||||||
param.setShopId(StpKit.USER.getShopId());
|
param.setShopId(StpKit.USER.getShopId());
|
||||||
}
|
}
|
||||||
return tableSummaryService.summaryExportList(param);
|
tableSummaryService.summaryExportList(param, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import com.mybatisflex.core.query.QueryWrapper;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -44,6 +45,8 @@ public class OrderPayController {
|
|||||||
private OrderInfoService orderInfoService;
|
private OrderInfoService orderInfoService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private SysParamsService paramsService;
|
private SysParamsService paramsService;
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String env;
|
||||||
|
|
||||||
@PostMapping("/creditPay")
|
@PostMapping("/creditPay")
|
||||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||||
@@ -123,18 +126,18 @@ public class OrderPayController {
|
|||||||
return orderPayService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
return orderPayService.ltPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 正扫
|
// * 正扫
|
||||||
*/
|
// */
|
||||||
@PostMapping("/scanPay")
|
// @PostMapping("/scanPay")
|
||||||
@Debounce(value = "#payParam.checkOrderPay.orderId")
|
// @Debounce(value = "#payParam.checkOrderPay.orderId")
|
||||||
public CzgResult<Map<String, Object>> scanPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
// public CzgResult<Map<String, Object>> scanPayOrder(@RequestHeader Long shopId, HttpServletRequest request, @Validated @RequestBody OrderPayParamDTO payParam) {
|
||||||
payParam.setShopId(shopId);
|
// payParam.setShopId(shopId);
|
||||||
return orderPayService.scanPayOrder(ServletUtil.getClientIP(request), payParam);
|
// return orderPayService.scanPayOrder(ServletUtil.getClientIP(request), payParam);
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 反扫
|
* 扫码收款
|
||||||
* authCode 必填 扫描码
|
* authCode 必填 扫描码
|
||||||
*/
|
*/
|
||||||
@PostMapping("/microPay")
|
@PostMapping("/microPay")
|
||||||
@@ -154,6 +157,7 @@ public class OrderPayController {
|
|||||||
AssertUtil.isNull(shopId, "店铺id不能为空");
|
AssertUtil.isNull(shopId, "店铺id不能为空");
|
||||||
AssertUtil.isNull(checkOrderPay, "订单信息不能为空");
|
AssertUtil.isNull(checkOrderPay, "订单信息不能为空");
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("env", env);
|
||||||
map.put("shopId", shopId);
|
map.put("shopId", shopId);
|
||||||
map.put("orderId", checkOrderPay.getOrderId());
|
map.put("orderId", checkOrderPay.getOrderId());
|
||||||
map.put("payAmount", checkOrderPay.getOrderAmount());
|
map.put("payAmount", checkOrderPay.getOrderAmount());
|
||||||
|
|||||||
@@ -1,151 +0,0 @@
|
|||||||
package com.czg.handel;
|
|
||||||
|
|
||||||
import cn.idev.excel.metadata.Head;
|
|
||||||
import cn.idev.excel.metadata.data.WriteCellData;
|
|
||||||
import cn.idev.excel.write.handler.CellWriteHandler;
|
|
||||||
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
|
|
||||||
import cn.idev.excel.write.metadata.holder.WriteTableHolder;
|
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2025-04-01 18:41
|
|
||||||
*/
|
|
||||||
public class ExcelMergeHandler implements CellWriteHandler {
|
|
||||||
// 要合并的列索引数组
|
|
||||||
private int[] mergeColumnIndex = {0, 1, 2, 3, 8, 9};
|
|
||||||
// 合并开始的行索引
|
|
||||||
private int mergeRowIndex = 1;
|
|
||||||
|
|
||||||
public ExcelMergeHandler() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构造函数
|
|
||||||
*
|
|
||||||
* @param mergeRowIndex 合并开始的行索引
|
|
||||||
* @param mergeColumnIndex 要合并的列索引数组
|
|
||||||
*/
|
|
||||||
public ExcelMergeHandler(int mergeRowIndex, int[] mergeColumnIndex) {
|
|
||||||
this.mergeRowIndex = mergeRowIndex;
|
|
||||||
this.mergeColumnIndex = mergeColumnIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
|
||||||
// 当前行索引
|
|
||||||
int curRowIndex = cell.getRowIndex();
|
|
||||||
// 当前列索引
|
|
||||||
int curColIndex = cell.getColumnIndex();
|
|
||||||
|
|
||||||
// 如果当前行大于合并开始行且当前列在需要合并的列中
|
|
||||||
if (curRowIndex > mergeRowIndex && isMergeColumn(curColIndex)) {
|
|
||||||
// 进行合并操作
|
|
||||||
mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查当前列是否在需要合并的列中
|
|
||||||
*
|
|
||||||
* @param curColIndex 当前列索引
|
|
||||||
* @return 如果是需要合并的列返回true,否则返回false
|
|
||||||
*/
|
|
||||||
private boolean isMergeColumn(int curColIndex) {
|
|
||||||
for (int columnIndex : mergeColumnIndex) {
|
|
||||||
if (curColIndex == columnIndex) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前单元格向上合并
|
|
||||||
*
|
|
||||||
* @param writeSheetHolder 当前工作表持有者
|
|
||||||
* @param cell 当前单元格
|
|
||||||
* @param curRowIndex 当前行索引
|
|
||||||
* @param curColIndex 当前列索引
|
|
||||||
*/
|
|
||||||
private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) {
|
|
||||||
// 获取当前单元格的数据
|
|
||||||
Object curData = getCellData(cell);
|
|
||||||
// 获取前一个单元格的数据
|
|
||||||
Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex);
|
|
||||||
Object preData = getCellData(preCell);
|
|
||||||
|
|
||||||
// 判断当前单元格和前一个单元格的数据以及主键是否相同
|
|
||||||
if (curData.equals(preData) && isSamePrimaryKey(cell, curRowIndex)) {
|
|
||||||
// 获取工作表
|
|
||||||
Sheet sheet = writeSheetHolder.getSheet();
|
|
||||||
// 合并单元格
|
|
||||||
mergeCells(sheet, curRowIndex, curColIndex);
|
|
||||||
CellStyle style = preCell.getCellStyle();
|
|
||||||
// 设置水平居中
|
|
||||||
style.setAlignment(HorizontalAlignment.CENTER);
|
|
||||||
// 设置垂直居中
|
|
||||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
||||||
preCell.setCellStyle(style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取单元格的数据
|
|
||||||
*
|
|
||||||
* @param cell 单元格
|
|
||||||
* @return 单元格数据
|
|
||||||
*/
|
|
||||||
private Object getCellData(Cell cell) {
|
|
||||||
return cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 判断当前单元格和前一个单元格的主键是否相同
|
|
||||||
*
|
|
||||||
* @param cell 当前单元格
|
|
||||||
* @param curRowIndex 当前行索引
|
|
||||||
* @return 如果主键相同返回true,否则返回false
|
|
||||||
*/
|
|
||||||
private boolean isSamePrimaryKey(Cell cell, int curRowIndex) {
|
|
||||||
String currentPrimaryKey = cell.getRow().getCell(0).getStringCellValue();
|
|
||||||
String previousPrimaryKey = cell.getSheet().getRow(curRowIndex - 1).getCell(0).getStringCellValue();
|
|
||||||
return currentPrimaryKey.equals(previousPrimaryKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 合并单元格
|
|
||||||
*
|
|
||||||
* @param sheet 工作表
|
|
||||||
* @param curRowIndex 当前行索引
|
|
||||||
* @param curColIndex 当前列索引
|
|
||||||
*/
|
|
||||||
private void mergeCells(Sheet sheet, int curRowIndex, int curColIndex) {
|
|
||||||
// 获取已合并的区域
|
|
||||||
List<CellRangeAddress> mergeRegions = sheet.getMergedRegions();
|
|
||||||
boolean isMerged = false;
|
|
||||||
|
|
||||||
// 检查前一个单元格是否已经被合并
|
|
||||||
for (int i = 0; i < mergeRegions.size() && !isMerged; i++) {
|
|
||||||
CellRangeAddress cellRangeAddr = mergeRegions.get(i);
|
|
||||||
if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) {
|
|
||||||
sheet.removeMergedRegion(i);
|
|
||||||
cellRangeAddr.setLastRow(curRowIndex);
|
|
||||||
sheet.addMergedRegion(cellRangeAddr);
|
|
||||||
isMerged = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果前一个单元格未被合并,则新增合并区域
|
|
||||||
if (!isMerged) {
|
|
||||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex);
|
|
||||||
sheet.addMergedRegion(cellRangeAddress);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
package com.czg.handel;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
|
||||||
import cn.idev.excel.metadata.Head;
|
|
||||||
import cn.idev.excel.metadata.data.WriteCellData;
|
|
||||||
import cn.idev.excel.write.handler.CellWriteHandler;
|
|
||||||
import cn.idev.excel.write.metadata.holder.WriteSheetHolder;
|
|
||||||
import cn.idev.excel.write.metadata.holder.WriteTableHolder;
|
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 台桌统计退单单元格处理器
|
|
||||||
*
|
|
||||||
* @author tankaikai
|
|
||||||
* @since 2025-04-02 09:50
|
|
||||||
*/
|
|
||||||
public class TableRefundCellHandel implements CellWriteHandler {
|
|
||||||
// 要处理的列索引数组
|
|
||||||
private int[] yellowColumnIndex = {10, 11};
|
|
||||||
|
|
||||||
public TableRefundCellHandel() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
|
|
||||||
// 当前行索引
|
|
||||||
int curRowIndex = cell.getRowIndex();
|
|
||||||
// 当前列索引
|
|
||||||
int curColIndex = cell.getColumnIndex();
|
|
||||||
if (curRowIndex == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 如果是指定要处理的列,则要进行加黄操作
|
|
||||||
if (ArrayUtil.contains(yellowColumnIndex, curColIndex)) {
|
|
||||||
Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex);
|
|
||||||
if (preCell.getCellType() == CellType.NUMERIC) {
|
|
||||||
if (preCell.getNumericCellValue() < 0) {
|
|
||||||
//System.out.println("设置黄色背景:" + curRowIndex + "行," + curColIndex + "列" + preCell.getNumericCellValue());
|
|
||||||
CellStyle style = preCell.getSheet().getWorkbook().createCellStyle();
|
|
||||||
style.cloneStyleFrom(preCell.getCellStyle());
|
|
||||||
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
|
||||||
style.setFillForegroundColor(IndexedColors.YELLOW.getIndex());
|
|
||||||
// 设置水平居中
|
|
||||||
style.setAlignment(HorizontalAlignment.CENTER);
|
|
||||||
// 设置垂直居中
|
|
||||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
|
||||||
preCell.setCellStyle(style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ import com.czg.service.order.service.ShopDirectMerchantService;
|
|||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -32,13 +31,15 @@ public class EntryManagerTask {
|
|||||||
@Resource
|
@Resource
|
||||||
private ShopMerchantService shopMerchantService;
|
private ShopMerchantService shopMerchantService;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO 暂时不用原生进件,使用第三方进件
|
||||||
//每10分钟查一次
|
//每10分钟查一次
|
||||||
@Scheduled(cron = "0 0/10 * * * ? ")
|
// @Scheduled(cron = "0 0/10 * * * ? ")
|
||||||
public void run() {
|
public void run() {
|
||||||
log.info("进件查询,定时任务执行");
|
// log.info("进件查询,定时任务执行");
|
||||||
long start = System.currentTimeMillis();
|
// long start = System.currentTimeMillis();
|
||||||
entryManager(null);
|
// entryManager(null);
|
||||||
log.info("进件查询,定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis());
|
// log.info("进件查询,定时任务执行完毕,耗时:{}ms", System.currentTimeMillis() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计任务
|
* 统计任务
|
||||||
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@@ -43,7 +44,7 @@ public class StatisticTask {
|
|||||||
// 获取前一天
|
// 获取前一天
|
||||||
LocalDate yesterday = LocalDate.now().minusDays(1);
|
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||||
baseStatistic(yesterday);
|
baseStatistic(yesterday);
|
||||||
log.info("统计数据,定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis());
|
log.info("统计数据,定时任务执行完毕,耗时:{}ms", System.currentTimeMillis() - start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,10 +52,6 @@
|
|||||||
<artifactId>cash-common-service</artifactId>
|
<artifactId>cash-common-service</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.pig4cloud.excel</groupId>
|
|
||||||
<artifactId>excel-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.czg.controller.admin;
|
|||||||
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.account.entity.ShopInfo;
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
import com.czg.config.RabbitPublisher;
|
import com.czg.config.RabbitPublisher;
|
||||||
@@ -26,10 +27,12 @@ import com.czg.validator.group.InsertGroup;
|
|||||||
import com.czg.validator.group.UpdateGroup;
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,9 +69,24 @@ public class ProductController {
|
|||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("商品-分页")
|
@OperationLog("商品-分页")
|
||||||
//@SaAdminCheckPermission("product:page")
|
//@SaAdminCheckPermission("product:page")
|
||||||
public CzgResult<Page<ProductDTO>> getProductPage(ProductDTO param) {
|
public CzgResult<Map<String, Object>> getProductPage(ProductDTO param) {
|
||||||
Page<ProductDTO> data = productService.getProductPage(param);
|
Page<ProductDTO> data = productService.getProductPage(param);
|
||||||
return CzgResult.success(data);
|
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(data), Map.class);
|
||||||
|
if (data.getRecords() != null && !data.getRecords().isEmpty()) {
|
||||||
|
ProductDTO first = data.getRecords().getFirst();
|
||||||
|
map.put("warnLine", first.getWarnLine());
|
||||||
|
} else {
|
||||||
|
map.put("warnLine", 0);
|
||||||
|
}
|
||||||
|
return CzgResult.success(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出商品
|
||||||
|
*/
|
||||||
|
@GetMapping("export")
|
||||||
|
public void exportProduct(ProductDTO param, HttpServletResponse response) {
|
||||||
|
productService.exportProductList(param, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,9 +100,7 @@ public class ProductController {
|
|||||||
param.setShopId(shopId);
|
param.setShopId(shopId);
|
||||||
List<ProductDTO> productList = productService.getProductCacheList(param);
|
List<ProductDTO> productList = productService.getProductCacheList(param);
|
||||||
productService.refreshProductStock(param, productList);
|
productService.refreshProductStock(param, productList);
|
||||||
productList.forEach(prod -> {
|
productList.forEach(prod -> prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime())));
|
||||||
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
|
|
||||||
});
|
|
||||||
return CzgResult.success(productList);
|
return CzgResult.success(productList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,13 +127,11 @@ public class ProductController {
|
|||||||
for (ProdSkuDTO prodSkuDTO : dto.getSkuList()) {
|
for (ProdSkuDTO prodSkuDTO : dto.getSkuList()) {
|
||||||
ValidatorUtil.validateEntity(prodSkuDTO, DefaultGroup.class);
|
ValidatorUtil.validateEntity(prodSkuDTO, DefaultGroup.class);
|
||||||
}
|
}
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
productService.addProduct(dto);
|
productService.addProduct(dto);
|
||||||
asyncProductToShop(dto.getId());
|
asyncProductToShop(dto.getId());
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
|
||||||
});
|
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,13 +154,11 @@ public class ProductController {
|
|||||||
if (dto.getStockNumber() != null) {
|
if (dto.getStockNumber() != null) {
|
||||||
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_shang_pin_ku_cun");
|
StpKit.USER.checkStaffPermission("yun_xu_xiu_gai_shang_pin_ku_cun");
|
||||||
}
|
}
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
dto.setShopId(shopId);
|
dto.setShopId(shopId);
|
||||||
productService.updateProduct(dto);
|
productService.updateProduct(dto);
|
||||||
asyncProductToShop(dto.getId());
|
asyncProductToShop(dto.getId());
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
|
||||||
});
|
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,12 +167,10 @@ public class ProductController {
|
|||||||
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
|
||||||
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
|
||||||
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
ValidatorUtil.validateEntity(param, DefaultGroup.class);
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
param.setShopId(shopId);
|
param.setShopId(shopId);
|
||||||
productService.updateProductStock(param);
|
productService.updateProductStock(param);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
|
||||||
});
|
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,12 +186,10 @@ public class ProductController {
|
|||||||
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
|
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
|
||||||
//效验数据
|
//效验数据
|
||||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
productService.deleteProduct(shopId, id);
|
productService.deleteProduct(shopId, id);
|
||||||
asyncProductToShop(id);
|
asyncProductToShop(id);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
|
||||||
});
|
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,12 +201,10 @@ public class ProductController {
|
|||||||
//@SaStaffCheckPermission("yun_xu_shang_xia_jia_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_shang_xia_jia_shang_pin")
|
||||||
//@SaAdminCheckPermission("product:on-off")
|
//@SaAdminCheckPermission("product:on-off")
|
||||||
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
|
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
param.setShopId(shopId);
|
param.setShopId(shopId);
|
||||||
productService.onOffProduct(param);
|
productService.onOffProduct(param);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
|
||||||
});
|
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,12 +216,10 @@ public class ProductController {
|
|||||||
//@SaStaffCheckPermission("yun_xu_shou_qing_shang_pin")
|
//@SaStaffCheckPermission("yun_xu_shou_qing_shang_pin")
|
||||||
//@SaAdminCheckPermission("product:markIsSoldOut")
|
//@SaAdminCheckPermission("product:markIsSoldOut")
|
||||||
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
|
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
|
||||||
Long shopId = StpKit.USER.getShopId(0L);
|
Long shopId = StpKit.USER.getShopId();
|
||||||
param.setShopId(shopId);
|
param.setShopId(shopId);
|
||||||
productService.markProductIsSoldOut(param);
|
productService.markProductIsSoldOut(param);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
|
||||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
|
||||||
});
|
|
||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,9 +316,7 @@ public class ProductController {
|
|||||||
if (shopInfo.getMainId() == null || shopId == shopInfo.getMainId()) {
|
if (shopInfo.getMainId() == null || shopId == shopInfo.getMainId()) {
|
||||||
throw new CzgException("不存在主子店铺关系,无需同步商品信息");
|
throw new CzgException("不存在主子店铺关系,无需同步商品信息");
|
||||||
}
|
}
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> shopSyncService.sync(shopInfo.getMainId(), shopId, shopId));
|
||||||
shopSyncService.sync(shopInfo.getMainId(), shopId, shopId);
|
|
||||||
});
|
|
||||||
CzgResult<Void> ret = CzgResult.success();
|
CzgResult<Void> ret = CzgResult.success();
|
||||||
ret.setMsg("操作成功,数据正在后台同步中...");
|
ret.setMsg("操作成功,数据正在后台同步中...");
|
||||||
return ret;
|
return ret;
|
||||||
@@ -322,15 +324,11 @@ public class ProductController {
|
|||||||
|
|
||||||
private void asyncProductToShop(Long id) {
|
private void asyncProductToShop(Long id) {
|
||||||
long shopId = StpKit.USER.getShopId(0L);
|
long shopId = StpKit.USER.getShopId(0L);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> shopSyncService.syncProductBySourceShop(shopId, id, shopId));
|
||||||
shopSyncService.syncProductBySourceShop(shopId, id, shopId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void asyncConsProToShop(Long id) {
|
private void asyncConsProToShop(Long id) {
|
||||||
long shopId = StpKit.USER.getShopId(0L);
|
long shopId = StpKit.USER.getShopId(0L);
|
||||||
ThreadUtil.execAsync(() -> {
|
ThreadUtil.execAsync(() -> shopSyncService.syncConsProBySourceShop(shopId, id, shopId));
|
||||||
shopSyncService.syncConsProBySourceShop(shopId, id, shopId);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.czg.validator.group.InsertGroup;
|
|||||||
import com.czg.validator.group.UpdateGroup;
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -36,14 +37,19 @@ public class ShopProdCategoryController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ShopSyncService shopSyncService;
|
private ShopSyncService shopSyncService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("商品分类-分页")
|
@OperationLog("商品分类-分页")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:page")
|
|
||||||
public CzgResult<Page<ShopProdCategoryDTO>> getShopProdCategoryPage(ShopProdCategoryDTO param) {
|
public CzgResult<Page<ShopProdCategoryDTO>> getShopProdCategoryPage(ShopProdCategoryDTO param) {
|
||||||
Page<ShopProdCategoryDTO> data = shopProdCategoryService.getShopProdCategoryPage(param);
|
Page<ShopProdCategoryDTO> data = shopProdCategoryService.getShopProdCategoryPage(param);
|
||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@OperationLog("商品分类-列表")
|
@OperationLog("商品分类-列表")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:list")
|
//@SaAdminCheckPermission("shopProdCategory:list")
|
||||||
@@ -52,6 +58,18 @@ public class ShopProdCategoryController {
|
|||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
@OperationLog("商品分类-导出")
|
||||||
|
public void exportShopProdCategory(ShopProdCategoryDTO param, HttpServletResponse response) {
|
||||||
|
shopProdCategoryService.exportShopProdCategory(param, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@OperationLog("商品分类-详情")
|
@OperationLog("商品分类-详情")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:info")
|
//@SaAdminCheckPermission("shopProdCategory:info")
|
||||||
@@ -61,6 +79,9 @@ public class ShopProdCategoryController {
|
|||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@OperationLog("商品分类-新增")
|
@OperationLog("商品分类-新增")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:add")
|
//@SaAdminCheckPermission("shopProdCategory:add")
|
||||||
@@ -70,6 +91,9 @@ public class ShopProdCategoryController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@OperationLog("商品分类-修改")
|
@OperationLog("商品分类-修改")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:update")
|
//@SaAdminCheckPermission("shopProdCategory:update")
|
||||||
@@ -79,6 +103,9 @@ public class ShopProdCategoryController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
@DeleteMapping("{id}")
|
@DeleteMapping("{id}")
|
||||||
@OperationLog("商品分类-删除")
|
@OperationLog("商品分类-删除")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:delete")
|
//@SaAdminCheckPermission("shopProdCategory:delete")
|
||||||
@@ -89,6 +116,9 @@ public class ShopProdCategoryController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用
|
||||||
|
*/
|
||||||
@PostMapping("disable/{id}")
|
@PostMapping("disable/{id}")
|
||||||
@OperationLog("商品分类-禁用")
|
@OperationLog("商品分类-禁用")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:able")
|
//@SaAdminCheckPermission("shopProdCategory:able")
|
||||||
@@ -100,6 +130,9 @@ public class ShopProdCategoryController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用
|
||||||
|
*/
|
||||||
@PostMapping("enable/{id}")
|
@PostMapping("enable/{id}")
|
||||||
@OperationLog("商品分类-启用")
|
@OperationLog("商品分类-启用")
|
||||||
//@SaAdminCheckPermission("shopProdCategory:able")
|
//@SaAdminCheckPermission("shopProdCategory:able")
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.czg.validator.group.InsertGroup;
|
|||||||
import com.czg.validator.group.UpdateGroup;
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@@ -21,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品单位
|
* 管理端/商品单位
|
||||||
*
|
*
|
||||||
* @author Tankaikai tankaikai@aliyun.com
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
* @since 1.0 2025-02-10
|
* @since 1.0 2025-02-10
|
||||||
@@ -36,7 +37,9 @@ public class ShopProdUnitController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ShopSyncService shopSyncService;
|
private ShopSyncService shopSyncService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页
|
||||||
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@OperationLog("商品单位-分页")
|
@OperationLog("商品单位-分页")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:page")
|
//@SaAdminCheckPermission("shopProdUnit:page")
|
||||||
@@ -45,6 +48,9 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
@OperationLog("商品单位-列表")
|
@OperationLog("商品单位-列表")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:list")
|
//@SaAdminCheckPermission("shopProdUnit:list")
|
||||||
@@ -53,6 +59,18 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出
|
||||||
|
*/
|
||||||
|
@GetMapping("/export")
|
||||||
|
@OperationLog("商品单位-导出")
|
||||||
|
public void exportProduct(ShopProdUnitDTO param, HttpServletResponse response) {
|
||||||
|
shopProdUnitService.exportShopProdUnit(param, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
@GetMapping("{id}")
|
@GetMapping("{id}")
|
||||||
@OperationLog("商品单位-详情")
|
@OperationLog("商品单位-详情")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:info")
|
//@SaAdminCheckPermission("shopProdUnit:info")
|
||||||
@@ -62,6 +80,9 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success(data);
|
return CzgResult.success(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@OperationLog("商品单位-新增")
|
@OperationLog("商品单位-新增")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:add")
|
//@SaAdminCheckPermission("shopProdUnit:add")
|
||||||
@@ -71,6 +92,9 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改
|
||||||
|
*/
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@OperationLog("商品单位-修改")
|
@OperationLog("商品单位-修改")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:update")
|
//@SaAdminCheckPermission("shopProdUnit:update")
|
||||||
@@ -80,6 +104,9 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
@DeleteMapping("{id}")
|
@DeleteMapping("{id}")
|
||||||
@OperationLog("商品单位-删除")
|
@OperationLog("商品单位-删除")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:delete")
|
//@SaAdminCheckPermission("shopProdUnit:delete")
|
||||||
@@ -90,6 +117,9 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 禁用
|
||||||
|
*/
|
||||||
@PostMapping("disable/{id}")
|
@PostMapping("disable/{id}")
|
||||||
@OperationLog("商品单位-禁用")
|
@OperationLog("商品单位-禁用")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:able")
|
//@SaAdminCheckPermission("shopProdUnit:able")
|
||||||
@@ -101,6 +131,9 @@ public class ShopProdUnitController {
|
|||||||
return CzgResult.success();
|
return CzgResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用
|
||||||
|
*/
|
||||||
@PostMapping("enable/{id}")
|
@PostMapping("enable/{id}")
|
||||||
@OperationLog("商品单位-启用")
|
@OperationLog("商品单位-启用")
|
||||||
//@SaAdminCheckPermission("shopProdUnit:able")
|
//@SaAdminCheckPermission("shopProdUnit:able")
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class MiniAppPagesController {
|
|||||||
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
|
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
|
||||||
*/
|
*/
|
||||||
@GetMapping("page")
|
@GetMapping("page")
|
||||||
@SaAdminCheckPermission(parentName = "小程序页面",value = "miniAppPages:page", name = "小程序页面分页")
|
// @SaAdminCheckPermission(parentName = "小程序页面",value = "miniAppPages:page", name = "小程序页面分页")
|
||||||
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
|
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
|
||||||
return miniAppPageService.getMiniAppPage(name, path, status);
|
return miniAppPageService.getMiniAppPage(name, path, status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,10 +30,7 @@
|
|||||||
<groupId>com.mybatis-flex</groupId>
|
<groupId>com.mybatis-flex</groupId>
|
||||||
<artifactId>mybatis-flex-processor</artifactId>
|
<artifactId>mybatis-flex-processor</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.pig4cloud.excel</groupId>
|
|
||||||
<artifactId>excel-spring-boot-starter</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.dubbo</groupId>
|
<groupId>org.apache.dubbo</groupId>
|
||||||
<artifactId>dubbo-spring-boot-starter</artifactId>
|
<artifactId>dubbo-spring-boot-starter</artifactId>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.math.BigDecimal;
|
|||||||
@Data
|
@Data
|
||||||
public class ShopInfoEditDTO {
|
public class ShopInfoEditDTO {
|
||||||
@NotNull(message = "id不为空")
|
@NotNull(message = "id不为空")
|
||||||
private Integer id;
|
private Long id;
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
|||||||
@@ -28,5 +28,4 @@ public class ShopUserDTO extends ShopUser {
|
|||||||
private String nextMemberLevelName;
|
private String nextMemberLevelName;
|
||||||
private Long nextExperience;
|
private Long nextExperience;
|
||||||
private Long pointBalance;
|
private Long pointBalance;
|
||||||
private boolean isNew;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.czg.account.dto.shopuser;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/28 11:30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopUserExportDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主店铺Id
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Long mainShopId;
|
||||||
|
|
||||||
|
@ExcelProperty("手机号")
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ExcelProperty("会员生日")
|
||||||
|
private String birthDay;
|
||||||
|
|
||||||
|
@ExcelProperty("用户昵称")
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer status;
|
||||||
|
@ExcelProperty("会员状态")
|
||||||
|
private String statusRemark;
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer isVip;
|
||||||
|
@ExcelProperty("是否会员")
|
||||||
|
private String vipRemark;
|
||||||
|
|
||||||
|
@ExcelProperty("会员编号")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@ExcelProperty("余额")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@ExcelProperty("充值次数")
|
||||||
|
private Integer rechargeCount;
|
||||||
|
|
||||||
|
@ExcelProperty("消费累计")
|
||||||
|
private BigDecimal consumeAmount;
|
||||||
|
|
||||||
|
@ExcelProperty("消费次数")
|
||||||
|
private Integer consumeCount;
|
||||||
|
|
||||||
|
@ExcelProperty("经验值")
|
||||||
|
private Long experience;
|
||||||
|
|
||||||
|
@ExcelIgnore
|
||||||
|
private String distributionShops;
|
||||||
|
@ExcelProperty("是否分销员")
|
||||||
|
private String distributionShopsRemark;
|
||||||
|
|
||||||
|
@ExcelProperty("优惠券数量")
|
||||||
|
private Long couponNum;
|
||||||
|
|
||||||
|
@ExcelProperty("订单数量")
|
||||||
|
private Long orderNumber;
|
||||||
|
|
||||||
|
@ExcelProperty("充值金额")
|
||||||
|
private BigDecimal rechargeAmount;
|
||||||
|
|
||||||
|
@ExcelProperty("会员等级")
|
||||||
|
private String memberLevelName;
|
||||||
|
|
||||||
|
@ExcelProperty("下一级会员等级")
|
||||||
|
private String nextMemberLevelName;
|
||||||
|
|
||||||
|
@ExcelProperty("升级所需经验值")
|
||||||
|
private Long nextExperience;
|
||||||
|
|
||||||
|
@ExcelProperty("积分余额")
|
||||||
|
private Long pointBalance;
|
||||||
|
|
||||||
|
@ExcelProperty("加入会员时间")
|
||||||
|
private LocalDateTime joinTime;
|
||||||
|
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
public String getVipRemark() {
|
||||||
|
if (isVip == null || isVip == 0) {
|
||||||
|
return "否";
|
||||||
|
}
|
||||||
|
return "是";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatusRemark() {
|
||||||
|
if (status == null || status == 0) {
|
||||||
|
return "禁用";
|
||||||
|
}
|
||||||
|
return "正常";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDistributionShopsRemark() {
|
||||||
|
if (StrUtil.isBlank(distributionShops)) {
|
||||||
|
return "否";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (distributionShops.contains(mainShopId + "_1")) {
|
||||||
|
return "是";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "否";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -128,7 +128,7 @@ public class ShopInfo implements Serializable {
|
|||||||
private String businessTime;
|
private String businessTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* trial试用版,release正式
|
* probation试用版,release正式
|
||||||
*/
|
*/
|
||||||
private String profiles;
|
private String profiles;
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package com.czg.account.entity;
|
package com.czg.account.entity;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
|
||||||
import com.czg.utils.CzgRandomUtils;
|
import com.czg.utils.CzgRandomUtils;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
@@ -152,22 +151,6 @@ public class ShopUser implements Serializable {
|
|||||||
private LocalDateTime nextDeliverTime;
|
private LocalDateTime nextDeliverTime;
|
||||||
// 是否分销员
|
// 是否分销员
|
||||||
private String distributionShops;
|
private String distributionShops;
|
||||||
/**
|
|
||||||
* 上级分销员id
|
|
||||||
*/
|
|
||||||
private Long parentUserId;
|
|
||||||
/**
|
|
||||||
* 上上级分销员id
|
|
||||||
*/
|
|
||||||
private Long gradeUserId;
|
|
||||||
/**
|
|
||||||
* 一级分销收入
|
|
||||||
*/
|
|
||||||
private BigDecimal oneIncome;
|
|
||||||
/**
|
|
||||||
* 二级分销收入
|
|
||||||
*/
|
|
||||||
private BigDecimal twoIncome;
|
|
||||||
|
|
||||||
private String memberCircleName;
|
private String memberCircleName;
|
||||||
private Integer memberCircleReward;
|
private Integer memberCircleReward;
|
||||||
@@ -179,8 +162,6 @@ public class ShopUser implements Serializable {
|
|||||||
private Integer discount;
|
private Integer discount;
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
private Integer isMemberPrice;
|
private Integer isMemberPrice;
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private LocalDateTime inviteTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加或更新分销店铺:若shopId已存在(无论后缀),则替换为新的id_后缀;否则插入
|
* 添加或更新分销店铺:若shopId已存在(无论后缀),则替换为新的id_后缀;否则插入
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.czg.account.dto.shopuser.*;
|
|||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
import com.czg.market.entity.SmsPushEventUser;
|
import com.czg.market.entity.SmsPushEventUser;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -22,6 +23,8 @@ public interface AShopUserService {
|
|||||||
Page<ShopUser> getPushEventUser(SmsPushEventUser smsPushEventUser);
|
Page<ShopUser> getPushEventUser(SmsPushEventUser smsPushEventUser);
|
||||||
Page<ShopUser> getAcPushEventUser(SmsPushEventUser smsPushEventUser);
|
Page<ShopUser> getAcPushEventUser(SmsPushEventUser smsPushEventUser);
|
||||||
|
|
||||||
|
void exportUserList(String key, Integer isVip, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO);
|
Boolean add(Long shopId, ShopUserAddDTO shopUserAddDTO);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import com.czg.account.entity.ShopInfo;
|
|||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,7 +15,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ShopConfigService extends IService<ShopConfig> {
|
public interface ShopConfigService extends IService<ShopConfig> {
|
||||||
|
|
||||||
ShopInfo getShopInfoAndConfig(Serializable id) throws CzgException;
|
ShopInfo getShopInfoAndConfig(Long id) throws CzgException;
|
||||||
|
|
||||||
void editStatusByShopIdList(Long mainShopId, Integer isEnable, boolean onyUpValid, String name, String useShopType, List<Long> shopIdList);
|
void editStatusByShopIdList(Long mainShopId, Integer isEnable, boolean onyUpValid, String name, String useShopType, List<Long> shopIdList);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public interface ShopInfoService extends IService<ShopInfo> {
|
|||||||
*/
|
*/
|
||||||
boolean checkSwitch(Long shopId, ShopSwitchTypeEnum switchType) throws ValidateException;
|
boolean checkSwitch(Long shopId, ShopSwitchTypeEnum switchType) throws ValidateException;
|
||||||
|
|
||||||
Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop);
|
Page<ShopInfo> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop);
|
||||||
|
|
||||||
Page<ShopInfo> getShopByMainId(PageDTO pageDTO, String shopName, Integer status);
|
Page<ShopInfo> getShopByMainId(PageDTO pageDTO, String shopName, Integer status);
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.czg.account.vo;
|
package com.czg.account.vo;
|
||||||
|
|
||||||
import cn.idev.excel.annotation.ExcelIgnore;
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -26,7 +25,6 @@ public class HandoverProductListVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 导入时候回显行号
|
* 导入时候回显行号
|
||||||
*/
|
*/
|
||||||
@ExcelLine
|
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
private Long lineNum;
|
private Long lineNum;
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
package com.czg.market.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class MkCarouselDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图名称(20字内)
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可分享 1=开启 0=关闭
|
||||||
|
*/
|
||||||
|
private Integer isShareable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态 1=启用 0=禁用
|
||||||
|
*/
|
||||||
|
private Integer isEnabled;
|
||||||
|
}
|
||||||
@@ -1,16 +1,17 @@
|
|||||||
|
|
||||||
package com.czg.market.dto;
|
package com.czg.market.dto;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import jakarta.validation.constraints.DecimalMin;
|
||||||
import java.math.BigDecimal;
|
import jakarta.validation.constraints.Min;
|
||||||
import java.time.LocalDateTime;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.*;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
import java.io.Serial;
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员等级配置 实体类。
|
* 分销员等级配置 实体类。
|
||||||
@@ -50,12 +51,7 @@ public class MkDistributionLevelConfigDTO implements Serializable {
|
|||||||
* 一级分销比例
|
* 一级分销比例
|
||||||
*/
|
*/
|
||||||
@NotNull(message = "一级分销比例不为空")
|
@NotNull(message = "一级分销比例不为空")
|
||||||
private BigDecimal levelOneCommission;
|
private BigDecimal commission;
|
||||||
|
|
||||||
/**
|
|
||||||
* 二级分销比例
|
|
||||||
*/
|
|
||||||
private BigDecimal levelTwoCommission;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
package com.czg.market.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigInteger;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置表 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("mk_carousel")
|
||||||
|
public class MkCarousel implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private BigInteger id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图名称(20字内)
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图片地址
|
||||||
|
*/
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否可分享 1=开启 0=关闭
|
||||||
|
*/
|
||||||
|
private Integer isShareable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转页面 tb_mini_app_pages的 id
|
||||||
|
*/
|
||||||
|
private Long jumpPageId;
|
||||||
|
/**
|
||||||
|
* 跳转页面路径
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private String jumpPagePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扩展参数
|
||||||
|
*/
|
||||||
|
private String extendParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序值,值越大越靠前
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启用状态 1=启用 0=禁用
|
||||||
|
*/
|
||||||
|
private Integer isEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.czg.market.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员管理群(全民股东管理) 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-28
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("mk_distribution_group")
|
||||||
|
public class MkDistributionGroup implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 群二维码地址
|
||||||
|
*/
|
||||||
|
private String groupUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块标题 15字以内
|
||||||
|
*/
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模块内容 20字以内
|
||||||
|
*/
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否开启
|
||||||
|
*/
|
||||||
|
private Integer isEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.czg.market.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东邀请关系 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-31
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("mk_distribution_invite")
|
||||||
|
public class MkDistributionInvite implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺Id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
/**
|
||||||
|
* 用户Id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户Id
|
||||||
|
*/
|
||||||
|
private Long shopUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请人ID mk_distribution_user.id
|
||||||
|
*/
|
||||||
|
private Long parentUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请人上级ID mk_distribution_user.id
|
||||||
|
*/
|
||||||
|
private Long gradeUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 一级分润
|
||||||
|
*/
|
||||||
|
private BigDecimal oneIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二级分润
|
||||||
|
*/
|
||||||
|
private BigDecimal twoIncome;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime inviteTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.czg.market.entity;
|
package com.czg.market.entity;
|
||||||
|
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
@@ -117,5 +116,9 @@ public class MkDistributionUser implements Serializable {
|
|||||||
* 邀请码
|
* 邀请码
|
||||||
*/
|
*/
|
||||||
private String inviteCode;
|
private String inviteCode;
|
||||||
|
/**
|
||||||
|
* 是否第一次进入全民股东界面
|
||||||
|
*/
|
||||||
|
private Integer firstIn;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package com.czg.market.entity;
|
||||||
|
|
||||||
|
import com.czg.market.dto.ShopCouponDTO;
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础配置 实体类。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("mk_share_base")
|
||||||
|
public class MkShareBase implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 功能开启状态 1=开启 0=关闭
|
||||||
|
*/
|
||||||
|
private Integer isEnabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可获得奖励的分享页面,用逗号分隔,
|
||||||
|
* 店铺首页 index
|
||||||
|
* 我的 dine
|
||||||
|
* 点餐页 eat
|
||||||
|
* 点餐页 eat-detail
|
||||||
|
* 套餐推广-列表 pp-list
|
||||||
|
* 套餐推广-详情 pp-detail
|
||||||
|
* 商品拼团-列表 gb-list
|
||||||
|
* 商品拼团-详情 gb-detail
|
||||||
|
* 全民股东 dis
|
||||||
|
*/
|
||||||
|
private String rewardSharePages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享人奖励的优惠券ID,关联优惠券表
|
||||||
|
*/
|
||||||
|
private Long sharerCouponId;
|
||||||
|
/**
|
||||||
|
* 分享人奖励的优惠券信息
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private ShopCouponDTO sharerCoupon;
|
||||||
|
/**
|
||||||
|
* 分享人奖励的优惠券名称
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private String sharerCouponName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享人单次获得优惠券数量
|
||||||
|
*/
|
||||||
|
private Integer sharerCouponNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可获得奖励次数 1=仅1次 2=每次分享成功
|
||||||
|
*/
|
||||||
|
private Integer rewardTimesType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被分享人奖励的优惠券ID,关联优惠券表(可选)
|
||||||
|
*/
|
||||||
|
private Long sharedUserCouponId;
|
||||||
|
/**
|
||||||
|
* 被分享人奖励的优惠券名称
|
||||||
|
*/
|
||||||
|
@Column(ignore = true)
|
||||||
|
private String sharedUserCouponName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被分享人单次获得优惠券数量(可选)
|
||||||
|
*/
|
||||||
|
private Integer sharedUserCouponNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被分享人弹窗开关 1=开启 0=关闭
|
||||||
|
*/
|
||||||
|
private Integer isSharedUserPopup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.czg.market.service;
|
||||||
|
|
||||||
|
import com.czg.market.dto.MkCarouselDTO;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.market.entity.MkCarousel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置表 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
public interface MkCarouselService extends IService<MkCarousel> {
|
||||||
|
|
||||||
|
List<MkCarousel> getCarousels(MkCarouselDTO mkCarouselDTO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.market.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.market.entity.MkDistributionGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员管理群(全民股东管理) 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-28
|
||||||
|
*/
|
||||||
|
public interface MkDistributionGroupService extends IService<MkDistributionGroup> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.czg.market.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.market.entity.MkDistributionInvite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东邀请关系 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-31
|
||||||
|
*/
|
||||||
|
public interface MkDistributionInviteService extends IService<MkDistributionInvite> {
|
||||||
|
|
||||||
|
MkDistributionInvite getByShopIdAndShopUserId(Long shopId, Long shopUserId);
|
||||||
|
}
|
||||||
@@ -60,9 +60,18 @@ public interface MkDistributionUserService extends IService<MkDistributionUser>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销员中心-绑定邀请人
|
* 分销员中心-绑定邀请人
|
||||||
|
* 通过邀请码
|
||||||
*/
|
*/
|
||||||
void bindInviteUser(MkDistributionUserDTO param) throws CzgException, ValidateException;
|
void bindInviteUser(MkDistributionUserDTO param) throws CzgException, ValidateException;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员中心-绑定邀请人
|
||||||
|
* 通过邀请人id
|
||||||
|
* @param fromUserId shopUserId 邀请人
|
||||||
|
* @param toUserId 被邀请人邀请人
|
||||||
|
*/
|
||||||
|
void bindInviteUser(Long fromUserId, Long toUserId, Long shopId) throws CzgException, ValidateException;
|
||||||
/**
|
/**
|
||||||
* 获取分销员分页列表
|
* 获取分销员分页列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.czg.market.service;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.market.entity.MkShareBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础配置 服务层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
public interface MkShareBaseService extends IService<MkShareBase> {
|
||||||
|
|
||||||
|
MkShareBase getShareBase(Long shopId);
|
||||||
|
|
||||||
|
void shareClaim(String tagType, Long shopId, Long fromUserId, Long toUserId);
|
||||||
|
}
|
||||||
@@ -0,0 +1,266 @@
|
|||||||
|
package com.czg.order.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 财务统计数据
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 09:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class FinanceStsDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额
|
||||||
|
*/
|
||||||
|
private TurnoverSts turnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单
|
||||||
|
*/
|
||||||
|
private OrderSts order;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠金额
|
||||||
|
*/
|
||||||
|
private DiscountSts discount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款
|
||||||
|
*/
|
||||||
|
private RefundSts refund;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计
|
||||||
|
*/
|
||||||
|
private Sts sts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class TurnoverSts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 营业额
|
||||||
|
*/
|
||||||
|
private BigDecimal turnover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal wechat;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付宝支付金额
|
||||||
|
*/
|
||||||
|
private BigDecimal alipay;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码收款
|
||||||
|
*/
|
||||||
|
private BigDecimal selfScan;
|
||||||
|
/**
|
||||||
|
* 扫码收款
|
||||||
|
*/
|
||||||
|
private BigDecimal barScan;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金收款
|
||||||
|
*/
|
||||||
|
private BigDecimal cash;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值
|
||||||
|
*/
|
||||||
|
private BigDecimal recharge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 挂账
|
||||||
|
*/
|
||||||
|
private BigDecimal owed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 余额支付
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class OrderSts {
|
||||||
|
/**
|
||||||
|
* 订单金额
|
||||||
|
*/
|
||||||
|
private BigDecimal orderAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单总数
|
||||||
|
*/
|
||||||
|
private Long orderCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠金额 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class DiscountSts {
|
||||||
|
/**
|
||||||
|
* 优惠金额
|
||||||
|
*/
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠笔数
|
||||||
|
*/
|
||||||
|
private Long discountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新客立减
|
||||||
|
*/
|
||||||
|
private BigDecimal newConsumerDiscount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 霸王餐
|
||||||
|
*/
|
||||||
|
private BigDecimal freeCashAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 满减活动
|
||||||
|
*/
|
||||||
|
private BigDecimal fullMinusAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠券
|
||||||
|
*/
|
||||||
|
private BigDecimal couponAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员折扣
|
||||||
|
*/
|
||||||
|
private BigDecimal memberDiscount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 积分抵扣金额
|
||||||
|
*/
|
||||||
|
private BigDecimal pointsDiscountAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单改价
|
||||||
|
*/
|
||||||
|
private BigDecimal orderDiscount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class RefundSts {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal onlineRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal cashRefundAmount;
|
||||||
|
/**
|
||||||
|
* 挂账退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal creditRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal rechargeRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上充值退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal onlineRechargeRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 现金充值退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal cashRechargeRefundAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员退款金额
|
||||||
|
*/
|
||||||
|
private BigDecimal memberRefundAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据统计 类
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public static class Sts {
|
||||||
|
/**
|
||||||
|
* 就餐人数
|
||||||
|
*/
|
||||||
|
private Long customerCount;
|
||||||
|
/**
|
||||||
|
* 订单数
|
||||||
|
*/
|
||||||
|
private Long orderCount;
|
||||||
|
/**
|
||||||
|
* 桌台数
|
||||||
|
*/
|
||||||
|
private Long tableCount;
|
||||||
|
/**
|
||||||
|
* 客单价
|
||||||
|
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
||||||
|
* 没有具体人数时,默认一桌按照1人计算
|
||||||
|
*/
|
||||||
|
private BigDecimal avgPayAmount;
|
||||||
|
/**
|
||||||
|
* 翻台率
|
||||||
|
* (订单数-桌台数)/桌台数*100%
|
||||||
|
*/
|
||||||
|
private BigDecimal turnoverRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 毛利润(订单实付金额-商品成本)
|
||||||
|
*/
|
||||||
|
private BigDecimal profitAmount;
|
||||||
|
/**
|
||||||
|
* 商品成本
|
||||||
|
*/
|
||||||
|
private BigDecimal productCostAmount;
|
||||||
|
/**
|
||||||
|
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
||||||
|
*/
|
||||||
|
private BigDecimal profitRate;
|
||||||
|
/**
|
||||||
|
* 净利润
|
||||||
|
*/
|
||||||
|
private BigDecimal netProfitAmount;
|
||||||
|
/**
|
||||||
|
* 净利润率
|
||||||
|
*/
|
||||||
|
private BigDecimal netProfitRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -182,13 +182,14 @@ public class OrderInfo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* {@link com.czg.order.enums.PayEnums}
|
* {@link com.czg.order.enums.PayEnums}
|
||||||
* 支付类型
|
* 支付类型
|
||||||
* 主扫 main_scan
|
* 二维码收款 main_scan
|
||||||
* 被扫 back_scan
|
* 扫码收款 back_scan
|
||||||
* 微信小程序 wechat_mini
|
* 微信小程序 wechat_mini
|
||||||
* 支付宝小程序 alipay_mini
|
* 支付宝小程序 alipay_mini
|
||||||
* 会员支付 vip_pay
|
* 会员支付 vip_pay
|
||||||
* 现金支付 cash_pay
|
* 现金支付 cash_pay
|
||||||
* 挂账支付 credit_pay
|
* 挂账支付 credit_pay
|
||||||
|
* 霸王餐支付 free_pay
|
||||||
*/
|
*/
|
||||||
private String payType;
|
private String payType;
|
||||||
|
|
||||||
|
|||||||
@@ -150,9 +150,10 @@ public class OrderPayment implements Serializable {
|
|||||||
return orderPayment;
|
return orderPayment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OrderPayment refund(@NonNull Long shopId, @NonNull Long sourceId, @NotBlank String sourceType,
|
public static OrderPayment refund(@NonNull String channel,@NonNull Long shopId, @NonNull Long sourceId, @NotBlank String sourceType,
|
||||||
@NotBlank String orderNo, @NonNull BigDecimal amount, Long relatedId, String platformType) {
|
@NotBlank String orderNo, @NonNull BigDecimal amount, Long relatedId, String platformType) {
|
||||||
OrderPayment orderPayment = getInstance(shopId, sourceId, sourceType, orderNo, amount, null, relatedId);
|
OrderPayment orderPayment = getInstance(shopId, sourceId, sourceType, orderNo, amount, null, relatedId);
|
||||||
|
orderPayment.setChannel(channel);
|
||||||
orderPayment.setPayType(PayTypeConstants.PayType.REFUND);
|
orderPayment.setPayType(PayTypeConstants.PayType.REFUND);
|
||||||
orderPayment.setPayStatus(PayTypeConstants.PayStatus.INIT);
|
orderPayment.setPayStatus(PayTypeConstants.PayStatus.INIT);
|
||||||
orderPayment.setPlatformType(platformType);
|
orderPayment.setPlatformType(platformType);
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.czg.order.entity;
|
package com.czg.order.entity;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
import com.mybatisflex.annotation.Table;
|
import com.mybatisflex.annotation.Table;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@@ -105,249 +107,311 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 主键ID
|
* 主键ID
|
||||||
*/
|
*/
|
||||||
@Id(keyType = KeyType.Auto)
|
@Id(keyType = KeyType.Auto)
|
||||||
|
@ExcelIgnore
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
/**
|
/**
|
||||||
* 统计日期 yyyy-MM-dd
|
* 统计日期 yyyy-MM-dd
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("统计日期")
|
||||||
|
@ColumnWidth(17)
|
||||||
private LocalDate statisticDate;
|
private LocalDate statisticDate;
|
||||||
//*********************以下为订单金额********************************************************************************
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单金额 订单原金额
|
* 订单金额 订单原金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("订单金额")
|
||||||
private BigDecimal originAmount;
|
private BigDecimal originAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实付金额 (线上付款 现金支付 会员支付 挂账)
|
* 实付金额 (线上付款 现金支付 会员支付 挂账)
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("实付金额")
|
||||||
private BigDecimal payAmount;
|
private BigDecimal payAmount;
|
||||||
/**
|
|
||||||
* 线上付款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal onlinePayAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 退款金额(原路返回 现金退款)
|
|
||||||
*/
|
|
||||||
private BigDecimal refundAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 线上退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal onlineRefundAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 线下退款金额/现金退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal cashRefundAmount;
|
|
||||||
/**
|
|
||||||
* 订单退款 会员退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal memberRefundAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员消费 会员订单支付金额
|
|
||||||
*/
|
|
||||||
private BigDecimal memberPayAmount;
|
|
||||||
/**
|
|
||||||
* 会员消费笔数
|
|
||||||
*/
|
|
||||||
private Long memberPayCount;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为充值金额********************************************************************************
|
|
||||||
/**
|
|
||||||
* 会员充值 充值金额(包含现金支付) 不包括赠送 多店 按 主店算
|
|
||||||
*/
|
|
||||||
private BigDecimal rechargeAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值 线上充值金额
|
|
||||||
*/
|
|
||||||
private BigDecimal onlineRechargeAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值 现金充值金额
|
|
||||||
*/
|
|
||||||
private BigDecimal cashRechargeAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值 充值赠送金额
|
|
||||||
*/
|
|
||||||
private BigDecimal giveAmount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员充值退款 充值退款金额(线上退款+现金退款)
|
|
||||||
*/
|
|
||||||
private BigDecimal rechargeRefundAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值退款 线上退款
|
|
||||||
*/
|
|
||||||
private BigDecimal onlineRechargeRefundAmount;
|
|
||||||
/**
|
|
||||||
* 会员充值退款 现金退款金额
|
|
||||||
*/
|
|
||||||
private BigDecimal cashRechargeRefundAmount;
|
|
||||||
/**
|
|
||||||
* 新增会员数
|
|
||||||
*/
|
|
||||||
private Long newMemberCount;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为客单价 翻台率 的计算********************************************************************************
|
|
||||||
/**
|
|
||||||
* 就餐人数
|
|
||||||
*/
|
|
||||||
private Long customerCount;
|
|
||||||
/**
|
|
||||||
* 订单数
|
|
||||||
*/
|
|
||||||
private Long orderCount;
|
|
||||||
/**
|
|
||||||
* 桌台数
|
|
||||||
*/
|
|
||||||
private Long tableCount;
|
|
||||||
/**
|
|
||||||
* 客单价
|
|
||||||
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
|
||||||
* 没有具体人数时,默认一桌按照1人计算
|
|
||||||
*/
|
|
||||||
private BigDecimal avgPayAmount;
|
|
||||||
/**
|
|
||||||
* 翻台率
|
|
||||||
* (订单数-桌台数)/桌台数*100%
|
|
||||||
*/
|
|
||||||
private BigDecimal turnoverRate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 毛利润(订单实付金额-商品成本)
|
|
||||||
*/
|
|
||||||
private BigDecimal profitAmount;
|
|
||||||
/**
|
|
||||||
* 商品成本
|
|
||||||
*/
|
|
||||||
private BigDecimal productCostAmount;
|
|
||||||
/**
|
|
||||||
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
|
||||||
*/
|
|
||||||
private BigDecimal profitRate;
|
|
||||||
/**
|
|
||||||
* 净利润
|
|
||||||
*/
|
|
||||||
private BigDecimal netProfitAmount;
|
|
||||||
/**
|
|
||||||
* 净利润率
|
|
||||||
*/
|
|
||||||
private BigDecimal netProfitRate;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为优惠金额********************************************************************************
|
|
||||||
/**
|
|
||||||
* 优惠总金额
|
|
||||||
*/
|
|
||||||
private BigDecimal discountAmount;
|
|
||||||
/**
|
|
||||||
* 优惠笔数
|
|
||||||
*/
|
|
||||||
private Long discountCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新客立减金额
|
|
||||||
*/
|
|
||||||
private BigDecimal newCustomerDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 满减活动金额
|
|
||||||
*/
|
|
||||||
private BigDecimal fullDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 优惠券抵扣金额
|
|
||||||
*/
|
|
||||||
private BigDecimal couponDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 积分抵扣金额
|
|
||||||
*/
|
|
||||||
private BigDecimal pointDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 霸王餐金额
|
|
||||||
*/
|
|
||||||
private BigDecimal backDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 会员整单折扣金额
|
|
||||||
*/
|
|
||||||
private BigDecimal memberDiscountAmount;
|
|
||||||
/**
|
|
||||||
* 订单改价金额
|
|
||||||
*/
|
|
||||||
private BigDecimal orderPriceDiscountAmount;
|
|
||||||
|
|
||||||
|
|
||||||
//*********************以下为支付金额********************************************************************************
|
//*********************以下为支付金额********************************************************************************
|
||||||
/**
|
/**
|
||||||
* 现金支付金额
|
* 现金支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("现金支付金额")
|
||||||
private BigDecimal cashPayAmount;
|
private BigDecimal cashPayAmount;
|
||||||
/**
|
/**
|
||||||
* 现金支付笔数
|
* 现金支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("现金支付笔数")
|
||||||
private Long cashPayCount;
|
private Long cashPayCount;
|
||||||
/**
|
/**
|
||||||
* 微信小程序支付金额
|
* 微信小程序支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("微信小程序支付金额")
|
||||||
private BigDecimal wechatPayAmount;
|
private BigDecimal wechatPayAmount;
|
||||||
/**
|
/**
|
||||||
* 微信小程序支付笔数
|
* 微信小程序支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("微信小程序支付笔数")
|
||||||
private Long wechatPayCount;
|
private Long wechatPayCount;
|
||||||
/**
|
/**
|
||||||
* 支付宝小程序支付金额
|
* 支付宝小程序支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("支付宝小程序支付金额")
|
||||||
private BigDecimal alipayPayAmount;
|
private BigDecimal alipayPayAmount;
|
||||||
/**
|
/**
|
||||||
* 支付宝小程序支付笔数
|
* 支付宝小程序支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("支付宝小程序支付笔数")
|
||||||
private Long alipayPayCount;
|
private Long alipayPayCount;
|
||||||
/**
|
/**
|
||||||
* 被扫收款金额
|
* 被扫收款金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("扫码收款金额")
|
||||||
private BigDecimal backScanPayAmount;
|
private BigDecimal backScanPayAmount;
|
||||||
/**
|
/**
|
||||||
* 被扫收款笔数
|
* 被扫收款笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("扫码收款笔数")
|
||||||
private Long backScanPayCount;
|
private Long backScanPayCount;
|
||||||
/**
|
/**
|
||||||
* 主扫收款金额
|
* 二维码收款金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("二维码收款金额")
|
||||||
private BigDecimal mainScanPayAmount;
|
private BigDecimal mainScanPayAmount;
|
||||||
/**
|
/**
|
||||||
* 主扫收款笔数
|
* 二维码收款笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("二维码收款笔数")
|
||||||
private Long mainScanPayCount;
|
private Long mainScanPayCount;
|
||||||
/**
|
/**
|
||||||
* 挂账支付金额
|
* 挂账支付金额
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("挂账支付金额")
|
||||||
private BigDecimal creditPayAmount;
|
private BigDecimal creditPayAmount;
|
||||||
/**
|
/**
|
||||||
* 挂账支付笔数
|
* 挂账支付笔数
|
||||||
*/
|
*/
|
||||||
|
@ExcelProperty("挂账支付笔数")
|
||||||
private Long creditPayCount;
|
private Long creditPayCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员消费 会员订单支付金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员消费金额")
|
||||||
|
private BigDecimal memberPayAmount;
|
||||||
|
/**
|
||||||
|
* 会员消费笔数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员消费笔数")
|
||||||
|
private Long memberPayCount;
|
||||||
|
|
||||||
|
//*********************以下为订单金额********************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线上付款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("线上付款金额")
|
||||||
|
private BigDecimal onlinePayAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 退款金额(原路返回 现金退款)
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款金额")
|
||||||
|
private BigDecimal refundAmount;
|
||||||
|
@ExcelProperty("订单挂账退款金额")
|
||||||
|
private BigDecimal creditRefundAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 线上退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款线上金额")
|
||||||
|
private BigDecimal onlineRefundAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 线下退款金额/现金退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款线下金额")
|
||||||
|
private BigDecimal cashRefundAmount;
|
||||||
|
/**
|
||||||
|
* 订单退款 会员退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单退款会员金额")
|
||||||
|
private BigDecimal memberRefundAmount;
|
||||||
|
|
||||||
|
|
||||||
|
//*********************以下为充值金额********************************************************************************
|
||||||
|
/**
|
||||||
|
* 会员充值 充值金额(包含现金支付) 不包括赠送 多店 按 主店算
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值金额")
|
||||||
|
private BigDecimal rechargeAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值 线上充值金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员线上充值金额")
|
||||||
|
private BigDecimal onlineRechargeAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值 现金充值金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员现金充值金额")
|
||||||
|
private BigDecimal cashRechargeAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值 充值赠送金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值赠送金额")
|
||||||
|
private BigDecimal giveAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会员充值退款 充值退款金额(线上退款+现金退款)
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值退款金额")
|
||||||
|
private BigDecimal rechargeRefundAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值退款 线上退款
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值线上退款金额")
|
||||||
|
private BigDecimal onlineRechargeRefundAmount;
|
||||||
|
/**
|
||||||
|
* 会员充值退款 现金退款金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员充值线下退款金额")
|
||||||
|
private BigDecimal cashRechargeRefundAmount;
|
||||||
|
/**
|
||||||
|
* 新增会员数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("新增会员数")
|
||||||
|
private Long newMemberCount;
|
||||||
|
|
||||||
|
|
||||||
|
//*********************以下为优惠金额********************************************************************************
|
||||||
|
/**
|
||||||
|
* 优惠总金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("优惠总金额")
|
||||||
|
private BigDecimal discountAmount;
|
||||||
|
/**
|
||||||
|
* 优惠笔数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("优惠笔数")
|
||||||
|
private Long discountCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新客立减金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("新客立减金额")
|
||||||
|
private BigDecimal newCustomerDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 满减活动金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("满减活动金额")
|
||||||
|
private BigDecimal fullDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 优惠券抵扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("优惠券抵扣金额")
|
||||||
|
private BigDecimal couponDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 积分抵扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("积分抵扣金额")
|
||||||
|
private BigDecimal pointDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 霸王餐金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("霸王餐金额")
|
||||||
|
private BigDecimal backDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 会员整单折扣金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("会员整单折扣金额")
|
||||||
|
private BigDecimal memberDiscountAmount;
|
||||||
|
/**
|
||||||
|
* 订单改价金额
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单改价金额")
|
||||||
|
private BigDecimal orderPriceDiscountAmount;
|
||||||
|
|
||||||
|
|
||||||
|
//*********************以下为客单价 翻台率 的计算********************************************************************************
|
||||||
|
/**
|
||||||
|
* 就餐人数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("就餐人数")
|
||||||
|
private Long customerCount;
|
||||||
|
/**
|
||||||
|
* 订单数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("订单数")
|
||||||
|
private Long orderCount;
|
||||||
|
/**
|
||||||
|
* 桌台数
|
||||||
|
*/
|
||||||
|
@ExcelProperty("桌台数")
|
||||||
|
private Long tableCount;
|
||||||
|
/**
|
||||||
|
* 客单价
|
||||||
|
* 实付金额(包含现金支付 包含会员支付 包含挂账)/就餐人数
|
||||||
|
* 没有具体人数时,默认一桌按照1人计算
|
||||||
|
*/
|
||||||
|
@ExcelProperty("客单价")
|
||||||
|
private BigDecimal avgPayAmount;
|
||||||
|
/**
|
||||||
|
* 翻台率
|
||||||
|
* (订单数-桌台数)/桌台数*100%
|
||||||
|
*/
|
||||||
|
@ExcelProperty("翻台率(%)")
|
||||||
|
private BigDecimal turnoverRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 毛利润(订单实付金额-商品成本)
|
||||||
|
*/
|
||||||
|
@ExcelProperty("毛利率(%)")
|
||||||
|
private BigDecimal profitAmount;
|
||||||
|
/**
|
||||||
|
* 商品成本
|
||||||
|
*/
|
||||||
|
@ExcelProperty("商品成本")
|
||||||
|
private BigDecimal productCostAmount;
|
||||||
|
/**
|
||||||
|
* 毛利率(订单实付金额-商品成本)/订单实付金额*100%
|
||||||
|
*/
|
||||||
|
@ExcelProperty("利润率(%)")
|
||||||
|
private BigDecimal profitRate;
|
||||||
|
/**
|
||||||
|
* 净利润
|
||||||
|
*/
|
||||||
|
@ExcelProperty("净利润")
|
||||||
|
private BigDecimal netProfitAmount;
|
||||||
|
/**
|
||||||
|
* 净利润率
|
||||||
|
*/
|
||||||
|
@ExcelProperty("净利润率(%)")
|
||||||
|
private BigDecimal netProfitRate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
@Column(onInsertValue = "now()")
|
@Column(onInsertValue = "now()")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新时间
|
* 更新时间
|
||||||
*/
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
|
@ExcelIgnore
|
||||||
BigDecimal zero = BigDecimal.ZERO;
|
BigDecimal zero = BigDecimal.ZERO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否有效
|
* 是否有效
|
||||||
*/
|
*/
|
||||||
@Column(ignore = true)
|
@Column(ignore = true)
|
||||||
|
@ExcelIgnore
|
||||||
private Boolean valid = true;
|
private Boolean valid = true;
|
||||||
|
|
||||||
|
|
||||||
@@ -410,11 +474,19 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 合并两个统计对象
|
* 合并两个统计对象
|
||||||
*/
|
*/
|
||||||
public static ShopOrderStatistic mergeStatistics(ShopOrderStatistic stat1, ShopOrderStatistic stat2) {
|
public static ShopOrderStatistic mergeStatistics(ShopOrderStatistic stat1, ShopOrderStatistic stat2) {
|
||||||
if (stat2 == null) return stat1;
|
if (stat2 == null) {
|
||||||
if (stat1 == null) return stat2;
|
return stat1;
|
||||||
|
}
|
||||||
|
if (stat1 == null) {
|
||||||
|
return stat2;
|
||||||
|
}
|
||||||
|
|
||||||
if(!stat2.getValid()) return stat1;
|
if(!stat2.getValid()) {
|
||||||
if(!stat1.getValid()) return stat2;
|
return stat1;
|
||||||
|
}
|
||||||
|
if(!stat1.getValid()) {
|
||||||
|
return stat2;
|
||||||
|
}
|
||||||
|
|
||||||
ShopOrderStatistic result = new ShopOrderStatistic();
|
ShopOrderStatistic result = new ShopOrderStatistic();
|
||||||
|
|
||||||
@@ -477,8 +549,12 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 安全的BigDecimal相加
|
* 安全的BigDecimal相加
|
||||||
*/
|
*/
|
||||||
private static BigDecimal safeAdd(BigDecimal num1, BigDecimal num2) {
|
private static BigDecimal safeAdd(BigDecimal num1, BigDecimal num2) {
|
||||||
if (num1 == null) return num2;
|
if (num1 == null) {
|
||||||
if (num2 == null) return num1;
|
return num2;
|
||||||
|
}
|
||||||
|
if (num2 == null) {
|
||||||
|
return num1;
|
||||||
|
}
|
||||||
return num1.add(num2);
|
return num1.add(num2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,8 +562,12 @@ public class ShopOrderStatistic implements Serializable {
|
|||||||
* 安全的Long相加
|
* 安全的Long相加
|
||||||
*/
|
*/
|
||||||
private static Long safeAdd(Long num1, Long num2) {
|
private static Long safeAdd(Long num1, Long num2) {
|
||||||
if (num1 == null) return num2;
|
if (num1 == null) {
|
||||||
if (num2 == null) return num1;
|
return num2;
|
||||||
|
}
|
||||||
|
if (num2 == null) {
|
||||||
|
return num1;
|
||||||
|
}
|
||||||
return num1 + num2;
|
return num1 + num2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.czg.order.entity;
|
package com.czg.order.entity;
|
||||||
|
|
||||||
import cn.idev.excel.annotation.ExcelIgnore;
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.mybatisflex.annotation.Column;
|
import com.mybatisflex.annotation.Column;
|
||||||
import com.mybatisflex.annotation.Id;
|
import com.mybatisflex.annotation.Id;
|
||||||
import com.mybatisflex.annotation.KeyType;
|
import com.mybatisflex.annotation.KeyType;
|
||||||
@@ -59,42 +59,42 @@ public class ShopProdStatistic implements Serializable {
|
|||||||
* 销售数量
|
* 销售数量
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("销量")
|
@ExcelProperty("销量")
|
||||||
@ColumnWidth(5)
|
@ColumnWidth(15)
|
||||||
private BigDecimal saleCount;
|
private BigDecimal saleCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销售金额
|
* 销售金额
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("销售金额")
|
@ExcelProperty("销售金额")
|
||||||
@ColumnWidth(7)
|
@ColumnWidth(15)
|
||||||
private BigDecimal saleAmount;
|
private BigDecimal saleAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退单量
|
* 退单量
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("退单量")
|
@ExcelProperty("退单量")
|
||||||
@ColumnWidth(5)
|
@ColumnWidth(15)
|
||||||
private BigDecimal refundCount;
|
private BigDecimal refundCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退单金额
|
* 退单金额
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("退款金额")
|
@ExcelProperty("退款金额")
|
||||||
@ColumnWidth(7)
|
@ColumnWidth(15)
|
||||||
private BigDecimal refundAmount;
|
private BigDecimal refundAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实际销售数量(过滤掉退单后的数量)
|
* 实际销售数量(过滤掉退单后的数量)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("实际销量")
|
@ExcelProperty("实际销量")
|
||||||
@ColumnWidth(5)
|
@ColumnWidth(15)
|
||||||
private BigDecimal validSaleCount;
|
private BigDecimal validSaleCount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实际销售金额(过滤掉退单后的金额)
|
* 实际销售金额(过滤掉退单后的金额)
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("实际销售额")
|
@ExcelProperty("实际销售额")
|
||||||
@ColumnWidth(7)
|
@ColumnWidth(15)
|
||||||
private BigDecimal validSaleAmount;
|
private BigDecimal validSaleAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,11 +17,12 @@ public enum PayEnums {
|
|||||||
/**
|
/**
|
||||||
* 主扫
|
* 主扫
|
||||||
*/
|
*/
|
||||||
MAIN_SCAN("main_scan", "主扫"),
|
MAIN_SCAN("main_scan", "二维码收款"),
|
||||||
/**
|
/**
|
||||||
* 被扫
|
* 被扫
|
||||||
*/
|
*/
|
||||||
BACK_SCAN("back_scan", "被扫"),
|
// BACK_SCAN("back_scan", "被扫"),
|
||||||
|
BACK_SCAN("back_scan", "扫码收款"),
|
||||||
/**
|
/**
|
||||||
* 微信小程序
|
* 微信小程序
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.czg.order.param;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 财务报表查询参数
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FinanceStsQueryParam implements Serializable {
|
||||||
|
|
||||||
|
public interface Query {}
|
||||||
|
public interface Export {}
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询日期 格式:yyyy-MM-dd
|
||||||
|
*/
|
||||||
|
@NotNull(message = "查询日期不能为空", groups = {Export.class, Query.class})
|
||||||
|
private LocalDate queryDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 平台
|
||||||
|
* czg 自己
|
||||||
|
* MTuan 美团
|
||||||
|
* CMeMe 菜么么
|
||||||
|
* KRuYun 客如云
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "平台不能为空", groups = {Export.class})
|
||||||
|
private String platform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
/**
|
||||||
|
* 主店id
|
||||||
|
*/
|
||||||
|
private Long mainShopId;
|
||||||
|
|
||||||
|
public boolean notValidDateRange() {
|
||||||
|
if (queryDate == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查开始日期是否晚于结束日期
|
||||||
|
return queryDate.isAfter(LocalDate.now());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.czg.order.service;
|
||||||
|
|
||||||
|
import com.czg.order.dto.FinanceStsDTO;
|
||||||
|
import com.czg.order.param.FinanceStsQueryParam;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:10
|
||||||
|
*/
|
||||||
|
public interface FinanceStsService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询财务统计
|
||||||
|
*/
|
||||||
|
FinanceStsDTO getFinanceSts(FinanceStsQueryParam param);
|
||||||
|
|
||||||
|
void exportFinanceSts(FinanceStsQueryParam param, HttpServletResponse response);
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.czg.order.service;
|
|||||||
|
|
||||||
import com.czg.order.param.TableSummaryParam;
|
import com.czg.order.param.TableSummaryParam;
|
||||||
import com.czg.order.vo.TableSummaryExportVo;
|
import com.czg.order.vo.TableSummaryExportVo;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ import java.util.List;
|
|||||||
public interface TableSummaryService {
|
public interface TableSummaryService {
|
||||||
|
|
||||||
|
|
||||||
List<TableSummaryExportVo> summaryExportList(TableSummaryParam param);
|
void summaryExportList(TableSummaryParam param, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.czg.order.vo;
|
package com.czg.order.vo;
|
||||||
|
|
||||||
import cn.idev.excel.annotation.ExcelIgnore;
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
import cn.idev.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import cn.idev.excel.annotation.write.style.ColumnWidth;
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.alibaba.fastjson2.annotation.JSONField;
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
import com.pig4cloud.plugin.excel.annotation.ExcelLine;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -25,7 +24,6 @@ public class TableSummaryExportVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 导入时候回显行号
|
* 导入时候回显行号
|
||||||
*/
|
*/
|
||||||
@ExcelLine
|
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
@JSONField(serialize = false)
|
@JSONField(serialize = false)
|
||||||
private Long lineNum;
|
private Long lineNum;
|
||||||
@@ -36,18 +34,20 @@ public class TableSummaryExportVo implements Serializable {
|
|||||||
private String tableConcatDate;
|
private String tableConcatDate;
|
||||||
@ExcelIgnore
|
@ExcelIgnore
|
||||||
private String tableCode;
|
private String tableCode;
|
||||||
/**
|
|
||||||
* 台桌
|
|
||||||
*/
|
|
||||||
@ExcelProperty("台桌")
|
|
||||||
@ColumnWidth(10)
|
|
||||||
private String tableName;
|
|
||||||
/**
|
/**
|
||||||
* 日期
|
* 日期
|
||||||
*/
|
*/
|
||||||
@ExcelProperty("日期")
|
@ExcelProperty("日期")
|
||||||
@ColumnWidth(10)
|
@ColumnWidth(15)
|
||||||
private String createDate;
|
private String createDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 台桌
|
||||||
|
*/
|
||||||
|
@ExcelProperty("台桌")
|
||||||
|
@ColumnWidth(13)
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品分类
|
* 商品分类
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.czg.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/30 18:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductCategoryExportDTO {
|
||||||
|
|
||||||
|
@ExcelProperty("分类名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
@ExcelProperty("简称")
|
||||||
|
private String shortName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.czg.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品导出
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/28 14:30
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductExportDTO {
|
||||||
|
|
||||||
|
@ExcelProperty("商品名称")
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("商品分类")
|
||||||
|
@ColumnWidth(15)
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@ExcelProperty("条码")
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String barCode;
|
||||||
|
|
||||||
|
@ExcelProperty("商品规格")
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String specFullName;
|
||||||
|
|
||||||
|
@ExcelProperty("售价")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private BigDecimal price;
|
||||||
|
@ExcelProperty("会员价")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private BigDecimal memberPrice;
|
||||||
|
@ExcelProperty("成本价")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private BigDecimal costPrice;
|
||||||
|
|
||||||
|
@ExcelProperty("商品单位")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
||||||
|
*/
|
||||||
|
@ExcelProperty("商品类型")
|
||||||
|
@ColumnWidth(15)
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可用开始时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty("可用开始时间")
|
||||||
|
@ColumnWidth(16)
|
||||||
|
private LocalTime startTime;
|
||||||
|
/**
|
||||||
|
* 可用结束时间
|
||||||
|
*/
|
||||||
|
@ExcelProperty("可用结束时间")
|
||||||
|
@ColumnWidth(16)
|
||||||
|
private LocalTime endTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品级库存数量
|
||||||
|
*/
|
||||||
|
@ExcelProperty("库存数量")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private Integer stockNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否上架
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer isSale;
|
||||||
|
@ExcelProperty("是否上架")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private String isSaleRemark;
|
||||||
|
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return switch (type) {
|
||||||
|
case "single" -> "单规格商品";
|
||||||
|
case "sku" -> "多规格商品";
|
||||||
|
case "package" -> "套餐商品";
|
||||||
|
case "weight" -> "称重商品";
|
||||||
|
case "coupon" -> "团购券";
|
||||||
|
case null, default -> "未知类型";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsSaleRemark() {
|
||||||
|
return switch (isSale) {
|
||||||
|
case 0 -> "下架";
|
||||||
|
case 1 -> "上架";
|
||||||
|
case null, default -> "未知状态";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.czg.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐商品导出
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/30 10:26
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ProductPackageExportDTO {
|
||||||
|
|
||||||
|
@ExcelProperty("套餐名称")
|
||||||
|
@ColumnWidth(20)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("套餐分类")
|
||||||
|
@ColumnWidth(15)
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@ExcelProperty("售价")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private BigDecimal price;
|
||||||
|
@ExcelProperty("会员价")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private BigDecimal memberPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品类型 single-单规格商品 sku-多规格商品 package-套餐商品 weight-称重商品 coupon-团购券
|
||||||
|
*/
|
||||||
|
@ExcelIgnore()
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐类型 0 固定套餐 1可选套餐
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer groupType;
|
||||||
|
@ExcelProperty("套餐类型")
|
||||||
|
@ColumnWidth(15)
|
||||||
|
private String groupTypeRemark;
|
||||||
|
|
||||||
|
@ExcelProperty("组名称")
|
||||||
|
@ColumnWidth(15)
|
||||||
|
private String groupTitleName;
|
||||||
|
|
||||||
|
@ExcelProperty("商品名称")
|
||||||
|
@ColumnWidth(21)
|
||||||
|
private String groupProductName;
|
||||||
|
|
||||||
|
@ExcelProperty("商品单位")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private String unitName;
|
||||||
|
|
||||||
|
@ExcelProperty("套餐内选择数量")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private String groupProductNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品级库存数量
|
||||||
|
*/
|
||||||
|
@ExcelProperty("库存数量")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private Integer stockNumber;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否上架
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer isSale;
|
||||||
|
@ExcelProperty("是否上架")
|
||||||
|
@ColumnWidth(10)
|
||||||
|
private String isSaleRemark;
|
||||||
|
|
||||||
|
public String getGroupTypeRemark() {
|
||||||
|
if (!"package".equals(type)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return switch (groupType) {
|
||||||
|
case 0 -> "固定套餐";
|
||||||
|
case 1 -> "可选套餐";
|
||||||
|
case null, default -> "未知类型";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsSaleRemark() {
|
||||||
|
return switch (isSale) {
|
||||||
|
case 0 -> "下架";
|
||||||
|
case 1 -> "上架";
|
||||||
|
case null, default -> "未知状态";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.czg.product.dto;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品单位导出
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/30 17:51
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ProductUnitExportDTO {
|
||||||
|
|
||||||
|
@ExcelProperty("单位名称")
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 单位类型 number-计数 weight-记重
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private String unitType;
|
||||||
|
@ExcelProperty("单位类型")
|
||||||
|
private String unitTypeRemark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位来源 1-系统预设 0-商家创建
|
||||||
|
*/
|
||||||
|
@ExcelIgnore
|
||||||
|
private Integer isSystem;
|
||||||
|
@ExcelProperty("单位来源")
|
||||||
|
private String isSystemRemark;
|
||||||
|
|
||||||
|
public String getUnitTypeRemark() {
|
||||||
|
return "number".equals(unitType) ? "计数" : "记重";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsSystemRemark() {
|
||||||
|
return isSystem == 1 ? "系统预设" : "商家创建";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.czg.product.service;
|
package com.czg.product.service;
|
||||||
|
|
||||||
import com.czg.product.dto.ProductDTO;
|
import com.czg.product.dto.ProductDTO;
|
||||||
import com.czg.product.dto.RelatedProductDTO;
|
|
||||||
import com.czg.product.entity.Product;
|
import com.czg.product.entity.Product;
|
||||||
import com.czg.product.entity.ProductStockFlow;
|
import com.czg.product.entity.ProductStockFlow;
|
||||||
import com.czg.product.param.*;
|
import com.czg.product.param.*;
|
||||||
import com.czg.product.vo.ProductStatisticsVo;
|
import com.czg.product.vo.ProductStatisticsVo;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -34,6 +34,8 @@ public interface ProductService extends IService<Product> {
|
|||||||
*/
|
*/
|
||||||
List<ProductDTO> getProductList(ProductDTO param);
|
List<ProductDTO> getProductList(ProductDTO param);
|
||||||
|
|
||||||
|
void exportProductList(ProductDTO param, HttpServletResponse response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从缓存里面获取商品列表
|
* 从缓存里面获取商品列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.czg.product.dto.ShopProdCategoryDTO;
|
|||||||
import com.czg.product.entity.ShopProdCategory;
|
import com.czg.product.entity.ShopProdCategory;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -30,6 +31,8 @@ public interface ShopProdCategoryService extends IService<ShopProdCategory> {
|
|||||||
*/
|
*/
|
||||||
List<ShopProdCategoryDTO> getShopProdCategoryList(ShopProdCategoryDTO param);
|
List<ShopProdCategoryDTO> getShopProdCategoryList(ShopProdCategoryDTO param);
|
||||||
|
|
||||||
|
void exportShopProdCategory(ShopProdCategoryDTO param, HttpServletResponse response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取店铺商品分类详情
|
* 获取店铺商品分类详情
|
||||||
* @param id id
|
* @param id id
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.czg.product.dto.ShopProdUnitDTO;
|
|||||||
import com.czg.product.entity.ShopProdUnit;
|
import com.czg.product.entity.ShopProdUnit;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -31,6 +32,8 @@ public interface ShopProdUnitService extends IService<ShopProdUnit> {
|
|||||||
*/
|
*/
|
||||||
List<ShopProdUnitDTO> getShopProdUnitList(ShopProdUnitDTO param);
|
List<ShopProdUnitDTO> getShopProdUnitList(ShopProdUnitDTO param);
|
||||||
|
|
||||||
|
void exportShopProdUnit(ShopProdUnitDTO param, HttpServletResponse response);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取商品单位详情
|
* 获取商品单位详情
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -95,6 +95,11 @@
|
|||||||
<artifactId>mybatis-flex-processor</artifactId>
|
<artifactId>mybatis-flex-processor</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.czg.excel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据提供者接口(用于分批获取数据)
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/28 10:51
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface DataSupplier<T> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定页的数据
|
||||||
|
*
|
||||||
|
* @param pageNum 页码
|
||||||
|
* @param pageSize 每页大小
|
||||||
|
* @return 数据列表
|
||||||
|
*/
|
||||||
|
List<T> getData(int pageNum, int pageSize);
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.czg.excel;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Excel导出配置类
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/28 10:47
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ExcelExportConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认工作表名称
|
||||||
|
*/
|
||||||
|
private String defaultSheetName = "Sheet1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认文件名
|
||||||
|
*/
|
||||||
|
private String defaultFileName = "export_data";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自动关闭流
|
||||||
|
*/
|
||||||
|
private boolean autoCloseStream = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应头编码
|
||||||
|
*/
|
||||||
|
private String charset = "UTF-8";
|
||||||
|
|
||||||
|
public ExcelExportConfig() {}
|
||||||
|
|
||||||
|
public ExcelExportConfig(String defaultSheetName, String defaultFileName) {
|
||||||
|
this.defaultSheetName = defaultSheetName;
|
||||||
|
this.defaultFileName = defaultFileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,324 @@
|
|||||||
|
package com.czg.excel;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
|
import com.alibaba.excel.ExcelWriter;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
|
import com.alibaba.excel.write.builder.ExcelWriterBuilder;
|
||||||
|
import com.alibaba.excel.write.builder.ExcelWriterSheetBuilder;
|
||||||
|
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||||
|
import com.alibaba.excel.write.merge.OnceAbsoluteMergeStrategy;
|
||||||
|
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||||
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||||
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||||
|
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* EasyExcel导出工具类
|
||||||
|
*
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/28 10:48
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class ExcelExportUtil {
|
||||||
|
|
||||||
|
private static final ExcelExportConfig DEFAULT_CONFIG = new ExcelExportConfig();
|
||||||
|
|
||||||
|
public static OnceAbsoluteMergeStrategy createMergeStrategy(int firstRow, int lastRow, int firstCol, int lastCol) {
|
||||||
|
return new OnceAbsoluteMergeStrategy(firstRow, lastRow, firstCol, lastCol);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel到HttpServletResponse
|
||||||
|
*
|
||||||
|
* @param data 数据列表
|
||||||
|
* @param clazz 数据类型
|
||||||
|
* @param fileName 文件名(不含扩展名)
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public static <T> void exportToResponse(List<T> data, Class<T> clazz,
|
||||||
|
String fileName, HttpServletResponse response) {
|
||||||
|
exportToResponse(data, clazz, fileName, DEFAULT_CONFIG, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel到HttpServletResponse(自定义配置)
|
||||||
|
*
|
||||||
|
* @param data 数据列表
|
||||||
|
* @param clazz 数据类型
|
||||||
|
* @param fileName 文件名(不含扩展名)
|
||||||
|
* @param config 配置信息
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public static <T> void exportToResponse(List<T> data, Class<T> clazz,
|
||||||
|
String fileName, ExcelExportConfig config,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
if (data == null) {
|
||||||
|
data = Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
setResponseHeader(response, fileName, config);
|
||||||
|
|
||||||
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
|
ExcelWriter excelWriter = EasyExcel.write(outputStream, clazz)
|
||||||
|
.autoCloseStream(config.isAutoCloseStream())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
WriteSheet writeSheet = EasyExcel.writerSheet(config.getDefaultSheetName()).build();
|
||||||
|
excelWriter.write(data, writeSheet);
|
||||||
|
excelWriter.finish();
|
||||||
|
|
||||||
|
log.info("Excel导出成功,文件名:{},数据量:{}", fileName, data.size());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("Excel导出失败", e);
|
||||||
|
throw new CzgException("Excel导出失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel到文件
|
||||||
|
*
|
||||||
|
* @param data 数据列表
|
||||||
|
* @param clazz 数据类型
|
||||||
|
* @param filePath 文件路径
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public static <T> void exportToFile(List<T> data, Class<T> clazz, String filePath) {
|
||||||
|
exportToFile(data, clazz, filePath, DEFAULT_CONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出Excel到文件(自定义配置)
|
||||||
|
*
|
||||||
|
* @param data 数据列表
|
||||||
|
* @param clazz 数据类型
|
||||||
|
* @param filePath 文件路径
|
||||||
|
* @param config 配置信息
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public static <T> void exportToFile(List<T> data, Class<T> clazz,
|
||||||
|
String filePath, ExcelExportConfig config) {
|
||||||
|
if (data == null) {
|
||||||
|
data = Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
EasyExcel.write(filePath, clazz)
|
||||||
|
.sheet(config.getDefaultSheetName())
|
||||||
|
.doWrite(data);
|
||||||
|
log.info("Excel文件导出成功,路径:{},数据量:{}", filePath, data.size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Excel文件导出失败", e);
|
||||||
|
throw new CzgException("Excel文件导出失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带样式的Excel导出到Response
|
||||||
|
*
|
||||||
|
* @param data 数据列表
|
||||||
|
* @param clazz 数据类型
|
||||||
|
* @param fileName 文件名
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public static <T> void exportWithStyleToResponse(List<T> data, Class<T> clazz,
|
||||||
|
String fileName, HttpServletResponse response) {
|
||||||
|
if (data == null) {
|
||||||
|
data = Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
setResponseHeader(response, fileName, DEFAULT_CONFIG);
|
||||||
|
|
||||||
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
|
// 设置表格样式
|
||||||
|
HorizontalCellStyleStrategy styleStrategy = createCellStyleStrategy();
|
||||||
|
|
||||||
|
ExcelWriter excelWriter = EasyExcel.write(outputStream, clazz)
|
||||||
|
.registerWriteHandler(styleStrategy)
|
||||||
|
.autoCloseStream(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
WriteSheet writeSheet = EasyExcel.writerSheet(DEFAULT_CONFIG.getDefaultSheetName()).build();
|
||||||
|
excelWriter.write(data, writeSheet);
|
||||||
|
excelWriter.finish();
|
||||||
|
|
||||||
|
log.info("带样式Excel导出成功,文件名:{},数据量:{}", fileName, data.size());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("带样式Excel导出失败", e);
|
||||||
|
throw new CzgException("Excel导出失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大数据量分批导出(避免内存溢出)
|
||||||
|
*
|
||||||
|
* @param dataSupplier 数据提供者(分页获取数据)
|
||||||
|
* @param clazz 数据类型
|
||||||
|
* @param fileName 文件名
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
* @param batchSize 每批大小
|
||||||
|
* @param <T> 数据类型
|
||||||
|
*/
|
||||||
|
public static <T> void exportBigDataToResponse(DataSupplier<T> dataSupplier,
|
||||||
|
Class<T> clazz, String fileName,
|
||||||
|
HttpServletResponse response, int batchSize) {
|
||||||
|
setResponseHeader(response, fileName, DEFAULT_CONFIG);
|
||||||
|
|
||||||
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
|
ExcelWriter excelWriter = EasyExcel.write(outputStream, clazz)
|
||||||
|
.autoCloseStream(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
WriteSheet writeSheet = EasyExcel.writerSheet(DEFAULT_CONFIG.getDefaultSheetName()).build();
|
||||||
|
|
||||||
|
int pageNum = 1;
|
||||||
|
List<T> batchData;
|
||||||
|
boolean hasNext = true;
|
||||||
|
|
||||||
|
while (hasNext) {
|
||||||
|
batchData = dataSupplier.getData(pageNum, batchSize);
|
||||||
|
if (batchData != null && !batchData.isEmpty()) {
|
||||||
|
excelWriter.write(batchData, writeSheet);
|
||||||
|
pageNum++;
|
||||||
|
} else {
|
||||||
|
hasNext = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
excelWriter.finish();
|
||||||
|
log.info("大数据量Excel导出成功,文件名:{},总页数:{}", fileName, pageNum - 1);
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("大数据量Excel导出失败", e);
|
||||||
|
throw new CzgException("Excel导出失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置响应头
|
||||||
|
*/
|
||||||
|
private static void setResponseHeader(HttpServletResponse response, String fileName, ExcelExportConfig config) {
|
||||||
|
try {
|
||||||
|
String encodedFileName = URLEncoder.encode(fileName, config.getCharset())
|
||||||
|
.replaceAll("\\+", "%20");
|
||||||
|
String contentDisposition = "attachment;filename*=utf-8''" + encodedFileName + ".xlsx";
|
||||||
|
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||||
|
response.setCharacterEncoding(config.getCharset());
|
||||||
|
response.setHeader("Content-Disposition", contentDisposition);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("设置响应头失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建表格样式策略
|
||||||
|
*/
|
||||||
|
private static HorizontalCellStyleStrategy createCellStyleStrategy() {
|
||||||
|
// 表头样式
|
||||||
|
WriteCellStyle headStyle = new WriteCellStyle();
|
||||||
|
headStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||||
|
headStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
|
||||||
|
// 内容样式
|
||||||
|
WriteCellStyle contentStyle = new WriteCellStyle();
|
||||||
|
contentStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
|
||||||
|
contentStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
|
||||||
|
return new HorizontalCellStyleStrategy(headStyle, contentStyle);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据总行数(用于前端显示进度)
|
||||||
|
*/
|
||||||
|
public static <T> int getDataCount(Class<T> clazz) {
|
||||||
|
Field[] fields = clazz.getDeclaredFields();
|
||||||
|
int count = 0;
|
||||||
|
for (Field field : fields) {
|
||||||
|
if (field.isAnnotationPresent(ExcelProperty.class)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 带合并单元格的导出到Response
|
||||||
|
* 多sheet导出到response
|
||||||
|
*
|
||||||
|
* @param sheetDataList 数据列表
|
||||||
|
* @param fileName 文件名
|
||||||
|
* @param response HttpServletResponse
|
||||||
|
*/
|
||||||
|
public static void exportMultipleSheetsToResponse(List<SheetData> sheetDataList,
|
||||||
|
String fileName,
|
||||||
|
HttpServletResponse response) {
|
||||||
|
if (CollectionUtil.isEmpty(sheetDataList)) {
|
||||||
|
throw new CzgException("数据列表不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
setResponseHeader(response, fileName, DEFAULT_CONFIG);
|
||||||
|
|
||||||
|
try (OutputStream outputStream = response.getOutputStream()) {
|
||||||
|
// 创建样式策略
|
||||||
|
WriteCellStyle headStyle = new WriteCellStyle();
|
||||||
|
headStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
|
||||||
|
headStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
|
||||||
|
WriteCellStyle contentStyle = new WriteCellStyle();
|
||||||
|
contentStyle.setHorizontalAlignment(HorizontalAlignment.LEFT);
|
||||||
|
contentStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
|
||||||
|
HorizontalCellStyleStrategy styleStrategy = new HorizontalCellStyleStrategy(headStyle, contentStyle);
|
||||||
|
|
||||||
|
// 创建ExcelWriter
|
||||||
|
ExcelWriterBuilder builder = EasyExcel.write(outputStream)
|
||||||
|
.autoCloseStream(true)
|
||||||
|
.registerConverter(new LocalTimeConverter())
|
||||||
|
.registerWriteHandler(styleStrategy);
|
||||||
|
|
||||||
|
ExcelWriter excelWriter = builder.build();
|
||||||
|
|
||||||
|
// 逐个写入sheet
|
||||||
|
for (int i = 0; i < sheetDataList.size(); i++) {
|
||||||
|
SheetData sheetData = sheetDataList.get(i);
|
||||||
|
String sheetName = StrUtil.isNotBlank(sheetData.getSheetName())
|
||||||
|
? sheetData.getSheetName()
|
||||||
|
: DEFAULT_CONFIG.getDefaultSheetName() + (i + 1);
|
||||||
|
|
||||||
|
ExcelWriterSheetBuilder sheetBuilder = EasyExcel.writerSheet(sheetName);
|
||||||
|
|
||||||
|
// 注册该sheet的合并处理器
|
||||||
|
if (sheetData.getHandlers() != null && !sheetData.getHandlers().isEmpty()) {
|
||||||
|
for (SheetWriteHandler handler : sheetData.getHandlers()) {
|
||||||
|
sheetBuilder.registerWriteHandler(handler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteSheet writeSheet = sheetBuilder.head(sheetData.getClazz()).build();
|
||||||
|
excelWriter.write(sheetData.getData(), writeSheet);
|
||||||
|
}
|
||||||
|
|
||||||
|
excelWriter.finish();
|
||||||
|
log.info("多sheet商品Excel导出成功,文件名:{},共{}个sheet", fileName, sheetDataList.size());
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("多sheet商品Excel导出失败", e);
|
||||||
|
throw new CzgException("Excel导出失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.czg.excel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.converters.Converter;
|
||||||
|
import com.alibaba.excel.enums.CellDataTypeEnum;
|
||||||
|
import com.alibaba.excel.metadata.GlobalConfiguration;
|
||||||
|
import com.alibaba.excel.metadata.data.ReadCellData;
|
||||||
|
import com.alibaba.excel.metadata.data.WriteCellData;
|
||||||
|
import com.alibaba.excel.metadata.property.ExcelContentProperty;
|
||||||
|
|
||||||
|
import java.time.LocalTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/28 16:16
|
||||||
|
*/
|
||||||
|
public class LocalTimeConverter implements Converter<LocalTime> {
|
||||||
|
|
||||||
|
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("HH:mm:ss");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<LocalTime> supportJavaTypeKey() {
|
||||||
|
return LocalTime.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CellDataTypeEnum supportExcelTypeKey() {
|
||||||
|
return CellDataTypeEnum.STRING;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalTime convertToJavaData(ReadCellData<?> cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||||
|
String stringValue = cellData.getStringValue();
|
||||||
|
if (stringValue == null || stringValue.trim().isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return LocalTime.parse(stringValue, FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WriteCellData<?> convertToExcelData(LocalTime value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) {
|
||||||
|
if (value == null) {
|
||||||
|
return new WriteCellData<>("");
|
||||||
|
}
|
||||||
|
return new WriteCellData<>(value.format(FORMATTER));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.czg.excel;
|
||||||
|
|
||||||
|
import com.alibaba.excel.write.handler.SheetWriteHandler;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 多sheet导出数据封装类
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/1/30 10:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SheetData {
|
||||||
|
private List<?> data;
|
||||||
|
private Class<?> clazz;
|
||||||
|
private String sheetName;
|
||||||
|
private List<SheetWriteHandler> handlers;
|
||||||
|
}
|
||||||
@@ -44,6 +44,7 @@
|
|||||||
<netty.version>4.1.128.Final</netty.version>
|
<netty.version>4.1.128.Final</netty.version>
|
||||||
<wechatpay.version>0.2.17</wechatpay.version>
|
<wechatpay.version>0.2.17</wechatpay.version>
|
||||||
<apipay-v3.version>3.1.65.ALL</apipay-v3.version>
|
<apipay-v3.version>3.1.65.ALL</apipay-v3.version>
|
||||||
|
<easyexcel.version>4.0.3</easyexcel.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
@@ -249,13 +250,6 @@
|
|||||||
<artifactId>spring-data-redis</artifactId>
|
<artifactId>spring-data-redis</artifactId>
|
||||||
<version>${spring-data-redis.version}</version>
|
<version>${spring-data-redis.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- excel 导入导出工具类:https://github.com/pig-mesh/excel-spring-boot-starter -->
|
|
||||||
<!-- 参考文档:https://www.yuque.com/pig4cloud/excel -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.pig4cloud.excel</groupId>
|
|
||||||
<artifactId>excel-spring-boot-starter</artifactId>
|
|
||||||
<version>3.4.0</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
|
<!-- https://mvnrepository.com/artifact/io.netty/netty-all -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -282,6 +276,12 @@
|
|||||||
<artifactId>alipay-sdk-java-v3</artifactId>
|
<artifactId>alipay-sdk-java-v3</artifactId>
|
||||||
<version>${apipay-v3.version}</version>
|
<version>${apipay-v3.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>${easyexcel.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
@@ -384,8 +384,8 @@ public class EntryManager {
|
|||||||
// verifyEntryParam(merchantDto);
|
// verifyEntryParam(merchantDto);
|
||||||
// uploadParamImage(merchantDto);
|
// uploadParamImage(merchantDto);
|
||||||
//// System.out.println(merchantDto);
|
//// System.out.println(merchantDto);
|
||||||
EntryRespDto respDto = entryMerchant(merchantDto, PayCst.Type.WECHAT);
|
// EntryRespDto respDto = entryMerchant(merchantDto, PayCst.Type.WECHAT);
|
||||||
// entryMerchant(merchantDto, PayCst.Type.ALIPAY);
|
EntryRespDto respDto = entryMerchant(merchantDto, PayCst.Type.ALIPAY);
|
||||||
// entryMerchant(merchantDto, PayCst.Type.WECHAT, PayCst.Type.ALIPAY);
|
// entryMerchant(merchantDto, PayCst.Type.WECHAT, PayCst.Type.ALIPAY);
|
||||||
System.out.println(respDto);
|
System.out.println(respDto);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.czg.third.alipay;
|
package com.czg.third.alipay;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alipay.v3.ApiException;
|
import com.alipay.v3.ApiException;
|
||||||
import com.alipay.v3.api.*;
|
import com.alipay.v3.api.*;
|
||||||
@@ -110,7 +111,10 @@ public class AlipayIsvEntryManager {
|
|||||||
respDto.setEntryId(batchNo);
|
respDto.setEntryId(batchNo);
|
||||||
|
|
||||||
AlipayOpenAgentFacetofaceSignModel signModel = buildFaceToFaceModel(reqDto, batchNo);
|
AlipayOpenAgentFacetofaceSignModel signModel = buildFaceToFaceModel(reqDto, batchNo);
|
||||||
File businessLicensePic = UploadFileUtil.getFileByUrl(reqDto.getBusinessLicenceInfo().getLicensePic().getUrl());
|
File businessLicensePic = null;
|
||||||
|
if (reqDto.getBusinessLicenceInfo() != null && reqDto.getBusinessLicenceInfo().getLicensePic() != null && StrUtil.isNotBlank(reqDto.getBusinessLicenceInfo().getLicensePic().getUrl())) {
|
||||||
|
businessLicensePic = UploadFileUtil.getFileByUrl(reqDto.getBusinessLicenceInfo().getLicensePic().getUrl());
|
||||||
|
}
|
||||||
File shopScenePic = UploadFileUtil.getFileByUrl(reqDto.getStoreInfo().getInsidePic().getUrl());
|
File shopScenePic = UploadFileUtil.getFileByUrl(reqDto.getStoreInfo().getInsidePic().getUrl());
|
||||||
File shopSignBoardPic = UploadFileUtil.getFileByUrl(reqDto.getStoreInfo().getDoorPic().getUrl());
|
File shopSignBoardPic = UploadFileUtil.getFileByUrl(reqDto.getStoreInfo().getDoorPic().getUrl());
|
||||||
|
|
||||||
@@ -237,10 +241,12 @@ public class AlipayIsvEntryManager {
|
|||||||
signModel.setRate("0.38");
|
signModel.setRate("0.38");
|
||||||
signModel.setSignAndAuth(true);
|
signModel.setSignAndAuth(true);
|
||||||
|
|
||||||
|
if (licenceInfo != null) {
|
||||||
signModel.setBusinessLicenseNo(licenceInfo.getLicenceNo());
|
signModel.setBusinessLicenseNo(licenceInfo.getLicenceNo());
|
||||||
signModel.setBusinessLicenseMobile(legalPersonInfo.getLegalPersonPhone());
|
signModel.setBusinessLicenseMobile(legalPersonInfo.getLegalPersonPhone());
|
||||||
signModel.setLongTerm(PayCst.LONG_TERM_DATE.equals(licenceInfo.getLicenceEndDate()));
|
signModel.setLongTerm(PayCst.LONG_TERM_DATE.equals(licenceInfo.getLicenceEndDate()));
|
||||||
signModel.setDateLimitation(licenceInfo.getLicenceStartDate());
|
signModel.setDateLimitation(licenceInfo.getLicenceStartDate());
|
||||||
|
}
|
||||||
|
|
||||||
signModel.setShopName(baseInfo.getShortName());
|
signModel.setShopName(baseInfo.getShortName());
|
||||||
|
|
||||||
@@ -258,6 +264,32 @@ public class AlipayIsvEntryManager {
|
|||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
// confirmRequest("2026010815384505500018243");
|
// confirmRequest("2026010815384505500018243");
|
||||||
queryMerchantBatchStatus(null, "2026010815384505500018243");
|
queryMerchantBatchStatus(null, "2026012310512107600067177");
|
||||||
|
|
||||||
|
// AggregateMerchantDto merchantDto = new AggregateMerchantDto();
|
||||||
|
// merchantDto.setMerchantCode("CZG20260112151202099");
|
||||||
|
//
|
||||||
|
// MerchantBaseInfoDto baseInfoDto = new MerchantBaseInfoDto();
|
||||||
|
// baseInfoDto.setUserType("3");
|
||||||
|
// baseInfoDto.setShortName("巩奕杰_商户");
|
||||||
|
// baseInfoDto.setMccCode("A0001_B0199");
|
||||||
|
// baseInfoDto.setAlipayAccount("15596653310");
|
||||||
|
// baseInfoDto.setContactPersonType("SUPER");
|
||||||
|
// baseInfoDto.setContactName("巩奕杰");
|
||||||
|
// baseInfoDto.setCertType("0");
|
||||||
|
// baseInfoDto.setContactPhone("15596653310");
|
||||||
|
// baseInfoDto.setContactEmail("sankejuzi@163.com");
|
||||||
|
// merchantDto.setMerchantBaseInfo(baseInfoDto);
|
||||||
|
//
|
||||||
|
// StoreInfoDto storeInfoDto = new StoreInfoDto();
|
||||||
|
// storeInfoDto.setBusinessAddress("陕西省西安市浐灞欧亚国际");
|
||||||
|
// storeInfoDto.setMercAreaCode("610113");
|
||||||
|
// storeInfoDto.setMercProvCode("610000");
|
||||||
|
// storeInfoDto.setMercCityCode("610100");
|
||||||
|
// storeInfoDto.setDoorPic(new ImageDto().setUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/2c207c6f4a764ad18e501ed10fbfad59.png"));
|
||||||
|
// storeInfoDto.setInsidePic(new ImageDto().setUrl("https://cashier-oss.oss-cn-beijing.aliyuncs.com/upload/1/394b4834698a47e9b75419a5fd7f7de7.jpg"));
|
||||||
|
// merchantDto.setStoreInfo(storeInfoDto);
|
||||||
|
//
|
||||||
|
// entryMerchant(null, merchantDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,8 +313,8 @@ public class WechatEntryManager {
|
|||||||
bizStoreInfo.setBizStoreName(baseInfo.getShortName());
|
bizStoreInfo.setBizStoreName(baseInfo.getShortName());
|
||||||
bizStoreInfo.setBizAddressCode(storeInfo.getMercAreaCode());
|
bizStoreInfo.setBizAddressCode(storeInfo.getMercAreaCode());
|
||||||
bizStoreInfo.setBizStoreAddress(storeInfo.getBusinessAddress());
|
bizStoreInfo.setBizStoreAddress(storeInfo.getBusinessAddress());
|
||||||
bizStoreInfo.setStoreEntrancePic(storeInfo.getDoorPic().getWechatId());
|
bizStoreInfo.setStoreEntrancePic(List.of(storeInfo.getDoorPic().getWechatId()));
|
||||||
bizStoreInfo.setIndoorPic(storeInfo.getInsidePic().getWechatId());
|
bizStoreInfo.setIndoorPic(List.of(storeInfo.getInsidePic().getWechatId()));
|
||||||
salesInfo.setBizStoreInfo(bizStoreInfo);
|
salesInfo.setBizStoreInfo(bizStoreInfo);
|
||||||
WechatEntryMiniProgramReqDto miniProgramInfo = new WechatEntryMiniProgramReqDto();
|
WechatEntryMiniProgramReqDto miniProgramInfo = new WechatEntryMiniProgramReqDto();
|
||||||
miniProgramInfo.setMiniProgramAppid("wxd88fffa983758a30");
|
miniProgramInfo.setMiniProgramAppid("wxd88fffa983758a30");
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ public class WechatEntryStoreInfoReqDto {
|
|||||||
* 2、请填写通过图片上传API预先上传图片生成好的MediaID。
|
* 2、请填写通过图片上传API预先上传图片生成好的MediaID。
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "store_entrance_pic")
|
@JSONField(name = "store_entrance_pic")
|
||||||
// private List<String> storeEntrancePic;
|
private List<String> storeEntrancePic;
|
||||||
private String storeEntrancePic;
|
// private String storeEntrancePic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【必填】
|
* 【必填】
|
||||||
@@ -65,8 +65,8 @@ public class WechatEntryStoreInfoReqDto {
|
|||||||
* 2、请填写通过图片上传API预先上传图片生成好的MediaID。
|
* 2、请填写通过图片上传API预先上传图片生成好的MediaID。
|
||||||
*/
|
*/
|
||||||
@JSONField(name = "indoor_pic")
|
@JSONField(name = "indoor_pic")
|
||||||
// private List<String> indoorPic;
|
private List<String> indoorPic;
|
||||||
private String indoorPic;
|
// private String indoorPic;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【选填】
|
* 【选填】
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.czg.account.dto.shopuser.*;
|
import com.czg.account.dto.shopuser.*;
|
||||||
|
import com.czg.account.entity.ShopInfo;
|
||||||
import com.czg.account.entity.ShopUser;
|
import com.czg.account.entity.ShopUser;
|
||||||
import com.czg.account.entity.UserInfo;
|
import com.czg.account.entity.UserInfo;
|
||||||
import com.czg.account.service.AShopUserService;
|
import com.czg.account.service.AShopUserService;
|
||||||
import com.czg.account.service.ShopInfoService;
|
import com.czg.account.service.ShopInfoService;
|
||||||
import com.czg.account.service.ShopUserService;
|
import com.czg.account.service.ShopUserService;
|
||||||
import com.czg.account.service.UserInfoService;
|
import com.czg.account.service.UserInfoService;
|
||||||
|
import com.czg.excel.ExcelExportUtil;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.market.entity.MemberLevelConfig;
|
import com.czg.market.entity.MemberLevelConfig;
|
||||||
import com.czg.market.entity.MkShopCouponRecord;
|
import com.czg.market.entity.MkShopCouponRecord;
|
||||||
@@ -28,6 +30,7 @@ import com.github.pagehelper.PageInfo;
|
|||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -124,6 +127,17 @@ public class AShopUserServiceImpl implements AShopUserService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportUserList(String key, Integer isVip, HttpServletResponse response) {
|
||||||
|
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
|
||||||
|
ShopInfo shopInfo = shopInfoService.getById(StpKit.USER.getShopId());
|
||||||
|
List<ShopUserDTO> dtoList = shopUserMapper.selectPageByKeyAndIsVip(mainIdByShopId, isVip, key, null);
|
||||||
|
|
||||||
|
// 将 dtoList 转换为 ShopUserExportDTO 列表
|
||||||
|
List<ShopUserExportDTO> exportList = BeanUtil.copyToList(dtoList, ShopUserExportDTO.class);
|
||||||
|
ExcelExportUtil.exportToResponse(exportList, ShopUserExportDTO.class, shopInfo == null ? "店铺用户列表" : shopInfo.getShopName() + "_用户列表", response);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO) {
|
public Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO) {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.czg.service.account.service.impl;
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.czg.account.service.GeoService;
|
import com.czg.account.service.GeoService;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.web.client.RestClient;
|
import org.springframework.web.client.RestClient;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ public class GeoServiceImpl implements GeoService {
|
|||||||
param.put("key", "7a7f2e4790ea222660a027352ee3af39");
|
param.put("key", "7a7f2e4790ea222660a027352ee3af39");
|
||||||
param.put("keywords", keywords);
|
param.put("keywords", keywords);
|
||||||
param.put("subdistrict", "1");
|
param.put("subdistrict", "1");
|
||||||
if (StringUtils.isNotBlank(subdistrict)) {
|
if (StrUtil.isNotBlank(subdistrict)) {
|
||||||
param.put("subdistrict", "2");
|
param.put("subdistrict", "2");
|
||||||
}
|
}
|
||||||
param.put("extensions", "base");
|
param.put("extensions", "base");
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import jakarta.annotation.Resource;
|
|||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@@ -37,7 +36,7 @@ public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(cacheNames = "shopInfo",key = "#id")
|
@Cacheable(cacheNames = "shopInfo",key = "#id")
|
||||||
public ShopInfo getShopInfoAndConfig(Serializable id) throws CzgException {
|
public ShopInfo getShopInfoAndConfig(Long id) throws CzgException {
|
||||||
ShopInfo shopInfo = shopInfoMapper.selectOneById(id);
|
ShopInfo shopInfo = shopInfoMapper.selectOneById(id);
|
||||||
if (shopInfo == null) {
|
if (shopInfo == null) {
|
||||||
throw new CzgException("店铺不存在");
|
throw new CzgException("店铺不存在");
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ShopInfo getById(Serializable id) throws CzgException {
|
public ShopInfo getById(Serializable id) throws CzgException {
|
||||||
return shopConfigService.getShopInfoAndConfig(id);
|
return shopConfigService.getShopInfoAndConfig((Long) id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,8 +113,14 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop) {
|
public Page<ShopInfo> get(PageDTO pageDTO, String profiles, String phone, String shopName, Integer status, Integer isHeadShop) {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
|
if (StrUtil.isNotBlank(profiles)) {
|
||||||
|
queryWrapper.eq(ShopInfo::getProfiles, profiles);
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(phone)) {
|
||||||
|
queryWrapper.like(ShopInfo::getPhone, phone);
|
||||||
|
}
|
||||||
if (StrUtil.isNotBlank(shopName)) {
|
if (StrUtil.isNotBlank(shopName)) {
|
||||||
queryWrapper.like(ShopInfo::getShopName, shopName);
|
queryWrapper.like(ShopInfo::getShopName, shopName);
|
||||||
}
|
}
|
||||||
@@ -125,7 +131,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||||||
queryWrapper.eq(ShopInfo::getIsHeadShop, isHeadShop);
|
queryWrapper.eq(ShopInfo::getIsHeadShop, isHeadShop);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName));
|
List<ShopInfo> shopAllList = getMapper().selectListByQuery(query().select(ShopInfo::getId, ShopInfo::getShopName)
|
||||||
|
.eq(ShopInfo::getIsHeadShop, 1).ne(ShopInfo::getShopType, ShopTypeEnum.ONLY.getValue()));
|
||||||
Map<Long, String> shopKv = shopAllList.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName));
|
Map<Long, String> shopKv = shopAllList.stream().collect(Collectors.toMap(ShopInfo::getId, ShopInfo::getShopName));
|
||||||
queryWrapper.orderBy(ShopInfo::getCreateTime, false);
|
queryWrapper.orderBy(ShopInfo::getCreateTime, false);
|
||||||
Page<ShopInfo> page = page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
|
Page<ShopInfo> page = page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
|
||||||
@@ -459,7 +466,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
|||||||
@Override
|
@Override
|
||||||
public BigDecimal updateAmount(Long id, BigDecimal amount) {
|
public BigDecimal updateAmount(Long id, BigDecimal amount) {
|
||||||
ShopInfo shopInfo = getShopInfo(id);
|
ShopInfo shopInfo = getShopInfo(id);
|
||||||
if (shopInfo.getAmount() == null || shopInfo.getAmount().compareTo(BigDecimal.ZERO) <= 0) {
|
if (shopInfo.getAmount().add(amount).compareTo(BigDecimal.ZERO) < 0) {
|
||||||
throw new CzgException("更新失败");
|
throw new CzgException("更新失败");
|
||||||
}
|
}
|
||||||
boolean flag = mapper.updateAmount(id, amount);
|
boolean flag = mapper.updateAmount(id, amount);
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import com.czg.config.RedisCst;
|
|||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.RedisService;
|
import com.czg.service.RedisService;
|
||||||
|
import com.czg.utils.CzgRandomUtils;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
import com.czg.account.entity.ShopSong;
|
import com.czg.account.entity.ShopSong;
|
||||||
import com.czg.account.service.ShopSongService;
|
import com.czg.account.service.ShopSongService;
|
||||||
import com.czg.service.account.mapper.ShopSongMapper;
|
import com.czg.service.account.mapper.ShopSongMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,7 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
* @since 2025-03-01
|
* @since 2025-03-01
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ShopSongServiceImpl extends ServiceImpl<ShopSongMapper, ShopSong> implements ShopSongService{
|
public class ShopSongServiceImpl extends ServiceImpl<ShopSongMapper, ShopSong> implements ShopSongService {
|
||||||
@Resource
|
@Resource
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
|
||||||
@@ -49,18 +49,12 @@ public class ShopSongServiceImpl extends ServiceImpl<ShopSongMapper, ShopSong> i
|
|||||||
public String getSongUrl(Long shopId) {
|
public String getSongUrl(Long shopId) {
|
||||||
String code;
|
String code;
|
||||||
String key = RedisCst.getSongUrlKey(shopId);
|
String key = RedisCst.getSongUrlKey(shopId);
|
||||||
if(redisService.hasKey(key)){
|
if (redisService.hasKey(key)) {
|
||||||
code = (String) redisService.get(key);
|
code = (String) redisService.get(key);
|
||||||
}else {
|
} else {
|
||||||
code = RandomStringUtils.randomAlphanumeric(12);
|
code = CzgRandomUtils.randomString(12);
|
||||||
redisService.set(key, code);
|
redisService.set(key, code);
|
||||||
}
|
}
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String string = RandomStringUtils.randomAlphanumeric(12);
|
|
||||||
System.out.println(string);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
and amount - #{money} >= 0
|
and amount - #{money} >= 0
|
||||||
</update>
|
</update>
|
||||||
<update id="updateOneOrTwoAmount">
|
<update id="updateOneOrTwoAmount">
|
||||||
update tb_shop_user
|
update mk_distribution_invite
|
||||||
<set>
|
<set>
|
||||||
<if test="isOne != null and isOne == 1">
|
<if test="isOne != null and isOne == 1">
|
||||||
one_income = one_income + #{amount}
|
one_income = one_income + #{amount}
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
two_income = two_income + #{amount}
|
two_income = two_income + #{amount}
|
||||||
</if>
|
</if>
|
||||||
</set>
|
</set>
|
||||||
where id = #{shopUserId}
|
where shop_user_id = #{shopUserId} and shop_id = #{shopId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
@@ -256,10 +256,10 @@
|
|||||||
</select>
|
</select>
|
||||||
<select id="getInviteUser" resultType="com.czg.market.vo.InviteUserVO">
|
<select id="getInviteUser" resultType="com.czg.market.vo.InviteUserVO">
|
||||||
SELECT
|
SELECT
|
||||||
invite.id AS shopUserId,
|
u.id AS shopUserId,
|
||||||
invite.head_img AS headImg,
|
u.head_img AS headImg,
|
||||||
invite.nick_name AS shopUserName,
|
u.nick_name AS shopUserName,
|
||||||
invite.phone AS shopUserPhone,
|
u.phone AS shopUserPhone,
|
||||||
invite.one_income AS oneIncome,
|
invite.one_income AS oneIncome,
|
||||||
invite.invite_time AS inviteTime,
|
invite.invite_time AS inviteTime,
|
||||||
dist.total_income AS totalIncome,
|
dist.total_income AS totalIncome,
|
||||||
@@ -269,12 +269,14 @@
|
|||||||
dist.status AS status,
|
dist.status AS status,
|
||||||
dist.distribution_level_id AS levelId,
|
dist.distribution_level_id AS levelId,
|
||||||
dist.distribution_level_name AS levelName,
|
dist.distribution_level_name AS levelName,
|
||||||
invite.distribution_shops AS distributionShops
|
u.distribution_shops AS distributionShops
|
||||||
FROM tb_shop_user invite
|
FROM mk_distribution_invite invite
|
||||||
left join mk_distribution_user dist on invite.id = dist.id and dist.shop_id = #{shopId}
|
left join tb_shop_user u on invite.shop_user_id = u.id
|
||||||
WHERE invite.`parent_user_id` = #{distributionUserId}
|
left join mk_distribution_user dist on invite.shop_user_id = dist.id
|
||||||
|
WHERE invite.`parent_user_id` = #{distributionUserId} and invite.shop_id = #{shopId}
|
||||||
<if test="distributionLevelId != null">and dist.distribution_level_id = #{distributionLevelId}</if>
|
<if test="distributionLevelId != null">and dist.distribution_level_id = #{distributionLevelId}</if>
|
||||||
<if test="shopUserId != null">and invite.id = #{shopUserId}</if>
|
<if test="shopUserId != null">and invite.id = #{shopUserId}</if>
|
||||||
|
GROUP BY invite.id
|
||||||
ORDER BY invite.`invite_time` DESC
|
ORDER BY invite.`invite_time` DESC
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.market.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.market.entity.MkCarousel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置表 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
public interface MkCarouselMapper extends BaseMapper<MkCarousel> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.market.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.market.entity.MkDistributionGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员管理群(全民股东管理) 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-28
|
||||||
|
*/
|
||||||
|
public interface MkDistributionGroupMapper extends BaseMapper<MkDistributionGroup> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.market.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.market.entity.MkDistributionInvite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东邀请关系 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-31
|
||||||
|
*/
|
||||||
|
public interface MkDistributionInviteMapper extends BaseMapper<MkDistributionInvite> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.market.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.market.entity.MkShareBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础配置 映射层。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
public interface MkShareBaseMapper extends BaseMapper<MkShareBase> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.czg.market.dto.MkCarouselDTO;
|
||||||
|
import com.czg.system.entity.MiniAppPages;
|
||||||
|
import com.czg.system.service.MiniAppPageService;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.market.entity.MkCarousel;
|
||||||
|
import com.czg.market.service.MkCarouselService;
|
||||||
|
import com.czg.service.market.mapper.MkCarouselMapper;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轮播图配置表 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MkCarouselServiceImpl extends ServiceImpl<MkCarouselMapper, MkCarousel> implements MkCarouselService {
|
||||||
|
@DubboReference
|
||||||
|
private MiniAppPageService miniAppPageService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MkCarousel> getCarousels(MkCarouselDTO mkCarouselDTO) {
|
||||||
|
QueryWrapper queryWrapper = query().eq(MkCarousel::getShopId, mkCarouselDTO.getShopId())
|
||||||
|
.eq(MkCarousel::getIsEnabled, mkCarouselDTO.getIsEnabled())
|
||||||
|
.eq(MkCarousel::getIsShareable, mkCarouselDTO.getIsShareable())
|
||||||
|
.orderBy(MkCarousel::getSort, false);
|
||||||
|
if (StrUtil.isNotBlank(mkCarouselDTO.getName())) {
|
||||||
|
queryWrapper.like(MkCarousel::getName, mkCarouselDTO.getName());
|
||||||
|
}
|
||||||
|
List<MkCarousel> list = list(queryWrapper);
|
||||||
|
list.forEach(mkCarousel -> {
|
||||||
|
if (mkCarousel.getJumpPageId() != null) {
|
||||||
|
MiniAppPages miniAppPages = miniAppPageService.getById(mkCarousel.getJumpPageId());
|
||||||
|
if (miniAppPages != null) {
|
||||||
|
mkCarousel.setJumpPagePath(miniAppPages.getPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.market.entity.MkDistributionGroup;
|
||||||
|
import com.czg.market.service.MkDistributionGroupService;
|
||||||
|
import com.czg.service.market.mapper.MkDistributionGroupMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分销员管理群(全民股东管理) 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-28
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MkDistributionGroupServiceImpl extends ServiceImpl<MkDistributionGroupMapper, MkDistributionGroup> implements MkDistributionGroupService{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.market.entity.MkDistributionInvite;
|
||||||
|
import com.czg.market.service.MkDistributionInviteService;
|
||||||
|
import com.czg.service.market.mapper.MkDistributionInviteMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全民股东邀请关系 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-31
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MkDistributionInviteServiceImpl extends ServiceImpl<MkDistributionInviteMapper, MkDistributionInvite> implements MkDistributionInviteService{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MkDistributionInvite getByShopIdAndShopUserId(Long shopId, Long shopUserId) {
|
||||||
|
return getOne(query().eq(MkDistributionInvite::getShopId, shopId).eq(MkDistributionInvite::getShopUserId, shopUserId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,6 +61,8 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUserMapper, MkDistributionUser> implements MkDistributionUserService {
|
public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUserMapper, MkDistributionUser> implements MkDistributionUserService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MkDistributionGroupService mkDistributionGroupService;
|
||||||
@Resource
|
@Resource
|
||||||
private MkDistributionConfigService mkDistributionConfigService;
|
private MkDistributionConfigService mkDistributionConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -74,6 +76,8 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
@Resource
|
@Resource
|
||||||
private MkDistributionDeliverService distributionDeliverService;
|
private MkDistributionDeliverService distributionDeliverService;
|
||||||
@Resource
|
@Resource
|
||||||
|
private MkDistributionInviteService distributionInviteService;
|
||||||
|
@Resource
|
||||||
private AppWxServiceImpl appWxService;
|
private AppWxServiceImpl appWxService;
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private ShopUserService shopUserService;
|
private ShopUserService shopUserService;
|
||||||
@@ -146,9 +150,9 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||||
UserInfo userInfo = userInfoService.getById(shopUser.getUserId());
|
UserInfo userInfo = userInfoService.getById(shopUser.getUserId());
|
||||||
result.put("cashOutAmount", userInfo.getDistributionAmount() == null ? 0.0 : userInfo.getDistributionAmount());
|
result.put("cashOutAmount", userInfo.getDistributionAmount() == null ? 0.0 : userInfo.getDistributionAmount());
|
||||||
|
MkDistributionInvite invite = distributionInviteService.getByShopIdAndShopUserId(shopId, shopUser.getId());
|
||||||
if (shopUser.getParentUserId() != null) {
|
if (invite != null && invite.getParentUserId() != null) {
|
||||||
MkDistributionUser mkDistributionUser = getMkDistributionUserByIdAndShopId(shopUser.getParentUserId(), shopId);
|
MkDistributionUser mkDistributionUser = getMkDistributionUserByIdAndShopId(invite.getParentUserId(), shopId);
|
||||||
AssertUtil.isNull(mkDistributionUser, "上级分销员不存在");
|
AssertUtil.isNull(mkDistributionUser, "上级分销员不存在");
|
||||||
ShopUser shopUserParent = shopUserService.getById(mkDistributionUser.getId());
|
ShopUser shopUserParent = shopUserService.getById(mkDistributionUser.getId());
|
||||||
result.put("parentName", shopUserParent.getNickName());
|
result.put("parentName", shopUserParent.getNickName());
|
||||||
@@ -156,6 +160,9 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
}
|
}
|
||||||
MkDistributionUser mkDistributionUser = getMkDistributionUserByIdAndShopId(shopUser.getId(), shopId);
|
MkDistributionUser mkDistributionUser = getMkDistributionUserByIdAndShopId(shopUser.getId(), shopId);
|
||||||
MkDistributionConfigVO mkDistributionConfigVO = mkDistributionConfigService.detail(shopId);
|
MkDistributionConfigVO mkDistributionConfigVO = mkDistributionConfigService.detail(shopId);
|
||||||
|
MkDistributionGroup group = mkDistributionGroupService.getById(shopId);
|
||||||
|
result.put("config", mkDistributionConfigVO);
|
||||||
|
result.put("group", group);
|
||||||
if (mkDistributionUser != null) {
|
if (mkDistributionUser != null) {
|
||||||
Map<String, Object> distributionUser = new HashMap<>();
|
Map<String, Object> distributionUser = new HashMap<>();
|
||||||
distributionUser.put("distributionId", mkDistributionUser.getId());
|
distributionUser.put("distributionId", mkDistributionUser.getId());
|
||||||
@@ -165,6 +172,7 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
distributionUser.put("totalIncome", mkDistributionUser.getTotalIncome());
|
distributionUser.put("totalIncome", mkDistributionUser.getTotalIncome());
|
||||||
distributionUser.put("pendingIncome", mkDistributionUser.getPendingIncome());
|
distributionUser.put("pendingIncome", mkDistributionUser.getPendingIncome());
|
||||||
distributionUser.put("isAssignLevel", mkDistributionUser.getIsAssignLevel());
|
distributionUser.put("isAssignLevel", mkDistributionUser.getIsAssignLevel());
|
||||||
|
distributionUser.put("firstIn", mkDistributionUser.getFirstIn());
|
||||||
|
|
||||||
if (mkDistributionUser.getDistributionLevelId() != null) {
|
if (mkDistributionUser.getDistributionLevelId() != null) {
|
||||||
List<MkDistributionLevelConfig> levelConfigList = mkDistributionConfigVO.getLevelConfigList();
|
List<MkDistributionLevelConfig> levelConfigList = mkDistributionConfigVO.getLevelConfigList();
|
||||||
@@ -186,8 +194,6 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
distributionUser.put("levelName", "无");
|
distributionUser.put("levelName", "无");
|
||||||
}
|
}
|
||||||
result.put("distributionUser", distributionUser);
|
result.put("distributionUser", distributionUser);
|
||||||
} else {
|
|
||||||
result.put("config", mkDistributionConfigVO);
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -230,8 +236,9 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
public void bindInviteUser(MkDistributionUserDTO param) throws CzgException, ValidateException {
|
public void bindInviteUser(MkDistributionUserDTO param) throws CzgException, ValidateException {
|
||||||
ShopUser shopUser = shopUserService.getById(param.getId());
|
ShopUser shopUser = shopUserService.getById(param.getId());
|
||||||
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||||
if (shopUser.getParentUserId() != null) {
|
MkDistributionInvite shopUserInvite = distributionInviteService.getByShopIdAndShopUserId(param.getShopId(), shopUser.getId());
|
||||||
throw new CzgException("店铺用户已绑定分销员");
|
if (shopUserInvite != null && shopUserInvite.getParentUserId() != null) {
|
||||||
|
throw new CzgException("店铺用户已存在上级");
|
||||||
}
|
}
|
||||||
MkDistributionUser parent = getOne(QueryWrapper.create().eq(MkDistributionUser::getInviteCode, param.getInviteCode()));
|
MkDistributionUser parent = getOne(QueryWrapper.create().eq(MkDistributionUser::getInviteCode, param.getInviteCode()));
|
||||||
AssertUtil.isNull(parent, "邀请人不存在");
|
AssertUtil.isNull(parent, "邀请人不存在");
|
||||||
@@ -246,28 +253,28 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
}
|
}
|
||||||
ShopUser parentShopUser = shopUserService.getById(parent.getId());
|
ShopUser parentShopUser = shopUserService.getById(parent.getId());
|
||||||
AssertUtil.isNull(parentShopUser, "邀请人不存在");
|
AssertUtil.isNull(parentShopUser, "邀请人不存在");
|
||||||
|
MkDistributionInvite parentShopUserInvite = distributionInviteService.getByShopIdAndShopUserId(param.getShopId(), parentShopUser.getId());
|
||||||
|
if (parentShopUserInvite != null && parentShopUserInvite.getParentUserId() != null && parentShopUserInvite.getParentUserId().equals(shopUser.getId())) {
|
||||||
|
throw new CzgException("存在绑定关系,不可绑定");
|
||||||
|
}
|
||||||
|
if (parentShopUserInvite != null && parentShopUserInvite.getGradeUserId() != null && parentShopUserInvite.getGradeUserId().equals(shopUser.getId())) {
|
||||||
|
throw new CzgException("存在绑定关系,不可绑定");
|
||||||
|
}
|
||||||
|
|
||||||
if (parentShopUser.getParentUserId() != null && parentShopUser.getParentUserId().equals(shopUser.getId())) {
|
|
||||||
throw new CzgException("存在绑定关系,不可绑定");
|
|
||||||
}
|
|
||||||
if (parentShopUser.getGradeUserId() != null && parentShopUser.getGradeUserId().equals(shopUser.getId())) {
|
|
||||||
throw new CzgException("存在绑定关系,不可绑定");
|
|
||||||
}
|
|
||||||
//更新自己的上级
|
//更新自己的上级
|
||||||
shopUser.setParentUserId(parentShopUser.getId());
|
MkDistributionInvite newShopUserInvite = new MkDistributionInvite();
|
||||||
shopUser.setGradeUserId(parentShopUser.getParentUserId());
|
newShopUserInvite.setShopId(param.getShopId());
|
||||||
|
newShopUserInvite.setUserId(shopUser.getUserId());
|
||||||
|
newShopUserInvite.setShopUserId(shopUser.getId());
|
||||||
|
newShopUserInvite.setParentUserId(parentShopUser.getId());
|
||||||
|
newShopUserInvite.setGradeUserId(parentShopUserInvite == null ? null : parentShopUserInvite.getParentUserId());
|
||||||
|
newShopUserInvite.setInviteTime(LocalDateTime.now());
|
||||||
|
distributionInviteService.save(newShopUserInvite);
|
||||||
|
if (parentShopUserInvite != null && parentShopUserInvite.getParentUserId() != null) {
|
||||||
//更新自己的下级 的上级的上级 为自己的上级
|
//更新自己的下级 的上级的上级 为自己的上级
|
||||||
ShopUser upShopUser1 = new ShopUser();
|
MkDistributionInvite childShopUserInvite = new MkDistributionInvite();
|
||||||
upShopUser1.setParentUserId(parentShopUser.getId());
|
childShopUserInvite.setGradeUserId(parentShopUser.getId());
|
||||||
upShopUser1.setGradeUserId(parentShopUser.getParentUserId());
|
distributionInviteService.update(childShopUserInvite, QueryWrapper.create().eq(MkDistributionInvite::getParentUserId, shopUser.getId()));
|
||||||
shopUserService.update(upShopUser1, QueryWrapper.create().eq(ShopUser::getId, shopUser.getId()));
|
|
||||||
|
|
||||||
if (shopUser.getParentUserId() != null) {
|
|
||||||
//更新自己的下级 的上级的上级 为自己的上级
|
|
||||||
ShopUser upShopUser = new ShopUser();
|
|
||||||
upShopUser.setGradeUserId(shopUser.getParentUserId());
|
|
||||||
shopUserService.update(upShopUser, QueryWrapper.create().eq(ShopUser::getParentUserId, shopUser.getId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MkDistributionUser newDistributionUser = new MkDistributionUser();
|
MkDistributionUser newDistributionUser = new MkDistributionUser();
|
||||||
@@ -311,12 +318,98 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
.eq(MkDistributionUser::getShopId, parent.getShopId()));
|
.eq(MkDistributionUser::getShopId, parent.getShopId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@GlobalTransactional
|
||||||
|
public void bindInviteUser(Long fromUserId, Long toUserId, Long shopId) throws CzgException, ValidateException {
|
||||||
|
ShopUser shopUser = shopUserService.getById(toUserId);
|
||||||
|
AssertUtil.isNull(shopUser, "店铺用户不存在");
|
||||||
|
MkDistributionInvite shopUserInvite = distributionInviteService.getByShopIdAndShopUserId(shopId, shopUser.getId());
|
||||||
|
if (shopUserInvite != null && shopUserInvite.getParentUserId() != null) {
|
||||||
|
throw new CzgException("店铺用户已存在上级");
|
||||||
|
}
|
||||||
|
MkDistributionUser parent = getOne(QueryWrapper.create().eq(MkDistributionUser::getId, fromUserId).eq(MkDistributionUser::getShopId, shopId));
|
||||||
|
AssertUtil.isNull(parent, "邀请人不存在");
|
||||||
|
if (parent.getId().equals(shopUser.getId())) {
|
||||||
|
throw new CzgException("不能绑定自己为上级");
|
||||||
|
}
|
||||||
|
if (parent.getStatus() == 9) {
|
||||||
|
throw new CzgException("绑定失败该邀请人分销身份已被取消");
|
||||||
|
}
|
||||||
|
ShopUser parentShopUser = shopUserService.getById(parent.getId());
|
||||||
|
AssertUtil.isNull(parentShopUser, "邀请人不存在");
|
||||||
|
|
||||||
|
MkDistributionInvite parentShopUserInvite = distributionInviteService.getByShopIdAndShopUserId(shopId, parentShopUser.getId());
|
||||||
|
if (parentShopUserInvite != null && parentShopUserInvite.getParentUserId() != null && parentShopUserInvite.getParentUserId().equals(shopUser.getId())) {
|
||||||
|
throw new CzgException("存在绑定关系,不可绑定");
|
||||||
|
}
|
||||||
|
if (parentShopUserInvite != null && parentShopUserInvite.getGradeUserId() != null && parentShopUserInvite.getGradeUserId().equals(shopUser.getId())) {
|
||||||
|
throw new CzgException("存在绑定关系,不可绑定");
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新自己的上级
|
||||||
|
MkDistributionInvite newShopUserInvite = new MkDistributionInvite();
|
||||||
|
newShopUserInvite.setShopId(shopId);
|
||||||
|
newShopUserInvite.setUserId(shopUser.getUserId());
|
||||||
|
newShopUserInvite.setShopUserId(shopUser.getId());
|
||||||
|
newShopUserInvite.setParentUserId(parentShopUser.getId());
|
||||||
|
newShopUserInvite.setGradeUserId(parentShopUserInvite == null ? null : parentShopUserInvite.getParentUserId());
|
||||||
|
newShopUserInvite.setInviteTime(LocalDateTime.now());
|
||||||
|
distributionInviteService.save(newShopUserInvite);
|
||||||
|
if (parentShopUserInvite != null && parentShopUserInvite.getParentUserId() != null) {
|
||||||
|
//更新自己的下级 的上级的上级 为自己的上级
|
||||||
|
MkDistributionInvite childShopUserInvite = new MkDistributionInvite();
|
||||||
|
childShopUserInvite.setGradeUserId(parentShopUser.getId());
|
||||||
|
distributionInviteService.update(childShopUserInvite, QueryWrapper.create().eq(MkDistributionInvite::getParentUserId, shopUser.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
MkDistributionUser newDistributionUser = new MkDistributionUser();
|
||||||
|
newDistributionUser.setId(parent.getId());
|
||||||
|
newDistributionUser.setInviteCount(parent.getInviteCount() + 1);
|
||||||
|
MkDistributionConfig mkDistributionConfig = mkDistributionConfigService.getOne(QueryWrapper.create()
|
||||||
|
.eq(MkDistributionConfig::getShopId, parent.getShopId()));
|
||||||
|
if ("自主申请".equals(parent.getOpeningMethod()) && parent.getStatus() == 0 && mkDistributionConfig != null) {
|
||||||
|
if (newDistributionUser.getInviteCount() >= mkDistributionConfig.getInviteCount()) {
|
||||||
|
ShopUser parentShopUser1 = new ShopUser();
|
||||||
|
parentShopUser1.setId(parentShopUser.getId());
|
||||||
|
parentShopUser1.upDistributionShop(shopId, 1);
|
||||||
|
shopUserService.updateById(parentShopUser1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mkDistributionConfig != null && !"not_upgrade".equals(mkDistributionConfig.getUpgradeType()) && parent.getIsAssignLevel() == 0) {
|
||||||
|
if ("invite".equals(mkDistributionConfig.getUpgradeType())) {
|
||||||
|
if (mkDistributionConfig.getInviteConsume() == 1) {
|
||||||
|
long count = orderInfoService.count(QueryWrapper.create()
|
||||||
|
.eq(OrderInfo::getUserId, shopUser.getUserId())
|
||||||
|
.eq(OrderInfo::getShopId, parent.getShopId())
|
||||||
|
.eq(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode()));
|
||||||
|
if (count < 1) {
|
||||||
|
throw new CzgException("绑定失败,被邀请人需要成功支付一笔订单");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MkDistributionLevelConfig levelConfig = levelConfigService.getOne(QueryWrapper.create()
|
||||||
|
.eq(MkDistributionLevelConfig::getShopId, parent.getShopId())
|
||||||
|
.le(MkDistributionLevelConfig::getInviteCount, newDistributionUser.getInviteCount())
|
||||||
|
.orderBy(MkDistributionLevelConfig::getId).desc().limit(1));
|
||||||
|
if (levelConfig != null) {
|
||||||
|
newDistributionUser.setDistributionLevelId(levelConfig.getId());
|
||||||
|
newDistributionUser.setDistributionLevelName(levelConfig.getName());
|
||||||
|
newDistributionUser.setStatus(1);
|
||||||
|
}
|
||||||
|
} else if ("cost".equals(mkDistributionConfig.getUpgradeType())) {
|
||||||
|
costUpgradeLevel(parent.getId(), parent.getShopId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
update(newDistributionUser, QueryWrapper.create().eq(MkDistributionUser::getId, parent.getId())
|
||||||
|
.eq(MkDistributionUser::getShopId, parent.getShopId()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void costUpgradeLevelBefore(Long userId, Long shopId) {
|
public void costUpgradeLevelBefore(Long userId, Long shopId) {
|
||||||
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, userId);
|
ShopUser shopUser = shopUserService.getShopUserInfo(shopId, userId);
|
||||||
costUpgradeLevel(shopUser.getId(), shopId);
|
costUpgradeLevel(shopUser.getId(), shopId);
|
||||||
if (shopUser.getParentUserId() != null) {
|
MkDistributionInvite shopUserInvite = distributionInviteService.getByShopIdAndShopUserId(shopId, shopUser.getId());
|
||||||
costUpgradeLevel(shopUser.getParentUserId(), shopId);
|
if (shopUserInvite != null && shopUserInvite.getParentUserId() != null) {
|
||||||
|
costUpgradeLevel(shopUserInvite.getParentUserId(), shopId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,8 +470,10 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
.map(MkDistributionUserDTO::getId)
|
.map(MkDistributionUserDTO::getId)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
shopUserMap = shopUserService.list(QueryWrapper.create().in(ShopUser::getId, shopUserIds))
|
List<ShopUser> shopUserList = shopUserService.list(QueryWrapper.create().in(ShopUser::getId, shopUserIds));
|
||||||
.stream().collect(Collectors.toMap(ShopUser::getId, shopUser -> shopUser));
|
if (CollUtil.isNotEmpty(shopUserList)) {
|
||||||
|
shopUserMap = shopUserList.stream().collect(Collectors.toMap(ShopUser::getId, shopUser -> shopUser));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (MkDistributionUserDTO record : page.getRecords()) {
|
for (MkDistributionUserDTO record : page.getRecords()) {
|
||||||
ShopUser shopUser = shopUserMap.get(record.getId());
|
ShopUser shopUser = shopUserMap.get(record.getId());
|
||||||
@@ -681,18 +776,19 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
|
|||||||
AssertUtil.isTrue(config.getIsEnable() != 1, "分销未开启");
|
AssertUtil.isTrue(config.getIsEnable() != 1, "分销未开启");
|
||||||
// 产生消费的用户
|
// 产生消费的用户
|
||||||
ShopUser curUser = shopUserService.getShopUserInfo(shopId, sourceUserId);
|
ShopUser curUser = shopUserService.getShopUserInfo(shopId, sourceUserId);
|
||||||
if (curUser == null || curUser.getParentUserId() == null) {
|
MkDistributionInvite sourceInviteUser = distributionInviteService.getByShopIdAndShopUserId(shopId, curUser.getId());
|
||||||
|
if (sourceInviteUser.getParentUserId() == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("开始分销, 当前来源用户: {}, shopId: {}, 邀请人id: {}", sourceUserId, shopId, curUser.getParentUserId());
|
log.info("开始分销, 当前来源用户: {}, shopId: {}, 邀请人id: {}", sourceUserId, shopId, sourceInviteUser.getParentUserId());
|
||||||
|
|
||||||
MkDistributionUser distributionUser = getMkDistributionUserByIdAndShopId(curUser.getParentUserId(), shopId);
|
MkDistributionUser distributionUser = getMkDistributionUserByIdAndShopId(sourceInviteUser.getParentUserId(), shopId);
|
||||||
MkDistributionLevelConfig level = levelConfigService.getById(distributionUser.getDistributionLevelId());
|
MkDistributionLevelConfig level = levelConfigService.getById(distributionUser.getDistributionLevelId());
|
||||||
deepReward(curUser, level.getCommission(), config, distributionUser,
|
deepReward(curUser, level.getCommission(), config, distributionUser,
|
||||||
amount, sourceId, type, orderNo, 1);
|
amount, sourceId, type, orderNo, 1);
|
||||||
if (curUser.getGradeUserId() != null) {
|
if (sourceInviteUser.getGradeUserId() != null) {
|
||||||
MkDistributionUser parentDis = getMkDistributionUserByIdAndShopId(curUser.getGradeUserId(), shopId);
|
MkDistributionUser parentDis = getMkDistributionUserByIdAndShopId(sourceInviteUser.getGradeUserId(), shopId);
|
||||||
MkDistributionLevelConfig parentDisLevel = levelConfigService.getById(parentDis.getDistributionLevelId());
|
MkDistributionLevelConfig parentDisLevel = levelConfigService.getById(parentDis.getDistributionLevelId());
|
||||||
deepReward(curUser, parentDisLevel.getCommission().subtract(level.getCommission()), config, parentDis,
|
deepReward(curUser, parentDisLevel.getCommission().subtract(level.getCommission()), config, parentDis,
|
||||||
amount, sourceId, type, orderNo, 2);
|
amount, sourceId, type, orderNo, 2);
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
package com.czg.service.market.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.czg.market.dto.MkShopCouponGiftDTO;
|
||||||
|
import com.czg.market.dto.ShopCouponDTO;
|
||||||
|
import com.czg.market.entity.MkShopCouponRecord;
|
||||||
|
import com.czg.market.service.MkDistributionUserService;
|
||||||
|
import com.czg.market.service.MkShopCouponRecordService;
|
||||||
|
import com.czg.market.service.ShopCouponService;
|
||||||
|
import com.czg.utils.FunUtils;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.market.entity.MkShareBase;
|
||||||
|
import com.czg.market.service.MkShareBaseService;
|
||||||
|
import com.czg.service.market.mapper.MkShareBaseMapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分享奖励基础配置 服务层实现。
|
||||||
|
*
|
||||||
|
* @author ww
|
||||||
|
* @since 2026-01-27
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class MkShareBaseServiceImpl extends ServiceImpl<MkShareBaseMapper, MkShareBase> implements MkShareBaseService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopCouponService shopCouponService;
|
||||||
|
@Resource
|
||||||
|
private MkDistributionUserService distributionUserService;
|
||||||
|
@Resource
|
||||||
|
private MkShopCouponRecordService mkShopCouponRecordService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MkShareBase getShareBase(Long shopId) {
|
||||||
|
MkShareBase shareBase = getById(shopId);
|
||||||
|
if (shareBase != null) {
|
||||||
|
if (shareBase.getSharerCouponId() != null) {
|
||||||
|
ShopCouponDTO sharerCoupon = shopCouponService.getCouponById(shareBase.getSharerCouponId());
|
||||||
|
if (sharerCoupon != null) {
|
||||||
|
shareBase.setSharerCouponName(sharerCoupon.getTitle());
|
||||||
|
shareBase.setSharerCoupon(sharerCoupon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shareBase.getSharedUserCouponId() != null) {
|
||||||
|
ShopCouponDTO shareUserCoupon = shopCouponService.getCouponById(shareBase.getSharedUserCouponId());
|
||||||
|
if (shareUserCoupon != null) {
|
||||||
|
shareBase.setSharedUserCouponName(shareUserCoupon.getTitle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return shareBase;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shareClaim(String tagType, Long shopId, Long fromUserId, Long toUserId) {
|
||||||
|
//获取邀请码
|
||||||
|
String inviteCode = null;
|
||||||
|
try {
|
||||||
|
inviteCode = distributionUserService.getInviteCode(shopId, fromUserId);
|
||||||
|
} catch (Exception _) {
|
||||||
|
}
|
||||||
|
//绑定上下级
|
||||||
|
if (StrUtil.isNotBlank(inviteCode)) {
|
||||||
|
FunUtils.safeRunVoid(() -> {
|
||||||
|
distributionUserService.bindInviteUser(fromUserId, toUserId, shopId);
|
||||||
|
}, "shareClaim绑定上下级");
|
||||||
|
}
|
||||||
|
MkShareBase shareBase = getById(shopId);
|
||||||
|
if (shareBase == null || !shareBase.getIsEnabled().equals(1) || StrUtil.isBlank(shareBase.getRewardSharePages())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!shareBase.getRewardSharePages().contains(tagType)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FunUtils.safeRun(() -> {
|
||||||
|
//发放分享人优惠券
|
||||||
|
if (shareBase.getSharerCouponId() != null) {
|
||||||
|
boolean grant = true;
|
||||||
|
if (shareBase.getRewardTimesType().equals(1)) {
|
||||||
|
boolean exists = mkShopCouponRecordService.exists(query()
|
||||||
|
.eq(MkShopCouponRecord::getShopId, shopId)
|
||||||
|
.eq(MkShopCouponRecord::getShopUserId, fromUserId)
|
||||||
|
.eq(MkShopCouponRecord::getSource, "邀请获得"));
|
||||||
|
grant = !exists;
|
||||||
|
}
|
||||||
|
if (grant) {
|
||||||
|
grant = !mkShopCouponRecordService.exists(query()
|
||||||
|
.eq(MkShopCouponRecord::getShopId, shopId)
|
||||||
|
.eq(MkShopCouponRecord::getShopUserId, fromUserId)
|
||||||
|
.eq(MkShopCouponRecord::getSourceFlowId, toUserId)
|
||||||
|
.eq(MkShopCouponRecord::getSource, "邀请获得"));
|
||||||
|
}
|
||||||
|
if (grant) {
|
||||||
|
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO();
|
||||||
|
giftDTO.setShopId(shopId)
|
||||||
|
.setSourceId(shareBase.getShopId())
|
||||||
|
.setSourceFlowId(toUserId)
|
||||||
|
.setShopUserId(fromUserId)
|
||||||
|
.setCouponId(shareBase.getSharerCouponId())
|
||||||
|
.setSource("邀请获得");
|
||||||
|
int receiveNum = 1;
|
||||||
|
if (shareBase.getSharerCouponNum() != null && shareBase.getSharerCouponNum() > 0) {
|
||||||
|
receiveNum = shareBase.getSharerCouponNum();
|
||||||
|
}
|
||||||
|
mkShopCouponRecordService.receiveCoupon(giftDTO, receiveNum, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}, "邀请人获取优惠券");
|
||||||
|
FunUtils.safeRun(() -> {
|
||||||
|
//发放被分享人优惠券
|
||||||
|
if (shareBase.getSharedUserCouponId() != null) {
|
||||||
|
boolean exists = mkShopCouponRecordService.exists(query()
|
||||||
|
.eq(MkShopCouponRecord::getShopId, shopId)
|
||||||
|
.eq(MkShopCouponRecord::getShopUserId, toUserId)
|
||||||
|
.eq(MkShopCouponRecord::getSourceFlowId, fromUserId)
|
||||||
|
.eq(MkShopCouponRecord::getSource, "参与分享获得"));
|
||||||
|
if (!exists) {
|
||||||
|
MkShopCouponGiftDTO giftDTO = new MkShopCouponGiftDTO();
|
||||||
|
giftDTO.setShopId(shopId)
|
||||||
|
.setSourceId(shareBase.getShopId())
|
||||||
|
.setShopUserId(toUserId)
|
||||||
|
.setSourceFlowId(fromUserId)
|
||||||
|
.setCouponId(shareBase.getSharedUserCouponId())
|
||||||
|
.setSource("参与分享获得");
|
||||||
|
int receiveNum = 1;
|
||||||
|
if (shareBase.getSharedUserCouponNum() != null && shareBase.getSharedUserCouponNum() > 0) {
|
||||||
|
receiveNum = shareBase.getSharedUserCouponNum();
|
||||||
|
}
|
||||||
|
mkShopCouponRecordService.receiveCoupon(giftDTO, receiveNum, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}, "被分享人获取优惠券");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -67,12 +67,14 @@ public class MkShopCouponRecordServiceImpl extends ServiceImpl<MkShopCouponRecor
|
|||||||
private ShopCouponMapper couponService;
|
private ShopCouponMapper couponService;
|
||||||
|
|
||||||
private static final List<String> TARGET_KEY = Arrays.asList("消费赠券", "充值赠券", "管理员赠送", "兑换码兑换", "群聊发放", "生日赠券",
|
private static final List<String> TARGET_KEY = Arrays.asList("消费赠券", "充值赠券", "管理员赠送", "兑换码兑换", "群聊发放", "生日赠券",
|
||||||
"购买会员赠券", "短信发放", "公众号发放", "用户弹窗领取", "积分兑换");
|
"购买会员赠券", "短信发放", "公众号发放", "用户弹窗领取", "积分兑换", "参与分享获得", "邀请获得");
|
||||||
|
|
||||||
private static final Map<String, String> SOURCE_TO_CATEGORY = Map.ofEntries(
|
private static final Map<String, String> SOURCE_TO_CATEGORY = Map.ofEntries(
|
||||||
Map.entry("用户弹窗领取", "用户领取"),
|
Map.entry("用户弹窗领取", "用户领取"),
|
||||||
Map.entry("兑换码兑换", "用户领取"),
|
Map.entry("兑换码兑换", "用户领取"),
|
||||||
Map.entry("积分兑换", "用户领取"),
|
Map.entry("积分兑换", "用户领取"),
|
||||||
|
Map.entry("参与分享获得", "分享获得"),
|
||||||
|
Map.entry("邀请获得", "分享获得"),
|
||||||
Map.entry("群聊发放", "群聊发放"),
|
Map.entry("群聊发放", "群聊发放"),
|
||||||
Map.entry("短信发放", "推广发放"),
|
Map.entry("短信发放", "推广发放"),
|
||||||
Map.entry("公众号发放", "推广发放"),
|
Map.entry("公众号发放", "推广发放"),
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.market.mapper.MkCarouselMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.market.mapper.MkDistributionGroupMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.market.mapper.MkDistributionInviteMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -65,8 +65,10 @@
|
|||||||
|
|
||||||
<select id="getOrderConsumeAmountByList" resultType="java.math.BigDecimal">
|
<select id="getOrderConsumeAmountByList" resultType="java.math.BigDecimal">
|
||||||
SELECT IFNULL(SUM(ord.pay_amount), 0) AS totalAmount
|
SELECT IFNULL(SUM(ord.pay_amount), 0) AS totalAmount
|
||||||
FROM tb_shop_user invite
|
FROM mk_distribution_invite invite
|
||||||
INNER JOIN tb_order_info ord ON invite.user_id = ord.user_id
|
INNER JOIN tb_shop_user su on invite.shop_user_id = su.id
|
||||||
|
INNER JOIN tb_order_info ord ON su.user_id = ord.user_id
|
||||||
|
and invite.shop_id = #{shopId}
|
||||||
AND ord.shop_id = #{shopId}
|
AND ord.shop_id = #{shopId}
|
||||||
AND ord.STATUS = 'done'
|
AND ord.STATUS = 'done'
|
||||||
AND ord.pay_type NOT IN ('vip_pay', 'credit_pay')
|
AND ord.pay_type NOT IN ('vip_pay', 'credit_pay')
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.czg.service.market.mapper.MkShareBaseMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -192,7 +192,7 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
|||||||
" AND shop_id = #{shopId}" +
|
" AND shop_id = #{shopId}" +
|
||||||
" AND source_type NOT IN ('memberPay', 'distribution', 'distributionRecharge', 'point' ,'ware')" +
|
" AND source_type NOT IN ('memberPay', 'distribution', 'distributionRecharge', 'point' ,'ware')" +
|
||||||
" AND pay_type != 'refundCompensate'" +
|
" AND pay_type != 'refundCompensate'" +
|
||||||
" AND pay_date = #{tradeDay} ;")
|
" AND DATE(update_time) = #{tradeDay} ;")
|
||||||
ShopOrderStatistic getOnlineStatSingleDate(Long shopId, LocalDate tradeDay);
|
ShopOrderStatistic getOnlineStatSingleDate(Long shopId, LocalDate tradeDay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,6 +210,7 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
|||||||
" SUM(CASE WHEN pay_type = 'free_pay' THEN order_amount ELSE 0 END) AS backDiscountAmount," +
|
" SUM(CASE WHEN pay_type = 'free_pay' THEN order_amount ELSE 0 END) AS backDiscountAmount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(CASE WHEN pay_type = 'vip_pay' THEN refund_amount ELSE 0 END) AS memberRefundAmount," +
|
" SUM(CASE WHEN pay_type = 'vip_pay' THEN refund_amount ELSE 0 END) AS memberRefundAmount," +
|
||||||
|
" SUM(CASE WHEN pay_type = 'credit_pay' THEN refund_amount ELSE 0 END) AS creditRefundAmount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(CASE WHEN pay_type = 'vip_pay' THEN 1 ELSE 0 END) as memberPayCount," +
|
" SUM(CASE WHEN pay_type = 'vip_pay' THEN 1 ELSE 0 END) as memberPayCount," +
|
||||||
" SUM(CASE WHEN pay_type = 'cash_pay' THEN 1 ELSE 0 END) as cashPayCount," +
|
" SUM(CASE WHEN pay_type = 'cash_pay' THEN 1 ELSE 0 END) as cashPayCount," +
|
||||||
@@ -219,15 +220,15 @@ public interface ShopOrderStatisticMapper extends BaseMapper<ShopOrderStatistic>
|
|||||||
" SUM(CASE WHEN pay_type = 'main_scan' THEN 1 ELSE 0 END) as mainScanPayCount," +
|
" SUM(CASE WHEN pay_type = 'main_scan' THEN 1 ELSE 0 END) as mainScanPayCount," +
|
||||||
" SUM(CASE WHEN pay_type = 'credit_pay' THEN 1 ELSE 0 END) as creditPayCount," +
|
" SUM(CASE WHEN pay_type = 'credit_pay' THEN 1 ELSE 0 END) as creditPayCount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(refund_amount) as refundAmount," +
|
" IFNULL(SUM(refund_amount), 0) as refundAmount," +
|
||||||
" SUM(CASE WHEN refund_type = 'cash' or pay_type = 'cash_pay' THEN refund_amount ELSE 0 END) as cashRefundAmount," +
|
" SUM(CASE WHEN refund_type = 'cash' or pay_type = 'cash_pay' THEN refund_amount ELSE 0 END) as cashRefundAmount," +
|
||||||
" " +
|
" " +
|
||||||
" SUM(new_customer_discount_amount) as newCustomerDiscountAmount," +
|
" IFNULL(SUM(new_customer_discount_amount), 0) as newCustomerDiscountAmount," +
|
||||||
" SUM(discount_act_amount) as fullDiscountAmount," +
|
" IFNULL(SUM(discount_act_amount), 0) as fullDiscountAmount," +
|
||||||
" SUM(product_coupon_discount_amount) + SUM(other_coupon_discount_amount) as couponDiscountAmount," +
|
" IFNULL(SUM(product_coupon_discount_amount), 0) + IFNULL(SUM(other_coupon_discount_amount), 0) as couponDiscountAmount," +
|
||||||
" SUM(points_discount_amount) as pointDiscountAmount," +
|
" IFNULL(SUM(points_discount_amount), 0) as pointDiscountAmount," +
|
||||||
" SUM(vip_discount_amount) as memberDiscountAmount," +
|
" IFNULL(SUM(vip_discount_amount), 0) as memberDiscountAmount," +
|
||||||
" SUM(discount_amount) as orderPriceDiscountAmount ," +
|
" IFNULL(SUM(discount_amount), 0) as orderPriceDiscountAmount ," +
|
||||||
" count(1) as orderCount," +
|
" count(1) as orderCount," +
|
||||||
" sum(CASE WHEN seat_num IS NULL OR seat_num <= 0 THEN 1 ELSE seat_num END) as customerCount " +
|
" sum(CASE WHEN seat_num IS NULL OR seat_num <= 0 THEN 1 ELSE seat_num END) as customerCount " +
|
||||||
"FROM" +
|
"FROM" +
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.czg.service.order.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.czg.excel.ExcelExportUtil;
|
||||||
|
import com.czg.exception.CzgException;
|
||||||
|
import com.czg.order.dto.FinanceStsDTO;
|
||||||
|
import com.czg.order.entity.ShopOrderStatistic;
|
||||||
|
import com.czg.order.param.FinanceStsQueryParam;
|
||||||
|
import com.czg.order.service.FinanceStsService;
|
||||||
|
import com.czg.order.service.ShopOrderStatisticService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yjjie
|
||||||
|
* @date 2026/2/2 10:11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FinanceStsServiceImpl implements FinanceStsService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopOrderStatisticService orderStatisticService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FinanceStsDTO getFinanceSts(FinanceStsQueryParam param) {
|
||||||
|
if (param.notValidDateRange()) {
|
||||||
|
throw new CzgException("日期范围无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopOrderStatistic statistic = getStatisticData(param);
|
||||||
|
|
||||||
|
return new FinanceStsDTO()
|
||||||
|
.setDate(LocalDateTimeUtil.format(param.getQueryDate(), "yyyy-MM-dd"))
|
||||||
|
.setTurnover(new FinanceStsDTO.TurnoverSts()
|
||||||
|
.setTurnover(statistic.getPayAmount().add(statistic.getRechargeAmount()))
|
||||||
|
.setWechat(statistic.getWechatPayAmount())
|
||||||
|
.setAlipay(statistic.getAlipayPayAmount())
|
||||||
|
.setSelfScan(statistic.getMainScanPayAmount())
|
||||||
|
.setBarScan(statistic.getBackScanPayAmount())
|
||||||
|
.setCash(statistic.getCashPayAmount())
|
||||||
|
.setRecharge(statistic.getRechargeAmount())
|
||||||
|
.setOwed(statistic.getCreditPayAmount())
|
||||||
|
.setBalance(statistic.getMemberPayAmount()))
|
||||||
|
.setOrder(new FinanceStsDTO.OrderSts()
|
||||||
|
.setOrderAmount(statistic.getPayAmount())
|
||||||
|
.setOrderCount(statistic.getOrderCount()))
|
||||||
|
.setDiscount(new FinanceStsDTO.DiscountSts()
|
||||||
|
.setDiscountAmount(statistic.getDiscountAmount())
|
||||||
|
.setDiscountCount(statistic.getDiscountCount())
|
||||||
|
.setNewConsumerDiscount(statistic.getNewCustomerDiscountAmount())
|
||||||
|
.setFreeCashAmount(statistic.getBackDiscountAmount())
|
||||||
|
.setFullMinusAmount(statistic.getFullDiscountAmount())
|
||||||
|
.setCouponAmount(statistic.getCouponDiscountAmount())
|
||||||
|
.setMemberDiscount(statistic.getMemberDiscountAmount())
|
||||||
|
.setPointsDiscountAmount(statistic.getPointDiscountAmount())
|
||||||
|
.setOrderDiscount(statistic.getOrderPriceDiscountAmount()))
|
||||||
|
.setRefund(new FinanceStsDTO.RefundSts()
|
||||||
|
.setRefundAmount(statistic.getRefundAmount().add(statistic.getRechargeRefundAmount()))
|
||||||
|
.setOnlineRefundAmount(statistic.getOnlineRefundAmount())
|
||||||
|
.setCashRefundAmount(statistic.getCashRefundAmount())
|
||||||
|
.setCreditRefundAmount(statistic.getCreditRefundAmount())
|
||||||
|
.setMemberRefundAmount(statistic.getMemberRefundAmount())
|
||||||
|
.setRechargeRefundAmount(statistic.getRechargeRefundAmount())
|
||||||
|
.setOnlineRechargeRefundAmount(statistic.getOnlineRechargeRefundAmount())
|
||||||
|
.setCashRechargeRefundAmount(statistic.getCashRechargeRefundAmount()))
|
||||||
|
.setSts(new FinanceStsDTO.Sts()
|
||||||
|
.setCustomerCount(statistic.getCustomerCount())
|
||||||
|
.setOrderCount(statistic.getOrderCount())
|
||||||
|
.setTableCount(statistic.getTableCount())
|
||||||
|
.setAvgPayAmount(statistic.getAvgPayAmount())
|
||||||
|
.setTurnoverRate(statistic.getTurnoverRate())
|
||||||
|
.setProfitAmount(statistic.getProfitAmount())
|
||||||
|
.setProductCostAmount(statistic.getProductCostAmount())
|
||||||
|
.setProfitRate(statistic.getProfitRate())
|
||||||
|
.setNetProfitRate(statistic.getNetProfitRate())
|
||||||
|
.setNetProfitRate(statistic.getNetProfitRate()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void exportFinanceSts(FinanceStsQueryParam param, HttpServletResponse response) {
|
||||||
|
if (param.notValidDateRange()) {
|
||||||
|
throw new CzgException("日期范围无效");
|
||||||
|
}
|
||||||
|
|
||||||
|
ShopOrderStatistic statistic = getStatisticData(param);
|
||||||
|
|
||||||
|
if ("czg".equals(param.getPlatform())) {
|
||||||
|
ExcelExportUtil.exportToResponse(List.of(statistic), ShopOrderStatistic.class, "财务报表", response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw new CzgException("平台不支持");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ShopOrderStatistic getStatisticData(FinanceStsQueryParam param) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
if (param.getQueryDate().equals(today)) {
|
||||||
|
return orderStatisticService.getRealTimeDataByDay(param.getShopId(), param.getQueryDate());
|
||||||
|
}
|
||||||
|
return orderStatisticService.getStatSingleDate(param.getShopId(), param.getQueryDate());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1050,6 +1050,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
payment.setPayStatus(PayTypeConstants.PayStatus.FAIL);
|
payment.setPayStatus(PayTypeConstants.PayStatus.FAIL);
|
||||||
payment.setPlatformType(notifyRespDTO.getPlatform());
|
payment.setPlatformType(notifyRespDTO.getPlatform());
|
||||||
payment.setChannel(channel);
|
payment.setChannel(channel);
|
||||||
|
payment.setPayTime(LocalDateTimeUtil.parse(notifyRespDTO.getPaySuccessTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||||
if ("TRADE_SUCCESS".equals(notifyRespDTO.getStatus())) {
|
if ("TRADE_SUCCESS".equals(notifyRespDTO.getStatus())) {
|
||||||
payment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
payment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
||||||
if (PayTypeConstants.SourceType.ORDER.equals(payment.getSourceType())) {
|
if (PayTypeConstants.SourceType.ORDER.equals(payment.getSourceType())) {
|
||||||
@@ -1196,6 +1197,13 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
|||||||
if (orderInfo.getCreditBuyerId() != null) {
|
if (orderInfo.getCreditBuyerId() != null) {
|
||||||
upOrderInfo.setCreditBuyerId(orderInfo.getCreditBuyerId());
|
upOrderInfo.setCreditBuyerId(orderInfo.getCreditBuyerId());
|
||||||
}
|
}
|
||||||
|
if (PayEnums.FREE_PAY.equals(payType)) {
|
||||||
|
if (orderInfo.getDiscountAllAmount() == null) {
|
||||||
|
upOrderInfo.setDiscountAllAmount(orderInfo.getOrderAmount());
|
||||||
|
} else {
|
||||||
|
upOrderInfo.setDiscountAllAmount(orderInfo.getDiscountAllAmount().add(orderInfo.getOrderAmount()));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (ObjectUtil.isNotNull(payType)) {
|
if (ObjectUtil.isNotNull(payType)) {
|
||||||
upOrderInfo.setPayType(payType.getValue());
|
upOrderInfo.setPayType(payType.getValue());
|
||||||
orderInfo.setPayType(payType.getValue());
|
orderInfo.setPayType(payType.getValue());
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
String payOrderNo = orderInfo.getPlatformType() + CzgRandomUtils.snowflake();
|
||||||
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
Long paymentId = payService.initPayment(OrderPayment.orderPay(payParam.getShopId(), orderInfo.getId(), payOrderNo, orderInfo.getOrderAmount(), ""));
|
||||||
upOrderPayInfo(orderInfo.getId(), PayCst.Type.ALIPAY.equals(payParam.getPayType()) ? PayEnums.ALIPAY_MINI : PayEnums.WECHAT_MINI, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayEnums.MAIN_SCAN, paymentId,
|
||||||
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
|
||||||
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
return payService.pay(payParam.getShopId(), CzgPayEnum.JS_PAY,
|
||||||
CzgPayBaseReq.jsPayReq(payOrderNo, "扫码支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
CzgPayBaseReq.jsPayReq(payOrderNo, "扫码支付", orderInfo.getOrderAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -358,7 +358,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
|
||||||
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
|
||||||
// 事务成功提交后执行消息发送
|
// 事务成功提交后执行消息发送
|
||||||
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals( orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1";
|
||||||
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
|
||||||
} else {
|
} else {
|
||||||
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
|
||||||
@@ -375,10 +375,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
if (orderInfo.getStatus().equals(OrderStatusEnums.CANCELLED.getCode())) {
|
if (orderInfo.getStatus().equals(OrderStatusEnums.CANCELLED.getCode())) {
|
||||||
throw new CzgException("订单已过期不可退单");
|
throw new CzgException("订单已过期不可退单");
|
||||||
}
|
}
|
||||||
boolean isFirstRefund = true;
|
boolean isFirstRefund = orderInfo.getRefundAmount().compareTo(BigDecimal.ZERO) == 0;
|
||||||
if (orderInfo.getRefundAmount().compareTo(BigDecimal.ZERO) != 0) {
|
|
||||||
isFirstRefund = false;
|
|
||||||
}
|
|
||||||
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
ShopInfo shopInfo = shopInfoService.getById(orderInfo.getShopId());
|
||||||
Map<String, BigDecimal> returnProMap = new HashMap<>();
|
Map<String, BigDecimal> returnProMap = new HashMap<>();
|
||||||
boolean isPay = true;
|
boolean isPay = true;
|
||||||
@@ -437,9 +434,8 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
returnProMap.put(Convert.toStr(orderDetail.getProductId()), refundDetail.getNum());
|
returnProMap.put(Convert.toStr(orderDetail.getProductId()), refundDetail.getNum());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
long count = orderDetailService.queryChain()
|
long count = orderDetailService.count(QueryWrapper.create().eq(OrderDetail::getOrderId, orderInfo.getId())
|
||||||
.eq(OrderDetail::getOrderId, orderInfo.getId())
|
.ne(OrderDetail::getStatus, OrderStatusEnums.REFUND.getCode()));
|
||||||
.ne(OrderDetail::getStatus, OrderStatusEnums.REFUND.getCode()).count();
|
|
||||||
if (count > 0 && isPay) {
|
if (count > 0 && isPay) {
|
||||||
orderInfo.setStatus(OrderStatusEnums.PART_REFUND.getCode());
|
orderInfo.setStatus(OrderStatusEnums.PART_REFUND.getCode());
|
||||||
} else if (isPay) {
|
} else if (isPay) {
|
||||||
@@ -447,10 +443,9 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
|
orderInfo.setStatus(OrderStatusEnums.REFUND.getCode());
|
||||||
List<OrderDetail> orderDetails = orderDetailService.queryChain()
|
List<OrderDetail> orderDetails = orderDetailService.list(
|
||||||
.select(OrderDetail::getId, OrderDetail::getProductId, OrderDetail::getNum, OrderDetail::getReturnNum, OrderDetail::getPackAmount, OrderDetail::getReturnNum)
|
QueryWrapper.create().select(OrderDetail::getId, OrderDetail::getProductId, OrderDetail::getNum, OrderDetail::getReturnNum, OrderDetail::getPackAmount, OrderDetail::getReturnNum)
|
||||||
.eq(OrderDetail::getOrderId, orderInfo.getId())
|
.eq(OrderDetail::getOrderId, orderInfo.getId()));
|
||||||
.list();
|
|
||||||
for (OrderDetail orderDetail : orderDetails) {
|
for (OrderDetail orderDetail : orderDetails) {
|
||||||
if (isPay) {
|
if (isPay) {
|
||||||
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
if (orderDetail.getProductId() != null && orderDetail.getProductId() > 0) {
|
||||||
@@ -517,7 +512,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||||
OrderPayment payment = paymentService.getById(payOrderId);
|
OrderPayment payment = paymentService.getById(payOrderId);
|
||||||
AssertUtil.isNull(payment, "退款失败支付记录不存在");
|
AssertUtil.isNull(payment, "退款失败支付记录不存在");
|
||||||
Long refundId = payService.initPayment(OrderPayment.refund(shopId, orderId, PayTypeConstants.SourceType.ORDER,
|
Long refundId = payService.initPayment(OrderPayment.refund(payment.getChannel(), shopId, orderId, PayTypeConstants.SourceType.ORDER,
|
||||||
refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
||||||
|
|
||||||
CzgResult<RefundRespDTO> refund = payService.refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(PayService.MONEY_RATE).longValue(),
|
CzgResult<RefundRespDTO> refund = payService.refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(PayService.MONEY_RATE).longValue(),
|
||||||
@@ -529,6 +524,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
throw new CzgException(refund.getMsg());
|
throw new CzgException(refund.getMsg());
|
||||||
} else {
|
} else {
|
||||||
OrderPayment upPayment = new OrderPayment();
|
OrderPayment upPayment = new OrderPayment();
|
||||||
|
upPayment.setPayStatus(PayTypeConstants.PayStatus.SUCCESS);
|
||||||
upPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime()));
|
upPayment.setPayTime(LocalDateTimeUtil.parse(refund.getData().getRefundTime()));
|
||||||
upPayment.setTradeNumber(refund.getData().getThirdRefundNo());
|
upPayment.setTradeNumber(refund.getData().getThirdRefundNo());
|
||||||
upPayment.setRespJson(refund.getData().getOriginalData());
|
upPayment.setRespJson(refund.getData().getOriginalData());
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ public class PayServiceImpl implements PayService {
|
|||||||
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
@NonNull String refundReason, @NonNull BigDecimal refundAmount) {
|
||||||
OrderPayment payment = paymentService.getById(payOrderId);
|
OrderPayment payment = paymentService.getById(payOrderId);
|
||||||
AssertUtil.isNull(payment, "退款失败,支付记录不存在");
|
AssertUtil.isNull(payment, "退款失败,支付记录不存在");
|
||||||
Long refundId = initPayment(OrderPayment.refund(shopId, sourceId, payment.getSourceType(), refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
Long refundId = initPayment(OrderPayment.refund(payment.getChannel(), shopId, sourceId, payment.getSourceType(), refPayOrderNo, refundAmount, payment.getId(), payment.getPlatformType()));
|
||||||
CzgResult<RefundRespDTO> refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
CzgResult<RefundRespDTO> refund = refund(shopId, new CzgRefundReq(refPayOrderNo, refundReason, refundAmount.multiply(MONEY_RATE).longValue(),
|
||||||
payment.getAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getOrderNo(), "", payment.getPlatformType()));
|
payment.getAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getOrderNo(), "", payment.getPlatformType()));
|
||||||
OrderPayment uOrderPayment = new OrderPayment();
|
OrderPayment uOrderPayment = new OrderPayment();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
}
|
}
|
||||||
if (day <= 1) {
|
if (day <= 1) {
|
||||||
return List.of(onlineDataAmount);
|
return List.of(onlineDataAmount);
|
||||||
}else {
|
} else {
|
||||||
startDate = currentDate.minusDays(day - 1);
|
startDate = currentDate.minusDays(day - 1);
|
||||||
}
|
}
|
||||||
List<TotalVo> statDateRange = mapper.getStatDateRange(shopId, startDate, currentDate);
|
List<TotalVo> statDateRange = mapper.getStatDateRange(shopId, startDate, currentDate);
|
||||||
@@ -84,7 +84,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
if (day <= 1) {
|
if (day <= 1) {
|
||||||
Map<String, BigDecimal> onlinePayTypeDate = mapper.getOnlinePayTypeDate(shopId, currentDate);
|
Map<String, BigDecimal> onlinePayTypeDate = mapper.getOnlinePayTypeDate(shopId, currentDate);
|
||||||
return CountPayTypeVo.realTimeDataByDay(onlinePayTypeDate);
|
return CountPayTypeVo.realTimeDataByDay(onlinePayTypeDate);
|
||||||
}else {
|
} else {
|
||||||
startDate = currentDate.minusDays(day - 1);
|
startDate = currentDate.minusDays(day - 1);
|
||||||
}
|
}
|
||||||
return CountPayTypeVo.mergePayTypeData(
|
return CountPayTypeVo.mergePayTypeData(
|
||||||
@@ -104,7 +104,7 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
}
|
}
|
||||||
if (day <= 1) {
|
if (day <= 1) {
|
||||||
return List.of(onlineProfitRateBarChart);
|
return List.of(onlineProfitRateBarChart);
|
||||||
}else {
|
} else {
|
||||||
startDate = currentDate.minusDays(day - 1);
|
startDate = currentDate.minusDays(day - 1);
|
||||||
}
|
}
|
||||||
List<ProfitRateVO> statDateRange = mapper.profitRateBarChart(shopId, startDate, currentDate);
|
List<ProfitRateVO> statDateRange = mapper.profitRateBarChart(shopId, startDate, currentDate);
|
||||||
@@ -180,13 +180,14 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
result.setTableCount(Optional.ofNullable(tableCount).orElse(0L));
|
result.setTableCount(Optional.ofNullable(tableCount).orElse(0L));
|
||||||
result.setProductCostAmount(Optional.ofNullable(productCostAmount).orElse(BigDecimal.ZERO));
|
result.setProductCostAmount(Optional.ofNullable(productCostAmount).orElse(BigDecimal.ZERO));
|
||||||
|
|
||||||
//会员充值退款 充值退款金额(线上退款+现金退款)
|
//会员充值金额(线上充值+现金充值+霸王餐充值)
|
||||||
BigDecimal cashRechargeAmount = Objects.requireNonNullElse(result.getCashRechargeAmount(), BigDecimal.ZERO);
|
BigDecimal cashRechargeAmount = Objects.requireNonNullElse(result.getCashRechargeAmount(), BigDecimal.ZERO);
|
||||||
BigDecimal onlineRechargeAmount = Objects.requireNonNullElse(result.getOnlineRechargeAmount(), BigDecimal.ZERO);
|
BigDecimal onlineRechargeAmount = Objects.requireNonNullElse(result.getOnlineRechargeAmount(), BigDecimal.ZERO);
|
||||||
BigDecimal rechargeAmount = cashRechargeAmount.add(onlineRechargeAmount);
|
BigDecimal freeRechargeAmount = Objects.requireNonNullElse(onlineStat != null ? onlineStat.getBackDiscountAmount() : null, BigDecimal.ZERO);
|
||||||
|
BigDecimal rechargeAmount = cashRechargeAmount.add(onlineRechargeAmount).add(freeRechargeAmount);
|
||||||
result.setRechargeAmount(rechargeAmount);
|
result.setRechargeAmount(rechargeAmount);
|
||||||
//会员充值退款 充值退款金额(线上退款+现金退款)
|
//会员充值退款 充值退款金额(线上退款+现金退款)
|
||||||
BigDecimal onlineRefundAmount = Objects.requireNonNullElse(
|
BigDecimal onlineRechargeRefundAmount = Objects.requireNonNullElse(
|
||||||
(onlineStat != null) ? onlineStat.getOnlineRechargeRefundAmount() : null,
|
(onlineStat != null) ? onlineStat.getOnlineRechargeRefundAmount() : null,
|
||||||
BigDecimal.ZERO
|
BigDecimal.ZERO
|
||||||
);
|
);
|
||||||
@@ -194,7 +195,9 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
|||||||
(userFlowStat != null) ? userFlowStat.getCashRechargeRefundAmount() : null,
|
(userFlowStat != null) ? userFlowStat.getCashRechargeRefundAmount() : null,
|
||||||
BigDecimal.ZERO
|
BigDecimal.ZERO
|
||||||
);
|
);
|
||||||
BigDecimal rechargeRefundAmountTotal = onlineRefundAmount.add(userFlowRefundAmount);
|
BigDecimal rechargeRefundAmountTotal = onlineRechargeRefundAmount.add(userFlowRefundAmount);
|
||||||
|
result.setOnlineRefundAmount(onlineStat == null ? BigDecimal.ZERO : onlineStat.getOnlineRefundAmount());
|
||||||
|
result.setOnlineRechargeRefundAmount(onlineStat == null ? BigDecimal.ZERO : onlineStat.getOnlineRechargeRefundAmount());
|
||||||
result.setRechargeRefundAmount(rechargeRefundAmountTotal);
|
result.setRechargeRefundAmount(rechargeRefundAmountTotal);
|
||||||
//实付金额 (线上付款 现金支付 会员支付 挂账)
|
//实付金额 (线上付款 现金支付 会员支付 挂账)
|
||||||
BigDecimal onlinePayAmount = (onlineStat != null)
|
BigDecimal onlinePayAmount = (onlineStat != null)
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ public class ShopUserServiceImpl implements ShopUserPayService {
|
|||||||
return CzgResult.failure("退款失败,该充值记录不存在");
|
return CzgResult.failure("退款失败,该充值记录不存在");
|
||||||
}
|
}
|
||||||
String refPayOrderNo = "REFVIP" + IdUtil.getSnowflakeNextId();
|
String refPayOrderNo = "REFVIP" + IdUtil.getSnowflakeNextId();
|
||||||
refPaymentId = payService.initPayment(OrderPayment.refund(refPayParam.getShopId(), shopUser.getId(), PayTypeConstants.SourceType.MEMBER_IN,
|
refPaymentId = payService.initPayment(OrderPayment.refund(payment.getChannel(), refPayParam.getShopId(), shopUser.getId(), PayTypeConstants.SourceType.MEMBER_IN,
|
||||||
refPayOrderNo, refPayParam.getRefAmount(), inFlow.getId(), payment.getPlatformType()));
|
refPayOrderNo, refPayParam.getRefAmount(), inFlow.getId(), payment.getPlatformType()));
|
||||||
CzgResult<RefundRespDTO> refund = payService.refund(refPayParam.getShopId(), new CzgRefundReq(refPayOrderNo, refPayParam.getRemark(),
|
CzgResult<RefundRespDTO> refund = payService.refund(refPayParam.getShopId(), new CzgRefundReq(refPayOrderNo, refPayParam.getRemark(),
|
||||||
refPayParam.getRefAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getAmount().multiply(PayService.MONEY_RATE).longValue(),
|
refPayParam.getRefAmount().multiply(PayService.MONEY_RATE).longValue(), payment.getAmount().multiply(PayService.MONEY_RATE).longValue(),
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user