feat:登陆页面

This commit is contained in:
zhouz
2026-10-08 14:01:04 +08:00
parent 249ab676bb
commit 43fb2e75fc
9 changed files with 43 additions and 56 deletions

View File

@@ -71,9 +71,9 @@ public class AdminAuthServiceImpl implements AdminAuthService {
private SmsCodeApi smsCodeApi;
/**
* 验证码的开关,默认为 true
* 验证码的开关,默认关闭;需要验证码的环境可通过配置显式开启。
*/
@Value("${nl.captcha.enable:true}")
@Value("${nl.captcha.enable:false}")
@Setter // 为了单测:开启或者关闭验证码
private Boolean captchaEnable;

View File

@@ -56,16 +56,13 @@ public class WmsErpInboundServiceImpl implements ErpInboundService {
@Override
public String outboundFinishedBox(ErpFinishedBoxOutboundReqVO reqVO) {
validateRequest(reqVO);
BsrealStorAttrDO warehouse = resolveWarehouse(reqVO.getStorCode());
IostorInvDO existing = iostorInvMapper.selectByErpSource(reqVO.getBusinessType(), reqVO.getBillNo());
if (existing != null) {
checkSame(reqVO, existing);
checkSame(reqVO, existing, warehouse);
return existing.getBillCode();
}
BsrealStorAttrDO warehouse = bsrealStorAttrMapper.selectByStorCode(reqVO.getStorCode());
if (warehouse == null) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "仓库不存在");
}
loadGroups(reqVO);
loadGroups(reqVO, warehouse);
CommonResult<String> codeResult;
try {
codeResult = codeGenApi.generate(new CodeGenerateReqDTO().setRuleCode("IO_CODE"));
@@ -91,7 +88,7 @@ public class WmsErpInboundServiceImpl implements ErpInboundService {
IostorInvDO concurrent = iostorInvMapper
.selectByErpSource(reqVO.getBusinessType(), reqVO.getBillNo());
if (concurrent == null) throw exception;
checkSame(reqVO, concurrent);
checkSame(reqVO, concurrent, warehouse);
return concurrent.getBillCode();
});
}
@@ -105,7 +102,7 @@ public class WmsErpInboundServiceImpl implements ErpInboundService {
String billCode) {
IostorInvDO existing = iostorInvMapper.selectByErpSource(reqVO.getBusinessType(), reqVO.getBillNo());
if (existing != null) {
checkSame(reqVO, existing);
checkSame(reqVO, existing, warehouse);
return existing.getBillCode();
}
List<String> boxes = reqVO.getItems().stream()
@@ -145,9 +142,10 @@ public class WmsErpInboundServiceImpl implements ErpInboundService {
}
/** 查询并校验所有箱码均存在完整在库组盘记录。 */
private Map<String, List<GroupPlateDO>> loadGroups(ErpFinishedBoxOutboundReqVO reqVO) {
private Map<String, List<GroupPlateDO>> loadGroups(ErpFinishedBoxOutboundReqVO reqVO,
BsrealStorAttrDO warehouse) {
List<String> boxes = reqVO.getItems().stream().map(ErpFinishedBoxOutboundReqVO.Item::getPackageBoxSn).toList();
List<GroupPlateDO> rows = groupPlateMapper.selectStoredListByVehicleCodes(reqVO.getStorCode(), boxes);
List<GroupPlateDO> rows = groupPlateMapper.selectStoredListByVehicleCodes(warehouse.getStorCode(), boxes);
Map<String, List<GroupPlateDO>> groups = groupRowsByBox(rows);
if (groups.size() != boxes.size() || boxes.stream().anyMatch(box -> !groups.containsKey(box))) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "成品木箱或箱内子卷库存不存在");
@@ -162,16 +160,33 @@ public class WmsErpInboundServiceImpl implements ErpInboundService {
}
/** 校验同一ERP业务键的仓库和有序箱码完全一致。 */
private void checkSame(ErpFinishedBoxOutboundReqVO reqVO, IostorInvDO existing) {
private void checkSame(ErpFinishedBoxOutboundReqVO reqVO, IostorInvDO existing,
BsrealStorAttrDO warehouse) {
List<String> requested = reqVO.getItems().stream().map(ErpFinishedBoxOutboundReqVO.Item::getPackageBoxSn)
.sorted().toList();
List<String> saved = iostorinvDtlMapper.selectListByIostorinvId(existing.getIostorinvId()).stream()
.map(IostorinvDtlDO::getSourceLoadPort).distinct().sorted().toList();
if (!Objects.equals(existing.getStorCode(), reqVO.getStorCode()) || !Objects.equals(saved, requested)) {
if (!Objects.equals(existing.getStorId(), warehouse.getStorId()) || !Objects.equals(saved, requested)) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "ERP成品木箱出库单据内容冲突");
}
}
/** ERP 传入的仓库编码通过 ext_id 唯一映射到启用的 WMS 仓库。 */
private BsrealStorAttrDO resolveWarehouse(String erpStorCode) {
List<BsrealStorAttrDO> warehouses = bsrealStorAttrMapper.selectListByExtId(erpStorCode);
if (CollectionUtils.isEmpty(warehouses)) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "仓库编码不存在:" + erpStorCode);
}
if (warehouses.size() != 1) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "仓库编码匹配到多条仓库:" + erpStorCode);
}
BsrealStorAttrDO warehouse = warehouses.get(0);
if (!"1".equals(warehouse.getIsUsed())) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "仓库已停用:" + erpStorCode);
}
return warehouse;
}
/** 校验字符串长度及请求内箱码唯一性。 */
private void validateRequest(ErpFinishedBoxOutboundReqVO reqVO) {
HashSet<String> boxes = new HashSet<>();

View File

@@ -16,7 +16,7 @@
},
"type": "module",
"scripts": {
"build": "pnpm vite build --mode production",
"build": "vite build --mode production",
"build:analyze": "pnpm vite build --mode analyze",
"dev": "pnpm vite --mode development",
"preview": "vite preview",

View File

@@ -15,6 +15,7 @@ const logoDark = computed(() => preferences.logo.sourceDark);
<template>
<AuthPageLayout
:app-name="appName"
:copyright="false"
:logo="logo"
:logo-dark="logoDark"
:page-description="$t('authentication.pageDesc')"

View File

@@ -33,8 +33,12 @@ export const overridesPreferences = defineOverridesPreferences({
fixed: false,
},
copyright: {
companyName: import.meta.env.VITE_APP_TITLE,
companySiteLink: 'https://gitee.com/yudaocode/yudao-ui-admin-vben',
/** 不展示备案号、Copyright 和系统名称等底部版权信息 */
enable: false,
companyName: '',
companySiteLink: '',
icp: '',
icpLink: '',
},
// copyright: appCopyrightPreferences,
});

