talent-card-admin/src/layouts/AdminLayout.vue
@@ -105,8 +105,6 @@ ] const operationMenus: MenuItem[] = [ { path: '/benefit-coupons', label: '优惠券管理' }, { path: '/display-services', label: '展示类服务管理' }, { path: '/equity-images', label: '权益图片管理' }, { path: '/talent-news-management', label: '人才资讯管理' }, { path: '/talent-policy-management', label: '人才政策管理' }, talent-card-admin/src/views/MerchantCreateView.vue
@@ -89,9 +89,23 @@ const isSpouseEmploymentMerchant = computed(() => normalizedMerchantType.value === '配偶推荐就业') const isApprovalMerchant = computed(() => normalizedMerchantType.value === '行政审批') const isServiceMerchant = computed(() => isFoodMerchant.value || normalizedMerchantType.value === '景区服务') const merchantAppLoginOptionalTypes = ['数码服务', '文化服务', '电信服务', '口腔治疗保健'] const supportsMerchantAppLogin = computed(() => ( isServiceMerchant.value || isApartmentMerchant.value || isCarWashMerchant.value || isHealthCheckMerchant.value || isParkingMerchant.value || isChildcareMerchant.value || isFinancialMerchant.value || isMovieMerchant.value || isSpouseEmploymentMerchant.value || isApprovalMerchant.value || merchantAppLoginOptionalTypes.includes(normalizedMerchantType.value) )) const requiresMerchantOperator = computed(() => !isEditMode.value && ( normalizedMerchantType.value === '景区服务' || (isFoodMerchant.value && Number(form.canLoginMerchantApp) === 1) || (supportsMerchantAppLogin.value && Number(form.canLoginMerchantApp) === 1) )) function carWashJumpMeta() { if (!isCarWashMerchant.value) return {} @@ -2192,7 +2206,7 @@ <section class="merchant-account-panel"> <h3>账户设置</h3> <el-form ref="accountFormRef" class="merchant-account-form" :model="accountForm" :rules="accountRules" label-width="72px" label-position="left"> <el-form-item v-if="isServiceMerchant || isApartmentMerchant || isCarWashMerchant || isHealthCheckMerchant || isParkingMerchant || isChildcareMerchant || isFinancialMerchant || isMovieMerchant || isSpouseEmploymentMerchant || isApprovalMerchant" label="登录商户端" label-width="100px"> <el-form-item v-if="supportsMerchantAppLogin" label="登录商户端" label-width="100px"> <el-switch v-model="form.canLoginMerchantApp" :active-value="1" :inactive-value="0" /> </el-form-item> <el-form-item label="登录账号" prop="loginAccount" :required="requiresMerchantOperator" :error="accountTaken ? '登录账号已存在,请更换' : ''"> talent-card-server/src/main/java/com/talentcard/server/business/admin/AdminBusinessService.java
@@ -8,6 +8,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; import com.talentcard.server.business.BusinessIdGenerator; import com.alibaba.fastjson.JSON; @@ -24,6 +25,10 @@ @Service public class AdminBusinessService { private static final Set<String> MERCHANT_APP_LOGIN_TYPES = Set.of( "餐饮服务", "景区服务", "数码服务", "文化服务", "电信服务", "口腔治疗保健" ); private final JdbcTemplate jdbcTemplate; @@ -382,10 +387,14 @@ } private boolean hasMerchantAppAccess(MerchantCreateRequest request) { return ("餐饮服务".equals(request.merchantType()) || "景区服务".equals(request.merchantType())) return supportsMerchantAppLogin(request.merchantType()) && (request.canLoginMerchantApp() == null || request.canLoginMerchantApp() == 1); } boolean supportsMerchantAppLogin(String merchantType) { return MERCHANT_APP_LOGIN_TYPES.contains(merchantType); } private void validateScenicMerchantCreate(MerchantCreateRequest request) { if (!"景区服务".equals(request.merchantType())) { return; talent-card-server/src/test/java/com/talentcard/server/business/admin/AdminBusinessServiceTests.java
@@ -1,5 +1,6 @@ package com.talentcard.server.business.admin; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.mock; @@ -24,4 +25,17 @@ .isInstanceOf(BusinessException.class) .hasMessageContaining("请输入商家地址"); } @Test void supportsMerchantAppLoginForConfiguredServiceTypes() { assertThat(service.supportsMerchantAppLogin("数码服务")).isTrue(); assertThat(service.supportsMerchantAppLogin("文化服务")).isTrue(); assertThat(service.supportsMerchantAppLogin("电信服务")).isTrue(); assertThat(service.supportsMerchantAppLogin("口腔治疗保健")).isTrue(); } @Test void doesNotSupportMerchantAppLoginForUnconfiguredServiceTypes() { assertThat(service.supportsMerchantAppLogin("酒店服务")).isFalse(); } }