From 6648e74a007254e167c5508de5d25402cd4bb63b Mon Sep 17 00:00:00 2001 From: zhuguifei <zhuguifei@zhuguifeideiMac.local> Date: 星期一, 10 三月 2025 16:39:50 +0800 Subject: [PATCH] 完成保养工单明细 --- eims/ruoyi-admin/src/main/resources/application-dev.yml | 2 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintPlanMapper.java | 22 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintStandController.java | 105 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java | 253 ++ eims-ui/apps/web-antd/src/api/eims/maint-stand/index.ts | 61 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrderMapper.java | 22 eims-ui/apps/web-antd/src/api/eims/maint-plan/model.d.ts | 67 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/job/MaintPlanToOrderJob.java | 142 + eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrder.java | 109 eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-prod.yml | 4 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/GenerateCodeServiceImpl.java | 39 eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue | 32 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrderService.java | 77 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStandServiceImpl.java | 135 + eims-ui/apps/web-antd/src/views/eims/maint-stand/maint-stand-drawer.vue | 111 + eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintPlanVo.java | 150 + eims-ui/apps/web-antd/src/api/eims/maint-stand/model.d.ts | 53 eims-ui/apps/web-antd/src/views/eims/components/miant-order-modal.vue | 49 eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/MaintOrderCodeTranslationImpl.java | 30 eims-ui/apps/web-antd/src/views/eims/maint-stand/data.tsx | 111 + eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/constant/TransConstant.java | 5 eims-ui/apps/web-antd/src/views/eims/maint-orditm/index.vue | 159 + eims-ui/apps/web-antd/src/views/eims/maint-orditm/data.tsx | 169 + eims-ui/apps/web-antd/src/views/eims/components/basis-sub-table.vue | 98 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintPlanService.java | 77 eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx | 33 eims-ui/apps/web-antd/src/api/eims/maint-plan/index.ts | 61 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintStandService.java | 68 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrditmController.java | 105 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java | 24 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrderVo.java | 149 + eims-ui/apps/web-antd/src/views/eims/maint-plan/maint-plan-drawer.vue | 154 + eims-ui/apps/web-antd/src/views/eims/maint-plan/index.vue | 293 ++ eims-ui/apps/web-antd/src/api/eims/maint-orditm/model.d.ts | 46 eims-ui/apps/web-antd/src/views/eims/maint-order/data.tsx | 298 ++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrditmServiceImpl.java | 170 + eims-ui/apps/web-antd/src/constants/dict/index.ts | 10 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IGenerateCodeService.java | 5 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintStandVo.java | 93 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintStand.java | 77 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrditmBo.java | 76 eims-ui/apps/web-antd/src/views/eims/maint-order/index.vue | 316 ++ eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrderMapper.xml | 20 eims-ui/apps/web-antd/src/views/eims/maint-order/maint-order-drawer.vue | 201 + eims/ruoyi-common/ruoyi-common-translation/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | 1 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrderController.java | 106 eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts | 5 eims-ui/apps/web-antd/src/views/eims/maint-plan/data.tsx | 278 ++ eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintPlan.java | 106 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java | 118 + eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintPlanBo.java | 115 + eims-ui/apps/web-antd/src/views/eims/maint-order/sub-orditm.vue | 147 + eims/ruoyi-modules/lb-eims/pom.xml | 5 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrditmService.java | 68 eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrditmMapper.xml | 7 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrditmVo.java | 100 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStandBo.java | 78 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrditmMapper.java | 15 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintPlanServiceImpl.java | 235 ++ eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintStandMapper.xml | 7 eims-ui/apps/web-antd/src/views/eims/maint-stand/index.vue | 159 + eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintPlanController.java | 106 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintStandMapper.java | 15 eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java | 62 eims-ui/apps/web-antd/src/api/eims/maint-order/index.ts | 61 eims-ui/apps/web-antd/src/api/eims/maint-orditm/index.ts | 61 eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java | 7 eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrditm.java | 73 eims-ui/apps/web-antd/src/api/eims/maint-order/model.d.ts | 89 eims-ui/apps/web-antd/src/views/eims/maint-orditm/maint-orditm-drawer.vue | 175 + eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/MaintOrderService.java | 11 eims-ui/apps/web-antd/src/views/eims/repair-res/data.tsx | 53 eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintPlanMapper.xml | 19 73 files changed, 6,486 insertions(+), 77 deletions(-) diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-order/index.ts b/eims-ui/apps/web-antd/src/api/eims/maint-order/index.ts new file mode 100644 index 0000000..e30c0ac --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-order/index.ts @@ -0,0 +1,61 @@ +import type { MaintOrderVO } from './model'; + +import type { ID, IDS } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + maintOrderExport = '/eims/maintOrder/export', + maintOrderList = '/eims/maintOrder/list', + root = '/eims/maintOrder' +} + +/** + * 鏌ヨ淇濆吇宸ュ崟鍒楄〃 + * @param query + * @returns {*} + */ + +export function listMaintOrder(params?: any) { + return requestClient.get<MaintOrderVO[]>(Api.maintOrderList, { params }); +} + +/** + * 鏌ヨ淇濆吇宸ュ崟璇︾粏 + * @param maintOrderId + */ +export function getMaintOrder(maintOrderId: ID) { + return requestClient.get<MaintOrderVO>(`${Api.root}/${maintOrderId}`); +} + +/** + * 鏂板淇濆吇宸ュ崟 + * @param data + */ +export function addMaintOrder(data: any) { + return requestClient.postWithMsg<void>(Api.root, data); +} + +/** + * 淇敼淇濆吇宸ュ崟 + * @param data + */ +export function updateMaintOrder(data: any) { + return requestClient.putWithMsg<void>(Api.root, data); +} + +/** + * 鍒犻櫎淇濆吇宸ュ崟 + * @param maintOrderId + */ +export function delMaintOrder(maintOrderId: IDS) { + return requestClient.deleteWithMsg<void>(`${Api.root}/${maintOrderId}`); +} +/** + * 瀵煎嚭 + * @param + */ +export function maintOrderExport(data: any) { + return commonExport(Api.maintOrderExport, data); +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-order/model.d.ts b/eims-ui/apps/web-antd/src/api/eims/maint-order/model.d.ts new file mode 100644 index 0000000..996513f --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-order/model.d.ts @@ -0,0 +1,89 @@ +export interface MaintOrderVO { + /** + * + */ + id: number | string; + + /** + * + */ + equId: number | string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + maintType: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡 + */ + maintCycle: number; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + maintCycleUnit: string; + + /** + * 璁″垝琛ㄥ啑浣�- 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + maintRule: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇浜� + */ + maintUser: number; + maintUserName: string; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬 + */ + maintDept: number; + + /** + * 淇濆吇鍗曞彿 + */ + maintCode: string; + + /** + * + */ + status: string; + + verifyUser: number; + /** + * 楠岃瘉浜� + */ + verifyUserName: string; + + /** + * 淇濆吇璁″垝鏃堕棿 + */ + planTime: string; + + /** + * 淇濆吇寮�濮嬫椂闂� + */ + startTime: string; + + /** + * 淇濆吇缁撴潫鏃堕棿 + */ + endTime: string; + + /** + * 璁″垝id + */ + planId: number | string; + + /** + * 鍒涘缓鏃堕棿 + */ + createTime: string; + + /** + * 澶囨敞 + */ + remark: string; + +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-orditm/index.ts b/eims-ui/apps/web-antd/src/api/eims/maint-orditm/index.ts new file mode 100644 index 0000000..8807a5a --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-orditm/index.ts @@ -0,0 +1,61 @@ +import type { MaintOrditmVO } from './model'; + +import type { ID, IDS, PageResult } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + maintOrditmExport = '/eims/maintOrditm/export', + maintOrditmList = '/eims/maintOrditm/list', + root = '/eims/maintOrditm' +} + +/** + * 鏌ヨ宸ュ崟鏉$洰鍒楄〃 + * @param query + * @returns {*} + */ + +export function listMaintOrditm(params?: any) { + return requestClient.get<PageResult<MaintOrditmVO>>(Api.maintOrditmList, { params }); +} + +/** + * 鏌ヨ宸ュ崟鏉$洰璇︾粏 + * @param maintOrditmId + */ +export function getMaintOrditm(maintOrditmId: ID) { + return requestClient.get<MaintOrditmVO>(`${Api.root}/${maintOrditmId}`); +} + +/** + * 鏂板宸ュ崟鏉$洰 + * @param data + */ +export function addMaintOrditm(data: any) { + return requestClient.postWithMsg<void>(Api.root, data); +} + +/** + * 淇敼宸ュ崟鏉$洰 + * @param data + */ +export function updateMaintOrditm(data: any) { + return requestClient.putWithMsg<void>(Api.root, data); +} + +/** + * 鍒犻櫎宸ュ崟鏉$洰 + * @param maintOrditmId + */ +export function delMaintOrditm(maintOrditmId: IDS) { + return requestClient.deleteWithMsg<void>(`${Api.root}/${maintOrditmId}`); +} +/** + * 瀵煎嚭 + * @param + */ +export function maintOrditmExport(data: any) { + return commonExport(Api.maintOrditmExport, data); +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-orditm/model.d.ts b/eims-ui/apps/web-antd/src/api/eims/maint-orditm/model.d.ts new file mode 100644 index 0000000..0e39a49 --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-orditm/model.d.ts @@ -0,0 +1,46 @@ +export interface MaintOrditmVO { + /** + * + */ + id: number | string; + + /** + * 宸ュ崟id + */ + orderId: number | string; + + /** + * 璁惧id + */ + equId: number | string; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + itmName: string; + + /** + * 淇濆吇椤圭洰鎿嶄綔鏍囧噯 + */ + itmAction: string; + + /** + * 淇濆吇鎿嶄綔鐢ㄦ埛 + */ + itmUser: number; + + /** + * 淇濆吇鏃堕棿 + */ + itmTime: string; + + /** + * 瀹屾垚鐘舵�侊紙瀛楀吀锛� + */ + status: string; + + /** + * 澶囨敞 + */ + remark: string; +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-plan/index.ts b/eims-ui/apps/web-antd/src/api/eims/maint-plan/index.ts new file mode 100644 index 0000000..bba8da4 --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-plan/index.ts @@ -0,0 +1,61 @@ +import type { MaintPlanVO } from './model'; + +import type { ID, IDS } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + maintPlanExport = '/eims/maintPlan/export', + maintPlanList = '/eims/maintPlan/list', + root = '/eims/maintPlan' +} + +/** + * 鏌ヨ淇濆吇璁″垝鍒楄〃 + * @param query + * @returns {*} + */ + +export function listMaintPlan(params?: any) { + return requestClient.get<MaintPlanVO[]>(Api.maintPlanList, { params }); +} + +/** + * 鏌ヨ淇濆吇璁″垝璇︾粏 + * @param maintPlanId + */ +export function getMaintPlan(maintPlanId: ID) { + return requestClient.get<MaintPlanVO>(`${Api.root}/${maintPlanId}`); +} + +/** + * 鏂板淇濆吇璁″垝 + * @param data + */ +export function addMaintPlan(data: any) { + return requestClient.postWithMsg<void>(Api.root, data); +} + +/** + * 淇敼淇濆吇璁″垝 + * @param data + */ +export function updateMaintPlan(data: any) { + return requestClient.putWithMsg<void>(Api.root, data); +} + +/** + * 鍒犻櫎淇濆吇璁″垝 + * @param maintPlanId + */ +export function delMaintPlan(maintPlanId: IDS) { + return requestClient.deleteWithMsg<void>(`${Api.root}/${maintPlanId}`); +} +/** + * 瀵煎嚭 + * @param + */ +export function maintPlanExport(data: any) { + return commonExport(Api.maintPlanExport, data); +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-plan/model.d.ts b/eims-ui/apps/web-antd/src/api/eims/maint-plan/model.d.ts new file mode 100644 index 0000000..09f143c --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-plan/model.d.ts @@ -0,0 +1,67 @@ +export interface MaintPlanVO { + /** + * + */ + id: number | string; + + /** + * 璁惧id + + */ + equId: number | string; + + /** + * 淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + maintType: string; + + /** + * 淇濆吇鍛ㄦ湡 + */ + maintCycle: number; + + /** + * 淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + maintCycleUnit: string; + + /** + * 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + maintRule: string; + + /** + * 淇濆吇浜� + */ + maintUser: number; + + /** + * 淇濆吇閮ㄩ棬 + */ + maintDept: number; + + /** + * 鐘舵�侊紙瀛楀吀锛� 0-鍚敤 1-绂佺敤 + */ + status: string; + + /** + * 涓婃鎵ц鏃堕棿 + */ + maintFirstTime: string; + + /** + * 涓婃鎵ц鏃堕棿 + */ + maintLastTime: string; + + /** + * 涓嬫鎵ц鏃堕棿 + */ + maintNextTime: string; + + /** + * 澶囨敞 + */ + remark: string; +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-stand/index.ts b/eims-ui/apps/web-antd/src/api/eims/maint-stand/index.ts new file mode 100644 index 0000000..0822d12 --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-stand/index.ts @@ -0,0 +1,61 @@ +import type { MaintStandVO } from './model'; + +import type { ID, IDS, PageResult } from '#/api/common'; + +import { commonExport } from '#/api/helper'; +import { requestClient } from '#/api/request'; + +enum Api { + maintStandExport = '/eims/maintStand/export', + maintStandList = '/eims/maintStand/list', + root = '/eims/maintStand' +} + +/** + * 鏌ヨ淇濆吇鏍囧噯鍒楄〃 + * @param query + * @returns {*} + */ + +export function listMaintStand(params?: any) { + return requestClient.get<PageResult<MaintStandVO>>(Api.maintStandList, { params }); +} + +/** + * 鏌ヨ淇濆吇鏍囧噯璇︾粏 + * @param maintStandId + */ +export function getMaintStand(maintStandId: ID) { + return requestClient.get<MaintStandVO>(`${Api.root}/${maintStandId}`); +} + +/** + * 鏂板淇濆吇鏍囧噯 + * @param data + */ +export function addMaintStand(data: any) { + return requestClient.postWithMsg<void>(Api.root, data); +} + +/** + * 淇敼淇濆吇鏍囧噯 + * @param data + */ +export function updateMaintStand(data: any) { + return requestClient.putWithMsg<void>(Api.root, data); +} + +/** + * 鍒犻櫎淇濆吇鏍囧噯 + * @param maintStandId + */ +export function delMaintStand(maintStandId: IDS) { + return requestClient.deleteWithMsg<void>(`${Api.root}/${maintStandId}`); +} +/** + * 瀵煎嚭 + * @param + */ +export function maintStandExport(data: any) { + return commonExport(Api.maintStandExport, data); +} diff --git a/eims-ui/apps/web-antd/src/api/eims/maint-stand/model.d.ts b/eims-ui/apps/web-antd/src/api/eims/maint-stand/model.d.ts new file mode 100644 index 0000000..8dd1ba4 --- /dev/null +++ b/eims-ui/apps/web-antd/src/api/eims/maint-stand/model.d.ts @@ -0,0 +1,53 @@ +export interface MaintStandVO { + /** + * + */ + id: string | number; + + /** + * 璁惧id + */ + equId: string | number; + + /** + * 璁惧缂栫爜 + */ + equCode: string; + + /** + * 璁惧绫诲瀷 + */ + equTypeId: string | number; + + /** + * 璧勪骇缂栧彿 + */ + assetNo: string; + + /** + * 璁惧鍚嶇О + + */ + equName: string; + + /** + * 璁惧鍨嬪彿 + */ + modelNo: string; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + name: string; + + /** + * 淇濆吇椤圭洰鏍囧噯 + */ + stand: string; + + /** + * 澶囨敞 + */ + remark: string; + +} diff --git a/eims-ui/apps/web-antd/src/constants/dict/index.ts b/eims-ui/apps/web-antd/src/constants/dict/index.ts index 7fe5f13..b86cfa4 100644 --- a/eims-ui/apps/web-antd/src/constants/dict/index.ts +++ b/eims-ui/apps/web-antd/src/constants/dict/index.ts @@ -39,3 +39,13 @@ WEIXIU = '2', // 缁翠慨涓� YIJIEDAN = '1' // 宸叉帴鍗� } + +/** + * 淇濆吇宸ュ崟鐘舵�� + */ +export enum MAINT_ORDER_STATUS { + BAOYANG = '1', // 淇濆吇缁� + DAIBAOYANG = '0', // 寰呬繚鍏� + DAIYANZHENG = '2', // 寰呴獙璇� + WANCHENG = '3' // 瀹屾垚 +} diff --git a/eims-ui/apps/web-antd/src/views/eims/components/basis-sub-table.vue b/eims-ui/apps/web-antd/src/views/eims/components/basis-sub-table.vue new file mode 100644 index 0000000..b7e37a0 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/components/basis-sub-table.vue @@ -0,0 +1,98 @@ +<script setup lang="ts"> +import { ref, watch } from 'vue'; + +import { Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; + +interface Props { + reqKey: string; + reqValue: any; + title?: string; + listApi: (params: any) => Promise<any>; // 鍔ㄦ�丄PI鍑芥暟 + columns?: VxeGridProps['columns']; +} +const props = defineProps<Props>(); +const columns = props?.columns?.filter((i) => i.field !== 'action'); + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + const keyName = props.reqKey; + const keyValue = props.reqValue; + if (keyName && keyValue) { + const params = { [keyName]: props.reqValue }; + Object.assign(formValues, params); + } else { + // 鏈紶鍙傚垯鏌ヨ涓�涓笉瀛樺湪鐨勫�� + const params = { [keyName]: -1 }; + Object.assign(formValues, params); + } + return await props.listApi({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: `basis-sub-table${props.reqValue}` +}; + +const [BasicTable, tableApi] = useVbenVxeGrid({ + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + } +}); + +// 浣跨敤 watch 鐩戝惉 id 鐨勫彉鍖� +watch( + () => props.reqValue, + (newVal, oldVal) => { + if (newVal !== oldVal && newVal) { + tableApi.query(); + } + }, + { immediate: false } +); +/** + * TODO 鍚庣画鎵╁睍鐐瑰嚮浜嬩欢 + */ +const slotName = ref<string>('equName'); +</script> + +<template> + <div class="w-full"> + <BasicTable :table-title="title"> + <template #[slotName]="{ row }"> + <Space> + <span>{{ row[slotName] }}</span> + </Space> + </template> + </BasicTable> + </div> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/components/miant-order-modal.vue b/eims-ui/apps/web-antd/src/views/eims/components/miant-order-modal.vue new file mode 100644 index 0000000..a549111 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/components/miant-order-modal.vue @@ -0,0 +1,49 @@ +<script setup lang="ts"> +import { ref } from 'vue'; + +import { useVbenModal } from '@vben/common-ui'; + +import { message } from 'ant-design-vue'; + +import MaintOrderView from '#/views/eims/maint-order/index.vue'; + +const emit = defineEmits<{ updateSelect: [any] }>(); + +const [BasicModal, modalApi] = useVbenModal({ + fullscreenButton: false, + draggable: true, + onCancel: handleCancel, + onConfirm: handleConfirm +}); +const innerView = ref(); + +async function handleConfirm() { + try { + modalApi.modalLoading(true); + const tableSelect = innerView.value.tableSelect(); + if (tableSelect.length > 1) { + message.error('鏈�澶氬彧鑳介�夋嫨涓�鏉℃暟鎹紒'); + modalApi.modalLoading(false); + return false; + } + emit('updateSelect', tableSelect[0]); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + modalApi.modalLoading(false); + } +} + +async function handleCancel() { + modalApi.close(); +} +</script> + +<template> + <BasicModal :fullscreen-button="true" class="w-[800px]"> + <MaintOrderView ref="innerView" /> + </BasicModal> +</template> + +<style scoped></style> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-order/data.tsx b/eims-ui/apps/web-antd/src/views/eims/maint-order/data.tsx new file mode 100644 index 0000000..8c28042 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-order/data.tsx @@ -0,0 +1,298 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { DictEnum } from '@vben/constants'; +import { getPopupContainer } from '@vben/utils'; + +import { type FormSchemaGetter } from '#/adapter/form'; +import { getDictOptions } from '#/utils/dict'; +import { renderDict } from '#/utils/render'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'Input', + fieldName: 'maintCode', + label: '淇濆吇宸ュ崟' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.EIMS_MAINT_TYPE) + }, + fieldName: 'maintType', + label: '淇濆吇绫诲瀷' + }, + { + component: 'TreeSelect', + // 鍦╠rawer閲屾洿鏂� 杩欓噷涓嶉渶瑕侀粯璁ょ殑componentProps + defaultValue: undefined, + fieldName: 'maintDept', + label: '淇濆吇閮ㄩ棬' + }, + { + component: 'Select', + componentProps: { + allowClear: true, + showSearch: true, + getPopupContainer + }, + fieldName: 'maintUser', + label: '淇濆吇浜�' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.MAINT_TIME_RULE) + }, + fieldName: 'maintRule', + label: '璁$畻瑙勫垯' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.MAINT_ORDER_STATUS) + }, + fieldName: 'status', + label: '鐘舵��' + } +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60, fixed: 'left' }, + { + title: '淇濆吇宸ュ崟', + field: 'maintCode', + minWidth: 200, + fixed: 'left' + }, + + { + title: '鐘舵��', + field: 'status', + minWidth: 80, + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.MAINT_ORDER_STATUS); + } + } + }, + { + title: '璁惧鍚嶇О', + field: 'equName', + minWidth: 200, + fixed: 'left' + }, + { + title: '璧勪骇缂栧彿', + field: 'assetNo', + minWidth: 160 + }, + { + title: '淇濆吇绫诲瀷', + field: 'maintType', + minWidth: 120, + slots: { + default: ({ row }) => { + return renderDict(row.maintType, DictEnum.EIMS_MAINT_TYPE); + } + } + }, + { + title: '淇濆吇浜�', + field: 'maintUserName', + minWidth: 100 + }, + { + title: '璁″垝淇濆吇鏃堕棿', + field: 'planTime', + minWidth: 160 + }, + { + title: '淇濆吇寮�濮嬫椂闂�', + field: 'startTime', + minWidth: 160 + }, + { + title: '淇濆吇缁撴潫鏃堕棿', + field: 'endTime', + minWidth: 160 + }, + { + title: '楠岃瘉浜�', + field: 'verifyUserName', + minWidth: 160 + }, + { + title: '鍒涘缓鏃堕棿', + field: 'createTime', + minWidth: 200 + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '鎿嶄綔', + width: 200 + } +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'id' + }, + { + component: 'Input', + fieldName: 'equId', + label: '璁惧id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'maintCode', + label: '淇濆吇鍗曞彿' + }, + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.EIMS_MAINT_TYPE), + optionType: 'button' + }, + fieldName: 'maintType', + defaultValue: '1', + label: '淇濆吇绫诲瀷' + }, + /* + { + component: 'InputNumber', + fieldName: 'maintCycle', + label: '淇濆吇鍛ㄦ湡', + formItemClass: 'col-span-1', + componentProps: { + min: 1 + } + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.MAINT_CYCLE_UNIT) + }, + fieldName: 'maintCycleUnit', + formItemClass: 'col-span-1 w-[80px]', + labelWidth: 0, + label: '' + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.MAINT_TIME_RULE) + }, + fieldName: 'maintRule', + label: '淇濆吇瑙勫垯 ' + },*/ + { + component: 'Input', + fieldName: 'maintUser', + label: '淇濆吇浜篿d', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'maintUserName', + label: '淇濆吇浜�' + }, + { + component: 'Input', + fieldName: 'maintDept', + label: '閮ㄩ棬id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.MAINT_ORDER_STATUS), + optionType: 'button' + }, + fieldName: 'status', + defaultValue: '0', + label: '鐘舵��' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + showTime: false, + valueFormat: 'YYYY-MM-DD', + getPopupContainer + }, + fieldName: 'planTime', + label: '璁″垝淇濆吇鏃ユ湡' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD HH:mm:ss', + showTime: true, + valueFormat: 'YYYY-MM-DD HH:mm:ss', + getPopupContainer + }, + fieldName: 'startTime', + label: '寮�濮嬫椂闂�' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD HH:mm:ss', + showTime: true, + valueFormat: 'YYYY-MM-DD HH:mm:ss', + getPopupContainer + }, + fieldName: 'endTime', + label: '缁撴潫鏃堕棿' + }, + { + component: 'Input', + fieldName: 'verifyUser', + label: '楠岃瘉浜篿d', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'verifyUserName', + label: '楠岃瘉浜�' + }, + { + component: 'Textarea', + fieldName: 'remark', + label: '澶囨敞' + } +]; diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-order/index.vue b/eims-ui/apps/web-antd/src/views/eims/maint-order/index.vue new file mode 100644 index 0000000..f5e3edc --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-order/index.vue @@ -0,0 +1,316 @@ +<script setup lang="ts"> +import type { Recordable } from '@vben/types'; + +import { computed, onMounted, ref } from 'vue'; + +import { useAccess } from '@vben/access'; +import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { useUserStore } from '@vben/stores'; +import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; + +import { Modal, Popconfirm, Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { delMaintOrder, listMaintOrder, maintOrderExport } from '#/api/eims/maint-order'; +import { getDeptTree, userList } from '#/api/system/user'; +import { MAINT_ORDER_STATUS } from '#/constants/dict'; +import { commonDownloadExcel } from '#/utils/file/download'; + +import { columns, querySchema } from './data'; +import maintOrderDrawer from './maint-order-drawer.vue'; +import SubOrditm from './sub-orditm.vue'; + +defineExpose({ + tableSelect +}); + +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + componentProps: { + allowClear: true + } + }, + collapsed: true, + schema: querySchema(), + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' +}; + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + return await listMaintOrder({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: 'maint-order-index' +}; +const orderId = ref<string>(); +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), + cellClick: (e: any) => { + const { row } = e; + orderId.value = row.id; + } + } +}); + +const [MaintOrderDrawer, maintOrderDrawerApi] = useVbenDrawer({ + connectedComponent: maintOrderDrawer +}); + +function handleAdd() { + maintOrderDrawerApi.setData({}); + maintOrderDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + maintOrderDrawerApi.setData({ id: record.id }); + maintOrderDrawerApi.open(); +} + +async function handleDelete(row: Recordable<any>) { + await delMaintOrder(row.id); + await tableApi.query(); +} + +function handleMultiDelete() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id); + Modal.confirm({ + title: '鎻愮ず', + okType: 'danger', + content: `纭鍒犻櫎閫変腑鐨�${ids.length}鏉¤褰曞悧锛焋, + onOk: async () => { + await delMaintOrder(ids); + await tableApi.query(); + } + }); +} + +function handleDownloadExcel() { + commonDownloadExcel(maintOrderExport, '淇濆吇宸ュ崟璁板綍', tableApi.formApi.form.values, { + fieldMappingTime: formOptions.fieldMappingTime + }); +} + +/** + * 鍒濆鍖栭儴闂ㄩ�夋嫨 + */ +async function setupDeptSelect() { + // updateSchema + const deptTree = await getDeptTree(); + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� 鍗崇埗鑺傜偣 / 瀛愯妭鐐� + addFullName(deptTree, 'label', ' / '); + tableApi.formApi.updateSchema([ + { + componentProps: (formModel) => ({ + class: 'w-full', + fieldNames: { + key: 'id', + value: 'id', + children: 'children' + }, + getPopupContainer, + async onSelect(deptId: number | string) { + /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ + await setupUserOptions(deptId); + /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ + formModel.maintUser = undefined; + }, + placeholder: '璇烽�夋嫨', + showSearch: true, + treeData: deptTree, + treeDefaultExpandAll: true, + treeLine: { showLeafIcon: false }, + // 绛涢�夌殑瀛楁 + treeNodeFilterProp: 'label', + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� + treeNodeLabelProp: 'fullName' + }), + fieldName: 'maintDept' + } + ]); +} + +/** + * 鐢ㄦ埛鐨勫姞杞� + */ +async function setupUserOptions(deptId: any) { + const params = { deptId }; + const userPageResult = await userList({ + pageNum: 1, + pageSize: 500, + ...params + }); + const options = userPageResult.rows.map((item) => ({ + label: item.nickName || item.userName, + value: item.userId + })); + // 绛涢�� + const filterOption = (input: string, option: any) => { + return option.label.toLowerCase().includes(input.toLowerCase()); + }; + + const placeholder = options.length > 0 ? '璇烽�夋嫨' : '璇ラ儴闂ㄤ笅鏆傛棤鐢ㄦ埛'; + tableApi.formApi.updateSchema([ + { + componentProps: { options, placeholder, filterOption }, + fieldName: 'maintUser' + } + ]); +} + + + +onMounted(async () => { + await setupDeptSelect(); +}); + +async function handleEditStatus(record: Recordable<any>, status: string) { + maintOrderDrawerApi.setData({ id: record.id, status }); + maintOrderDrawerApi.open(); +} + +const userStore = useUserStore(); +const userId = userStore.userInfo?.userId; +const deptId = userStore.userInfo?.deptId; +const { hasAccessByRoles } = useAccess(); +const isSuperAdmin = computed(() => hasAccessByRoles(['superadmin'])); +const isLeader = computed(() => hasAccessByRoles(['leader'])); + +/** + * 寰呬繚鍏荤姸鎬�-淇濆吇浜烘搷浣� + * @param row + */ +function daibaoyang(row: any) { + return (isSuperAdmin.value || isLeader.value || row.maintUser === userId) && row.status === MAINT_ORDER_STATUS.DAIBAOYANG; +} + +/** + * 淇濆吇鐘舵��-淇濆吇浜烘搷浣� + * @param row + */ +function baoyang(row: any) { + return (isSuperAdmin.value || isLeader.value || row.maintUser === userId) && row.status === MAINT_ORDER_STATUS.BAOYANG; +} + +/** + * 寰呴獙璇佺姸鎬�-楠岃瘉浜烘搷浣� + * @param row + */ +function yanzheng(row: any) { + return (isSuperAdmin.value || isLeader.value || row.verifyUser === userId) && row.status === MAINT_ORDER_STATUS.DAIYANZHENG; +} + +// 閫変腑鏁版嵁 +function tableSelect() { + return tableApi.grid.getCheckboxRecords(); +} +</script> + +<template> + <Page :auto-content-height="true"> + <div class="flex h-full gap-[8px] flex-col"> + <BasicTable class="h-2/3" table-title="淇濆吇宸ュ崟鍒楄〃"> + <template #toolbar-tools> + <Space> + <a-button v-access:code="['eims:maintOrder:export']" @click="handleDownloadExcel"> + {{ $t('pages.common.export') }} + </a-button> + <a-button + :disabled="!vxeCheckboxChecked(tableApi)" + danger + type="primary" + v-access:code="['eims:maintOrder:remove']" + @click="handleMultiDelete" + > + {{ $t('pages.common.delete') }} + </a-button> + <a-button type="primary" v-access:code="['eims:maintOrder:add']" @click="handleAdd"> + {{ $t('pages.common.add') }} + </a-button> + </Space> + </template> + + <template #equName="{ row }"> + <Space> + <span>{{ row.equName }}</span> + </Space> + </template> + + <template #action="{ row }"> + <Space> + <ghost-button + v-if="daibaoyang(row)" + class="btn-success" + v-access:code="['eims:maintOrder:edit']" + @click.stop="handleEditStatus(row, MAINT_ORDER_STATUS.BAOYANG)" + > + 淇濆吇 + </ghost-button> + <ghost-button + v-if="baoyang(row)" + class="btn-success" + v-access:code="['eims:maintOrder:edit']" + @click.stop="handleEditStatus(row, MAINT_ORDER_STATUS.DAIYANZHENG)" + > + 瀹屾垚 + </ghost-button> + <ghost-button + v-if="yanzheng(row)" + class="btn-success" + v-access:code="['eims:maintOrder:edit']" + @click.stop="handleEditStatus(row, MAINT_ORDER_STATUS.WANCHENG)" + > + 楠岃瘉 + </ghost-button> + <ghost-button v-access:code="['eims:maintOrder:edit']" @click.stop="handleEdit(row)"> + {{ $t('pages.common.edit') }} + </ghost-button> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" + @confirm="handleDelete(row)"> + <ghost-button danger v-access:code="['eims:maintOrder:remove']" @click.stop=""> + {{ $t('pages.common.delete') }} + </ghost-button> + </Popconfirm> + </Space> + </template> + </BasicTable> + <!--<BasisSubTable :columns="maintStandCol" :list-api="listMaintStand" :req-value="equId" class="h-1/3" req-key="equId" title="淇濆吇瀹炴柦椤圭洰" />--> + <SubOrditm :order-id="orderId" class="h-1/3" /> + </div> + <MaintOrderDrawer @reload="tableApi.query()" /> + </Page> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-order/maint-order-drawer.vue b/eims-ui/apps/web-antd/src/views/eims/maint-order/maint-order-drawer.vue new file mode 100644 index 0000000..992a2e3 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-order/maint-order-drawer.vue @@ -0,0 +1,201 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; + +import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; +import { cloneDeep } from '@vben/utils'; + +import { InputSearch } from 'ant-design-vue'; + +import { useVbenForm } from '#/adapter/form'; +import { addMaintOrder, getMaintOrder, updateMaintOrder } from '#/api/eims/maint-order'; +import CodeInput from '#/views/eims/components/code-input.vue'; +import equModal from '#/views/eims/components/equ-modal.vue'; +import userModal from '#/views/eims/components/user-modal.vue'; + +import { drawerSchema } from './data'; + + +const emit = defineEmits<{ reload: [] }>(); + +const isUpdate = ref(false); +const title = computed(() => { + return isUpdate.value ? '缂栬緫淇濆吇宸ュ崟' : '鏂板淇濆吇宸ュ崟'; +}); + +const [BasicForm, formApi] = useVbenForm({ + commonConfig: { + formItemClass: 'col-span-2', + componentProps: { + class: 'w-full' + }, + labelWidth: 120 + }, + schema: drawerSchema(), + showDefaultActions: false, + wrapperClass: 'grid-cols-2' +}); + +const [BasicDrawer, drawerApi] = useVbenDrawer({ + onCancel: handleCancel, + onConfirm: handleConfirm, + async onOpenChange(isOpen) { + if (!isOpen) { + return null; + } + drawerApi.drawerLoading(true); + const { id } = drawerApi.getData() as { id?: number | string }; + const { status } = drawerApi.getData() as { status?: string }; + // 浠庝繚鍏昏鍒掗〉闈㈢敓鎴愪繚鍏诲伐鍗� + const { planOrder } = drawerApi.getData(); + isUpdate.value = !!id; + // 鏂板-浠庝繚鍏昏鍒掗〉闈㈢敓鎴愪繚鍏诲伐鍗� + if (!isUpdate.value && !id) { + await formApi.setValues(planOrder); + } + // 閲嶇疆 + baoyangCol(false); + + // 鏇存柊 && 璧嬪�� + if (isUpdate.value && id) { + const record = await getMaintOrder(id); + /** + * 鏇存柊鐘舵�� + */ + if (status) { + record.status = status; + baoyangCol(true); + // TODO 绮剧粏鍖栨帶鍒惰緭鍏� + /* switch (status) { + case MAINT_ORDER_STATUS.BAOYANG: { + + break; + } + case MAINT_ORDER_STATUS.DAIYANZHENG: { + break; + } + }*/ + } + await formApi.setValues(record); + } + + drawerApi.drawerLoading(false); + } +}); + + +async function handleConfirm() { + try { + drawerApi.drawerLoading(true); + const { valid } = await formApi.validate(); + if (!valid) { + return; + } + const data = cloneDeep(await formApi.getValues()); + await (isUpdate.value ? updateMaintOrder(data) : addMaintOrder(data)); + emit('reload'); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + drawerApi.drawerLoading(false); + } +} + +function baoyangCol(disable: boolean) { + const show = disable; + formApi.updateSchema([ + { + componentProps: { + disabled: show + }, + fieldName: 'maintType' + }, + { + componentProps: { + disabled: show + }, + fieldName: 'planTime' + }, + { + componentProps: { + disabled: show + }, + fieldName: 'status' + } + ]); +} + +async function handleCancel() { + drawerApi.close(); + await formApi.resetForm(); +} + +// equ modal +const [EquModal, equModalApi] = useVbenModal({ + connectedComponent: equModal, + draggable: true, + title: '閫夋嫨璁惧' +}); + +function handleEquModal() { + equModalApi.setData({}); + equModalApi.open(); +} + +// user modal +const [UserModal, userModalApi] = useVbenModal({ + connectedComponent: userModal, + draggable: true, + title: '閫夋嫨淇濆吇浜�' +}); + +const userType = ref<number | undefined>(undefined); + +function handleUserModal(type: number) { + userType.value = type; + userModalApi.setData({}); + userModalApi.open(); +} + +/** + * 鏇存柊閫夋嫨鐨勮澶� + * @param equ + */ +async function updateEqu(equ: any) { + await formApi.setValues({equId:equ.equId,equName:equ.equName}); +} + +/** + * 鏇存柊閫夋嫨鐨勭敤鎴� + * @param user + */ +async function updateUser(user: any) { + if (userType.value === 1) { + await formApi.setValues({ 'maintUserName': user.nickName, 'maintUser': user.userId, 'maintDept': user.deptId }); + } else if (userType.value === 2) { + await formApi.setValues({ 'verifyUserName': user.nickName, 'verifyUser': user.userId, 'verifyDept': user.deptId }); + } +} +</script> + +<template> + <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> + <BasicForm> + <template #equName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleEquModal" v-bind="slotProps" + :disabled="isUpdate" /> + </template> + <template #maintUserName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleUserModal(1)" v-bind="slotProps" /> + </template> + <template #verifyUserName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleUserModal(2)" v-bind="slotProps" /> + </template> + <template #maintCode="slotProps"> + <CodeInput v-bind="slotProps" :disabled="isUpdate" prefix="BYSD" /> + </template> + </BasicForm> + <EquModal class="w-[1200px]" @update-equ="updateEqu" /> + <UserModal class="w-[1200px]" @select-user="updateUser" /> + </BasicDrawer> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-order/sub-orditm.vue b/eims-ui/apps/web-antd/src/views/eims/maint-order/sub-orditm.vue new file mode 100644 index 0000000..98bf28c --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-order/sub-orditm.vue @@ -0,0 +1,147 @@ +<script setup lang="ts"> +import type { Recordable } from '@vben/types'; + +import { nextTick, ref, watch } from 'vue'; + +import { useVbenDrawer } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { getVxePopupContainer } from '@vben/utils'; + +import { Popconfirm, Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { listMaintOrditm } from '#/api/eims/maint-orditm'; +import { columns } from '#/views/eims/maint-orditm/data'; +import maintOrditmDrawer from '#/views/eims/maint-orditm/maint-orditm-drawer.vue'; + +interface Props { + orderId?: string; +} + +const props = defineProps<Props>(); + +const completed = ref<string>('宸插畬鎴�'); +// 鏈洏鐐� +const uncompleted = ref<string>('鏈畬鎴�'); + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + if (props.orderId) { + const params = { orderId: props.orderId }; + Object.assign(formValues, params); + } else { + const params = { orderId: -1 }; + Object.assign(formValues, params); + } + return await listMaintOrditm({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + }, + querySuccess: () => { + nextTick(() => { + // eslint-disable-next-line no-use-before-define + const data = tableApi?.grid.getData(); + completed.value = '宸插畬鎴�'; + uncompleted.value = '鏈畬鎴�'; + if (data.length <= 0) return false; + const wc = data?.filter((i) => i.status === '1')?.length; + completed.value = `宸插畬鎴�(${wc})`; + uncompleted.value = `鏈畬鎴�(${data.length - wc})`; + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: 'sub-orditm-index' +}; + +const [BasicTable, tableApi] = useVbenVxeGrid({ + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + } +}); + +const [MaintOrditmDrawer, maintOrditmDrawerApi] = useVbenDrawer({ + connectedComponent: maintOrditmDrawer +}); + +function handleAdd() { + maintOrditmDrawerApi.setData({}); + maintOrditmDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + maintOrditmDrawerApi.setData({ id: record.id }); + maintOrditmDrawerApi.open(); +} + +// 浣跨敤 watch 鐩戝惉 resId 鐨勫彉鍖� +watch( + () => props.orderId, + (newVal, oldVal) => { + if (newVal !== oldVal && newVal) { + tableApi.query(); + } + }, + { immediate: false } +); +</script> + +<template> + <div class="w-full"> + <BasicTable table-title="瀹炴柦椤圭洰"> + <template #toolbar-tools> + <Space> + <a-button>{{ uncompleted }}</a-button> + <a-button type="primary"> {{ completed }}</a-button> + </Space> + </template> + + <template #equName="{ row }"> + <Space> + <span>{{ row.equName }}</span> + </Space> + </template> + + <template #action="{ row }"> + <Space> + <ghost-button v-access:code="['eims:maintOrditm:edit']" @click.stop="handleEdit(row)"> + {{ $t('pages.common.edit') }} + </ghost-button> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> + <ghost-button danger v-access:code="['eims:maintOrditm:remove']" @click.stop=""> + {{ $t('pages.common.delete') }} + </ghost-button> + </Popconfirm> + </Space> + </template> + </BasicTable> + <MaintOrditmDrawer @reload="tableApi.query()" /> + </div> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-orditm/data.tsx b/eims-ui/apps/web-antd/src/views/eims/maint-orditm/data.tsx new file mode 100644 index 0000000..37e58ac --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-orditm/data.tsx @@ -0,0 +1,169 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { DictEnum } from '@vben/constants'; +import { getPopupContainer } from '@vben/utils'; + +import { type FormSchemaGetter } from '#/adapter/form'; +import { getDictOptions } from '#/utils/dict'; +import { renderDict } from '#/utils/render'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'Input', + fieldName: 'assetNo', + label: '璧勪骇缂栧彿' + } +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60, fixed: 'left' }, + { + title: '鐘舵��', + field: 'status', + minWidth: 80, + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.EIMS_ORDITM_STATUS); + } + } + }, + { + title: '瀹屾垚鏃堕棿', + field: 'itmTime', + minWidth: 200 + }, + { + title: '璁惧鍚嶇О', + field: 'equName', + minWidth: 160, + slots: { default: 'equName' } + }, + { + title: '淇濆吇椤圭洰', + field: 'itmName', + minWidth: 200 + }, + { + title: '椤圭洰鏍囧噯', + field: 'itmAction', + minWidth: 200 + }, + { + title: '淇濆吇鐢ㄦ埛', + field: 'itmUserName', + minWidth: 200 + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '鎿嶄綔', + width: 200 + } +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'orderId', + label: '宸ュ崟id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'orderName', + label: '淇濆吇宸ュ崟' + }, + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'id' + }, + { + component: 'Input', + fieldName: 'equId', + label: '璁惧id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О', + componentProps: { + readonly: true + }, + }, + { + component: 'Select', + componentProps: { + allowClear: true, + showSearch: true, + getPopupContainer + }, + fieldName: 'itmName', + label: '淇濆吇椤圭洰', + }, + { + component: 'Input', + fieldName: 'itmAction', + label: '椤圭洰鏍囧噯', + componentProps: { + readonly: true + }, + }, + { + component: 'Input', + fieldName: 'itmUser', + label: '淇濆吇浜篿d', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'itmUserName', + label: '淇濆吇浜�' + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.EIMS_ORDITM_STATUS), + optionType: 'button' + }, + fieldName: 'status', + defaultValue: '0', + label: '鐘舵��' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD HH:mm:ss', + showTime: true, + valueFormat: 'YYYY-MM-DD HH:mm:ss', + getPopupContainer + }, + fieldName: 'itmTime', + label: '瀹屾垚鏃堕棿' + }, + { + component: 'Textarea', + fieldName: 'remark', + label: '澶囨敞' + } +]; diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-orditm/index.vue b/eims-ui/apps/web-antd/src/views/eims/maint-orditm/index.vue new file mode 100644 index 0000000..014cb93 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-orditm/index.vue @@ -0,0 +1,159 @@ +<script setup lang="ts"> +import type { Recordable } from '@vben/types'; + +import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { getVxePopupContainer } from '@vben/utils'; + +import { Modal, Popconfirm, Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { delMaintOrditm, listMaintOrditm, maintOrditmExport } from '#/api/eims/maint-orditm'; +import { commonDownloadExcel } from '#/utils/file/download'; + +import { columns, querySchema } from './data'; +import maintOrditmDrawer from './maint-orditm-drawer.vue'; + +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + componentProps: { + allowClear: true + } + }, + schema: querySchema(), + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' +}; + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + return await listMaintOrditm({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: 'maint-orditm-index' +}; + +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + } +}); + +const [MaintOrditmDrawer, maintOrditmDrawerApi] = useVbenDrawer({ + connectedComponent: maintOrditmDrawer +}); + +function handleAdd() { + maintOrditmDrawerApi.setData({}); + maintOrditmDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + maintOrditmDrawerApi.setData({ id: record.id }); + maintOrditmDrawerApi.open(); +} + +async function handleDelete(row: Recordable<any>) { + await delMaintOrditm(row.id); + await tableApi.query(); +} + +function handleMultiDelete() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id); + Modal.confirm({ + title: '鎻愮ず', + okType: 'danger', + content: `纭鍒犻櫎閫変腑鐨�${ids.length}鏉¤褰曞悧锛焋, + onOk: async () => { + await delMaintOrditm(ids); + await tableApi.query(); + } + }); +} + +function handleDownloadExcel() { + commonDownloadExcel(maintOrditmExport, '淇濆吇宸ュ崟鏄庣粏璁板綍', tableApi.formApi.form.values, { + fieldMappingTime: formOptions.fieldMappingTime + }); +} +</script> + +<template> + <Page :auto-content-height="true"> + <div class="flex h-full gap-[8px]"> + <BasicTable class="flex-1 overflow-hidden" table-title="淇濆吇宸ュ崟鏄庣粏鍒楄〃"> + <template #toolbar-tools> + <Space> + <a-button v-access:code="['eims:maintOrditm:export']" @click="handleDownloadExcel"> + {{ $t('pages.common.export') }} + </a-button> + <a-button + :disabled="!vxeCheckboxChecked(tableApi)" + danger + type="primary" + v-access:code="['eims:maintOrditm:remove']" + @click="handleMultiDelete" + > + {{ $t('pages.common.delete') }} + </a-button> + <a-button type="primary" v-access:code="['eims:maintOrditm:add']" @click="handleAdd"> + {{ $t('pages.common.add') }} + </a-button> + </Space> + </template> + + <template #equName="{ row }"> + <Space> + <span>{{ row.equName }}</span> + </Space> + </template> + + <template #action="{ row }"> + <Space> + <ghost-button v-access:code="['eims:maintOrditm:edit']" @click.stop="handleEdit(row)"> + {{ $t('pages.common.edit') }} + </ghost-button> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> + <ghost-button danger v-access:code="['eims:maintOrditm:remove']" @click.stop=""> + {{ $t('pages.common.delete') }} + </ghost-button> + </Popconfirm> + </Space> + </template> + </BasicTable> + </div> + <MaintOrditmDrawer @reload="tableApi.query()" /> + </Page> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-orditm/maint-orditm-drawer.vue b/eims-ui/apps/web-antd/src/views/eims/maint-orditm/maint-orditm-drawer.vue new file mode 100644 index 0000000..7341ecd --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-orditm/maint-orditm-drawer.vue @@ -0,0 +1,175 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; + +import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { cloneDeep } from '@vben/utils'; + +import { InputSearch } from 'ant-design-vue'; + +import { useVbenForm } from '#/adapter/form'; +import { addMaintOrditm, getMaintOrditm, updateMaintOrditm } from '#/api/eims/maint-orditm'; +import { listMaintStand } from '#/api/eims/maint-stand'; +import orderModal from '#/views/eims/components/miant-order-modal.vue'; +import userModal from '#/views/eims/components/user-modal.vue'; + +import { drawerSchema } from './data'; + +const emit = defineEmits<{ reload: [] }>(); + +const isUpdate = ref(false); +const title = computed(() => { + return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); +}); + +const [BasicForm, formApi] = useVbenForm({ + commonConfig: { + formItemClass: 'col-span-2', + componentProps: { + class: 'w-full' + }, + labelWidth: 120 + }, + schema: drawerSchema(), + showDefaultActions: false, + wrapperClass: 'grid-cols-2' +}); + +const [BasicDrawer, drawerApi] = useVbenDrawer({ + onCancel: handleCancel, + onConfirm: handleConfirm, + async onOpenChange(isOpen) { + if (!isOpen) { + return null; + } + drawerApi.drawerLoading(true); + const { id } = drawerApi.getData() as { id?: number | string }; + isUpdate.value = !!id; + // 鏇存柊 && 璧嬪�� + if (isUpdate.value && id) { + const record = await getMaintOrditm(id); + await formApi.setValues(record); + } + + drawerApi.drawerLoading(false); + } +}); + +/** + * 宸ュ崟鏄庣粏鐨勫姞杞� + */ +async function setupOrditmOptions(equId: any) { + const params = { equId }; + const userPageResult = await listMaintStand({ + pageNum: 1, + pageSize: 50, + ...params + }); + const options = userPageResult?.rows.map((item) => ({ + label: item.name, + value: item.name + })); + // 绛涢�� + const filterOption = (input: string, option: any) => { + return option.label.toLowerCase().includes(input.toLowerCase()); + }; + + const placeholder = options.length > 0 ? '璇烽�夋嫨' : '璇ュ伐鍗曟殏鏃犳槑缁�'; + formApi.updateSchema([ + { + componentProps: { + options, + placeholder, + filterOption, + async onSelect(name: string) { + const item = userPageResult?.rows.find((i) => i.name === name); + await formApi.setValues({ itmAction: item?.stand }); + } + }, + fieldName: 'itmName' + } + ]); +} + +async function handleConfirm() { + try { + drawerApi.drawerLoading(true); + const { valid } = await formApi.validate(); + if (!valid) { + return; + } + const data = cloneDeep(await formApi.getValues()); + await (isUpdate.value ? updateMaintOrditm(data) : addMaintOrditm(data)); + emit('reload'); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + drawerApi.drawerLoading(false); + } +} + +async function handleCancel() { + drawerApi.close(); + await formApi.resetForm(); +} + +// order modal +const [OrderModal, orderModalApi] = useVbenModal({ + connectedComponent: orderModal, + draggable: true, + title: '閫夋嫨宸ュ崟' +}); + +function handleOrderModal() { + orderModalApi.setData({}); + orderModalApi.open(); +} + +/** + * 鏇存柊閫夋嫨鐨勫伐鍗� + * @param order + */ +async function updateOrderSelect(order: any) { + await formApi.setValues({ 'orderId': order.id, 'orderName': order.maintCode, 'equId': order.equId, 'equName': order.equName }); + await setupOrditmOptions(order?.equId); +} + +// user modal +const [UserModal, userModalApi] = useVbenModal({ + connectedComponent: userModal, + draggable: true, + title: '閫夋嫨鎴愬憳' +}); + +/** + * 鎵撳紑閫夋嫨鐢ㄦ埛 + */ +function handleUserModal() { + userModalApi.setData({}); + userModalApi.open(); +} + +/** + * 鏇存柊閫夋嫨鐨勭敤鎴� + * @param user + */ +async function updateUserSelect(user: any) { + await formApi.setValues({ 'itmUser': user.userId, 'itmUserName': user.nickName }); +} +</script> + +<template> + <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> + <BasicForm> + <template #orderName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleOrderModal" v-bind="slotProps" /> + </template> + <template #itmUserName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleUserModal" v-bind="slotProps" /> + </template> + </BasicForm> + <OrderModal class="w-[1200px]" @update-select="updateOrderSelect" /> + <UserModal class="w-[1200px]" @select-user="updateUserSelect" /> + </BasicDrawer> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-plan/data.tsx b/eims-ui/apps/web-antd/src/views/eims/maint-plan/data.tsx new file mode 100644 index 0000000..b96fefd --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-plan/data.tsx @@ -0,0 +1,278 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { DictEnum } from '@vben/constants'; +import { getPopupContainer } from '@vben/utils'; + +import { type FormSchemaGetter } from '#/adapter/form'; +import { getDictOptions } from '#/utils/dict'; +import { renderDict } from '#/utils/render'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'Input', + fieldName: 'assetNo', + label: '璧勪骇缂栧彿' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.EIMS_MAINT_TYPE) + }, + fieldName: 'maintType', + label: '淇濆吇绫诲瀷' + }, + { + component: 'TreeSelect', + // 鍦╠rawer閲屾洿鏂� 杩欓噷涓嶉渶瑕侀粯璁ょ殑componentProps + defaultValue: undefined, + fieldName: 'maintDept', + label: '淇濆吇閮ㄩ棬', + + }, + { + component: 'Select', + componentProps: { + allowClear: true, + showSearch: true, + getPopupContainer + }, + fieldName: 'maintUser', + label: '淇濆吇浜�', + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.MAINT_TIME_RULE) + }, + fieldName: 'maintRule', + label: '璁$畻瑙勫垯' + }, + { + component: 'Select', + componentProps: { + options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE) + }, + fieldName: 'status', + label: '鐘舵��' + }, +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60, fixed: 'left' }, + { + title: '璁惧鍚嶇О', + field: 'equName', + minWidth: 200, + fixed: 'left' + }, + { + title: '璧勪骇缂栧彿', + field: 'assetNo', + minWidth: 160 + }, + { + title: '鐘舵��', + field: 'status', + minWidth: 80, + slots: { + default: ({ row }) => { + return renderDict(row.status, DictEnum.SYS_NORMAL_DISABLE); + } + } + }, + { + title: '淇濆吇绫诲瀷', + field: 'maintType', + minWidth: 120, + slots: { + default: ({ row }) => { + return renderDict(row.maintType, DictEnum.EIMS_MAINT_TYPE); + } + } + }, + { + title: '淇濆吇浜�', + field: 'maintUserName', + minWidth: 100 + }, + { + title: '寰幆鍛ㄦ湡', + field: 'maintCycleUnitName', + minWidth: 80 + }, + { + title: '鏃堕棿璁$畻瑙勫垯', + field: 'maintRule', + minWidth: 140, + slots: { + default: ({ row }) => { + return renderDict(row.maintRule, DictEnum.MAINT_TIME_RULE); + } + } + }, + { + title: '棣栨鎵ц鏃堕棿', + field: 'maintFirstTime', + minWidth: 160 + }, + { + title: '涓婃鎵ц鏃堕棿', + field: 'maintLastTime', + minWidth: 160 + }, + { + title: '涓嬫鎵ц鏃堕棿', + field: 'maintNextTime', + minWidth: 160 + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '鎿嶄綔', + width: 200 + } +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'id' + }, + { + component: 'Input', + fieldName: 'equId', + label: '璁惧id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.EIMS_MAINT_TYPE), + optionType: 'button' + }, + fieldName: 'maintType', + defaultValue: '1', + label: '淇濆吇绫诲瀷' + }, + { + component: 'InputNumber', + fieldName: 'maintCycle', + label: '淇濆吇鍛ㄦ湡', + formItemClass: 'col-span-1', + componentProps: { + min: 1 + } + }, + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.MAINT_CYCLE_UNIT) + }, + fieldName: 'maintCycleUnit', + formItemClass: 'col-span-1 w-[80px]', + labelWidth: 0, + label: '' + }, + + { + component: 'Select', + componentProps: { + getPopupContainer, + options: getDictOptions(DictEnum.MAINT_TIME_RULE) + }, + fieldName: 'maintRule', + label: '淇濆吇瑙勫垯 ' + }, + { + component: 'Input', + fieldName: 'maintUser', + label: '鐢ㄦ埛id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'maintUserName', + label: '淇濆吇浜�' + }, + { + component: 'Input', + fieldName: 'maintDept', + label: '閮ㄩ棬id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'RadioGroup', + componentProps: { + buttonStyle: 'solid', + options: getDictOptions(DictEnum.SYS_NORMAL_DISABLE), + optionType: 'button' + }, + fieldName: 'status', + defaultValue: '0', + label: '鐘舵��' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + showTime: false, + valueFormat: 'YYYY-MM-DD', + getPopupContainer + }, + fieldName: 'maintFirstTime', + label: '棣栨鎵ц鏃堕棿' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + showTime: false, + valueFormat: 'YYYY-MM-DD', + getPopupContainer + }, + fieldName: 'maintLastTime', + label: '涓婃鎵ц鏃堕棿' + }, + { + component: 'DatePicker', + componentProps: { + format: 'YYYY-MM-DD', + showTime: false, + valueFormat: 'YYYY-MM-DD', + getPopupContainer + }, + fieldName: 'maintNextTime', + label: '涓嬫鎵ц鏃堕棿', + }, + { + component: 'Textarea', + fieldName: 'remark', + label: '澶囨敞' + } +]; diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-plan/index.vue b/eims-ui/apps/web-antd/src/views/eims/maint-plan/index.vue new file mode 100644 index 0000000..ff7c4d5 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-plan/index.vue @@ -0,0 +1,293 @@ +<script setup lang="ts"> +import type { Recordable } from '@vben/types'; + +import { onMounted, ref } from 'vue'; + +import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { addFullName, getPopupContainer, getVxePopupContainer } from '@vben/utils'; + +import { Dropdown, Menu, MenuItem, Modal, Popconfirm, Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { delMaintPlan, listMaintPlan, maintPlanExport } from '#/api/eims/maint-plan'; +import { listMaintStand } from '#/api/eims/maint-stand'; +import { generateCode } from '#/api/eims/utils'; +import { getDeptTree, userList } from '#/api/system/user'; +import { MAINT_ORDER_STATUS } from '#/constants/dict'; +import { commonDownloadExcel } from '#/utils/file/download'; +import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; +import maintOrderDrawer from '#/views/eims/maint-order/maint-order-drawer.vue'; +import { columns as maintSrandCol } from '#/views/eims/maint-stand/data'; + +import { columns, querySchema } from './data'; +import maintPlanDrawer from './maint-plan-drawer.vue'; + +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + componentProps: { + allowClear: true + } + }, + collapsed: true, + schema: querySchema(), + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' +}; + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + return await listMaintPlan({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: 'maint-plan-index' +}; +const equId = ref<string>(); +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams), + cellClick: (e: any) => { + const { row } = e; + equId.value = row.equId; + } + } +}); + +const [MaintPlanDrawer, maintPlanDrawerApi] = useVbenDrawer({ + connectedComponent: maintPlanDrawer +}); + +const [MaintOrderDrawer, maintOrderDrawerApi] = useVbenDrawer({ + connectedComponent: maintOrderDrawer, +}); + +function handleAdd() { + maintPlanDrawerApi.setData({}); + maintPlanDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + maintPlanDrawerApi.setData({ id: record.id }); + maintPlanDrawerApi.open(); +} + +async function handleDelete(row: Recordable<any>) { + await delMaintPlan(row.id); + await tableApi.query(); +} + +function handleMultiDelete() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id); + Modal.confirm({ + title: '鎻愮ず', + okType: 'danger', + content: `纭鍒犻櫎閫変腑鐨�${ids.length}鏉¤褰曞悧锛焋, + onOk: async () => { + await delMaintPlan(ids); + await tableApi.query(); + } + }); +} + +function handleDownloadExcel() { + commonDownloadExcel(maintPlanExport, '淇濆吇璁″垝璁板綍', tableApi.formApi.form.values, { + fieldMappingTime: formOptions.fieldMappingTime + }); +} + +/** + * 鐢熸垚淇濆吇宸ュ崟 + * @param record + */ +async function handleAddOrder(record: Recordable<any>) { + /** + * 鐢熸垚淇濆吇宸ュ崟code + */ + const code = await generateCode('BYYJ'); + if (!code) { + Modal.error({ + content: '鐢熸垚淇濆吇宸ュ崟澶辫触锛岃閲嶈瘯锛�', + title: '鎻愮ず' + }); + return false; + } + const planOrder = { + equId: record.equId, + equName: record.equName, + maintUser: record.maintUser, + maintUserName: record.maintUserName, + maintDept: record.maintDept, + maintDeptName: record.maintDeptName, + maintType: record.maintType, + planTime: record.maintNextTime, + status: MAINT_ORDER_STATUS.DAIBAOYANG, + maintCode: code + }; + + maintOrderDrawerApi.setData({ planOrder }); + maintOrderDrawerApi.open(); + // await addMaintOrder(order.value); +} +/** + * 鍒濆鍖栭儴闂ㄩ�夋嫨 + */ +async function setupDeptSelect() { + // updateSchema + const deptTree = await getDeptTree(); + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� 鍗崇埗鑺傜偣 / 瀛愯妭鐐� + addFullName(deptTree, 'label', ' / '); + tableApi.formApi.updateSchema([ + { + componentProps: (formModel) => ({ + class: 'w-full', + fieldNames: { + key: 'id', + value: 'id', + children: 'children' + }, + getPopupContainer, + async onSelect(deptId: number | string) { + /** 鏍规嵁閮ㄩ棬ID鍔犺浇鐢ㄦ埛 */ + await setupUserOptions(deptId); + /** 鍙樺寲鍚庨渶瑕侀噸鏂伴�夋嫨鐢ㄦ埛 */ + formModel.maintUser = undefined; + }, + placeholder: '璇烽�夋嫨', + showSearch: true, + treeData: deptTree, + treeDefaultExpandAll: true, + treeLine: { showLeafIcon: false }, + // 绛涢�夌殑瀛楁 + treeNodeFilterProp: 'label', + // 閫変腑鍚庢樉绀哄湪杈撳叆妗嗙殑鍊� + treeNodeLabelProp: 'fullName' + }), + fieldName: 'maintDept' + } + ]); +} + +/** + * 鐢ㄦ埛鐨勫姞杞� + */ +async function setupUserOptions(deptId: any) { + const params = { deptId }; + const userPageResult = await userList({ + pageNum: 1, + pageSize: 500, + ...params + }); + const options = userPageResult.rows.map((item) => ({ + label: item.nickName || item.userName, + value: item.userId + })); + // 绛涢�� + const filterOption = (input: string, option: any) => { + return option.label.toLowerCase().includes(input.toLowerCase()); + }; + + const placeholder = options.length > 0 ? '璇烽�夋嫨' : '璇ラ儴闂ㄤ笅鏆傛棤鐢ㄦ埛'; + tableApi.formApi.updateSchema([ + { + componentProps: { options, placeholder, filterOption }, + fieldName: 'maintUser' + } + ]); +} + +onMounted(async () => { + await setupDeptSelect(); +}); +</script> + +<template> + <Page :auto-content-height="true"> + <div class="flex h-full gap-[8px] flex-col"> + <BasicTable class="h-2/3" table-title="淇濆吇璁″垝鍒楄〃"> + <template #toolbar-tools> + <Space> + <a-button v-access:code="['eims:maintPlan:export']" @click="handleDownloadExcel"> + {{ $t('pages.common.export') }} + </a-button> + <a-button + :disabled="!vxeCheckboxChecked(tableApi)" + danger + type="primary" + v-access:code="['eims:maintPlan:remove']" + @click="handleMultiDelete" + > + {{ $t('pages.common.delete') }} + </a-button> + <a-button type="primary" v-access:code="['eims:maintPlan:add']" @click="handleAdd"> + {{ $t('pages.common.add') }} + </a-button> + </Space> + </template> + + <template #equName="{ row }"> + <Space> + <span>{{ row.equName }}</span> + </Space> + </template> + + <template #action="{ row }"> + <Space> + <ghost-button class="btn-success" v-access:code="['eims:maintPlan:edit']" @click.stop="handleAddOrder(row)"> 鐢熸垚宸ュ崟 </ghost-button> + <ghost-button v-access:code="['eims:maintPlan:edit']" @click.stop="handleEdit(row)"> + {{ $t('pages.common.edit') }} + </ghost-button> + </Space> + <Dropdown :get-popup-container="getVxePopupContainer" placement="bottomRight"> + <template #overlay> + <Menu> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> + <MenuItem key="1" @click.stop=""> + {{ $t('pages.common.delete') }} + </MenuItem> + </Popconfirm> + </Menu> + </template> + <a-button size="small" type="link" v-access:code="['eims:maintPlan:remove']"> + {{ $t('pages.common.more') }} + </a-button> + </Dropdown> + </template> + </BasicTable> + <BasisSubTable :columns="maintSrandCol" :list-api="listMaintStand" :req-value="equId" class="h-1/3" req-key="equId" title="淇濆吇瀹炴柦椤圭洰" /> + </div> + <MaintPlanDrawer @reload="tableApi.query()" /> + <MaintOrderDrawer @reload="tableApi.query()" /> + </Page> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-plan/maint-plan-drawer.vue b/eims-ui/apps/web-antd/src/views/eims/maint-plan/maint-plan-drawer.vue new file mode 100644 index 0000000..9f094eb --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-plan/maint-plan-drawer.vue @@ -0,0 +1,154 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; + +import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { addFullName, cloneDeep, getPopupContainer } from '@vben/utils'; + +import { InputSearch } from 'ant-design-vue'; + +import { useVbenForm } from '#/adapter/form'; +import { addMaintPlan, getMaintPlan, updateMaintPlan } from '#/api/eims/maint-plan'; +import { getDeptTree, userList } from '#/api/system/user'; +import equModal from '#/views/eims/components/equ-modal.vue'; +import userModal from '#/views/eims/components/user-modal.vue'; + +import { drawerSchema } from './data'; + +const emit = defineEmits<{ reload: [] }>(); + +const isUpdate = ref(false); +const title = computed(() => { + return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); +}); + +const [BasicForm, formApi] = useVbenForm({ + commonConfig: { + formItemClass: 'col-span-2', + componentProps: { + class: 'w-full' + }, + labelWidth: 120 + }, + layout: 'horizontal', + fieldMappingTime: [['field4', ['phoneType', 'phoneNumber'], null]], + schema: drawerSchema(), + showDefaultActions: false, + wrapperClass: 'grid-cols-2' +}); + +const [BasicDrawer, drawerApi] = useVbenDrawer({ + onCancel: handleCancel, + onConfirm: handleConfirm, + async onOpenChange(isOpen) { + if (!isOpen) { + return null; + } + drawerApi.drawerLoading(true); + const { id } = drawerApi.getData() as { id?: number | string }; + isUpdate.value = !!id; + + formApi.updateSchema([ + { + dependencies: { + show: () => isUpdate.value, + triggerFields: [''] + }, + fieldName: 'maintLastTime' + }, + { + dependencies: { + show: () => isUpdate.value, + triggerFields: [''] + }, + fieldName: 'maintNextTime' + } + ]); + // 鏇存柊 && 璧嬪�� + if (isUpdate.value && id) { + const record = await getMaintPlan(id); + await formApi.setValues(record); + } + + drawerApi.drawerLoading(false); + } +}); + +async function handleConfirm() { + try { + drawerApi.drawerLoading(true); + const { valid } = await formApi.validate(); + if (!valid) { + return; + } + const data = cloneDeep(await formApi.getValues()); + await (isUpdate.value ? updateMaintPlan(data) : addMaintPlan(data)); + emit('reload'); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + drawerApi.drawerLoading(false); + } +} + +async function handleCancel() { + drawerApi.close(); + await formApi.resetForm(); +} + +// equ modal +const [EquModal, equModalApi] = useVbenModal({ + connectedComponent: equModal, + draggable: true, + title: '閫夋嫨璁惧' +}); + +function handleEquModal() { + equModalApi.setData({}); + equModalApi.open(); +} + +// user modal +const [UserModal, userModalApi] = useVbenModal({ + connectedComponent: userModal, + draggable: true, + title: '閫夋嫨淇濆吇浜�' +}); + +function handleUserModal() { + userModalApi.setData({}); + userModalApi.open(); +} + +/** + * 鏇存柊閫夋嫨鐨勮澶� + * @param equ + */ +async function updateEqu(equ: any) { + await formApi.setValues(equ); +} + +/** + * 鏇存柊閫夋嫨鐨勭敤鎴� + * @param user + */ +async function updateUser(user: any) { + await formApi.setValues({ 'maintUserName': user.nickName, 'maintUser': user.userId, 'maintDept': user.deptId }); +} +</script> + +<template> + <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> + <BasicForm> + <template #equName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleEquModal" v-bind="slotProps" /> + </template> + <template #maintUserName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleUserModal" v-bind="slotProps" /> + </template> + </BasicForm> + <EquModal class="w-[1200px]" @update-equ="updateEqu" /> + <UserModal class="w-[1200px]" @select-user="updateUser" /> + </BasicDrawer> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-stand/data.tsx b/eims-ui/apps/web-antd/src/views/eims/maint-stand/data.tsx new file mode 100644 index 0000000..bf209fb --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-stand/data.tsx @@ -0,0 +1,111 @@ +import type { VxeGridProps } from '#/adapter/vxe-table'; + +import { type FormSchemaGetter } from '#/adapter/form'; + +export const querySchema: FormSchemaGetter = () => [ + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'Input', + fieldName: 'assetNo', + label: '璧勪骇缂栧彿' + } +]; + +export const columns: VxeGridProps['columns'] = [ + { type: 'checkbox', width: 60, fixed: 'left' }, + { + title: '璁惧鍚嶇О', + field: 'equName', + minWidth: 200, + fixed: 'left', + slots: { default: 'equName' } + }, + { + title: '璧勪骇缂栧彿', + field: 'assetNo', + minWidth: 160 + }, + { + title: '淇濆吇椤圭洰', + field: 'name', + minWidth: 300 + }, + { + title: '椤圭洰鏍囧噯', + field: 'stand', + minWidth: 200 + }, + { + field: 'action', + fixed: 'right', + slots: { default: 'action' }, + title: '鎿嶄綔', + width: 200 + } +]; + +export const drawerSchema: FormSchemaGetter = () => [ + { + component: 'Input', + dependencies: { + show: () => false, + triggerFields: [''] + }, + fieldName: 'id' + }, + { + component: 'Input', + fieldName: 'equId', + label: '璁惧id', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'equCode', + label: '璁惧缂栫爜', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'assetNo', + label: '璧勪骇缂栧彿', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'modelNo', + label: '璁惧鍨嬪彿', + dependencies: { + show: () => false, + triggerFields: [''] + } + }, + { + component: 'Input', + fieldName: 'equName', + label: '璁惧鍚嶇О' + }, + { + component: 'Textarea', + fieldName: 'name', + label: '瀹炴柦椤圭洰' + }, + { + component: 'Textarea', + fieldName: 'stand', + label: '瀹炴柦鏍囧噯' + } +]; diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-stand/index.vue b/eims-ui/apps/web-antd/src/views/eims/maint-stand/index.vue new file mode 100644 index 0000000..d399899 --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-stand/index.vue @@ -0,0 +1,159 @@ +<script setup lang="ts"> +import type { Recordable } from '@vben/types'; + +import { Page, useVbenDrawer, type VbenFormProps } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { getVxePopupContainer } from '@vben/utils'; + +import { Modal, Popconfirm, Space } from 'ant-design-vue'; + +import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { delMaintStand, listMaintStand, maintStandExport } from '#/api/eims/maint-stand'; +import { commonDownloadExcel } from '#/utils/file/download'; + +import { columns, querySchema } from './data'; +import maintStandDrawer from './maint-stand-drawer.vue'; + +const formOptions: VbenFormProps = { + commonConfig: { + labelWidth: 80, + componentProps: { + allowClear: true + } + }, + schema: querySchema(), + wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4' +}; + +const gridOptions: VxeGridProps = { + checkboxConfig: { + // 楂樹寒 + highlight: true, + // 缈婚〉鏃朵繚鐣欓�変腑鐘舵�� + reserve: true + // 鐐瑰嚮琛岄�変腑 + // trigger: 'row' + }, + columns, + height: 'auto', + keepSource: true, + pagerConfig: {}, + proxyConfig: { + ajax: { + query: async ({ page }, formValues = {}) => { + return await listMaintStand({ + pageNum: page.currentPage, + pageSize: page.pageSize, + ...formValues + }); + } + } + }, + rowConfig: { + isHover: true, + keyField: 'id' + }, + sortConfig: { + // 杩滅▼鎺掑簭 + remote: true, + // 鏀寔澶氬瓧娈垫帓搴� 榛樿鍏抽棴 + multiple: true + }, + id: 'maint-stand-index' +}; + +const [BasicTable, tableApi] = useVbenVxeGrid({ + formOptions, + gridOptions, + gridEvents: { + sortChange: (sortParams) => vxeSortEvent(tableApi, sortParams) + } +}); + +const [MaintStandDrawer, maintStandDrawerApi] = useVbenDrawer({ + connectedComponent: maintStandDrawer +}); + +function handleAdd() { + maintStandDrawerApi.setData({}); + maintStandDrawerApi.open(); +} + +async function handleEdit(record: Recordable<any>) { + maintStandDrawerApi.setData({ id: record.id }); + maintStandDrawerApi.open(); +} + +async function handleDelete(row: Recordable<any>) { + await delMaintStand(row.id); + await tableApi.query(); +} + +function handleMultiDelete() { + const rows = tableApi.grid.getCheckboxRecords(); + const ids = rows.map((row: any) => row.id); + Modal.confirm({ + title: '鎻愮ず', + okType: 'danger', + content: `纭鍒犻櫎閫変腑鐨�${ids.length}鏉¤褰曞悧锛焋, + onOk: async () => { + await delMaintStand(ids); + await tableApi.query(); + } + }); +} + +function handleDownloadExcel() { + commonDownloadExcel(maintStandExport, '淇濆吇鏍囧噯璁板綍', tableApi.formApi.form.values, { + fieldMappingTime: formOptions.fieldMappingTime + }); +} +</script> + +<template> + <Page :auto-content-height="true"> + <div class="flex h-full gap-[8px]"> + <BasicTable class="flex-1 overflow-hidden" table-title="淇濆吇鏍囧噯鍒楄〃"> + <template #toolbar-tools> + <Space> + <a-button v-access:code="['eims:maintStand:export']" @click="handleDownloadExcel"> + {{ $t('pages.common.export') }} + </a-button> + <a-button + :disabled="!vxeCheckboxChecked(tableApi)" + danger + type="primary" + v-access:code="['eims:maintStand:remove']" + @click="handleMultiDelete" + > + {{ $t('pages.common.delete') }} + </a-button> + <a-button type="primary" v-access:code="['eims:maintStand:add']" @click="handleAdd"> + {{ $t('pages.common.add') }} + </a-button> + </Space> + </template> + + <template #equName="{ row }"> + <Space> + <span>{{ row.equName }}</span> + </Space> + </template> + + <template #action="{ row }"> + <Space> + <ghost-button v-access:code="['eims:maintStand:edit']" @click.stop="handleEdit(row)"> + {{ $t('pages.common.edit') }} + </ghost-button> + <Popconfirm :get-popup-container="getVxePopupContainer" placement="left" title="纭鍒犻櫎锛�" @confirm="handleDelete(row)"> + <ghost-button danger v-access:code="['eims:maintStand:remove']" @click.stop=""> + {{ $t('pages.common.delete') }} + </ghost-button> + </Popconfirm> + </Space> + </template> + </BasicTable> + </div> + <MaintStandDrawer @reload="tableApi.query()" /> + </Page> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/maint-stand/maint-stand-drawer.vue b/eims-ui/apps/web-antd/src/views/eims/maint-stand/maint-stand-drawer.vue new file mode 100644 index 0000000..1e430fd --- /dev/null +++ b/eims-ui/apps/web-antd/src/views/eims/maint-stand/maint-stand-drawer.vue @@ -0,0 +1,111 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; + +import { useVbenDrawer, useVbenModal } from '@vben/common-ui'; +import { $t } from '@vben/locales'; +import { cloneDeep } from '@vben/utils'; + +import { InputSearch } from 'ant-design-vue'; + +import { useVbenForm } from '#/adapter/form'; +import { addMaintStand, getMaintStand, updateMaintStand } from '#/api/eims/maint-stand'; + +import equModal from '#/views/eims/components/equ-modal.vue'; + +import { drawerSchema } from './data'; +import type { MaintStandVO } from '#/api/eims/maint-stand/model'; + +const emit = defineEmits<{ reload: [] }>(); + +const isUpdate = ref(false); +const title = computed(() => { + return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); +}); + +const [BasicForm, formApi] = useVbenForm({ + commonConfig: { + formItemClass: 'col-span-2', + componentProps: { + class: 'w-full' + }, + labelWidth: 120 + }, + schema: drawerSchema(), + showDefaultActions: false, + wrapperClass: 'grid-cols-2' +}); + +const [BasicDrawer, drawerApi] = useVbenDrawer({ + onCancel: handleCancel, + onConfirm: handleConfirm, + async onOpenChange(isOpen) { + if (!isOpen) { + return null; + } + drawerApi.drawerLoading(true); + const { id } = drawerApi.getData() as { id?: number | string }; + isUpdate.value = !!id; + // 鏇存柊 && 璧嬪�� + if (isUpdate.value && id) { + const record = await getMaintStand(id); + await formApi.setValues(record); + } + + drawerApi.drawerLoading(false); + } +}); + +async function handleConfirm() { + try { + drawerApi.drawerLoading(true); + const { valid } = await formApi.validate(); + if (!valid) { + return; + } + const data = cloneDeep(await formApi.getValues()); + await (isUpdate.value ? updateMaintStand(data) : addMaintStand(data)); + emit('reload'); + await handleCancel(); + } catch (error) { + console.error(error); + } finally { + drawerApi.drawerLoading(false); + } +} + +async function handleCancel() { + drawerApi.close(); + await formApi.resetForm(); +} + +// equ modal +const [EquModal, equModalApi] = useVbenModal({ + connectedComponent: equModal, + draggable: true, + title: '閫夋嫨璁惧' +}); + +function handleEquModal() { + equModalApi.setData({}); + equModalApi.open(); +} + +/** + * 鏇存柊閫夋嫨鐨勮澶� + * @param equ + */ +async function updateSelect(equ: any) { + await formApi.setValues(equ); +} +</script> + +<template> + <BasicDrawer :close-on-click-modal="false" :title="title" class="w-[600px]"> + <BasicForm> + <template #equName="slotProps"> + <InputSearch :enter-button="true" placeholder="璇烽�夋嫨" @search="handleEquModal" v-bind="slotProps" /> + </template> + </BasicForm> + <EquModal class="w-[1200px]" @update-equ="updateSelect" /> + </BasicDrawer> +</template> diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx b/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx index f6ce668..4946d81 100644 --- a/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx +++ b/eims-ui/apps/web-antd/src/views/eims/repair-req/data.tsx @@ -79,6 +79,23 @@ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60, fixed: 'left' }, { + title: '璁惧(宸ュ叿)鍚嶇О', + sortable: true, + minWidth: 150, + fixed: 'left', + slots: { + default: ({ row }) => { + if (row.reqType === REPAIR_REQ_TYPE.EQU) { + return row.equName; + } else if (row.reqType === REPAIR_REQ_TYPE.FIXTURE) { + return row.fixtureName; + } else { + return ''; + } + } + } + }, + { title: '鎶ヤ慨鍗曞彿', field: 'code', minWidth: 160, @@ -116,22 +133,6 @@ field: 'reqTime', sortable: true, minWidth: 200 - }, - { - title: '璁惧(宸ュ叿)鍚嶇О', - sortable: true, - minWidth: 150, - slots: { - default: ({ row }) => { - if (row.reqType === REPAIR_REQ_TYPE.EQU) { - return row.equName; - } else if (row.reqType === REPAIR_REQ_TYPE.FIXTURE) { - return row.fixtureName; - } else { - return ''; - } - } - } }, { title: '鏁呴殰绫诲埆', diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-res/data.tsx b/eims-ui/apps/web-antd/src/views/eims/repair-res/data.tsx index 3f5d7b4..0913dd9 100644 --- a/eims-ui/apps/web-antd/src/views/eims/repair-res/data.tsx +++ b/eims-ui/apps/web-antd/src/views/eims/repair-res/data.tsx @@ -50,6 +50,33 @@ export const columns: VxeGridProps['columns'] = [ { type: 'checkbox', width: 60, fixed: 'left' }, { + title: '璁惧(宸ュ叿)鍚嶇О', + sortable: true, + minWidth: 150, + fixed: 'left', + slots: { + default: ({ row }) => { + if (!row.reqType) { + return ''; + } + + // 鏍规嵁涓嶅悓鐨勮姹傜被鍨嬭繑鍥炵浉搴旂殑鍚嶇О + switch (row.reqType) { + case REPAIR_REQ_TYPE.EQU: { + return row.equName; + } + case REPAIR_REQ_TYPE.FIXTURE: { + return row.fixtureName; + } + default: { + // 濡傛灉璇锋眰绫诲瀷鏃笉鏄� EQU 涔熶笉鏄� FIXTURE锛屽垯杩斿洖绌哄瓧绗︿覆 + return ''; + } + } + } + } + }, + { title: '缁翠慨鍗曞彿', field: 'resCode', minWidth: 160, @@ -103,32 +130,6 @@ field: 'reqTime', sortable: true, minWidth: 200 - }, - { - title: '璁惧(宸ュ叿)鍚嶇О', - sortable: true, - minWidth: 150, - slots: { - default: ({ row }) => { - if (!row.reqType) { - return ''; - } - - // 鏍规嵁涓嶅悓鐨勮姹傜被鍨嬭繑鍥炵浉搴旂殑鍚嶇О - switch (row.reqType) { - case REPAIR_REQ_TYPE.EQU: { - return row.equName; - } - case REPAIR_REQ_TYPE.FIXTURE: { - return row.fixtureName; - } - default: { - // 濡傛灉璇锋眰绫诲瀷鏃笉鏄� EQU 涔熶笉鏄� FIXTURE锛屽垯杩斿洖绌哄瓧绗︿覆 - return ''; - } - } - } - } }, { title: '鏁呴殰绫诲埆', diff --git a/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue b/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue index 5a7d45b..226fdcf 100644 --- a/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue +++ b/eims-ui/apps/web-antd/src/views/eims/repair-res/index.vue @@ -12,17 +12,18 @@ import { Modal, Popconfirm, Space } from 'ant-design-vue'; import { useVbenVxeGrid, vxeCheckboxChecked, type VxeGridProps, vxeSortEvent } from '#/adapter/vxe-table'; +import { listRepairRecord } from '#/api/eims/repair-record'; import { delRepairRes, listRepairRes, repairResExport } from '#/api/eims/repair-res'; import { getDeptTree, userList } from '#/api/system/user'; import { REPAIR_RES_STATUS } from '#/constants/dict'; import { commonDownloadExcel } from '#/utils/file/download'; +import BasisSubTable from '#/views/eims/components/basis-sub-table.vue'; -import RepairRecord from '../repair-record/index.vue'; +import fbPreviewDrawer from '../repair-fb/fb-preview-drawer.vue'; +import repairFbDrawer from '../repair-fb/repair-fb-drawer.vue'; +import { columns as repairRecordCol } from '../repair-record/data'; import { columns, querySchema } from './data'; import repairResDrawer from './repair-res-drawer.vue'; - -import repairFbDrawer from '../repair-fb/repair-fb-drawer.vue' -import fbPreviewDrawer from '../repair-fb/fb-preview-drawer.vue' const userStore = useUserStore(); const userId = userStore.userInfo?.userId; @@ -106,7 +107,7 @@ }); function handleAddFb(record: Recordable<any>) { - repairFbDrawerApi.setData({ resId: record.id, resCode: record.resCode, fbUser: userId, fbDept: deptId}); + repairFbDrawerApi.setData({ resId: record.id, resCode: record.resCode, fbUser: userId, fbDept: deptId }); repairFbDrawerApi.open(); } @@ -114,7 +115,6 @@ fbPreviewDrawerApi.setData({ id: record.fbId }); fbPreviewDrawerApi.open(); } - function handleAdd() { repairResDrawerApi.setData({ resUser: userId, resDept: deptId }); @@ -133,22 +133,22 @@ const { hasAccessByRoles } = useAccess(); const isSuperAdmin = computed(() => hasAccessByRoles(['superadmin'])); - +const isLeader = computed(() => hasAccessByRoles(['leader'])); function pingjiaAdd(row: any) { - return (isSuperAdmin.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && !row.fbId; + return (isSuperAdmin.value || isLeader.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && !row.fbId; } function pingjiaDetail(row: any) { - return (isSuperAdmin.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && row.fbId; + return (isSuperAdmin.value || isLeader.value || row.reqUser === userId) && row.status === REPAIR_RES_STATUS.WANCHENG && row.fbId; } function weixiu(row: any) { - return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.YIJIEDAN; + return (isSuperAdmin.value || isLeader.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.YIJIEDAN; } function wancheng(row: any) { - return (isSuperAdmin.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.WEIXIU; + return (isSuperAdmin.value || isLeader.value || row.resUser === userId) && row.status === REPAIR_RES_STATUS.WEIXIU; } async function handleDelete(row: Recordable<any>) { @@ -272,8 +272,12 @@ <template #action="{ row }"> <Space> - <ghost-button v-if="pingjiaAdd(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleAddFb(row)"> 璇勪环 </ghost-button> - <ghost-button v-if="pingjiaDetail(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleDetailFb(row)"> 闃呰瘎 </ghost-button> + <ghost-button v-if="pingjiaAdd(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleAddFb(row)"> + 璇勪环 + </ghost-button> + <ghost-button v-if="pingjiaDetail(row)" class="btn-success" v-access:code="['eims:repairRes:edit']" @click.stop="handleDetailFb(row)"> + 闃呰瘎 + </ghost-button> <ghost-button v-if="weixiu(row)" class="btn-success" @@ -303,7 +307,7 @@ </Space> </template> </BasicTable> - <RepairRecord :res-id="resId" class="h-1/3" table-title="缁翠慨璁板綍" /> + <BasisSubTable :columns="repairRecordCol" :list-api="listRepairRecord" :req-value="resId" class="h-1/3" req-key="resId" title="鎿嶄綔璁板綍" /> </div> <RepairResDrawer @reload="tableApi.query()" /> <RepairFbDrawer @reload="tableApi.query()" /> diff --git a/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts b/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts index a1bfb45..1e5e3a5 100644 --- a/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts +++ b/eims-ui/packages/@core/base/shared/src/constants/dict-enum.ts @@ -3,9 +3,14 @@ EIMS_FIXTURE_STATUS = 'eims_fixture_status', // 宸ュ叿锛堟不鍏凤級鐘舵�� EIMS_INVENTORY_DETAIL_STATU = 'inventory_detail_statu', // 璁惧鐩樼偣鐘舵�� EIMS_INVENTORY_STATU = 'inventory_statu', // 璁惧鐩樼偣鐘舵�� + EIMS_MAINT_TYPE = 'eims_maint_type', // 淇濆吇绫诲瀷 + EIMS_ORDITM_STATUS = 'eims_orditm_status', // 淇濆吇宸ュ崟鏄庣粏瀹屾垚鐘舵�� EQU_IMPORT_STATU = 'equ_import_status', // 璁惧瀵煎叆鐘舵�� FIXTURE_BORROW_RECORD_STATUS = 'fixture_borrow_record_status', // 宸ュ叿锛堟不鍏凤級鍊熺敤璁板綍鐘舵�� FIXTURE_BORROW_STATUS = 'fixture_borrow_status', // 宸ュ叿锛堟不鍏凤級鍊熺敤鐘舵�� + MAINT_CYCLE_UNIT = 'maint_cycle_unit', // 淇濆吇鍛ㄦ湡鍗曚綅 + MAINT_ORDER_STATUS = 'maint_order_status', // 淇濆吇宸ュ崟鐘舵�� + MAINT_TIME_RULE = 'maint_time_rule', // 淇濆吇瑙勫垯 REPAIR_FAULT_TYPE = 'repair_fault_type', // 鎶ヤ慨鐘舵�� REPAIR_RECORD_HANDLE = 'repair_record_handle', // 缁翠慨璁板綍鎿嶄綔 REPAIR_REQ_STATUS = 'repair_req_status', // 鎶ヤ慨鐘舵�� diff --git a/eims/ruoyi-admin/src/main/resources/application-dev.yml b/eims/ruoyi-admin/src/main/resources/application-dev.yml index 4ca327a..a2da72f 100644 --- a/eims/ruoyi-admin/src/main/resources/application-dev.yml +++ b/eims/ruoyi-admin/src/main/resources/application-dev.yml @@ -13,7 +13,7 @@ --- # snail-job 閰嶇疆 snail-job: - enabled: false + enabled: true # 闇�瑕佸湪 SnailJob 鍚庡彴缁勭鐞嗗垱寤哄搴斿悕绉扮殑缁�,鐒跺悗鍒涘缓浠诲姟鐨勬椂鍊欓�夋嫨瀵瑰簲鐨勭粍,鎵嶈兘姝g‘鍒嗘淳浠诲姟 group: "ruoyi_group" # SnailJob 鎺ュ叆楠岃瘉浠ょ墝 璇﹁ script/sql/snail_job.sql `sj_group_config` 琛� diff --git a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java index 878a0bb..bb8dca6 100644 --- a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java +++ b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/constant/DictConstants.java @@ -19,6 +19,7 @@ * 鎶ヤ慨鐘舵�� */ String REPAIR_REQ_STATUS = "repair_req_status"; + interface REPAIR_REQ_STATUS_DETAIL { /** * 宸叉帴鍗� @@ -38,6 +39,7 @@ * 缁翠慨宸ュ崟鐘舵�� */ String REPAIR_RES_STATUS = "repair_res_status"; + interface REPAIR_RES_STATUS_DETAIL { /** * 鎺ュ崟 @@ -58,6 +60,7 @@ * 缁翠慨宸ュ崟鐘舵�� */ String REPAIR_RECORD_HANDLE = "repair_record_handle"; + interface REPAIR_RECORD_HANDLE_DETAIL { /** * 鏂板 @@ -79,4 +82,63 @@ String WANCHENG = "4"; } + /** + * 淇濆吇鏃堕棿璁$畻瑙勫垯 + */ + String MAINT_TIME_RULE = "maint_time_rule"; + + interface MAINT_TIME_RULE_DETAIL { + /** + * 鎸夊浐瀹氬懆鏈� + */ + String CYCLE = "0"; + /** + * 鎸変笂娆′繚鍏绘椂闂� + */ + String LAST = "1"; + } + + /** + * 绯荤粺鏄剧ず闅愯棌 + */ + String SYS_NORMAL_DISABLE = "sys_normal_disable"; + + interface SYS_NORMAL_DISABLE_DETAIL { + String NORMAL = "0"; + String DISABLE = "1"; + } + + /** + * 淇濆吇鏃堕棿鍗曚綅 + */ + String MAINT_CYCLE_UNIT = "maint_cycle_unit"; + + interface MAINT_CYCLE_UNIT_DETAIL { + String DAY = "1"; + String WEEK = "2"; + String MONTH = "3"; + String SEASON = "4"; + String YEAR = "5"; + } + + /** + * 淇濆吇宸ュ崟鐘舵�� + */ + String MAINT_ORDER_STATUS = "maint_order_status"; + + interface MAINT_ORDER_STATUS_DETAIL { + String BAOYANG = "1";// 淇濆吇缁� + String DAIBAOYANG = "0"; // 寰呬繚鍏� + String DAIYANZHENG = "2"; // 寰呴獙璇� + String WANCHENG = "3"; // 瀹屾垚 + } + + /** + * 淇濆吇宸ュ崟椤瑰畬鎴愮姸鎬� + */ + String EIMS_ORDITM_STATUS = "eims_orditm_status"; + interface EIMS_ORDITM_STATUS_DETAIL { + String WEIWANCHENG = "0";// 鏈畬鎴� + String YIWANCHENG = "1"; // 宸插畬鎴� + } } diff --git a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/MaintOrderService.java b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/MaintOrderService.java new file mode 100644 index 0000000..03d6000 --- /dev/null +++ b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/service/MaintOrderService.java @@ -0,0 +1,11 @@ +package org.dromara.common.core.service; + +public interface MaintOrderService { + /** + * 閫氳繃淇濆吇宸ュ崟ID鏌ヨ淇濆吇宸ュ崟code + * + * @param orderIds 淇濆吇宸ュ崟ID涓查�楀彿鍒嗛殧 + * @return 淇濆吇宸ュ崟鍚嶇О涓查�楀彿鍒嗛殧 + */ + String selectMaintOrderCodeByIds(String orderIds); +} diff --git a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java index 72178a7..e0f9ecd 100644 --- a/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java +++ b/eims/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java @@ -129,6 +129,13 @@ } /** + * 璁$畻鐩稿樊澶╂暟 + */ + public static int differentDays(Date date1, Date date2) { + return (int) ((date2.getTime() - date1.getTime()) / (1000 * 3600 * 24)); + } + + /** * 璁$畻涓や釜鏃堕棿宸� */ public static String getDatePoor(Date endDate, Date nowDate) { diff --git a/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/constant/TransConstant.java b/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/constant/TransConstant.java index 2f7f37c..697c3c1 100644 --- a/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/constant/TransConstant.java +++ b/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/constant/TransConstant.java @@ -60,4 +60,9 @@ */ String REPAIR_RES_ID_TO_CODE = "repair_res_id_to_code"; + /** + * 淇濆吇宸ュ崟id杞琧ode + */ + String MAINT_ORDER_ID_TO_CODE = "maint_order_id_to_code"; + } diff --git a/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/MaintOrderCodeTranslationImpl.java b/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/MaintOrderCodeTranslationImpl.java new file mode 100644 index 0000000..51fcf67 --- /dev/null +++ b/eims/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/impl/MaintOrderCodeTranslationImpl.java @@ -0,0 +1,30 @@ +package org.dromara.common.translation.core.impl; + +import lombok.AllArgsConstructor; +import org.dromara.common.core.service.MaintOrderService; +import org.dromara.common.core.service.RepairResService; +import org.dromara.common.translation.annotation.TranslationType; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.common.translation.core.TranslationInterface; + +/** + * 淇濆吇宸ュ崟id杞琧ode + * + * @author zhuguifei + */ +@AllArgsConstructor +@TranslationType(type = TransConstant.MAINT_ORDER_ID_TO_CODE) +public class MaintOrderCodeTranslationImpl implements TranslationInterface<String> { + + private final MaintOrderService orderService; + + @Override + public String translation(Object key, String other) { + if (key instanceof String ids) { + return orderService.selectMaintOrderCodeByIds(ids); + } else if (key instanceof Long id) { + return orderService.selectMaintOrderCodeByIds(id.toString()); + } + return null; + } +} diff --git a/eims/ruoyi-common/ruoyi-common-translation/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/eims/ruoyi-common/ruoyi-common-translation/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 427b607..fb76424 100644 --- a/eims/ruoyi-common/ruoyi-common-translation/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/eims/ruoyi-common/ruoyi-common-translation/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -10,3 +10,4 @@ org.dromara.common.translation.core.impl.FixtureNameTranslationImpl org.dromara.common.translation.core.impl.RepairReqCodeTranslationImpl org.dromara.common.translation.core.impl.RepairResCodeTranslationImpl +org.dromara.common.translation.core.impl.MaintOrderCodeTranslationImpl diff --git a/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-prod.yml b/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-prod.yml index 3ba983c..a69cbda 100644 --- a/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-prod.yml +++ b/eims/ruoyi-extend/ruoyi-snailjob-server/src/main/resources/application-prod.yml @@ -2,9 +2,9 @@ datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver - url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + url: jdbc:mysql://localhost:3306/eims?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true username: root - password: root + password: 123456 hikari: connection-timeout: 30000 validation-timeout: 5000 diff --git a/eims/ruoyi-modules/lb-eims/pom.xml b/eims/ruoyi-modules/lb-eims/pom.xml index e053d4f..1609192 100644 --- a/eims/ruoyi-modules/lb-eims/pom.xml +++ b/eims/ruoyi-modules/lb-eims/pom.xml @@ -102,5 +102,10 @@ <artifactId>ruoyi-system</artifactId> </dependency> + <dependency> + <groupId>org.dromara</groupId> + <artifactId>ruoyi-common-job</artifactId> + </dependency> + </dependencies> </project> diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrderController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrderController.java new file mode 100644 index 0000000..5610c22 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrderController.java @@ -0,0 +1,106 @@ +package org.dromara.eims.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.eims.domain.vo.EimsMaintOrderVo; +import org.dromara.eims.domain.bo.EimsMaintOrderBo; +import org.dromara.eims.service.IEimsMaintOrderService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 淇濆吇宸ュ崟 + * + * @author zhuguifei + * @date 2025-03-06 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/maintOrder") +public class EimsMaintOrderController extends BaseController { + + private final IEimsMaintOrderService eimsMaintOrderService; + + /** + * 鏌ヨ淇濆吇宸ュ崟鍒楄〃 + */ + @SaCheckPermission("eims:maintOrder:list") + @GetMapping("/list") + public TableDataInfo<EimsMaintOrderVo> list(EimsMaintOrderBo bo, PageQuery pageQuery) { +// return eimsMaintOrderService.queryPageList(bo, pageQuery); + return eimsMaintOrderService.queryPageListCustom(bo, pageQuery); + } + + /** + * 瀵煎嚭淇濆吇宸ュ崟鍒楄〃 + */ + @SaCheckPermission("eims:maintOrder:export") + @Log(title = "淇濆吇宸ュ崟", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EimsMaintOrderBo bo, HttpServletResponse response) { + List<EimsMaintOrderVo> list = eimsMaintOrderService.queryList(bo); + ExcelUtil.exportExcel(list, "淇濆吇宸ュ崟", EimsMaintOrderVo.class, response); + } + + /** + * 鑾峰彇淇濆吇宸ュ崟璇︾粏淇℃伅 + * + * @param id 涓婚敭 + */ + @SaCheckPermission("eims:maintOrder:query") + @GetMapping("/{id}") + public R<EimsMaintOrderVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long id) { + return R.ok(eimsMaintOrderService.queryById(id)); + } + + /** + * 鏂板淇濆吇宸ュ崟 + */ + @SaCheckPermission("eims:maintOrder:add") + @Log(title = "淇濆吇宸ュ崟", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsMaintOrderBo bo) { + return toAjax(eimsMaintOrderService.insertByBo(bo)); + } + + /** + * 淇敼淇濆吇宸ュ崟 + */ + @SaCheckPermission("eims:maintOrder:edit") + @Log(title = "淇濆吇宸ュ崟", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsMaintOrderBo bo) { + return toAjax(eimsMaintOrderService.updateByBo(bo)); + } + + /** + * 鍒犻櫎淇濆吇宸ュ崟 + * + * @param ids 涓婚敭涓� + */ + @SaCheckPermission("eims:maintOrder:remove") + @Log(title = "淇濆吇宸ュ崟", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(eimsMaintOrderService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrditmController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrditmController.java new file mode 100644 index 0000000..a0ecd55 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintOrditmController.java @@ -0,0 +1,105 @@ +package org.dromara.eims.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.eims.domain.vo.EimsMaintOrditmVo; +import org.dromara.eims.domain.bo.EimsMaintOrditmBo; +import org.dromara.eims.service.IEimsMaintOrditmService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 宸ュ崟鏉$洰 + * + * @author zhuguifei + * @date 2025-03-10 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/maintOrditm") +public class EimsMaintOrditmController extends BaseController { + + private final IEimsMaintOrditmService eimsMaintOrditmService; + + /** + * 鏌ヨ宸ュ崟鏉$洰鍒楄〃 + */ + @SaCheckPermission("eims:maintOrditm:list") + @GetMapping("/list") + public TableDataInfo<EimsMaintOrditmVo> list(EimsMaintOrditmBo bo, PageQuery pageQuery) { + return eimsMaintOrditmService.queryPageList(bo, pageQuery); + } + + /** + * 瀵煎嚭宸ュ崟鏉$洰鍒楄〃 + */ + @SaCheckPermission("eims:maintOrditm:export") + @Log(title = "宸ュ崟鏉$洰", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EimsMaintOrditmBo bo, HttpServletResponse response) { + List<EimsMaintOrditmVo> list = eimsMaintOrditmService.queryList(bo); + ExcelUtil.exportExcel(list, "宸ュ崟鏉$洰", EimsMaintOrditmVo.class, response); + } + + /** + * 鑾峰彇宸ュ崟鏉$洰璇︾粏淇℃伅 + * + * @param id 涓婚敭 + */ + @SaCheckPermission("eims:maintOrditm:query") + @GetMapping("/{id}") + public R<EimsMaintOrditmVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long id) { + return R.ok(eimsMaintOrditmService.queryById(id)); + } + + /** + * 鏂板宸ュ崟鏉$洰 + */ + @SaCheckPermission("eims:maintOrditm:add") + @Log(title = "宸ュ崟鏉$洰", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsMaintOrditmBo bo) { + return toAjax(eimsMaintOrditmService.insertByBo(bo)); + } + + /** + * 淇敼宸ュ崟鏉$洰 + */ + @SaCheckPermission("eims:maintOrditm:edit") + @Log(title = "宸ュ崟鏉$洰", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsMaintOrditmBo bo) { + return toAjax(eimsMaintOrditmService.updateByBo(bo)); + } + + /** + * 鍒犻櫎宸ュ崟鏉$洰 + * + * @param ids 涓婚敭涓� + */ + @SaCheckPermission("eims:maintOrditm:remove") + @Log(title = "宸ュ崟鏉$洰", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(eimsMaintOrditmService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintPlanController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintPlanController.java new file mode 100644 index 0000000..d2005dc --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintPlanController.java @@ -0,0 +1,106 @@ +package org.dromara.eims.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.eims.domain.vo.EimsMaintPlanVo; +import org.dromara.eims.domain.bo.EimsMaintPlanBo; +import org.dromara.eims.service.IEimsMaintPlanService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 淇濆吇璁″垝 + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/maintPlan") +public class EimsMaintPlanController extends BaseController { + + private final IEimsMaintPlanService eimsMaintPlanService; + + /** + * 鏌ヨ淇濆吇璁″垝鍒楄〃 + */ + @SaCheckPermission("eims:maintPlan:list") + @GetMapping("/list") + public TableDataInfo<EimsMaintPlanVo> list(EimsMaintPlanBo bo, PageQuery pageQuery) { +// return eimsMaintPlanService.queryPageList(bo, pageQuery); + return eimsMaintPlanService.queryPageListCustom(bo, pageQuery); + } + + /** + * 瀵煎嚭淇濆吇璁″垝鍒楄〃 + */ + @SaCheckPermission("eims:maintPlan:export") + @Log(title = "淇濆吇璁″垝", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EimsMaintPlanBo bo, HttpServletResponse response) { + List<EimsMaintPlanVo> list = eimsMaintPlanService.queryList(bo); + ExcelUtil.exportExcel(list, "淇濆吇璁″垝", EimsMaintPlanVo.class, response); + } + + /** + * 鑾峰彇淇濆吇璁″垝璇︾粏淇℃伅 + * + * @param id 涓婚敭 + */ + @SaCheckPermission("eims:maintPlan:query") + @GetMapping("/{id}") + public R<EimsMaintPlanVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long id) { + return R.ok(eimsMaintPlanService.queryById(id)); + } + + /** + * 鏂板淇濆吇璁″垝 + */ + @SaCheckPermission("eims:maintPlan:add") + @Log(title = "淇濆吇璁″垝", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsMaintPlanBo bo) { + return toAjax(eimsMaintPlanService.insertByBo(bo)); + } + + /** + * 淇敼淇濆吇璁″垝 + */ + @SaCheckPermission("eims:maintPlan:edit") + @Log(title = "淇濆吇璁″垝", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsMaintPlanBo bo) { + return toAjax(eimsMaintPlanService.updateByBo(bo)); + } + + /** + * 鍒犻櫎淇濆吇璁″垝 + * + * @param ids 涓婚敭涓� + */ + @SaCheckPermission("eims:maintPlan:remove") + @Log(title = "淇濆吇璁″垝", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(eimsMaintPlanService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintStandController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintStandController.java new file mode 100644 index 0000000..446302c --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/EimsMaintStandController.java @@ -0,0 +1,105 @@ +package org.dromara.eims.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.eims.domain.vo.EimsMaintStandVo; +import org.dromara.eims.domain.bo.EimsMaintStandBo; +import org.dromara.eims.service.IEimsMaintStandService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 淇濆吇鏍囧噯 + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/eims/maintStand") +public class EimsMaintStandController extends BaseController { + + private final IEimsMaintStandService eimsMaintStandService; + + /** + * 鏌ヨ淇濆吇鏍囧噯鍒楄〃 + */ + @SaCheckPermission("eims:maintStand:list") + @GetMapping("/list") + public TableDataInfo<EimsMaintStandVo> list(EimsMaintStandBo bo, PageQuery pageQuery) { + return eimsMaintStandService.queryPageList(bo, pageQuery); + } + + /** + * 瀵煎嚭淇濆吇鏍囧噯鍒楄〃 + */ + @SaCheckPermission("eims:maintStand:export") + @Log(title = "淇濆吇鏍囧噯", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(EimsMaintStandBo bo, HttpServletResponse response) { + List<EimsMaintStandVo> list = eimsMaintStandService.queryList(bo); + ExcelUtil.exportExcel(list, "淇濆吇鏍囧噯", EimsMaintStandVo.class, response); + } + + /** + * 鑾峰彇淇濆吇鏍囧噯璇︾粏淇℃伅 + * + * @param id 涓婚敭 + */ + @SaCheckPermission("eims:maintStand:query") + @GetMapping("/{id}") + public R<EimsMaintStandVo> getInfo(@NotNull(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long id) { + return R.ok(eimsMaintStandService.queryById(id)); + } + + /** + * 鏂板淇濆吇鏍囧噯 + */ + @SaCheckPermission("eims:maintStand:add") + @Log(title = "淇濆吇鏍囧噯", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R<Void> add(@Validated(AddGroup.class) @RequestBody EimsMaintStandBo bo) { + return toAjax(eimsMaintStandService.insertByBo(bo)); + } + + /** + * 淇敼淇濆吇鏍囧噯 + */ + @SaCheckPermission("eims:maintStand:edit") + @Log(title = "淇濆吇鏍囧噯", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R<Void> edit(@Validated(EditGroup.class) @RequestBody EimsMaintStandBo bo) { + return toAjax(eimsMaintStandService.updateByBo(bo)); + } + + /** + * 鍒犻櫎淇濆吇鏍囧噯 + * + * @param ids 涓婚敭涓� + */ + @SaCheckPermission("eims:maintStand:remove") + @Log(title = "淇濆吇鏍囧噯", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R<Void> remove(@NotEmpty(message = "涓婚敭涓嶈兘涓虹┖") + @PathVariable Long[] ids) { + return toAjax(eimsMaintStandService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java index 9f7aac5..d267a89 100644 --- a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/controller/GenerateCodeController.java @@ -5,6 +5,8 @@ import org.dromara.common.core.constant.CacheConstants; import org.dromara.common.core.domain.R; import org.dromara.common.redis.utils.RedisUtils; +import org.dromara.eims.service.IEimsRepairResService; +import org.dromara.eims.service.IGenerateCodeService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -26,6 +28,8 @@ @RestController @RequestMapping("/eims/generate") public class GenerateCodeController { + + private final IGenerateCodeService eimsRepairResService; /** * 鏍规嵁鍓嶇紑鐢熸垚鍚勭缂栫爜 * @@ -35,25 +39,9 @@ @GetMapping("/{prefix}") public R<String> generateCode(@NotNull(message = "绫诲瀷涓嶈兘涓虹┖") @PathVariable String prefix) { - String todayStr = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now()); - String key = CacheConstants.EIMS_GENERATE_CODE + ":" + prefix; - String code; - // 浣跨敤Redis鐨勫師瀛愭�ф搷浣滈伩鍏嶅苟鍙戦棶棰� - String oldCode = RedisUtils.getCacheObject(key); - if (oldCode != null && oldCode.contains(todayStr)) { - int no = Integer.parseInt(oldCode.substring(oldCode.length() - 4)); - code = String.format("%s%s%04d", prefix, todayStr, no + 1); - } else { - code = String.format("%s%s%04d", prefix, todayStr, 1); - } - // 鏇存柊缂撳瓨 - try { - RedisUtils.setCacheObject(key, code); - } catch (Exception e) { - return R.fail("鐢熸垚缂栫爜澶辫触锛岃绋嶅悗閲嶈瘯锛�"); - } - return R.ok("鐢熸垚鎴愬姛锛�", code); + String code = eimsRepairResService.generateCode(prefix); + return code == null ? R.fail("鐢熸垚澶辫触锛�") :R.ok("鐢熸垚鎴愬姛锛�", code); } } diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrder.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrder.java new file mode 100644 index 0000000..6811b22 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrder.java @@ -0,0 +1,109 @@ +package org.dromara.eims.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 淇濆吇宸ュ崟瀵硅薄 eims_maint_order + * + * @author zhuguifei + * @date 2025-03-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eims_maint_order") +public class EimsMaintOrder extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + + /** + * + */ + private Long equId; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + private String maintType; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡 + */ + private Long maintCycle; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + private String maintCycleUnit; + + /** + * 璁″垝琛ㄥ啑浣�- 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + private String maintRule; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇浜� + */ + private Long maintUser; + + /** + * 楠岃瘉浜� + */ + private Long verifyUser; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬 + */ + private Long maintDept; + + /** + * 淇濆吇鍗曞彿 + */ + private String maintCode; + + /** + * + */ + private String status; + + /** + * 淇濆吇璁″垝鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date planTime; + + /** + * 淇濆吇寮�濮嬫椂闂� + */ + private Date startTime; + + /** + * 淇濆吇缁撴潫鏃堕棿 + */ + private Date endTime; + + /** + * 璁″垝id + */ + private Long planId; + + /** + * 澶囨敞 + */ + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrditm.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrditm.java new file mode 100644 index 0000000..45bd507 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintOrditm.java @@ -0,0 +1,73 @@ +package org.dromara.eims.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 宸ュ崟鏉$洰瀵硅薄 eims_maint_orditm + * + * @author zhuguifei + * @date 2025-03-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eims_maint_orditm") +public class EimsMaintOrditm extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + + /** + * 宸ュ崟id + */ + private Long orderId; + + /** + * 璁惧id + */ + private Long equId; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + private String itmName; + + /** + * 淇濆吇椤圭洰鎿嶄綔鏍囧噯 + */ + private String itmAction; + + /** + * 淇濆吇鎿嶄綔鐢ㄦ埛 + */ + private Long itmUser; + + /** + * 淇濆吇鏃堕棿 + */ + private Date itmTime; + + /** + * 瀹屾垚鐘舵�侊紙瀛楀吀锛� + */ + private String status; + + /** + * 澶囨敞 + */ + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintPlan.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintPlan.java new file mode 100644 index 0000000..8177bcb --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintPlan.java @@ -0,0 +1,106 @@ +package org.dromara.eims.domain; + +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +import java.io.Serial; + +/** + * 淇濆吇璁″垝瀵硅薄 eims_maint_plan + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eims_maint_plan") +public class EimsMaintPlan extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + + /** + * 璁惧id + + */ + private Long equId; + + /** + * 淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + private String maintType; + + /** + * 淇濆吇鍛ㄦ湡 + */ + private Long maintCycle; + + /** + * 淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + private String maintCycleUnit; + + /** + * 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + private String maintRule; + + /** + * 淇濆吇浜� + */ + private Long maintUser; + + /** + * 淇濆吇閮ㄩ棬 + */ + private Long maintDept; + + /** + * 鐘舵�侊紙瀛楀吀锛� 0-鍚敤 1-绂佺敤 + */ + private String status; + + /** + * 棣栨鎵ц鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintFirstTime; + + /** + * 涓婃鎵ц鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintLastTime; + + /** + * 涓嬫鎵ц鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintNextTime; + + /** + * 澶囨敞 + */ + private String remark; + + /** + * 涓婃鐢熸垚宸ュ崟鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date lastGenerateDate; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintStand.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintStand.java new file mode 100644 index 0000000..d4b9754 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/EimsMaintStand.java @@ -0,0 +1,77 @@ +package org.dromara.eims.domain; + +import org.dromara.common.mybatis.core.domain.BaseEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 淇濆吇鏍囧噯瀵硅薄 eims_maint_stand + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("eims_maint_stand") +public class EimsMaintStand extends BaseEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @TableId(value = "id") + private Long id; + + /** + * 璁惧id + */ + private Long equId; + + /** + * 璁惧缂栫爜 + */ + private String equCode; + + /** + * 璁惧绫诲瀷 + */ + private Long equTypeId; + + /** + * 璧勪骇缂栧彿 + */ + private String assetNo; + + /** + * 璁惧鍚嶇О + + */ + private String equName; + + /** + * 璁惧鍨嬪彿 + */ + private String modelNo; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + private String name; + + /** + * 淇濆吇椤圭洰鏍囧噯 + */ + private String stand; + + /** + * 澶囨敞 + */ + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java new file mode 100644 index 0000000..e90b9dd --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrderBo.java @@ -0,0 +1,118 @@ +package org.dromara.eims.domain.bo; + +import org.dromara.eims.domain.EimsMaintOrder; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 淇濆吇宸ュ崟涓氬姟瀵硅薄 eims_maint_order + * + * @author zhuguifei + * @date 2025-03-06 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = EimsMaintOrder.class, reverseConvertGenerate = false) +public class EimsMaintOrderBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "id涓嶈兘涓虹┖", groups = { EditGroup.class }) + private Long id; + + /** + * + */ + @NotNull(message = "璁惧id涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long equId; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + private String maintType; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡 + */ + private Long maintCycle; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + private String maintCycleUnit; + + /** + * 璁″垝琛ㄥ啑浣�- 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + private String maintRule; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇浜� + */ + @NotNull(message = "璁″垝琛ㄥ啑浣�-淇濆吇浜轰笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private Long maintUser; + + /** + * 楠岃瘉浜� + */ + private Long verifyUser; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬 + */ + @NotNull(message = "璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long maintDept; + + /** + * 淇濆吇鍗曞彿 + */ + @NotBlank(message = "淇濆吇鍗曞彿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String maintCode; + + /** + * + */ + @NotBlank(message = "鐘舵�佷笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 淇濆吇璁″垝鏃堕棿 + */ + @NotNull(message = "淇濆吇璁″垝鏃堕棿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + @JsonFormat(pattern = "yyyy-MM-dd") + private Date planTime; + + /** + * 淇濆吇寮�濮嬫椂闂� + */ + private Date startTime; + + /** + * 淇濆吇缁撴潫鏃堕棿 + */ + private Date endTime; + + /** + * 璁″垝id + */ + private Long planId; + + /** + * 澶囨敞 + */ + private String remark; + + + // 鍏宠仈琛ㄥ瓧娈� + private String equName; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrditmBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrditmBo.java new file mode 100644 index 0000000..560d523 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintOrditmBo.java @@ -0,0 +1,76 @@ +package org.dromara.eims.domain.bo; + +import org.dromara.eims.domain.EimsMaintOrditm; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 宸ュ崟鏉$洰涓氬姟瀵硅薄 eims_maint_orditm + * + * @author zhuguifei + * @date 2025-03-10 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = EimsMaintOrditm.class, reverseConvertGenerate = false) +public class EimsMaintOrditmBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "涓嶈兘涓虹┖", groups = { EditGroup.class }) + private Long id; + + /** + * 宸ュ崟id + */ + @NotNull(message = "宸ュ崟id涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long orderId; + + /** + * 璁惧id + */ + @NotNull(message = "璁惧id涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long equId; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + @NotBlank(message = "淇濆吇椤圭洰鍚嶇О涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String itmName; + + /** + * 淇濆吇椤圭洰鎿嶄綔鏍囧噯 + */ + private String itmAction; + + /** + * 淇濆吇鎿嶄綔鐢ㄦ埛 + */ + @NotNull(message = "淇濆吇鎿嶄綔鐢ㄦ埛涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long itmUser; + + /** + * 淇濆吇鏃堕棿 + */ + private Date itmTime; + + /** + * 瀹屾垚鐘舵�侊紙瀛楀吀锛� + */ + private String status; + + /** + * 澶囨敞 + */ + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintPlanBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintPlanBo.java new file mode 100644 index 0000000..97705cd --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintPlanBo.java @@ -0,0 +1,115 @@ +package org.dromara.eims.domain.bo; + +import org.dromara.eims.domain.EimsMaintPlan; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; + +/** + * 淇濆吇璁″垝涓氬姟瀵硅薄 eims_maint_plan + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = EimsMaintPlan.class, reverseConvertGenerate = false) +public class EimsMaintPlanBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "涓嶈兘涓虹┖", groups = { EditGroup.class }) + private Long id; + + /** + * 璁惧id + + */ + @NotNull(message = "璁惧id 涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long equId; + + /** + * 淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + @NotBlank(message = "淇濆吇绫诲瀷锛堝瓧鍏革級涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String maintType; + + /** + * 淇濆吇鍛ㄦ湡 + */ + @NotNull(message = "淇濆吇鍛ㄦ湡涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long maintCycle; + + /** + * 淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + @NotBlank(message = "淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String maintCycleUnit; + + /** + * 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + @NotBlank(message = "淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂翠笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private String maintRule; + + /** + * 淇濆吇浜� + */ + @NotNull(message = "淇濆吇浜轰笉鑳戒负绌�", groups = { AddGroup.class, EditGroup.class }) + private Long maintUser; + + /** + * 淇濆吇閮ㄩ棬 + */ + @NotNull(message = "淇濆吇閮ㄩ棬涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long maintDept; + + /** + * 鐘舵�侊紙瀛楀吀锛� 0-鍚敤 1-绂佺敤 + */ + @NotNull(message = "鐘舵�侊紙瀛楀吀锛� 0-鍚敤 1-绂佺敤涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private String status; + + /** + * 棣栨鎵ц鏃堕棿 + */ + @NotNull(message = "淇濆吇璁″垝棣栨鎵ц鏃堕棿涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintFirstTime; + + /** + * 涓婃鎵ц鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintLastTime; + + /** + * 涓嬫鎵ц鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintNextTime; + + /** + * 澶囨敞 + */ + private String remark; + + /** + * 涓婃鐢熸垚宸ュ崟鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date lastGenerateDate; + + // 鍏宠仈琛ㄥ瓧娈� + private String equName; + private String assetNo; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStandBo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStandBo.java new file mode 100644 index 0000000..1240e32 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/bo/EimsMaintStandBo.java @@ -0,0 +1,78 @@ +package org.dromara.eims.domain.bo; + +import org.dromara.eims.domain.EimsMaintStand; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 淇濆吇鏍囧噯涓氬姟瀵硅薄 eims_maint_stand + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = EimsMaintStand.class, reverseConvertGenerate = false) +public class EimsMaintStandBo extends BaseEntity { + + /** + * + */ + @NotNull(message = "涓嶈兘涓虹┖", groups = { EditGroup.class }) + private Long id; + + /** + * 璁惧id + */ + @NotNull(message = "璁惧id涓嶈兘涓虹┖", groups = { AddGroup.class, EditGroup.class }) + private Long equId; + + /** + * 璁惧缂栫爜 + */ + private String equCode; + + /** + * 璁惧绫诲瀷 + */ + private Long equTypeId; + + /** + * 璧勪骇缂栧彿 + */ + private String assetNo; + + /** + * 璁惧鍚嶇О + + */ + private String equName; + + /** + * 璁惧鍨嬪彿 + */ + private String modelNo; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + private String name; + + /** + * 淇濆吇椤圭洰鏍囧噯 + */ + private String stand; + + /** + * 澶囨敞 + */ + @NotBlank(message = "澶囨敞涓嶈兘涓虹┖", groups = { EditGroup.class }) + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrderVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrderVo.java new file mode 100644 index 0000000..e4b457a --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrderVo.java @@ -0,0 +1,149 @@ +package org.dromara.eims.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.eims.domain.EimsMaintOrder; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 淇濆吇宸ュ崟瑙嗗浘瀵硅薄 eims_maint_order + * + * @author zhuguifei + * @date 2025-03-06 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = EimsMaintOrder.class) +public class EimsMaintOrderVo extends BaseEntity implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * + */ + @ExcelProperty(value = "") + private Long equId; + + @Translation(type = TransConstant.EQU_ID_TO_NAME, mapper = "equId") + private String equName; + + /** + * 璁惧璧勪骇缂栧彿 + */ + private String assetNo; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + @ExcelProperty(value = "璁″垝琛ㄥ啑浣�-淇濆吇绫诲瀷", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "瀛�=鍏�") + private String maintType; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡 + */ + @ExcelProperty(value = "璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡") + private Long maintCycle; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + @ExcelProperty(value = "璁″垝琛ㄥ啑浣�-淇濆吇鍛ㄦ湡鍗曚綅", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "瀛�=鍏�") + private String maintCycleUnit; + + /** + * 璁″垝琛ㄥ啑浣�- 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + @ExcelProperty(value = "璁″垝琛ㄥ啑浣�- 淇濆吇瑙勫垯", converter = ExcelDictConvert.class) + @ExcelDictFormat(readConverterExp = "瀛�=鍏�") + private String maintRule; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇浜� + */ + @ExcelProperty(value = "璁″垝琛ㄥ啑浣�-淇濆吇浜�") + private Long maintUser; + + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "maintUser") + private String maintUserName; + + /** + * 楠岃瘉浜� + */ + private Long verifyUser; + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "verifyUser") + private String verifyUserName; + + /** + * 璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬 + */ + @ExcelProperty(value = "璁″垝琛ㄥ啑浣�-淇濆吇閮ㄩ棬") + private Long maintDept; + + /** + * 淇濆吇鍗曞彿 + */ + @ExcelProperty(value = "淇濆吇鍗曞彿") + private String maintCode; + + /** + * + */ + @ExcelProperty(value = "") + private String status; + + /** + * 淇濆吇璁″垝鏃堕棿 + */ + @ExcelProperty(value = "淇濆吇璁″垝鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date planTime; + + /** + * 淇濆吇寮�濮嬫椂闂� + */ + @ExcelProperty(value = "淇濆吇寮�濮嬫椂闂�") + private Date startTime; + + /** + * 淇濆吇缁撴潫鏃堕棿 + */ + @ExcelProperty(value = "淇濆吇缁撴潫鏃堕棿") + private Date endTime; + + /** + * 璁″垝id + */ + @ExcelProperty(value = "璁″垝id") + private Long planId; + + /** + * 澶囨敞 + */ + @ExcelProperty(value = "澶囨敞") + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrditmVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrditmVo.java new file mode 100644 index 0000000..98e9d37 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintOrditmVo.java @@ -0,0 +1,100 @@ +package org.dromara.eims.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.eims.domain.EimsMaintOrditm; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 宸ュ崟鏉$洰瑙嗗浘瀵硅薄 eims_maint_orditm + * + * @author zhuguifei + * @date 2025-03-10 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = EimsMaintOrditm.class) +public class EimsMaintOrditmVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 宸ュ崟id + */ + @ExcelProperty(value = "宸ュ崟id") + private Long orderId; + + @Translation(type = TransConstant.MAINT_ORDER_ID_TO_CODE, mapper = "orderId") + private String orderName; + + /** + * 璁惧id + */ + @ExcelProperty(value = "璁惧id") + private Long equId; + + @Translation(type = TransConstant.EQU_ID_TO_NAME, mapper = "equId") + private String equName; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + @ExcelProperty(value = "淇濆吇椤圭洰鍚嶇О") + private String itmName; + + /** + * 淇濆吇椤圭洰鎿嶄綔鏍囧噯 + */ + @ExcelProperty(value = "淇濆吇椤圭洰鎿嶄綔鏍囧噯") + private String itmAction; + + /** + * 淇濆吇鎿嶄綔鐢ㄦ埛 + */ + @ExcelProperty(value = "淇濆吇鎿嶄綔鐢ㄦ埛") + private Long itmUser; + + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "itmUser") + private String itmUserName; + + /** + * 淇濆吇鏃堕棿 + */ + @ExcelProperty(value = "淇濆吇鏃堕棿") + private Date itmTime; + + /** + * 瀹屾垚鐘舵�侊紙瀛楀吀锛� + */ + @ExcelProperty(value = "瀹屾垚鐘舵��", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "eims_orditm_status") + private String status; + + /** + * 澶囨敞 + */ + @ExcelProperty(value = "澶囨敞") + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintPlanVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintPlanVo.java new file mode 100644 index 0000000..618029e --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintPlanVo.java @@ -0,0 +1,150 @@ +package org.dromara.eims.domain.vo; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import jakarta.validation.constraints.NotNull; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.eims.domain.EimsMaintPlan; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 淇濆吇璁″垝瑙嗗浘瀵硅薄 eims_maint_plan + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = EimsMaintPlan.class) +public class EimsMaintPlanVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 璁惧id + + */ + @ExcelProperty(value = "璁惧id") + private Long equId; + + /** + * 璁惧鍚嶇О + */ + @Translation(type = TransConstant.EQU_ID_TO_NAME, mapper = "equId") + private String equName; + + /** + * 璁惧璧勪骇缂栧彿 + */ + private String assetNo; + + /** + * 淇濆吇绫诲瀷锛堝瓧鍏革級 + */ + @ExcelProperty(value = "淇濆吇绫诲瀷", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "eims_maint_type") + private String maintType; + + /** + * 淇濆吇鍛ㄦ湡 + */ + @ExcelProperty(value = "淇濆吇鍛ㄦ湡") + private Long maintCycle; + + /** + * 淇濆吇鍛ㄦ湡鍗曚綅锛堝瓧鍏革級 + */ + @ExcelProperty(value = "淇濆吇鍛ㄦ湡鍗曚綅", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "maint_cycle_unit") + private String maintCycleUnit; + + /** + * 瀛楁鎷兼帴 maintCycle + maintCycleUnit鐨刣ictLabel + */ + private String maintCycleUnitName; + + /** + * 淇濆吇瑙勫垯锛堝瓧鍏革級淇濆吇鏃堕棿璁$畻锛�1-鎸夊懆鏈� 2-鎸変笂娆′繚鍏绘椂闂� + */ + @ExcelProperty(value = "淇濆吇瑙勫垯", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "maint_time_rule") + private String maintRule; + + /** + * 淇濆吇浜� + */ + @ExcelProperty(value = "淇濆吇浜�") + private Long maintUser; + + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "maintUser") + private String maintUserName; + + /** + * 淇濆吇閮ㄩ棬 + */ + @ExcelProperty(value = "淇濆吇閮ㄩ棬") + private Long maintDept; + + private String maintDeptName; + + /** + * 鐘舵�侊紙瀛楀吀锛� 0-鍚敤 1-绂佺敤 + */ + @ExcelProperty(value = "鐘舵��", converter = ExcelDictConvert.class) + @ExcelDictFormat(dictType = "sys_normal_disable") + private String status; + + /** + * 棣栨鎵ц鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintFirstTime; + + /** + * 涓婃鎵ц鏃堕棿 + */ + @ExcelProperty(value = "涓婃鎵ц鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintLastTime; + + /** + * 涓嬫鎵ц鏃堕棿 + */ + @ExcelProperty(value = "涓嬫鎵ц鏃堕棿") + @JsonFormat(pattern = "yyyy-MM-dd") + private Date maintNextTime; + + /** + * 澶囨敞 + */ + @ExcelProperty(value = "澶囨敞") + private String remark; + /** + * 涓婃鐢熸垚宸ュ崟鏃堕棿 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + private Date lastGenerateDate; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintStandVo.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintStandVo.java new file mode 100644 index 0000000..2247397 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/domain/vo/EimsMaintStandVo.java @@ -0,0 +1,93 @@ +package org.dromara.eims.domain.vo; + +import org.dromara.eims.domain.EimsMaintStand; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 淇濆吇鏍囧噯瑙嗗浘瀵硅薄 eims_maint_stand + * + * @author zhuguifei + * @date 2025-03-04 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = EimsMaintStand.class) +public class EimsMaintStandVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * + */ + @ExcelProperty(value = "") + private Long id; + + /** + * 璁惧id + */ + @ExcelProperty(value = "璁惧id") + private Long equId; + + /** + * 璁惧缂栫爜 + */ + @ExcelProperty(value = "璁惧缂栫爜") + private String equCode; + + /** + * 璁惧绫诲瀷 + */ + @ExcelProperty(value = "璁惧绫诲瀷") + private Long equTypeId; + + /** + * 璧勪骇缂栧彿 + */ + @ExcelProperty(value = "璧勪骇缂栧彿") + private String assetNo; + + /** + * 璁惧鍚嶇О + + */ + @ExcelProperty(value = "璁惧鍚嶇О") + private String equName; + + /** + * 璁惧鍨嬪彿 + */ + @ExcelProperty(value = "璁惧鍨嬪彿") + private String modelNo; + + /** + * 淇濆吇椤圭洰鍚嶇О + */ + @ExcelProperty(value = "淇濆吇椤圭洰鍚嶇О") + private String name; + + /** + * 淇濆吇椤圭洰鏍囧噯 + */ + @ExcelProperty(value = "淇濆吇椤圭洰鏍囧噯") + private String stand; + + /** + * 澶囨敞 + */ + @ExcelProperty(value = "澶囨敞") + private String remark; + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/job/MaintPlanToOrderJob.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/job/MaintPlanToOrderJob.java new file mode 100644 index 0000000..1058f6d --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/job/MaintPlanToOrderJob.java @@ -0,0 +1,142 @@ +package org.dromara.eims.job; + +import com.aizuda.snailjob.client.job.core.annotation.JobExecutor; +import com.aizuda.snailjob.client.job.core.dto.JobArgs; +import com.aizuda.snailjob.client.model.ExecuteResult; +import com.aizuda.snailjob.common.core.util.JsonUtil; +import com.aizuda.snailjob.common.log.SnailJobLog; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; +import org.dromara.common.core.constant.DictConstants; +import org.dromara.common.core.utils.DateUtils; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.eims.domain.*; +import org.dromara.eims.domain.bo.EimsMaintPlanBo; +import org.dromara.eims.domain.vo.EimsMaintPlanVo; +import org.dromara.eims.domain.vo.EimsMaintStandVo; +import org.dromara.eims.mapper.EimsMaintOrderMapper; +import org.dromara.eims.mapper.EimsMaintOrditmMapper; +import org.dromara.eims.mapper.EimsMaintPlanMapper; +import org.dromara.eims.mapper.EimsMaintStandMapper; +import org.dromara.eims.service.IEimsMaintOrderService; +import org.dromara.eims.service.IEimsMaintPlanService; +import org.dromara.eims.service.IGenerateCodeService; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; + +@Component +@RequiredArgsConstructor +@JobExecutor(name = "maintPlanToOrderJob") +public class MaintPlanToOrderJob { + private final EimsMaintOrderMapper orderMapper; + + private final EimsMaintStandMapper standMapper; + + private final EimsMaintOrditmMapper orditmMapper; + + private final EimsMaintPlanMapper planMapper; + + private final IGenerateCodeService codeService; + + + @SneakyThrows + @Transactional(rollbackFor = Exception.class) + public ExecuteResult jobExecute(JobArgs jobArgs) { + // 鑾峰彇浠婂ぉ鏃ユ湡 + + Date today = new Date(); + LambdaQueryWrapper<EimsMaintPlan> planBoQueryWrapper = Wrappers.lambdaQuery(); + // 鏌ヨ鍚敤鐨勪繚鍏昏鍒� + planBoQueryWrapper.eq(EimsMaintPlan::getStatus, DictConstants.SYS_NORMAL_DISABLE_DETAIL.NORMAL); + // 杩囨护娌℃湁棣栨杩愯鏃堕棿 + planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintFirstTime); + // 杩囨护娌℃湁涓嬫杩愯鏃堕棿 + planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintNextTime); + // 杩囨护娌℃湁淇濆吇鍛ㄦ湡鐨勬暟鎹� + planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintCycle); + planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintCycleUnit); + planBoQueryWrapper.isNotNull(EimsMaintPlan::getMaintRule); + + List<EimsMaintPlanVo> planVoList = planMapper.selectVoList(planBoQueryWrapper); + for (int i = 0; i < planVoList.size(); i++) { + EimsMaintPlanVo planVo = planVoList.get(i); + // 淇濆吇璁″垝add鐨勬椂鍊欎細鑷姩鐢熸垚涓嬫杩愯鏃堕棿 + Date createOrderTime = planVo.getMaintNextTime(); + int day = DateUtils.differentDays(today,createOrderTime ); + // 濡傛灉璁″垝鐢熸垚宸ュ崟鏃ユ湡澶т簬浠婂ぉ鍒欎笉鐢熸垚宸ュ崟 + if (day >= 1) { + continue; + } + + // 璁$畻鐢熸垚宸ュ崟鏃堕棿 + Long maintCycle = planVo.getMaintCycle(); + String maintRule = planVo.getMaintRule(); + Date firstTime = planVo.getMaintFirstTime(); + Date lastTime = planVo.getMaintLastTime(); + Date nextTime = null; + String maintCycleUnit = planVo.getMaintCycleUnit(); + switch (maintCycleUnit) { + case DictConstants.MAINT_CYCLE_UNIT_DETAIL.DAY: + break; + case DictConstants.MAINT_CYCLE_UNIT_DETAIL.WEEK: + maintCycle *= 7; + break; + case DictConstants.MAINT_CYCLE_UNIT_DETAIL.MONTH: + maintCycle *= 30; + break; + case DictConstants.MAINT_CYCLE_UNIT_DETAIL.SEASON: + maintCycle *= 90; + break; + case DictConstants.MAINT_CYCLE_UNIT_DETAIL.YEAR: + maintCycle *= 365; + break; + } + // 棣栨 + if (lastTime == null ) { + nextTime = DateUtils.addDays(createOrderTime, maintCycle.intValue()); + } else { + nextTime = DateUtils.addDays(lastTime, maintCycle.intValue()); + } + EimsMaintOrder order = new EimsMaintOrder(); + BeanUtils.copyProperties(planVo, order); + order.setId(null); + order.setStatus(DictConstants.MAINT_ORDER_STATUS_DETAIL.DAIBAOYANG); + order.setPlanTime(createOrderTime); + order.setMaintCode(codeService.generateCode("BYZD")); + EimsMaintPlan plan = MapstructUtils.convert(planVo, EimsMaintPlan.class); + assert plan != null; + plan.setLastGenerateDate(new Date()); + plan.setMaintLastTime(createOrderTime); + plan.setMaintNextTime(nextTime); + boolean flag = orderMapper.insert(order) > 0; + //TODO 鐢熸垚澶辫触锛屾坊鍔犲紓甯歌褰� + if (!flag) continue; + planMapper.updateById(plan); + + //鐢熸垚淇濆吇鏄庣粏 + Long equId = plan.getEquId(); + List<EimsMaintStandVo> standList = standMapper.selectVoList(new LambdaQueryWrapper<EimsMaintStand>().eq(EimsMaintStand::getEquId, equId)); + //TODO 娌℃湁淇濆吇椤癸紝娣诲姞寮傚父璁板綍 + if(standList.isEmpty()) continue; + for (int j = 0; j < standList.size(); j++) { + EimsMaintStandVo stand = standList.get(j); + EimsMaintOrditm itm = new EimsMaintOrditm(); + itm.setOrderId(order.getId()); + itm.setEquId(equId); + itm.setItmName(stand.getName()); + itm.setItmAction(stand.getStand()); + itm.setItmUser(order.getMaintUser()); + orditmMapper.insert(itm); + } + } + return ExecuteResult.success("淇濆吇璁″垝鐢熸垚淇濆吇宸ュ崟鎴愬姛"); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrderMapper.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrderMapper.java new file mode 100644 index 0000000..caa3aab --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrderMapper.java @@ -0,0 +1,22 @@ +package org.dromara.eims.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.dromara.eims.domain.EimsMaintOrder; +import org.dromara.eims.domain.EimsMaintPlan; +import org.dromara.eims.domain.vo.EimsMaintOrderVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.eims.domain.vo.EimsMaintPlanVo; + +/** + * 淇濆吇宸ュ崟Mapper鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-06 + */ +public interface EimsMaintOrderMapper extends BaseMapperPlus<EimsMaintOrder, EimsMaintOrderVo> { + Page<EimsMaintOrderVo> selectMaintOrderList(@Param("page") Page<EimsMaintOrderVo> page, @Param(Constants.WRAPPER) Wrapper<EimsMaintOrder> queryWrapper); + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrditmMapper.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrditmMapper.java new file mode 100644 index 0000000..57b4cef --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintOrditmMapper.java @@ -0,0 +1,15 @@ +package org.dromara.eims.mapper; + +import org.dromara.eims.domain.EimsMaintOrditm; +import org.dromara.eims.domain.vo.EimsMaintOrditmVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 宸ュ崟鏉$洰Mapper鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-10 + */ +public interface EimsMaintOrditmMapper extends BaseMapperPlus<EimsMaintOrditm, EimsMaintOrditmVo> { + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintPlanMapper.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintPlanMapper.java new file mode 100644 index 0000000..63d5e4d --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintPlanMapper.java @@ -0,0 +1,22 @@ +package org.dromara.eims.mapper; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.dromara.eims.domain.EimsMaintPlan; +import org.dromara.eims.domain.EimsRepairReq; +import org.dromara.eims.domain.vo.EimsMaintPlanVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.eims.domain.vo.EimsRepairReqVo; + +/** + * 淇濆吇璁″垝Mapper鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-04 + */ +public interface EimsMaintPlanMapper extends BaseMapperPlus<EimsMaintPlan, EimsMaintPlanVo> { + Page<EimsMaintPlanVo> selectMaintPlanList(@Param("page") Page<EimsMaintPlanVo> page, @Param(Constants.WRAPPER) Wrapper<EimsMaintPlan> queryWrapper); + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintStandMapper.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintStandMapper.java new file mode 100644 index 0000000..f98e5be --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/mapper/EimsMaintStandMapper.java @@ -0,0 +1,15 @@ +package org.dromara.eims.mapper; + +import org.dromara.eims.domain.EimsMaintStand; +import org.dromara.eims.domain.vo.EimsMaintStandVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 淇濆吇鏍囧噯Mapper鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-04 + */ +public interface EimsMaintStandMapper extends BaseMapperPlus<EimsMaintStand, EimsMaintStandVo> { + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrderService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrderService.java new file mode 100644 index 0000000..8894366 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrderService.java @@ -0,0 +1,77 @@ +package org.dromara.eims.service; + +import org.dromara.eims.domain.vo.EimsMaintOrderVo; +import org.dromara.eims.domain.bo.EimsMaintOrderBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 淇濆吇宸ュ崟Service鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-06 + */ +public interface IEimsMaintOrderService { + + /** + * 鏌ヨ淇濆吇宸ュ崟 + * + * @param id 涓婚敭 + * @return 淇濆吇宸ュ崟 + */ + EimsMaintOrderVo queryById(Long id); + + /** + * 鍒嗛〉鏌ヨ淇濆吇宸ュ崟鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇宸ュ崟鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsMaintOrderVo> queryPageList(EimsMaintOrderBo bo, PageQuery pageQuery); + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勪繚鍏诲伐鍗曞垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 淇濆吇宸ュ崟鍒楄〃 + */ + List<EimsMaintOrderVo> queryList(EimsMaintOrderBo bo); + + /** + * 鏂板淇濆吇宸ュ崟 + * + * @param bo 淇濆吇宸ュ崟 + * @return 鏄惁鏂板鎴愬姛 + */ + Boolean insertByBo(EimsMaintOrderBo bo); + + /** + * 淇敼淇濆吇宸ュ崟 + * + * @param bo 淇濆吇宸ュ崟 + * @return 鏄惁淇敼鎴愬姛 + */ + Boolean updateByBo(EimsMaintOrderBo bo); + + /** + * 鏍¢獙骞舵壒閲忓垹闄や繚鍏诲伐鍗曚俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); + + /** + * 鍒嗛〉鏌ヨ淇濆吇宸ュ崟鍒楄〃-澶氳〃鏌ヨ + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇宸ュ崟鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsMaintOrderVo> queryPageListCustom(EimsMaintOrderBo bo, PageQuery pageQuery); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrditmService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrditmService.java new file mode 100644 index 0000000..862cbd0 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintOrditmService.java @@ -0,0 +1,68 @@ +package org.dromara.eims.service; + +import org.dromara.eims.domain.vo.EimsMaintOrditmVo; +import org.dromara.eims.domain.bo.EimsMaintOrditmBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 宸ュ崟鏉$洰Service鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-10 + */ +public interface IEimsMaintOrditmService { + + /** + * 鏌ヨ宸ュ崟鏉$洰 + * + * @param id 涓婚敭 + * @return 宸ュ崟鏉$洰 + */ + EimsMaintOrditmVo queryById(Long id); + + /** + * 鍒嗛〉鏌ヨ宸ュ崟鏉$洰鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 宸ュ崟鏉$洰鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsMaintOrditmVo> queryPageList(EimsMaintOrditmBo bo, PageQuery pageQuery); + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勫伐鍗曟潯鐩垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 宸ュ崟鏉$洰鍒楄〃 + */ + List<EimsMaintOrditmVo> queryList(EimsMaintOrditmBo bo); + + /** + * 鏂板宸ュ崟鏉$洰 + * + * @param bo 宸ュ崟鏉$洰 + * @return 鏄惁鏂板鎴愬姛 + */ + Boolean insertByBo(EimsMaintOrditmBo bo); + + /** + * 淇敼宸ュ崟鏉$洰 + * + * @param bo 宸ュ崟鏉$洰 + * @return 鏄惁淇敼鎴愬姛 + */ + Boolean updateByBo(EimsMaintOrditmBo bo); + + /** + * 鏍¢獙骞舵壒閲忓垹闄ゅ伐鍗曟潯鐩俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintPlanService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintPlanService.java new file mode 100644 index 0000000..e7b98ce --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintPlanService.java @@ -0,0 +1,77 @@ +package org.dromara.eims.service; + +import org.dromara.eims.domain.vo.EimsMaintPlanVo; +import org.dromara.eims.domain.bo.EimsMaintPlanBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 淇濆吇璁″垝Service鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-04 + */ +public interface IEimsMaintPlanService { + + /** + * 鏌ヨ淇濆吇璁″垝 + * + * @param id 涓婚敭 + * @return 淇濆吇璁″垝 + */ + EimsMaintPlanVo queryById(Long id); + + /** + * 鍒嗛〉鏌ヨ淇濆吇璁″垝鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇璁″垝鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsMaintPlanVo> queryPageList(EimsMaintPlanBo bo, PageQuery pageQuery); + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勪繚鍏昏鍒掑垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 淇濆吇璁″垝鍒楄〃 + */ + List<EimsMaintPlanVo> queryList(EimsMaintPlanBo bo); + + /** + * 鏂板淇濆吇璁″垝 + * + * @param bo 淇濆吇璁″垝 + * @return 鏄惁鏂板鎴愬姛 + */ + Boolean insertByBo(EimsMaintPlanBo bo); + + /** + * 淇敼淇濆吇璁″垝 + * + * @param bo 淇濆吇璁″垝 + * @return 鏄惁淇敼鎴愬姛 + */ + Boolean updateByBo(EimsMaintPlanBo bo); + + /** + * 鏍¢獙骞舵壒閲忓垹闄や繚鍏昏鍒掍俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); + + /** + * 鍒嗛〉鏌ヨ淇濆吇璁″垝鍒楄〃-澶氳〃鏌ヨ + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇璁″垝鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsMaintPlanVo> queryPageListCustom(EimsMaintPlanBo bo, PageQuery pageQuery); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintStandService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintStandService.java new file mode 100644 index 0000000..536958d --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IEimsMaintStandService.java @@ -0,0 +1,68 @@ +package org.dromara.eims.service; + +import org.dromara.eims.domain.vo.EimsMaintStandVo; +import org.dromara.eims.domain.bo.EimsMaintStandBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 淇濆吇鏍囧噯Service鎺ュ彛 + * + * @author zhuguifei + * @date 2025-03-04 + */ +public interface IEimsMaintStandService { + + /** + * 鏌ヨ淇濆吇鏍囧噯 + * + * @param id 涓婚敭 + * @return 淇濆吇鏍囧噯 + */ + EimsMaintStandVo queryById(Long id); + + /** + * 鍒嗛〉鏌ヨ淇濆吇鏍囧噯鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇鏍囧噯鍒嗛〉鍒楄〃 + */ + TableDataInfo<EimsMaintStandVo> queryPageList(EimsMaintStandBo bo, PageQuery pageQuery); + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勪繚鍏绘爣鍑嗗垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 淇濆吇鏍囧噯鍒楄〃 + */ + List<EimsMaintStandVo> queryList(EimsMaintStandBo bo); + + /** + * 鏂板淇濆吇鏍囧噯 + * + * @param bo 淇濆吇鏍囧噯 + * @return 鏄惁鏂板鎴愬姛 + */ + Boolean insertByBo(EimsMaintStandBo bo); + + /** + * 淇敼淇濆吇鏍囧噯 + * + * @param bo 淇濆吇鏍囧噯 + * @return 鏄惁淇敼鎴愬姛 + */ + Boolean updateByBo(EimsMaintStandBo bo); + + /** + * 鏍¢獙骞舵壒閲忓垹闄や繚鍏绘爣鍑嗕俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IGenerateCodeService.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IGenerateCodeService.java new file mode 100644 index 0000000..15f9030 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/IGenerateCodeService.java @@ -0,0 +1,5 @@ +package org.dromara.eims.service; + +public interface IGenerateCodeService { + String generateCode(String prefix); +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java new file mode 100644 index 0000000..988fc92 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrderServiceImpl.java @@ -0,0 +1,253 @@ +package org.dromara.eims.service.impl; + +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.SneakyThrows; +import org.dromara.common.core.constant.DictConstants; +import org.dromara.common.core.service.MaintOrderService; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.SpringUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.eims.domain.EimsMaintOrditm; +import org.dromara.eims.domain.EimsMaintStand; +import org.dromara.eims.domain.vo.EimsMaintPlanVo; +import org.dromara.eims.domain.vo.EimsMaintStandVo; +import org.dromara.eims.domain.vo.EimsRepairResVo; +import org.dromara.eims.mapper.EimsMaintOrditmMapper; +import org.dromara.eims.mapper.EimsMaintStandMapper; +import org.dromara.system.domain.SysDept; +import org.dromara.system.domain.vo.SysDeptVo; +import org.dromara.system.mapper.SysDeptMapper; +import org.springframework.stereotype.Service; +import org.dromara.eims.domain.bo.EimsMaintOrderBo; +import org.dromara.eims.domain.vo.EimsMaintOrderVo; +import org.dromara.eims.domain.EimsMaintOrder; +import org.dromara.eims.mapper.EimsMaintOrderMapper; +import org.dromara.eims.service.IEimsMaintOrderService; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 淇濆吇宸ュ崟Service涓氬姟灞傚鐞� + * + * @author zhuguifei + * @date 2025-03-06 + */ +@RequiredArgsConstructor +@Service +public class EimsMaintOrderServiceImpl implements IEimsMaintOrderService, MaintOrderService { + + private final EimsMaintOrderMapper baseMapper; + private final EimsMaintOrditmMapper orditmMapper; + private final SysDeptMapper sysDeptMapper; + + private final EimsMaintStandMapper standMapper; + /** + * 鏌ヨ淇濆吇宸ュ崟 + * + * @param id 涓婚敭 + * @return 淇濆吇宸ュ崟 + */ + @Override + public EimsMaintOrderVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 鍒嗛〉鏌ヨ淇濆吇宸ュ崟鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇宸ュ崟鍒嗛〉鍒楄〃 + */ + @Override + public TableDataInfo<EimsMaintOrderVo> queryPageList(EimsMaintOrderBo bo, PageQuery pageQuery) { + LambdaQueryWrapper<EimsMaintOrder> lqw = buildQueryWrapper(bo); + Page<EimsMaintOrderVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + @Override + public TableDataInfo<EimsMaintOrderVo> queryPageListCustom(EimsMaintOrderBo bo, PageQuery pageQuery) { + Page<EimsMaintOrderVo> page = baseMapper.selectMaintOrderList(pageQuery.build(), buildWrapper(bo)); + return TableDataInfo.build(page); + } + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勪繚鍏诲伐鍗曞垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 淇濆吇宸ュ崟鍒楄〃 + */ + @Override + public List<EimsMaintOrderVo> queryList(EimsMaintOrderBo bo) { + LambdaQueryWrapper<EimsMaintOrder> lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + private QueryWrapper<EimsMaintOrder> buildWrapper(EimsMaintOrderBo bo) { + Map<String, Object> params = bo.getParams(); + QueryWrapper<EimsMaintOrder> qw = Wrappers.query(); + qw.like(StringUtils.isNotBlank(bo.getMaintCode()),"mo.maint_code", bo.getMaintCode()); + qw.like(bo.getEquName() != null, "equ.equ_name", bo.getEquName()); + qw.eq(StringUtils.isNotBlank(bo.getMaintType()), "mo.maint_type", bo.getMaintType()); + qw.eq(StringUtils.isNotBlank(bo.getMaintCycleUnit()), "mo.maint_cycle_unit", bo.getMaintCycleUnit()); + qw.eq(StringUtils.isNotBlank(bo.getMaintRule()), "mo.maint_rule", bo.getMaintRule()); + qw.eq(bo.getMaintUser() != null, "mo.maint_user", bo.getMaintUser()); + qw.in(bo.getMaintDept() != null, "mo.maint_dept", getAllDescendantIds(bo.getMaintDept())); + qw.eq(bo.getStatus() != null, "mo.status", bo.getStatus()); + qw.orderByDesc("mo.create_time"); + return qw; + } + + /** + * 鏍规嵁id锛岃幏鍙栨墍鏈夊悗浠d + * + * @param rootId + * @return + */ + public List<Long> getAllDescendantIds(Long rootId) { + List<Long> result = new ArrayList<>(); + result.add(rootId); + collectDescendants(rootId, result); + return result; + } + + private void collectDescendants(Long currentId, List<Long> collector) { + QueryWrapper<SysDept> sysDeptWrapper = new QueryWrapper<>(); + sysDeptWrapper.lambda().eq(SysDept::getParentId, currentId); + + List<SysDeptVo> children = sysDeptMapper.selectVoList(sysDeptWrapper); + if (children != null && !children.isEmpty()) { + for (SysDeptVo child : children) { + Long childId = child.getDeptId(); + collector.add(childId); + collectDescendants(childId, collector); + } + } + } + + private LambdaQueryWrapper<EimsMaintOrder> buildQueryWrapper(EimsMaintOrderBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<EimsMaintOrder> lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getEquId() != null, EimsMaintOrder::getEquId, bo.getEquId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintType()), EimsMaintOrder::getMaintType, bo.getMaintType()); + lqw.eq(bo.getMaintCycle() != null, EimsMaintOrder::getMaintCycle, bo.getMaintCycle()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintCycleUnit()), EimsMaintOrder::getMaintCycleUnit, bo.getMaintCycleUnit()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintRule()), EimsMaintOrder::getMaintRule, bo.getMaintRule()); + lqw.eq(bo.getMaintUser() != null, EimsMaintOrder::getMaintUser, bo.getMaintUser()); + lqw.eq(bo.getMaintDept() != null, EimsMaintOrder::getMaintDept, bo.getMaintDept()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintCode()), EimsMaintOrder::getMaintCode, bo.getMaintCode()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsMaintOrder::getStatus, bo.getStatus()); + lqw.eq(bo.getPlanTime() != null, EimsMaintOrder::getPlanTime, bo.getPlanTime()); + lqw.eq(bo.getPlanId() != null, EimsMaintOrder::getPlanId, bo.getPlanId()); + return lqw; + } + + /** + * 鏂板淇濆吇宸ュ崟 + * + * @param bo 淇濆吇宸ュ崟 + * @return 鏄惁鏂板鎴愬姛 + */ + @Override + public Boolean insertByBo(EimsMaintOrderBo bo) { + EimsMaintOrder add = MapstructUtils.convert(bo, EimsMaintOrder.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + + //鐢熸垚淇濆吇鏄庣粏 + Long equId = bo.getEquId(); + List<EimsMaintStandVo> standList = standMapper.selectVoList(new LambdaQueryWrapper<EimsMaintStand>().eq(EimsMaintStand::getEquId, equId)); + //TODO 娌℃湁淇濆吇椤癸紝娣诲姞寮傚父璁板綍 + for (int j = 0; j < standList.size(); j++) { + EimsMaintStandVo stand = standList.get(j); + EimsMaintOrditm itm = new EimsMaintOrditm(); + itm.setOrderId(bo.getId()); + itm.setEquId(equId); + itm.setItmName(stand.getName()); + itm.setItmAction(stand.getStand()); + itm.setItmUser(bo.getMaintUser()); + orditmMapper.insert(itm); + } + + } + return flag; + } + + /** + * 淇敼淇濆吇宸ュ崟 + * + * @param bo 淇濆吇宸ュ崟 + * @return 鏄惁淇敼鎴愬姛 + */ + @SneakyThrows + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean updateByBo(EimsMaintOrderBo bo) { + EimsMaintOrder update = MapstructUtils.convert(bo, EimsMaintOrder.class); + + EimsMaintOrder old = baseMapper.selectById(bo.getId()); + + // 淇濆吇鐘舵�佸彉鏇村緟瀹℃牳鏃堕渶瑕佹牎楠屼繚鍏婚」鏁版嵁 + if(old.getStatus().equals(DictConstants.MAINT_ORDER_STATUS_DETAIL.BAOYANG)&&bo.getStatus().equals(DictConstants.MAINT_ORDER_STATUS_DETAIL.DAIYANZHENG)){ + LambdaQueryWrapper<EimsMaintOrditm> itmQueryWrapper = Wrappers.lambdaQuery(); + itmQueryWrapper.eq(EimsMaintOrditm::getOrderId, bo.getId()); + List<EimsMaintOrditm> eimsMaintOrditms = orditmMapper.selectList(itmQueryWrapper); + List<EimsMaintOrditm> wwc = eimsMaintOrditms.stream().filter(item->!item.getStatus().equals(DictConstants.EIMS_ORDITM_STATUS_DETAIL.YIWANCHENG)).toList(); + if(!wwc.isEmpty()){ + return false; + } + } + + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + */ + private void validEntityBeforeSave(EimsMaintOrder entity){ + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + /** + * 鏍¢獙骞舵壒閲忓垹闄や繚鍏诲伐鍗曚俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if(isValid){ + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return baseMapper.deleteByIds(ids) > 0; + } + + + @Override + public String selectMaintOrderCodeByIds(String orderIds) { + List<String> list = new ArrayList<>(); + for (Long id : StringUtils.splitTo(orderIds, Convert::toLong)) { + EimsMaintOrderVo vo = SpringUtils.getAopProxy(this).queryById(id); + if (ObjectUtil.isNotNull(vo)) { + list.add(vo.getMaintCode()); + } + } + return String.join(StringUtils.SEPARATOR, list); + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrditmServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrditmServiceImpl.java new file mode 100644 index 0000000..b3dfde2 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintOrditmServiceImpl.java @@ -0,0 +1,170 @@ +package org.dromara.eims.service.impl; + +import org.dromara.common.core.constant.DictConstants; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.eims.domain.EimsMaintOrder; +import org.dromara.eims.mapper.EimsMaintOrderMapper; +import org.springframework.stereotype.Service; +import org.dromara.eims.domain.bo.EimsMaintOrditmBo; +import org.dromara.eims.domain.vo.EimsMaintOrditmVo; +import org.dromara.eims.domain.EimsMaintOrditm; +import org.dromara.eims.mapper.EimsMaintOrditmMapper; +import org.dromara.eims.service.IEimsMaintOrditmService; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 宸ュ崟鏉$洰Service涓氬姟灞傚鐞� + * + * @author zhuguifei + * @date 2025-03-10 + */ +@RequiredArgsConstructor +@Service +public class EimsMaintOrditmServiceImpl implements IEimsMaintOrditmService { + + private final EimsMaintOrditmMapper baseMapper; + private final EimsMaintOrderMapper orderMapper; + + /** + * 鏌ヨ宸ュ崟鏉$洰 + * + * @param id 涓婚敭 + * @return 宸ュ崟鏉$洰 + */ + @Override + public EimsMaintOrditmVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 鍒嗛〉鏌ヨ宸ュ崟鏉$洰鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 宸ュ崟鏉$洰鍒嗛〉鍒楄〃 + */ + @Override + public TableDataInfo<EimsMaintOrditmVo> queryPageList(EimsMaintOrditmBo bo, PageQuery pageQuery) { + LambdaQueryWrapper<EimsMaintOrditm> lqw = buildQueryWrapper(bo); + Page<EimsMaintOrditmVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勫伐鍗曟潯鐩垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 宸ュ崟鏉$洰鍒楄〃 + */ + @Override + public List<EimsMaintOrditmVo> queryList(EimsMaintOrditmBo bo) { + LambdaQueryWrapper<EimsMaintOrditm> lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper<EimsMaintOrditm> buildQueryWrapper(EimsMaintOrditmBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<EimsMaintOrditm> lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getOrderId() != null, EimsMaintOrditm::getOrderId, bo.getOrderId()); + lqw.eq(bo.getEquId() != null, EimsMaintOrditm::getEquId, bo.getEquId()); + lqw.like(StringUtils.isNotBlank(bo.getItmName()), EimsMaintOrditm::getItmName, bo.getItmName()); + lqw.eq(StringUtils.isNotBlank(bo.getItmAction()), EimsMaintOrditm::getItmAction, bo.getItmAction()); + lqw.eq(bo.getItmUser() != null, EimsMaintOrditm::getItmUser, bo.getItmUser()); + lqw.eq(bo.getItmTime() != null, EimsMaintOrditm::getItmTime, bo.getItmTime()); + lqw.eq(StringUtils.isNotBlank(bo.getStatus()), EimsMaintOrditm::getStatus, bo.getStatus()); + return lqw; + } + + /** + * 鏂板宸ュ崟鏉$洰 + * + * @param bo 宸ュ崟鏉$洰 + * @return 鏄惁鏂板鎴愬姛 + */ + @Override + public Boolean insertByBo(EimsMaintOrditmBo bo) { + EimsMaintOrditm add = MapstructUtils.convert(bo, EimsMaintOrditm.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 淇敼宸ュ崟鏉$洰 + * + * @param bo 宸ュ崟鏉$洰 + * @return 鏄惁淇敼鎴愬姛 + */ + @Transactional(rollbackFor = Exception.class) + @Override + public Boolean updateByBo(EimsMaintOrditmBo bo) { + EimsMaintOrditm update = MapstructUtils.convert(bo, EimsMaintOrditm.class); + // 瀹屾垚宸ュ崟鏄庣粏鍚屾淇敼宸ュ崟鐘舵�� + //1.绗竴娆″畬鎴愪繚鍏诲伐鍗曟槑缁嗘妸淇濆吇宸ュ崟鐘舵�佷慨鏀逛负 淇濆吇涓� + Long orderId = bo.getOrderId(); + EimsMaintOrder order = orderMapper.selectById(orderId); + if(bo.getStatus().equals(DictConstants.EIMS_ORDITM_STATUS_DETAIL.YIWANCHENG)){ + //娌℃湁瀹屾垚鏃堕棿鑷姩娣诲姞瀹屾垚鏃堕棿 + if(bo.getItmTime()==null){ + update.setItmTime(new Date()); + } + if(order.getStatus().equals(DictConstants.MAINT_ORDER_STATUS_DETAIL.DAIBAOYANG)){ + order.setStatus(DictConstants.MAINT_ORDER_STATUS_DETAIL.BAOYANG); + if(order.getStartTime()==null){ + order.setStartTime(new Date()); + } + orderMapper.updateById(order); + } + } + validEntityBeforeSave(update); + boolean flag = baseMapper.updateById(update) > 0; + //2.鏌ヨ鎵�鏈変繚鍏婚」鏄惁閮藉凡瀹屾垚 + LambdaQueryWrapper<EimsMaintOrditm> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.eq(EimsMaintOrditm::getOrderId, bo.getOrderId()); + List<EimsMaintOrditm> eimsMaintOrditms = baseMapper.selectList(queryWrapper); + List<EimsMaintOrditm> wwc = eimsMaintOrditms.stream().filter(item->!item.getStatus().equals(DictConstants.EIMS_ORDITM_STATUS_DETAIL.YIWANCHENG)).toList(); + if(wwc.isEmpty()){ + order.setStatus(DictConstants.MAINT_ORDER_STATUS_DETAIL.DAIYANZHENG); + orderMapper.updateById(order); + } + + return flag; + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + */ + private void validEntityBeforeSave(EimsMaintOrditm entity){ + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + /** + * 鏍¢獙骞舵壒閲忓垹闄ゅ伐鍗曟潯鐩俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if(isValid){ + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintPlanServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintPlanServiceImpl.java new file mode 100644 index 0000000..8cbc9af --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintPlanServiceImpl.java @@ -0,0 +1,235 @@ +package org.dromara.eims.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import lombok.SneakyThrows; +import org.dromara.common.core.constant.DictConstants; +import org.dromara.common.core.utils.DateUtils; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.dromara.eims.domain.vo.EimsRepairResVo; +import org.dromara.system.domain.SysDept; +import org.dromara.system.domain.vo.SysDeptVo; +import org.dromara.system.mapper.SysDeptMapper; +import org.springframework.stereotype.Service; +import org.dromara.eims.domain.bo.EimsMaintPlanBo; +import org.dromara.eims.domain.vo.EimsMaintPlanVo; +import org.dromara.eims.domain.EimsMaintPlan; +import org.dromara.eims.mapper.EimsMaintPlanMapper; +import org.dromara.eims.service.IEimsMaintPlanService; + +import java.util.*; + +/** + * 淇濆吇璁″垝Service涓氬姟灞傚鐞� + * + * @author zhuguifei + * @date 2025-03-04 + */ +@RequiredArgsConstructor +@Service +public class EimsMaintPlanServiceImpl implements IEimsMaintPlanService { + + private final EimsMaintPlanMapper baseMapper; + private final SysDeptMapper sysDeptMapper; + + /** + * 鏌ヨ淇濆吇璁″垝 + * + * @param id 涓婚敭 + * @return 淇濆吇璁″垝 + */ + @Override + public EimsMaintPlanVo queryById(Long id) { + return baseMapper.selectVoById(id); + } + + /** + * 鍒嗛〉鏌ヨ淇濆吇璁″垝鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇璁″垝鍒嗛〉鍒楄〃 + */ + @Override + public TableDataInfo<EimsMaintPlanVo> queryPageList(EimsMaintPlanBo bo, PageQuery pageQuery) { + LambdaQueryWrapper<EimsMaintPlan> lqw = buildQueryWrapper(bo); + Page<EimsMaintPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + @Override + public TableDataInfo<EimsMaintPlanVo> queryPageListCustom(EimsMaintPlanBo bo, PageQuery pageQuery) { + Page<EimsMaintPlanVo> page = baseMapper.selectMaintPlanList(pageQuery.build(), buildWrapper(bo)); + return TableDataInfo.build(page); + } + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勪繚鍏昏鍒掑垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 淇濆吇璁″垝鍒楄〃 + */ + @Override + public List<EimsMaintPlanVo> queryList(EimsMaintPlanBo bo) { + LambdaQueryWrapper<EimsMaintPlan> lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper<EimsMaintPlan> buildQueryWrapper(EimsMaintPlanBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<EimsMaintPlan> lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getEquId() != null, EimsMaintPlan::getEquId, bo.getEquId()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintType()), EimsMaintPlan::getMaintType, bo.getMaintType()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintCycleUnit()), EimsMaintPlan::getMaintCycleUnit, bo.getMaintCycleUnit()); + lqw.eq(StringUtils.isNotBlank(bo.getMaintRule()), EimsMaintPlan::getMaintRule, bo.getMaintRule()); + lqw.eq(bo.getMaintUser() != null, EimsMaintPlan::getMaintUser, bo.getMaintUser()); + lqw.eq(bo.getMaintDept() != null, EimsMaintPlan::getMaintDept, bo.getMaintDept()); + lqw.eq(bo.getStatus() != null, EimsMaintPlan::getStatus, bo.getStatus()); + return lqw; + } + + private QueryWrapper<EimsMaintPlan> buildWrapper(EimsMaintPlanBo bo) { + Map<String, Object> params = bo.getParams(); + QueryWrapper<EimsMaintPlan> qw = Wrappers.query(); + qw.eq(bo.getEquId() != null, "mp.equ_id", bo.getEquId()); + qw.like(bo.getEquName() != null, "equ.equ_name", bo.getEquName()); + qw.like(bo.getAssetNo() != null, "equ.asset_no", bo.getAssetNo()); + qw.eq(StringUtils.isNotBlank(bo.getMaintType()), "mp.maint_type", bo.getMaintType()); + qw.eq(StringUtils.isNotBlank(bo.getMaintCycleUnit()), "mp.maint_cycle_unit", bo.getMaintCycleUnit()); + qw.eq(StringUtils.isNotBlank(bo.getMaintRule()), "mp.maint_rule", bo.getMaintRule()); + qw.eq(bo.getMaintUser() != null, "mp.maint_user", bo.getMaintUser()); + qw.in(bo.getMaintDept() != null, "mp.maint_dept", getAllDescendantIds(bo.getMaintDept())); + qw.eq(bo.getStatus() != null, "mp.status", bo.getStatus()); + return qw; + } + + /** + * 鏍规嵁id锛岃幏鍙栨墍鏈夊悗浠d + * + * @param rootId + * @return + */ + public List<Long> getAllDescendantIds(Long rootId) { + List<Long> result = new ArrayList<>(); + result.add(rootId); + collectDescendants(rootId, result); + return result; + } + + private void collectDescendants(Long currentId, List<Long> collector) { + QueryWrapper<SysDept> sysDeptWrapper = new QueryWrapper<>(); + sysDeptWrapper.lambda().eq(SysDept::getParentId, currentId); + + List<SysDeptVo> children = sysDeptMapper.selectVoList(sysDeptWrapper); + if (children != null && !children.isEmpty()) { + for (SysDeptVo child : children) { + Long childId = child.getDeptId(); + collector.add(childId); + collectDescendants(childId, collector); + } + } + } + + /** + * 鏂板淇濆吇璁″垝 + * + * @param bo 淇濆吇璁″垝 + * @return 鏄惁鏂板鎴愬姛 + */ + @Override + public Boolean insertByBo(EimsMaintPlanBo bo) { + setMaintNextTime(bo); + EimsMaintPlan add = MapstructUtils.convert(bo, EimsMaintPlan.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 璁$畻淇濆吇璁″垝涓嬫鎵ц鏃堕棿 + */ + @SneakyThrows + private void setMaintNextTime(EimsMaintPlanBo bo) { + Date maintFirstTime = bo.getMaintFirstTime(); + Date maintLastTime = bo.getMaintLastTime(); + //涓嬫淇濆吇鏃堕棿璁$畻瑙勫垯 0-鎸夊浐瀹氬懆鏈� 1-鎸変笂娆′繚鍏绘椂闂� + Date nextDate = (maintLastTime != null && bo.getMaintRule().equals(DictConstants.MAINT_TIME_RULE_DETAIL.LAST)) ? maintLastTime :maintFirstTime; + + //棣栨鎵ц鏃堕棿涓虹┖鎶涘嚭寮傚父 + if (maintFirstTime == null) { + throw new Exception("棣栨鎵ц鏃堕棿涓嶈兘涓虹┖!"); + } + //鍛ㄦ湡 + Long maintCycle = bo.getMaintCycle(); + //鍗曚綅 1-澶� 2-鍛� 3-鏈� 4-瀛� 5-骞� + String maintCycleUnit = bo.getMaintCycleUnit(); + switch (maintCycleUnit) { + case "1": + nextDate = DateUtils.addDays(nextDate, maintCycle.intValue()); + break; + case "2": + nextDate = DateUtils.addWeeks(nextDate, maintCycle.intValue()); + break; + case "3": + nextDate = DateUtils.addMonths(nextDate, maintCycle.intValue()); + break; + case "4": + nextDate = DateUtils.addMonths(nextDate, maintCycle.intValue() * 3); + break; + case "5": + nextDate = DateUtils.addYears(nextDate, maintCycle.intValue()); + break; + + } + bo.setMaintNextTime(nextDate); + + + } + + /** + * 淇敼淇濆吇璁″垝 + * + * @param bo 淇濆吇璁″垝 + * @return 鏄惁淇敼鎴愬姛 + */ + @Override + public Boolean updateByBo(EimsMaintPlanBo bo) { + //setMaintNextTime(bo); + EimsMaintPlan update = MapstructUtils.convert(bo, EimsMaintPlan.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + */ + private void validEntityBeforeSave(EimsMaintPlan entity) { + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + /** + * 鏍¢獙骞舵壒閲忓垹闄や繚鍏昏鍒掍俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if (isValid) { + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return baseMapper.deleteByIds(ids) > 0; + } + + +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStandServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStandServiceImpl.java new file mode 100644 index 0000000..d1e76d2 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/EimsMaintStandServiceImpl.java @@ -0,0 +1,135 @@ +package org.dromara.eims.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.dromara.eims.domain.bo.EimsMaintStandBo; +import org.dromara.eims.domain.vo.EimsMaintStandVo; +import org.dromara.eims.domain.EimsMaintStand; +import org.dromara.eims.mapper.EimsMaintStandMapper; +import org.dromara.eims.service.IEimsMaintStandService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 淇濆吇鏍囧噯Service涓氬姟灞傚鐞� + * + * @author zhuguifei + * @date 2025-03-04 + */ +@RequiredArgsConstructor +@Service +public class EimsMaintStandServiceImpl implements IEimsMaintStandService { + + private final EimsMaintStandMapper baseMapper; + + /** + * 鏌ヨ淇濆吇鏍囧噯 + * + * @param id 涓婚敭 + * @return 淇濆吇鏍囧噯 + */ + @Override + public EimsMaintStandVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 鍒嗛〉鏌ヨ淇濆吇鏍囧噯鍒楄〃 + * + * @param bo 鏌ヨ鏉′欢 + * @param pageQuery 鍒嗛〉鍙傛暟 + * @return 淇濆吇鏍囧噯鍒嗛〉鍒楄〃 + */ + @Override + public TableDataInfo<EimsMaintStandVo> queryPageList(EimsMaintStandBo bo, PageQuery pageQuery) { + LambdaQueryWrapper<EimsMaintStand> lqw = buildQueryWrapper(bo); + Page<EimsMaintStandVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 鏌ヨ绗﹀悎鏉′欢鐨勪繚鍏绘爣鍑嗗垪琛� + * + * @param bo 鏌ヨ鏉′欢 + * @return 淇濆吇鏍囧噯鍒楄〃 + */ + @Override + public List<EimsMaintStandVo> queryList(EimsMaintStandBo bo) { + LambdaQueryWrapper<EimsMaintStand> lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper<EimsMaintStand> buildQueryWrapper(EimsMaintStandBo bo) { + Map<String, Object> params = bo.getParams(); + LambdaQueryWrapper<EimsMaintStand> lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getEquId() != null, EimsMaintStand::getEquId, bo.getEquId()); + lqw.eq(bo.getEquTypeId() != null, EimsMaintStand::getEquTypeId, bo.getEquTypeId()); + lqw.like(StringUtils.isNotBlank(bo.getAssetNo()), EimsMaintStand::getAssetNo, bo.getAssetNo()); + lqw.like(StringUtils.isNotBlank(bo.getEquName()), EimsMaintStand::getEquName, bo.getEquName()); + lqw.like(StringUtils.isNotBlank(bo.getModelNo()), EimsMaintStand::getModelNo, bo.getModelNo()); + lqw.like(StringUtils.isNotBlank(bo.getName()), EimsMaintStand::getName, bo.getName()); + lqw.like(StringUtils.isNotBlank(bo.getStand()), EimsMaintStand::getStand, bo.getStand()); + return lqw; + } + + /** + * 鏂板淇濆吇鏍囧噯 + * + * @param bo 淇濆吇鏍囧噯 + * @return 鏄惁鏂板鎴愬姛 + */ + @Override + public Boolean insertByBo(EimsMaintStandBo bo) { + EimsMaintStand add = MapstructUtils.convert(bo, EimsMaintStand.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 淇敼淇濆吇鏍囧噯 + * + * @param bo 淇濆吇鏍囧噯 + * @return 鏄惁淇敼鎴愬姛 + */ + @Override + public Boolean updateByBo(EimsMaintStandBo bo) { + EimsMaintStand update = MapstructUtils.convert(bo, EimsMaintStand.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙 + */ + private void validEntityBeforeSave(EimsMaintStand entity){ + //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + } + + /** + * 鏍¢獙骞舵壒閲忓垹闄や繚鍏绘爣鍑嗕俊鎭� + * + * @param ids 寰呭垹闄ょ殑涓婚敭闆嗗悎 + * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠� + * @return 鏄惁鍒犻櫎鎴愬姛 + */ + @Override + public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { + if(isValid){ + //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠� + } + return baseMapper.deleteByIds(ids) > 0; + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/GenerateCodeServiceImpl.java b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/GenerateCodeServiceImpl.java new file mode 100644 index 0000000..07d1301 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/java/org/dromara/eims/service/impl/GenerateCodeServiceImpl.java @@ -0,0 +1,39 @@ +package org.dromara.eims.service.impl; + +import lombok.RequiredArgsConstructor; +import org.dromara.common.core.constant.CacheConstants; +import org.dromara.common.core.domain.R; +import org.dromara.common.redis.utils.RedisUtils; +import org.dromara.eims.service.IGenerateCodeService; +import org.springframework.stereotype.Service; + +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +@RequiredArgsConstructor +@Service +public class GenerateCodeServiceImpl implements IGenerateCodeService { + @Override + public String generateCode(String prefix) { + String key = CacheConstants.EIMS_GENERATE_CODE + ":" + prefix; + String todayStr = DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now()); + String code; + // 浣跨敤Redis鐨勫師瀛愭�ф搷浣滈伩鍏嶅苟鍙戦棶棰� + String oldCode = RedisUtils.getCacheObject(key); + if (oldCode != null && oldCode.contains(todayStr)) { + int no = Integer.parseInt(oldCode.substring(oldCode.length() - 4)); + code = String.format("%s%s%04d", prefix, todayStr, no + 1); + } else { + code = String.format("%s%s%04d", prefix, todayStr, 1); + } + + // 鏇存柊缂撳瓨 + try { + RedisUtils.setCacheObject(key, code); + return code; + } catch (Exception e) { + return null; + } + + + } +} diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrderMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrderMapper.xml new file mode 100644 index 0000000..e320526 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrderMapper.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.dromara.eims.mapper.EimsMaintOrderMapper"> + <resultMap type="org.dromara.eims.domain.vo.EimsMaintOrderVo" id="EimsMaintOrderResult"> + </resultMap> + <select id="selectMaintOrderList" resultMap="EimsMaintOrderResult"> + SELECT mo.*,equ.equ_name equName,equ.equ_code equCode,equ.asset_no assetNo,equ.model_no modelNo,mo.create_time createTime, + us.nick_name maintUserName,dp.dept_name maintDeptName,ue.nick_name verifyUserName, + CONCAT_WS('', mo.maint_cycle, dd.dict_label) maintCycleUnitName + FROM eims_maint_order mo + LEFT JOIN eims_equ equ ON mo.equ_id = equ.equ_id + LEFT JOIN sys_user us ON mo.maint_user = us.user_id + LEFT JOIN sys_user ue ON mo.verify_user = ue.user_id + LEFT JOIN sys_dept dp ON mo.maint_dept = dp.dept_id + LEFT JOIN sys_dict_data dd on dd.dict_type = 'maint_cycle_unit' and dd.dict_value = mo.maint_cycle_unit + ${ew.getCustomSqlSegment} + </select> +</mapper> diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrditmMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrditmMapper.xml new file mode 100644 index 0000000..0fe9238 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintOrditmMapper.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.dromara.eims.mapper.EimsMaintOrditmMapper"> + +</mapper> diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintPlanMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintPlanMapper.xml new file mode 100644 index 0000000..0987499 --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintPlanMapper.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.dromara.eims.mapper.EimsMaintPlanMapper"> + <resultMap type="org.dromara.eims.domain.vo.EimsMaintPlanVo" id="EimsMaintPlanResult"> + </resultMap> + <select id="selectMaintPlanList" resultMap="EimsMaintPlanResult"> + SELECT mp.*,equ.equ_name equName,equ.equ_code equCode,equ.asset_no assetNo,equ.model_no modelNo, + us.nick_name maintUserName,dp.dept_name maintDeptName, + CONCAT_WS('', mp.maint_cycle, dd.dict_label) maintCycleUnitName + FROM eims_maint_plan mp + LEFT JOIN eims_equ equ ON mp.equ_id = equ.equ_id + LEFT JOIN sys_user us ON mp.maint_user = us.user_id + LEFT JOIN sys_dept dp ON mp.maint_dept = dp.dept_id + LEFT JOIN sys_dict_data dd on dd.dict_type = 'maint_cycle_unit' and dd.dict_value = mp.maint_cycle_unit + ${ew.getCustomSqlSegment} + </select> +</mapper> diff --git a/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintStandMapper.xml b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintStandMapper.xml new file mode 100644 index 0000000..92692fa --- /dev/null +++ b/eims/ruoyi-modules/lb-eims/src/main/resources/mapper/eims/EimsMaintStandMapper.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="org.dromara.eims.mapper.EimsMaintStandMapper"> + +</mapper> -- Gitblit v1.9.3