默认接口目录

This commit is contained in:
2025-12-10 10:20:59 +08:00
parent 9af06296f6
commit f5b67ac11d
13 changed files with 48 additions and 56 deletions

View File

@@ -42,7 +42,7 @@ public class PointsConfigController {
* 积分:配置:详情 * 积分:配置:详情
*/ */
@GetMapping("/config") @GetMapping("/config")
@SaAdminCheckPermission(value = "points:config:info", name = "积分-配置-详情") @SaAdminCheckPermission(parentName = "积分配置", value = "points:config:info", name = "积分-配置-详情")
public CzgResult<MkPointsConfig> getPointsBasicSetting() { public CzgResult<MkPointsConfig> getPointsBasicSetting() {
MkPointsConfig entity = pointsConfigService.getById(StpKit.USER.getShopId()); MkPointsConfig entity = pointsConfigService.getById(StpKit.USER.getShopId());
return CzgResult.success(entity); return CzgResult.success(entity);
@@ -56,13 +56,12 @@ public class PointsConfigController {
public CzgResult<Void> savePointsBasicSetting(@RequestBody @Validated MkPointsConfigDTO dto) { public CzgResult<Void> savePointsBasicSetting(@RequestBody @Validated MkPointsConfigDTO dto) {
Long shopId = StpKit.USER.getShopId(); Long shopId = StpKit.USER.getShopId();
dto.setShopId(shopId); dto.setShopId(shopId);
ValidatorUtil.validateEntity(dto, InsertGroup.class, DefaultGroup.class);
MkPointsConfig entity = BeanUtil.copyProperties(dto, MkPointsConfig.class); MkPointsConfig entity = BeanUtil.copyProperties(dto, MkPointsConfig.class);
MkPointsConfig record = pointsConfigService.getById(shopId); MkPointsConfig record = pointsConfigService.getById(shopId);
if (record == null) { if (record == null) {
pointsConfigService.save(entity); pointsConfigService.save(entity);
} else { } else {
pointsConfigService.saveOrUpdate(entity); pointsConfigService.updateById(entity);
} }
return CzgResult.success(); return CzgResult.success();
} }

View File

@@ -62,7 +62,7 @@ public class PointsGoodsController {
* 删除 * 删除
*/ */
@DeleteMapping("/{id}") @DeleteMapping("/{id}")
@SaAdminCheckPermission(value = "points:goods:delete", name = "积分-商品-新增/修改") @SaAdminCheckPermission(value = "points:goods:delete", name = "积分-商品-删除")
public CzgResult<Void> deletePointsGoodsSetting(@PathVariable("id") Long id) { public CzgResult<Void> deletePointsGoodsSetting(@PathVariable("id") Long id) {
MkPointsGoods entity = pointsGoodsSettingService.getById(id); MkPointsGoods entity = pointsGoodsSettingService.getById(id);
entity.setDelFlag(DeleteEnum.DELETED.value()); entity.setDelFlag(DeleteEnum.DELETED.value());

View File

@@ -34,7 +34,7 @@ public class PointsGoodsRecordController {
private PointsGoodPayService goodPayService; private PointsGoodPayService goodPayService;
/** /**
* 积分:积分商品:兑换记录列表 * 积分:积分商品:兑换记录
*/ */
@GetMapping("page") @GetMapping("page")
@SaAdminCheckPermission(value = "points:goodsRecord:list", name = "积分-积分商品-兑换记录") @SaAdminCheckPermission(value = "points:goodsRecord:list", name = "积分-积分商品-兑换记录")

View File

@@ -45,10 +45,6 @@ public class ShopConfigDTO implements Serializable {
* 备注 * 备注
*/ */
private String remark; private String remark;
/**
* 是否允许会员自定义金额 1-允许 0-不允许
*/
private Integer isCustomAmount;
/** /**
* 是否开启退款密码 1-启用 0-禁用 * 是否开启退款密码 1-启用 0-禁用
*/ */

View File

@@ -76,10 +76,6 @@ public class ShopInfoEditDTO {
*/ */
private Integer isReturnPwd; private Integer isReturnPwd;
/**
* 是否允许会员自定义金额 1 允许 0 不允许
*/
private Integer isCustomAmount;
/** /**
* 是否开启会员充值密码 1 启用 0 禁用 * 是否开启会员充值密码 1 启用 0 禁用

View File

@@ -42,10 +42,10 @@ public class ShopUserAddDTO implements Serializable {
*/ */
private Integer sex; private Integer sex;
/** // /**
* 账户积分 // * 账户积分
*/ // */
private Integer accountPoints; // private Integer accountPoints;
/** /**
* 钱包余额 * 钱包余额

View File

@@ -65,10 +65,6 @@ public class ShopConfig implements Serializable {
*/ */
private String remark; private String remark;
/** /**
* 是否允许会员自定义金额 1-允许 0-不允许
*/
private Integer isCustomAmount;
/**
* 是否开启退款密码 1-启用 0-禁用 * 是否开启退款密码 1-启用 0-禁用
*/ */
private Integer isReturnPwd; private Integer isReturnPwd;

View File

@@ -283,11 +283,6 @@ public class ShopInfo implements Serializable {
*/ */
@Column(ignore = true) @Column(ignore = true)
private Integer isAllowAccountLogin; private Integer isAllowAccountLogin;
/**
* 是否允许会员自定义金额 1-允许 0-不允许
*/
@Column(ignore = true)
private Integer isCustomAmount;
/** /**
* 是否开启退款密码 1-启用 0-禁用 * 是否开启退款密码 1-启用 0-禁用
*/ */

View File

@@ -83,11 +83,11 @@ public class ShopUser implements Serializable {
* 用户Id * 用户Id
*/ */
private Long userId; private Long userId;
//
/** // /**
* 账户积分 // * 账户积分
*/ // */
private Integer accountPoints; // private Integer accountPoints;
/** /**
* 钱包余额 * 钱包余额
@@ -122,15 +122,15 @@ public class ShopUser implements Serializable {
*/ */
private String code; private String code;
/** // /**
* 最近一次积分变动时间 // * 最近一次积分变动时间
*/ // */
private LocalDateTime lastPointsChangeTime; // private LocalDateTime lastPointsChangeTime;
//
/** // /**
* 最近一次浮动积分 // * 最近一次浮动积分
*/ // */
private Integer lastFloatPoints; // private Integer lastFloatPoints;
/** /**
* 成为会员的时间 * 成为会员的时间

View File

@@ -18,6 +18,7 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
@Component @Component
@Slf4j @Slf4j
@@ -87,24 +88,35 @@ public class LoadingRole implements CommandLineRunner {
Method parentNameMethod = annotationClass.getMethod("parentName"); Method parentNameMethod = annotationClass.getMethod("parentName");
String parentName = (String) parentNameMethod.invoke(annotation); String parentName = (String) parentNameMethod.invoke(annotation);
String parentId; String parentId;
String parentMenuSql = "select * from sys_menu where title=?"; // 查询菜单是否存在 String parentMenuSql = "select * from sys_menu where title=?"; // 查询菜单是否存在
Row parentMenu; Row parentMenu;
// parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
// if (parentMenu == null) {
// Db.insertBySql("INSERT INTO `sys_menu` (`type`, `title`) VALUES (?, ?);", 0, "默认接口目录");
// }
// parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
// if (StrUtil.isNotBlank(parentName)) {
// parentMenu = Db.selectOneBySql(parentMenuSql, parentName);
// if (parentMenu == null) {
// throw new RuntimeException(StrUtil.format("上级菜单不存在, 方法名{} 方法路径:{}", method.getName(), fullPath));
// }
// }
// parentId = parentMenu.getString("menu_id");
parentId = "1";
Row childMenu;
if (StrUtil.isNotBlank(parentName)) { if (StrUtil.isNotBlank(parentName)) {
parentMenu = Db.selectOneBySql(parentMenuSql, parentName); childMenu = Db.selectOneBySql(parentMenuSql, parentName);
if (parentMenu == null) { if (childMenu == null) {
throw new RuntimeException(StrUtil.format("上级菜单不存在, 方法名{} 方法路径:{}", method.getName(), fullPath)); Db.insertBySql("INSERT INTO `sys_menu` (`type`, `pid`,`title`) VALUES (?,?, ?);", 0, parentId, parentName);
childMenu = Db.selectOneBySql(parentMenuSql, parentName);
} }
}else { parentId = childMenu.getString("menu_id");
parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
if (parentMenu == null) {
Db.insertBySql("INSERT INTO `sys_menu` (`type`, `title`) VALUES (?, ?);", 0, "默认接口目录");
}
parentMenu = Db.selectOneBySql(parentMenuSql, "默认接口目录");
} }
parentId = parentMenu.getString("menu_id");
for (String s : permissions) { for (String s : permissions) {
String sql = "select * from sys_menu where permission=?"; String sql = "select * from sys_menu where permission=?";
@@ -115,18 +127,18 @@ public class LoadingRole implements CommandLineRunner {
String url = menu1.getString("url"); String url = menu1.getString("url");
String method1 = menu1.getString("method"); String method1 = menu1.getString("method");
String permission = menu1.getString("permission"); String permission = menu1.getString("permission");
String pid = menu1.getString("pid");
String listSql = "select * from sys_roles_menus where menu_id=? and role_id=?"; String listSql = "select * from sys_roles_menus where menu_id=? and role_id=?";
List<Row> count1 = Db.selectListBySql(listSql, menuId, 1L); List<Row> count1 = Db.selectListBySql(listSql, menuId, 1L);
if (count1.isEmpty()) { if (count1.isEmpty()) {
sql = "INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES (?, ?);"; sql = "INSERT INTO `sys_roles_menus` (`menu_id`, `role_id`) VALUES (?, ?);";
Db.insertBySql(sql, menuId, 1L); Db.insertBySql(sql, menuId, 1L);
log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", title, permission); log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", title, permission);
} }
if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1)) { if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1) || !parentId.equals(pid)) {
sql = "update sys_menu set title=?, url=?, method=?, pid=? where menu_id=?"; sql = "update sys_menu set title=?, url=?, method=?, pid=? where menu_id=?";
Db.updateBySql(sql, permissionName, fullPath, httpMethod, parentId, menuId); Db.updateBySql(sql, permissionName, fullPath, httpMethod, parentId, menuId);
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName); log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);

View File

@@ -223,7 +223,6 @@ public class ShopInfoServiceImpl extends ServiceImpl<ShopInfoMapper, ShopInfo> i
shopConfig.setIsEnableConsSync(0); shopConfig.setIsEnableConsSync(0);
shopConfig.setIsAllowAccountLogin(1); shopConfig.setIsAllowAccountLogin(1);
shopConfig.setRemark(null); shopConfig.setRemark(null);
shopConfig.setIsCustomAmount(0);
shopConfig.setIsReturnPwd(0); shopConfig.setIsReturnPwd(0);
shopConfig.setIsMemberInPwd(0); shopConfig.setIsMemberInPwd(0);
shopConfig.setIsMemberReturnPwd(0); shopConfig.setIsMemberReturnPwd(0);

View File

@@ -128,7 +128,6 @@ public class MemberOrderServiceImpl extends ServiceImpl<MemberOrderMapper, Membe
.setAmount(BigDecimal.ZERO) .setAmount(BigDecimal.ZERO)
.setBirthDay(userInfo.getBirthDay()) .setBirthDay(userInfo.getBirthDay())
.setIsVip(0) .setIsVip(0)
.setAccountPoints(0)
.setNickName(userInfo.getNickName()) .setNickName(userInfo.getNickName())
); );

View File

@@ -49,7 +49,7 @@ public class MkPointsUserServiceImpl extends ServiceImpl<MkPointsUserMapper, MkP
public Page<MkPointsUserDTO> getPointsUserPage(String phone, Integer page, Integer size) { public Page<MkPointsUserDTO> getPointsUserPage(String phone, Integer page, Integer size) {
Long shopUserId = null; Long shopUserId = null;
Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId()); Long mainIdByShopId = shopInfoService.getMainIdByShopId(StpKit.USER.getShopId());
if (StrUtil.isBlankIfStr(phone)) { if (StrUtil.isNotBlank(phone)) {
ShopUser one = shopUserService.getOne(query().eq(ShopUser::getPhone, phone).eq(ShopUser::getMainShopId, mainIdByShopId)); ShopUser one = shopUserService.getOne(query().eq(ShopUser::getPhone, phone).eq(ShopUser::getMainShopId, mainIdByShopId));
if (one == null) { if (one == null) {
return new Page<>(); return new Page<>();