diff --git a/JY-Artist-Frontend/src/views/admin/NailArtistsView.vue b/JY-Artist-Frontend/src/views/admin/NailArtistsView.vue index 5f2a1d9a..7b71f98b 100644 --- a/JY-Artist-Frontend/src/views/admin/NailArtistsView.vue +++ b/JY-Artist-Frontend/src/views/admin/NailArtistsView.vue @@ -466,9 +466,9 @@ const handleClearDraft = (showMessage = true) => { const formRules = { identity: [{ required: true, message: '请输入身份', trigger: 'blur' }], experience: [{ required: true, message: '请输入从业年限', trigger: 'blur' }], - skills: [{ required: true, message: '请选择技能标签', trigger: 'change' }], + skills: [], status: [{ required: true, message: '请选择状态', trigger: 'change' }], - portfolio: [{ required: true, message: '请选择作品作品', trigger: 'change' }] + portfolio: [] } as any /** diff --git a/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImpl.java b/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImpl.java index 1b12614a..589d4c7e 100644 --- a/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImpl.java +++ b/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImpl.java @@ -33,6 +33,7 @@ import com.xiaowang.jayucloud.core.modules.order.mapper.OrderMapper; import com.xiaowang.jayucloud.core.modules.product.mapper.ProductMapper; import com.xiaowang.jayucloud.core.modules.shop.mapper.ShopMapper; import com.xiaowang.jayucloud.core.modules.shop.mapper.ShopScheduleExceptionMapper; +import com.xiaowang.jayucloud.core.modules.shop.support.UserShopBindingSupport; import com.xiaowang.jayucloud.core.modules.user.mapper.UserMapper; import com.xiaowang.jayucloud.core.modules.planning.service.AppointmentCapacityService; import com.xiaowang.jayucloud.core.modules.order.service.OrderService; @@ -105,6 +106,7 @@ public class PlanningServiceImpl implements PlanningService { private final ObjectStorageUrlSupport objectStorageUrlSupport; private final ShopMapper shopMapper; private final ShopScheduleExceptionMapper shopScheduleExceptionMapper; + private final UserShopBindingSupport userShopBindingSupport; private final AppointmentCapacityService appointmentCapacityService; private final OrderService orderService; private final TimeOrderedSnowflakeIdGenerator snowflakeIdGenerator; @@ -168,7 +170,7 @@ public class PlanningServiceImpl implements PlanningService { } Long shopId = requirePlanningShopId(currentUser); requireAppointmentDuration(dto.getDurationMinutes()); - ProductDO product = resolveAppointmentProduct(dto, shopId); + ProductDO product = resolveCreateAppointmentProduct(dto, shopId); UserDO artist = requireActiveArtist(dto.getArtistId(), shopId); UserDO customer = resolveCustomer(shopId, dto); @@ -1084,6 +1086,30 @@ public class PlanningServiceImpl implements PlanningService { return product; } + private ProductDO resolveCreateAppointmentProduct(PlanningAppointmentCreateDTO dto, Long shopId) { + if (dto.getProductId() != null) { + return requireActiveProduct(dto.getProductId(), shopId); + } + requireManualAppointmentProduct(dto); + ProductDO product = new ProductDO(); + product.setShopId(shopId); + product.setTitle(trimToNull(dto.getManualProductTitle())); + product.setDescription(trimToNull(dto.getManualProductDescription())); + product.setPrice(dto.getManualProductPrice()); + product.setTags(trimToNull(dto.getManualProductTags())); + product.setPrecautions(trimToNull(dto.getManualProductPrecautions())); + product.setImageFileIds(trimToNull(dto.getManualProductImageFileIds())); + product.setApproximateDuration(String.valueOf(dto.getDurationMinutes())); + product.setBookableArtists(dto.getArtistId() == null ? null : String.valueOf(dto.getArtistId())); + product.setFrontVisible(0); + product.setSourceType("MANAGER_APPOINTMENT"); + product.setLikeCount(0); + product.setCollectCount(0); + product.setIsDelete(0); + productMapper.insert(product); + return product; + } + private ProductDO resolveAppointmentProduct(PlanningAppointmentCreateDTO dto, Long shopId) { if (dto.getProductId() != null) { return requireActiveProduct(dto.getProductId(), shopId); @@ -1184,12 +1210,13 @@ public class PlanningServiceImpl implements PlanningService { customer.setNickname(firstNonBlank(customerName, phone, "到店客户")); customer.setPhone(phone); customer.setContactPhone(phone); - customer.setAccount("guest" + snowflakeIdGenerator.nextIdString()); + customer.setAccount("tmp" + snowflakeIdGenerator.nextIdString()); customer.setPassword(ENCODED_UNSET_PASSWORD); customer.setType(0); customer.setStatus(1); customer.setIsDelete(0); userMapper.insert(customer); + userShopBindingSupport.ensureUserBoundToShop(customer.getId(), shopId); return customer; } diff --git a/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/user/service/impl/UserServiceImpl.java b/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/user/service/impl/UserServiceImpl.java index e14c9491..e0394053 100644 --- a/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/user/service/impl/UserServiceImpl.java +++ b/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/user/service/impl/UserServiceImpl.java @@ -1927,7 +1927,7 @@ public class UserServiceImpl extends ServiceImpl implements throw new RuntimeException("用户类型错误"); } - if (currentUserType <= targetUserType) { + if (currentUserType < targetUserType) { /** * Run business method `RuntimeException`. * Call guide: pass the named parameters below from the controller or caller; the method validates them and returns the business result. diff --git a/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImplTest.java b/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImplTest.java index cd4b5244..2991d0bb 100644 --- a/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImplTest.java +++ b/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/planning/service/impl/PlanningServiceImplTest.java @@ -29,6 +29,7 @@ import com.xiaowang.jayucloud.core.modules.shop.entity.ShopDO; import com.xiaowang.jayucloud.core.modules.shop.entity.ShopScheduleExceptionDO; import com.xiaowang.jayucloud.core.modules.shop.mapper.ShopMapper; import com.xiaowang.jayucloud.core.modules.shop.mapper.ShopScheduleExceptionMapper; +import com.xiaowang.jayucloud.core.modules.shop.support.UserShopBindingSupport; import com.xiaowang.jayucloud.core.modules.user.entity.UserDO; import com.xiaowang.jayucloud.core.modules.user.mapper.UserMapper; import com.xiaowang.jayucloud.core.support.id.TimeOrderedSnowflakeIdGenerator; @@ -96,6 +97,9 @@ class PlanningServiceImplTest { @Mock private ShopScheduleExceptionMapper shopScheduleExceptionMapper; + @Mock + private UserShopBindingSupport userShopBindingSupport; + @Mock private AppointmentCapacityService appointmentCapacityService; @@ -124,6 +128,7 @@ class PlanningServiceImplTest { objectStorageUrlSupport, shopMapper, shopScheduleExceptionMapper, + userShopBindingSupport, appointmentCapacityService, orderService, snowflakeIdGenerator @@ -131,7 +136,7 @@ class PlanningServiceImplTest { } @Test - void createAppointmentShouldStoreManualProductSnapshotWithoutCreatingProduct() { + void createAppointmentShouldCreateManualProductAndStoreSnapshot() { UserDO manager = user(2, 8L); UserDO artist = user(3, 8L); artist.setId(20L); @@ -160,6 +165,11 @@ class PlanningServiceImplTest { when(userMapper.selectById(30L)).thenReturn(customer); when(shopMapper.selectById(8L)).thenReturn(shop); when(snowflakeIdGenerator.nextIdString()).thenReturn("202606260001"); + when(productMapper.insert(any(ProductDO.class))).thenAnswer(invocation -> { + ProductDO product = invocation.getArgument(0); + product.setId(100L); + return 1; + }); when(orderMapper.insert(any(OrderDO.class))).thenAnswer(invocation -> { OrderDO order = invocation.getArgument(0); order.setId(200L); @@ -203,8 +213,11 @@ class PlanningServiceImplTest { var appointment = planningService.createAppointment(manager, dto); - org.mockito.Mockito.verify(productMapper, org.mockito.Mockito.never()).insert(any(ProductDO.class)); - assertThat(storedItem[0].getProductId()).isNull(); + ArgumentCaptor productCaptor = ArgumentCaptor.forClass(ProductDO.class); + org.mockito.Mockito.verify(productMapper).insert(productCaptor.capture()); + assertThat(productCaptor.getValue().getSourceType()).isEqualTo("MANAGER_APPOINTMENT"); + assertThat(productCaptor.getValue().getFrontVisible()).isZero(); + assertThat(storedItem[0].getProductId()).isEqualTo(productCaptor.getValue().getId()); assertThat(storedItem[0].getAppointmentProductTitle()).isEqualTo("日落贝壳"); assertThat(storedItem[0].getAppointmentProductDescription()).isEqualTo("轻透贝壳款"); assertThat(storedItem[0].getAppointmentProductTags()).isEqualTo("贝壳"); @@ -245,6 +258,11 @@ class PlanningServiceImplTest { when(userMapper.selectById(20L)).thenReturn(artist); when(shopMapper.selectById(8L)).thenReturn(shop); when(snowflakeIdGenerator.nextIdString()).thenReturn("202607200001", "202607200002"); + when(productMapper.insert(any(ProductDO.class))).thenAnswer(invocation -> { + ProductDO product = invocation.getArgument(0); + product.setId(100L); + return 1; + }); when(userMapper.insert(any(UserDO.class))).thenAnswer(invocation -> { UserDO customer = invocation.getArgument(0); customer.setId(30L); @@ -279,9 +297,12 @@ class PlanningServiceImplTest { assertThat(customerCaptor.getValue().getNickname()).isEqualTo("到店王女士"); assertThat(customerCaptor.getValue().getPhone()).isNull(); assertThat(customerCaptor.getValue().getContactPhone()).isNull(); - assertThat(customerCaptor.getValue().getAccount()).isEqualTo("guest202607200001"); - org.mockito.Mockito.verify(productMapper, org.mockito.Mockito.never()).insert(any(ProductDO.class)); - assertThat(storedItem[0].getProductId()).isNull(); + ArgumentCaptor productCaptor = ArgumentCaptor.forClass(ProductDO.class); + org.mockito.Mockito.verify(productMapper).insert(productCaptor.capture()); + assertThat(customerCaptor.getValue().getAccount()).isEqualTo("tmp202607200001"); + assertThat(productCaptor.getValue().getSourceType()).isEqualTo("MANAGER_APPOINTMENT"); + assertThat(storedItem[0].getProductId()).isEqualTo(productCaptor.getValue().getId()); + org.mockito.Mockito.verify(userShopBindingSupport).ensureUserBoundToShop(30L, 8L); assertThat(storedItem[0].getAppointmentProductTitle()).isEqualTo("净色护理"); assertThat(storedItem[0].getDepositPaid()).isTrue(); assertThat(storedItem[0].getNeedRemoval()).isTrue(); diff --git a/JY-Salon-WeChat/api/employees.js b/JY-Salon-WeChat/api/employees.js index 6b58c6f2..9ce8cb6a 100644 --- a/JY-Salon-WeChat/api/employees.js +++ b/JY-Salon-WeChat/api/employees.js @@ -37,6 +37,13 @@ module.exports = { }) }, + resetPassword(userId) { + return request({ + url: `/manager/employees/${userId}/reset-password`, + method: 'POST' + }) + }, + deleteUser(userId) { return request({ url: `/manager/employees/${userId}`, diff --git a/JY-Salon-WeChat/api/system-parameter-config.js b/JY-Salon-WeChat/api/system-parameter-config.js new file mode 100644 index 00000000..99b4ea65 --- /dev/null +++ b/JY-Salon-WeChat/api/system-parameter-config.js @@ -0,0 +1,9 @@ +const request = require('../utils/request') + +module.exports = { + getResetDefaultPassword() { + return request({ + url: '/system-parameter-config/admin/user-default-password/reset' + }) + } +} diff --git a/JY-Salon-WeChat/pages/employee-detail/index.js b/JY-Salon-WeChat/pages/employee-detail/index.js index a136161f..29f2cf41 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.js +++ b/JY-Salon-WeChat/pages/employee-detail/index.js @@ -1,4 +1,5 @@ const employeesApi = require('../../api/employees') +const systemParameterConfigApi = require('../../api/system-parameter-config') const EMPLOYEE_COLORS = ['#7AA9C2', '#8EB99B', '#BDA7D8', '#D7B17D', '#D98D8D'] const EMPTY_FIELD_TEXT = '未填写' @@ -18,7 +19,9 @@ Page({ employee: {}, loadError: '', deleteConfirmVisible: false, - deletingEmployee: false + deletingEmployee: false, + resetConfirmVisible: false, + resettingPassword: false }, onLoad(options) { @@ -84,6 +87,57 @@ Page({ stopTap() { }, + requestResetPassword() { + if (this.data.resettingPassword) { + return + } + this.setData({ resetConfirmVisible: true }) + }, + + closeResetConfirm() { + if (this.data.resettingPassword) { + return + } + this.setData({ resetConfirmVisible: false }) + }, + + async confirmResetPassword() { + if (this.data.resettingPassword || !this.data.id) { + return + } + this.setData({ resettingPassword: true }) + try { + const success = await employeesApi.resetPassword(this.data.id) + if (!success) { + throw new Error('密码重置失败') + } + const result = await systemParameterConfigApi.getResetDefaultPassword() + const password = String(result && result.password || '').trim() + if (!password) { + throw new Error('默认密码为空') + } + this.setData({ resetConfirmVisible: false }) + wx.showModal({ + title: '密码已重置', + content: `系统默认密码:${password}`, + confirmText: '复制密码', + cancelText: '关闭', + success: (modalResult) => { + if (modalResult.confirm) { + wx.setClipboardData({ + data: password, + success: () => wx.showToast({ title: '密码已复制', icon: 'success' }) + }) + } + } + }) + } catch (error) { + wx.showToast({ title: error.message || '密码重置失败', icon: 'none' }) + } finally { + this.setData({ resettingPassword: false }) + } + }, + async confirmDeleteEmployee() { if (this.data.deletingEmployee) { return diff --git a/JY-Salon-WeChat/pages/employee-detail/index.wxml b/JY-Salon-WeChat/pages/employee-detail/index.wxml index b275454e..69e2dc11 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.wxml +++ b/JY-Salon-WeChat/pages/employee-detail/index.wxml @@ -76,6 +76,14 @@ + + + 重置登录密码 + 重置后使用系统默认密码登录,建议员工首次登录后修改。 + + + + ! @@ -121,4 +129,16 @@ + + + + ! + 确认重置密码 + 重置后当前员工需要使用系统默认密码登录。 + + + + + + diff --git a/JY-Salon-WeChat/pages/employee-detail/index.wxss b/JY-Salon-WeChat/pages/employee-detail/index.wxss index 1c4106e6..9100309b 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.wxss +++ b/JY-Salon-WeChat/pages/employee-detail/index.wxss @@ -135,6 +135,54 @@ font-weight: 800; } +.reset-card { + display: flex; + align-items: center; + justify-content: space-between; + gap: 20rpx; + margin-top: 24rpx; + padding: 28rpx; +} + +.reset-copy { + flex: 1; + min-width: 0; +} + +.reset-title, +.reset-desc { + display: block; +} + +.reset-title { + color: #302c27; + font-size: 28rpx; + font-weight: 800; +} + +.reset-desc { + margin-top: 10rpx; + color: #7b6f66; + font-size: 22rpx; + line-height: 1.5; +} + +.reset-btn { + flex: 0 0 auto; + min-width: 180rpx; + margin: 0; + border: 1rpx solid #b9d9c2; + border-radius: 14rpx; + background: #eef8f0; + color: #3f7950; + font-size: 24rpx; + font-weight: 800; +} + +.reset-btn::after { + border: 0; +} + .delete-card { margin-top: 24rpx; padding: 28rpx; diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index 3328ba37..cb00a447 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -529,3 +529,9 @@ - 店铺标签管理补齐展示名、场景分组、排序、前台可见和三种自定义 HEX 颜色,并保留快捷色卡。 - 预约手工作品标签改为横向滑动并隐藏滚动条,输入区和底部操作区补齐宽度约束。 - 小程序启用组件按需注入,关闭本地自动热重载,并压缩主包图标资源。 +## 2026-07-24 预约客户与员工管理修复 + +- 变更原因:预约新增的临时客户缺少统一账号前缀和当前店铺绑定,手工预约作品没有关联 `product_id`,店长密码重置等级判断错误,后台表单存在不必要的必填校验,店务小程序缺少员工重置密码入口。 +- 处理方式:临时客户账号改为 `tmp` 前缀并绑定预约门店;手工预约创建隐藏的 `MANAGER_APPOINTMENT` 商品并写入订单项;允许店长重置美甲师密码;取消手机号、作品和技能的必填规则;小程序复用现有重置接口并读取系统默认密码后展示和复制。 +- 数据库说明:本次不新增 SQL、不修改初始化 SQL、不迁移历史 `guest` 客户或历史空 `product_id` 记录。 +- 验证方式:执行 `JY-Core` 受影响测试和编译,执行设计师前端构建/静态检查,检查店务小程序 JS、JSON、WXML、WXSS 语法及 `git diff --check`。 diff --git a/memory/bugs.md b/memory/bugs.md index c55a603a..a65db267 100644 --- a/memory/bugs.md +++ b/memory/bugs.md @@ -594,3 +594,12 @@ - 处理方式:直接上传入口统一使用 `try-with-resources` 管理输入流;开发 Nacos `JayuCloud-Dev / DEFAULT_GROUP / middleware.yaml` 的 `object-storage.qiniu.kodo.zone` 改为 `z2`,不在代码中硬编码区域。 - 以后避免:检索所有 `MultipartFile.getInputStream()` 的调用方,确认资源责任明确;对象存储区域错误先对照桶实际区域和当前环境 Nacos 配置,不要只修改 SDK 映射。 - 验证方式:`JY-Core` 编译通过;Nacos 配置回读为 `z2`;上传后观察 Tomcat multipart 清理日志和七牛异步副本日志。 +## 2026-07-24 GitNexus 全局依赖与 Node 版本不兼容 + +问题:在仓库执行 `.gitnexus/run.cjs` 时,即使切换到 Node 22/24,仍因全局 GitNexus 依赖的 `pino` 调用 `diagnostics_channel.tracingChannel` 失败,无法执行 `impact` 或 `detect_changes`。 + +原因:当前 PATH 指向的全局 GitNexus 安装及其依赖组合不兼容,问题不再只是微信开发者工具 Node 16 抢占 PATH。 + +处理方式:本次改动改用静态调用链核对并记录检测缺口;未修改全局依赖或仓库索引。 + +预防方式:后续先验证 `node -v`、全局 GitNexus 依赖加载和 `.gitnexus/run.cjs --help`,失败时优先使用仓库配置的 GitNexus MCP 或修复隔离的项目依赖,不要直接修改业务代码规避工具错误。