From 602943efeb3daac20ef1e47960dda35d823619d2 Mon Sep 17 00:00:00 2001 From: xiaowang <2161656029@qq.com> Date: Sun, 26 Jul 2026 00:05:47 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=BA=97=E9=95=BF=E5=8F=82?= =?UTF-8?q?=E4=B8=8E=E5=88=B6=E4=BD=9C=E4=B8=8E=E9=A2=84=E7=BA=A6=E6=94=B9?= =?UTF-8?q?=E6=B4=BE=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/NailArtistInfoServiceImpl.java | 4 +-- .../service/impl/PlanningServiceImpl.java | 14 ++++++++- .../impl/NailArtistInfoServiceImplTest.java | 4 +-- .../service/impl/PlanningServiceImplTest.java | 29 ++++++++++++++++++- .../src/views/EmployeeDetailView.vue | 23 +++++++++++---- .../pages/employee-detail/index.js | 3 +- .../pages/employee-detail/index.wxml | 4 +++ docs/项目变更记录.md | 8 +++++ 8 files changed, 77 insertions(+), 12 deletions(-) diff --git a/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java b/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java index 9538ff9a..95b9a51e 100644 --- a/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java +++ b/JY-Core/src/main/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImpl.java @@ -549,7 +549,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl shopOptions = userShopBindingSupport.listShopOptionsByUserId(user.getId(), true, true); if (!shopOptions.isEmpty()) { 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 84b8cf50..30bbe6e3 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 @@ -659,6 +659,11 @@ public class PlanningServiceImpl implements PlanningService { for (int i = 0; i < artists.size(); i++) { UserDO user = artists.get(i); NailArtistInfoDO info = infoMap.get(user.getId()); + if (Integer.valueOf(2).equals(user.getType()) + && (artistId == null || !Objects.equals(artistId, user.getId())) + && !isParticipatingManager(info)) { + continue; + } ArtistScheduleRuleDO rule = ruleMap.get(user.getId()); PlanningArtistVO vo = new PlanningArtistVO(); vo.setId(user.getId()); @@ -1273,12 +1278,19 @@ public class PlanningServiceImpl implements PlanningService { } UserDO artist = userMapper.selectById(artistId); if (artist == null || Integer.valueOf(1).equals(artist.getIsDelete()) - || !Integer.valueOf(3).equals(artist.getType()) || !shopId.equals(artist.getShopId())) { + || !shopId.equals(artist.getShopId()) + || (!Integer.valueOf(3).equals(artist.getType()) + && !(Integer.valueOf(2).equals(artist.getType()) + && isParticipatingManager(loadArtistInfo(Set.of(artistId)).get(artistId))))) { throw new RuntimeException("美甲师不存在或不属于当前店铺"); } return artist; } + private boolean isParticipatingManager(NailArtistInfoDO info) { + return info != null && Integer.valueOf(1).equals(info.getParticipateProduction()); + } + private UserDO resolveCustomer(Long shopId, PlanningAppointmentCreateDTO dto) { if (dto.getCustomerUserId() != null) { UserDO customer = userMapper.selectById(dto.getCustomerUserId()); diff --git a/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImplTest.java b/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImplTest.java index 36a0edb9..48207c8f 100644 --- a/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImplTest.java +++ b/JY-Core/src/test/java/com/xiaowang/jayucloud/core/modules/artist/service/impl/NailArtistInfoServiceImplTest.java @@ -158,7 +158,7 @@ class NailArtistInfoServiceImplTest { assertThat(dto.getNickname()).isEqualTo("门店店长"); assertThat(dto.getUserType()).isEqualTo(2); assertThat(dto.getIdentity()).isEqualTo("店长"); - assertThat(dto.getParticipateProduction()).isOne(); + assertThat(dto.getParticipateProduction()).isZero(); } @Test @@ -207,7 +207,7 @@ class NailArtistInfoServiceImplTest { .orElseThrow(); assertThat(managerInfo.getUserType()).isEqualTo(2); assertThat(managerInfo.getIdentity()).isEqualTo("店长"); - assertThat(managerInfo.getParticipateProduction()).isOne(); + assertThat(managerInfo.getParticipateProduction()).isZero(); assertThat(managerInfo.getShopName()).isEqualTo("测试门店"); assertThat(result) .extracting(NailArtistInfoDTO::getUserId) 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 9b04b3a2..750fdf0d 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 @@ -6,6 +6,7 @@ import com.xiaowang.jayucloud.core.modules.artist.mapper.ArtistScheduleException import com.xiaowang.jayucloud.core.modules.artist.mapper.NailArtistInfoMapper; import com.xiaowang.jayucloud.core.modules.artist.entity.ArtistScheduleDO; import com.xiaowang.jayucloud.core.modules.artist.entity.ArtistScheduleRuleDO; +import com.xiaowang.jayucloud.core.modules.artist.entity.NailArtistInfoDO; import com.xiaowang.jayucloud.core.modules.file.service.ObjectStorageFileService; import com.xiaowang.jayucloud.core.modules.file.support.ObjectStorageUrlSupport; import com.xiaowang.jayucloud.core.modules.file.vo.ObjectStorageFileVO; @@ -946,7 +947,10 @@ class PlanningServiceImplTest { when(shopMapper.selectById(8L)).thenReturn(shop); when(shopScheduleExceptionMapper.selectList(any())).thenReturn(List.of()); when(userMapper.selectList(any())).thenReturn(List.of(manager)); - when(nailArtistInfoMapper.selectList(any())).thenReturn(List.of()); + NailArtistInfoDO managerInfo = new NailArtistInfoDO(); + managerInfo.setUserId(20L); + managerInfo.setParticipateProduction(1); + when(nailArtistInfoMapper.selectList(any())).thenReturn(List.of(managerInfo)); when(artistScheduleMapper.selectList(any())).thenReturn(List.of()); when(artistScheduleRuleMapper.selectList(any())) .thenReturn(List.of(scheduleRule(20L, "EVERYDAY", "1,2,3,4,5,6,7", LocalTime.of(9, 0), LocalTime.of(18, 0)))); @@ -962,6 +966,29 @@ class PlanningServiceImplTest { assertThat(calendar.getSchedules().get(0).getArtistId()).isEqualTo(20L); } + @Test + void calendarExcludesManagerWithoutProductionParticipation() { + UserDO manager = user(2, 8L); + manager.setId(20L); + LocalDate date = LocalDate.of(2026, 7, 20); + ShopDO shop = new ShopDO(); + shop.setBusinessHours("09:00-18:00"); + + when(adminScopeHelper.resolveShopScope(manager, null)).thenReturn(8L); + when(shopMapper.selectById(8L)).thenReturn(shop); + when(shopScheduleExceptionMapper.selectList(any())).thenReturn(List.of()); + when(userMapper.selectList(any())).thenReturn(List.of(manager)); + when(nailArtistInfoMapper.selectList(any())).thenReturn(List.of()); + when(artistScheduleMapper.selectList(any())).thenReturn(List.of()); + when(artistScheduleRuleMapper.selectList(any())).thenReturn(List.of()); + when(appointmentReservationMapper.selectList(any())).thenReturn(List.of()); + + var calendar = planningService.getCalendar(manager, date, date, null); + + assertThat(calendar.getArtists()).isEmpty(); + assertThat(calendar.getSchedules()).isEmpty(); + } + @Test void calendarUsesRuleWhenDailyScheduleMissing() { UserDO manager = user(2, 8L); diff --git a/JY-Salon-Front/src/views/EmployeeDetailView.vue b/JY-Salon-Front/src/views/EmployeeDetailView.vue index 96b1330c..7ff8763e 100644 --- a/JY-Salon-Front/src/views/EmployeeDetailView.vue +++ b/JY-Salon-Front/src/views/EmployeeDetailView.vue @@ -21,6 +21,7 @@
{{ employee.userId || employee.id }}
{{ employee.identity || employee.level || '美甲师' }}
{{ employee.status === 0 ? '休息中' : '可预约' }}
+
{{ employee.participateProduction === 1 ? '是' : '否' }}
{{ employee.phone || '未填写' }}
{{ employee.contactPhone || '未填写' }}
{{ employee.wechatId || '未填写' }}
@@ -123,6 +124,10 @@ +
@@ -183,6 +188,7 @@ interface EditEmployeeForm { wechatId: string identity: string status: number + participateProduction: boolean } const EDIT_EMPLOYEE_DRAFT_NAME_PREFIX = 'employee-edit' @@ -218,7 +224,8 @@ const buildEmptyEditForm = (): EditEmployeeForm => ({ contactPhone: '', wechatId: '', identity: '', - status: 1 + status: 1, + participateProduction: false }) const editForm = reactive(buildEmptyEditForm()) const originalEditForm = ref(buildEmptyEditForm()) @@ -233,7 +240,8 @@ function buildEditFormFromEmployee(value: Artist): EditEmployeeForm { contactPhone: value.contactPhone || '', wechatId: value.wechatId || '', identity: value.identity || value.level || '', - status: value.status === 0 ? 0 : 1 + status: value.status === 0 ? 0 : 1, + participateProduction: value.participateProduction === 1 } } @@ -245,6 +253,7 @@ function sameEditForm(left: EditEmployeeForm, right: EditEmployeeForm): boolean && left.wechatId === right.wechatId && left.identity === right.identity && left.status === right.status + && left.participateProduction === right.participateProduction } function snapshotEditForm(): EditEmployeeForm { @@ -255,7 +264,8 @@ function snapshotEditForm(): EditEmployeeForm { contactPhone: editForm.contactPhone, wechatId: editForm.wechatId, identity: editForm.identity, - status: editForm.status + status: editForm.status, + participateProduction: editForm.participateProduction } } @@ -267,7 +277,8 @@ function normalizeEditForm(form: EditEmployeeForm): EditEmployeeForm { contactPhone: String(form.contactPhone || ''), wechatId: String(form.wechatId || ''), identity: String(form.identity || ''), - status: Number(form.status) === 0 ? 0 : 1 + status: Number(form.status) === 0 ? 0 : 1, + participateProduction: Boolean(form.participateProduction) } } @@ -280,6 +291,7 @@ function applyEditForm(form: EditEmployeeForm): void { editForm.wechatId = normalizedForm.wechatId editForm.identity = normalizedForm.identity editForm.status = normalizedForm.status + editForm.participateProduction = normalizedForm.participateProduction } function resetEditForm(): void { @@ -414,7 +426,8 @@ const saveEdit = async (): Promise => { contactPhone: editForm.contactPhone.trim(), wechatId: editForm.wechatId.trim(), identity: editForm.identity.trim(), - status: editForm.status + status: editForm.status, + participateProduction: editForm.participateProduction ? 1 : 0 }) toast.success('员工信息已保存') updateEditModalVisible(false) diff --git a/JY-Salon-WeChat/pages/employee-detail/index.js b/JY-Salon-WeChat/pages/employee-detail/index.js index fb724dac..9cb32d4c 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.js +++ b/JY-Salon-WeChat/pages/employee-detail/index.js @@ -66,7 +66,8 @@ Page({ monthOrders, monthAmount, avgAmount, - currentStatusText: displayText(data.currentStatusText) + currentStatusText: displayText(data.currentStatusText), + participateProductionText: Number(data.participateProduction) === 1 ? '是' : '否' } }) } catch (error) { diff --git a/JY-Salon-WeChat/pages/employee-detail/index.wxml b/JY-Salon-WeChat/pages/employee-detail/index.wxml index 0071e760..852700c5 100644 --- a/JY-Salon-WeChat/pages/employee-detail/index.wxml +++ b/JY-Salon-WeChat/pages/employee-detail/index.wxml @@ -68,6 +68,10 @@ 当前状态 {{employee.currentStatusText}} + + 参与制作美甲 + {{employee.participateProductionText}} + diff --git a/docs/项目变更记录.md b/docs/项目变更记录.md index 8ece5b8c..e9208ba8 100644 --- a/docs/项目变更记录.md +++ b/docs/项目变更记录.md @@ -687,3 +687,11 @@ - 公网验证:`https://yunail.art/health/check`、`https://yunail.art/api/shop/list`、`https://salon.yunail.art/health/check` 和 `https://salon.yunail.art/` 均返回 HTTP 200。 - 问题记录:首次关键词日志统计把正常启动日志中的文本重复计数,修正为按 systemd error 优先级复核后确认无真实错误。 - 完成时间:`2026-07-25 23:28:27 +08:00`。 + +## 2026-07-25 店长参与制作与预约改派统一 + +- 变更原因:店长账号虽然状态正常,但未参与制作时不应作为预约改派目标;店务员工详情也需要明确展示店长是否参与美甲制作。 +- 处理方式:统一复用 `t_nail_artist_info.participate_production`;店长无美甲师资料时默认不参与制作,规划候选列表仅展示参与制作的店长,预约改派后端校验允许参与制作的当前店铺店长;店务 Web 和小程序员工详情增加参与制作状态,Web 编辑员工时支持修改该开关。 +- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。 +- 影响范围:影响 `JY-Core` 员工资料兜底、规划候选和预约改派校验,影响 `JY-Salon-Front` 员工详情编辑,以及 `JY-Salon-WeChat` 员工详情展示;设计师端继续使用原有参与制作字段和规则。 +- 验证方式:运行 Core 规划与员工资料相关测试,执行店务 Web 构建和店务小程序 JS 语法检查,并确认 `git diff --check` 通过。