统一店长参与制作与预约改派规则

This commit is contained in:
2026-07-26 00:05:47 +08:00
parent a35669026c
commit 602943efeb
8 changed files with 77 additions and 12 deletions
@@ -549,7 +549,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
private NailArtistInfoDTO buildManagerFallbackArtistInfo(UserDO user) {
NailArtistInfoDTO dto = buildFallbackArtistInfo(user);
dto.setIdentity("店长");
dto.setParticipateProduction(1);
dto.setParticipateProduction(0);
return dto;
}
@@ -566,7 +566,7 @@ public class NailArtistInfoServiceImpl extends ServiceImpl<NailArtistInfoMapper,
dto.setUserTypeName(resolveUserTypeName(user.getType()));
dto.setIdentity("美甲师");
dto.setStatus(1);
dto.setParticipateProduction(1);
dto.setParticipateProduction(Integer.valueOf(3).equals(user.getType()) ? 1 : 0);
dto.setShopId(user.getShopId());
List<ShopSimpleVO> shopOptions = userShopBindingSupport.listShopOptionsByUserId(user.getId(), true, true);
if (!shopOptions.isEmpty()) {
@@ -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());
@@ -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)
@@ -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);
@@ -21,6 +21,7 @@
<div class="field"><label>员工编号</label><div class="field-value">{{ employee.userId || employee.id }}</div></div>
<div class="field"><label>身份/级别</label><div class="field-value">{{ employee.identity || employee.level || '美甲师' }}</div></div>
<div class="field"><label>状态</label><div class="field-value">{{ employee.status === 0 ? '休息中' : '可预约' }}</div></div>
<div class="field"><label>参与制作美甲</label><div class="field-value">{{ employee.participateProduction === 1 ? '是' : '否' }}</div></div>
<div class="field"><label>登录手机号</label><div class="field-value">{{ employee.phone || '未填写' }}</div></div>
<div class="field"><label>联系电话</label><div class="field-value">{{ employee.contactPhone || '未填写' }}</div></div>
<div class="field"><label>微信号</label><div class="field-value">{{ employee.wechatId || '未填写' }}</div></div>
@@ -123,6 +124,10 @@
<option :value="0">休息中</option>
</select>
</div>
<label class="field checkbox-field">
<span>参与制作美甲</span>
<input v-model="editForm.participateProduction" type="checkbox" />
</label>
<div class="reset-panel">
<div>
@@ -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<EditEmployeeForm>(buildEmptyEditForm())
const originalEditForm = ref<EditEmployeeForm>(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<void> => {
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)
@@ -66,7 +66,8 @@ Page({
monthOrders,
monthAmount,
avgAmount,
currentStatusText: displayText(data.currentStatusText)
currentStatusText: displayText(data.currentStatusText),
participateProductionText: Number(data.participateProduction) === 1 ? '是' : '否'
}
})
} catch (error) {
@@ -68,6 +68,10 @@
<text class="info-label">当前状态</text>
<text class="info-value">{{employee.currentStatusText}}</text>
</view>
<view class="info-row">
<text class="info-label">参与制作美甲</text>
<text class="info-value">{{employee.participateProductionText}}</text>
</view>
</view>
</view>
+8
View File
@@ -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` 通过。