Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai 2025-03-11 19:31:22 +08:00
commit fc8adc5734
25 changed files with 66 additions and 128 deletions

View File

@ -40,7 +40,7 @@ public class MenuController {
* @return 菜单结构
*/
@SaAdminCheckRole("管理员")
// @SaAdminCheckPermission("menu:list")
@SaAdminCheckPermission(value = "menu:list", name = "菜单列表")
@GetMapping("/list")
public CzgResult<List<MenuVO>> all(String title, String startTime, String endTime) {
return CzgResult.success(menuService.getAll(title, startTime, endTime));
@ -51,7 +51,7 @@ public class MenuController {
* @return 菜单结构
*/
@SaAdminCheckRole("管理员")
// @SaAdminCheckPermission("menu:detail")
@SaAdminCheckPermission(value = "menu:detail", name = "菜单详情")
@GetMapping("/detail")
public CzgResult<SysMenu> detail(@RequestParam Integer id) {
return CzgResult.success(menuService.getById(id));
@ -62,7 +62,7 @@ public class MenuController {
* @return 是否成功
*/
@SaAdminCheckRole("管理员")
// @SaAdminCheckPermission("menu:add")
@SaAdminCheckPermission(value = "menu:add", name = "菜单添加")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated MenuAddDTO menuAddDTO) {
return CzgResult.success(menuService.add(menuAddDTO));
@ -73,7 +73,7 @@ public class MenuController {
* @return 是否成功
*/
@SaAdminCheckRole("管理员")
// @SaAdminCheckPermission("menu:edit")
@SaAdminCheckPermission(value = "menu:edit", name = "菜单编辑")
@PutMapping()
public CzgResult<Boolean> edit(@RequestBody @Validated MenuEditDTO menuEditDTO) {
return CzgResult.success(menuService.edit(menuEditDTO));
@ -84,7 +84,7 @@ public class MenuController {
* @return 是否成功
*/
@SaAdminCheckRole("管理员")
// @SaAdminCheckPermission("menu:del")
@SaAdminCheckPermission(value = "menu:del", name = "菜单删除")
@DeleteMapping()
public CzgResult<Boolean> edit(@RequestBody @Validated MenuDelDTO menuDelDTO) {
return CzgResult.success(menuService.removeById(menuDelDTO.getId()));

View File

@ -37,7 +37,7 @@ public class RoleController {
@SaAdminCheckPermission(value = "role:list", name = "角色列表")
@GetMapping("/list")
public CzgResult<Page<SysRole>> getList(PageDTO pageDTO, String key, String startTime, String endTime) {
return CzgResult.success(roleService.getList(pageDTO, key, startTime, endTime));
return CzgResult.success(roleService.getList(StpKit.USER.getShopId(), pageDTO, key, startTime, endTime));
}
/**
@ -85,6 +85,9 @@ public class RoleController {
@SaAdminCheckPermission(value = "role:remove", name = "角色删除")
@DeleteMapping
public CzgResult<Boolean> remove(@RequestBody @Validated RoleRemoveDTO roleRemoveDTO) {
if (roleRemoveDTO.id() == 1L || roleRemoveDTO.id() == 2L) {
return CzgResult.failure("超级管理员角色不可删除");
}
return CzgResult.success(roleService.removeById(roleRemoveDTO.id()));
}
}

View File

@ -28,7 +28,7 @@ public class ShopActivateController {
* 店铺充值活动列表
* 权限标识: activate:list
*/
@SaAdminCheckPermission("activate:list")
@SaAdminCheckPermission(value = "activate:list", name = "店铺充值活动列表")
@GetMapping
public CzgResult<List<ShopActivateDTO>> detail(@RequestParam(required = false) Long shopId) {
return CzgResult.success(shopActivateService.getList(shopId));
@ -38,7 +38,7 @@ public class ShopActivateController {
* 店铺充值活动新增
* 权限标识: activate:add
*/
@SaAdminCheckPermission("activate:add")
@SaAdminCheckPermission(value = "activate:add", name = "店铺充值活动新增")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopActivateDTO activateDTO) {
activateDTO.setShopId(StpKit.USER.getShopId());
@ -49,7 +49,7 @@ public class ShopActivateController {
* 店铺充值活动修改
* 权限标识: activate:edit
*/
@SaAdminCheckPermission("activate:edit")
@SaAdminCheckPermission(value = "activate:edit", name = "店铺充值活动修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopActivateDTO activateDTO) {
return CzgResult.success(shopActivateService.edit(activateDTO));

View File

@ -26,7 +26,7 @@ public class ShopMerchantController {
* @return 支付信息
*/
@SaAdminCheckRole("管理员")
@SaAdminCheckPermission("shopMerchant:detail")
@SaAdminCheckPermission(value = "shopMerchant:detail", name = "商户支付信息获取")
@GetMapping
public CzgResult<ShopMerchant> detail() {
return CzgResult.success(shopMerchantService.detail());
@ -38,7 +38,7 @@ public class ShopMerchantController {
* @return 是否成功
*/
@SaAdminCheckRole("管理员")
@SaAdminCheckPermission("shopMerchant:edit")
@SaAdminCheckPermission(value = "shopMerchant:edit", name = "商户支付信息修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopMerchantEditDTO shopMerchantEditDTO) {
return CzgResult.success(shopMerchantService.edit(shopMerchantEditDTO));

View File

@ -25,7 +25,7 @@ public class ShopPermissionController {
* 获取店铺权限列表
* @return 权限列表
*/
@SaAdminCheckPermission("shopPermission:list")
@SaAdminCheckPermission(value = "shopPermission:list", name = "店铺权限列表")
@GetMapping
public CzgResult<List<ShopPermission>> getPermission() {
return CzgResult.success(shopPermissionService.getPermission());

View File

@ -29,7 +29,7 @@ public class ShopTableAreaController {
* @param name 区域名称
* @return 是否成功
*/
@SaAdminCheckPermission("shopArea:list")
@SaAdminCheckPermission(value = "shopArea:list", name = "区域列表")
@GetMapping
public CzgResult<Page<ShopTableArea>> list(String name) {
return CzgResult.success(shopTableAreaService.pageInfo(StpKit.USER.getShopId(), name));
@ -40,7 +40,7 @@ public class ShopTableAreaController {
* 权限标识: shopArea:edit
* @return 是否成功
*/
@SaAdminCheckPermission("shopArea:edit")
@SaAdminCheckPermission(value = "shopArea:edit", name = "区域修改")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopAreaEditDTO shopAreaEditDTO) {
return CzgResult.success(shopTableAreaService.edit(StpKit.USER.getShopId(), shopAreaEditDTO));
@ -51,7 +51,7 @@ public class ShopTableAreaController {
* 权限标识: shopArea:del
* @return 是否成功
*/
@SaAdminCheckPermission("shopArea:del")
@SaAdminCheckPermission(value = "shopArea:del", name = "区域删除")
@DeleteMapping
public CzgResult<Boolean> remove(@RequestBody @Validated ShopAreaEditDTO shopAreaEditDTO) {
return CzgResult.success(shopTableAreaService.remove(new QueryWrapper().eq(ShopTableArea::getShopId, StpKit.USER.getShopId()).eq(ShopTableArea::getId, shopAreaEditDTO.getId())));
@ -62,7 +62,7 @@ public class ShopTableAreaController {
* 权限标识: shopArea:add
* @return 是否成功
*/
@SaAdminCheckPermission("shopArea:add")
@SaAdminCheckPermission(value = "shopArea:add", name = "区域新增")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopAreaAddDTO shopAreaAddDTO) {
return CzgResult.success(shopTableAreaService.add(shopAreaAddDTO));

View File

@ -36,7 +36,7 @@ dubbo:
threads: 20
name: dubbo
serialization: hessian2
port: -1
port: 10101
seata:

View File

@ -35,7 +35,7 @@ dubbo:
group: server-test
protocol:
threads: 20
port: -1
port: 10102
name: dubbo
serialization: hessian2

View File

@ -29,13 +29,13 @@ spring:
dubbo:
application:
name: order-server
# qos-port: 22231
qos-enable: false
qos-port: 22231
qos-enable: true
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-dev
protocol:
port: -1
port: 10201
threads: 20
name: dubbo
serialization: hessian2

View File

@ -30,15 +30,15 @@ spring:
dubbo:
application:
name: order-server
# qos-port: 22232
qos-enable: false
qos-port: 22232
qos-enable: true
logger: log4j2
environment: test
registry:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test
protocol:
port: -1
port: 10202
threads: 20
name: dubbo
serialization: hessian2

View File

@ -40,7 +40,7 @@ dubbo:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-dev
protocol:
port: -1
port: 10301
threads: 20
name: dubbo
serialization: hessian2

View File

@ -34,7 +34,7 @@ dubbo:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test
protocol:
port: -1
port: 10302
threads: 20
name: dubbo
serialization: hessian2

View File

@ -58,6 +58,7 @@ public class MiniAppPagesController {
* @param status 小程序页面状态 -1 查全部 1 启用 0 禁用
*/
@GetMapping("page")
@SaAdminCheckPermission(value = "miniAppPages:page", name = "小程序页面分页")
public CzgResult<Page<MiniAppPagesDTO>> getMiniAppPage(String name, String path, Integer status) {
return miniAppPageService.getMiniAppPage(name, path, status);
}

View File

@ -35,7 +35,7 @@ dubbo:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-dev
protocol:
port: -1
port: 10401
threads: 20
name: dubbo
serialization: hessian2

View File

@ -35,7 +35,7 @@ dubbo:
address: nacos://121.40.109.122:8848 # Nacos 服务地址
group: server-test
protocol:
port: -1
port: 10402
threads: 20
name: dubbo
serialization: hessian2

View File

@ -1,45 +0,0 @@
package com.czg.config;
import com.mybatisflex.core.dialect.impl.CommonsDialectImpl;
import com.mybatisflex.core.exception.FlexExceptions;
import com.mybatisflex.core.exception.locale.LocalizedFormats;
import com.mybatisflex.core.query.CPI;
import com.mybatisflex.core.query.QueryCondition;
import com.mybatisflex.core.query.QueryTable;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.util.StringUtil;
import org.springframework.stereotype.Component;
import java.util.List;
import static com.mybatisflex.core.constant.SqlConsts.ASTERISK;
import static com.mybatisflex.core.constant.SqlConsts.WHERE;
/**
* 自定义sql解析器 备用
*/
//@Component
public class MyCommonsDialectImpl extends CommonsDialectImpl {
@Override
public String wrap(String keyword) {
return ASTERISK.equals(keyword) ? keyword : keywordWrap.wrap(keyword);
}
protected void buildWhereSql(StringBuilder sqlBuilder, QueryWrapper queryWrapper, List<QueryTable> queryTables, boolean allowNoCondition) {
QueryCondition whereQueryCondition = CPI.getWhereQueryCondition(queryWrapper);
if (whereQueryCondition != null) {
String whereSql = whereQueryCondition.toSql(queryTables, this);
if (StringUtil.hasText(whereSql)) {
sqlBuilder.append(WHERE).append(whereSql);
} else if (!allowNoCondition) {
throw FlexExceptions.wrap(LocalizedFormats.UPDATE_OR_DELETE_NOT_ALLOW);
}
} else {
// whereQueryCondition == null
if (!allowNoCondition) {
throw FlexExceptions.wrap(LocalizedFormats.UPDATE_OR_DELETE_NOT_ALLOW);
}
}
}
}

View File

@ -1,36 +0,0 @@
package com.czg.config;
import com.mybatisflex.core.audit.AuditManager;
import com.mybatisflex.core.dialect.DbType;
import com.mybatisflex.core.dialect.DialectFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
/**
* 自定义sql方言
*
* @author Administrator
*/
@Configuration
@Slf4j(topic = "mybatis-flex-sql")
public class MybatisFlexConfig {
public MybatisFlexConfig() {
//开启审计功能
AuditManager.setAuditEnable(true);
//设置 SQL 审计收集器
AuditManager.setMessageCollector(auditMessage ->
log.info("{},{}ms", auditMessage.getFullSql()
, auditMessage.getElapsedTime())
);
}
// @Resource
private MyCommonsDialectImpl myCommonsDialect;
// @PostConstruct
public void init() {
DialectFactory.registerDialect(DbType.MYSQL, myCommonsDialect);
}
}

View File

@ -37,6 +37,10 @@ public class ShopUserDetailDTO extends ShopUser {
* 店铺信息
*/
private ShopInfo shopInfo;
/**
* 支付密码
*/
private String payPwd;
/**
* 店铺拓展参数
*/

View File

@ -19,7 +19,7 @@ public interface SysRoleService extends IService<SysRole> {
List<SysRole> getByUserId(Long id);
Page<SysRole> getList(PageDTO pageDTO, String key, String startTime, String endTime);
Page<SysRole> getList(Long shopId, PageDTO pageDTO, String key, String startTime, String endTime);
Boolean add(RoleAddDTO roleAddDTO);

View File

@ -57,7 +57,7 @@ public class AuthorizationServiceImpl implements AuthorizationService {
SpecCaptcha captcha = new SpecCaptcha(130, 48, 4);
// 获取验证码文本
String code = captcha.text();
String code = captcha.text().toLowerCase();
// 生成唯一的验证码 ID
String captchaKey = IdUtil.randomUUID();
@ -70,10 +70,10 @@ public class AuthorizationServiceImpl implements AuthorizationService {
@Override
public LoginVO login(SysLoginDTO loginDTO) {
// Object code = redisService.get(RedisCst.LOGIN_CODE + loginDTO.uuid());
// if (!"666666".equals(loginDTO.code()) && code == null || !code.equals(loginDTO.code())) {
// throw new ApiNotPrintException("验证码错误");
// }
Object code = redisService.get(RedisCst.LOGIN_CODE + loginDTO.uuid());
if (!"666666".equals(loginDTO.code()) && (code == null || !code.equals(loginDTO.code().toLowerCase()))) {
throw new ApiNotPrintException("验证码错误");
}
SysUser user;
// 员工账号登录

View File

@ -117,7 +117,7 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
}
// 添加系统账号
shopInfoAddDTO.setRoleId(shopInfoAddDTO.getRoleId() == null ? 1L : shopInfoAddDTO.getRoleId());
shopInfoAddDTO.setRoleId(shopInfoAddDTO.getRoleId() == null ? 2L : shopInfoAddDTO.getRoleId());
SysUser sysUser = sysUserService.addUser(shopInfoAddDTO.getShopName(), shopInfoAddDTO.getAccountName(), shopInfoAddDTO.getAccountPwd(), shopInfoAddDTO.getPhone(), shopInfoAddDTO.getRoleId());
// 保存店铺信息

View File

@ -252,28 +252,34 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
userInfoService.updateById(userInfo);
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
if (shopUser != null) {
if (shopUser == null) {
shopUser = new ShopUser();
shopUser.setShopId(shopId);
shopUser.setUserId(userId);
save(shopUser);
} else if (shopUser.getIsVip() == 1) {
throw new ApiNotPrintException("您已加入店铺会员");
}
shopUser = BeanUtil.copyProperties(shopUserAddDTO, ShopUser.class);
BeanUtil.copyProperties(shopUserAddDTO, shopUser);
shopUser.setIsVip(1);
shopUser.setCode(generateCode(shopId));
shopUser.setJoinTime(DateUtil.date().toLocalDateTime());
shopUser.setShopId(shopId);
shopUser.setUserId(userId);
return save(shopUser);
shopUser.setUserId(null);
shopUser.setShopId(null);
return updateById(shopUser);
}
@Override
public ShopUserDetailDTO getInfo(Long shopId, long userId) {
ShopUser shopUser = getOne(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userId));
UserInfo userInfo = userInfoService.getById(userId);
if (userInfo == null) {
throw new ApiNotPrintException("用户信息不存在");
}
long couponNum = 0;
if (shopUser == null) {
UserInfo userInfo = userInfoService.getById(userId);
if (userInfo == null) {
throw new ApiNotPrintException("用户信息不存在");
}
shopUser = BeanUtil.copyProperties(userInfo, ShopUser.class);
shopUser.setShopId(shopId);
shopUser.setId(null);
@ -294,6 +300,8 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
List<ShopExtend> shopExtends = shopExtendService.list(new QueryWrapper().eq(ShopExtend::getShopId, shopInfo.getId()));
shopUserDetailDTO.setShopExtendList(shopExtends);
}
shopUserDetailDTO.setPayPwd(userInfo.getPayPwd());
return shopUserDetailDTO;
}
}

View File

@ -46,7 +46,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
}
@Override
public Page<SysRole> getList(PageDTO pageDTO, String key, String startTime, String endTime) {
public Page<SysRole> getList(Long shopId, PageDTO pageDTO, String key, String startTime, String endTime) {
QueryWrapper queryWrapper = new QueryWrapper();
if (!StpKit.USER.isAdmin()) {
queryWrapper.eq(SysRole::getCreateUserId, StpKit.USER.getLoginIdAsLong());

View File

@ -608,6 +608,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
if (payOrderId != null) {
updateChain.set(OrderInfo::getPayOrderId, payOrderId);
}
if (orderInfo.getCreditBuyerId() != null) {
updateChain.set(OrderInfo::getCreditBuyerId, orderInfo.getCreditBuyerId());
}
if (ObjectUtil.isNotNull(payType)) {
updateChain.set(OrderInfo::getPayType, payType.getValue());
}

View File

@ -140,7 +140,7 @@ public class PayServiceImpl implements PayService {
@Override
@Transactional(noRollbackFor = PaySuccessException.class)
public CzgResult<Object> creditPayOrder(OrderPayParamDTO payParam) {
AssertUtil.isNull(payParam.getCreditBuyerId(), "挂账人不可为空");
AssertUtil.isNull(payParam.getCreditBuyerId(), "请选择挂账人后支付");
OrderInfo orderInfo = checkPay(payParam.getCheckOrderPay());
orderInfo.setCreditBuyerId(payParam.getCreditBuyerId());
orderInfoService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),