Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -1,10 +1,7 @@
|
|||||||
package com.czg.controller.admin;
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
import com.czg.account.dto.PageDTO;
|
import com.czg.account.dto.PageDTO;
|
||||||
import com.czg.account.dto.role.RoleAddDTO;
|
import com.czg.account.dto.role.*;
|
||||||
import com.czg.account.dto.role.RoleEditDTO;
|
|
||||||
import com.czg.account.dto.role.RolePermissionDTO;
|
|
||||||
import com.czg.account.dto.role.RoleRemoveDTO;
|
|
||||||
import com.czg.account.entity.SysRole;
|
import com.czg.account.entity.SysRole;
|
||||||
import com.czg.account.service.SysRoleService;
|
import com.czg.account.service.SysRoleService;
|
||||||
import com.czg.annotation.SaAdminCheckPermission;
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
@@ -102,4 +99,13 @@ public class RoleController {
|
|||||||
}
|
}
|
||||||
return CzgResult.success(roleService.removeById(roleRemoveDTO.id()));
|
return CzgResult.success(roleService.removeById(roleRemoveDTO.id()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模板保存角色
|
||||||
|
*/
|
||||||
|
@PostMapping("/saveByTemplate")
|
||||||
|
public CzgResult<Boolean> saveByTemplate(@Validated @RequestBody RoleSaveTemplateDTO dto) {
|
||||||
|
return CzgResult.success(roleService.saveByTemplate(StpKit.USER.getShopId(), dto));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.czg.controller.admin;
|
||||||
|
|
||||||
|
import com.czg.account.dto.RoleTemplateDTO;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
|
import com.czg.market.entity.SysRoleTemplate;
|
||||||
|
import com.czg.market.service.SysRoleTemplateService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色模板
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/admin/roleTemplate")
|
||||||
|
public class RoleTemplateController {
|
||||||
|
@Resource
|
||||||
|
private SysRoleTemplateService roleTemplateService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加
|
||||||
|
*/
|
||||||
|
@PostMapping
|
||||||
|
public CzgResult<Boolean> save(@RequestBody @Validated RoleTemplateDTO dto) {
|
||||||
|
return CzgResult.success(roleTemplateService.saveInfo(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
*/
|
||||||
|
@DeleteMapping
|
||||||
|
public CzgResult<Boolean> delete(@RequestParam Long id) {
|
||||||
|
return CzgResult.success(roleTemplateService.removeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
@PutMapping
|
||||||
|
public CzgResult<Boolean> edit(@RequestBody @Validated RoleTemplateDTO dto) {
|
||||||
|
return CzgResult.success(roleTemplateService.editInfo(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public CzgResult<List<SysRoleTemplate>> list(@RequestParam(required = false) Long pid) {
|
||||||
|
return CzgResult.success(roleTemplateService.listInfo(pid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -14,6 +14,7 @@ import com.czg.account.vo.MemberPointsLogVO;
|
|||||||
import com.czg.account.vo.PointsShopListVO;
|
import com.czg.account.vo.PointsShopListVO;
|
||||||
import com.czg.account.vo.ShopUserFlowInfoVO;
|
import com.czg.account.vo.ShopUserFlowInfoVO;
|
||||||
import com.czg.annotation.Debounce;
|
import com.czg.annotation.Debounce;
|
||||||
|
import com.czg.annotation.SaAdminCheckPermission;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.utils.MyQueryWrapper;
|
import com.czg.utils.MyQueryWrapper;
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ public @interface SaAdminCheckPermission {
|
|||||||
|
|
||||||
String name() default "";
|
String name() default "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级菜单名称
|
||||||
|
*/
|
||||||
|
String parentName() default "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证模式:AND | OR,默认AND
|
* 验证模式:AND | OR,默认AND
|
||||||
* @return 验证模式
|
* @return 验证模式
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.czg.account.dto;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class RoleTemplateDTO {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "模板名称不能为空")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Integer isEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色id列表
|
||||||
|
*/
|
||||||
|
private Integer roleId;
|
||||||
|
/**
|
||||||
|
* 上级id
|
||||||
|
*/
|
||||||
|
private Integer pid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.czg.account.dto.role;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public record RoleSaveTemplateDTO(
|
||||||
|
/* 角色名称 */
|
||||||
|
@NotBlank
|
||||||
|
List<Integer> roleTemplateIdList
|
||||||
|
) {
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.mybatisflex.annotation.Table;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -23,6 +24,7 @@ import java.time.LocalDateTime;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Table("sys_role")
|
@Table("sys_role")
|
||||||
|
@Accessors(chain = true)
|
||||||
public class SysRole implements Serializable {
|
public class SysRole implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.czg.account.dto.PageDTO;
|
|||||||
import com.czg.account.dto.role.RoleAddDTO;
|
import com.czg.account.dto.role.RoleAddDTO;
|
||||||
import com.czg.account.dto.role.RoleEditDTO;
|
import com.czg.account.dto.role.RoleEditDTO;
|
||||||
import com.czg.account.dto.role.RolePermissionDTO;
|
import com.czg.account.dto.role.RolePermissionDTO;
|
||||||
|
import com.czg.account.dto.role.RoleSaveTemplateDTO;
|
||||||
import com.czg.account.entity.SysRole;
|
import com.czg.account.entity.SysRole;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
import com.mybatisflex.core.service.IService;
|
import com.mybatisflex.core.service.IService;
|
||||||
@@ -29,4 +30,7 @@ public interface SysRoleService extends IService<SysRole> {
|
|||||||
List<Long> getRoleMenu(long loginIdAsLong, Integer id, Integer type);
|
List<Long> getRoleMenu(long loginIdAsLong, Integer id, Integer type);
|
||||||
|
|
||||||
Boolean editPermission(long userId, RolePermissionDTO rolePermissionDTO);
|
Boolean editPermission(long userId, RolePermissionDTO rolePermissionDTO);
|
||||||
|
|
||||||
|
Boolean saveByTemplate(long shopId, RoleSaveTemplateDTO dto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
|
||||||
|
package com.czg.market.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.alibaba.fastjson2.annotation.JSONField;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import java.io.Serial;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色模板 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-12-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class SysRoleTemplateDTO implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Integer isEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人
|
||||||
|
*/
|
||||||
|
private String opUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色id列表
|
||||||
|
*/
|
||||||
|
private String roleIdList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
package com.czg.market.entity;
|
||||||
|
|
||||||
|
import com.mybatisflex.annotation.Column;
|
||||||
|
import com.mybatisflex.annotation.Id;
|
||||||
|
import com.mybatisflex.annotation.KeyType;
|
||||||
|
import com.mybatisflex.annotation.Table;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色模板 实体类。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-12-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Table("sys_role_template")
|
||||||
|
public class SysRoleTemplate implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Id(keyType = KeyType.Auto)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否启用
|
||||||
|
*/
|
||||||
|
private Integer isEnable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人
|
||||||
|
*/
|
||||||
|
private String opUser;
|
||||||
|
private Long opSysUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改时间
|
||||||
|
*/
|
||||||
|
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色id列表
|
||||||
|
*/
|
||||||
|
private Long roleId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级id
|
||||||
|
*/
|
||||||
|
private Integer pid;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.czg.market.service;
|
||||||
|
|
||||||
|
import com.czg.account.dto.RoleTemplateDTO;
|
||||||
|
import com.mybatisflex.core.service.IService;
|
||||||
|
import com.czg.market.entity.SysRoleTemplate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色模板 服务层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-12-08
|
||||||
|
*/
|
||||||
|
public interface SysRoleTemplateService extends IService<SysRoleTemplate> {
|
||||||
|
|
||||||
|
Boolean saveInfo(RoleTemplateDTO dto);
|
||||||
|
|
||||||
|
List<SysRoleTemplate> listInfo(Long pid);
|
||||||
|
|
||||||
|
Boolean editInfo(RoleTemplateDTO dto);
|
||||||
|
}
|
||||||
@@ -85,8 +85,29 @@ public class LoadingRole implements CommandLineRunner {
|
|||||||
Method nameMethod = annotationClass.getMethod("name");
|
Method nameMethod = annotationClass.getMethod("name");
|
||||||
String permissionName = (String) nameMethod.invoke(annotation);
|
String permissionName = (String) nameMethod.invoke(annotation);
|
||||||
|
|
||||||
|
Method parentNameMethod = annotationClass.getMethod("parentName");
|
||||||
|
String parentName = (String) parentNameMethod.invoke(annotation);
|
||||||
|
|
||||||
|
|
||||||
|
String parentId;
|
||||||
|
String parentMenuSql = "select * from sys_menu where title=?"; // 查询菜单是否存在
|
||||||
|
Row parentMenu;
|
||||||
|
if (StrUtil.isNotBlank(parentName)) {
|
||||||
|
parentMenu = Db.selectOneBySql(parentMenuSql, parentName);
|
||||||
|
if (parentMenu == null) {
|
||||||
|
throw new RuntimeException(StrUtil.format("上级菜单不存在, 方法名{}, 方法路径:{}", method.getName(), fullPath));
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
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=?";
|
||||||
|
|
||||||
Row menu1 = Db.selectOneBySql(sql, s);
|
Row menu1 = Db.selectOneBySql(sql, s);
|
||||||
if (menu1 != null) {
|
if (menu1 != null) {
|
||||||
Long menuId = menu1.getLong("menu_id");
|
Long menuId = menu1.getLong("menu_id");
|
||||||
@@ -97,6 +118,8 @@ public class LoadingRole implements CommandLineRunner {
|
|||||||
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);
|
||||||
@@ -104,16 +127,16 @@ public class LoadingRole implements CommandLineRunner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1)) {
|
if (!title.equals(permissionName) || !fullPath.equals(url) || !httpMethod.equals(method1)) {
|
||||||
sql = "update sys_menu set title=?, url=?, method=? where menu_id=?";
|
sql = "update sys_menu set title=?, url=?, method=?, pid=? where menu_id=?";
|
||||||
Db.updateBySql(sql, permissionName, fullPath, httpMethod, menuId);
|
Db.updateBySql(sql, permissionName, fullPath, httpMethod, parentId, menuId);
|
||||||
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);
|
log.info("接口菜单修改成功, 旧名称: {}, 新菜单名称: {}", title, permissionName);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sql = "INSERT INTO `czg_cashier`.`sys_menu` ( `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`, `active_menu`, `is_shop`, `url`, `method`) VALUES " +
|
sql = "INSERT INTO `czg_cashier`.`sys_menu` ( `sub_count`, `type`, `title`, `name`, `component`, `menu_sort`, `icon`, `path`, `i_frame`, `cache`, `hidden`, `permission`, `create_by`, `update_by`, `create_time`, `update_time`, `active_menu`, `is_shop`, `url`, `method`, `pid`) VALUES " +
|
||||||
"(0, 2, ?, NULL, '', 2, '', '', b'0', b'0', b'0', ?, NULL, NULL, ?, NULL, NULL, 0, ?, ?);";
|
"(0, 2, ?, NULL, '', 2, '', '', b'0', b'0', b'0', ?, NULL, NULL, ?, NULL, NULL, 0, ?, ?, ?);";
|
||||||
Db.insertBySql(sql, StrUtil.isNotBlank(permissionName) ? permissionName : s, s, DateUtil.date(), fullPath, httpMethod);
|
Db.insertBySql(sql, StrUtil.isNotBlank(permissionName) ? permissionName : s, s, DateUtil.date(), fullPath, httpMethod, parentId);
|
||||||
sql = "select * from sys_menu where permission=?";
|
sql = "select * from sys_menu where permission=?";
|
||||||
Row info = Db.selectOneBySql(sql, s);
|
Row info = Db.selectOneBySql(sql, s);
|
||||||
Long menuId = info.getLong("menu_id");
|
Long menuId = info.getLong("menu_id");
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.czg.service.account.mapper;
|
||||||
|
|
||||||
|
import com.mybatisflex.core.BaseMapper;
|
||||||
|
import com.czg.market.entity.SysRoleTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色模板 映射层。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-12-08
|
||||||
|
*/
|
||||||
|
public interface SysRoleTemplateMapper extends BaseMapper<SysRoleTemplate> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl;
|
|||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -27,6 +28,10 @@ public class BkContactListServiceImpl extends ServiceImpl<BkContactListMapper, B
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BkContactList> getUserList(Long shopId, Set<String> phones) {
|
public List<BkContactList> getUserList(Long shopId, Set<String> phones) {
|
||||||
|
if (phones == null || phones.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
remove(QueryWrapper.create().eq(BkContactList::getShopId, shopId));
|
remove(QueryWrapper.create().eq(BkContactList::getShopId, shopId));
|
||||||
List<BkContactList> collect = phones.stream()
|
List<BkContactList> collect = phones.stream()
|
||||||
.filter(StrUtil::isNotEmpty)
|
.filter(StrUtil::isNotEmpty)
|
||||||
|
|||||||
@@ -9,18 +9,22 @@ import com.czg.account.dto.menu.MenuApiInfoItemDTO;
|
|||||||
import com.czg.account.dto.role.RoleAddDTO;
|
import com.czg.account.dto.role.RoleAddDTO;
|
||||||
import com.czg.account.dto.role.RoleEditDTO;
|
import com.czg.account.dto.role.RoleEditDTO;
|
||||||
import com.czg.account.dto.role.RolePermissionDTO;
|
import com.czg.account.dto.role.RolePermissionDTO;
|
||||||
|
import com.czg.account.dto.role.RoleSaveTemplateDTO;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
import com.czg.account.service.CashMenuService;
|
import com.czg.account.service.CashMenuService;
|
||||||
import com.czg.account.service.SysMenuService;
|
import com.czg.account.service.SysMenuService;
|
||||||
import com.czg.account.service.SysRoleService;
|
import com.czg.account.service.SysRoleService;
|
||||||
import com.czg.account.service.SysRolesMenusService;
|
import com.czg.account.service.SysRolesMenusService;
|
||||||
import com.czg.exception.CzgException;
|
import com.czg.exception.CzgException;
|
||||||
|
import com.czg.market.entity.SysRoleTemplate;
|
||||||
|
import com.czg.market.service.SysRoleTemplateService;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import com.czg.service.account.mapper.SysRoleMapper;
|
import com.czg.service.account.mapper.SysRoleMapper;
|
||||||
import com.mybatisflex.core.paginate.Page;
|
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 org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -43,6 +47,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||||||
private SysRolesMenusService sysRolesMenusService;
|
private SysRolesMenusService sysRolesMenusService;
|
||||||
@Resource
|
@Resource
|
||||||
private CashMenuService cashMenuService;
|
private CashMenuService cashMenuService;
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private SysRoleTemplateService roleTemplateService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SysRole> getByUserId(Long id) {
|
public List<SysRole> getByUserId(Long id) {
|
||||||
@@ -237,6 +244,18 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|||||||
throw new CzgException("保存失败");
|
throw new CzgException("保存失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean saveByTemplate(long shopId, RoleSaveTemplateDTO dto) {
|
||||||
|
roleTemplateService.list(new QueryWrapper().in(SysRoleTemplate::getId, dto.roleTemplateIdList())).forEach(item -> {
|
||||||
|
SysRole role = getById(item.getRoleId());
|
||||||
|
role.setShopId(shopId);
|
||||||
|
role.setCreateTime(null);
|
||||||
|
role.setId(null);
|
||||||
|
save(role);
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean edit(RoleEditDTO roleEditDTO) {
|
public Boolean edit(RoleEditDTO roleEditDTO) {
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
package com.czg.service.account.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import com.czg.account.dto.RoleTemplateDTO;
|
||||||
|
import com.czg.account.entity.SysRole;
|
||||||
|
import com.czg.account.service.SysRoleService;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.service.account.mapper.SysRoleTemplateMapper;
|
||||||
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||||
|
import com.czg.market.entity.SysRoleTemplate;
|
||||||
|
import com.czg.market.service.SysRoleTemplateService;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色模板 服务层实现。
|
||||||
|
*
|
||||||
|
* @author zs
|
||||||
|
* @since 2025-12-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SysRoleTemplateServiceImpl extends ServiceImpl<SysRoleTemplateMapper, SysRoleTemplate> implements SysRoleTemplateService{
|
||||||
|
@Resource
|
||||||
|
private SysRoleService roleService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean saveInfo(RoleTemplateDTO dto) {
|
||||||
|
SysRoleTemplate roleTemplate = BeanUtil.copyProperties(dto, SysRoleTemplate.class, "roleIdList");
|
||||||
|
roleTemplate.setOpUser(StpKit.USER.getAccount());
|
||||||
|
if (roleTemplate.getPid() != null) {
|
||||||
|
SysRole sysRole = new SysRole().setName(roleTemplate.getName()).setCreateUserId(StpKit.USER.getLoginIdAsLong());
|
||||||
|
roleService.save(sysRole);
|
||||||
|
roleTemplate.setRoleId(sysRole.getId());
|
||||||
|
}
|
||||||
|
roleTemplate.setOpSysUserId(StpKit.USER.getLoginIdAsLong());
|
||||||
|
return save(roleTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysRoleTemplate> listInfo(Long pid) {
|
||||||
|
QueryWrapper queryWrapper = new QueryWrapper().eq(SysRoleTemplate::getPid, pid);
|
||||||
|
if (pid == null) {
|
||||||
|
queryWrapper.isNull(SysRoleTemplate::getPid);
|
||||||
|
}
|
||||||
|
return list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean editInfo(RoleTemplateDTO dto) {
|
||||||
|
SysRoleTemplate roleTemplate = BeanUtil.copyProperties(dto, SysRoleTemplate.class);
|
||||||
|
roleTemplate.setOpUser(StpKit.USER.getAccount());
|
||||||
|
roleTemplate.setOpSysUserId(StpKit.USER.getLoginIdAsLong());
|
||||||
|
return updateById(roleTemplate);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -106,9 +106,11 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
Map<Long, ShopCoupon> couponMap = shopCouponService.list(new QueryWrapper().in(ShopCoupon::getId, couponIdList)).stream().collect(Collectors.toMap(ShopCoupon::getId, v -> v));
|
Map<Long, ShopCoupon> couponMap = shopCouponService.list(new QueryWrapper().in(ShopCoupon::getId, couponIdList)).stream().collect(Collectors.toMap(ShopCoupon::getId, v -> v));
|
||||||
couponInfoDTOS.forEach(item -> {
|
couponInfoDTOS.forEach(item -> {
|
||||||
ShopCoupon shopCoupon = couponMap.get(item.getId());
|
ShopCoupon shopCoupon = couponMap.get(item.getId());
|
||||||
if (shopCoupon != null) {
|
|
||||||
shopCoupon.setInfo();
|
if (shopCoupon == null) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
shopCoupon.setInfo();
|
||||||
couponInfoVOS.add(new CouponInfoVO().setCoupon(shopCoupon).setNum(item.getNum()));
|
couponInfoVOS.add(new CouponInfoVO().setCoupon(shopCoupon).setNum(item.getNum()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?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.SysRoleTemplateMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -95,6 +95,7 @@
|
|||||||
consStockFlow.setInOutItem(InOutItemEnum.MANUAL_IN.value());
|
consStockFlow.setInOutItem(InOutItemEnum.MANUAL_IN.value());
|
||||||
consStockFlow.setCreateUserId(createUserId);
|
consStockFlow.setCreateUserId(createUserId);
|
||||||
consStockFlow.setCreateUserName(createUserName);
|
consStockFlow.setCreateUserName(createUserName);
|
||||||
|
consStockFlow.setVendorId(param.getVendorId());
|
||||||
String conId = entity.getConId();
|
String conId = entity.getConId();
|
||||||
ConsInfo consInfo;
|
ConsInfo consInfo;
|
||||||
if (StrUtil.isBlank(entity.getConId())) {
|
if (StrUtil.isBlank(entity.getConId())) {
|
||||||
@@ -121,7 +122,9 @@
|
|||||||
consInfo.setStockNumber(consStockFlow.getAfterNumber());
|
consInfo.setStockNumber(consStockFlow.getAfterNumber());
|
||||||
updateStockList.add(consInfo);
|
updateStockList.add(consInfo);
|
||||||
}
|
}
|
||||||
|
if (!insertList.isEmpty()) {
|
||||||
mapper.insertBatchSelective(insertList, 50);
|
mapper.insertBatchSelective(insertList, 50);
|
||||||
|
}
|
||||||
for (ConsInfo consInfo : updateStockList) {
|
for (ConsInfo consInfo : updateStockList) {
|
||||||
consInfoMapper.update(consInfo);
|
consInfoMapper.update(consInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user