View File

@@ -17,6 +17,7 @@ const routes: RouteRecordRaw[] = [
path: '/workspace',
component: () => import('#/views/dashboard/workspace/index.vue'),
meta: {
hideInMenu: true,
icon: 'carbon:workspace',
title: $t('page.dashboard.workspace'),
},

View File

@@ -6,14 +6,12 @@ import type { AuthApi } from '#/api/core/auth';
import { computed, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import { AuthenticationLogin, Verification, z } from '@vben/common-ui';
import { isCaptchaEnable, isTenantEnable } from '@vben/hooks';
import { AuthenticationLogin, z } from '@vben/common-ui';
import { isTenantEnable } from '@vben/hooks';
import { $t } from '@vben/locales';
import { useAccessStore } from '@vben/stores';
import {
checkCaptcha,
getCaptcha,
getTenantByWebsite,
getTenantSimpleList,
socialAuthRedirect,
@@ -26,12 +24,8 @@ const { query } = useRoute();
const authStore = useAuthStore();
const accessStore = useAccessStore();
const tenantEnable = isTenantEnable();
const captchaEnable = isCaptchaEnable();
const loginRef = ref();
const verifyRef = ref();
const captchaType = 'blockPuzzle'; // 验证码类型:'blockPuzzle' | 'clickWord'
/** 获取租户列表,并默认选中 */
const tenantList = ref<AuthApi.TenantResult[]>([]); // 租户列表
@@ -69,27 +63,9 @@ async function fetchTenantList() {
/** 处理登录 */
async function handleLogin(values: any) {
// 如果开启验证码,则先验证验证码
if (captchaEnable) {
verifyRef.value.show();
return;
}
// 无验证码,直接登录
await authStore.authLogin('username', values);
}
/** 验证码通过,执行登录 */
async function handleVerifySuccess({ captchaVerification }: any) {
try {
await authStore.authLogin('username', {
...(await loginRef.value.getFormApi().getValues()),
captchaVerification,
});
} catch (error) {
console.error('Error in handleLogin:', error);
}
}
/** 处理第三方登录 */
const redirect = query?.redirect;
async function handleThirdLogin(type: number) {
@@ -178,15 +154,5 @@ const formSchema = computed((): VbenFormSchema[] => {
@submit="handleLogin"
@third-login="handleThirdLogin"
/>
<Verification
ref="verifyRef"
v-if="captchaEnable"
:captcha-type="captchaType"
:check-captcha-api="checkCaptcha"
:get-captcha-api="getCaptcha"
:img-size="{ width: '400px', height: '200px' }"
mode="pop"
@on-success="handleVerifySuccess"
/>
</div>
</template>

View File

@@ -28,7 +28,7 @@
"bootstrap": "pnpm install",
"build": "cross-env NODE_OPTIONS=--max-old-space-size=8192 turbo build",
"build:analyze": "turbo build:analyze",
"build:antdv-next": "pnpm run build --filter=@vben/web-antdv-next",
"build:antdv-next": "cross-env NODE_OPTIONS=--max-old-space-size=8192 turbo build --filter=@vben/web-antdv-next",
"build:docs": "pnpm run build --filter=@vben/docs",
"build:docker": "./scripts/deploy/build-local-docker-image.sh",
"changeset": "pnpm exec changeset",

View File

@@ -1,7 +1,7 @@
{
"welcomeBack": "欢迎回来",
"pageTitle": "开箱即用的大型中后台管理系统",
"pageDesc": "工程化、高性能、跨组件库的前端模版",
"pageTitle": "智能物流,协同高效",
"pageDesc": "让物流作业更简单、更可靠",
"loginSuccess": "登录成功",
"loginSuccessDesc": "欢迎回来",
"loginSubtitle": "请输入您的账户信息以开始管理您的项目",