Merge branch 'test' into prod

# Conflicts:
#	cash-api/order-server/src/main/java/com/czg/controller/pay/OrderPayController.java
This commit is contained in:
2026-01-30 16:02:25 +08:00
54 changed files with 2065 additions and 112 deletions

View File

@@ -97,6 +97,17 @@ public class ShopUserController {
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")
public CzgResult<Page<ShopUser>> getPage(@RequestParam(required = false)String key,@RequestParam(required = false) Integer isVip) {
return CzgResult.success(shopUserService.getPage(key, isVip));

View File

@@ -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())));
}
}

View File

@@ -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, false));
}
}
}

View File

@@ -0,0 +1,47 @@
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 {
return CzgResult.success(mkShareBaseService.updateById(shareBase, false));
}
}
}

View File

@@ -1,5 +1,6 @@
package com.czg.controller.admin;
import com.czg.annotation.Debounce;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.log.annotation.OperationLog;
import com.czg.market.dto.MkDistributionUserDTO;
@@ -57,6 +58,7 @@ public class DistributionUserController {
*
* @return 是否成功
*/
@Debounce
@PostMapping
@OperationLog("分销员-添加")
@SaAdminCheckPermission(parentName = "分销相关",value = "distribution:user:add", name = "分销员添加")

View File

@@ -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();
}
}

View File

