多店铺需求
This commit is contained in:
parent
ec5de0f9ba
commit
fffa1e5389
|
|
@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺管理
|
* 店铺管理
|
||||||
|
*
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -35,8 +36,8 @@ public class ShopInfoController {
|
||||||
@SaAdminCheckRole("管理员")
|
@SaAdminCheckRole("管理员")
|
||||||
@SaAdminCheckPermission(value = "shopInfo:list", name = "店铺列表")
|
@SaAdminCheckPermission(value = "shopInfo:list", name = "店铺列表")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String shopName, Integer status) {
|
public CzgResult<Page<ShopInfo>> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop) {
|
||||||
return CzgResult.success(shopInfoService.get(pageDTO, shopName, status));
|
return CzgResult.success(shopInfoService.get(pageDTO, shopName, status, isHeadShop));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,4 +84,5 @@ public class ShopInfoController {
|
||||||
public CzgResult<?> delete(@RequestParam Integer id) {
|
public CzgResult<?> delete(@RequestParam Integer id) {
|
||||||
return CzgResult.success(shopInfoService.remove(new QueryWrapper().eq(ShopInfo::getId, id)));
|
return CzgResult.success(shopInfoService.remove(new QueryWrapper().eq(ShopInfo::getId, id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,81 @@
|
||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺配置扩展
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-04-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ShopConfigDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 主店id
|
||||||
|
*/
|
||||||
|
private Long mainId;
|
||||||
|
/**
|
||||||
|
* 是否启用商品同步 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isEnableProdSync;
|
||||||
|
/**
|
||||||
|
* 是否启用会员同步 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isEnableVipSync;
|
||||||
|
/**
|
||||||
|
* 是否启用耗材同步 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isEnableConsSync;
|
||||||
|
/**
|
||||||
|
* 是否允许账号登录 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isAllowAccountLogin;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 是否允许会员自定义金额 1-允许 0-不允许
|
||||||
|
*/
|
||||||
|
private Integer isCustomAmount;
|
||||||
|
/**
|
||||||
|
* 是否开启退款密码 1-启用 0-禁用
|
||||||
|
*/
|
||||||
|
private Integer isReturnPwd;
|
||||||
|
/**
|
||||||
|
* 是否开启会员充值密码 1-启用 0-禁用
|
||||||
|
*/
|
||||||
|
private Integer isMemberInPwd;
|
||||||
|
/**
|
||||||
|
* 是否开启会员退款密码 1-启用 0-禁用
|
||||||
|
*/
|
||||||
|
private Integer isMemberReturnPwd;
|
||||||
|
/**
|
||||||
|
* 是否免除桌位费 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isTableFee;
|
||||||
|
/**
|
||||||
|
* 是否启用会员价 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isMemberPrice;
|
||||||
|
/**
|
||||||
|
* 是否允许会员余额支付 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isAccountPay;
|
||||||
|
/**
|
||||||
|
* 分店数据同步方式 auto-自动同步 manual-手动同步
|
||||||
|
*/
|
||||||
|
private String branchDataSyncMethod;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -45,4 +45,12 @@ public class ShopInfoAddDTO {
|
||||||
private String districts;
|
private String districts;
|
||||||
private String provinces;
|
private String provinces;
|
||||||
private String address;
|
private String address;
|
||||||
|
/**
|
||||||
|
* 是否为主店
|
||||||
|
*/
|
||||||
|
private Integer isHeadShop;
|
||||||
|
/**
|
||||||
|
* 主店id
|
||||||
|
*/
|
||||||
|
private Long mainId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ public class ShopInfoEditDTO {
|
||||||
/**
|
/**
|
||||||
* 主店id
|
* 主店id
|
||||||
*/
|
*/
|
||||||
private Integer mainId;
|
private Long mainId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺口号
|
* 店铺口号
|
||||||
|
|
@ -241,4 +241,8 @@ public class ShopInfoEditDTO {
|
||||||
* 店铺激活码
|
* 店铺激活码
|
||||||
*/
|
*/
|
||||||
private String activateCode;
|
private String activateCode;
|
||||||
|
/**
|
||||||
|
* 是否为主店 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isHeadShop;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.czg.account.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺配置扩展
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-04-03
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Table("tb_shop_config")
|
||||||
|
public class ShopConfig implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
@Id(keyType = KeyType.None)
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 主店id
|
||||||
|
*/
|
||||||
|
private Long mainId;
|
||||||
|
/**
|
||||||
|
* 是否启用商品同步 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isEnableProdSync;
|
||||||
|
/**
|
||||||
|
* 是否启用会员同步 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isEnableVipSync;
|
||||||
|
/**
|
||||||
|
* 是否启用耗材同步 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isEnableConsSync;
|
||||||
|
/**
|
||||||
|
* 是否允许账号登录 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isAllowAccountLogin;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 是否允许会员自定义金额 1-允许 0-不允许
|
||||||
|
*/
|
||||||
|
private Integer isCustomAmount;
|
||||||
|
/**
|
||||||
|
* 是否开启退款密码 1-启用 0-禁用
|
||||||
|
*/
|
||||||
|
private Integer isReturnPwd;
|
||||||
|
/**
|
||||||
|
* 是否开启会员充值密码 1-启用 0-禁用
|
||||||
|
*/
|
||||||
|
private Integer isMemberInPwd;
|
||||||
|
/**
|
||||||
|
* 是否开启会员退款密码 1-启用 0-禁用
|
||||||
|
*/
|
||||||
|
private Integer isMemberReturnPwd;
|
||||||
|
/**
|
||||||
|
* 是否免除桌位费 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isTableFee;
|
||||||
|
/**
|
||||||
|
* 是否启用会员价 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isMemberPrice;
|
||||||
|
/**
|
||||||
|
* 是否允许会员余额支付 1-是 0-否
|
||||||
|
*/
|
||||||
|
private Integer isAccountPay;
|
||||||
|
/**
|
||||||
|
* 分店数据同步方式 auto-自动同步 manual-手动同步
|
||||||
|
*/
|
||||||
|
private String branchDataSyncMethod;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.czg.account.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分店数据同步方式枚举
|
||||||
|
*
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-04-03 16:53
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum BranchDataSyncMethodEnum {
|
||||||
|
/**
|
||||||
|
* 实时自动同步
|
||||||
|
*/
|
||||||
|
AUTO("auto", "实时自动同步"),
|
||||||
|
/**
|
||||||
|
* 手动同步
|
||||||
|
*/
|
||||||
|
MANUAL("manual", "手动同步");
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
|
||||||
|
public static List<String> getValues() {
|
||||||
|
return Arrays.stream(values()).map(BranchDataSyncMethodEnum::getValue).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getText(String value) {
|
||||||
|
BranchDataSyncMethodEnum item = Arrays.stream(values()).filter(obj -> value.equals(obj.getValue())).findFirst().orElse(null);
|
||||||
|
if (item != null) {
|
||||||
|
return item.getText();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.czg.account.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺经营模式枚举
|
||||||
|
*
|
||||||
|
* @author tankaikai
|
||||||
|
* @since 2025-04-03 16:53
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum ShopTypeEnum {
|
||||||
|
/**
|
||||||
|
* 单店
|
||||||
|
*/
|
||||||
|
ONLY("only", "单店"),
|
||||||
|
/**
|
||||||
|
* 连锁店
|
||||||
|
*/
|
||||||
|
CHAIN("chain", "连锁店"),
|
||||||
|
/**
|
||||||
|
* 加盟店
|
||||||
|
*/
|
||||||
|
JOIN("join", "加盟店"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
|
||||||
|
public static List<String> getValues() {
|
||||||
|
return Arrays.stream(values()).map(ShopTypeEnum::getValue).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getText(String value) {
|
||||||
|
ShopTypeEnum item = Arrays.stream(values()).filter(obj -> value.equals(obj.getValue())).findFirst().orElse(null);
|
||||||
|
if (item != null) {
|
||||||
|
return item.getText();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.czg.account.service;
|
||||||
|
|
||||||
|
import com.czg.account.entity.ShopConfig;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺配置扩展
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-04-03
|
||||||
|
*/
|
||||||
|
public interface ShopConfigService extends IService<ShopConfig> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -10,7 +10,7 @@ import com.mybatisflex.core.service.IService;
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
public interface ShopInfoService extends IService<ShopInfo> {
|
public interface ShopInfoService extends IService<ShopInfo> {
|
||||||
Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status);
|
Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop);
|
||||||
|
|
||||||
Boolean add(ShopInfoAddDTO shopInfoAddDTO);
|
Boolean add(ShopInfoAddDTO shopInfoAddDTO);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.czg.account.entity.ShopConfig;
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺配置扩展
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-04-03
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ShopConfigMapper extends BaseMapper<ShopConfig> {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import com.czg.account.dto.ShopConfigDTO;
|
||||||
|
import com.czg.account.entity.ShopConfig;
|
||||||
|
import com.czg.account.service.ShopConfigService;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.service.account.mapper.ShopConfigMapper;
|
||||||
|
import com.czg.service.account.mapper.ShopInfoMapper;
|
||||||
|
import com.czg.utils.PageUtil;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺配置扩展
|
||||||
|
*
|
||||||
|
* @author Tankaikai tankaikai@aliyun.com
|
||||||
|
* @since 1.0 2025-04-03
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ShopConfigServiceImpl extends ServiceImpl<ShopConfigMapper, ShopConfig> implements ShopConfigService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ShopInfoMapper shopInfoMapper;
|
||||||
|
|
||||||
|
private QueryWrapper buildQueryWrapper(ShopConfigDTO param) {
|
||||||
|
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
|
||||||
|
/*if (StrUtil.isNotEmpty(param.getName())) {
|
||||||
|
queryWrapper.like(ShopConfig::getName, param.getName());
|
||||||
|
}*/
|
||||||
|
Long shopId = StpKit.USER.getLoginIdAsLong();
|
||||||
|
queryWrapper.eq(ShopConfig::getMainId, shopId);
|
||||||
|
queryWrapper.orderBy(ShopConfig::getId, false);
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -7,9 +7,12 @@ import cn.hutool.crypto.SecureUtil;
|
||||||
import com.czg.account.dto.PageDTO;
|
import com.czg.account.dto.PageDTO;
|
||||||
import com.czg.account.dto.shopinfo.*;
|
import com.czg.account.dto.shopinfo.*;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
|
import com.czg.account.enums.BranchDataSyncMethodEnum;
|
||||||
|
import com.czg.account.enums.ShopTypeEnum;
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
import com.czg.config.RedisCst;
|
import com.czg.config.RedisCst;
|
||||||
import com.czg.enums.StatusEnum;
|
import com.czg.enums.StatusEnum;
|
||||||
|
import com.czg.enums.YesNoEnum;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
|
|
@ -27,6 +30,7 @@ import com.mybatisflex.core.paginate.Page;
|
||||||
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 jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.dubbo.config.annotation.DubboReference;
|
import org.apache.dubbo.config.annotation.DubboReference;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.cache.annotation.CacheConfig;
|
import org.springframework.cache.annotation.CacheConfig;
|
||||||
|
|
@ -44,6 +48,7 @@ import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
*/
|
*/
|
||||||
|
@Slf4j
|
||||||
@DubboService
|
@DubboService
|
||||||
@CacheConfig(cacheNames = "shopInfo")
|
@CacheConfig(cacheNames = "shopInfo")
|
||||||
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> implements ShopInfoService {
|
||||||
|
|
@ -65,6 +70,8 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
private FreeDineConfigService freeDineConfigService;
|
private FreeDineConfigService freeDineConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
private PointsBasicSettingService pointsBasicSettingService;
|
private PointsBasicSettingService pointsBasicSettingService;
|
||||||
|
@Resource
|
||||||
|
private ShopConfigService shopConfigService;
|
||||||
|
|
||||||
@DubboReference
|
@DubboReference
|
||||||
private SysParamsService sysParamsService;
|
private SysParamsService sysParamsService;
|
||||||
|
|
@ -72,7 +79,10 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
@Override
|
@Override
|
||||||
@Cacheable(key = "#id")
|
@Cacheable(key = "#id")
|
||||||
public ShopInfo getById(Serializable id) {
|
public ShopInfo getById(Serializable id) {
|
||||||
return super.getById(id);
|
ShopInfo shopInfo = super.getById(id);
|
||||||
|
ShopConfig shopConfig = shopConfigService.getById(shopInfo.getId());
|
||||||
|
BeanUtil.copyProperties(shopConfig, shopInfo);
|
||||||
|
return shopInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ShopInfo getShopInfo(Long shopId) {
|
private ShopInfo getShopInfo(Long shopId) {
|
||||||
|
|
@ -94,7 +104,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status) {
|
public Page<ShopInfo> get(PageDTO pageDTO, String shopName, Integer status, Integer isHeadShop) {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper();
|
QueryWrapper queryWrapper = new QueryWrapper();
|
||||||
if (StrUtil.isNotBlank(shopName)) {
|
if (StrUtil.isNotBlank(shopName)) {
|
||||||
queryWrapper.like(ShopInfo::getShopName, shopName);
|
queryWrapper.like(ShopInfo::getShopName, shopName);
|
||||||
|
|
@ -103,7 +113,12 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
queryWrapper.eq(ShopInfo::getStatus, status);
|
queryWrapper.eq(ShopInfo::getStatus, status);
|
||||||
}
|
}
|
||||||
queryWrapper.orderBy(ShopInfo::getCreateTime, false);
|
queryWrapper.orderBy(ShopInfo::getCreateTime, false);
|
||||||
return page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
|
Page<ShopInfo> page = page(new Page<>(pageDTO.page(), pageDTO.size()), queryWrapper);
|
||||||
|
page.getRecords().forEach(shopInfo -> {
|
||||||
|
ShopConfig shopConfig = shopConfigService.getById(shopInfo.getId());
|
||||||
|
BeanUtil.copyProperties(shopConfig, shopInfo);
|
||||||
|
});
|
||||||
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void activateShop(ShopInfo shopInfo, String activateCode) {
|
private void activateShop(ShopInfo shopInfo, String activateCode) {
|
||||||
|
|
@ -116,7 +131,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
// 续期
|
// 续期
|
||||||
if (shopInfo.getExpireTime() != null && shopInfo.getExpireTime().isAfter(LocalDateTime.now())) {
|
if (shopInfo.getExpireTime() != null && shopInfo.getExpireTime().isAfter(LocalDateTime.now())) {
|
||||||
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(shopInfo.getExpireTime()), merchantRegister.getPeriodMonth()).toLocalDateTime());
|
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(shopInfo.getExpireTime()), merchantRegister.getPeriodMonth()).toLocalDateTime());
|
||||||
}else {
|
} else {
|
||||||
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(), merchantRegister.getPeriodMonth()).toLocalDateTime());
|
shopInfo.setExpireTime(DateUtil.offsetMonth(DateUtil.date(), merchantRegister.getPeriodMonth()).toLocalDateTime());
|
||||||
}
|
}
|
||||||
merchantRegister.setStatus(1);
|
merchantRegister.setStatus(1);
|
||||||
|
|
@ -127,6 +142,21 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean add(ShopInfoAddDTO shopInfoAddDTO) {
|
public Boolean add(ShopInfoAddDTO shopInfoAddDTO) {
|
||||||
|
// 如果店铺类型是单店,是否主店要设为否
|
||||||
|
if (ShopTypeEnum.ONLY.getValue().equals(shopInfoAddDTO.getShopType())) {
|
||||||
|
shopInfoAddDTO.setIsHeadShop(YesNoEnum.NO.value());
|
||||||
|
shopInfoAddDTO.setMainId(null);
|
||||||
|
} else {
|
||||||
|
if (shopInfoAddDTO.getIsHeadShop() == null) {
|
||||||
|
throw new CzgException("加盟店/连锁店请选择是否主店");
|
||||||
|
}
|
||||||
|
if (shopInfoAddDTO.getIsHeadShop() == YesNoEnum.NO.value() && shopInfoAddDTO.getMainId() == null) {
|
||||||
|
throw new CzgException("请选择一个店铺做为主店");
|
||||||
|
}
|
||||||
|
if (shopInfoAddDTO.getIsHeadShop() == YesNoEnum.YES.value()) {
|
||||||
|
shopInfoAddDTO.setMainId(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
shopInfoAddDTO.setPhone(shopInfoAddDTO.getPhone().trim());
|
shopInfoAddDTO.setPhone(shopInfoAddDTO.getPhone().trim());
|
||||||
if (StrUtil.isBlank(shopInfoAddDTO.getPhone())) {
|
if (StrUtil.isBlank(shopInfoAddDTO.getPhone())) {
|
||||||
throw new ApiNotPrintException("请输入手机号");
|
throw new ApiNotPrintException("请输入手机号");
|
||||||
|
|
@ -156,7 +186,50 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
// 初始化积分霸王餐设置
|
// 初始化积分霸王餐设置
|
||||||
freeDineConfigService.getConfig(shopInfo.getId());
|
freeDineConfigService.getConfig(shopInfo.getId());
|
||||||
pointsBasicSettingService.initInfo(shopInfo.getId());
|
pointsBasicSettingService.initInfo(shopInfo.getId());
|
||||||
return updateById(shopInfo);
|
updateById(shopInfo);
|
||||||
|
syncSaveConfig(shopInfo, shopInfoAddDTO);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步创建配置信息
|
||||||
|
*
|
||||||
|
* @param shopInfo 店铺信息实体
|
||||||
|
* @param dto 新增店铺信息DTO
|
||||||
|
*/
|
||||||
|
private void syncSaveConfig(ShopInfo shopInfo, ShopInfoAddDTO dto) {
|
||||||
|
ShopConfig shopConfig = new ShopConfig();
|
||||||
|
shopConfig.setId(shopInfo.getId());
|
||||||
|
shopConfig.setMainId(shopInfo.getMainId());
|
||||||
|
shopConfig.setIsEnableProdSync(0);
|
||||||
|
shopConfig.setIsEnableVipSync(0);
|
||||||
|
shopConfig.setIsEnableConsSync(0);
|
||||||
|
shopConfig.setIsAllowAccountLogin(1);
|
||||||
|
shopConfig.setRemark(null);
|
||||||
|
shopConfig.setIsCustomAmount(0);
|
||||||
|
shopConfig.setIsReturnPwd(0);
|
||||||
|
shopConfig.setIsMemberInPwd(0);
|
||||||
|
shopConfig.setIsMemberReturnPwd(0);
|
||||||
|
shopConfig.setIsTableFee(1);
|
||||||
|
shopConfig.setIsMemberPrice(0);
|
||||||
|
shopConfig.setIsAccountPay(0);
|
||||||
|
shopConfig.setBranchDataSyncMethod(null);
|
||||||
|
if (dto.getIsHeadShop() == YesNoEnum.YES.value()) {
|
||||||
|
shopConfig.setBranchDataSyncMethod(BranchDataSyncMethodEnum.AUTO.getValue());
|
||||||
|
}
|
||||||
|
shopConfigService.save(shopConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步修改配置信息
|
||||||
|
*
|
||||||
|
* @param shopInfo 店铺信息实体
|
||||||
|
* @param dto 新增店铺信息DTO
|
||||||
|
*/
|
||||||
|
private void syncUpdateConfig(ShopInfo shopInfo, ShopInfoEditDTO dto) {
|
||||||
|
ShopConfig shopConfig = shopConfigService.getById(shopInfo.getId());
|
||||||
|
BeanUtil.copyProperties(dto, shopConfig);
|
||||||
|
shopConfigService.updateById(shopConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -165,14 +238,25 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
ShopInfo shopInfo;
|
ShopInfo shopInfo;
|
||||||
if (!StpKit.USER.isAdmin()) {
|
if (!StpKit.USER.isAdmin()) {
|
||||||
shopInfo = queryChain().eq(ShopInfo::getId, StpKit.USER.getLoginIdAsLong()).one();
|
shopInfo = queryChain().eq(ShopInfo::getId, StpKit.USER.getLoginIdAsLong()).one();
|
||||||
}else {
|
} else {
|
||||||
shopInfo = getById(StpKit.USER.getLoginIdAsLong());
|
shopInfo = getById(StpKit.USER.getLoginIdAsLong());
|
||||||
}
|
}
|
||||||
if (shopInfo == null) {
|
if (shopInfo == null) {
|
||||||
throw new CzgException("店铺不存在");
|
throw new CzgException("店铺不存在");
|
||||||
}
|
}
|
||||||
BeanUtil.copyProperties(shopInfoEditDTO, shopInfo);
|
String shopType = shopInfo.getShopType();
|
||||||
|
Long mainId = shopInfo.getMainId();
|
||||||
|
Integer isHeadShop = shopInfo.getIsHeadShop();
|
||||||
|
// 禁止加盟店/连锁店修改为单店
|
||||||
|
if (!shopType.equals(shopInfoEditDTO.getShopType())) {
|
||||||
|
throw new CzgException("禁止修改店铺类型");
|
||||||
|
}
|
||||||
|
if (!isHeadShop.equals(shopInfoEditDTO.getIsHeadShop())) {
|
||||||
|
throw new CzgException("禁止修改是否主店");
|
||||||
|
}
|
||||||
|
if (!mainId.equals(shopInfoEditDTO.getMainId())) {
|
||||||
|
throw new CzgException("禁止从新选择店铺设为主店");
|
||||||
|
}
|
||||||
if (shopInfoEditDTO.getActivateCode() != null) {
|
if (shopInfoEditDTO.getActivateCode() != null) {
|
||||||
activateShop(shopInfo, shopInfoEditDTO.getActivateCode());
|
activateShop(shopInfo, shopInfoEditDTO.getActivateCode());
|
||||||
}
|
}
|
||||||
|
|
@ -188,6 +272,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
redisService.del(key);
|
redisService.del(key);
|
||||||
}
|
}
|
||||||
if (updateById(shopInfo)) {
|
if (updateById(shopInfo)) {
|
||||||
|
syncUpdateConfig(shopInfo, shopInfoEditDTO);
|
||||||
SysUser sysUser = sysUserService.getById(shopInfo.getId());
|
SysUser sysUser = sysUserService.getById(shopInfo.getId());
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
if (!sysUser.getNickName().equals(shopInfo.getShopName())) {
|
if (!sysUser.getNickName().equals(shopInfo.getShopName())) {
|
||||||
|
|
@ -218,12 +303,16 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
if (!StpKit.USER.isAdmin() && !Objects.equals(StpKit.USER.getShopId(), shopInfo.getId())) {
|
if (!StpKit.USER.isAdmin() && !Objects.equals(StpKit.USER.getShopId(), shopInfo.getId())) {
|
||||||
throw new ApiNotPrintException("店铺信息不存在");
|
throw new ApiNotPrintException("店铺信息不存在");
|
||||||
}
|
}
|
||||||
|
ShopConfig shopConfig = shopConfigService.getById(shopInfo.getId());
|
||||||
|
if (shopConfig == null) {
|
||||||
|
throw new CzgException("店铺配置不存在");
|
||||||
|
}
|
||||||
ShopDetailDTO shopDetailDTO = BeanUtil.copyProperties(shopInfo, ShopDetailDTO.class);
|
ShopDetailDTO shopDetailDTO = BeanUtil.copyProperties(shopInfo, ShopDetailDTO.class);
|
||||||
SysUser sysUser = sysUserService.getById(shopInfo.getId());
|
SysUser sysUser = sysUserService.getById(shopInfo.getId());
|
||||||
shopDetailDTO.setAccount(sysUser.getAccount());
|
shopDetailDTO.setAccount(sysUser.getAccount());
|
||||||
CzgResult<SysParamsDTO> shopOrderPayBaseUrl = sysParamsService.getParamsByCode("shop_order_pay_base_url");
|
CzgResult<SysParamsDTO> shopOrderPayBaseUrl = sysParamsService.getParamsByCode("shop_order_pay_base_url");
|
||||||
shopDetailDTO.setPaymentQrcode(shopOrderPayBaseUrl.getData().getParamValue() + "?shopId=" + id);
|
shopDetailDTO.setPaymentQrcode(shopOrderPayBaseUrl.getData().getParamValue() + "?shopId=" + id);
|
||||||
|
BeanUtil.copyProperties(shopConfig, shopDetailDTO);
|
||||||
return shopDetailDTO;
|
return shopDetailDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,7 +327,6 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
|
||||||
throw new ApiNotPrintException("台桌状态不可用");
|
throw new ApiNotPrintException("台桌状态不可用");
|
||||||
}
|
}
|
||||||
ShopInfo shopInfo = getShopInfo(shopTable.getShopId());
|
ShopInfo shopInfo = getShopInfo(shopTable.getShopId());
|
||||||
|
|
||||||
double distance = 0;
|
double distance = 0;
|
||||||
if (StrUtil.isAllNotBlank(lat, lng, shopInfo.getLat(), shopInfo.getLng())) {
|
if (StrUtil.isAllNotBlank(lat, lng, shopInfo.getLat(), shopInfo.getLng())) {
|
||||||
// 计算距离,单位:米
|
// 计算距离,单位:米
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?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.account.mapper.ShopConfigMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -1 +1,65 @@
|
||||||
ALTER TABLE `tb_shop_info` ADD COLUMN `is_head_shop` tinyint NULL COMMENT '是否主店 1-是 0-否';
|
ALTER TABLE `tb_shop_info`
|
||||||
|
ADD COLUMN `is_head_shop` tinyint NULL COMMENT '是否主店 1-是 0-否';
|
||||||
|
-- ----------------------------
|
||||||
|
-- 更新历史数据,将创建时间在2025年4月3日之前的店铺设置为非主店
|
||||||
|
-- ----------------------------
|
||||||
|
update tb_shop_info
|
||||||
|
set is_head_shop = 0
|
||||||
|
where create_time < str_to_date('2025-04-03 00:00:00', '%Y-%m-%d %H:%i:%s');
|
||||||
|
-- ----------------------------
|
||||||
|
-- 创建店铺配置扩展表
|
||||||
|
-- ----------------------------
|
||||||
|
CREATE TABLE `tb_shop_config`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL COMMENT '店铺id',
|
||||||
|
`main_id` bigint NULL DEFAULT NULL COMMENT '主店id',
|
||||||
|
`is_enable_prod_sync` tinyint NOT NULL DEFAULT 0 COMMENT '是否启用商品同步 1-是 0-否',
|
||||||
|
`is_enable_vip_sync` tinyint NOT NULL DEFAULT 0 COMMENT '是否启用会员同步 1-是 0-否',
|
||||||
|
`is_enable_cons_sync` tinyint NOT NULL DEFAULT 0 COMMENT '是否启用耗材同步 1-是 0-否',
|
||||||
|
`is_allow_account_login` tinyint NOT NULL DEFAULT 1 COMMENT '是否允许账号登录 1-是 0-否',
|
||||||
|
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
|
||||||
|
`is_custom_amount` int NOT NULL DEFAULT 0 COMMENT '是否允许会员自定义金额 1-允许 0-不允许',
|
||||||
|
`is_return_pwd` int NOT NULL DEFAULT 0 COMMENT '是否开启退款密码 1-启用 0-禁用',
|
||||||
|
`is_member_in_pwd` int NOT NULL DEFAULT 0 COMMENT '是否开启会员充值密码 1-启用 0-禁用',
|
||||||
|
`is_member_return_pwd` int NOT NULL DEFAULT 0 COMMENT '是否开启会员退款密码 1-启用 0-禁用',
|
||||||
|
`is_table_fee` int NOT NULL DEFAULT 1 COMMENT '是否免除桌位费 1-是 0-否',
|
||||||
|
`is_member_price` int NOT NULL DEFAULT 0 COMMENT '是否启用会员价 1-是 0-否 ',
|
||||||
|
`is_account_pay` tinyint NOT NULL DEFAULT 0 COMMENT '是否允许会员余额支付 1-是 0-否',
|
||||||
|
`branch_data_sync_method` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '分店数据同步方式 auto-自动同步 manual-手动同步',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
CHARACTER SET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_0900_ai_ci COMMENT = '店铺配置扩展'
|
||||||
|
ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 转移历史数据至【店铺配置扩展表】
|
||||||
|
-- ----------------------------
|
||||||
|
insert into tb_shop_config
|
||||||
|
select id,
|
||||||
|
main_id,
|
||||||
|
0 as is_enable_prod_sync,
|
||||||
|
0 as is_enable_vip_sync,
|
||||||
|
0 as is_enable_cons_sync,
|
||||||
|
1 as is_allow_account_login,
|
||||||
|
null as remark,
|
||||||
|
is_custom_amount,
|
||||||
|
is_return_pwd,
|
||||||
|
is_member_in_pwd,
|
||||||
|
is_member_return_pwd,
|
||||||
|
is_table_fee,
|
||||||
|
is_member_price,
|
||||||
|
is_account_pay,
|
||||||
|
null as branch_data_sync_method
|
||||||
|
from tb_shop_info;
|
||||||
|
-- ----------------------------
|
||||||
|
-- 删除店铺主表是否xxx等字段,迁移至店铺配置扩展表
|
||||||
|
-- ----------------------------
|
||||||
|
ALTER TABLE `tb_shop_info`
|
||||||
|
DROP COLUMN `is_custom_amount`,
|
||||||
|
DROP COLUMN `is_return_pwd`,
|
||||||
|
DROP COLUMN `is_member_in_pwd`,
|
||||||
|
DROP COLUMN `is_member_return_pwd`,
|
||||||
|
DROP COLUMN `is_table_fee`,
|
||||||
|
DROP COLUMN `is_member_price`,
|
||||||
|
DROP COLUMN `is_account_pay`;
|
||||||
Loading…
Reference in New Issue