整理上线初始化SQL基线并收口管理师接口
This commit is contained in:
+239
@@ -0,0 +1,239 @@
|
||||
package com.xiaowang.fingertipdesigner.core.modules.manager.controller.admin;
|
||||
|
||||
import com.xiaowang.fingertipdesigner.core.annotation.OperationGuard;
|
||||
import com.xiaowang.fingertipdesigner.core.annotation.RequirePermission;
|
||||
import com.xiaowang.fingertipdesigner.core.common.Result;
|
||||
import com.xiaowang.fingertipdesigner.core.common.vo.PageResultVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.dto.ArtistScheduleDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.dto.NailArtistInfoDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.service.ArtistScheduleService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.service.NailArtistInfoService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.vo.ArtistScheduleVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.dto.PlanningAppointmentCreateDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.dto.PlanningAppointmentMoveDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.dto.PlanningAppointmentStatusDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.service.PlanningService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.vo.PlanningAppointmentVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.vo.PlanningCalendarVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.product.service.ProductService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.product.vo.ProductVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.security.support.AdminScopeHelper;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.dto.ShopDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.service.ShopService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.vo.ShopVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.dto.UserDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.entity.UserDO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.service.UserService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.vo.UserVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/manager")
|
||||
@RequiredArgsConstructor
|
||||
public class AdminManagerController {
|
||||
|
||||
private final PlanningService planningService;
|
||||
private final UserService userService;
|
||||
private final NailArtistInfoService nailArtistInfoService;
|
||||
private final ArtistScheduleService artistScheduleService;
|
||||
private final ProductService productService;
|
||||
private final ShopService shopService;
|
||||
private final AdminScopeHelper adminScopeHelper;
|
||||
|
||||
@GetMapping("/planning/calendar")
|
||||
@RequirePermission("schedule:view")
|
||||
public Result<PlanningCalendarVO> calendar(HttpServletRequest request,
|
||||
@RequestParam(required = false) String startDate,
|
||||
@RequestParam(required = false) String endDate,
|
||||
@RequestParam(required = false) Long artistId) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
LocalDate start = startDate == null || startDate.isBlank() ? LocalDate.now() : LocalDate.parse(startDate);
|
||||
LocalDate end = endDate == null || endDate.isBlank() ? start : LocalDate.parse(endDate);
|
||||
return Result.success(planningService.getCalendar(currentUser, start, end, artistId));
|
||||
}
|
||||
|
||||
@PostMapping("/planning/appointments")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "manager-planning-create-appointment", ttlSeconds = 10, message = "预约创建处理中,请勿重复提交")
|
||||
public Result<PlanningAppointmentVO> createAppointment(HttpServletRequest request,
|
||||
@RequestBody PlanningAppointmentCreateDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.createAppointment(currentUser, dto));
|
||||
}
|
||||
|
||||
@GetMapping("/planning/appointments/{orderItemId}")
|
||||
@RequirePermission("order:view")
|
||||
public Result<PlanningAppointmentVO> appointment(HttpServletRequest request,
|
||||
@PathVariable Long orderItemId) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.getAppointment(currentUser, orderItemId));
|
||||
}
|
||||
|
||||
@PutMapping("/planning/appointments/{orderItemId}/time-artist")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "manager-planning-move-appointment", ttlSeconds = 10, message = "预约调整处理中,请勿重复提交")
|
||||
public Result<PlanningAppointmentVO> moveAppointment(HttpServletRequest request,
|
||||
@PathVariable Long orderItemId,
|
||||
@RequestBody PlanningAppointmentMoveDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.moveAppointment(currentUser, orderItemId, dto));
|
||||
}
|
||||
|
||||
@PutMapping("/planning/appointments/{orderId}/status")
|
||||
@RequirePermission("order:process")
|
||||
@OperationGuard(action = "manager-planning-update-appointment-status", ttlSeconds = 10, message = "预约状态处理中,请勿重复提交")
|
||||
public Result<Boolean> updateStatus(HttpServletRequest request,
|
||||
@PathVariable Long orderId,
|
||||
@RequestBody PlanningAppointmentStatusDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
return Result.success(planningService.updateStatus(currentUser, orderId, dto));
|
||||
}
|
||||
|
||||
@GetMapping("/customers")
|
||||
@RequirePermission("user:view")
|
||||
public Result<PageResultVO<UserVO>> customers(HttpServletRequest request,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String keyword,
|
||||
@RequestParam(required = false) Long shopId,
|
||||
@RequestParam(required = false) Boolean hasOrder) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
Long resolvedShopId = adminScopeHelper.resolveShopScope(currentUser, shopId);
|
||||
PageResultVO<UserVO> result = userService.pageUsers(page, size, keyword, resolvedShopId, 0, null, null, null, null, null, null, null, null, hasOrder);
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
@GetMapping("/customers/{id}")
|
||||
@RequirePermission("user:view")
|
||||
public Result<UserVO> customer(HttpServletRequest request, @PathVariable Long id) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, id, "无权查看其他店铺客户");
|
||||
return Result.success(userService.getUserById(id));
|
||||
}
|
||||
|
||||
@GetMapping("/employees")
|
||||
@RequirePermission("nail_artist:view")
|
||||
public Result<List<NailArtistInfoDTO>> employees(HttpServletRequest request) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
if (adminScopeHelper.isPlatformAdmin(currentUser)) {
|
||||
return Result.success(nailArtistInfoService.getAllNailArtists());
|
||||
}
|
||||
Long shopId = adminScopeHelper.resolveShopScope(currentUser, null);
|
||||
return Result.success(nailArtistInfoService.getByShopId(shopId));
|
||||
}
|
||||
|
||||
@GetMapping("/employees/{userId}")
|
||||
@RequirePermission("nail_artist:view")
|
||||
public Result<NailArtistInfoDTO> employee(HttpServletRequest request, @PathVariable Long userId) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
|
||||
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, userId, "无权查看其他店铺员工");
|
||||
}
|
||||
return Result.success(nailArtistInfoService.getByUserId(userId));
|
||||
}
|
||||
|
||||
@PostMapping("/employees")
|
||||
@RequirePermission("nail_artist:edit")
|
||||
@OperationGuard(action = "manager-nail-artist-save", ttlSeconds = 10, message = "员工信息保存处理中,请勿重复提交")
|
||||
public Result<NailArtistInfoDTO> saveEmployee(HttpServletRequest request,
|
||||
@RequestBody NailArtistInfoDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
|
||||
adminScopeHelper.ensureUserAccessibleInCurrentShop(currentUser, dto.getUserId(), "无权编辑其他店铺员工");
|
||||
}
|
||||
return Result.success(nailArtistInfoService.saveOrUpdateNailArtistInfo(dto));
|
||||
}
|
||||
|
||||
@PostMapping("/employees/users")
|
||||
@RequirePermission("user:create")
|
||||
@OperationGuard(action = "manager-user-create", ttlSeconds = 10, message = "员工账号创建处理中,请勿重复提交")
|
||||
public Result<Long> createEmployeeUser(HttpServletRequest request,
|
||||
@Valid @RequestBody UserDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
adminScopeHelper.ensureAssignableUserType(currentUser, dto.getType());
|
||||
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
|
||||
Long managedShopId = adminScopeHelper.getManagedShopId(currentUser);
|
||||
dto.setShopId(managedShopId);
|
||||
dto.setShopIds(List.of(managedShopId));
|
||||
}
|
||||
return Result.success(userService.createUser(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/employees/schedules")
|
||||
@RequirePermission("schedule:view")
|
||||
public Result<List<ArtistScheduleVO>> schedules(HttpServletRequest request,
|
||||
@RequestParam(required = false) Long artistId,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
|
||||
@RequestParam(required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
Long shopId = adminScopeHelper.resolveShopScope(currentUser, null);
|
||||
return Result.success(artistScheduleService.listSchedules(shopId, artistId, startDate, endDate));
|
||||
}
|
||||
|
||||
@PostMapping("/employees/schedules")
|
||||
@RequirePermission("schedule:edit")
|
||||
@OperationGuard(action = "manager-artist-schedule-save", ttlSeconds = 10, message = "排班保存处理中,请勿重复提交")
|
||||
public Result<ArtistScheduleVO> saveSchedule(HttpServletRequest request,
|
||||
@RequestBody ArtistScheduleDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
dto.setShopId(adminScopeHelper.resolveShopScope(currentUser, dto.getShopId()));
|
||||
return Result.success(artistScheduleService.saveSchedule(dto));
|
||||
}
|
||||
|
||||
@GetMapping("/products")
|
||||
@RequirePermission("product:view")
|
||||
public Result<PageResultVO<ProductVO>> products(HttpServletRequest request,
|
||||
@RequestParam(defaultValue = "1") Integer page,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String keyword,
|
||||
@RequestParam(required = false) Long shopId,
|
||||
@RequestParam(required = false) Long tagId,
|
||||
@RequestParam(required = false) java.math.BigDecimal minPrice,
|
||||
@RequestParam(required = false) java.math.BigDecimal maxPrice,
|
||||
@RequestParam(required = false) String createdFrom,
|
||||
@RequestParam(required = false) String createdTo) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
Long resolvedShopId = adminScopeHelper.resolveShopScope(currentUser, shopId);
|
||||
return Result.success(productService.pageProducts(page, size, keyword, resolvedShopId, tagId, minPrice, maxPrice, createdFrom, createdTo));
|
||||
}
|
||||
|
||||
@GetMapping("/shop")
|
||||
@RequirePermission("shop:view")
|
||||
public Result<ShopVO> shop(HttpServletRequest request) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
Long shopId = adminScopeHelper.resolveShopScope(currentUser, null);
|
||||
adminScopeHelper.requireShopContext(currentUser);
|
||||
return Result.success(shopService.getShopById(shopId));
|
||||
}
|
||||
|
||||
@PutMapping("/shop")
|
||||
@RequirePermission("shop:edit")
|
||||
@OperationGuard(action = "manager-shop-update", ttlSeconds = 10, message = "店铺设置保存处理中,请勿重复提交")
|
||||
public Result<Boolean> updateShop(HttpServletRequest request, @RequestBody ShopDTO dto) {
|
||||
UserDO currentUser = adminScopeHelper.getCurrentUser(request);
|
||||
Long shopId = adminScopeHelper.resolveShopScope(currentUser, null);
|
||||
adminScopeHelper.requireShopContext(currentUser);
|
||||
ShopVO shop = shopService.getShopById(shopId);
|
||||
if (shop == null) {
|
||||
return Result.success(false);
|
||||
}
|
||||
if (!adminScopeHelper.isPlatformAdmin(currentUser)) {
|
||||
dto.setAuthorizationExpireTime(shop.getAuthorizationExpireTime());
|
||||
}
|
||||
return Result.success(shopService.updateShop(shopId, dto));
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -2,6 +2,7 @@ package com.xiaowang.fingertipdesigner.core.modules.integration.service.impl;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xiaowang.fingertipdesigner.core.config.BrandProperties;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.integration.entity.MessageHubPushConfigDO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.integration.service.MessageHubPushConfigService;
|
||||
import com.xiaowang.fingertipdesigner.core.support.id.TimeOrderedSnowflakeIdGenerator;
|
||||
@@ -34,6 +35,9 @@ class MessageHubClientServiceImplTest {
|
||||
@Mock
|
||||
private MessageHubPushConfigService messageHubPushConfigService;
|
||||
|
||||
@Mock
|
||||
private BrandProperties brandProperties;
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
private MessageHubClientServiceImpl service;
|
||||
@@ -45,7 +49,8 @@ class MessageHubClientServiceImplTest {
|
||||
rabbitTemplate,
|
||||
objectMapper,
|
||||
snowflakeIdGenerator,
|
||||
messageHubPushConfigService
|
||||
messageHubPushConfigService,
|
||||
brandProperties
|
||||
);
|
||||
when(snowflakeIdGenerator.nextIdString()).thenReturn("sms-message-1");
|
||||
}
|
||||
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
package com.xiaowang.fingertipdesigner.core.modules.manager.controller.admin;
|
||||
|
||||
import com.xiaowang.fingertipdesigner.core.common.Result;
|
||||
import com.xiaowang.fingertipdesigner.core.common.vo.PageResultVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.dto.ArtistScheduleDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.dto.NailArtistInfoDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.service.ArtistScheduleService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.service.NailArtistInfoService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.artist.vo.ArtistScheduleVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.planning.service.PlanningService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.product.service.ProductService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.product.vo.ProductVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.security.support.AdminScopeHelper;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.dto.ShopDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.service.ShopService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.vo.ShopVO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.dto.UserDTO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.entity.UserDO;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.service.UserService;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.vo.UserVO;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class AdminManagerControllerTest {
|
||||
|
||||
@Mock
|
||||
private PlanningService planningService;
|
||||
|
||||
@Mock
|
||||
private UserService userService;
|
||||
|
||||
@Mock
|
||||
private NailArtistInfoService nailArtistInfoService;
|
||||
|
||||
@Mock
|
||||
private ArtistScheduleService artistScheduleService;
|
||||
|
||||
@Mock
|
||||
private ProductService productService;
|
||||
|
||||
@Mock
|
||||
private ShopService shopService;
|
||||
|
||||
@Mock
|
||||
private AdminScopeHelper adminScopeHelper;
|
||||
|
||||
private AdminManagerController controller;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
controller = new AdminManagerController(planningService, userService, nailArtistInfoService, artistScheduleService, productService, shopService, adminScopeHelper);
|
||||
}
|
||||
|
||||
@Test
|
||||
void controllerShouldExposeManagerBoundary() {
|
||||
RequestMapping mapping = AdminManagerController.class.getAnnotation(RequestMapping.class);
|
||||
|
||||
assertThat(mapping.value()).containsExactly("/admin/manager");
|
||||
}
|
||||
|
||||
@Test
|
||||
void customersShouldResolveShopScopeAndForceCustomerType() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
manager.setType(2);
|
||||
manager.setShopId(8L);
|
||||
PageResultVO<UserVO> pageResult = new PageResultVO<>();
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.resolveShopScope(manager, 99L)).thenReturn(8L);
|
||||
when(userService.pageUsers(1, 10, "ann", 8L, 0, null, null, null, null, null, null, null, null, true)).thenReturn(pageResult);
|
||||
|
||||
Result<PageResultVO<UserVO>> result = controller.customers(request, 1, 10, "ann", 99L, true);
|
||||
|
||||
assertThat(result.getData()).isSameAs(pageResult);
|
||||
verify(adminScopeHelper).resolveShopScope(manager, 99L);
|
||||
verify(userService).pageUsers(1, 10, "ann", 8L, 0, null, null, null, null, null, null, null, null, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createEmployeeUserShouldBindNonPlatformUserToManagedShop() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
manager.setType(2);
|
||||
manager.setShopId(8L);
|
||||
UserDTO dto = new UserDTO();
|
||||
dto.setType(3);
|
||||
dto.setShopId(99L);
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.isPlatformAdmin(manager)).thenReturn(false);
|
||||
when(adminScopeHelper.getManagedShopId(manager)).thenReturn(8L);
|
||||
when(userService.createUser(dto)).thenReturn(101L);
|
||||
|
||||
Result<Long> result = controller.createEmployeeUser(request, dto);
|
||||
|
||||
assertThat(result.getData()).isEqualTo(101L);
|
||||
assertThat(dto.getShopId()).isEqualTo(8L);
|
||||
assertThat(dto.getShopIds()).containsExactly(8L);
|
||||
verify(adminScopeHelper).ensureAssignableUserType(manager, 3);
|
||||
}
|
||||
|
||||
@Test
|
||||
void saveScheduleShouldResolveShopScopeBeforeSaving() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
ArtistScheduleDTO dto = new ArtistScheduleDTO();
|
||||
dto.setShopId(99L);
|
||||
ArtistScheduleVO vo = new ArtistScheduleVO();
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.resolveShopScope(manager, 99L)).thenReturn(8L);
|
||||
when(artistScheduleService.saveSchedule(dto)).thenReturn(vo);
|
||||
|
||||
Result<ArtistScheduleVO> result = controller.saveSchedule(request, dto);
|
||||
|
||||
assertThat(result.getData()).isSameAs(vo);
|
||||
assertThat(dto.getShopId()).isEqualTo(8L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateShopShouldPreserveAuthorizationExpireTimeForNonPlatformUser() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
ShopDTO dto = new ShopDTO();
|
||||
ShopVO shop = new ShopVO();
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
|
||||
when(shopService.getShopById(8L)).thenReturn(shop);
|
||||
when(adminScopeHelper.isPlatformAdmin(manager)).thenReturn(false);
|
||||
when(shopService.updateShop(8L, dto)).thenReturn(true);
|
||||
|
||||
Result<Boolean> result = controller.updateShop(request, dto);
|
||||
|
||||
assertThat(result.getData()).isTrue();
|
||||
verify(adminScopeHelper).requireShopContext(manager);
|
||||
verify(shopService).updateShop(8L, dto);
|
||||
}
|
||||
|
||||
@Test
|
||||
void employeesShouldReturnScopedArtistsForNonPlatformUser() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
List<NailArtistInfoDTO> artists = List.of(new NailArtistInfoDTO());
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.isPlatformAdmin(manager)).thenReturn(false);
|
||||
when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L);
|
||||
when(nailArtistInfoService.getByShopId(8L)).thenReturn(artists);
|
||||
|
||||
Result<List<NailArtistInfoDTO>> result = controller.employees(request);
|
||||
|
||||
assertThat(result.getData()).isSameAs(artists);
|
||||
}
|
||||
|
||||
@Test
|
||||
void productsShouldResolveShopScope() {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
UserDO manager = new UserDO();
|
||||
PageResultVO<ProductVO> pageResult = new PageResultVO<>();
|
||||
when(adminScopeHelper.getCurrentUser(request)).thenReturn(manager);
|
||||
when(adminScopeHelper.resolveShopScope(manager, 99L)).thenReturn(8L);
|
||||
when(productService.pageProducts(1, 10, "gel", 8L, null, null, null, null, null)).thenReturn(pageResult);
|
||||
|
||||
Result<PageResultVO<ProductVO>> result = controller.products(request, 1, 10, "gel", 99L, null, null, null, null, null);
|
||||
|
||||
assertThat(result.getData()).isSameAs(pageResult);
|
||||
verify(productService).pageProducts(1, 10, "gel", 8L, null, null, null, null, null);
|
||||
}
|
||||
}
|
||||
+5
@@ -1,6 +1,7 @@
|
||||
package com.xiaowang.fingertipdesigner.core.modules.user.service.impl;
|
||||
|
||||
import com.xiaowang.fingertipdesigner.core.modules.security.mapper.PermissionMapper;
|
||||
import com.xiaowang.fingertipdesigner.core.config.BrandProperties;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.shop.mapper.ShopMapper;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.mapper.UserInviteCodeMapper;
|
||||
import com.xiaowang.fingertipdesigner.core.modules.user.mapper.UserMapper;
|
||||
@@ -65,6 +66,9 @@ class UserServiceImplPermissionAssignmentTest {
|
||||
@Mock
|
||||
private UserInviteCodeMapper userInviteCodeMapper;
|
||||
|
||||
@Mock
|
||||
private BrandProperties brandProperties;
|
||||
|
||||
@Mock
|
||||
private UserShopRoleMapper userShopRoleMapper;
|
||||
|
||||
@@ -110,6 +114,7 @@ class UserServiceImplPermissionAssignmentTest {
|
||||
permissionMapper,
|
||||
userRelationMapper,
|
||||
userInviteCodeMapper,
|
||||
brandProperties,
|
||||
userShopRoleMapper,
|
||||
nailArtistInfoService,
|
||||
verificationCodeService,
|
||||
|
||||
+10
@@ -57,6 +57,16 @@ class AuthGlobalFilterWhitelistTest {
|
||||
assertThat(yaml).contains("Path=/admin/auth/**");
|
||||
}
|
||||
|
||||
@Test
|
||||
void applicationRoutesManagerApiThroughAdminRoute() throws Exception {
|
||||
String yaml = new String(new ClassPathResource("application.yaml").getInputStream().readAllBytes(), StandardCharsets.UTF_8);
|
||||
|
||||
assertThat(yaml)
|
||||
.contains("Path=/api/admin/**")
|
||||
.contains("RewritePath=/api/admin/(?<remaining>.*), /admin/${remaining}");
|
||||
assertThat(matches(AuthWhitelist.defaultPatterns(), "/api/admin/manager/planning/calendar")).isFalse();
|
||||
}
|
||||
|
||||
private boolean matches(List<String> patterns, String path) {
|
||||
return patterns.stream().anyMatch(pattern -> pathMatcher.match(pattern, path));
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ const request = require('../utils/request')
|
||||
module.exports = {
|
||||
list(params) {
|
||||
return request({
|
||||
url: '/user/list',
|
||||
url: '/manager/customers',
|
||||
params: {
|
||||
type: 0,
|
||||
hasOrder: true,
|
||||
...params
|
||||
}
|
||||
@@ -14,7 +13,7 @@ module.exports = {
|
||||
|
||||
detail(id) {
|
||||
return request({
|
||||
url: `/user/detail/${id}`
|
||||
url: `/manager/customers/${id}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,20 +3,20 @@ const request = require('../utils/request')
|
||||
module.exports = {
|
||||
list(params) {
|
||||
return request({
|
||||
url: '/nail-artist/list',
|
||||
url: '/manager/employees',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
detail(userId) {
|
||||
return request({
|
||||
url: `/nail-artist/get/${userId}`
|
||||
url: `/manager/employees/${userId}`
|
||||
})
|
||||
},
|
||||
|
||||
save(data) {
|
||||
return request({
|
||||
url: '/nail-artist/save',
|
||||
url: '/manager/employees',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
@@ -24,7 +24,7 @@ module.exports = {
|
||||
|
||||
createUser(data) {
|
||||
return request({
|
||||
url: '/user/create',
|
||||
url: '/manager/employees/users',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
@@ -32,14 +32,14 @@ module.exports = {
|
||||
|
||||
schedules(params) {
|
||||
return request({
|
||||
url: '/artist-schedule/list',
|
||||
url: '/manager/employees/schedules',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
saveSchedule(data) {
|
||||
return request({
|
||||
url: '/artist-schedule/save',
|
||||
url: '/manager/employees/schedules',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
|
||||
@@ -3,14 +3,14 @@ const request = require('../utils/request')
|
||||
module.exports = {
|
||||
calendar(params) {
|
||||
return request({
|
||||
url: '/planning/calendar',
|
||||
url: '/manager/planning/calendar',
|
||||
params
|
||||
})
|
||||
},
|
||||
|
||||
createAppointment(data) {
|
||||
return request({
|
||||
url: '/planning/appointments',
|
||||
url: '/manager/planning/appointments',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
@@ -18,13 +18,13 @@ module.exports = {
|
||||
|
||||
appointment(orderItemId) {
|
||||
return request({
|
||||
url: `/planning/appointments/${orderItemId}`
|
||||
url: `/manager/planning/appointments/${orderItemId}`
|
||||
})
|
||||
},
|
||||
|
||||
moveAppointment(orderItemId, data) {
|
||||
return request({
|
||||
url: `/planning/appointments/${orderItemId}/time-artist`,
|
||||
url: `/manager/planning/appointments/${orderItemId}/time-artist`,
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
@@ -32,7 +32,7 @@ module.exports = {
|
||||
|
||||
updateStatus(orderId, status) {
|
||||
return request({
|
||||
url: `/planning/appointments/${orderId}/status`,
|
||||
url: `/manager/planning/appointments/${orderId}/status`,
|
||||
method: 'PUT',
|
||||
data: { status }
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@ const request = require('../utils/request')
|
||||
module.exports = {
|
||||
list(params) {
|
||||
return request({
|
||||
url: '/product/list',
|
||||
url: '/manager/products',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
@@ -3,13 +3,13 @@ const request = require('../utils/request')
|
||||
module.exports = {
|
||||
settings() {
|
||||
return request({
|
||||
url: '/shops/current'
|
||||
url: '/manager/shop'
|
||||
})
|
||||
},
|
||||
|
||||
saveSettings(data) {
|
||||
return request({
|
||||
url: '/shops/current',
|
||||
url: '/manager/shop',
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
|
||||
+1
-1
@@ -32,5 +32,5 @@ FingertipDesigner 指尖设计师是一个面向美甲门店经营的全链路
|
||||
- `FD-Core/src/main/java/com/xiaowang/fingertipdesigner/core/modules/`:后端 Core 业务模块目录。
|
||||
- `FD-Core/src/main/java/com/xiaowang/fingertipdesigner/core/common/`:后端 Core 公共 DTO、VO 和基类目录。
|
||||
- `scripts/sql/init/`:数据库初始化 SQL。
|
||||
- `scripts/sql/migrations/`:后续新增 SQL 变更脚本目录。
|
||||
- `scripts/sql/migrations/`:当前仅保留目录占位,不作为开发、测试或上线空库初始化步骤。
|
||||
- `artifacts/maven/`:Maven 打包产物指定输出目录。
|
||||
|
||||
@@ -70,4 +70,4 @@ vNext 经营能力在数据库层补齐独立运行时表,并与订单、权
|
||||
|
||||
初始化 SQL 只放在 `scripts/sql/init/FingertipDesigner.sql`,这是当前唯一的数据库初始化入口。
|
||||
|
||||
本轮 vNext 增量脚本为 `scripts/sql/migrations/20260524_vnext_operations.sql`。它与初始化 SQL 保持同一表结构、索引、权限种子和雪花 ID 主键口径。
|
||||
vNext 经营表结构、索引、权限种子和雪花 ID 主键口径已经并入唯一初始化 SQL。空库初始化只执行 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
|
||||
@@ -2,14 +2,12 @@
|
||||
|
||||
## Maven 产物目录
|
||||
|
||||
Maven 打包产物指定目录为:
|
||||
Maven 打包产物统一放在:
|
||||
|
||||
```text
|
||||
artifacts/maven/
|
||||
```
|
||||
|
||||
后续打包 Core 和 Gateway 时,最终可发布的 jar 包统一放到该目录。当前轮次只创建目录和约定,不修改 Java 代码文件。
|
||||
|
||||
建议产物命名:
|
||||
|
||||
```text
|
||||
@@ -17,38 +15,21 @@ artifacts/maven/FingertipDesigner-Core.jar
|
||||
artifacts/maven/FingertipDesigner-Gateway.jar
|
||||
```
|
||||
|
||||
如果后续需要 Maven 自动输出到该目录,可以在单独任务中调整 Maven 构建配置或打包脚本。
|
||||
## SQL 基线
|
||||
|
||||
## SQL 目录
|
||||
|
||||
初始化 SQL:
|
||||
当前唯一初始化 SQL:
|
||||
|
||||
```text
|
||||
scripts/sql/init/FingertipDesigner.sql
|
||||
```
|
||||
|
||||
后续新增 SQL:
|
||||
开发、测试、上线空库初始化只执行该文件。该文件包含完整表结构、索引、约束、平台管理员、基础权限、系统参数、协议、MessageHub 与 VIP 基础配置。
|
||||
|
||||
```text
|
||||
scripts/sql/migrations/
|
||||
```
|
||||
|
||||
迁移脚本命名建议:
|
||||
|
||||
```text
|
||||
YYYYMMDDHHmm_description.sql
|
||||
```
|
||||
|
||||
例如:
|
||||
|
||||
```text
|
||||
202605231030_add_order_review_index.sql
|
||||
```
|
||||
`scripts/sql/migrations` 当前不保留历史迁移 SQL。旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等变更已经合并进 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
|
||||
## SQL 管理规则
|
||||
|
||||
- 空库初始化优先执行 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 上线后新增结构、索引、权限种子和数据修复脚本放入 `scripts/sql/migrations/`。
|
||||
- 迁移脚本必须可重复审查,避免把环境密码、Nacos 配置或测试库连接信息写入仓库。
|
||||
- 迁移完成后,必要时同步更新初始化 SQL,保证新环境可以从空库一次初始化成功。
|
||||
|
||||
- 新环境空库初始化只执行 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 后续新增表、字段、索引或运行必需种子数据时,必须同步更新该初始化 SQL。
|
||||
- 已部署生产库的数据升级不直接复用初始化 SQL;如需升级已有库,必须单独制定迁移方案并经人工确认。
|
||||
- SQL 中不得写入环境密码、Nacos 配置或测试库连接信息。
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
更新时间:2026-05-24
|
||||
|
||||
本文记录本轮初始化 SQL 与增量 migration 覆盖的 vNext 经营能力。对应文件为 `FingertipDesigner-Core/src/main/resources/files/FingertipDesigner.sql`、`scripts/sql/init/FingertipDesigner.sql` 和 `scripts/sql/migrations/20260524_vnext_operations.sql`。
|
||||
本文记录已经并入唯一初始化 SQL 的 vNext 经营能力。当前空库初始化只执行 `scripts/sql/init/FingertipDesigner.sql`,不再额外执行历史增量脚本。
|
||||
|
||||
## 覆盖范围
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
- `analytics:view`
|
||||
- `performance:view`
|
||||
|
||||
初始化 SQL 会把平台管理员、店长、美甲师默认权限列表同步到对应能力;增量 migration 会确保 `xiaowang` 获得当前权限目录中的全部权限。
|
||||
初始化 SQL 会把平台管理员默认权限列表同步到对应能力,并确保 `xiaowang` 获得当前权限目录中的全部权限。
|
||||
|
||||
## 验证入口
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
# 上线初始化 SQL 基线说明
|
||||
|
||||
更新时间:2026-06-24
|
||||
|
||||
## 唯一入口
|
||||
|
||||
`scripts/sql/init/FingertipDesigner.sql` 是当前唯一初始化 SQL。
|
||||
|
||||
开发、测试、上线空库初始化都只执行该文件。`scripts/sql/migrations` 下不再保留历史变更脚本,本轮已把旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等变更合并回初始化基线。
|
||||
|
||||
## 初始化内容
|
||||
|
||||
初始化 SQL 覆盖完整表结构、字段、索引、约束和最小运行种子数据。
|
||||
|
||||
保留的种子数据:
|
||||
|
||||
- 平台管理员账号 `xiaowang` 及当前 bcrypt 密码值。
|
||||
- 完整权限字典。
|
||||
- `xiaowang` 对当前权限目录的全量授权。
|
||||
- 用户协议、隐私政策、系统参数、MessageHub 推送配置、VIP 基础规则。
|
||||
|
||||
不写入的业务样例数据:
|
||||
|
||||
- 门店、商品、标签、客户、订单、购物车、库存流水、测试消息、测试公告。
|
||||
|
||||
## 已合并的历史变更
|
||||
|
||||
- `t_object_storage_file_replica` 对象存储副本表。
|
||||
- `t_product.front_visible` 和 `t_product.source_type` 字段。
|
||||
- `t_messagehub_push_config.source_system = 'fingertipdesigner'`。
|
||||
|
||||
## 后续规则
|
||||
|
||||
后续开发环境和测试环境以该 SQL 为基线。如果新增表、字段、索引或运行必需种子数据,必须同步更新 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
|
||||
生产已部署库的历史数据升级不在本文件范围内。若后续需要升级已有生产库,应单独制定迁移方案并经人工确认后执行。
|
||||
@@ -2,63 +2,51 @@
|
||||
|
||||
更新时间:2026-06-24
|
||||
|
||||
用途:记录当前仓库、配置、对象存储和部署准备状态。继续开发、部署或交接前先读本文件。
|
||||
## 仓库状态
|
||||
|
||||
## 1. 仓库状态
|
||||
- 工作目录:`D:\code\FingertipDesigner`
|
||||
- 当前分支:`dev`
|
||||
- 项目统一使用 `FingertipDesigner` / `fingertip-designer` 命名。
|
||||
- Core Java 包名:`com.xiaowang.fingertipdesigner.core`
|
||||
- Gateway Java 包名:`com.xiaowang.fingertipdesigner.gateway`
|
||||
|
||||
- 工作目录:`D:\code\FingertipDesigner`。
|
||||
- 当前分支:`dev`。
|
||||
- 最新提交:`b1117325 统一项目命名并接回MinIO三副本存储`。
|
||||
- 该提交前已执行 GitNexus `detect_changes(scope="all")`,结果为 `risk_level=low`,无 affected processes。
|
||||
- 提交后工作区曾确认干净;本次只更新 `docx/handoff` 文档,尚未提交。
|
||||
## SQL 基线
|
||||
|
||||
## 2. 命名状态
|
||||
- 唯一初始化 SQL:`scripts/sql/init/FingertipDesigner.sql`
|
||||
- 开发、测试、上线空库初始化只执行该文件。
|
||||
- `scripts/sql/migrations` 当前不再保留历史迁移 SQL。
|
||||
- 旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等变更已经合并进初始化 SQL。
|
||||
- 该初始化 SQL 只保留一名平台管理员 `xiaowang`、完整权限、管理员授权、协议、系统参数、MessageHub 和 VIP 基础配置,不写入门店、商品、订单、客户等业务样例数据。
|
||||
- 生产已部署库的历史数据升级不在初始化 SQL 范围内,如需升级已有库必须单独制定迁移方案。
|
||||
|
||||
- 当前项目统一使用 `FingertipDesigner` / `fingertip-designer` 命名。
|
||||
- Core Java 包名:`com.xiaowang.fingertipdesigner.core`。
|
||||
- Gateway Java 包名:`com.xiaowang.fingertipdesigner.gateway`。
|
||||
- 初始化 SQL:`scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 旧名迁移 SQL:`scripts/sql/migrations/统一项目命名为FingertipDesigner_20260623.sql`。
|
||||
- 本地敏感 Excel 已通过 `.gitignore` 忽略,不进入提交:`docx/服务器信息.xlsx`、`docx/生产服务器信息.xlsx`。
|
||||
## 对象存储状态
|
||||
|
||||
## 3. 对象存储状态
|
||||
- 对象存储按三副本方向接回:`MINIO -> QINIU_KODO -> ALIYUN_OSS`。
|
||||
- 开发 MinIO:`http://192.168.5.15:9000`
|
||||
- Console:`http://192.168.5.15:9001`
|
||||
- 开发 bucket:`fingertipdesigner`
|
||||
|
||||
- 对象存储已按三副本方向接回:`MINIO -> QINIU_KODO -> ALIYUN_OSS`。
|
||||
- 开发 MinIO:`http://192.168.5.15:9000`,Console:`http://192.168.5.15:9001`。
|
||||
- 开发 bucket:`fingertipdesigner`。
|
||||
- 已完成开发环境冒烟:上传优先落 MinIO,签名 URL 返回 MinIO 地址,临时数据库记录已清理。
|
||||
- 新增迁移 SQL:`scripts/sql/migrations/接回MinIO三副本对象存储_20260624.sql`。
|
||||
- 新增配置说明:`scripts/接回MinIO三副本对象存储配置说明_20260624.md`。
|
||||
## Nacos 与配置状态
|
||||
|
||||
## 4. Nacos 与配置状态
|
||||
|
||||
- 开发 Nacos 地址:`192.168.5.103:8848`。
|
||||
- 开发 namespace:`FingertipDesigner-Dev`。
|
||||
- 生产 namespace:`FingertipDesigner`。
|
||||
- 开发 Nacos 地址:`192.168.5.103:8848`
|
||||
- 开发 namespace:`FingertipDesigner-Dev`
|
||||
- 生产 namespace:`FingertipDesigner`
|
||||
- 本地 `application.yaml` / `bootstrap.yaml` 只保留连接 Nacos 的必要默认值和占位。
|
||||
- MySQL、Redis、RabbitMQ、JWT、微信、MinIO、七牛、阿里云等敏感配置应放在 Nacos,不写入仓库。
|
||||
- 开发环境旧的非 Dev 命名空间用法已清理。
|
||||
|
||||
## 5. 关键子系统
|
||||
## 关键子系统
|
||||
|
||||
- `FD-Core`:Spring Boot Core 后端,提供业务接口、文件上传、对象存储编排、数据库访问。
|
||||
- `FD-Core`:Spring Boot Core 后端,提供业务接口、文件上传、对象存储编排和数据库访问。
|
||||
- `FD-Gateway`:统一 API 入口,负责路由、白名单、Token 初筛和转发。
|
||||
- `FD-Frontend`:Vue Web 用户端和后台管理端。
|
||||
- `FD-WeChat-Fronted`:普通用户微信小程序。
|
||||
- `FM-Wechat-Fronted`:指尖管理师小程序。
|
||||
- `scripts`:部署、配置说明、初始化 SQL 和迁移 SQL。
|
||||
- `scripts`:部署脚本、配置说明和唯一初始化 SQL。
|
||||
- `docx`:项目说明、设计、交接和测试资料。
|
||||
|
||||
## 6. 最近验证
|
||||
## 最近验证
|
||||
|
||||
- MinIO 连通性验证通过:`192.168.5.15:9000/minio/health/live` 返回 200。
|
||||
- 开发 bucket `fingertipdesigner` 已创建。
|
||||
- Core/Gateway 开发环境冒烟中完成过文件上传和签名 URL 下载验证。
|
||||
- 提交前执行过 GitNexus `detect_changes(scope="all")`。
|
||||
- 本次文档更新未重新执行 Maven、前端构建或小程序自动化。
|
||||
|
||||
## 7. 下一步建议
|
||||
|
||||
- 若继续部署:先拉取 Nacos `FingertipDesigner-Dev` / `FingertipDesigner` 的 `core.yaml`、`gateway.yaml`、`infra.yaml`、`secret.yaml`、`logging.yaml` 做环境差异核对。
|
||||
- 若继续对象存储:优先补充三家 Provider 的失败重试、后台补副本和签名 URL 选择链路测试。
|
||||
- 若准备提交本文档更新:提交前再次执行 GitNexus `detect_changes(scope="all")`。
|
||||
- manager 边界目标测试和 Gateway 路由测试已通过。
|
||||
- GitNexus MCP 当前可能返回 `Transport closed`,提交前需再次尝试 `detect_changes(scope="all")`,失败时记录原因并以 `git diff` 和测试结果兜底。
|
||||
|
||||
@@ -1,88 +1,33 @@
|
||||
# FingertipDesigner Handoff Boot
|
||||
# Handoff Boot
|
||||
|
||||
更新时间:2026-06-24
|
||||
用途:新一轮接手时先读本文件,再读 `CURRENT-STATE.md` 和 `PROJECT-MAP.md`。
|
||||
|
||||
用途:新会话先读 `AGENTS.md` 和本文件,即可建立最小项目上下文。更详细的当前状态见 `CURRENT-STATE.md`。
|
||||
## 开工顺序
|
||||
|
||||
## 1. 项目一句话
|
||||
1. 运行 `rtk git status --short`,确认当前工作区改动。
|
||||
2. 阅读 `docx/handoff/CURRENT-STATE.md`。
|
||||
3. 阅读 `docx/handoff/PROJECT-MAP.md`。
|
||||
4. 涉及 SQL 时,先阅读 `docx/design/上线初始化SQL基线说明_20260624.md`。
|
||||
5. 修改代码前按 GitNexus 规则做 impact;提交前做 `detect_changes(scope="all")`。如 MCP 返回 `Transport closed`,记录原因并用 `git diff` 和测试结果兜底。
|
||||
|
||||
`D:\code\FingertipDesigner` 是 FingertipDesigner 美甲业务系统主仓库,包含 Web 前后台、用户微信小程序、指尖管理师小程序、Spring Cloud Gateway、Spring Boot Core、SQL 初始化、迁移脚本和项目文档。
|
||||
## 当前 SQL 规则
|
||||
|
||||
主链路:
|
||||
- 唯一初始化 SQL:`scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 开发、测试、上线空库初始化只执行该文件。
|
||||
- `scripts/sql/migrations` 当前不保留历史迁移 SQL。
|
||||
- 后续新增表、字段、索引或运行必需种子数据时,必须同步更新初始化 SQL。
|
||||
- 生产已部署库升级不直接复用初始化 SQL;如需升级已有库,必须单独制定迁移方案并经人工确认。
|
||||
|
||||
```text
|
||||
FD-Frontend / FD-WeChat-Fronted / FM-Wechat-Fronted
|
||||
-> FD-Gateway
|
||||
-> FD-Core
|
||||
-> MySQL / Redis / RabbitMQ / MinIO / Qiniu Kodo / Aliyun OSS / Nacos
|
||||
```
|
||||
|
||||
## 2. 子系统地图
|
||||
|
||||
| 目录 | 职责 | 任务命中时读 |
|
||||
| --- | --- | --- |
|
||||
| `FD-Core` | 核心业务后端,按 `modules.<module>` 业务分包 | `CORE-MODULES.md` |
|
||||
| `FD-Gateway` | 统一 API 入口、路由、白名单、Token 初筛 | `PROJECT-MAP.md` |
|
||||
| `FD-Frontend` | Vue 3 Web 用户端和后台管理端 | `PROJECT-MAP.md` |
|
||||
| `FD-WeChat-Fronted` | 普通用户微信小程序 | `PROJECT-MAP.md` |
|
||||
| `FM-Wechat-Fronted` | 指尖管理师小程序 | `PROJECT-MAP.md` |
|
||||
| `scripts/sql` | 初始化 SQL 和版本变更 SQL | `RISK-REGISTER.md` |
|
||||
| `docx` | 文档、测试案例、交接资料 | 本目录 |
|
||||
|
||||
## 3. 最高优先级规则
|
||||
|
||||
- 修改函数、类、方法前,按 `AGENTS.md` 做 GitNexus upstream impact。
|
||||
- 提交前必须做 GitNexus `detect_changes()`。
|
||||
- 不要回滚未提交改动,先用 `git status --short` 看清楚当前状态。
|
||||
- 手动编辑文件优先用 `apply_patch`。
|
||||
- 搜索优先 `rg` / `rg --files`。
|
||||
- 后端修改如果涉及 SQL,不直接修改初始化 SQL,优先新增 `scripts/sql/migrations/` 下的中文版本变更 SQL。
|
||||
- 生产/开发密钥不写入仓库;凭据走 Nacos 或用户明确提供的本地资料。
|
||||
|
||||
## 4. 当前状态快照
|
||||
|
||||
- 最新提交:`b1117325 统一项目命名并接回MinIO三副本存储`。
|
||||
- 项目命名已统一为 `FingertipDesigner` / `fingertip-designer`。
|
||||
- Core 包名已迁移到 `com.xiaowang.fingertipdesigner.core`。
|
||||
- Gateway 包名已迁移到 `com.xiaowang.fingertipdesigner.gateway`。
|
||||
- 对象存储按 `MINIO -> QINIU_KODO -> ALIYUN_OSS` 三副本优先级接回。
|
||||
- 开发 MinIO 使用 `http://192.168.5.15:9000`,bucket 为 `fingertipdesigner`。
|
||||
- 开发 Nacos 使用 `192.168.5.103:8848`,namespace 为 `FingertipDesigner-Dev`。
|
||||
- 本地服务器信息 Excel 已忽略,不进入 Git。
|
||||
|
||||
## 5. 常用验证命令
|
||||
|
||||
Core:
|
||||
## 常用验证
|
||||
|
||||
```powershell
|
||||
rtk git --no-pager diff --check
|
||||
rtk mvn -f FD-Core/pom.xml test
|
||||
rtk mvn -f FD-Core/pom.xml package -DskipTests
|
||||
```
|
||||
|
||||
Gateway:
|
||||
|
||||
```powershell
|
||||
rtk mvn -f FD-Gateway/pom.xml test
|
||||
rtk mvn -f FD-Gateway/pom.xml package -DskipTests
|
||||
```
|
||||
|
||||
Web:
|
||||
小程序静态语法检查可使用:
|
||||
|
||||
```powershell
|
||||
cd FD-Frontend
|
||||
rtk npm run build
|
||||
rtk node -e "const fs=require('fs');const path=require('path');let n=0;function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const p=path.join(d,e.name);if(e.isDirectory())walk(p);else if(e.isFile()&&p.endsWith('.js')){new Function(fs.readFileSync(p,'utf8'));n++;}}}['FM-Wechat-Fronted/api','FM-Wechat-Fronted/utils','FM-Wechat-Fronted/pages'].forEach(walk);console.log('checked '+n+' js files')"
|
||||
```
|
||||
|
||||
残留旧名扫描:
|
||||
|
||||
```powershell
|
||||
rtk git grep -n -I -i "yuminail\|yumitail\|yumi-" -- FD-Core FD-Gateway FD-Frontend FD-WeChat-Fronted FM-Wechat-Fronted scripts docx
|
||||
```
|
||||
|
||||
## 6. 下一步读取策略
|
||||
|
||||
- 继续部署/配置任务:读 `CURRENT-STATE.md`、`PROJECT-MAP.md`、`RISK-REGISTER.md`。
|
||||
- 继续对象存储任务:读 `CURRENT-STATE.md` 和 `scripts/接回MinIO三副本对象存储配置说明_20260624.md`。
|
||||
- 改后端接口:读 `CORE-MODULES.md` 和 `TASK-PLAYBOOKS.md`。
|
||||
- 改前端或小程序:读 `PROJECT-MAP.md` 和 `TASK-PLAYBOOKS.md`。
|
||||
- 改 SQL:读 `RISK-REGISTER.md`,并优先新增迁移 SQL。
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# Project Map
|
||||
|
||||
用途:按子系统定位入口、边界和常用文件。这里写入口和边界,不替代源码。
|
||||
用途:按子系统定位入口、边界和常用文件。本文只记录当前有效边界,不替代源码。
|
||||
|
||||
## FD-Core
|
||||
|
||||
职责:核心业务后端,Spring Boot 2.7.18、MyBatis-Plus、Redis、RabbitMQ、Nacos 和对象存储编排。
|
||||
职责:核心业务后端,使用 Spring Boot 2.7.18、MyBatis-Plus、Redis、RabbitMQ、Nacos 和对象存储编排。
|
||||
|
||||
关键入口:
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
边界:
|
||||
|
||||
- 新业务优先放入现有 `modules.<module>`。
|
||||
- 外部系统连接器可以使用类封装,普通业务逻辑优先保持简单函数和服务方法。
|
||||
- 后端 SQL 变更优先新增 `scripts/sql/migrations/` 下的中文版本脚本。
|
||||
- Gateway 不承载业务写逻辑。
|
||||
- 数据库空库基线以 `scripts/sql/init/FingertipDesigner.sql` 为准。
|
||||
|
||||
## FD-Gateway
|
||||
|
||||
@@ -31,11 +31,6 @@
|
||||
- `FD-Gateway/src/main/resources/bootstrap.yaml`
|
||||
- Nacos `FingertipDesigner-Dev` / `gateway.yaml`
|
||||
|
||||
边界:
|
||||
|
||||
- 新增公开接口时,同步检查 Gateway 白名单、前端免登录路径和后端 Controller 路径。
|
||||
- Gateway 不承载业务写逻辑。
|
||||
|
||||
## FD-Frontend
|
||||
|
||||
职责:Vue 3 Web 用户端和后台管理端。
|
||||
@@ -46,13 +41,6 @@
|
||||
- `FD-Frontend/src/router`
|
||||
- `FD-Frontend/src/api`
|
||||
- `FD-Frontend/src/views`
|
||||
- `FD-Frontend/src/views/admin`
|
||||
|
||||
边界:
|
||||
|
||||
- 用户可见文案使用中文。
|
||||
- 前后端 token 独立,避免互相清理登录态。
|
||||
- 静态品牌名使用 `FingertipDesigner`。
|
||||
|
||||
## FD-WeChat-Fronted
|
||||
|
||||
@@ -65,11 +53,6 @@
|
||||
- `FD-WeChat-Fronted/api`
|
||||
- `FD-WeChat-Fronted/utils`
|
||||
|
||||
边界:
|
||||
|
||||
- 匿名可浏览公开作品、店铺和详情。
|
||||
- 收藏、加购、下单、评价等动作需要登录。
|
||||
|
||||
## FM-Wechat-Fronted
|
||||
|
||||
职责:指尖管理师小程序,覆盖移动工作台、规划、客户、员工、排班、请假和设置等管理场景。
|
||||
@@ -86,25 +69,22 @@
|
||||
|
||||
- 生产管理端 API 基址走 `https://yunail.art/api/admin`。
|
||||
- 本地开发配置通过 `utils/config.local.js`,该文件不进入 Git。
|
||||
- 页面测试优先使用微信开发者工具自动化。
|
||||
|
||||
## scripts
|
||||
|
||||
职责:部署脚本、配置说明、初始化 SQL 和版本变更 SQL。
|
||||
职责:部署脚本、配置说明和 SQL 基线。
|
||||
|
||||
关键入口:
|
||||
|
||||
- `scripts/sql/init/FingertipDesigner.sql`
|
||||
- `scripts/sql/migrations/统一项目命名为FingertipDesigner_20260623.sql`
|
||||
- `scripts/sql/migrations/接回MinIO三副本对象存储_20260624.sql`
|
||||
- `scripts/deploy-fingertip-designer-production.ps1`
|
||||
- `scripts/package-release.ps1`
|
||||
|
||||
边界:
|
||||
|
||||
- 初始化 SQL 用于新库基线。
|
||||
- 已部署环境使用 `scripts/sql/migrations/` 下的版本变更 SQL。
|
||||
- 配置类变更需要在 `scripts/` 下补充说明文档。
|
||||
- `scripts/sql/init/FingertipDesigner.sql` 是唯一初始化 SQL。
|
||||
- `scripts/sql/migrations` 当前不保留历史迁移 SQL。
|
||||
- 生产已部署库升级不直接复用初始化 SQL,必须单独制定迁移方案。
|
||||
|
||||
## docx
|
||||
|
||||
@@ -114,14 +94,8 @@
|
||||
|
||||
- `docx/README.md`
|
||||
- `docx/core-module-index.md`
|
||||
- `docx/design/上线初始化SQL基线说明_20260624.md`
|
||||
- `docx/handoff/HANDOFF-BOOT.md`
|
||||
- `docx/handoff/CURRENT-STATE.md`
|
||||
- `docx/handoff/PROJECT-MAP.md`
|
||||
- `docx/testing`
|
||||
|
||||
边界:
|
||||
|
||||
- `docx/handoff` 记录当前接手状态。
|
||||
- `docx/design` 记录较稳定的设计资料。
|
||||
- `docx/testing` 记录测试计划、报告和用例矩阵。
|
||||
- 本地敏感服务器信息 Excel 不进入提交。
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Risk Register
|
||||
|
||||
用途:修改高风险区域前读取。
|
||||
用途:修改高风险区域前读取,避免破坏隐藏依赖或环境约束。
|
||||
|
||||
## GitNexus
|
||||
|
||||
@@ -9,61 +9,53 @@
|
||||
检查点:
|
||||
|
||||
- 改 symbol 前运行 GitNexus upstream impact。
|
||||
- 高/关键风险先告知用户。
|
||||
- 高风险或关键流程先告知用户。
|
||||
- 提交前运行 GitNexus detect_changes。
|
||||
- 如 MCP 返回 `Transport closed`,记录原因,并用 `git diff`、测试结果和人工核对兜底。
|
||||
|
||||
## 脏工作区
|
||||
|
||||
风险:仓库经常有未提交改动,回滚会丢用户或前序任务成果。
|
||||
风险:仓库经常有未提交改动,误回滚会丢用户或前序任务成果。
|
||||
|
||||
检查点:
|
||||
|
||||
- 每次开工先 `git status --short`。
|
||||
- 每次开工先 `rtk git status --short`。
|
||||
- 只改当前任务相关文件。
|
||||
- 不使用 `git reset --hard`、`git checkout --` 回滚未授权改动。
|
||||
|
||||
## SQL
|
||||
|
||||
风险:散落 SQL 会导致初始化库、真实库、测试库不一致。
|
||||
风险:分散 SQL 会导致初始化库、真实库、测试库不一致。
|
||||
|
||||
检查点:
|
||||
|
||||
- 结构、补列、索引、权限种子优先更新 `FingertipDesigner-Core/src/main/resources/files/FingertipDesigner.sql`。
|
||||
- 同步关注 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 真实 DDL 优先 MySQL MCP,不能执行就记录阻塞。
|
||||
- 当前唯一初始化 SQL 是 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 开发、测试、上线空库只执行该文件。
|
||||
- 新增表、字段、索引或运行必需种子数据时,必须同步更新该初始化 SQL。
|
||||
- `scripts/sql/migrations` 当前不保留历史迁移 SQL。
|
||||
- 生产已部署库升级不直接复用初始化 SQL,必须单独制定迁移方案。
|
||||
- 真实 DDL 优先用 MySQL 执行验证;不能执行时要记录阻塞原因。
|
||||
|
||||
## MinIO / OSS
|
||||
|
||||
风险:MinIO 是主上传链路;OSS 只是异步备份和展示回退。混淆会导致上传不可控。
|
||||
风险:对象存储主备链路混淆会导致上传不可控。
|
||||
|
||||
检查点:
|
||||
|
||||
- 上传仍优先 MinIO,MinIO 失败则上传失败。
|
||||
- OSS 备份不能阻塞主流程。
|
||||
- OSS 私有桶必须返回签名 URL,不返回裸链接。
|
||||
- 当前 OSS 缺配置,`aliyun.oss.enabled=false`。
|
||||
- 上传优先级是 `MINIO -> QINIU_KODO -> ALIYUN_OSS`。
|
||||
- 阿里云 OSS 是兜底 Provider,不应掩盖前序 Provider 的明确失败。
|
||||
- 私有桶必须返回签名 URL,不返回裸链接。
|
||||
|
||||
## Nacos / RabbitMQ
|
||||
|
||||
风险:dataId 命名历史不一致导致服务启动时读空配置。
|
||||
风险:dataId 命名历史不一致会导致服务启动时读取空配置。
|
||||
|
||||
检查点:
|
||||
|
||||
- Core 使用 `rabbit-mq.yaml`。
|
||||
- Gateway 使用 `rabbitmq.yaml`。
|
||||
- 当前两个 dataId 都已补齐。
|
||||
- Gateway 主配置同时存在 `fingertip-designer-gateway` 和 `fingertip-designer-gateway.yaml`。
|
||||
- Core 主配置同时存在 `fingertip-designer-core` 和 `fingertip-designer-core.yaml`。
|
||||
|
||||
## MySQL Writer
|
||||
|
||||
风险:当前 datasource 临时直连 `mysql02:3306`,不具备主库自动切换能力。
|
||||
|
||||
检查点:
|
||||
|
||||
- 不要误以为这是最终架构。
|
||||
- 长期修复目标是恢复 `mysql-writer:3308` JDBC 可用。
|
||||
- 切回 writer 前验证 `read_only=0`、`super_read_only=0`。
|
||||
- 开发 Nacos 地址:`192.168.5.103:8848`。
|
||||
- 开发 namespace:`FingertipDesigner-Dev`。
|
||||
- 生产 namespace:`FingertipDesigner`。
|
||||
- MySQL、Redis、RabbitMQ、JWT、微信、MinIO、七牛、阿里云等敏感配置放在 Nacos。
|
||||
|
||||
## 店铺授权
|
||||
|
||||
@@ -72,7 +64,7 @@
|
||||
检查点:
|
||||
|
||||
- `t_shop.authorization_expire_time` 为空代表长期有效。
|
||||
- 到期后前台提示冻结,后台可登录但业务功能受限。
|
||||
- 到期后后台可登录但业务功能受限。
|
||||
|
||||
## 身份和权限
|
||||
|
||||
@@ -83,17 +75,14 @@
|
||||
- 店长 `type=2`。
|
||||
- 美甲师 `type=3`。
|
||||
- 平台管理员 `type=4`。
|
||||
- 店长参与制作由 `t_nail_artist_info.participate_production` 控制。
|
||||
- 店铺自定义角色权限按当前 `currentShopId` 生效。
|
||||
|
||||
## 预约和订单
|
||||
|
||||
风险:绕过容量/占用/状态机会造成重复预约、释放失败或并发错乱。
|
||||
风险:绕过容量、占用或状态机会造成重复预约、释放失败或并发错乱。
|
||||
|
||||
检查点:
|
||||
|
||||
- 新建/改派/改时间必须校验营业时间、排班、容量、已有占用。
|
||||
- 新建、改派、改时间必须校验营业时间、排班、容量和已有占用。
|
||||
- 订单状态流转优先使用既有状态机和条件更新。
|
||||
- 取消订单要释放预约占用。
|
||||
- FingertipDesigner 已确认订单应进入指尖管理师规划。
|
||||
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
|
||||
步骤:
|
||||
|
||||
1. `git status --short`,确认脏工作区。
|
||||
1. `rtk git status --short`,确认工作区。
|
||||
2. 用 `rg` 或 GitNexus query 定位模块。
|
||||
3. 修改 symbol 前做 GitNexus upstream impact。
|
||||
4. 按模块局部结构改 controller/service/dto/vo/mapper/entity。
|
||||
5. 跑相关测试或 `rtk mvn -q -DskipTests compile`。
|
||||
6. 涉及提交前跑 GitNexus detect_changes。
|
||||
5. 跑相关测试或 `rtk mvn -f FD-Core/pom.xml -DskipTests compile`。
|
||||
6. 提交前跑 GitNexus detect_changes。
|
||||
|
||||
容易漏:
|
||||
|
||||
@@ -31,114 +31,58 @@
|
||||
先读:
|
||||
|
||||
- `PROJECT-MAP.md`
|
||||
- 相关 `FingertipDesigner-Frontend/src/api` 和 `src/views`。
|
||||
- 相关 `src/api` 和 `src/views`。
|
||||
|
||||
步骤:
|
||||
|
||||
1. 查路由和 API 封装。
|
||||
2. 保持中文文案和现有 UI 风格。
|
||||
3. 修改后跑 `rtk npm run build`。
|
||||
3. 修改后跑对应构建或语法检查。
|
||||
|
||||
容易漏:
|
||||
|
||||
- 前后台 token 独立。
|
||||
- 免登录接口 401 不应触发全局过期跳转。
|
||||
|
||||
## 改微信用户小程序
|
||||
|
||||
先读:
|
||||
|
||||
- `PROJECT-MAP.md`
|
||||
- `WeChatProgram/app.json`
|
||||
- `WeChatProgram/utils/request.js`
|
||||
## 改微信小程序
|
||||
|
||||
步骤:
|
||||
|
||||
1. 查页面路径和 API。
|
||||
2. 保持匿名浏览能力。
|
||||
1. 查 `app.json` 页面路径和 `api` 封装。
|
||||
2. 保持匿名浏览能力和登录态边界。
|
||||
3. JS 改动后跑 node 语法检查。
|
||||
|
||||
容易漏:
|
||||
|
||||
- 弹窗遮罩才使用 `catchtouchmove`。
|
||||
- 小屏需要可滚动。
|
||||
4. 有条件时用微信开发者工具自动化冒烟。
|
||||
|
||||
## 改指尖管理师小程序
|
||||
|
||||
先读:
|
||||
|
||||
- `PROJECT-MAP.md`
|
||||
- `FingertipManager-Program/app.json`
|
||||
|
||||
步骤:
|
||||
|
||||
1. 优先检查规划、客户、员工、我的四个 Tab。
|
||||
2. 月视图必须直接展示各美甲师单量。
|
||||
3. 页面测试用 `wechat-devtools-mcp`。
|
||||
|
||||
容易漏:
|
||||
|
||||
- 不要恢复旧后台营销/库存/权限大表入口。
|
||||
- 固定底部按钮和 TabBar 不要遮挡内容。
|
||||
2. 核对 `FM-Wechat-Fronted/api` 与 Gateway/Core 路径契约。
|
||||
3. 生产请求必须走 `/api/admin/**`。
|
||||
4. JS 改动后跑 node 语法检查。
|
||||
|
||||
## 改 SQL / 初始化数据
|
||||
|
||||
先读:
|
||||
|
||||
- `docx/design/上线初始化SQL基线说明_20260624.md`
|
||||
- `RISK-REGISTER.md`
|
||||
- `CURRENT-STATE.md`
|
||||
|
||||
步骤:
|
||||
|
||||
1. 更新 `FingertipDesigner-Core/src/main/resources/files/FingertipDesigner.sql`。
|
||||
2. 同步 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
3. 用 schema 测试或 MySQL MCP 验证列和索引。
|
||||
1. 更新 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
2. 对比 Java `@TableName` 实体表与 SQL `CREATE TABLE` 清单。
|
||||
3. 检查运行必需种子数据:管理员、权限、授权、协议、系统参数、MessageHub、VIP。
|
||||
4. 用临时库执行 SQL;不能执行时记录阻塞原因。
|
||||
|
||||
容易漏:
|
||||
|
||||
- 真实库已可能手工补过列,不能只看本地 SQL。
|
||||
- 新字段只改代码没改初始化 SQL。
|
||||
- 种子权限新增后没有授权给 `xiaowang`。
|
||||
- 生产已部署库不能直接执行初始化 SQL。
|
||||
|
||||
## 改 Nacos / 生产服务
|
||||
|
||||
先读:
|
||||
|
||||
- `CURRENT-STATE.md`
|
||||
- `RISK-REGISTER.md`
|
||||
|
||||
步骤:
|
||||
|
||||
1. 只读检查命名空间、dataId、实例。
|
||||
2. 写配置前备份原配置。
|
||||
3. 不写明文密钥到仓库。
|
||||
4. 发布后检查服务日志和 Nacos 实例健康。
|
||||
|
||||
容易漏:
|
||||
|
||||
- Core/Gateway 读不同 RabbitMQ dataId。
|
||||
- `mysql02:3306` 是临时直连,不是最终 HA writer。
|
||||
|
||||
## 做真实上传 / 预约 / 订单联调
|
||||
|
||||
先读:
|
||||
|
||||
- `CURRENT-STATE.md`
|
||||
- `CORE-MODULES.md`
|
||||
|
||||
上传联调:
|
||||
|
||||
1. 确认 MinIO 可用。
|
||||
2. 上传后检查文件表 MinIO 状态。
|
||||
3. OSS 配好后检查 MQ 备份状态和 OSS 签名 URL。
|
||||
4. MinIO 故障回退只验证已备份成功文件。
|
||||
|
||||
预约/订单联调:
|
||||
|
||||
1. 准备店铺、作品、美甲师、排班。
|
||||
2. 用户下单/店长确认后检查预约占用。
|
||||
3. 指尖管理师新建/改派/取消检查冲突和释放。
|
||||
|
||||
容易漏:
|
||||
|
||||
- OSS 未配置时不要期望备份成功。
|
||||
- 预约必须校验营业时间、排班、容量、已有占用。
|
||||
|
||||
|
||||
@@ -1,105 +1,53 @@
|
||||
# 指尖管理师上线检查清单(2026-06-22)
|
||||
# 指尖管理师上线检查清单(2026-06-24 更新)
|
||||
|
||||
## 总体结论
|
||||
|
||||
- [ ] 当前可上线
|
||||
- [x] 当前阻断上线
|
||||
- [x] 当前仍需完成部署前验证
|
||||
- [ ] 高风险修复后可灰度
|
||||
- [ ] 中低风险可带风险上线
|
||||
|
||||
## 初始化 SQL
|
||||
|
||||
- [x] 已确认初始化脚本入口:`scripts/sql/init/FingertipDesigner.sql`
|
||||
- [x] 已确认当前 MySQL 业务库 `fingertipdesigner` 有 54 张表
|
||||
- [x] 已确认当前库 0 张表缺少主键
|
||||
- [x] 已确认当前库有 323 个索引
|
||||
- [x] 已确认当前库关键种子数据存在:权限、管理员/用户、系统参数、协议、MessageHub 配置
|
||||
- [x] 已静态比对 SQL 表与 Java `@TableName` 实体,主体覆盖一致
|
||||
- [x] 唯一初始化脚本入口:`scripts/sql/init/FingertipDesigner.sql`
|
||||
- [x] 已明确开发、测试、上线空库只执行该 SQL
|
||||
- [x] 已删除旧迁移 SQL,历史变更已合并进初始化基线
|
||||
- [x] 已保留一名平台管理员 `xiaowang`
|
||||
- [x] 已保留完整权限字典和管理员全量授权
|
||||
- [x] 已保留协议、系统参数、MessageHub、VIP 基础配置
|
||||
- [x] 已合并 `t_object_storage_file_replica`
|
||||
- [x] 已合并 `t_product.front_visible`
|
||||
- [x] 已合并 `t_product.source_type`
|
||||
- [x] 已确认 `t_messagehub_push_config.source_system` 使用 `fingertipdesigner`
|
||||
- [ ] 需在可直连 MySQL 的环境创建临时库并全量执行 `FingertipDesigner.sql`
|
||||
- [ ] 需记录 fresh install 执行耗时、warning、失败语句和最终表结构
|
||||
- [ ] 需统一 SQL 库名 `fingertipdesigner` 与后端默认 datasource `FingertipDesigner`
|
||||
- [ ] 需确认生产 MySQL `lower_case_table_names` 与库名大小写策略
|
||||
- [ ] 需统一表排序规则,至少处理 4 张 `utf8mb4_general_ci` 表
|
||||
- [ ] 需确认初始化 SQL 只用于空库,不直接对已有库重复执行
|
||||
- [ ] 需恢复或新增版本变更 SQL,不能只依赖初始化 SQL 升级已有环境
|
||||
|
||||
## 后端 FD-Core
|
||||
|
||||
- [x] `mvn test` 通过,131 个测试无失败
|
||||
- [x] `mvn package -DskipTests` 通过
|
||||
- [x] 已生成 `docx/product/FingertipDesigner-Core.jar`
|
||||
- [x] 已确认预约规划核心 DTO/VO 与前端主要字段基本一致
|
||||
- [x] 已确认 `AdminPlanningController` 提供日历、创建预约、详情、改时间/技师、改状态接口
|
||||
- [x] 已确认 `AdminShopController` 提供列表、创建、更新、删除、状态、详情接口
|
||||
- [ ] 需补齐或下线 `/admin/shops/current`
|
||||
- [ ] 需补齐或下线 `/admin/export`
|
||||
- [ ] 需补齐或下线 `/admin/user/detail/{id}`
|
||||
- [ ] 需用生产配置启动 Core 并验证 MySQL、Redis、RabbitMQ、对象存储连接
|
||||
- [ ] 需确认对象存储 `QINIU_KODO_*` 环境变量全部配置
|
||||
- [ ] 需确认 Nacos 生产命名空间、分组、账号密码由部署环境显式注入
|
||||
- [x] manager 边界目标测试通过:`AdminManagerControllerTest`
|
||||
- [ ] 需跑全量 `rtk mvn -f FD-Core/pom.xml test`
|
||||
- [ ] 需确认全量测试失败是否与本轮 SQL/manager 改动相关
|
||||
- [ ] 需用生产或预发配置启动 Core 并验证 MySQL、Redis、RabbitMQ、对象存储连接
|
||||
|
||||
## 后端 FD-Gateway
|
||||
|
||||
- [x] `mvn test` 通过,4 个测试无失败
|
||||
- [x] `mvn package -DskipTests` 通过
|
||||
- [x] 已生成 `docx/product/FingertipDesigner-Gateway.jar`
|
||||
- [x] 已确认 Gateway 当前支持 `/api/admin/**`、`/admin/api/**`、`/admin/auth/**`
|
||||
- [ ] 需修复小程序 `/admin/**` 后台接口无法经 Gateway 路由的问题
|
||||
- [ ] 需确认 `/admin/auth/register` 或 `/api/admin/auth/register` 是否应加入白名单
|
||||
- [ ] 需用生产 Nacos 服务发现启动 Gateway 并验证能路由到 Core
|
||||
- [ ] 需验证 401、token 过期、登出、切店等鉴权链路
|
||||
- [x] manager 路由测试通过:`AuthGlobalFilterWhitelistTest`
|
||||
- [ ] 需跑全量 `rtk mvn -f FD-Gateway/pom.xml test`
|
||||
- [ ] 需启动 Gateway 验证 `/api/admin/manager/**` 可正确转发到 Core
|
||||
|
||||
## 指尖管理师小程序
|
||||
|
||||
- [x] 已确认 `FM-Wechat-Fronted/app.json` 注册 19 个页面
|
||||
- [x] 已执行 31 个 JS 文件 `node --check`,无语法错误
|
||||
- [ ] 需将 `utils/config.js` 的 `http://127.0.0.1:80` 改为生产 HTTPS 域名配置
|
||||
- [ ] 需恢复微信小程序域名校验,不能以 `urlCheck: false` 作为发布状态
|
||||
- [ ] 需统一后台 API 前缀为 Gateway 可识别路径
|
||||
- [ ] 需移除 `pages/planning/index.js` 的日历 mock 兜底
|
||||
- [ ] 需移除 `pages/appointment-form/index.js` 的商品和排班 mock/fallback 兜底
|
||||
- [ ] 需移除 `pages/appointment-detail/index.js` 的 mock 详情兜底
|
||||
- [ ] 需移除 `pages/customers/index.js` 的 fallback 客户数据
|
||||
- [ ] 需移除 `pages/employees/index.js` 和 `pages/employee-detail/index.js` 的 mock 员工数据
|
||||
- [ ] 需将 `pages/shop-settings/index.js` 接入真实门店设置接口,或下线入口
|
||||
- [ ] 需将 `pages/export/index.js` 接入真实导出接口,或下线入口
|
||||
- [ ] 需将 `pages/customer-detail/index.js` 接入真实客户详情/订单数据,或下线入口
|
||||
- [ ] 需补充接口失败态、空状态、重试入口和表单校验
|
||||
- [x] 核心 API 已迁移到 `/manager/**` 方向
|
||||
- [x] JS 静态语法检查通过
|
||||
- [ ] 需用微信开发者工具跑登录、规划、客户、员工、排班、店铺设置冒烟
|
||||
- [ ] 需确认 `project.config.json` appid 改动是否属于当前发布配置
|
||||
|
||||
## 小程序自动化与冒烟
|
||||
## 上线门槛
|
||||
|
||||
- [x] 已确认微信开发者工具 automator 端口可连接
|
||||
- [ ] 当前 automator 会话页面为 `pages/auth/index`,与本项目 `app.json` 不一致,需清理会话后重跑
|
||||
- [ ] 需验证 `pages/login/index` 可打开
|
||||
- [ ] 需验证登录态跳转和 401 清理逻辑
|
||||
- [ ] 需验证注册、验证码、协议勾选
|
||||
- [ ] 需验证规划日历按日/周/月加载真实接口
|
||||
- [ ] 需验证创建预约、冲突提示、详情跳转
|
||||
- [ ] 需验证客户列表、客户详情、创建预约入口
|
||||
- [ ] 需验证员工列表、员工详情、排班设置
|
||||
- [ ] 需验证请假、颜色设置、员工订单、密码修改
|
||||
- [ ] 需验证门店设置和数据导出,或确认本次不上线
|
||||
|
||||
## 部署环境
|
||||
|
||||
- [ ] 生产 MySQL 地址、库名、账号、权限已确认
|
||||
- [ ] 生产 Redis 地址、密码、DB、TTL 策略已确认
|
||||
- [ ] 生产 RabbitMQ 地址、账号、交换机/队列策略已确认
|
||||
- [ ] 生产 Nacos 地址、namespace、group、dataId 已确认
|
||||
- [ ] 生产对象存储 bucket、域名、私有桶签名策略已确认
|
||||
- [ ] Core/Gateway 端口、健康检查、日志目录、日志级别已确认
|
||||
- [ ] JVM 版本与 `java.version=17` 兼容
|
||||
- [ ] 小程序 request 合法域名已配置到微信公众平台
|
||||
- [ ] 后端接口已通过 HTTPS 域名访问验证
|
||||
|
||||
## 上线门禁
|
||||
|
||||
- [ ] 所有阻断项关闭
|
||||
- [ ] 所有高风险项关闭或有负责人签字接受
|
||||
- [ ] 临时库初始化脚本执行成功
|
||||
- [ ] Core/Gateway 生产配置启动成功
|
||||
- [ ] 小程序真实接口冒烟成功
|
||||
- [ ] 回滚方案已确认
|
||||
- [ ] 数据库备份方案已确认
|
||||
- [ ] 监控告警已确认
|
||||
- [ ] 发布窗口和负责人已确认
|
||||
- [ ] 初始化 SQL 临时库执行成功
|
||||
- [ ] Core/Gateway 全量测试完成
|
||||
- [ ] 小程序核心链路冒烟完成
|
||||
- [ ] Nacos、MySQL、Redis、RabbitMQ、对象存储生产配置核对完成
|
||||
- [ ] GitNexus `detect_changes(scope="all")` 完成;若 MCP 不可用,需记录原因
|
||||
- [ ] 回滚方案和数据库备份方案确认
|
||||
|
||||
@@ -13,6 +13,14 @@
|
||||
- 指尖管理师小程序:`FM-Wechat-Fronted`
|
||||
- GitNexus:索引时间为 2026-06-16,仅用于辅助导航;结论以当前文件系统源码和本轮命令输出为准。
|
||||
|
||||
## 2026-06-24 SQL 基线修订
|
||||
|
||||
- `scripts/sql/init/FingertipDesigner.sql` 已调整为唯一初始化 SQL,开发、测试、上线空库初始化均以该文件为准。
|
||||
- 旧项目命名、MinIO 三副本对象存储、预约手动项目展示控制等历史变更已合并进初始化基线。
|
||||
- `scripts/sql/migrations` 当前不再保留历史迁移 SQL;本轮开发环境测试不再要求额外执行迁移脚本。
|
||||
- 已部署生产库不能直接执行初始化 SQL;如果需要升级已有库,必须单独制定迁移方案并人工确认。
|
||||
- 原报告中的增量脚本补齐建议已被本次基线策略取代。
|
||||
|
||||
## 执行摘要
|
||||
|
||||
| 类别 | 结论 | 证据 |
|
||||
@@ -282,7 +290,7 @@
|
||||
3. 移除生产 mock/static 兜底,改为真实错误态。
|
||||
4. 补齐或下线门店设置、导出、客户详情等未接入功能。
|
||||
5. 在可直连 MySQL 的环境全量执行 `FingertipDesigner.sql` 到临时库,并记录 warning。
|
||||
6. 补齐版本迁移 SQL,避免只修改初始化脚本。
|
||||
6. 验证唯一初始化 SQL 已包含全部上线所需表、字段、索引和运行必需种子数据。
|
||||
7. 用干净的微信开发者工具会话重新打开 `FM-Wechat-Fronted` 并跑核心页面冒烟。
|
||||
8. 以生产 Nacos/Redis/RabbitMQ/MySQL/对象存储配置启动 Core/Gateway 并跑接口冒烟。
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
-- Fingertip Designer 最小运行初始化 SQL
|
||||
-- 说明:
|
||||
-- 1. 首次部署空库时,只需要执行本文件即可完成基础建表、结构补丁、权限种子、基础参数、协议、MessageHub、VIP 规则与管理员初始化。
|
||||
-- 2. 2026-03-20_user_asset_vip_coupon_permission_patch.sql、2026-03-25_user_shop_binding_and_shop_status_patch.sql、
|
||||
-- 2026-03-20_init_admin_permission_template.sql 仍保留用于已有数据库的增量升级,不再作为空库首选入口。
|
||||
-- 3. 当前 Nacos datasource.yaml 必须指向 FingertipDesigner,本文件默认按该库名初始化;Linux MySQL 环境下库名大小写敏感,请先统一 datasource 与下方库名。
|
||||
-- 4. 本文件只初始化一个平台管理员 xiaowang(默认密码 888888),不写入开发/验收用户、门店、作品、标签、订单、消息公告等业务数据。
|
||||
-- FingertipDesigner 唯一初始化 SQL
|
||||
-- 本文件用于开发、测试、上线空库初始化,后续环境基线均以本文件为准。
|
||||
-- 执行范围:建库、建表、索引、约束、平台管理员、基础权限、系统参数、协议、MessageHub 与 VIP 基础配置。
|
||||
-- 种子数据原则:只保留运行必需配置;不写入门店、商品、订单、客户、库存流水、测试消息等业务样例数据。
|
||||
-- 默认平台管理员账号:xiaowang,默认密码沿用当前 bcrypt 值。
|
||||
-- Linux MySQL 环境库名大小写敏感,数据源必须指向 FingertipDesigner。
|
||||
CREATE DATABASE IF NOT EXISTS FingertipDesigner DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
use FingertipDesigner;
|
||||
|
||||
@@ -305,6 +304,30 @@ create index idx_object_storage_file_backup_retry
|
||||
on t_object_storage_file (backup_upload_status, primary_upload_status, status)
|
||||
comment '????????';
|
||||
|
||||
-- auto-generated definition
|
||||
CREATE TABLE IF NOT EXISTS `t_object_storage_file_replica`
|
||||
(
|
||||
`id` bigint unsigned NOT NULL COMMENT '副本ID',
|
||||
`file_id` bigint unsigned NOT NULL COMMENT '文件ID',
|
||||
`provider` varchar(64) NOT NULL COMMENT '对象存储提供方',
|
||||
`object_name` varchar(512) NOT NULL COMMENT '对象Key',
|
||||
`object_url` text NULL COMMENT '对象访问地址',
|
||||
`upload_status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '上传状态:0-待上传,1-成功,2-失败',
|
||||
`retry_count` int unsigned NOT NULL DEFAULT 0 COMMENT '重试次数',
|
||||
`last_error` varchar(500) NULL COMMENT '最近一次错误',
|
||||
`uploaded_at` datetime NULL COMMENT '上传成功时间',
|
||||
`last_retry_time` datetime NULL COMMENT '最近一次重试时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_object_storage_file_replica_file_provider` (`file_id`, `provider`),
|
||||
KEY `idx_object_storage_file_replica_retry` (`upload_status`, `provider`, `file_id`),
|
||||
KEY `idx_object_storage_file_replica_file_status` (`file_id`, `upload_status`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_unicode_ci
|
||||
COMMENT = '对象存储文件副本表';
|
||||
|
||||
-- auto-generated definition
|
||||
create table t_order
|
||||
(
|
||||
@@ -460,6 +483,8 @@ create table t_product
|
||||
approximate_duration varchar(50) default '' null comment '商品对应的服务大约耗时(如“30分钟”)',
|
||||
bookable_artists varchar(200) default '' null comment '可预约的美甲师ID集合,多个ID以逗号分隔',
|
||||
available_coupons text null comment '可用的优惠券ID集合,多个ID以逗号分隔',
|
||||
front_visible tinyint unsigned default 1 not null comment '前台是否展示:0-隐藏,1-展示',
|
||||
source_type varchar(64) default 'BACKEND' not null comment '来源类型:BACKEND-后台维护,MANAGER_APPOINTMENT-管理师端手动预约',
|
||||
create_time datetime default CURRENT_TIMESTAMP not null comment '商品创建时间',
|
||||
update_time datetime default CURRENT_TIMESTAMP not null on update CURRENT_TIMESTAMP comment '商品信息最后更新时间',
|
||||
is_delete tinyint unsigned default 0 null comment '逻辑删除标识:0-未删除,1-已删除'
|
||||
@@ -482,6 +507,10 @@ create index idx_title
|
||||
on t_product (title)
|
||||
comment '商品标题搜索的索引';
|
||||
|
||||
create index idx_t_product_front_visible
|
||||
on t_product (shop_id, front_visible, source_type)
|
||||
comment '按门店、前台展示和来源筛选商品';
|
||||
|
||||
-- auto-generated definition
|
||||
create table t_product_like
|
||||
(
|
||||
@@ -996,29 +1025,6 @@ CALL sp_add_index_if_not_exists('t_balance_change_detail', 'idx_balance_detail_o
|
||||
|
||||
CALL sp_add_column_if_not_exists('t_order', 'shop_id', 'bigint unsigned NULL COMMENT ''所属店铺ID''');
|
||||
CALL sp_add_column_if_not_exists('t_order', 'user_coupon_id', 'bigint unsigned NULL COMMENT ''用户券ID''');
|
||||
CALL sp_add_column_if_not_exists('t_order', 'coupon_source_type', 'varchar(32) NULL COMMENT ''优惠来源类型''');
|
||||
|
||||
UPDATE t_order
|
||||
SET coupon_id = NULL
|
||||
WHERE coupon_id = 0;
|
||||
|
||||
UPDATE t_order o
|
||||
INNER JOIN (
|
||||
SELECT oi.order_id, MIN(p.shop_id) AS resolved_shop_id
|
||||
FROM t_order_item oi
|
||||
INNER JOIN t_product p ON p.id = oi.product_id
|
||||
GROUP BY oi.order_id
|
||||
) detail_shop ON detail_shop.order_id = o.id
|
||||
SET o.shop_id = detail_shop.resolved_shop_id
|
||||
WHERE o.shop_id IS NULL;
|
||||
|
||||
UPDATE t_order
|
||||
SET coupon_source_type = 'USER_COUPON'
|
||||
WHERE coupon_source_type IS NULL
|
||||
AND coupon_id IS NOT NULL;
|
||||
|
||||
CALL sp_add_index_if_not_exists('t_order', 'idx_t_order_shop_id', '(`shop_id`)');
|
||||
CALL sp_add_index_if_not_exists('t_order', 'idx_t_order_coupon_source_type', '(`coupon_source_type`)');
|
||||
|
||||
CALL sp_add_column_if_not_exists('t_order_item', 'appointment_time', 'datetime NULL COMMENT ''预约开始时间''');
|
||||
CALL sp_add_index_if_not_exists('t_order_item', 'idx_t_order_item_artist_appointment_time', '(`artist_id`, `appointment_time`)');
|
||||
@@ -1919,227 +1925,6 @@ WHERE NOT EXISTS (
|
||||
WHERE account = 'xiaowang'
|
||||
);
|
||||
|
||||
INSERT INTO t_user_permission (user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT u.id, p.id, NOW(), NOW(), u.id, u.id, 0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
AND p.permission_code IN (
|
||||
'home:view',
|
||||
'dashboard:view',
|
||||
'user:view',
|
||||
'user:create',
|
||||
'user:edit',
|
||||
'user:disable',
|
||||
'user:unbind',
|
||||
'user:reset_password',
|
||||
'user:delete',
|
||||
'user:balance:view',
|
||||
'user:balance:manage',
|
||||
'user:vip:manage',
|
||||
'product:view',
|
||||
'product:create',
|
||||
'product:edit',
|
||||
'product:delete',
|
||||
'product:category:manage',
|
||||
'shop:view',
|
||||
'shop:create',
|
||||
'shop:edit',
|
||||
'shop:delete',
|
||||
'shop:staff:manage',
|
||||
'permission:view',
|
||||
'permission:create',
|
||||
'permission:edit',
|
||||
'permission:delete',
|
||||
'permission:assign',
|
||||
'tag:view',
|
||||
'tag:create',
|
||||
'tag:edit',
|
||||
'tag:delete',
|
||||
'tag:assign',
|
||||
'coupon:view',
|
||||
'coupon:create',
|
||||
'coupon:edit',
|
||||
'coupon:delete',
|
||||
'coupon:assign',
|
||||
'comment:view',
|
||||
'comment:delete',
|
||||
'order:view',
|
||||
'order:process',
|
||||
'order:artist-change',
|
||||
'order:edit',
|
||||
'order:delete',
|
||||
'nail_artist:view',
|
||||
'nail_artist:edit',
|
||||
'schedule:view',
|
||||
'schedule:edit',
|
||||
'payment:view',
|
||||
'payment:manage',
|
||||
'refund:view',
|
||||
'refund:manage',
|
||||
'after_sale:view',
|
||||
'after_sale:audit',
|
||||
'inventory:view',
|
||||
'inventory:manage',
|
||||
'campaign:view',
|
||||
'campaign:manage',
|
||||
'growth:view',
|
||||
'analytics:view',
|
||||
'performance:view',
|
||||
'message:view',
|
||||
'message:create',
|
||||
'message:delete',
|
||||
'announcement:view',
|
||||
'announcement:create',
|
||||
'announcement:delete'
|
||||
)
|
||||
WHERE u.is_delete = 0
|
||||
AND u.type = 4
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user_permission up
|
||||
WHERE up.user_id = u.id
|
||||
AND up.permission_id = p.id
|
||||
);
|
||||
|
||||
INSERT INTO t_user_permission (user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT u.id, p.id, NOW(), NOW(), u.id, u.id, 0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
AND p.permission_code IN (
|
||||
'home:view',
|
||||
'dashboard:view',
|
||||
'user:view',
|
||||
'user:create',
|
||||
'user:edit',
|
||||
'user:unbind',
|
||||
'user:reset_password',
|
||||
'user:balance:view',
|
||||
'user:balance:manage',
|
||||
'user:vip:manage',
|
||||
'product:view',
|
||||
'product:create',
|
||||
'product:edit',
|
||||
'product:delete',
|
||||
'product:category:manage',
|
||||
'shop:view',
|
||||
'shop:edit',
|
||||
'shop:staff:manage',
|
||||
'permission:view',
|
||||
'permission:assign',
|
||||
'tag:view',
|
||||
'tag:create',
|
||||
'tag:edit',
|
||||
'tag:delete',
|
||||
'tag:assign',
|
||||
'coupon:view',
|
||||
'coupon:create',
|
||||
'coupon:edit',
|
||||
'coupon:delete',
|
||||
'coupon:assign',
|
||||
'comment:view',
|
||||
'comment:delete',
|
||||
'order:view',
|
||||
'order:process',
|
||||
'order:artist-change',
|
||||
'order:edit',
|
||||
'order:delete',
|
||||
'nail_artist:view',
|
||||
'nail_artist:edit',
|
||||
'schedule:view',
|
||||
'schedule:edit',
|
||||
'payment:view',
|
||||
'refund:view',
|
||||
'after_sale:view',
|
||||
'after_sale:audit',
|
||||
'inventory:view',
|
||||
'inventory:manage',
|
||||
'campaign:view',
|
||||
'campaign:manage',
|
||||
'analytics:view',
|
||||
'performance:view',
|
||||
'message:view',
|
||||
'message:create',
|
||||
'announcement:view',
|
||||
'announcement:create'
|
||||
)
|
||||
WHERE u.is_delete = 0
|
||||
AND u.type = 2
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user_permission up
|
||||
WHERE up.user_id = u.id
|
||||
AND up.permission_id = p.id
|
||||
);
|
||||
|
||||
INSERT INTO t_user_permission (user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT u.id, p.id, NOW(), NOW(), u.id, u.id, 0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
AND p.permission_code IN (
|
||||
'home:view',
|
||||
'user:view',
|
||||
'user:balance:view',
|
||||
'product:view',
|
||||
'shop:view',
|
||||
'tag:view',
|
||||
'coupon:view',
|
||||
'comment:view',
|
||||
'order:view',
|
||||
'order:process',
|
||||
'order:artist-change',
|
||||
'schedule:view',
|
||||
'after_sale:view',
|
||||
'performance:view'
|
||||
)
|
||||
WHERE u.is_delete = 0
|
||||
AND u.type = 3
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user_permission up
|
||||
WHERE up.user_id = u.id
|
||||
AND up.permission_id = p.id
|
||||
);
|
||||
|
||||
|
||||
INSERT INTO t_user_permission (id, user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT 910000000009000 + ((u.id % 1000000) * 10) + CASE p.permission_code
|
||||
WHEN 'message:view' THEN 1
|
||||
WHEN 'message:create' THEN 2
|
||||
WHEN 'message:delete' THEN 3
|
||||
WHEN 'announcement:view' THEN 4
|
||||
WHEN 'announcement:create' THEN 5
|
||||
WHEN 'announcement:delete' THEN 6
|
||||
ELSE 0
|
||||
END,
|
||||
u.id,
|
||||
p.id,
|
||||
NOW(),
|
||||
NOW(),
|
||||
u.id,
|
||||
u.id,
|
||||
0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
AND (
|
||||
(u.type = 4 AND p.permission_code IN ('message:view', 'message:create', 'message:delete', 'announcement:view', 'announcement:create', 'announcement:delete'))
|
||||
OR (u.type = 2 AND p.permission_code IN ('message:view', 'message:create', 'announcement:view', 'announcement:create'))
|
||||
)
|
||||
WHERE u.is_delete = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM t_user_permission up
|
||||
WHERE up.user_id = u.id
|
||||
AND up.permission_id = p.id
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
|
||||
-- ========================================
|
||||
-- 雪花 ID 口径收口区:去掉运行时主键表的 AUTO_INCREMENT
|
||||
-- 说明:
|
||||
@@ -2288,8 +2073,6 @@ CREATE TABLE IF NOT EXISTS t_user_invite_code (
|
||||
UNIQUE KEY uk_invite_code (invite_code)
|
||||
) COMMENT='邀请码表';
|
||||
|
||||
-- Indexes are created by the corresponding migration path in environments that need them.
|
||||
-- Existing databases already have these indexes, and MySQL 5.7 does not support CREATE INDEX IF NOT EXISTS.
|
||||
|
||||
INSERT INTO t_permission (id, permission_code, permission_name, permission_group, description, create_time, update_time, is_delete)
|
||||
VALUES
|
||||
@@ -2506,3 +2289,25 @@ ON DUPLICATE KEY UPDATE
|
||||
description = VALUES(description),
|
||||
is_delete = 0,
|
||||
update_time = NOW();
|
||||
|
||||
-- 最终权限兜底:确保平台管理员拥有当前权限目录中的全部基础权限。
|
||||
INSERT INTO t_user_permission (id, user_id, permission_id, create_time, update_time, create_by, update_by, is_delete)
|
||||
SELECT
|
||||
(CAST(u.id AS UNSIGNED) << 20) + (CAST(p.id AS UNSIGNED) & 1048575),
|
||||
u.id,
|
||||
p.id,
|
||||
NOW(),
|
||||
NOW(),
|
||||
0,
|
||||
0,
|
||||
0
|
||||
FROM t_user u
|
||||
INNER JOIN t_permission p
|
||||
ON p.is_delete = 0
|
||||
WHERE u.account = 'xiaowang'
|
||||
AND u.is_delete = 0
|
||||
AND u.type = 4
|
||||
ON DUPLICATE KEY UPDATE
|
||||
is_delete = 0,
|
||||
update_by = VALUES(update_by),
|
||||
update_time = NOW();
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
USE `FingertipDesigner`;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `t_object_storage_file_replica`
|
||||
(
|
||||
`id` bigint unsigned NOT NULL COMMENT '副本ID',
|
||||
`file_id` bigint unsigned NOT NULL COMMENT '文件ID',
|
||||
`provider` varchar(64) NOT NULL COMMENT '对象存储提供方',
|
||||
`object_name` varchar(512) NOT NULL COMMENT '对象Key',
|
||||
`object_url` text NULL COMMENT '对象存储地址',
|
||||
`upload_status` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '上传状态:0待上传,1成功,2失败',
|
||||
`retry_count` int unsigned NOT NULL DEFAULT 0 COMMENT '重试次数',
|
||||
`last_error` varchar(500) NULL COMMENT '最近一次错误',
|
||||
`uploaded_at` datetime NULL COMMENT '上传成功时间',
|
||||
`last_retry_time` datetime NULL COMMENT '最近一次重试时间',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_object_storage_file_replica_file_provider` (`file_id`, `provider`),
|
||||
KEY `idx_object_storage_file_replica_retry` (`upload_status`, `provider`, `file_id`),
|
||||
KEY `idx_object_storage_file_replica_file_status` (`file_id`, `upload_status`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4
|
||||
COLLATE = utf8mb4_unicode_ci
|
||||
COMMENT = '对象存储文件副本表';
|
||||
|
||||
INSERT INTO `t_object_storage_file_replica`
|
||||
(`id`, `file_id`, `provider`, `object_name`, `object_url`, `upload_status`, `retry_count`, `last_error`, `uploaded_at`, `last_retry_time`, `create_time`, `update_time`)
|
||||
SELECT CAST(CONV(SUBSTRING(MD5(CONCAT(CAST(`id` AS CHAR), ':PRIMARY:', COALESCE(NULLIF(`primary_provider`, ''), 'QINIU_KODO'))), 1, 15), 16, 10) AS UNSIGNED),
|
||||
`id`,
|
||||
COALESCE(NULLIF(`primary_provider`, ''), 'QINIU_KODO'),
|
||||
`object_name`,
|
||||
COALESCE(`primary_url`, `file_url`),
|
||||
COALESCE(NULLIF(`primary_upload_status`, 0), 1),
|
||||
0,
|
||||
NULL,
|
||||
CASE WHEN COALESCE(NULLIF(`primary_upload_status`, 0), 1) = 1 THEN COALESCE(`create_time`, NOW()) ELSE NULL END,
|
||||
NULL,
|
||||
COALESCE(`create_time`, NOW()),
|
||||
COALESCE(`update_time`, NOW())
|
||||
FROM `t_object_storage_file`
|
||||
WHERE `object_name` IS NOT NULL
|
||||
AND `object_name` <> ''
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`object_name` = VALUES(`object_name`),
|
||||
`object_url` = VALUES(`object_url`),
|
||||
`upload_status` = VALUES(`upload_status`),
|
||||
`update_time` = NOW();
|
||||
|
||||
INSERT INTO `t_object_storage_file_replica`
|
||||
(`id`, `file_id`, `provider`, `object_name`, `object_url`, `upload_status`, `retry_count`, `last_error`, `uploaded_at`, `last_retry_time`, `create_time`, `update_time`)
|
||||
SELECT CAST(CONV(SUBSTRING(MD5(CONCAT(CAST(`id` AS CHAR), ':BACKUP:', COALESCE(NULLIF(`backup_provider`, ''), 'ALIYUN_OSS'))), 1, 15), 16, 10) AS UNSIGNED),
|
||||
`id`,
|
||||
COALESCE(NULLIF(`backup_provider`, ''), 'ALIYUN_OSS'),
|
||||
`object_name`,
|
||||
`backup_url`,
|
||||
COALESCE(`backup_upload_status`, 0),
|
||||
COALESCE(`backup_retry_count`, 0),
|
||||
`backup_last_error`,
|
||||
`backup_uploaded_at`,
|
||||
`backup_last_retry_time`,
|
||||
COALESCE(`create_time`, NOW()),
|
||||
COALESCE(`update_time`, NOW())
|
||||
FROM `t_object_storage_file`
|
||||
WHERE `object_name` IS NOT NULL
|
||||
AND `object_name` <> ''
|
||||
AND `backup_provider` IS NOT NULL
|
||||
AND `backup_provider` <> ''
|
||||
AND `backup_provider` NOT LIKE '%,%'
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`object_name` = VALUES(`object_name`),
|
||||
`object_url` = VALUES(`object_url`),
|
||||
`upload_status` = VALUES(`upload_status`),
|
||||
`retry_count` = VALUES(`retry_count`),
|
||||
`last_error` = VALUES(`last_error`),
|
||||
`uploaded_at` = VALUES(`uploaded_at`),
|
||||
`last_retry_time` = VALUES(`last_retry_time`),
|
||||
`update_time` = NOW();
|
||||
|
||||
INSERT INTO `t_object_storage_file_replica`
|
||||
(`id`, `file_id`, `provider`, `object_name`, `object_url`, `upload_status`, `retry_count`, `last_error`, `uploaded_at`, `last_retry_time`, `create_time`, `update_time`)
|
||||
SELECT CAST(CONV(SUBSTRING(MD5(CONCAT(CAST(file.`id` AS CHAR), ':REQUIRED:', required_provider.`provider`)), 1, 15), 16, 10) AS UNSIGNED),
|
||||
file.`id`,
|
||||
required_provider.`provider`,
|
||||
file.`object_name`,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
COALESCE(file.`create_time`, NOW()),
|
||||
COALESCE(file.`update_time`, NOW())
|
||||
FROM `t_object_storage_file` file
|
||||
JOIN (
|
||||
SELECT 'MINIO' AS `provider`
|
||||
UNION ALL
|
||||
SELECT 'QINIU_KODO' AS `provider`
|
||||
UNION ALL
|
||||
SELECT 'ALIYUN_OSS' AS `provider`
|
||||
) required_provider
|
||||
WHERE file.`object_name` IS NOT NULL
|
||||
AND file.`object_name` <> ''
|
||||
ON DUPLICATE KEY UPDATE
|
||||
`provider` = VALUES(`provider`);
|
||||
@@ -1,7 +0,0 @@
|
||||
USE `FingertipDesigner`;
|
||||
|
||||
UPDATE `t_messagehub_push_config`
|
||||
SET `source_system` = 'fingertipdesigner',
|
||||
`update_time` = NOW()
|
||||
WHERE `source_system` = CONCAT('yu', 'minail')
|
||||
AND `is_delete` = 0;
|
||||
@@ -1,46 +0,0 @@
|
||||
USE `FingertipDesigner`;
|
||||
|
||||
SET @front_visible_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 't_product'
|
||||
AND COLUMN_NAME = 'front_visible'
|
||||
);
|
||||
|
||||
SET @add_front_visible_sql := IF(
|
||||
@front_visible_exists = 0,
|
||||
'ALTER TABLE `t_product` ADD COLUMN `front_visible` tinyint NOT NULL DEFAULT 1 COMMENT ''前台是否展示:0-隐藏,1-展示'' AFTER `available_coupons`',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE add_front_visible_stmt FROM @add_front_visible_sql;
|
||||
EXECUTE add_front_visible_stmt;
|
||||
DEALLOCATE PREPARE add_front_visible_stmt;
|
||||
|
||||
SET @source_type_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 't_product'
|
||||
AND COLUMN_NAME = 'source_type'
|
||||
);
|
||||
|
||||
SET @add_source_type_sql := IF(
|
||||
@source_type_exists = 0,
|
||||
'ALTER TABLE `t_product` ADD COLUMN `source_type` varchar(64) NOT NULL DEFAULT ''BACKEND'' COMMENT ''来源类型:BACKEND-后台维护,MANAGER_APPOINTMENT-管理师端手动预约'' AFTER `front_visible`',
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE add_source_type_stmt FROM @add_source_type_sql;
|
||||
EXECUTE add_source_type_stmt;
|
||||
DEALLOCATE PREPARE add_source_type_stmt;
|
||||
|
||||
UPDATE `t_product`
|
||||
SET `front_visible` = 1
|
||||
WHERE `front_visible` IS NULL;
|
||||
|
||||
UPDATE `t_product`
|
||||
SET `source_type` = 'BACKEND'
|
||||
WHERE `source_type` IS NULL
|
||||
OR `source_type` = '';
|
||||
@@ -126,9 +126,7 @@ aliyun:
|
||||
|
||||
必须执行版本变更 SQL:
|
||||
|
||||
```text
|
||||
scripts/sql/migrations/接回MinIO三副本对象存储_20260624.sql
|
||||
```
|
||||
MinIO 三副本对象存储所需表结构已经并入 `scripts/sql/init/FingertipDesigner.sql`。开发、测试和上线空库只执行该初始化 SQL。
|
||||
|
||||
该脚本会新增 `t_object_storage_file_replica`,并为历史文件生成 `MINIO`、`QINIU_KODO`、`ALIYUN_OSS` 三类副本记录。已有成功副本不会被覆盖,缺失副本会进入待上传状态,由重试任务补齐。
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
- Nacos 或本地 `spring.datasource.url` 必须指向 `jdbc:mysql://<host>:<port>/FingertipDesigner`。
|
||||
- Core 与 Gateway 默认 Nacos 命名空间为 `FingertipDesigner`,如需连接其他环境必须显式设置 `NACOS_NAMESPACE`。
|
||||
- MySQL 中必须存在 `FingertipDesigner` 数据库;首次部署可执行 `scripts/sql/init/FingertipDesigner.sql`。
|
||||
- 已部署环境可执行 `scripts/sql/migrations/统一数据库名为FingertipDesigner_20260617.sql` 确保目标库存在。
|
||||
- 开发、测试和上线空库只执行 `scripts/sql/init/FingertipDesigner.sql`;已部署生产库如需调整库名,需要单独制定生产迁移方案。
|
||||
|
||||
## 注意事项
|
||||
|
||||
|
||||
Reference in New Issue
Block a user