@@ -3,6 +3,7 @@ package com.czg.controller.user;
import com.czg.account.entity.UserInfo;
import com.czg.market.dto.MkDistributionUserDTO;
import com.czg.market.dto.MkDistributionWithdrawFlowDTO;
import com.czg.market.entity.MkDistributionUser;
import com.czg.market.entity.MkDistributionWithdrawFlow;
import com.czg.market.service.MkDistributionConfigService;
import com.czg.market.service.MkDistributionFlowService;
@@ -16,17 +17,16 @@ import com.czg.sa.StpKit;
import com.czg.task.DistributionTask;
import com.czg.utils.AssertUtil;
import com.mybatisflex.core.paginate.Page;
import io.seata.core.exception.TransactionException;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.NestedExceptionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* 分销相关
* 全民股东相关
*
* @author Administrator
*/
@@ -60,7 +60,7 @@ public class UDistributionController {
/**
* 分销员中心-获取配置
* 全民股东=-获取配置
*/
@GetMapping("/getConfig")
public CzgResult<MkDistributionConfigVO> getConfig(@RequestParam Long shopId) {
@@ -68,7 +68,7 @@ public class UDistributionController {
}
/**
* 分销员中心-首页
* 全民股东-首页
*/
@PostMapping("/centerUser")
public CzgResult<Map<String, Object>> centerUser() {
@@ -76,7 +76,7 @@ public class UDistributionController {
}
/**
* 分销员中心-已开通的店铺
* 全民股东界-已开通的店铺
*/
@GetMapping("/centerUser/activates")
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")
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")
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")
public CzgResult<String> getInviteCode(@RequestParam Long shopId, @RequestParam Long 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")
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")
public CzgResult<Map<String, Object>> bindInviteUser(@RequestBody MkDistributionUserDTO param) {
@@ -160,7 +144,7 @@ public class UDistributionController {
}
/**
* 分销员:获取邀请人分页列表
* 全民股东:获取邀请人分页列表
*/
@GetMapping("/inviteUser")
public CzgResult<Page<InviteUserVO>> getInviteUser(

View File

@@ -20,6 +20,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -44,6 +45,8 @@ public class OrderPayController {
private OrderInfoService orderInfoService;
@DubboReference
private SysParamsService paramsService;
@Value("${spring.profiles.active}")
private String env;
@PostMapping("/creditPay")
@Debounce(value = "#payParam.checkOrderPay.orderId")
@@ -154,6 +157,7 @@ public class OrderPayController {
AssertUtil.isNull(shopId, "店铺id不能为空");
AssertUtil.isNull(checkOrderPay, "订单信息不能为空");
Map<String, Object> map = new HashMap<>();
map.put("env", env);
map.put("shopId", shopId);
map.put("orderId", checkOrderPay.getOrderId());
map.put("payAmount", checkOrderPay.getOrderAmount());

View File

@@ -38,7 +38,7 @@ public class EntryManagerTask {
log.info("进件查询,定时任务执行");
long start = System.currentTimeMillis();
entryManager(null);
log.info("进件查询,定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis());
log.info("进件查询,定时任务执行完毕,耗时:{}ms", System.currentTimeMillis() - start);
}
/**

View File

@@ -17,6 +17,7 @@ import java.util.List;
/**
* 统计任务
*
* @author Administrator
*/
@Component
@@ -43,7 +44,7 @@ public class StatisticTask {
// 获取前一天
LocalDate yesterday = LocalDate.now().minusDays(1);
baseStatistic(yesterday);
log.info("统计数据,定时任务执行完毕,耗时:{}ms", start - System.currentTimeMillis());
log.info("统计数据,定时任务执行完毕,耗时:{}ms", System.currentTimeMillis() - start);
}

View File

@@ -2,6 +2,7 @@ package com.czg.controller.admin;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.thread.ThreadUtil;
import com.alibaba.fastjson2.JSONObject;
import com.czg.account.entity.ShopInfo;
import com.czg.account.service.ShopInfoService;
import com.czg.config.RabbitPublisher;
@@ -26,10 +27,12 @@ import com.czg.validator.group.InsertGroup;
import com.czg.validator.group.UpdateGroup;
import com.mybatisflex.core.paginate.Page;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
@@ -66,9 +69,24 @@ public class ProductController {
@GetMapping("page")
@OperationLog("商品-分页")
//@SaAdminCheckPermission("product:page")
public CzgResult<Page<ProductDTO>> getProductPage(ProductDTO param) {
public CzgResult<Map<String, Object>> getProductPage(ProductDTO 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);
List<ProductDTO> productList = productService.getProductCacheList(param);
productService.refreshProductStock(param, productList);
productList.forEach(prod -> {
prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime()));
});
productList.forEach(prod -> prod.setIsSaleTime(uProductService.calcIsSaleTime(prod.getDays(), prod.getStartTime(), prod.getEndTime())));
return CzgResult.success(productList);
}
@@ -111,13 +127,11 @@ public class ProductController {
for (ProdSkuDTO prodSkuDTO : dto.getSkuList()) {
ValidatorUtil.validateEntity(prodSkuDTO, DefaultGroup.class);
}
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
dto.setShopId(shopId);
productService.addProduct(dto);
asyncProductToShop(dto.getId());
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
});
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
return CzgResult.success();
}
@@ -140,13 +154,11 @@ public class ProductController {
if (dto.getStockNumber() != null) {
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);
productService.updateProduct(dto);
asyncProductToShop(dto.getId());
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
});
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
return CzgResult.success();
}
@@ -155,12 +167,10 @@ public class ProductController {
//@SaStaffCheckPermission("yun_xu_xiu_gai_shang_pin")
public CzgResult<Void> updateProductStock(@RequestBody ProductModifyStockParam param) {
ValidatorUtil.validateEntity(param, DefaultGroup.class);
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
param.setShopId(shopId);
productService.updateProductStock(param);
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
});
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
return CzgResult.success();
}
@@ -176,12 +186,10 @@ public class ProductController {
public CzgResult<Void> deleteProduct(@PathVariable("id") Long id) {
//效验数据
AssertUtil.isNull(id, "{}不能为空", "id");
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
productService.deleteProduct(shopId, id);
asyncProductToShop(id);
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
});
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
return CzgResult.success();
}
@@ -193,12 +201,10 @@ public class ProductController {
//@SaStaffCheckPermission("yun_xu_shang_xia_jia_shang_pin")
//@SaAdminCheckPermission("product:on-off")
public CzgResult<Void> onOffProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSaleParam param) {
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
param.setShopId(shopId);
productService.onOffProduct(param);
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
});
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
return CzgResult.success();
}
@@ -210,12 +216,10 @@ public class ProductController {
//@SaStaffCheckPermission("yun_xu_shou_qing_shang_pin")
//@SaAdminCheckPermission("product:markIsSoldOut")
public CzgResult<Void> markIsSoldOutProduct(@RequestBody @Validated({DefaultGroup.class}) ProductIsSoldOutParam param) {
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
param.setShopId(shopId);
productService.markProductIsSoldOut(param);
ThreadUtil.execAsync(() -> {
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
});
ThreadUtil.execAsync(() -> rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId)));
return CzgResult.success();
}
@@ -312,9 +316,7 @@ public class ProductController {
if (shopInfo.getMainId() == null || shopId == shopInfo.getMainId()) {
throw new CzgException("不存在主子店铺关系,无需同步商品信息");
}
ThreadUtil.execAsync(() -> {
shopSyncService.sync(shopInfo.getMainId(), shopId, shopId);
});
ThreadUtil.execAsync(() -> shopSyncService.sync(shopInfo.getMainId(), shopId, shopId));
CzgResult<Void> ret = CzgResult.success();
ret.setMsg("操作成功,数据正在后台同步中...");
return ret;
@@ -322,15 +324,11 @@ public class ProductController {
private void asyncProductToShop(Long id) {
long shopId = StpKit.USER.getShopId(0L);
ThreadUtil.execAsync(() -> {
shopSyncService.syncProductBySourceShop(shopId, id, shopId);
});
ThreadUtil.execAsync(() -> shopSyncService.syncProductBySourceShop(shopId, id, shopId));
}
private void asyncConsProToShop(Long id) {
long shopId = StpKit.USER.getShopId(0L);
ThreadUtil.execAsync(() -> {
shopSyncService.syncConsProBySourceShop(shopId, id, shopId);
});
ThreadUtil.execAsync(() -> shopSyncService.syncConsProBySourceShop(shopId, id, shopId));
}
}

View File

@@ -58,7 +58,7 @@ public class MiniAppPagesController {
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
*/
@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) {
return miniAppPageService.getMiniAppPage(name, path, status);
}