切换店铺统计 √
下单选择会员 √ 注册会员 √ 完善手机号 √ 会员流水信息同步 √
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.shopuser.*;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.ShopUserFlow;
|
||||
import com.czg.account.service.ShopUserFlowService;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.account.vo.ShopUserFlowVO;
|
||||
@@ -12,9 +10,7 @@ import com.czg.annotation.SaStaffCheckPermission;
|
||||
import com.czg.enums.ShopUserFlowBizEnum;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -47,7 +43,7 @@ public class ShopUserController {
|
||||
@GetMapping("/summary")
|
||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||
public CzgResult<ShopUserSummaryDTO> summary(Integer isVip) {
|
||||
return CzgResult.success(shopUserService.getSummary(StpKit.USER.getShopId(), isVip));
|
||||
return CzgResult.success(shopUserService.getSummary(StpKit.USER.getHeadShopId(), isVip));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +67,7 @@ public class ShopUserController {
|
||||
@GetMapping("/flow")
|
||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||
public CzgResult<Page<ShopUserFlowVO>> flow(Integer userId, String bizCode, String startTime, String endTime) {
|
||||
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getShopId(), userId, bizCode, startTime, endTime));
|
||||
return CzgResult.success(shopUserFlowService.pageInfo(StpKit.USER.getHeadShopId(), userId, bizCode, startTime, endTime));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +83,7 @@ public class ShopUserController {
|
||||
@GetMapping("/flow/download")
|
||||
@SaStaffCheckPermission("yun_xu_guan_li_hui_yuan_xin_xi")
|
||||
public void flowDownload(Integer userId, String bizCode, String startTime, String endTime, HttpServletResponse response) throws IOException {
|
||||
shopUserFlowService.flowDownload(StpKit.USER.getShopId(), userId, bizCode, startTime, endTime, response);
|
||||
shopUserFlowService.flowDownload(StpKit.USER.getHeadShopId(), userId, bizCode, startTime, endTime, response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -129,7 +125,7 @@ public class ShopUserController {
|
||||
@SaAdminCheckPermission(value = "shopUser:add", name = "店铺用户添加")
|
||||
@PostMapping
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated ShopUserAddDTO shopUserAddDTO) {
|
||||
return CzgResult.success(shopUserService.add(StpKit.USER.getShopId(), shopUserAddDTO));
|
||||
return CzgResult.success(shopUserService.add(StpKit.USER.getHeadShopId(), shopUserAddDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +137,7 @@ public class ShopUserController {
|
||||
@SaAdminCheckPermission(value = "shopUser:edit", name = "店铺用户修改")
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated ShopUserEditDTO shopUserEditDTO) {
|
||||
return CzgResult.success(shopUserService.updateInfo(StpKit.USER.getShopId(), shopUserEditDTO));
|
||||
return CzgResult.success(shopUserService.updateInfo(StpKit.USER.getHeadShopId(), shopUserEditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,7 +150,7 @@ public class ShopUserController {
|
||||
@PutMapping("/money")
|
||||
public CzgResult<Boolean> editMoney(@RequestBody @Validated ShopUserMoneyEditDTO shopUserMoneyEditDTO) {
|
||||
shopUserMoneyEditDTO.setBizEnum(ShopUserFlowBizEnum.ADMIN_IN);
|
||||
return CzgResult.success(shopUserService.updateMoney(StpKit.USER.getShopId(), shopUserMoneyEditDTO) > 0L);
|
||||
return CzgResult.success(shopUserService.updateMoney(StpKit.USER.getHeadShopId(), shopUserMoneyEditDTO) > 0L);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.czg.account.dto.shopuser.ShopUserAddDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserDetailDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
|
||||
import com.czg.account.entity.MemberPointsLog;
|
||||
import com.czg.account.entity.PointsExchangeRecord;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.czg.account.entity.ShopUserFlow;
|
||||
import com.czg.account.service.MemberPointsLogService;
|
||||
@@ -18,14 +17,9 @@ import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 店铺会员相关
|
||||
*
|
||||
@@ -51,7 +45,7 @@ public class UShopUserController {
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<ShopUserDetailDTO> get(Long shopId) {
|
||||
return CzgResult.success(shopUserService.getInfo(shopId == null ? StpKit.USER.getShopId() : shopId, StpKit.USER.getLoginIdAsLong()));
|
||||
return CzgResult.success(shopUserService.getInfo(shopId == null ? StpKit.USER.getHeadShopId() : shopId, StpKit.USER.getLoginIdAsLong()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,7 +65,7 @@ public class UShopUserController {
|
||||
*/
|
||||
@GetMapping("/code")
|
||||
public CzgResult<String> code(Long shopId) {
|
||||
return shopUserService.getCode(StpKit.USER.getLoginIdAsLong(), shopId == null ? StpKit.USER.getShopId() : shopId);
|
||||
return shopUserService.getCode(StpKit.USER.getLoginIdAsLong(), shopId == null ? StpKit.USER.getHeadShopId() : shopId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,7 +76,7 @@ public class UShopUserController {
|
||||
@PostMapping
|
||||
@Debounce("#shopUserAddDTO.phone")
|
||||
public CzgResult<Boolean> join(@RequestBody @Validated ShopUserAddDTO shopUserAddDTO) {
|
||||
return CzgResult.success(shopUserService.join(StpKit.USER.getShopId(), StpKit.USER.getLoginIdAsLong(), shopUserAddDTO));
|
||||
return CzgResult.success(shopUserService.join(StpKit.USER.getHeadShopId(), StpKit.USER.getLoginIdAsLong(), shopUserAddDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.czg.controller.user;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoEditDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoPwdEditDTO;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -38,7 +34,7 @@ public class UserController {
|
||||
*/
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> update(@RequestBody UserInfoEditDTO userInfoEditDTO) {
|
||||
return CzgResult.success(userInfoService.updateInfo(StpKit.USER.getShopId(-1L), StpKit.USER.getLoginIdAsLong(), userInfoEditDTO));
|
||||
return CzgResult.success(userInfoService.updateInfo(StpKit.USER.getHeadShopId(), StpKit.USER.getLoginIdAsLong(), userInfoEditDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ConsGroupDTO;
|
||||
import com.czg.product.service.ConsGroupService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -27,6 +31,8 @@ import java.util.List;
|
||||
@RequestMapping("/admin/product/consGroup")
|
||||
public class ConsGroupController {
|
||||
private final ConsGroupService consGroupService;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
@@ -72,6 +78,7 @@ public class ConsGroupController {
|
||||
//@SaAdminCheckPermission("consGroup:add")
|
||||
public CzgResult<Void> addConsGroup(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ConsGroupDTO dto) {
|
||||
consGroupService.addConsGroup(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -83,6 +90,7 @@ public class ConsGroupController {
|
||||
//@SaAdminCheckPermission("consGroup:update")
|
||||
public CzgResult<Void> updateConsGroup(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ConsGroupDTO dto) {
|
||||
consGroupService.updateConsGroup(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -98,6 +106,7 @@ public class ConsGroupController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
consGroupService.disableConsGroup(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -113,6 +122,15 @@ public class ConsGroupController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
consGroupService.enableConsGroup(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncConsGroupBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.czg.enums.CrudEnum;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ConsInfoDTO;
|
||||
import com.czg.product.param.ConsInfoParam;
|
||||
import com.czg.product.param.ConsReportDamageParam;
|
||||
import com.czg.product.param.ConsSubUnitParam;
|
||||
import com.czg.product.service.ConsInfoService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.product.vo.ConsStatisticsVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
@@ -16,6 +17,7 @@ import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -34,6 +36,8 @@ import java.util.List;
|
||||
@RequestMapping("/admin/product/cons")
|
||||
public class ConsInfoController {
|
||||
private final ConsInfoService consInfoService;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
@@ -79,6 +83,7 @@ public class ConsInfoController {
|
||||
//@SaAdminCheckPermission("consInfo:add")
|
||||
public CzgResult<Void> addConsInfo(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ConsInfoDTO dto) {
|
||||
consInfoService.addConsInfo(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -90,6 +95,7 @@ public class ConsInfoController {
|
||||
//@SaAdminCheckPermission("consInfo:update")
|
||||
public CzgResult<Void> updateConsInfo(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ConsInfoDTO dto) {
|
||||
consInfoService.updateConsInfo(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -120,6 +126,7 @@ public class ConsInfoController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
consInfoService.disableConsInfo(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -135,6 +142,7 @@ public class ConsInfoController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
consInfoService.enableConsInfo(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -167,6 +175,7 @@ public class ConsInfoController {
|
||||
ValidatorUtil.validateEntity(param, InsertGroup.class);
|
||||
}
|
||||
consInfoService.modifySubUnit(param);
|
||||
asyncToBranchShop(param.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -183,4 +192,12 @@ public class ConsInfoController {
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncConsInfoBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.czg.config.RabbitPublisher;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ProdGroupDTO;
|
||||
import com.czg.product.service.ProdGroupService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
@@ -13,6 +14,7 @@ import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -32,6 +34,8 @@ import java.util.List;
|
||||
public class ProdGroupController {
|
||||
private final ProdGroupService prodGroupService;
|
||||
private final RabbitPublisher rabbitPublisher;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
@@ -79,6 +83,7 @@ public class ProdGroupController {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
prodGroupService.addProdGroup(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -95,6 +100,7 @@ public class ProdGroupController {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
prodGroupService.updateProdGroup(dto,true);
|
||||
asyncToBranchShop(dto.getId());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -111,6 +117,7 @@ public class ProdGroupController {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
prodGroupService.updateProdGroup(dto,false);
|
||||
asyncToBranchShop(dto.getId());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -145,6 +152,7 @@ public class ProdGroupController {
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
prodGroupService.disableProdGroup(shopId, id);
|
||||
asyncToBranchShop(id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -162,9 +170,18 @@ public class ProdGroupController {
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
prodGroupService.enableProdGroup(shopId, id);
|
||||
asyncToBranchShop(id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncGroupBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import com.czg.product.entity.ProductStockFlow;
|
||||
import com.czg.product.param.*;
|
||||
import com.czg.product.service.ProdConsRelationService;
|
||||
import com.czg.product.service.ProductService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.product.vo.ProductStatisticsVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
@@ -24,6 +25,7 @@ import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -44,6 +46,8 @@ public class ProductController {
|
||||
private final ProductService productService;
|
||||
private final ProdConsRelationService prodConsRelationService;
|
||||
private final RabbitPublisher rabbitPublisher;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
/**
|
||||
* 商品-分页
|
||||
@@ -109,6 +113,7 @@ public class ProductController {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
productService.addProduct(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -137,6 +142,7 @@ public class ProductController {
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
dto.setShopId(shopId);
|
||||
productService.updateProduct(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -168,6 +174,7 @@ public class ProductController {
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
Long shopId = StpKit.USER.getShopId(0L);
|
||||
productService.deleteProduct(shopId, id);
|
||||
asyncToBranchShop(id);
|
||||
ThreadUtil.execAsync(() -> {
|
||||
rabbitPublisher.sendProductInfoChangeMsg(Convert.toStr(shopId));
|
||||
});
|
||||
@@ -216,6 +223,7 @@ public class ProductController {
|
||||
//@SaAdminCheckPermission("product:bind")
|
||||
public CzgResult<Void> bindCons(@RequestBody @Validated({DefaultGroup.class}) ProdConsBindDTO param) {
|
||||
prodConsRelationService.saveProdConsRelation(param);
|
||||
asyncToBranchShop2(param.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -227,6 +235,7 @@ public class ProductController {
|
||||
//@SaAdminCheckPermission("product:update")
|
||||
public CzgResult<Void> refundToStock(@RequestBody @Validated({DefaultGroup.class}) ProdRefundToStockParam param) {
|
||||
productService.refundToStock(param);
|
||||
asyncToBranchShop(param.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -282,4 +291,20 @@ public class ProductController {
|
||||
return CzgResult.success(data);
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncProductBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
|
||||
private void asyncToBranchShop2(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncConsProBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ShopProdCategoryDTO;
|
||||
import com.czg.product.service.ShopProdCategoryService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -27,6 +31,8 @@ import java.util.List;
|
||||
@RequestMapping("/admin/prod/category")
|
||||
public class ShopProdCategoryController {
|
||||
private final ShopProdCategoryService shopProdCategoryService;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品分类-分页")
|
||||
@@ -58,6 +64,7 @@ public class ShopProdCategoryController {
|
||||
//@SaAdminCheckPermission("shopProdCategory:add")
|
||||
public CzgResult<Void> addShopProdCategory(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopProdCategoryDTO dto) {
|
||||
shopProdCategoryService.addShopProdCategory(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -66,6 +73,7 @@ public class ShopProdCategoryController {
|
||||
//@SaAdminCheckPermission("shopProdCategory:update")
|
||||
public CzgResult<Void> updateShopProdCategory(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopProdCategoryDTO dto) {
|
||||
shopProdCategoryService.updateShopProdCategory(dto);
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -86,6 +94,7 @@ public class ShopProdCategoryController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopProdCategoryService.disableShopProdCategory(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -96,7 +105,16 @@ public class ShopProdCategoryController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopProdCategoryService.enableShopProdCategory(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncCategoryBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ShopProdSpecDTO;
|
||||
import com.czg.product.service.ShopProdSpecService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.ValidatorUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -26,6 +31,9 @@ import java.util.List;
|
||||
@RequestMapping("/admin/prod/spec")
|
||||
public class ShopProdSpecController {
|
||||
private final ShopProdSpecService shopProdSpecService;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
|
||||
@GetMapping("list")
|
||||
@OperationLog("商品规格-列表")
|
||||
@@ -50,9 +58,8 @@ public class ShopProdSpecController {
|
||||
public CzgResult<Void> addShopProdSpec(@RequestBody ShopProdSpecDTO dto) {
|
||||
//效验数据
|
||||
ValidatorUtil.validateEntity(dto, InsertGroup.class, DefaultGroup.class);
|
||||
|
||||
shopProdSpecService.addShopProdSpec(dto);
|
||||
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -62,9 +69,11 @@ public class ShopProdSpecController {
|
||||
public CzgResult<Void> updateShopProdSpec(@RequestBody ShopProdSpecDTO dto) {
|
||||
//效验数据
|
||||
ValidatorUtil.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
|
||||
|
||||
shopProdSpecService.updateShopProdSpec(dto);
|
||||
|
||||
List<Long> affectedIdList = dto.getAffectedIdList();
|
||||
if (CollUtil.isNotEmpty(affectedIdList)) {
|
||||
affectedIdList.parallelStream().forEach(this::asyncToBranchShop);
|
||||
}
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -85,6 +94,7 @@ public class ShopProdSpecController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopProdSpecService.disableShopProdSpec(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -95,6 +105,7 @@ public class ShopProdSpecController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopProdSpecService.enableShopProdSpec(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -103,6 +114,10 @@ public class ShopProdSpecController {
|
||||
//@SaAdminCheckPermission("shopProductSpec:add")
|
||||
public CzgResult<Void> quickAddShopProdSpec(@RequestBody ShopProdSpecDTO dto) {
|
||||
shopProdSpecService.quickAddShopProdSpec(dto);
|
||||
List<Long> affectedIdList = dto.getAffectedIdList();
|
||||
if (CollUtil.isNotEmpty(affectedIdList)) {
|
||||
affectedIdList.parallelStream().forEach(this::asyncToBranchShop);
|
||||
}
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -120,6 +135,19 @@ public class ShopProdSpecController {
|
||||
//@SaAdminCheckPermission("shopProductSpec:update")
|
||||
public CzgResult<Void> quickUpdateShopProdSpec(@RequestBody ShopProdSpecDTO dto) {
|
||||
shopProdSpecService.quickUpdateShopProdSpec(dto);
|
||||
List<Long> affectedIdList = dto.getAffectedIdList();
|
||||
if (CollUtil.isNotEmpty(affectedIdList)) {
|
||||
affectedIdList.parallelStream().forEach(this::asyncToBranchShop);
|
||||
}
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
ThreadUtil.safeSleep(1000L);
|
||||
shopSyncService.syncSpecBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.czg.log.annotation.OperationLog;
|
||||
import com.czg.product.dto.ShopProdUnitDTO;
|
||||
import com.czg.product.service.ShopProdUnitService;
|
||||
import com.czg.product.service.ShopSyncService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -28,6 +32,9 @@ import java.util.List;
|
||||
public class ShopProdUnitController {
|
||||
|
||||
private final ShopProdUnitService shopProdUnitService;
|
||||
@Resource
|
||||
private ShopSyncService shopSyncService;
|
||||
|
||||
|
||||
@GetMapping("page")
|
||||
@OperationLog("商品单位-分页")
|
||||
@@ -58,9 +65,8 @@ public class ShopProdUnitController {
|
||||
@OperationLog("商品单位-新增")
|
||||
//@SaAdminCheckPermission("shopProdUnit:add")
|
||||
public CzgResult<Void> addShopProdUnit(@RequestBody @Validated({InsertGroup.class, DefaultGroup.class}) ShopProdUnitDTO dto) {
|
||||
|
||||
shopProdUnitService.addShopProdUnit(dto);
|
||||
|
||||
Long id = shopProdUnitService.addShopProdUnit(dto);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -68,9 +74,8 @@ public class ShopProdUnitController {
|
||||
@OperationLog("商品单位-修改")
|
||||
//@SaAdminCheckPermission("shopProdUnit:update")
|
||||
public CzgResult<Void> updateShopProdUnit(@RequestBody @Validated({UpdateGroup.class, DefaultGroup.class}) ShopProdUnitDTO dto) {
|
||||
|
||||
shopProdUnitService.updateShopProdUnit(dto);
|
||||
|
||||
asyncToBranchShop(dto.getId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -91,6 +96,7 @@ public class ShopProdUnitController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopProdUnitService.disableShopProdUnit(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@@ -101,8 +107,16 @@ public class ShopProdUnitController {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "id");
|
||||
shopProdUnitService.enableShopProdUnit(id);
|
||||
asyncToBranchShop(id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
private void asyncToBranchShop(Long id) {
|
||||
long shopId = StpKit.USER.getShopId(0L);
|
||||
long sysUserId = StpKit.USER.getLoginIdAsLong();
|
||||
ThreadUtil.execAsync(() -> {
|
||||
shopSyncService.syncUnitBySourceShop(shopId, id, sysUserId);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user