| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # 彿¡£å°è´¦ï¼æäº§åèåï¼åç«¯å¯¹æ¥ææ¡£ |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - 彿¡£å°è´¦å表页ï¼ä¿®æ¹ï¼ |
| | | - 彿¡£å°è´¦è¯¦æ
å¼¹çª/页é¢ï¼æ°å¢ï¼ |
| | | |
| | | ## API |
| | | |
| | | ### 1. å页æ¥è¯¢ï¼æé¡¹ç®/产åèåï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | GET | /mes/pd/archive/page | 彿¡£å°è´¦åé¡µï¼æé¡¹ç®/产åèåï¼ | |
| | | |
| | | **请æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | pageNo | Integer | æ¯ | 页ç ï¼ä»1å¼å§ï¼ | |
| | | | pageSize | Integer | æ¯ | æ¯é¡µæ¡æ° | |
| | | | archiveCode | String | å¦ | 彿¡£ç¼å·ï¼æ¨¡ç³æç´¢ï¼ | |
| | | | projectId | Long | å¦ | 设计项ç®ID | |
| | | | archiveStatus | Integer | å¦ | 彿¡£ç¶æï¼0=å¾
彿¡£ 1=已彿¡£ï¼ | |
| | | | productCode | String | å¦ | 产åç¼ç ï¼æ¨¡ç³æç´¢ï¼ | |
| | | | productName | String | å¦ | 产ååç§°ï¼æ¨¡ç³æç´¢ï¼ | |
| | | |
| | | **ååºç»æï¼** |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "data": { |
| | | "list": [ |
| | | { |
| | | "id": 3, |
| | | "archiveCode": "ARC20240003", |
| | | "projectId": 1, |
| | | "taskCode": "PD20240001", |
| | | "taskName": "æ°äº§å设计任å¡", |
| | | "productCode": "P001", |
| | | "productName": "注å¡äº§åA", |
| | | "archiveCount": 3, |
| | | "archiver": 1, |
| | | "archiverNickname": "çäº", |
| | | "archiveStatus": 1, |
| | | "archiveTime": "2024-01-03 10:00:00", |
| | | "remark": "", |
| | | "createTime": "2024-01-01 00:00:00", |
| | | "updater": "1", |
| | | "updaterNickname": "å¼ ä¸", |
| | | "updateTime": "2024-01-03 15:30:00" |
| | | } |
| | | ], |
| | | "total": 5 |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | **åæ®µè¯´æï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | id | Long | ææ°å½æ¡£è®°å½ID | |
| | | | archiveCode | String | ææ°å½æ¡£ç¼å· | |
| | | | projectId | Long | 设计项ç®ID | |
| | | | taskCode | String | ä»»å¡ç¼ç | |
| | | | taskName | String | ä»»å¡åç§° | |
| | | | productCode | String | 产åç¼ç | |
| | | | productName | String | 产ååç§° | |
| | | | archiveCount | Integer | 该项ç®ä¸å½æ¡£è®°å½æ»æ° | |
| | | | archiver | Long | 彿¡£äººID | |
| | | | archiverNickname | String | 彿¡£äººåç§° | |
| | | | archiveStatus | Integer | 彿¡£ç¶æï¼åå
¸ mes_pd_archive_statusï¼ | |
| | | | archiveTime | LocalDateTime | 彿¡£æ¶é´ | |
| | | | remark | String | 夿³¨ | |
| | | | createTime | LocalDateTime | å建æ¶é´ | |
| | | | updater | String | æ´æ°äººID | |
| | | | updaterNickname | String | æ´æ°äººåç§° | |
| | | | updateTime | LocalDateTime | æ´æ°æ¶é´ | |
| | | |
| | | --- |
| | | |
| | | ### 2. 详æ
æ¥è¯¢ï¼æäº§åç¼ç ï¼ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | GET | /mes/pd/archive/detail-by-product | 彿¡£å°è´¦è¯¦æ
ï¼æäº§åç¼ç æ¥è¯¢ï¼ | |
| | | |
| | | **请æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | productCode | String | æ¯ | 产åç¼ç | |
| | | |
| | | **ååºç»æï¼** |
| | | |
| | | è¿å `List<MesPdArchiveDetailRespVO>`ï¼åä¸äº§åç¼ç å¯è½å
³èå¤ä¸ªè®¾è®¡é¡¹ç®ï¼æ¯ä¸ªé¡¹ç®ä¸æ¡è¯¦æ
ã |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "data": [ |
| | | { |
| | | "project": { |
| | | "id": 1, |
| | | "taskCode": "PD20240001", |
| | | "taskName": "æ°äº§å设计任å¡", |
| | | "productCode": "P001", |
| | | "productName": "注å¡äº§åA", |
| | | "version": "V1.0", |
| | | "status": 4, |
| | | "chiefDesigner": 1, |
| | | "chiefDesignerNickname": "å¼ ä¸", |
| | | "reviewer": 2, |
| | | "reviewerNickname": "æå", |
| | | "planFinishTime": "2024-12-31 00:00:00", |
| | | "remark": "", |
| | | "createTime": "2024-01-01 00:00:00" |
| | | }, |
| | | "archives": [ |
| | | { |
| | | "id": 1, |
| | | "archiveCode": "ARC20240001", |
| | | "archiver": 1, |
| | | "archiverNickname": "çäº", |
| | | "archiveStatus": 1, |
| | | "archiveTime": "2024-01-01 10:00:00", |
| | | "remark": "", |
| | | "createTime": "2024-01-01 10:00:00" |
| | | }, |
| | | { |
| | | "id": 2, |
| | | "archiveCode": "ARC20240002", |
| | | "archiver": 1, |
| | | "archiverNickname": "çäº", |
| | | "archiveStatus": 1, |
| | | "archiveTime": "2024-01-02 10:00:00", |
| | | "remark": "", |
| | | "createTime": "2024-01-02 10:00:00" |
| | | } |
| | | ], |
| | | "documents": [ |
| | | { |
| | | "id": 1, |
| | | "documentType": "1", |
| | | "documentName": "产å设计å¾", |
| | | "documentVersion": "V1.0", |
| | | "fileName": "design.pdf", |
| | | "fileUrl": "/files/design.pdf", |
| | | "uploadUserId": 1, |
| | | "uploadUserNickname": "èµµå
", |
| | | "uploadTime": "2024-01-01 09:00:00", |
| | | "remark": "", |
| | | "createTime": "2024-01-01 09:00:00" |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | **ProjectInfo åæ®µè¯´æï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | id | Long | 项ç®ID | |
| | | | taskCode | String | ä»»å¡ç¼ç | |
| | | | taskName | String | ä»»å¡åç§° | |
| | | | productCode | String | 产åç¼ç | |
| | | | productName | String | 产ååç§° | |
| | | | version | String | çæ¬å· | |
| | | | status | Integer | 项ç®ç¶æï¼åå
¸ mes_pd_project_statusï¼0=å¾
åå¸ 1=å¾
ä¸ä¼ 2=å¾
å®¡æ ¸ 3=å¾
彿¡£ 4=已彿¡£ï¼ | |
| | | | chiefDesigner | Long | 主设计å¸ID | |
| | | | chiefDesignerNickname | String | 主设计å¸åç§° | |
| | | | reviewer | Long | å®¡æ ¸äººID | |
| | | | reviewerNickname | String | å®¡æ ¸äººåç§° | |
| | | | planFinishTime | LocalDateTime | 计å宿æ¶é´ | |
| | | | remark | String | 夿³¨ | |
| | | | createTime | LocalDateTime | å建æ¶é´ | |
| | | |
| | | **ArchiveInfo åæ®µè¯´æï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | id | Long | 彿¡£ID | |
| | | | archiveCode | String | 彿¡£ç¼å· | |
| | | | archiver | Long | 彿¡£äººID | |
| | | | archiverNickname | String | 彿¡£äººåç§° | |
| | | | archiveStatus | Integer | 彿¡£ç¶æï¼åå
¸ mes_pd_archive_statusï¼ | |
| | | | archiveTime | LocalDateTime | 彿¡£æ¶é´ | |
| | | | remark | String | 夿³¨ | |
| | | | createTime | LocalDateTime | å建æ¶é´ | |
| | | |
| | | **DocumentInfo åæ®µè¯´æï¼** |
| | | |
| | | | åæ®µ | ç±»å | 说æ | |
| | | |------|------|------| |
| | | | id | Long | èµæID | |
| | | | documentType | String | èµæç±»åï¼åå
¸ mes_pd_document_typeï¼ | |
| | | | documentName | String | èµæåç§° | |
| | | | documentVersion | String | èµæçæ¬ | |
| | | | fileName | String | æä»¶å | |
| | | | fileUrl | String | æä»¶URL | |
| | | | uploadUserId | Long | ä¸ä¼ 人ID | |
| | | | uploadUserNickname | String | ä¸ä¼ 人åç§° | |
| | | | uploadTime | LocalDateTime | ä¸ä¼ æ¶é´ | |
| | | | remark | String | 夿³¨ | |
| | | | createTime | LocalDateTime | å建æ¶é´ | |
| | | |
| | | --- |
| | | |
| | | ## å端修æ¹ç¹ |
| | | |
| | | ### 1. å表页 - æç´¢æ æ°å¢ |
| | | |
| | | ```html |
| | | <el-form :model="queryParams" ref="queryFormRef" :inline="true"> |
| | | <el-form-item label="产åç¼ç " prop="productCode"> |
| | | <el-input v-model="queryParams.productCode" placeholder="请è¾å
¥äº§åç¼ç " clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="产ååç§°" prop="productName"> |
| | | <el-input v-model="queryParams.productName" placeholder="请è¾å
¥äº§ååç§°" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="彿¡£ç¶æ" prop="archiveStatus"> |
| | | <el-select v-model="queryParams.archiveStatus" placeholder="è¯·éæ©å½æ¡£ç¶æ" clearable> |
| | | <el-option v-for="dict in getIntDictOptions(DICT_TYPE.MES_PD_ARCHIVE_STATUS)" |
| | | :key="dict.value" :label="dict.label" :value="dict.value" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleQuery"><Icon icon="ep:search" />æç´¢</el-button> |
| | | <el-button @click="resetQuery"><Icon icon="ep:refresh" />éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | ``` |
| | | |
| | | ### 2. å表页 - è¡¨æ ¼æ°å¢å |
| | | |
| | | ```html |
| | | <el-table v-loading="loading" :data="list"> |
| | | <el-table-column label="产åç¼ç " align="center" prop="productCode" /> |
| | | <el-table-column label="产ååç§°" align="center" prop="productName" /> |
| | | <el-table-column label="彿¡£æ°é" align="center" prop="archiveCount" width="100" /> |
| | | <el-table-column label="æ´æ°äºº" align="center" prop="updaterNickname" /> |
| | | <el-table-column label="æ´æ°æ¶é´" align="center" prop="updateTime" width="180" /> |
| | | <el-table-column label="æä½" align="center" width="100"> |
| | | <template #default="scope"> |
| | | <el-button link type="primary" @click="handleDetail(scope.row.productCode)" |
| | | v-hasPermi="['mes:pd-archive:query']">详æ
</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | ``` |
| | | |
| | | ### 3. 详æ
å¼¹çª/é¡µé¢ - æ°å¢ |
| | | |
| | | ```html |
| | | <!-- æäº§åç¼ç å¯è½è¿åå¤ä¸ªé¡¹ç®ï¼ç¨ tab ææé£ç´å±ç¤º --> |
| | | <el-tabs v-model="activeProject" type="border-card"> |
| | | <el-tab-pane v-for="(detail, index) in detailList" :key="detail.project.id" |
| | | :label="detail.project.taskName" :name="String(index)"> |
| | | |
| | | <!-- 项ç®ä¿¡æ¯ --> |
| | | <el-descriptions :column="3" border> |
| | | <el-descriptions-item label="ä»»å¡ç¼ç ">{{ detail.project.taskCode }}</el-descriptions-item> |
| | | <el-descriptions-item label="ä»»å¡åç§°">{{ detail.project.taskName }}</el-descriptions-item> |
| | | <el-descriptions-item label="产åç¼ç ">{{ detail.project.productCode }}</el-descriptions-item> |
| | | <el-descriptions-item label="产ååç§°">{{ detail.project.productName }}</el-descriptions-item> |
| | | <el-descriptions-item label="çæ¬å·">{{ detail.project.version }}</el-descriptions-item> |
| | | <el-descriptions-item label="主设计å¸">{{ detail.project.chiefDesignerNickname }}</el-descriptions-item> |
| | | <el-descriptions-item label="å®¡æ ¸äºº">{{ detail.project.reviewerNickname }}</el-descriptions-item> |
| | | <el-descriptions-item label="计å宿æ¶é´">{{ detail.project.planFinishTime }}</el-descriptions-item> |
| | | </el-descriptions> |
| | | |
| | | <!-- 彿¡£è®°å½å表 --> |
| | | <el-card header="彿¡£è®°å½" style="margin-top: 16px"> |
| | | <el-table :data="detail.archives" border> |
| | | <el-table-column label="彿¡£ç¼å·" prop="archiveCode" /> |
| | | <el-table-column label="彿¡£äºº" prop="archiverNickname" /> |
| | | <el-table-column label="彿¡£ç¶æ" prop="archiveStatus"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.MES_PD_ARCHIVE_STATUS" :value="scope.row.archiveStatus" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="彿¡£æ¶é´" prop="archiveTime" width="180" /> |
| | | <el-table-column label="夿³¨" prop="remark" show-overflow-tooltip /> |
| | | </el-table> |
| | | </el-card> |
| | | |
| | | <!-- è®¾è®¡èµæå表 --> |
| | | <el-card header="è®¾è®¡èµæ" style="margin-top: 16px"> |
| | | <el-table :data="detail.documents" border> |
| | | <el-table-column label="èµæåç§°" prop="documentName" /> |
| | | <el-table-column label="èµæç±»å" prop="documentType"> |
| | | <template #default="scope"> |
| | | <dict-tag :type="DICT_TYPE.MES_PD_DOCUMENT_TYPE" :value="scope.row.documentType" /> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="çæ¬" prop="documentVersion" width="80" /> |
| | | <el-table-column label="æä»¶å" prop="fileName" /> |
| | | <el-table-column label="ä¸ä¼ 人" prop="uploadUserNickname" /> |
| | | <el-table-column label="ä¸ä¼ æ¶é´" prop="uploadTime" width="180" /> |
| | | <el-table-column label="æä½" width="80"> |
| | | <template #default="scope"> |
| | | <el-button v-if="scope.row.fileUrl" link type="primary" @click="handleDownload(scope.row)">ä¸è½½</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-card> |
| | | |
| | | </el-tab-pane> |
| | | </el-tabs> |
| | | ``` |
| | | |
| | | ### 4. API æ¥å£å®ä¹ |
| | | |
| | | æä»¶è·¯å¾ï¼`src/api/mes/pd/archive/index.ts` |
| | | |
| | | ```ts |
| | | import request from '@/config/axios' |
| | | |
| | | // è·å¾å½æ¡£å°è´¦åé¡µï¼æé¡¹ç®/产åèåï¼ |
| | | export const getArchivePage = (params) => { |
| | | return request.get({ url: '/mes/pd/archive/page', params }) |
| | | } |
| | | |
| | | // è·å¾å½æ¡£å°è´¦è¯¦æ
ï¼æäº§åç¼ç ï¼ |
| | | export const getArchiveDetailByProduct = (productCode: string) => { |
| | | return request.get({ url: '/mes/pd/archive/detail-by-product', params: { productCode } }) |
| | | } |
| | | |
| | | // åå»ºå½æ¡£å°è´¦ |
| | | export const createArchive = (data) => { |
| | | return request.post({ url: '/mes/pd/archive/create', data }) |
| | | } |
| | | |
| | | // æ´æ°å½æ¡£å°è´¦ |
| | | export const updateArchive = (data) => { |
| | | return request.put({ url: '/mes/pd/archive/update', data }) |
| | | } |
| | | |
| | | // å é¤å½æ¡£å°è´¦ |
| | | export const deleteArchive = (id: number) => { |
| | | return request.delete({ url: '/mes/pd/archive/delete?id=' + id }) |
| | | } |
| | | |
| | | // è·å¾å½æ¡£å°è´¦ |
| | | export const getArchive = (id: number) => { |
| | | return request.get({ url: '/mes/pd/archive/get?id=' + id }) |
| | | } |
| | | |
| | | // 导åºå½æ¡£å°è´¦ Excel |
| | | export const exportArchiveExcel = (params) => { |
| | | return request.download({ url: '/mes/pd/archive/export-excel', params }) |
| | | } |
| | | ``` |
| | | |
| | | ### 5. data æ°æ® |
| | | |
| | | ```js |
| | | const queryParams = reactive({ |
| | | pageNo: 1, |
| | | pageSize: 10, |
| | | archiveCode: undefined, |
| | | projectId: undefined, |
| | | archiveStatus: undefined, |
| | | productCode: undefined, |
| | | productName: undefined, |
| | | }) |
| | | |
| | | const detailList = ref([]) |
| | | const detailVisible = ref(false) |
| | | const activeProject = ref('0') |
| | | ``` |
| | | |
| | | ### 6. æ¹æ³ |
| | | |
| | | ```js |
| | | // æ¥ç详æ
ï¼æäº§åç¼ç ï¼ |
| | | const handleDetail = async (productCode) => { |
| | | const res = await ArchiveApi.getArchiveDetailByProduct(productCode) |
| | | detailList.value = res |
| | | activeProject.value = '0' |
| | | detailVisible.value = true |
| | | } |
| | | ``` |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - **å页èåé»è¾**ï¼`/page` æ¥å£æ `project_id` åç»ï¼æ¯ç»åææ°ä¸æ¡å½æ¡£è®°å½ï¼`MAX(id)`ï¼ï¼æä»¥ `updater` å `updateTime` æ¯è¯¥ç»ææ°å½æ¡£çæ´æ°ä¿¡æ¯ |
| | | - **详æ
æ¥å£åæ°åå**ï¼ä» `projectId` æ¹ä¸º `productCode`ï¼å 为å端å表å±ç¤ºçæ¯äº§å维度ï¼ç¹å»è¯¦æ
æ¶ä¼ 产åç¼ç æ´èªç¶ |
| | | - **详æ
è¿åå表**ï¼`detail-by-product` è¿å `List`ï¼å 为åä¸äº§åç¼ç å¯è½å
³èå¤ä¸ªè®¾è®¡é¡¹ç®ï¼å¦ä¸åçæ¬ï¼ï¼åç«¯ç¨ tab 忢å±ç¤º |
| | | - **åå
¸ç±»å**ï¼ |
| | | - 彿¡£ç¶æï¼`mes_pd_archive_status`ï¼0=å¾
彿¡£ 1=已彿¡£ï¼ |
| | | - 项ç®ç¶æï¼`mes_pd_project_status`ï¼0=å¾
åå¸ 1=å¾
ä¸ä¼ 2=å¾
å®¡æ ¸ 3=å¾
彿¡£ 4=已彿¡£ï¼ |
| | | - èµæç±»åï¼`mes_pd_document_type` |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # 产å设计 |
| | | |
| | | ## æ¶åé¡µé¢ |
| | | |
| | | - 设计项ç®å表页ï¼`mes/pd/project/index`ï¼ |
| | | - 设计项ç®è¯¦æ
/æ°å¢/ç¼è¾å¼¹çª |
| | | - èµæå表管çå¼¹çª |
| | | - èµæå®¡æ ¸å¼¹çª |
| | | - 彿¡£å°è´¦å表页ï¼`mes/pd/archive/index`ï¼ |
| | | - 彿¡£å°è´¦è¯¦æ
/æ°å¢/ç¼è¾å¼¹çª |
| | | |
| | | ## ç¶ææµè½¬ |
| | | |
| | | **å¾
åå¸(0) â å¾
ä¸ä¼ (1) â å¾
å®¡æ ¸(2) â å¾
彿¡£(3) â 已彿¡£(4)** |
| | | |
| | | | ç¶æå¼ | ç¶æå | å
许æä½ | |
| | | |--------|--------|----------| |
| | | | 0 | å¾
åå¸ | ä¿®æ¹ãå é¤ãåå¸ | |
| | | | 1 | å¾
ä¸ä¼ | ä¸ä¼ èµæ | |
| | | | 2 | å¾
å®¡æ ¸ | å®¡æ ¸ | |
| | | | 3 | å¾
彿¡£ | 彿¡£ | |
| | | | 4 | 已彿¡£ | æ | |
| | | |
| | | ## API |
| | | |
| | | ### è®¾è®¡é¡¹ç® |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pd/project/create | åå»ºè®¾è®¡é¡¹ç® | |
| | | | PUT | /mes/pd/project/update | æ´æ°è®¾è®¡é¡¹ç® | |
| | | | DELETE | /mes/pd/project/delete | å é¤è®¾è®¡é¡¹ç® | |
| | | | GET | /mes/pd/project/get | è·å设计项ç®è¯¦æ
| |
| | | | GET | /mes/pd/project/page | è·å设计项ç®å页 | |
| | | | GET | /mes/pd/project/export-excel | 导åºè®¾è®¡é¡¹ç®Excel | |
| | | | PUT | /mes/pd/project/publish | åå¸ï¼å¾
åå¸âå¾
ä¸ä¼ ï¼ | |
| | | | PUT | /mes/pd/project/upload | ä¸ä¼ èµæï¼å¾
ä¸ä¼ âå¾
å®¡æ ¸ï¼ï¼**èªå¨åå»ºèµæå®¡æ ¸è®°å½** | |
| | | | PUT | /mes/pd/project/audit | å®¡æ ¸ï¼å¾
å®¡æ ¸âå¾
彿¡£ï¼ | |
| | | | PUT | /mes/pd/project/archive | 彿¡£ï¼å¾
彿¡£â已彿¡£ï¼ï¼**èªå¨åå»ºå½æ¡£å°è´¦è®°å½** | |
| | | |
| | | **å建/æ´æ°è¯·æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | id | Long | å¦ï¼æ´æ°æ¶å¿
å¡«ï¼ | ç¼å· | |
| | | | taskCode | String | æ¯ | ä»»å¡ç¼ç | |
| | | | taskName | String | æ¯ | ä»»å¡åç§° | |
| | | | productCode | String | å¦ | 产åç¼ç | |
| | | | productName | String | å¦ | 产ååç§° | |
| | | | version | String | å¦ | çæ¬å· | |
| | | | chiefDesigner | Long | å¦ | 主设计å¸ï¼ç¨æ·IDï¼ | |
| | | | reviewer | Long | å¦ | å®¡æ ¸äººï¼ç¨æ·IDï¼ | |
| | | | planFinishTime | LocalDateTime | å¦ | 计å宿æ¶é´ | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | |
| | | **å页请æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | taskCode | String | å¦ | ä»»å¡ç¼ç ï¼æ¨¡ç³ï¼ | |
| | | | taskName | String | å¦ | ä»»å¡åç§°ï¼æ¨¡ç³ï¼ | |
| | | | productCode | String | å¦ | 产åç¼ç ï¼æ¨¡ç³ï¼ | |
| | | | productName | String | å¦ | 产ååç§°ï¼æ¨¡ç³ï¼ | |
| | | | status | Integer | å¦ | ç¶æ | |
| | | | planFinishTime | LocalDateTime[] | å¦ | 计å宿æ¶é´èå´ | |
| | | |
| | | **ååºï¼** å¨åºç¡å段ä¸é¢å¤å
å« `chiefDesignerNickname`ï¼ä¸»è®¾è®¡å¸åç§°ï¼ã`reviewerNickname`ï¼å®¡æ ¸äººåç§°ï¼ |
| | | |
| | | ### è®¾è®¡èµæ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pd/document/create | åå»ºè®¾è®¡èµæ | |
| | | | PUT | /mes/pd/document/update | æ´æ°è®¾è®¡èµæ | |
| | | | DELETE | /mes/pd/document/delete | å é¤è®¾è®¡èµæ | |
| | | | GET | /mes/pd/document/get | è·åè®¾è®¡èµæè¯¦æ
| |
| | | | GET | /mes/pd/document/page | è·åè®¾è®¡èµæå页 | |
| | | | GET | /mes/pd/document/export-excel | 导åºè®¾è®¡èµæExcel | |
| | | |
| | | **å建/æ´æ°è¯·æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | id | Long | å¦ï¼æ´æ°æ¶å¿
å¡«ï¼ | ç¼å· | |
| | | | projectId | Long | æ¯ | 设计项ç®ID | |
| | | | documentType | String | å¦ | èµæç±»åï¼åå
¸ mes_pd_document_typeï¼ | |
| | | | documentName | String | æ¯ | èµæåç§° | |
| | | | documentVersion | String | å¦ | çæ¬ | |
| | | | fileName | String | å¦ | æä»¶å | |
| | | | uploadUserId | Long | å¦ | ä¸ä¼ 人ï¼ç¨æ·IDï¼ | |
| | | | uploadTime | LocalDateTime | å¦ | ä¸ä¼ æ¶é´ | |
| | | | fileUrl | String | å¦ | æä»¶URLï¼éè¿ `/infra/file/upload` ä¸ä¼ åè·åï¼ | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | |
| | | **ååºï¼** å¨åºç¡å段ä¸é¢å¤å
å« `uploadUserNickname`ï¼ä¸ä¼ 人åç§°ï¼ã`fileUrl`ï¼æä»¶URLï¼ |
| | | |
| | | ### èµæå®¡æ ¸ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pd/document-audit/create | åå»ºèµæå®¡æ ¸ï¼**ä¸ä¼ èµææ¶å端èªå¨è°ç¨ï¼å端æ éåç¬è°ç¨**ï¼ | |
| | | | PUT | /mes/pd/document-audit/update | æ´æ°èµæå®¡æ ¸ | |
| | | | DELETE | /mes/pd/document-audit/delete | å é¤èµæå®¡æ ¸ | |
| | | | GET | /mes/pd/document-audit/get | è·åèµæå®¡æ ¸è¯¦æ
| |
| | | | GET | /mes/pd/document-audit/page | è·åèµæå®¡æ ¸å页 | |
| | | | GET | /mes/pd/document-audit/export-excel | 导åºèµæå®¡æ ¸Excel | |
| | | |
| | | **å建/æ´æ°è¯·æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | id | Long | å¦ï¼æ´æ°æ¶å¿
å¡«ï¼ | ç¼å· | |
| | | | auditNo | String | æ¯ | å®¡æ ¸åå·ï¼ç¼ç è§å PD_DOCUMENT_AUDIT_CODE èªå¨çæï¼ | |
| | | | documentId | Long | æ¯ | èµæID | |
| | | | documentName | String | å¦ | èµæåç§°ï¼åä½ï¼ | |
| | | | documentVersion | String | å¦ | èµæçæ¬ï¼åä½ï¼ | |
| | | | reviewer | Long | å¦ | å®¡æ ¸äººï¼ç¨æ·IDï¼èªå¨å项ç®çå®¡æ ¸äººï¼ | |
| | | | auditStatus | Integer | å¦ | å®¡æ ¸ç¶æï¼åå
¸ mes_pd_document_audit_statusï¼ | |
| | | | auditTime | LocalDateTime | å¦ | å®¡æ ¸æ¶é´ | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | |
| | | **ååºï¼** å¨åºç¡å段ä¸é¢å¤å
å« `reviewerNickname`ï¼å®¡æ ¸äººåç§°ï¼ |
| | | |
| | | ### 彿¡£å°è´¦ |
| | | |
| | | | æ¹æ³ | è·¯å¾ | 说æ | |
| | | |------|------|------| |
| | | | POST | /mes/pd/archive/create | åå»ºå½æ¡£å°è´¦ï¼**彿¡£æ¶å端èªå¨è°ç¨ï¼å端æ éåç¬è°ç¨**ï¼ | |
| | | | PUT | /mes/pd/archive/update | æ´æ°å½æ¡£å°è´¦ | |
| | | | DELETE | /mes/pd/archive/delete | å é¤å½æ¡£å°è´¦ | |
| | | | GET | /mes/pd/archive/get | è·å彿¡£å°è´¦è¯¦æ
| |
| | | | GET | /mes/pd/archive/page | è·å彿¡£å°è´¦å页 | |
| | | | GET | /mes/pd/archive/export-excel | 导åºå½æ¡£å°è´¦Excel | |
| | | |
| | | **å建/æ´æ°è¯·æ±åæ°ï¼** |
| | | |
| | | | åæ° | ç±»å | å¿
å¡« | 说æ | |
| | | |------|------|------|------| |
| | | | id | Long | å¦ï¼æ´æ°æ¶å¿
å¡«ï¼ | ç¼å· | |
| | | | archiveCode | String | æ¯ | 彿¡£ç¼å·ï¼ç¼ç è§å PD_ARCHIVE_CODE èªå¨çæï¼ | |
| | | | projectId | Long | æ¯ | 设计项ç®ID | |
| | | | archiver | Long | å¦ | 彿¡£äººï¼ç¨æ·IDï¼èªå¨åå½åç»å½ç¨æ·ï¼ | |
| | | | archiveStatus | Integer | å¦ | 彿¡£ç¶æï¼åå
¸ mes_pd_archive_statusï¼ | |
| | | | archiveTime | LocalDateTime | å¦ | 彿¡£æ¶é´ï¼èªå¨åå½åæ¶é´ï¼ | |
| | | | remark | String | å¦ | 夿³¨ | |
| | | |
| | | **ååºï¼** å¨åºç¡å段ä¸é¢å¤å
å« `archiverNickname`ï¼å½æ¡£äººåç§°ï¼ã`taskCode`ï¼ä»»å¡ç¼ç ï¼ã`taskName`ï¼ä»»å¡åç§°ï¼ |
| | | |
| | | ## å端修æ¹ç¹ |
| | | |
| | | ### 1. 设计项ç®å表页 |
| | | |
| | | ```html |
| | | <!-- ç¶ææ ç¾ --> |
| | | <el-tag :type="getStatusTagType(row.status)"> |
| | | {{ getStatusLabel(row.status) }} |
| | | </el-tag> |
| | | |
| | | <!-- ç¶ææµè½¬æé® --> |
| | | <el-button v-if="row.status === 0" @click="handlePublish(row.id)" type="primary">åå¸</el-button> |
| | | <el-button v-if="row.status === 1" @click="handleUpload(row.id)" type="warning">ä¸ä¼ èµæ</el-button> |
| | | <el-button v-if="row.status === 2" @click="handleAudit(row.id)" type="success">å®¡æ ¸</el-button> |
| | | <el-button v-if="row.status === 3" @click="handleArchive(row.id)" type="danger">彿¡£</el-button> |
| | | ``` |
| | | |
| | | ### 2. data æ°æ® |
| | | |
| | | ```js |
| | | data() { |
| | | return { |
| | | // ç¶ææµè½¬APIæ å° |
| | | statusFlowApi: { |
| | | 0: publishProject, |
| | | 1: uploadProject, |
| | | 2: auditProject, |
| | | 3: archiveProject, |
| | | }, |
| | | } |
| | | } |
| | | ``` |
| | | |
| | | ### 3. æ¹æ³ |
| | | |
| | | ```js |
| | | // ç¶ææµè½¬ |
| | | handlePublish(id) { |
| | | publishProject(id).then(() => { this.getList() }) |
| | | }, |
| | | handleUpload(id) { |
| | | uploadProject(id).then(() => { this.getList() }) |
| | | }, |
| | | handleAudit(id) { |
| | | auditProject(id).then(() => { this.getList() }) |
| | | }, |
| | | handleArchive(id) { |
| | | archiveProject(id).then(() => { this.getList() }) |
| | | }, |
| | | |
| | | // èµæå表 - æå¼å¼¹çª |
| | | handleDocument(projectId) { |
| | | this.documentOpen = true |
| | | this.documentProjectId = projectId |
| | | this.getDocumentList() |
| | | }, |
| | | ``` |
| | | |
| | | ### 4. API å®ä¹ |
| | | |
| | | ```js |
| | | // è®¾è®¡é¡¹ç® |
| | | export function createProject(data) { return request({ url: '/mes/pd/project/create', method: 'post', data }) } |
| | | export function updateProject(data) { return request({ url: '/mes/pd/project/update', method: 'put', data }) } |
| | | export function deleteProject(id) { return request({ url: '/mes/pd/project/delete', method: 'delete', params: { id } }) } |
| | | export function getProject(id) { return request({ url: '/mes/pd/project/get', method: 'get', params: { id } }) } |
| | | export function getProjectPage(params) { return request({ url: '/mes/pd/project/page', method: 'get', params }) } |
| | | export function exportProjectExcel(params) { return request({ url: '/mes/pd/project/export-excel', method: 'get', params, responseType: 'blob' }) } |
| | | export function publishProject(id) { return request({ url: '/mes/pd/project/publish', method: 'put', params: { id } }) } |
| | | export function uploadProject(id) { return request({ url: '/mes/pd/project/upload', method: 'put', params: { id } }) } |
| | | export function auditProject(id) { return request({ url: '/mes/pd/project/audit', method: 'put', params: { id } }) } |
| | | export function archiveProject(id) { return request({ url: '/mes/pd/project/archive', method: 'put', params: { id } }) } |
| | | |
| | | // è®¾è®¡èµæ |
| | | export function createDocument(data) { return request({ url: '/mes/pd/document/create', method: 'post', data }) } |
| | | export function updateDocument(data) { return request({ url: '/mes/pd/document/update', method: 'put', data }) } |
| | | export function deleteDocument(id) { return request({ url: '/mes/pd/document/delete', method: 'delete', params: { id } }) } |
| | | export function getDocument(id) { return request({ url: '/mes/pd/document/get', method: 'get', params: { id } }) } |
| | | export function getDocumentPage(params) { return request({ url: '/mes/pd/document/page', method: 'get', params }) } |
| | | |
| | | // æä»¶ä¸ä¼ ï¼éç¨æ¥å£ï¼ä¸ä¼ åè¿åURLï¼åå
¥èµæè¡¨ fileUrl åæ®µï¼ |
| | | export function uploadFile(file, directory) { return request({ url: '/infra/file/upload', method: 'post', data: { file, directory }, headers: { 'Content-Type': 'multipart/form-data' } }) } |
| | | |
| | | // èµæå®¡æ ¸ï¼å端æ éè°ç¨ createï¼ä¸ä¼ èµææ¶å端èªå¨åå»ºï¼ |
| | | export function updateDocumentAudit(data) { return request({ url: '/mes/pd/document-audit/update', method: 'put', data }) } |
| | | export function deleteDocumentAudit(id) { return request({ url: '/mes/pd/document-audit/delete', method: 'delete', params: { id } }) } |
| | | export function getDocumentAuditPage(params) { return request({ url: '/mes/pd/document-audit/page', method: 'get', params }) } |
| | | |
| | | // 彿¡£å°è´¦ï¼å端æ éè°ç¨ createï¼å½æ¡£æ¶å端èªå¨åå»ºï¼ |
| | | export function updateArchive(data) { return request({ url: '/mes/pd/archive/update', method: 'put', data }) } |
| | | export function deleteArchive(id) { return request({ url: '/mes/pd/archive/delete', method: 'delete', params: { id } }) } |
| | | export function getArchive(id) { return request({ url: '/mes/pd/archive/get', method: 'get', params: { id } }) } |
| | | export function getArchivePage(params) { return request({ url: '/mes/pd/archive/page', method: 'get', params }) } |
| | | export function exportArchiveExcel(params) { return request({ url: '/mes/pd/archive/export-excel', method: 'get', params, responseType: 'blob' }) } |
| | | ``` |
| | | |
| | | ### 5. èµæå表 - æä»¶ä¸ä¼ ç»ä»¶ |
| | | |
| | | ```html |
| | | <!-- è®¾è®¡èµææ°å¢/ç¼è¾å¼¹çªä¸æ·»å æä»¶ä¸ä¼ --> |
| | | <el-form-item label="æä»¶" prop="fileUrl"> |
| | | <UploadFile v-model="formData.fileUrl" :limit="1" /> |
| | | </el-form-item> |
| | | |
| | | <!-- èµæåè¡¨ä¸æ¾ç¤ºæä»¶é¾æ¥ --> |
| | | <el-table-column label="æä»¶" prop="fileUrl"> |
| | | <template #default="{ row }"> |
| | | <el-link v-if="row.fileUrl" :href="row.fileUrl" target="_blank" type="primary"> |
| | | {{ row.fileName || 'æ¥çæä»¶' }} |
| | | </el-link> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | ``` |
| | | |
| | | ```js |
| | | // æä»¶ä¸ä¼ åè° |
| | | handleFileUploadSuccess(url) { |
| | | this.formData.fileUrl = url |
| | | }, |
| | | ``` |
| | | |
| | | ### 6. åå
¸æ°æ®æ´æ° SQL |
| | | |
| | | ```sql |
| | | UPDATE system_dict_data SET label = 'å¾
åå¸' WHERE dict_type = 'mes_pd_project_status' AND value = '0'; |
| | | UPDATE system_dict_data SET label = 'å¾
ä¸ä¼ ' WHERE dict_type = 'mes_pd_project_status' AND value = '1'; |
| | | UPDATE system_dict_data SET label = 'å¾
å®¡æ ¸' WHERE dict_type = 'mes_pd_project_status' AND value = '2'; |
| | | UPDATE system_dict_data SET label = 'å¾
彿¡£' WHERE dict_type = 'mes_pd_project_status' AND value = '3'; |
| | | UPDATE system_dict_data SET label = '已彿¡£' WHERE dict_type = 'mes_pd_project_status' AND value = '4'; |
| | | ``` |
| | | |
| | | ## ç¼ç è§åé
ç½® |
| | | |
| | | éè¦å¨ç¼ç è§å管ç䏿°å¢ä»¥ä¸ä¸¤æ¡è§åï¼ |
| | | |
| | | | è§å代ç | è§ååç§° | 说æ | |
| | | |----------|----------|------| |
| | | | PD_DOCUMENT_AUDIT_CODE | èµæå®¡æ ¸åç¼ç | ä¸ä¼ èµææ¶èªå¨çæå®¡æ ¸åå· | |
| | | | PD_ARCHIVE_CODE | 彿¡£å°è´¦ç¼ç | 彿¡£æ¶èªå¨çæå½æ¡£ç¼å· | |
| | | |
| | | ## 注æäºé¡¹ |
| | | |
| | | - 设计项ç®ç¶ææµè½¬ä¸ºçº¿æ§5ç¶æï¼0â1â2â3â4ï¼ï¼ä¸æ¯æåéæåæ¶ |
| | | - åªæå¾
åå¸(0)ç¶ææå
许修æ¹åå é¤è®¾è®¡é¡¹ç® |
| | | - å é¤è®¾è®¡é¡¹ç®ä¼çº§èå é¤å
¶ä¸çææèµæè®°å½ |
| | | - èµæå表ç `fileUrl` åæ®µå卿件URLï¼å端éè¿ `/infra/file/upload` éç¨æ¥å£ä¸ä¼ æä»¶åè·åURL |
| | | - èµæå®¡æ ¸è¡¨ä¸èµæå表为ä¸å¯¹å¤å
³ç³»ï¼ä¸æ¡èµæå¯ä»¥æå¤æ¡å®¡æ ¸è®°å½ |
| | | - åå
¸ç±»åéè¦å¨ç³»ç»ç®¡çä¸é
ç½®ï¼`mes_pd_project_status`ã`mes_pd_document_type`ã`mes_pd_document_audit_status`ã`mes_pd_archive_status` |
| | | - `mes_pd_document_type`ï¼èµæç±»åï¼çåå
¸æ°æ®éè¦æ ¹æ®å®é
ä¸å¡è¡¥å
|
| | | - **ä¸ä¼ èµæ**æ¶å端èªå¨ä¸ºé¡¹ç®ä¸ææèµæåå»ºå®¡æ ¸è®°å½ï¼å®¡æ ¸äºº=é¡¹ç® reviewerï¼å®¡æ ¸ç¶æ=å¾
å®¡æ ¸ï¼ï¼å端æ éåç¬è°ç¨ `POST /mes/pd/document-audit/create` |
| | | - **彿¡£**æ¶å端èªå¨åå»ºå½æ¡£å°è´¦è®°å½ï¼å½æ¡£äºº=å½åç»å½ç¨æ·ï¼å½æ¡£æ¶é´=å½åæ¶é´ï¼ï¼å端æ éåç¬è°ç¨ `POST /mes/pd/archive/create` |
| | | - ä¸ä¼ èµæå彿¡£æä½æ¯äºå¡æ§çï¼ç¶ææ´æ°åå表å建å¨åä¸ä¸ªäºå¡ä¸ï¼è¦ä¹å
¨é¨æåè¦ä¹å
¨é¨åæ» |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | -- ============================================= |
| | | -- MES 产å设计模å - åå§åèæ¬ |
| | | -- ============================================= |
| | | |
| | | -- ---------------------------- |
| | | -- è®¾è®¡é¡¹ç® |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_project` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `task_code` varchar(64) DEFAULT NULL COMMENT 'ä»»å¡ç¼ç ', |
| | | `task_name` varchar(255) DEFAULT NULL COMMENT 'ä»»å¡åç§°', |
| | | `product_code` varchar(64) DEFAULT NULL COMMENT '产åç¼ç ', |
| | | `product_name` varchar(255) DEFAULT NULL COMMENT '产ååç§°', |
| | | `version` varchar(64) DEFAULT NULL COMMENT 'çæ¬å·', |
| | | `status` tinyint NOT NULL DEFAULT 0 COMMENT 'ç¶æï¼0=å¾
åå¸ 1=å¾
ä¸ä¼ 2=å¾
å®¡æ ¸ 3=å¾
彿¡£ 4=已彿¡£ï¼', |
| | | `chief_designer` bigint DEFAULT NULL COMMENT '主设计å¸', |
| | | `reviewer` bigint DEFAULT NULL COMMENT 'å®¡æ ¸äºº', |
| | | `plan_finish_time` datetime DEFAULT NULL COMMENT '计å宿æ¶é´', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES 设计项ç®'; |
| | | |
| | | -- ---------------------------- |
| | | -- è®¾è®¡èµæå表 |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_document` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `project_id` bigint NOT NULL COMMENT '设计项ç®ID', |
| | | `document_type` varchar(64) DEFAULT NULL COMMENT 'èµæç±»å', |
| | | `document_name` varchar(255) DEFAULT NULL COMMENT 'èµæåç§°', |
| | | `document_version` varchar(64) DEFAULT NULL COMMENT 'çæ¬', |
| | | `file_name` varchar(255) DEFAULT NULL COMMENT 'æä»¶å', |
| | | `upload_user_id` bigint DEFAULT NULL COMMENT 'ä¸ä¼ 人', |
| | | `upload_time` datetime DEFAULT NULL COMMENT 'ä¸ä¼ æ¶é´', |
| | | `file_url` varchar(512) DEFAULT NULL COMMENT 'æä»¶URLï¼é¢çï¼', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES è®¾è®¡èµæ'; |
| | | |
| | | -- ---------------------------- |
| | | -- èµæå®¡æ ¸è¡¨ |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_document_audit` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `audit_no` varchar(64) DEFAULT NULL COMMENT 'å®¡æ ¸åå·', |
| | | `document_id` bigint NOT NULL COMMENT 'èµæID', |
| | | `document_name` varchar(255) DEFAULT NULL COMMENT 'èµæåç§°ï¼åä½ï¼', |
| | | `document_version` varchar(64) DEFAULT NULL COMMENT 'èµæçæ¬ï¼åä½ï¼', |
| | | `reviewer` bigint DEFAULT NULL COMMENT 'å®¡æ ¸äºº', |
| | | `audit_status` tinyint DEFAULT NULL COMMENT 'å®¡æ ¸ç¶æ', |
| | | `audit_time` datetime DEFAULT NULL COMMENT 'å®¡æ ¸æ¶é´', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES èµæå®¡æ ¸'; |
| | | |
| | | -- ---------------------------- |
| | | -- 彿¡£å°è´¦ |
| | | -- ---------------------------- |
| | | CREATE TABLE IF NOT EXISTS `mes_pd_archive` ( |
| | | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'ç¼å·', |
| | | `archive_code` varchar(64) DEFAULT NULL COMMENT '彿¡£ç¼å·', |
| | | `project_id` bigint NOT NULL COMMENT '设计项ç®ID', |
| | | `archiver` bigint DEFAULT NULL COMMENT '彿¡£äºº', |
| | | `archive_status` tinyint DEFAULT NULL COMMENT '彿¡£ç¶æ', |
| | | `archive_time` datetime DEFAULT NULL COMMENT '彿¡£æ¶é´', |
| | | `remark` varchar(500) DEFAULT NULL COMMENT '夿³¨', |
| | | `creator` varchar(64) DEFAULT '' COMMENT 'å建è
', |
| | | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'å建æ¶é´', |
| | | `updater` varchar(64) DEFAULT '' COMMENT 'æ´æ°è
', |
| | | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'æ´æ°æ¶é´', |
| | | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT 'æ¯å¦å é¤', |
| | | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT 'ç§æ·ç¼å·', |
| | | PRIMARY KEY (`id`) |
| | | ) ENGINE=InnoDB COMMENT='MES 彿¡£å°è´¦'; |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸ç±»å |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('设计项ç®ç¶æ', 'mes_pd_project_status', 0, '设计项ç®ç¶æ', '1', NOW(), '1', NOW(), b'0'), |
| | | ('èµæç±»å', 'mes_pd_document_type', 0, 'èµæç±»å', '1', NOW(), '1', NOW(), b'0'), |
| | | ('èµæå®¡æ ¸ç¶æ', 'mes_pd_document_audit_status', 0, 'èµæå®¡æ ¸ç¶æ', '1', NOW(), '1', NOW(), b'0'), |
| | | ('彿¡£ç¶æ', 'mes_pd_archive_status', 0, '彿¡£ç¶æ', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸æ°æ® - 设计项ç®ç¶æ |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | (0, 'å¾
åå¸', '0', 'mes_pd_project_status', 0, 'info', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1, 'å¾
ä¸ä¼ ', '1', 'mes_pd_project_status', 0, 'primary', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (2, 'å¾
å®¡æ ¸', '2', 'mes_pd_project_status', 0, 'warning', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (3, 'å¾
彿¡£', '3', 'mes_pd_project_status', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (4, '已彿¡£', '4', 'mes_pd_project_status', 0, 'danger', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸æ°æ® - èµæå®¡æ ¸ç¶æ |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | (0, 'å¾
å®¡æ ¸', '0', 'mes_pd_document_audit_status', 0, 'info', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1, 'å®¡æ ¸éè¿', '1', 'mes_pd_document_audit_status', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (2, 'å®¡æ ¸ä¸éè¿', '2', 'mes_pd_document_audit_status', 0, 'danger', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- åå
¸æ°æ® - 彿¡£ç¶æ |
| | | -- ---------------------------- |
| | | INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | (0, 'å¾
彿¡£', '0', 'mes_pd_archive_status', 0, 'info', '', '', '1', NOW(), '1', NOW(), b'0'), |
| | | (1, '已彿¡£', '1', 'mes_pd_archive_status', 0, 'success', '', '', '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- ---------------------------- |
| | | -- èå - ä¸çº§ç®å½ï¼äº§å设计 |
| | | -- 注æï¼parent_id éè¦æ ¹æ®å®é
MESç¶èåIDè°æ´ |
| | | -- ---------------------------- |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('产å设计', '', 2, 20, 0, 'pd', '', '', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | SET @pd_menu_id = LAST_INSERT_ID(); |
| | | |
| | | -- äºçº§èåï¼è®¾è®¡é¡¹ç® |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('设计项ç®', '', 2, 1, @pd_menu_id, 'project', '', 'mes/pd/project/index', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | SET @project_menu_id = LAST_INSERT_ID(); |
| | | |
| | | -- è®¾è®¡é¡¹ç®æé®æé |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('è®¾è®¡é¡¹ç®æ¥è¯¢', 'mes:pd-project:query', 3, 1, @project_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('设计项ç®å建', 'mes:pd-project:create', 3, 2, @project_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('è®¾è®¡é¡¹ç®æ´æ°', 'mes:pd-project:update', 3, 3, @project_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('设计项ç®å é¤', 'mes:pd-project:delete', 3, 4, @project_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('设计项ç®å¯¼åº', 'mes:pd-project:export', 3, 5, @project_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | |
| | | -- äºçº§èåï¼å½æ¡£å°è´¦ |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('彿¡£å°è´¦', '', 2, 2, @pd_menu_id, 'archive', '', 'mes/pd/archive/index', 0, '1', NOW(), '1', NOW(), b'0'); |
| | | SET @archive_menu_id = LAST_INSERT_ID(); |
| | | |
| | | -- 彿¡£å°è´¦æé®æé |
| | | INSERT INTO `system_menu` (`name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES |
| | | ('彿¡£å°è´¦æ¥è¯¢', 'mes:pd-archive:query', 3, 1, @archive_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('彿¡£å°è´¦å建', 'mes:pd-archive:create', 3, 2, @archive_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('彿¡£å°è´¦æ´æ°', 'mes:pd-archive:update', 3, 3, @archive_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('彿¡£å°è´¦å é¤', 'mes:pd-archive:delete', 3, 4, @archive_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'), |
| | | ('彿¡£å°è´¦å¯¼åº', 'mes:pd-archive:export', 3, 5, @archive_menu_id, '', '', '', 0, '1', NOW(), '1', NOW(), b'0'); |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.archive; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.*; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.archive.MesPdArchiveDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.archive.MesPdArchiveService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | |
| | | @Tag(name = "管çåå° - MES 彿¡£å°è´¦") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/archive") |
| | | @Validated |
| | | public class MesPdArchiveController { |
| | | |
| | | @Resource |
| | | private MesPdArchiveService archiveService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºå½æ¡£å°è´¦") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:create')") |
| | | public CommonResult<Long> createArchive(@Valid @RequestBody MesPdArchiveSaveReqVO createReqVO) { |
| | | return success(archiveService.createArchive(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°å½æ¡£å°è´¦") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:update')") |
| | | public CommonResult<Boolean> updateArchive(@Valid @RequestBody MesPdArchiveSaveReqVO updateReqVO) { |
| | | archiveService.updateArchive(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤å½æ¡£å°è´¦") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:delete')") |
| | | public CommonResult<Boolean> deleteArchive(@RequestParam("id") Long id) { |
| | | archiveService.deleteArchive(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾å½æ¡£å°è´¦") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:query')") |
| | | public CommonResult<MesPdArchiveRespVO> getArchive(@RequestParam("id") Long id) { |
| | | MesPdArchiveDO archive = archiveService.getArchive(id); |
| | | if (archive == null) { |
| | | return success(null); |
| | | } |
| | | return success(BeanUtils.toBean(archive, MesPdArchiveRespVO.class)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾å½æ¡£å°è´¦åé¡µï¼æé¡¹ç®/产åèåï¼") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:query')") |
| | | public CommonResult<PageResult<MesPdArchiveRespVO>> getArchivePage(@Valid MesPdArchivePageReqVO pageReqVO, |
| | | Page<MesPdArchiveGroupRespVO> page) { |
| | | IPage<MesPdArchiveGroupRespVO> archivePage = archiveService.getArchivePageGroupByProject(pageReqVO, page); |
| | | return CommonResult.success(new PageResult<>( |
| | | buildArchiveRespVOList(archivePage.getRecords()), archivePage.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/detail-by-product") |
| | | @Operation(summary = "è·å¾å½æ¡£å°è´¦è¯¦æ
ï¼æäº§åï¼") |
| | | @Parameter(name = "productCode", description = "产åç¼å·", required = true, example = "1") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:query')") |
| | | public CommonResult<List<MesPdArchiveDetailRespVO>> getArchiveDetailByProduct(@RequestParam("productCode") String productCode) { |
| | | return success(archiveService.getArchiveDetailByProductCode(productCode)); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºå½æ¡£å°è´¦ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-archive:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportArchiveExcel(@Valid MesPdArchivePageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | IPage<MesPdArchiveGroupRespVO> archivePage = archiveService.getArchivePageGroupByProject(pageReqVO, null); |
| | | ExcelUtils.write(response, "彿¡£å°è´¦.xls", "æ°æ®", MesPdArchiveRespVO.class, |
| | | buildArchiveRespVOList(archivePage.getRecords())); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesPdArchiveRespVO> buildArchiveRespVOList(List<MesPdArchiveGroupRespVO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1. æ¹éè·åæ´æ°äººæµç§°ï¼updater æ¯ String ç±»åçç¨æ·IDï¼ |
| | | Set<String> updaterIds = list.stream() |
| | | .map(MesPdArchiveGroupRespVO::getUpdater) |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | Map<Long, AdminUserRespDTO> userMap = Collections.emptyMap(); |
| | | if (!updaterIds.isEmpty()) { |
| | | Set<Long> userIds = updaterIds.stream() |
| | | .filter(id -> id.matches("\\d+")) |
| | | .map(Long::parseLong) |
| | | .collect(Collectors.toSet()); |
| | | if (!userIds.isEmpty()) { |
| | | userMap = adminUserApi.getUserMap(userIds); |
| | | } |
| | | } |
| | | // 2. æ¼æ¥ VO |
| | | Map<Long, AdminUserRespDTO> finalUserMap = userMap; |
| | | return BeanUtils.toBean(list, MesPdArchiveRespVO.class, vo -> { |
| | | // productCodeãproductNameãarchiveCount å·²ä» XML æ¥è¯¢æ å°å° GroupRespVO |
| | | // æ´æ°äººæµç§° |
| | | if (vo.getUpdater() != null && vo.getUpdater().matches("\\d+")) { |
| | | MapUtils.findAndThen(finalUserMap, Long.parseLong(vo.getUpdater()), |
| | | user -> vo.setUpdaterNickname(user.getNickname())); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | @Schema(description = "管çåå° - MES 彿¡£å°è´¦è¯¦æ
ï¼æäº§åï¼ Response VO") |
| | | @Data |
| | | public class MesPdArchiveDetailRespVO { |
| | | |
| | | @Schema(description = "项ç®ä¿¡æ¯") |
| | | private ProjectInfo project; |
| | | |
| | | @Schema(description = "彿¡£è®°å½å表") |
| | | private List<ArchiveInfo> archives; |
| | | |
| | | @Schema(description = "è®¾è®¡èµæå表") |
| | | private List<DocumentInfo> documents; |
| | | |
| | | @Schema(description = "项ç®ä¿¡æ¯") |
| | | @Data |
| | | public static class ProjectInfo { |
| | | |
| | | @Schema(description = "项ç®ID", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ä»»å¡ç¼ç ", example = "PD2024001") |
| | | private String taskCode; |
| | | |
| | | @Schema(description = "ä»»å¡åç§°", example = "æ°äº§å设计任å¡") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "P001") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "注å¡äº§åA") |
| | | private String productName; |
| | | |
| | | @Schema(description = "çæ¬å·", example = "V1.0") |
| | | private String version; |
| | | |
| | | @Schema(description = "项ç®ç¶æ", example = "4") |
| | | @DictFormat(DictTypeConstants.MES_PD_PROJECT_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "主设计å¸", example = "1") |
| | | private Long chiefDesigner; |
| | | |
| | | @Schema(description = "主设计å¸åç§°", example = "å¼ ä¸") |
| | | private String chiefDesignerNickname; |
| | | |
| | | @Schema(description = "å®¡æ ¸äºº", example = "2") |
| | | private Long reviewer; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººåç§°", example = "æå") |
| | | private String reviewerNickname; |
| | | |
| | | @Schema(description = "计å宿æ¶é´") |
| | | private LocalDateTime planFinishTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| | | |
| | | @Schema(description = "彿¡£è®°å½ä¿¡æ¯") |
| | | @Data |
| | | public static class ArchiveInfo { |
| | | |
| | | @Schema(description = "彿¡£ID", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "彿¡£ç¼å·", example = "ARC2024001") |
| | | private String archiveCode; |
| | | |
| | | @Schema(description = "彿¡£äºº", example = "1") |
| | | private Long archiver; |
| | | |
| | | @Schema(description = "彿¡£äººåç§°", example = "çäº") |
| | | private String archiverNickname; |
| | | |
| | | @Schema(description = "彿¡£ç¶æ", example = "1") |
| | | @DictFormat(DictTypeConstants.MES_PD_ARCHIVE_STATUS) |
| | | private Integer archiveStatus; |
| | | |
| | | @Schema(description = "彿¡£æ¶é´") |
| | | private LocalDateTime archiveTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| | | |
| | | @Schema(description = "è®¾è®¡èµæä¿¡æ¯") |
| | | @Data |
| | | public static class DocumentInfo { |
| | | |
| | | @Schema(description = "èµæID", example = "1") |
| | | private Long id; |
| | | |
| | | @Schema(description = "èµæç±»å", example = "1") |
| | | @DictFormat(DictTypeConstants.MES_PD_DOCUMENT_TYPE) |
| | | private String documentType; |
| | | |
| | | @Schema(description = "èµæåç§°", example = "产å设计å¾") |
| | | private String documentName; |
| | | |
| | | @Schema(description = "èµæçæ¬", example = "V1.0") |
| | | private String documentVersion; |
| | | |
| | | @Schema(description = "æä»¶å", example = "design.pdf") |
| | | private String fileName; |
| | | |
| | | @Schema(description = "æä»¶URL", example = "/files/design.pdf") |
| | | private String fileUrl; |
| | | |
| | | @Schema(description = "ä¸ä¼ 人", example = "1") |
| | | private Long uploadUserId; |
| | | |
| | | @Schema(description = "ä¸ä¼ 人åç§°", example = "èµµå
") |
| | | private String uploadUserNickname; |
| | | |
| | | @Schema(description = "ä¸ä¼ æ¶é´") |
| | | private LocalDateTime uploadTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * 彿¡£å°è´¦åç»æ¥è¯¢ Response VO |
| | | * <p> |
| | | * å¨å½æ¡£å°è´¦å段åºç¡ä¸ï¼é¢å¤å
å«å
³è项ç®ç产åç¼ç ã产ååç§°ã |
| | | * ç¨äº XML mapper çåç»æ¥è¯¢ç»ææ å°ï¼ä¸ç ´å MesPdArchiveDO 䏿°æ®åºçæ å°å
³ç³»ã |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Schema(description = "管çåå° - MES 彿¡£å°è´¦åç»æ¥è¯¢ Response VO") |
| | | @Data |
| | | public class MesPdArchiveGroupRespVO { |
| | | |
| | | // ========== 彿¡£å°è´¦èªèº«å段 ========== |
| | | |
| | | @Schema(description = "ç¼å·", example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "彿¡£ç¼å·", example = "ARC2024001") |
| | | private String archiveCode; |
| | | |
| | | @Schema(description = "设计项ç®ID", example = "1") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "彿¡£äºº", example = "1") |
| | | private Long archiver; |
| | | |
| | | @Schema(description = "彿¡£ç¶æ", example = "0") |
| | | private Integer archiveStatus; |
| | | |
| | | @Schema(description = "彿¡£æ¶é´") |
| | | private LocalDateTime archiveTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建è
") |
| | | private String creator; |
| | | |
| | | @Schema(description = "å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "æ´æ°äºº") |
| | | private String updater; |
| | | |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | // ========== å
³è项ç®å段ï¼XML æ¥è¯¢é¢å¤è¿åï¼ ========== |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "P001") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "注å¡äº§åA") |
| | | private String productName; |
| | | |
| | | @Schema(description = "彿¡£è®°å½æ°é", example = "3") |
| | | private Integer archiveCount; |
| | | |
| | | private String taskCode; |
| | | private String taskName; |
| | | |
| | | private String archiverNickname; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - MES 彿¡£å°è´¦å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdArchivePageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "彿¡£ç¼å·", example = "ARC2024001") |
| | | private String archiveCode; |
| | | |
| | | @Schema(description = "设计项ç®ID", example = "1") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "彿¡£ç¶æ", example = "0") |
| | | private Integer archiveStatus; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "P001") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "注å¡äº§åA") |
| | | private String productName; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES 彿¡£å°è´¦ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdArchiveRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "彿¡£ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "ARC2024001") |
| | | @ExcelProperty("彿¡£ç¼å·") |
| | | private String archiveCode; |
| | | |
| | | @Schema(description = "设计项ç®ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "ä»»å¡ç¼ç ", example = "PD2024001") |
| | | @ExcelProperty("ä»»å¡ç¼ç ") |
| | | private String taskCode; |
| | | |
| | | @Schema(description = "ä»»å¡åç§°", example = "æ°äº§å设计任å¡") |
| | | @ExcelProperty("ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "P001") |
| | | @ExcelProperty("产åç¼ç ") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "注å¡äº§åA") |
| | | @ExcelProperty("产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "彿¡£è®°å½æ°é", example = "3") |
| | | private Integer archiveCount; |
| | | |
| | | @Schema(description = "彿¡£äºº", example = "1") |
| | | private Long archiver; |
| | | |
| | | @Schema(description = "彿¡£äººåç§°", example = "çäº") |
| | | @ExcelProperty("彿¡£äºº") |
| | | private String archiverNickname; |
| | | |
| | | @Schema(description = "彿¡£ç¶æ", example = "0") |
| | | @ExcelProperty(value = "彿¡£ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_ARCHIVE_STATUS) |
| | | private Integer archiveStatus; |
| | | |
| | | @Schema(description = "彿¡£æ¶é´") |
| | | @ExcelProperty("彿¡£æ¶é´") |
| | | private LocalDateTime archiveTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | @Schema(description = "æ´æ°äºº", example = "1") |
| | | private String updater; |
| | | |
| | | @Schema(description = "æ´æ°äººåç§°", example = "æå") |
| | | @ExcelProperty("æ´æ°äºº") |
| | | private String updaterNickname; |
| | | |
| | | @Schema(description = "æ´æ°æ¶é´") |
| | | @ExcelProperty("æ´æ°æ¶é´") |
| | | private LocalDateTime updateTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES 彿¡£å°è´¦æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdArchiveSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "彿¡£ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "ARC2024001") |
| | | @NotBlank(message = "彿¡£ç¼å·ä¸è½ä¸ºç©º") |
| | | private String archiveCode; |
| | | |
| | | @Schema(description = "设计项ç®ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "设计项ç®IDä¸è½ä¸ºç©º") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "彿¡£äºº", example = "1") |
| | | private Long archiver; |
| | | |
| | | @Schema(description = "彿¡£ç¶æ", example = "0") |
| | | private Integer archiveStatus; |
| | | |
| | | @Schema(description = "彿¡£æ¶é´") |
| | | private LocalDateTime archiveTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.document; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.document.MesPdDocumentService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES è®¾è®¡èµæ") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/document") |
| | | @Validated |
| | | public class MesPdDocumentController { |
| | | |
| | | @Resource |
| | | private MesPdDocumentService documentService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºè®¾è®¡èµæ") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document:create')") |
| | | public CommonResult<Long> createDocument(@Valid @RequestBody MesPdDocumentSaveReqVO createReqVO) { |
| | | return success(documentService.createDocument(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°è®¾è®¡èµæ") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document:update')") |
| | | public CommonResult<Boolean> updateDocument(@Valid @RequestBody MesPdDocumentSaveReqVO updateReqVO) { |
| | | documentService.updateDocument(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è®¾è®¡èµæ") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document:delete')") |
| | | public CommonResult<Boolean> deleteDocument(@RequestParam("id") Long id) { |
| | | documentService.deleteDocument(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾è®¾è®¡èµæ") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document:query')") |
| | | public CommonResult<MesPdDocumentRespVO> getDocument(@RequestParam("id") Long id) { |
| | | MesPdDocumentDO document = documentService.getDocument(id); |
| | | if (document == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildDocumentRespVOList(Collections.singletonList(document)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾è®¾è®¡èµæå页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document:query')") |
| | | public CommonResult<PageResult<MesPdDocumentRespVO>> getDocumentPage(@Valid MesPdDocumentPageReqVO pageReqVO) { |
| | | PageResult<MesPdDocumentDO> pageResult = documentService.getDocumentPage(pageReqVO); |
| | | return success(new PageResult<>(buildDocumentRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºè®¾è®¡èµæ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportDocumentExcel(@Valid MesPdDocumentPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesPdDocumentDO> list = documentService.getDocumentPage(pageReqVO).getList(); |
| | | // å¯¼åº Excel |
| | | ExcelUtils.write(response, "è®¾è®¡èµæ.xls", "æ°æ®", MesPdDocumentRespVO.class, |
| | | buildDocumentRespVOList(list)); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesPdDocumentRespVO> buildDocumentRespVOList(List<MesPdDocumentDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1.1 æ¹éè·åå
³èæ°æ®ï¼ä¸ä¼ äººï¼ |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(list, MesPdDocumentDO::getUploadUserId)); |
| | | // 2. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesPdDocumentRespVO.class, vo -> { |
| | | MapUtils.findAndThen(userMap, vo.getUploadUserId(), |
| | | user -> vo.setUploadUserNickname(user.getNickname())); |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾è®¡èµæå页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdDocumentPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "设计项ç®ID", example = "1") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "èµæåç§°", example = "产å设计å¾") |
| | | private String documentName; |
| | | |
| | | @Schema(description = "èµæç±»å", example = "drawing") |
| | | private String documentType; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾è®¡èµæ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdDocumentRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "设计项ç®ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "èµæç±»å", example = "drawing") |
| | | @ExcelProperty(value = "èµæç±»å", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_DOCUMENT_TYPE) |
| | | private String documentType; |
| | | |
| | | @Schema(description = "èµæåç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "产å设计å¾") |
| | | @ExcelProperty("èµæåç§°") |
| | | private String documentName; |
| | | |
| | | @Schema(description = "çæ¬", example = "V1.0") |
| | | @ExcelProperty("çæ¬") |
| | | private String documentVersion; |
| | | |
| | | @Schema(description = "æä»¶å", example = "design_v1.pdf") |
| | | @ExcelProperty("æä»¶å") |
| | | private String fileName; |
| | | |
| | | @Schema(description = "ä¸ä¼ 人", example = "1") |
| | | private Long uploadUserId; |
| | | |
| | | @Schema(description = "ä¸ä¼ 人åç§°", example = "å¼ ä¸") |
| | | @ExcelProperty("ä¸ä¼ 人") |
| | | private String uploadUserNickname; |
| | | |
| | | @Schema(description = "ä¸ä¼ æ¶é´") |
| | | @ExcelProperty("ä¸ä¼ æ¶é´") |
| | | private LocalDateTime uploadTime; |
| | | |
| | | @Schema(description = "æä»¶URL", example = "https://xxx/file.pdf") |
| | | @ExcelProperty("æä»¶URL") |
| | | private String fileUrl; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾è®¡èµææ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdDocumentSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "设计项ç®ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | @NotNull(message = "设计项ç®IDä¸è½ä¸ºç©º") |
| | | private Long projectId; |
| | | |
| | | @Schema(description = "èµæç±»å", example = "drawing") |
| | | private String documentType; |
| | | |
| | | @Schema(description = "èµæåç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "产å设计å¾") |
| | | @NotBlank(message = "èµæåç§°ä¸è½ä¸ºç©º") |
| | | private String documentName; |
| | | |
| | | @Schema(description = "çæ¬", example = "V1.0") |
| | | private String documentVersion; |
| | | |
| | | @Schema(description = "æä»¶å", example = "design_v1.pdf") |
| | | private String fileName; |
| | | |
| | | @Schema(description = "ä¸ä¼ 人", example = "1") |
| | | private Long uploadUserId; |
| | | |
| | | @Schema(description = "ä¸ä¼ æ¶é´") |
| | | private LocalDateTime uploadTime; |
| | | |
| | | @Schema(description = "æä»¶URL", example = "https://xxx/file.pdf") |
| | | private String fileUrl; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.documentaudit.MesPdDocumentAuditDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.documentaudit.MesPdDocumentAuditService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | |
| | | @Tag(name = "管çåå° - MES èµæå®¡æ ¸") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/document-audit") |
| | | @Validated |
| | | public class MesPdDocumentAuditController { |
| | | |
| | | @Resource |
| | | private MesPdDocumentAuditService documentAuditService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "åå»ºèµæå®¡æ ¸") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document-audit:create')") |
| | | public CommonResult<Long> createDocumentAudit(@Valid @RequestBody MesPdDocumentAuditSaveReqVO createReqVO) { |
| | | return success(documentAuditService.createDocumentAudit(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°èµæå®¡æ ¸") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document-audit:update')") |
| | | public CommonResult<Boolean> updateDocumentAudit(@Valid @RequestBody MesPdDocumentAuditSaveReqVO updateReqVO) { |
| | | documentAuditService.updateDocumentAudit(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤èµæå®¡æ ¸") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document-audit:delete')") |
| | | public CommonResult<Boolean> deleteDocumentAudit(@RequestParam("id") Long id) { |
| | | documentAuditService.deleteDocumentAudit(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾èµæå®¡æ ¸") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document-audit:query')") |
| | | public CommonResult<MesPdDocumentAuditRespVO> getDocumentAudit(@RequestParam("id") Long id) { |
| | | MesPdDocumentAuditDO documentAudit = documentAuditService.getDocumentAudit(id); |
| | | if (documentAudit == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildDocumentAuditRespVOList(Collections.singletonList(documentAudit)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾èµæå®¡æ ¸å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document-audit:query')") |
| | | public CommonResult<PageResult<MesPdDocumentAuditRespVO>> getDocumentAuditPage(@Valid MesPdDocumentAuditPageReqVO pageReqVO) { |
| | | PageResult<MesPdDocumentAuditDO> pageResult = documentAuditService.getDocumentAuditPage(pageReqVO); |
| | | return success(new PageResult<>(buildDocumentAuditRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºèµæå®¡æ ¸ Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-document-audit:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportDocumentAuditExcel(@Valid MesPdDocumentAuditPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesPdDocumentAuditDO> list = documentAuditService.getDocumentAuditPage(pageReqVO).getList(); |
| | | // å¯¼åº Excel |
| | | ExcelUtils.write(response, "èµæå®¡æ ¸.xls", "æ°æ®", MesPdDocumentAuditRespVO.class, |
| | | buildDocumentAuditRespVOList(list)); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesPdDocumentAuditRespVO> buildDocumentAuditRespVOList(List<MesPdDocumentAuditDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1.1 æ¹éè·åå
³èæ°æ®ï¼å®¡æ ¸äººï¼ |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSet(list, MesPdDocumentAuditDO::getReviewer)); |
| | | // 2. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesPdDocumentAuditRespVO.class, vo -> { |
| | | MapUtils.findAndThen(userMap, vo.getReviewer(), |
| | | user -> vo.setReviewerNickname(user.getNickname())); |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | |
| | | @Schema(description = "管çåå° - MES èµæå®¡æ ¸å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdDocumentAuditPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "èµæID", example = "1") |
| | | private Long documentId; |
| | | |
| | | @Schema(description = "å®¡æ ¸åå·", example = "AUD2024001") |
| | | private String auditNo; |
| | | |
| | | @Schema(description = "å®¡æ ¸ç¶æ", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES èµæå®¡æ ¸ Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdDocumentAuditRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å®¡æ ¸åå·", requiredMode = Schema.RequiredMode.REQUIRED, example = "AUD2024001") |
| | | @ExcelProperty("å®¡æ ¸åå·") |
| | | private String auditNo; |
| | | |
| | | @Schema(description = "èµæID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long documentId; |
| | | |
| | | @Schema(description = "èµæåç§°", example = "产å设计å¾") |
| | | @ExcelProperty("èµæåç§°") |
| | | private String documentName; |
| | | |
| | | @Schema(description = "èµæçæ¬", example = "V1.0") |
| | | @ExcelProperty("èµæçæ¬") |
| | | private String documentVersion; |
| | | |
| | | @Schema(description = "å®¡æ ¸äºº", example = "1") |
| | | private Long reviewer; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººåç§°", example = "æå") |
| | | @ExcelProperty("å®¡æ ¸äºº") |
| | | private String reviewerNickname; |
| | | |
| | | @Schema(description = "å®¡æ ¸ç¶æ", example = "0") |
| | | @ExcelProperty(value = "å®¡æ ¸ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_DOCUMENT_AUDIT_STATUS) |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "å®¡æ ¸æ¶é´") |
| | | @ExcelProperty("å®¡æ ¸æ¶é´") |
| | | private LocalDateTime auditTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import jakarta.validation.constraints.NotNull; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES èµæå®¡æ ¸æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdDocumentAuditSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "å®¡æ ¸åå·", requiredMode = Schema.RequiredMode.REQUIRED, example = "AUD2024001") |
| | | private String auditNo; |
| | | |
| | | @Schema(description = "èµæID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| | | private Long documentId; |
| | | |
| | | @Schema(description = "èµæåç§°", example = "产å设计å¾") |
| | | private String documentName; |
| | | |
| | | @Schema(description = "èµæçæ¬", example = "V1.0") |
| | | private String documentVersion; |
| | | |
| | | @Schema(description = "å®¡æ ¸äºº", example = "1") |
| | | private Long reviewer; |
| | | |
| | | @Schema(description = "å®¡æ ¸ç¶æ", example = "0") |
| | | private Integer auditStatus; |
| | | |
| | | @Schema(description = "å®¡æ ¸æ¶é´") |
| | | private LocalDateTime auditTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.project; |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
| | | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import cn.iocoder.yudao.module.mes.service.pd.project.MesPdProjectService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.annotation.Resource; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.Valid; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Stream; |
| | | |
| | | import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; |
| | | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; |
| | | import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; |
| | | |
| | | @Tag(name = "管çåå° - MES 设计项ç®") |
| | | @RestController |
| | | @RequestMapping("/mes/pd/project") |
| | | @Validated |
| | | public class MesPdProjectController { |
| | | |
| | | @Resource |
| | | private MesPdProjectService projectService; |
| | | |
| | | @Resource |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @PostMapping("/create") |
| | | @Operation(summary = "å建设计项ç®") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:create')") |
| | | public CommonResult<Long> createProject(@Valid @RequestBody MesPdProjectSaveReqVO createReqVO) { |
| | | return success(projectService.createProject(createReqVO)); |
| | | } |
| | | |
| | | @PutMapping("/update") |
| | | @Operation(summary = "æ´æ°è®¾è®¡é¡¹ç®") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:update')") |
| | | public CommonResult<Boolean> updateProject(@Valid @RequestBody MesPdProjectSaveReqVO updateReqVO) { |
| | | projectService.updateProject(updateReqVO); |
| | | return success(true); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "å é¤è®¾è®¡é¡¹ç®") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:delete')") |
| | | public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) { |
| | | projectService.deleteProject(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @GetMapping("/get") |
| | | @Operation(summary = "è·å¾è®¾è®¡é¡¹ç®") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true, example = "1024") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:query')") |
| | | public CommonResult<MesPdProjectRespVO> getProject(@RequestParam("id") Long id) { |
| | | MesPdProjectDO project = projectService.getProject(id); |
| | | if (project == null) { |
| | | return success(null); |
| | | } |
| | | return success(buildProjectRespVOList(Collections.singletonList(project)).get(0)); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @Operation(summary = "è·å¾è®¾è®¡é¡¹ç®å页") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:query')") |
| | | public CommonResult<PageResult<MesPdProjectRespVO>> getProjectPage(@Valid MesPdProjectPageReqVO pageReqVO) { |
| | | PageResult<MesPdProjectDO> pageResult = projectService.getProjectPage(pageReqVO); |
| | | return success(new PageResult<>(buildProjectRespVOList(pageResult.getList()), pageResult.getTotal())); |
| | | } |
| | | |
| | | @GetMapping("/export-excel") |
| | | @Operation(summary = "导åºè®¾è®¡é¡¹ç® Excel") |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:export')") |
| | | @ApiAccessLog(operateType = EXPORT) |
| | | public void exportProjectExcel(@Valid MesPdProjectPageReqVO pageReqVO, |
| | | HttpServletResponse response) throws IOException { |
| | | pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
| | | List<MesPdProjectDO> list = projectService.getProjectPage(pageReqVO).getList(); |
| | | // å¯¼åº Excel |
| | | ExcelUtils.write(response, "设计项ç®.xls", "æ°æ®", MesPdProjectRespVO.class, |
| | | buildProjectRespVOList(list)); |
| | | } |
| | | |
| | | @PutMapping("/publish") |
| | | @Operation(summary = "åå¸è®¾è®¡é¡¹ç®ï¼å¾
åå¸âå¾
ä¸ä¼ ï¼") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:update')") |
| | | public CommonResult<Boolean> publishProject(@RequestParam("id") Long id) { |
| | | projectService.publishProject(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/upload") |
| | | @Operation(summary = "ä¸ä¼ èµæï¼å¾
ä¸ä¼ âå¾
å®¡æ ¸ï¼ï¼åæ¶èªå¨åå»ºèµæå®¡æ ¸è®°å½") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:update')") |
| | | public CommonResult<Boolean> uploadProject(@RequestParam("id") Long id) { |
| | | projectService.uploadProject(id, getLoginUserId()); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/audit") |
| | | @Operation(summary = "å®¡æ ¸è®¾è®¡é¡¹ç®ï¼å¾
å®¡æ ¸âå¾
彿¡£ï¼") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:update')") |
| | | public CommonResult<Boolean> auditProject(@RequestParam("id") Long id) { |
| | | projectService.auditProject(id); |
| | | return success(true); |
| | | } |
| | | |
| | | @PutMapping("/archive") |
| | | @Operation(summary = "彿¡£è®¾è®¡é¡¹ç®ï¼å¾
彿¡£â已彿¡£ï¼ï¼åæ¶èªå¨åå»ºå½æ¡£å°è´¦") |
| | | @Parameter(name = "id", description = "ç¼å·", required = true) |
| | | @PreAuthorize("@ss.hasPermission('mes:pd-project:update')") |
| | | public CommonResult<Boolean> archiveProject(@RequestParam("id") Long id) { |
| | | projectService.archiveProject(id, getLoginUserId()); |
| | | return success(true); |
| | | } |
| | | |
| | | // ==================== æ¼æ¥ VO ==================== |
| | | |
| | | private List<MesPdProjectRespVO> buildProjectRespVOList(List<MesPdProjectDO> list) { |
| | | if (CollUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 1.1 æ¹éè·åå
³èæ°æ®ï¼ä¸»è®¾è®¡å¸ + å®¡æ ¸äººï¼ |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(list, |
| | | project -> Stream.of(project.getChiefDesigner(), project.getReviewer()))); |
| | | // 2. æ¼æ¥ VO |
| | | return BeanUtils.toBean(list, MesPdProjectRespVO.class, vo -> { |
| | | MapUtils.findAndThen(userMap, vo.getChiefDesigner(), |
| | | user -> vo.setChiefDesignerNickname(user.getNickname())); |
| | | MapUtils.findAndThen(userMap, vo.getReviewer(), |
| | | user -> vo.setReviewerNickname(user.getNickname())); |
| | | }); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.ToString; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| | | |
| | | @Schema(description = "管çåå° - MES 设计项ç®å页 Request VO") |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | public class MesPdProjectPageReqVO extends PageParam { |
| | | |
| | | @Schema(description = "ä»»å¡ç¼ç ", example = "PD2024001") |
| | | private String taskCode; |
| | | |
| | | @Schema(description = "ä»»å¡åç§°", example = "æ°äº§å设计任å¡") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "ITEM001") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "æºè½ä¼ æå¨") |
| | | private String productName; |
| | | |
| | | @Schema(description = "ç¶æ", example = "0") |
| | | private Integer status; |
| | | |
| | | @Schema(description = "计å宿æ¶é´") |
| | | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| | | private LocalDateTime[] planFinishTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo; |
| | | |
| | | import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; |
| | | import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.idev.excel.annotation.ExcelIgnoreUnannotated; |
| | | import cn.idev.excel.annotation.ExcelProperty; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾è®¡é¡¹ç® Response VO") |
| | | @Data |
| | | @ExcelIgnoreUnannotated |
| | | public class MesPdProjectRespVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| | | @ExcelProperty("ç¼å·") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ä»»å¡ç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "PD2024001") |
| | | @ExcelProperty("ä»»å¡ç¼ç ") |
| | | private String taskCode; |
| | | |
| | | @Schema(description = "ä»»å¡åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "æ°äº§å设计任å¡") |
| | | @ExcelProperty("ä»»å¡åç§°") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "ITEM001") |
| | | @ExcelProperty("产åç¼ç ") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "æºè½ä¼ æå¨") |
| | | @ExcelProperty("产ååç§°") |
| | | private String productName; |
| | | |
| | | @Schema(description = "çæ¬å·", example = "V1.0") |
| | | @ExcelProperty("çæ¬å·") |
| | | private String version; |
| | | |
| | | @Schema(description = "ç¶æ", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") |
| | | @ExcelProperty(value = "ç¶æ", converter = DictConvert.class) |
| | | @DictFormat(DictTypeConstants.MES_PD_PROJECT_STATUS) |
| | | private Integer status; |
| | | |
| | | @Schema(description = "主设计å¸", example = "1") |
| | | private Long chiefDesigner; |
| | | |
| | | @Schema(description = "主设计å¸åç§°", example = "å¼ ä¸") |
| | | @ExcelProperty("主设计å¸") |
| | | private String chiefDesignerNickname; |
| | | |
| | | @Schema(description = "å®¡æ ¸äºº", example = "1") |
| | | private Long reviewer; |
| | | |
| | | @Schema(description = "å®¡æ ¸äººåç§°", example = "æå") |
| | | @ExcelProperty("å®¡æ ¸äºº") |
| | | private String reviewerNickname; |
| | | |
| | | @Schema(description = "计å宿æ¶é´") |
| | | @ExcelProperty("计å宿æ¶é´") |
| | | private LocalDateTime planFinishTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | @ExcelProperty("夿³¨") |
| | | private String remark; |
| | | |
| | | @Schema(description = "å建æ¶é´", requiredMode = Schema.RequiredMode.REQUIRED) |
| | | @ExcelProperty("å建æ¶é´") |
| | | private LocalDateTime createTime; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo; |
| | | |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Schema(description = "管çåå° - MES è®¾è®¡é¡¹ç®æ°å¢/ä¿®æ¹ Request VO") |
| | | @Data |
| | | public class MesPdProjectSaveReqVO { |
| | | |
| | | @Schema(description = "ç¼å·", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") |
| | | private Long id; |
| | | |
| | | @Schema(description = "ä»»å¡ç¼ç ", requiredMode = Schema.RequiredMode.REQUIRED, example = "PD2024001") |
| | | @NotBlank(message = "ä»»å¡ç¼ç ä¸è½ä¸ºç©º") |
| | | private String taskCode; |
| | | |
| | | @Schema(description = "ä»»å¡åç§°", requiredMode = Schema.RequiredMode.REQUIRED, example = "æ°äº§å设计任å¡") |
| | | @NotBlank(message = "ä»»å¡åç§°ä¸è½ä¸ºç©º") |
| | | private String taskName; |
| | | |
| | | @Schema(description = "产åç¼ç ", example = "ITEM001") |
| | | private String productCode; |
| | | |
| | | @Schema(description = "产ååç§°", example = "æºè½ä¼ æå¨") |
| | | private String productName; |
| | | |
| | | @Schema(description = "çæ¬å·", example = "V1.0") |
| | | private String version; |
| | | |
| | | @Schema(description = "主设计å¸", example = "1") |
| | | private Long chiefDesigner; |
| | | |
| | | @Schema(description = "å®¡æ ¸äºº", example = "1") |
| | | private Long reviewer; |
| | | |
| | | @Schema(description = "计å宿æ¶é´") |
| | | private LocalDateTime planFinishTime; |
| | | |
| | | @Schema(description = "夿³¨", example = "æµè¯å¤æ³¨") |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.archive; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES 彿¡£å°è´¦ DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_archive") |
| | | @KeySequence("mes_pd_archive_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdArchiveDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * 彿¡£ç¼å· |
| | | */ |
| | | private String archiveCode; |
| | | /** |
| | | * 设计项ç®ID |
| | | * |
| | | * å
³è {@link MesPdProjectDO#getId()} |
| | | */ |
| | | private Long projectId; |
| | | /** |
| | | * 彿¡£äºº |
| | | * |
| | | * å
³è AdminUserDO#getId() |
| | | */ |
| | | private Long archiver; |
| | | /** |
| | | * 彿¡£ç¶æ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_ARCHIVE_STATUS} |
| | | */ |
| | | private Integer archiveStatus; |
| | | /** |
| | | * 彿¡£æ¶é´ |
| | | */ |
| | | private LocalDateTime archiveTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.document; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES è®¾è®¡èµæ DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_document") |
| | | @KeySequence("mes_pd_document_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdDocumentDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * 设计项ç®ID |
| | | * |
| | | * å
³è {@link MesPdProjectDO#getId()} |
| | | */ |
| | | private Long projectId; |
| | | /** |
| | | * èµæç±»å |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_DOCUMENT_TYPE} |
| | | */ |
| | | private String documentType; |
| | | /** |
| | | * èµæåç§° |
| | | */ |
| | | private String documentName; |
| | | /** |
| | | * çæ¬ |
| | | */ |
| | | private String documentVersion; |
| | | /** |
| | | * æä»¶å |
| | | */ |
| | | private String fileName; |
| | | /** |
| | | * ä¸ä¼ 人 |
| | | * |
| | | * å
³è AdminUserDO#getId() |
| | | */ |
| | | private Long uploadUserId; |
| | | /** |
| | | * ä¸ä¼ æ¶é´ |
| | | */ |
| | | private LocalDateTime uploadTime; |
| | | /** |
| | | * æä»¶URL |
| | | */ |
| | | private String fileUrl; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.documentaudit; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES èµæå®¡æ ¸ DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_document_audit") |
| | | @KeySequence("mes_pd_document_audit_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdDocumentAuditDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * å®¡æ ¸åå· |
| | | */ |
| | | private String auditNo; |
| | | /** |
| | | * èµæID |
| | | * |
| | | * å
³è {@link MesPdDocumentDO#getId()} |
| | | */ |
| | | private Long documentId; |
| | | /** |
| | | * èµæåç§°ï¼åä½ï¼ |
| | | */ |
| | | private String documentName; |
| | | /** |
| | | * èµæçæ¬ï¼åä½ï¼ |
| | | */ |
| | | private String documentVersion; |
| | | /** |
| | | * å®¡æ ¸äºº |
| | | * |
| | | * å
³è AdminUserDO#getId() |
| | | */ |
| | | private Long reviewer; |
| | | /** |
| | | * å®¡æ ¸ç¶æ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_DOCUMENT_AUDIT_STATUS} |
| | | */ |
| | | private Integer auditStatus; |
| | | /** |
| | | * å®¡æ ¸æ¶é´ |
| | | */ |
| | | private LocalDateTime auditTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.dataobject.pd.project; |
| | | |
| | | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| | | import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; |
| | | import cn.iocoder.yudao.module.mes.enums.pd.MesPdProjectStatusEnum; |
| | | import com.baomidou.mybatisplus.annotation.KeySequence; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | |
| | | /** |
| | | * MES è®¾è®¡é¡¹ç® DO |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @TableName("mes_pd_project") |
| | | @KeySequence("mes_pd_project_seq") // ç¨äº OracleãPostgreSQLãKingbaseãDB2ãH2 æ°æ®åºç主é®èªå¢ãå¦ææ¯ MySQL çæ°æ®åºï¼å¯ä¸åã |
| | | @Data |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ToString(callSuper = true) |
| | | @Builder |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | public class MesPdProjectDO extends BaseDO { |
| | | |
| | | /** |
| | | * ç¼å· |
| | | */ |
| | | @TableId |
| | | private Long id; |
| | | /** |
| | | * ä»»å¡ç¼ç |
| | | */ |
| | | private String taskCode; |
| | | /** |
| | | * ä»»å¡åç§° |
| | | */ |
| | | private String taskName; |
| | | /** |
| | | * 产åç¼ç |
| | | */ |
| | | private String productCode; |
| | | /** |
| | | * 产ååç§° |
| | | */ |
| | | private String productName; |
| | | /** |
| | | * çæ¬å· |
| | | */ |
| | | private String version; |
| | | /** |
| | | * ç¶æ |
| | | * |
| | | * åå
¸ {@link DictTypeConstants#MES_PD_PROJECT_STATUS} |
| | | * æä¸¾ {@link MesPdProjectStatusEnum} |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * ä¸»è®¾è®¡å¸ |
| | | * |
| | | * å
³è AdminUserDO#getId() |
| | | */ |
| | | private Long chiefDesigner; |
| | | /** |
| | | * å®¡æ ¸äºº |
| | | * |
| | | * å
³è AdminUserDO#getId() |
| | | */ |
| | | private Long reviewer; |
| | | /** |
| | | * 计å宿æ¶é´ |
| | | */ |
| | | private LocalDateTime planFinishTime; |
| | | /** |
| | | * 夿³¨ |
| | | */ |
| | | private String remark; |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.archive; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveGroupRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchivePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.archive.MesPdArchiveDO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdArchiveMapper extends BaseMapperX<MesPdArchiveDO> { |
| | | |
| | | default PageResult<MesPdArchiveDO> selectPage(MesPdArchivePageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdArchiveDO>() |
| | | .likeIfPresent(MesPdArchiveDO::getArchiveCode, reqVO.getArchiveCode()) |
| | | .eqIfPresent(MesPdArchiveDO::getProjectId, reqVO.getProjectId()) |
| | | .eqIfPresent(MesPdArchiveDO::getArchiveStatus, reqVO.getArchiveStatus()) |
| | | .orderByDesc(MesPdArchiveDO::getId)); |
| | | } |
| | | |
| | | default MesPdArchiveDO selectByArchiveCode(String archiveCode) { |
| | | return selectOne(MesPdArchiveDO::getArchiveCode, archiveCode); |
| | | } |
| | | |
| | | default List<MesPdArchiveDO> selectListByProjectId(Long projectId) { |
| | | return selectList(MesPdArchiveDO::getProjectId, projectId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æé¡¹ç®ä¸å½æ¡£è®°å½æ°é |
| | | */ |
| | | default Long selectCountByProjectId(Long projectId) { |
| | | return selectCount(MesPdArchiveDO::getProjectId, projectId); |
| | | } |
| | | |
| | | /** |
| | | * XML mapper å®ç°çåç»å页æ¥è¯¢ |
| | | * è¿å MesPdArchiveGroupRespVOï¼å
å«å½æ¡£å段 + å
³è项ç®ç产åç¼ç /åç§°ï¼ |
| | | */ |
| | | IPage<MesPdArchiveGroupRespVO> selectPageGroupByProjectId(Page<MesPdArchiveGroupRespVO> page, |
| | | @Param("req") MesPdArchivePageReqVO reqVO); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.document; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdDocumentMapper extends BaseMapperX<MesPdDocumentDO> { |
| | | |
| | | default PageResult<MesPdDocumentDO> selectPage(MesPdDocumentPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdDocumentDO>() |
| | | .eqIfPresent(MesPdDocumentDO::getProjectId, reqVO.getProjectId()) |
| | | .likeIfPresent(MesPdDocumentDO::getDocumentName, reqVO.getDocumentName()) |
| | | .eqIfPresent(MesPdDocumentDO::getDocumentType, reqVO.getDocumentType()) |
| | | .orderByDesc(MesPdDocumentDO::getId)); |
| | | } |
| | | |
| | | default List<MesPdDocumentDO> selectListByProjectId(Long projectId) { |
| | | return selectList(MesPdDocumentDO::getProjectId, projectId); |
| | | } |
| | | |
| | | default int deleteByProjectId(Long projectId) { |
| | | return delete(MesPdDocumentDO::getProjectId, projectId); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.documentaudit; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.documentaudit.MesPdDocumentAuditDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | public interface MesPdDocumentAuditMapper extends BaseMapperX<MesPdDocumentAuditDO> { |
| | | |
| | | default PageResult<MesPdDocumentAuditDO> selectPage(MesPdDocumentAuditPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdDocumentAuditDO>() |
| | | .eqIfPresent(MesPdDocumentAuditDO::getDocumentId, reqVO.getDocumentId()) |
| | | .likeIfPresent(MesPdDocumentAuditDO::getAuditNo, reqVO.getAuditNo()) |
| | | .eqIfPresent(MesPdDocumentAuditDO::getAuditStatus, reqVO.getAuditStatus()) |
| | | .orderByDesc(MesPdDocumentAuditDO::getId)); |
| | | } |
| | | |
| | | default List<MesPdDocumentAuditDO> selectListByDocumentId(Long documentId) { |
| | | return selectList(MesPdDocumentAuditDO::getDocumentId, documentId); |
| | | } |
| | | |
| | | default int deleteByDocumentId(Long documentId) { |
| | | return delete(MesPdDocumentAuditDO::getDocumentId, documentId); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æå®èµæIDåè¡¨ä¸æ¯å¦åå¨å¾
å®¡æ ¸çè®°å½ |
| | | * |
| | | * @param documentIds èµæIDå表 |
| | | * @return æ¯å¦åå¨å¾
å®¡æ ¸è®°å½ |
| | | */ |
| | | default boolean existsPendingAuditByDocumentIds(Collection<Long> documentIds) { |
| | | if (documentIds == null || documentIds.isEmpty()) { |
| | | return false; |
| | | } |
| | | return selectCount(new LambdaQueryWrapperX<MesPdDocumentAuditDO>() |
| | | .in(MesPdDocumentAuditDO::getDocumentId, documentIds) |
| | | .eq(MesPdDocumentAuditDO::getAuditStatus, 0)) > 0; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.dal.mysql.pd.project; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| | | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface MesPdProjectMapper extends BaseMapperX<MesPdProjectDO> { |
| | | |
| | | default PageResult<MesPdProjectDO> selectPage(MesPdProjectPageReqVO reqVO) { |
| | | return selectPage(reqVO, new LambdaQueryWrapperX<MesPdProjectDO>() |
| | | .likeIfPresent(MesPdProjectDO::getTaskCode, reqVO.getTaskCode()) |
| | | .likeIfPresent(MesPdProjectDO::getTaskName, reqVO.getTaskName()) |
| | | .likeIfPresent(MesPdProjectDO::getProductCode, reqVO.getProductCode()) |
| | | .likeIfPresent(MesPdProjectDO::getProductName, reqVO.getProductName()) |
| | | .eqIfPresent(MesPdProjectDO::getStatus, reqVO.getStatus()) |
| | | .betweenIfPresent(MesPdProjectDO::getPlanFinishTime, reqVO.getPlanFinishTime()) |
| | | .orderByDesc(MesPdProjectDO::getId)); |
| | | } |
| | | |
| | | default MesPdProjectDO selectByTaskCode(String taskCode) { |
| | | return selectOne(MesPdProjectDO::getTaskCode, taskCode); |
| | | } |
| | | |
| | | } |
| | |
| | | // ========== å·¥å
·ç®¡ç (TM) ========== |
| | | String MES_TM_TOOL_STATUS = "mes_tm_tool_status"; // MES å·¥å
·ç¶æ |
| | | String MES_TM_MAINTEN_TYPE = "mes_tm_mainten_type"; // MES ä¿å
»ç»´æ¤ç±»å |
| | | |
| | | // ========== 产å设计 (PD) ========== |
| | | String MES_PD_PROJECT_STATUS = "mes_pd_project_status"; // 设计项ç®ç¶æ |
| | | String MES_PD_DOCUMENT_TYPE = "mes_pd_document_type"; // èµæç±»å |
| | | String MES_PD_DOCUMENT_AUDIT_STATUS = "mes_pd_document_audit_status"; // èµæå®¡æ ¸ç¶æ |
| | | String MES_PD_ARCHIVE_STATUS = "mes_pd_archive_status"; // 彿¡£ç¶æ |
| | | String MES_PD_PROCESS_PARAM_TYPE = "mes_pd_process_param_type"; // å·¥èºåæ°ç±»å |
| | | String MES_PD_PROCESS_PARAM_TEMPLATE_TYPE = "mes_pd_process_param_template_type"; // å·¥èºåæ°æ¨¡æ¿ç±»å |
| | | } |
| | |
| | | ErrorCode WM_PACKAGE_HAS_CHILDREN = new ErrorCode(1_040_740_008, "åå¨åç®±ï¼ä¸å
许å é¤"); |
| | | ErrorCode WM_PACKAGE_LINE_NOT_EXISTS = new ErrorCode(1_040_740_100, "è£
ç®±æç»ä¸åå¨"); |
| | | |
| | | // ========== MES 产å设计-设计项ç®ï¼1-040-800-000ï¼ ========== |
| | | ErrorCode PD_PROJECT_NOT_EXISTS = new ErrorCode(1_040_800_000, "设计项ç®ä¸åå¨"); |
| | | ErrorCode PD_PROJECT_NOT_INITIATE = new ErrorCode(1_040_800_001, "设计项ç®ä¸æ¯å¾
åå¸ç¶æï¼ä¸å
è®¸ä¿®æ¹æå é¤"); |
| | | ErrorCode PD_PROJECT_CODE_DUPLICATE = new ErrorCode(1_040_800_002, "设计项ç®ä»»å¡ç¼ç å·²åå¨"); |
| | | ErrorCode PD_PROJECT_NOT_INITIATE_FOR_PUBLISH = new ErrorCode(1_040_800_003, "åªæå¾
åå¸ç¶æçè®¾è®¡é¡¹ç®æè½åå¸"); |
| | | ErrorCode PD_PROJECT_NOT_PUBLISH_FOR_UPLOAD = new ErrorCode(1_040_800_004, "åªæå¾
ä¸ä¼ ç¶æçè®¾è®¡é¡¹ç®æè½ä¸ä¼ èµæ"); |
| | | ErrorCode PD_PROJECT_NOT_UPLOAD_FOR_AUDIT = new ErrorCode(1_040_800_005, "åªæå¾
å®¡æ ¸ç¶æçè®¾è®¡é¡¹ç®æè½å®¡æ ¸"); |
| | | ErrorCode PD_PROJECT_NOT_AUDIT_FOR_ARCHIVE = new ErrorCode(1_040_800_006, "åªæå¾
彿¡£ç¶æçè®¾è®¡é¡¹ç®æè½å½æ¡£"); |
| | | ErrorCode PD_PROJECT_AUDIT_NOT_FINISHED = new ErrorCode(1_040_800_007, "该项ç®ä¸å卿ªå®¡æ ¸çèµæï¼è¯·å
宿ææèµæå®¡æ ¸"); |
| | | |
| | | // ========== MES 产å设计-èµæå表ï¼1-040-801-000ï¼ ========== |
| | | ErrorCode PD_DOCUMENT_NOT_EXISTS = new ErrorCode(1_040_801_000, "è®¾è®¡èµæä¸åå¨"); |
| | | |
| | | // ========== MES 产å设计-èµæå®¡æ ¸ï¼1-040-802-000ï¼ ========== |
| | | ErrorCode PD_DOCUMENT_AUDIT_NOT_EXISTS = new ErrorCode(1_040_802_000, "èµæå®¡æ ¸è®°å½ä¸åå¨"); |
| | | |
| | | // ========== MES 产å设计-彿¡£å°è´¦ï¼1-040-803-000ï¼ ========== |
| | | ErrorCode PD_ARCHIVE_NOT_EXISTS = new ErrorCode(1_040_803_000, "彿¡£å°è´¦ä¸åå¨"); |
| | | ErrorCode PD_ARCHIVE_CODE_DUPLICATE = new ErrorCode(1_040_803_001, "彿¡£ç¼å·å·²åå¨"); |
| | | |
| | | // ========== MES 产å设计-å·¥èºåæ°ï¼1-040-804-000ï¼ ========== |
| | | ErrorCode PD_PROCESS_PARAM_NOT_EXISTS = new ErrorCode(1_040_804_000, "å·¥èºåæ°ä¸åå¨"); |
| | | ErrorCode PD_PROCESS_PARAM_CODE_DUPLICATE = new ErrorCode(1_040_804_001, "å·¥èºåæ°ç¼ç å·²åå¨"); |
| | | |
| | | // ========== MES 产å设计-å·¥èºåæ°æ¨¡æ¿ï¼1-040-805-000ï¼ ========== |
| | | ErrorCode PD_PROCESS_PARAM_TEMPLATE_NOT_EXISTS = new ErrorCode(1_040_805_000, "å·¥èºåæ°æ¨¡æ¿ä¸åå¨"); |
| | | ErrorCode PD_PROCESS_PARAM_TEMPLATE_CODE_DUPLICATE = new ErrorCode(1_040_805_001, "å·¥èºåæ°æ¨¡æ¿ç¼ç å·²åå¨"); |
| | | |
| | | } |
| | |
| | | public static final int MD_USER = 604; // 人åï¼ç³»ç»ç¨æ· |
| | | public static final int MD_CLIENT = 605; // 客æ·ï¼MesMdClientDO |
| | | |
| | | // ========== PD 产å设计模å [700, 800) ========== |
| | | |
| | | public static final int PD_PROJECT = 700; // 设计项ç®ï¼MesPdProjectDO |
| | | public static final int PD_DOCUMENT = 701; // èµæå表ï¼MesPdDocumentDO |
| | | public static final int PD_DOCUMENT_AUDIT = 702; // èµæå®¡æ ¸ï¼MesPdDocumentAuditDO |
| | | public static final int PD_ARCHIVE = 703; // 彿¡£å°è´¦ï¼MesPdArchiveDO |
| | | public static final int PD_PROCESS_PARAM = 704; // å·¥èºåæ°ï¼MesPdProcessParamDO |
| | | public static final int PD_PROCESS_PARAM_TEMPLATE = 705; // å·¥èºåæ°æ¨¡æ¿ï¼MesPdProcessParamTemplateDO |
| | | |
| | | // ========== ç¹æ®ç±»åï¼éä¸å¡å®ä½ï¼ [900, 1000) ========== |
| | | |
| | | public static final int QUALITY_STATUS = 900; // è´¨éç¶æï¼éå®ä½ï¼ç¨äºçç¹çåºæ¯çç¶æçé |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums; |
| | | |
| | | /** |
| | | * MES 产åè®¾è®¡ç¶æå¸¸é |
| | | * |
| | | * éä¸ç®¡ç产å设计模åååæ®ç¶æçç¼å·ï¼ä½ä¸ºç¶æå¼çä¸å¤®æ³¨åä¸å¿ã |
| | | * åæä¸¾ç±»å¼ç¨æ¤å¤å¸¸éï¼é¿å
硬ç¼ç æ°åã |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public final class MesPdStatusConstants { |
| | | |
| | | private MesPdStatusConstants() {} |
| | | |
| | | /** |
| | | * å¾
åå¸ |
| | | */ |
| | | public static final int INITIATE = 0; |
| | | /** |
| | | * å¾
ä¸ä¼ |
| | | */ |
| | | public static final int PUBLISH = 1; |
| | | /** |
| | | * å¾
å®¡æ ¸ |
| | | */ |
| | | public static final int UPLOAD = 2; |
| | | /** |
| | | * å¾
彿¡£ |
| | | */ |
| | | public static final int AUDIT = 3; |
| | | /** |
| | | * 已彿¡£ |
| | | */ |
| | | public static final int ARCHIVE = 4; |
| | | |
| | | } |
| | |
| | | PRO_WORK_ORDER_CODE("PRO_WORK_ORDER_CODE", "ç产工åç¼ç "), |
| | | QC_DEFECT_CODE("QC_DEFECT_CODE", "缺é·ç±»åç¼ç "), |
| | | QC_INDICATOR_RESULT_CODE("QC_INDICATOR_RESULT_CODE", "æ ·åæ£éªç»æç¼ç "), |
| | | WM_OUTSOURCE_RECEIPT_CODE("WM_OUTSOURCE_RECEIPT_CODE", "å¤åå
¥åºåç¼ç "); |
| | | WM_OUTSOURCE_RECEIPT_CODE("WM_OUTSOURCE_RECEIPT_CODE", "å¤åå
¥åºåç¼ç "), |
| | | PD_DOCUMENT_AUDIT_CODE("PD_DOCUMENT_AUDIT_CODE", "èµæå®¡æ ¸åç¼ç "), |
| | | PD_ARCHIVE_CODE("PD_ARCHIVE_CODE", "彿¡£å°è´¦ç¼ç "), |
| | | PD_PROCESS_PARAM_CODE("PD_PROCESS_PARAM_CODE", "å·¥èºåæ°ç¼ç "), |
| | | PD_PROCESS_PARAM_TEMPLATE_CODE("PD_PROCESS_PARAM_TEMPLATE_CODE", "å·¥èºåæ°æ¨¡æ¿ç¼ç "); |
| | | |
| | | /** |
| | | * è§å代ç |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.enums.pd; |
| | | |
| | | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| | | import cn.iocoder.yudao.module.mes.enums.MesPdStatusConstants; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Getter; |
| | | |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * MES 设计项ç®ç¶ææä¸¾ |
| | | * |
| | | * ç¶ææµè½¬ï¼å¾
åå¸ â å¾
ä¸ä¼ â å¾
å®¡æ ¸ â å¾
彿¡£ â 已彿¡£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Getter |
| | | @AllArgsConstructor |
| | | public enum MesPdProjectStatusEnum implements ArrayValuable<Integer> { |
| | | |
| | | /** |
| | | * å¾
åå¸ |
| | | * |
| | | * å¯¹åº MesPdProjectService#createProject æ¹æ³ |
| | | */ |
| | | INITIATE(MesPdStatusConstants.INITIATE, "å¾
åå¸"), |
| | | /** |
| | | * å¾
ä¸ä¼ |
| | | * |
| | | * å¯¹åº MesPdProjectService#publishProject æ¹æ³ |
| | | */ |
| | | PUBLISH(MesPdStatusConstants.PUBLISH, "å¾
ä¸ä¼ "), |
| | | /** |
| | | * å¾
å®¡æ ¸ |
| | | * |
| | | * å¯¹åº MesPdProjectService#uploadProject æ¹æ³ |
| | | */ |
| | | UPLOAD(MesPdStatusConstants.UPLOAD, "å¾
å®¡æ ¸"), |
| | | /** |
| | | * å¾
彿¡£ |
| | | * |
| | | * å¯¹åº MesPdProjectService#auditProject æ¹æ³ |
| | | */ |
| | | AUDIT(MesPdStatusConstants.AUDIT, "å¾
彿¡£"), |
| | | /** |
| | | * 已彿¡£ |
| | | * |
| | | * å¯¹åº MesPdProjectService#archiveProject æ¹æ³ |
| | | */ |
| | | ARCHIVE(MesPdStatusConstants.ARCHIVE, "已彿¡£"); |
| | | |
| | | public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesPdProjectStatusEnum::getStatus).toArray(Integer[]::new); |
| | | |
| | | /** |
| | | * ç¶æå¼ |
| | | */ |
| | | private final Integer status; |
| | | /** |
| | | * ç¶æå |
| | | */ |
| | | private final String name; |
| | | |
| | | @Override |
| | | public Integer[] array() { |
| | | return ARRAYS; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.archive; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveDetailRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveGroupRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchivePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.archive.MesPdArchiveDO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES 彿¡£å°è´¦ Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesPdArchiveService { |
| | | |
| | | /** |
| | | * åå»ºå½æ¡£å°è´¦ |
| | | */ |
| | | Long createArchive(@Valid MesPdArchiveSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°å½æ¡£å°è´¦ |
| | | */ |
| | | void updateArchive(@Valid MesPdArchiveSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤å½æ¡£å°è´¦ |
| | | */ |
| | | void deleteArchive(Long id); |
| | | |
| | | /** |
| | | * è·å¾å½æ¡£å°è´¦ |
| | | */ |
| | | MesPdArchiveDO getArchive(Long id); |
| | | |
| | | /** |
| | | * è·å¾å½æ¡£å°è´¦å页 |
| | | */ |
| | | PageResult<MesPdArchiveDO> getArchivePage(MesPdArchivePageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å¾å½æ¡£å°è´¦åé¡µï¼æé¡¹ç®/产ååç»ï¼æ¯ç»åææ°ä¸æ¡ï¼ |
| | | * è¿å MesPdArchiveGroupRespVOï¼å
å«å½æ¡£å段 + å
³è项ç®ç产åç¼ç /åç§°ï¼ |
| | | */ |
| | | IPage<MesPdArchiveGroupRespVO> getArchivePageGroupByProject(MesPdArchivePageReqVO pageReqVO, |
| | | Page<MesPdArchiveGroupRespVO> page); |
| | | |
| | | /** |
| | | * è·å¾å½æ¡£å°è´¦è¯¦æ
ï¼æäº§åï¼ï¼å
å«é¡¹ç®ä¿¡æ¯ã彿¡£è®°å½å表ãè®¾è®¡èµæå表 |
| | | */ |
| | | List<MesPdArchiveDetailRespVO> getArchiveDetailByProductCode(String productCode); |
| | | |
| | | /** |
| | | * è·å¾æé¡¹ç®ä¸å½æ¡£è®°å½æ°é |
| | | */ |
| | | Long getArchiveCountByProjectId(Long projectId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.archive; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveDetailRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveGroupRespVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchivePageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.archive.MesPdArchiveDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.archive.MesPdArchiveMapper; |
| | | import cn.iocoder.yudao.module.mes.service.pd.document.MesPdDocumentService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.project.MesPdProjectService; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES 彿¡£å°è´¦ Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdArchiveServiceImpl implements MesPdArchiveService { |
| | | |
| | | @Resource |
| | | private MesPdArchiveMapper archiveMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesPdProjectService projectService; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesPdDocumentService documentService; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private AdminUserApi adminUserApi; |
| | | |
| | | @Override |
| | | public Long createArchive(MesPdArchiveSaveReqVO createReqVO) { |
| | | // æ ¡éªå½æ¡£ç¼å·å¯ä¸ |
| | | validateArchiveCodeUnique(null, createReqVO.getArchiveCode()); |
| | | // æ ¡éªè®¾è®¡é¡¹ç®åå¨ |
| | | projectService.validateProjectExists(createReqVO.getProjectId()); |
| | | // æå
¥ |
| | | MesPdArchiveDO archive = BeanUtils.toBean(createReqVO, MesPdArchiveDO.class); |
| | | archiveMapper.insert(archive); |
| | | return archive.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateArchive(MesPdArchiveSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | validateArchiveExists(updateReqVO.getId()); |
| | | // æ ¡éªå½æ¡£ç¼å·å¯ä¸ |
| | | validateArchiveCodeUnique(updateReqVO.getId(), updateReqVO.getArchiveCode()); |
| | | // æ´æ° |
| | | MesPdArchiveDO updateObj = BeanUtils.toBean(updateReqVO, MesPdArchiveDO.class); |
| | | archiveMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteArchive(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateArchiveExists(id); |
| | | // å é¤ |
| | | archiveMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdArchiveDO getArchive(Long id) { |
| | | return archiveMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdArchiveDO> getArchivePage(MesPdArchivePageReqVO pageReqVO) { |
| | | return archiveMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MesPdArchiveGroupRespVO> getArchivePageGroupByProject(MesPdArchivePageReqVO pageReqVO, Page<MesPdArchiveGroupRespVO> page) { |
| | | return archiveMapper.selectPageGroupByProjectId(page,pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdArchiveDetailRespVO> getArchiveDetailByProductCode(String productCode) { |
| | | // 1. æ¥é¡¹ç®ä¿¡æ¯ |
| | | List<MesPdProjectDO> projects = projectService.getProjectByProductCode(productCode); |
| | | List<MesPdArchiveDetailRespVO> mesPdArchiveDetailRespVOS = new ArrayList<>(); |
| | | projects.forEach(project -> { |
| | | if (project == null) { |
| | | throw exception(PD_PROJECT_NOT_EXISTS); |
| | | } |
| | | // 2. æ¥å½æ¡£å表 |
| | | List<MesPdArchiveDO> archives = archiveMapper.selectListByProjectId(project.getId()); |
| | | // 3. æ¥èµæå表 |
| | | List<MesPdDocumentDO> documents = documentService.getDocumentListByProjectId(project.getId()); |
| | | |
| | | // 4. ç»è£
VO |
| | | MesPdArchiveDetailRespVO respVO = new MesPdArchiveDetailRespVO(); |
| | | |
| | | // 4.1 项ç®ä¿¡æ¯ |
| | | MesPdArchiveDetailRespVO.ProjectInfo projectInfo = BeanUtils.toBean(project, MesPdArchiveDetailRespVO.ProjectInfo.class); |
| | | // æ¹éè·åç¨æ·ä¿¡æ¯ |
| | | Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( |
| | | cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet( |
| | | java.util.stream.Stream.of(project.getChiefDesigner(), project.getReviewer()) |
| | | .filter(java.util.Objects::nonNull) |
| | | .collect(java.util.stream.Collectors.toSet()), |
| | | id -> id)); |
| | | MapUtils.findAndThen(userMap, project.getChiefDesigner(), |
| | | user -> projectInfo.setChiefDesignerNickname(user.getNickname())); |
| | | MapUtils.findAndThen(userMap, project.getReviewer(), |
| | | user -> projectInfo.setReviewerNickname(user.getNickname())); |
| | | respVO.setProject(projectInfo); |
| | | |
| | | // 4.2 彿¡£è®°å½å表 |
| | | if (!archives.isEmpty()) { |
| | | Map<Long, AdminUserRespDTO> archiverUserMap = adminUserApi.getUserMap( |
| | | cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet(archives, MesPdArchiveDO::getArchiver)); |
| | | List<MesPdArchiveDetailRespVO.ArchiveInfo> archiveInfos = BeanUtils.toBean(archives, MesPdArchiveDetailRespVO.ArchiveInfo.class, |
| | | info -> MapUtils.findAndThen(archiverUserMap, info.getArchiver(), |
| | | user -> info.setArchiverNickname(user.getNickname()))); |
| | | respVO.setArchives(archiveInfos); |
| | | } |
| | | |
| | | // 4.3 è®¾è®¡èµæå表 |
| | | if (!documents.isEmpty()) { |
| | | Map<Long, AdminUserRespDTO> uploadUserMap = adminUserApi.getUserMap( |
| | | cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet(documents, MesPdDocumentDO::getUploadUserId)); |
| | | List<MesPdArchiveDetailRespVO.DocumentInfo> documentInfos = BeanUtils.toBean(documents, MesPdArchiveDetailRespVO.DocumentInfo.class, |
| | | info -> MapUtils.findAndThen(uploadUserMap, info.getUploadUserId(), |
| | | user -> info.setUploadUserNickname(user.getNickname()))); |
| | | respVO.setDocuments(documentInfos); |
| | | } |
| | | mesPdArchiveDetailRespVOS.add(respVO); |
| | | }); |
| | | |
| | | return mesPdArchiveDetailRespVOS; |
| | | } |
| | | |
| | | @Override |
| | | public Long getArchiveCountByProjectId(Long projectId) { |
| | | return archiveMapper.selectCountByProjectId(projectId); |
| | | } |
| | | |
| | | private MesPdArchiveDO validateArchiveExists(Long id) { |
| | | MesPdArchiveDO archive = archiveMapper.selectById(id); |
| | | if (archive == null) { |
| | | throw exception(PD_ARCHIVE_NOT_EXISTS); |
| | | } |
| | | return archive; |
| | | } |
| | | |
| | | private void validateArchiveCodeUnique(Long id, String archiveCode) { |
| | | MesPdArchiveDO existing = archiveMapper.selectByArchiveCode(archiveCode); |
| | | if (existing == null) { |
| | | return; |
| | | } |
| | | // 妿 id 为空ï¼è¯´ææ¯æ°å¢ï¼ç¼ç éå¤ |
| | | if (id == null) { |
| | | throw exception(PD_ARCHIVE_CODE_DUPLICATE); |
| | | } |
| | | // 妿 id ä¸ä¸ºç©ºï¼è¯´ææ¯ä¿®æ¹ï¼ç¼ç éå¤ä¸ä¸æ¯å䏿¡è®°å½ |
| | | if (!existing.getId().equals(id)) { |
| | | throw exception(PD_ARCHIVE_CODE_DUPLICATE); |
| | | } |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.document; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES è®¾è®¡èµæ Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesPdDocumentService { |
| | | |
| | | /** |
| | | * åå»ºè®¾è®¡èµæ |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createDocument(@Valid MesPdDocumentSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°è®¾è®¡èµæ |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateDocument(@Valid MesPdDocumentSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤è®¾è®¡èµæ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteDocument(Long id); |
| | | |
| | | /** |
| | | * è·å¾è®¾è®¡èµæ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return è®¾è®¡èµæ |
| | | */ |
| | | MesPdDocumentDO getDocument(Long id); |
| | | |
| | | /** |
| | | * è·å¾è®¾è®¡èµæå页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return è®¾è®¡èµæå页 |
| | | */ |
| | | PageResult<MesPdDocumentDO> getDocumentPage(MesPdDocumentPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å¾æå®è®¾è®¡é¡¹ç®ä¸çèµæå表 |
| | | * |
| | | * @param projectId 设计项ç®ID |
| | | * @return èµæå表 |
| | | */ |
| | | List<MesPdDocumentDO> getDocumentListByProjectId(Long projectId); |
| | | |
| | | /** |
| | | * å 餿å®è®¾è®¡é¡¹ç®ä¸çææèµæ |
| | | * |
| | | * @param projectId 设计项ç®ID |
| | | */ |
| | | void deleteByProjectId(Long projectId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.document; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.document.vo.MesPdDocumentSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.document.MesPdDocumentMapper; |
| | | import cn.iocoder.yudao.module.mes.service.pd.project.MesPdProjectService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_DOCUMENT_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES è®¾è®¡èµæ Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdDocumentServiceImpl implements MesPdDocumentService { |
| | | |
| | | @Resource |
| | | private MesPdDocumentMapper documentMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesPdProjectService projectService; |
| | | |
| | | @Override |
| | | public Long createDocument(MesPdDocumentSaveReqVO createReqVO) { |
| | | // æ ¡éªè®¾è®¡é¡¹ç®åå¨ |
| | | projectService.validateProjectExists(createReqVO.getProjectId()); |
| | | // æå
¥ |
| | | MesPdDocumentDO document = BeanUtils.toBean(createReqVO, MesPdDocumentDO.class); |
| | | documentMapper.insert(document); |
| | | return document.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateDocument(MesPdDocumentSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | validateDocumentExists(updateReqVO.getId()); |
| | | // æ´æ° |
| | | MesPdDocumentDO updateObj = BeanUtils.toBean(updateReqVO, MesPdDocumentDO.class); |
| | | documentMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteDocument(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateDocumentExists(id); |
| | | // å é¤ |
| | | documentMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdDocumentDO getDocument(Long id) { |
| | | return documentMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdDocumentDO> getDocumentPage(MesPdDocumentPageReqVO pageReqVO) { |
| | | return documentMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdDocumentDO> getDocumentListByProjectId(Long projectId) { |
| | | return documentMapper.selectListByProjectId(projectId); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByProjectId(Long projectId) { |
| | | documentMapper.deleteByProjectId(projectId); |
| | | } |
| | | |
| | | private MesPdDocumentDO validateDocumentExists(Long id) { |
| | | MesPdDocumentDO document = documentMapper.selectById(id); |
| | | if (document == null) { |
| | | throw exception(PD_DOCUMENT_NOT_EXISTS); |
| | | } |
| | | return document; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.documentaudit; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.documentaudit.MesPdDocumentAuditDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * MES èµæå®¡æ ¸ Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesPdDocumentAuditService { |
| | | |
| | | /** |
| | | * åå»ºèµæå®¡æ ¸ |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createDocumentAudit(@Valid MesPdDocumentAuditSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°èµæå®¡æ ¸ |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateDocumentAudit(@Valid MesPdDocumentAuditSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤èµæå®¡æ ¸ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteDocumentAudit(Long id); |
| | | |
| | | /** |
| | | * è·å¾èµæå®¡æ ¸ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return èµæå®¡æ ¸ |
| | | */ |
| | | MesPdDocumentAuditDO getDocumentAudit(Long id); |
| | | |
| | | /** |
| | | * è·å¾èµæå®¡æ ¸å页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return èµæå®¡æ ¸å页 |
| | | */ |
| | | PageResult<MesPdDocumentAuditDO> getDocumentAuditPage(MesPdDocumentAuditPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * è·å¾æå®èµæä¸çå®¡æ ¸å表 |
| | | * |
| | | * @param documentId èµæID |
| | | * @return å®¡æ ¸å表 |
| | | */ |
| | | List<MesPdDocumentAuditDO> getDocumentAuditListByDocumentId(Long documentId); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.documentaudit; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.documentaudit.vo.MesPdDocumentAuditSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.documentaudit.MesPdDocumentAuditDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.documentaudit.MesPdDocumentAuditMapper; |
| | | import cn.iocoder.yudao.module.mes.service.pd.document.MesPdDocumentService; |
| | | import com.mysql.cj.protocol.Security; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.List; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PD_DOCUMENT_AUDIT_NOT_EXISTS; |
| | | |
| | | /** |
| | | * MES èµæå®¡æ ¸ Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdDocumentAuditServiceImpl implements MesPdDocumentAuditService { |
| | | |
| | | @Resource |
| | | private MesPdDocumentAuditMapper documentAuditMapper; |
| | | |
| | | @Resource |
| | | private MesPdDocumentService documentService; |
| | | |
| | | @Override |
| | | public Long createDocumentAudit(MesPdDocumentAuditSaveReqVO createReqVO) { |
| | | // æ ¡éªèµæåå¨ |
| | | documentService.getDocument(createReqVO.getDocumentId()); |
| | | // æå
¥ |
| | | MesPdDocumentAuditDO documentAudit = BeanUtils.toBean(createReqVO, MesPdDocumentAuditDO.class); |
| | | documentAuditMapper.insert(documentAudit); |
| | | return documentAudit.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateDocumentAudit(MesPdDocumentAuditSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | validateDocumentAuditExists(updateReqVO.getId()); |
| | | if (updateReqVO.getAuditStatus() ==1 ) { |
| | | updateReqVO.setReviewer(SecurityFrameworkUtils.getLoginUserId()); |
| | | updateReqVO.setAuditTime(LocalDateTime.now()); |
| | | } |
| | | // æ´æ° |
| | | MesPdDocumentAuditDO updateObj = BeanUtils.toBean(updateReqVO, MesPdDocumentAuditDO.class); |
| | | documentAuditMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteDocumentAudit(Long id) { |
| | | // æ ¡éªåå¨ |
| | | validateDocumentAuditExists(id); |
| | | // å é¤ |
| | | documentAuditMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdDocumentAuditDO getDocumentAudit(Long id) { |
| | | return documentAuditMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdDocumentAuditDO> getDocumentAuditPage(MesPdDocumentAuditPageReqVO pageReqVO) { |
| | | return documentAuditMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdDocumentAuditDO> getDocumentAuditListByDocumentId(Long documentId) { |
| | | return documentAuditMapper.selectListByDocumentId(documentId); |
| | | } |
| | | |
| | | private MesPdDocumentAuditDO validateDocumentAuditExists(Long id) { |
| | | MesPdDocumentAuditDO documentAudit = documentAuditMapper.selectById(id); |
| | | if (documentAudit == null) { |
| | | throw exception(PD_DOCUMENT_AUDIT_NOT_EXISTS); |
| | | } |
| | | return documentAudit; |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.project; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import jakarta.validation.Valid; |
| | | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * MES è®¾è®¡é¡¹ç® Service æ¥å£ |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | public interface MesPdProjectService { |
| | | |
| | | /** |
| | | * åå»ºè®¾è®¡é¡¹ç® |
| | | * |
| | | * @param createReqVO åå»ºä¿¡æ¯ |
| | | * @return ç¼å· |
| | | */ |
| | | Long createProject(@Valid MesPdProjectSaveReqVO createReqVO); |
| | | |
| | | /** |
| | | * æ´æ°è®¾è®¡é¡¹ç® |
| | | * |
| | | * @param updateReqVO æ´æ°ä¿¡æ¯ |
| | | */ |
| | | void updateProject(@Valid MesPdProjectSaveReqVO updateReqVO); |
| | | |
| | | /** |
| | | * å é¤è®¾è®¡é¡¹ç® |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void deleteProject(Long id); |
| | | |
| | | /** |
| | | * æ ¡éªè®¾è®¡é¡¹ç®æ¯å¦åå¨ |
| | | * |
| | | * @param id ç¼å· |
| | | * @return è®¾è®¡é¡¹ç® |
| | | */ |
| | | MesPdProjectDO validateProjectExists(Long id); |
| | | |
| | | /** |
| | | * è·å¾è®¾è®¡é¡¹ç® |
| | | * |
| | | * @param id ç¼å· |
| | | * @return è®¾è®¡é¡¹ç® |
| | | */ |
| | | MesPdProjectDO getProject(Long id); |
| | | |
| | | /** |
| | | * è·å¾è®¾è®¡é¡¹ç®å页 |
| | | * |
| | | * @param pageReqVO å页æ¥è¯¢ |
| | | * @return 设计项ç®å页 |
| | | */ |
| | | PageResult<MesPdProjectDO> getProjectPage(MesPdProjectPageReqVO pageReqVO); |
| | | |
| | | /** |
| | | * åå¸è®¾è®¡é¡¹ç®ï¼å¾
åå¸âå¾
ä¸ä¼ ï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void publishProject(Long id); |
| | | |
| | | /** |
| | | * ä¸ä¼ èµæï¼å¾
ä¸ä¼ âå¾
å®¡æ ¸ï¼ |
| | | * <p> |
| | | * åæ¶èªå¨ä¸ºè¯¥é¡¹ç®ä¸ææèµæåå»ºå®¡æ ¸è®°å½ |
| | | * |
| | | * @param id ç¼å· |
| | | * @param userId å½åç»å½ç¨æ·ID |
| | | */ |
| | | void uploadProject(Long id, Long userId); |
| | | |
| | | /** |
| | | * å®¡æ ¸è®¾è®¡é¡¹ç®ï¼å¾
å®¡æ ¸âå¾
彿¡£ï¼ |
| | | * |
| | | * @param id ç¼å· |
| | | */ |
| | | void auditProject(Long id); |
| | | |
| | | /** |
| | | * 彿¡£è®¾è®¡é¡¹ç®ï¼å¾
彿¡£â已彿¡£ï¼ |
| | | * <p> |
| | | * åæ¶èªå¨åå»ºå½æ¡£å°è´¦è®°å½ |
| | | * |
| | | * @param id ç¼å· |
| | | * @param userId å½åç»å½ç¨æ·ID |
| | | */ |
| | | void archiveProject(Long id, Long userId); |
| | | |
| | | /** |
| | | * æ¹éè·åè®¾è®¡é¡¹ç® Map |
| | | * |
| | | * @param ids ç¼å·éå |
| | | * @return è®¾è®¡é¡¹ç® Map |
| | | */ |
| | | Map<Long, MesPdProjectDO> getProjectMap(Collection<Long> ids); |
| | | |
| | | List<MesPdProjectDO> getProjectByProductCode(String productCode); |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.iocoder.yudao.module.mes.service.pd.project; |
| | | |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.pd.project.vo.MesPdProjectSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.document.MesPdDocumentDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.documentaudit.MesPdDocumentAuditDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.archive.MesPdArchiveDO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.pd.project.MesPdProjectDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.project.MesPdProjectMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.documentaudit.MesPdDocumentAuditMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.pd.archive.MesPdArchiveMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.pd.MesPdProjectStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.pd.document.MesPdDocumentService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; |
| | | import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | | * MES è®¾è®¡é¡¹ç® Service å®ç°ç±» |
| | | * |
| | | * @author èéæºç |
| | | */ |
| | | @Service |
| | | @Validated |
| | | public class MesPdProjectServiceImpl implements MesPdProjectService { |
| | | |
| | | @Resource |
| | | private MesPdProjectMapper projectMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesPdDocumentService documentService; |
| | | |
| | | @Resource |
| | | private MesPdDocumentAuditMapper documentAuditMapper; |
| | | |
| | | @Resource |
| | | private MesPdArchiveMapper archiveMapper; |
| | | |
| | | @Resource |
| | | @Lazy |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createProject(MesPdProjectSaveReqVO createReqVO) { |
| | | // æ ¡éªä»»å¡ç¼ç å¯ä¸ |
| | | validateTaskCodeUnique(null, createReqVO.getTaskCode()); |
| | | // æå
¥ |
| | | MesPdProjectDO project = MesPdProjectDO.builder() |
| | | .taskCode(createReqVO.getTaskCode()) |
| | | .taskName(createReqVO.getTaskName()) |
| | | .productCode(createReqVO.getProductCode()) |
| | | .productName(createReqVO.getProductName()) |
| | | .version(createReqVO.getVersion()) |
| | | .status(MesPdProjectStatusEnum.INITIATE.getStatus()) |
| | | .chiefDesigner(createReqVO.getChiefDesigner()) |
| | | .reviewer(createReqVO.getReviewer()) |
| | | .planFinishTime(createReqVO.getPlanFinishTime()) |
| | | .remark(createReqVO.getRemark()) |
| | | .build(); |
| | | projectMapper.insert(project); |
| | | return project.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updateProject(MesPdProjectSaveReqVO updateReqVO) { |
| | | // æ ¡éªåå¨ |
| | | MesPdProjectDO project = validateProjectExists(updateReqVO.getId()); |
| | | // æ ¡éªç¶æä¸ºå¾
åå¸ |
| | | validateProjectInitiate(project); |
| | | // æ ¡éªä»»å¡ç¼ç å¯ä¸ |
| | | validateTaskCodeUnique(updateReqVO.getId(), updateReqVO.getTaskCode()); |
| | | // æ´æ° |
| | | MesPdProjectDO updateObj = MesPdProjectDO.builder() |
| | | .id(updateReqVO.getId()) |
| | | .taskCode(updateReqVO.getTaskCode()) |
| | | .taskName(updateReqVO.getTaskName()) |
| | | .productCode(updateReqVO.getProductCode()) |
| | | .productName(updateReqVO.getProductName()) |
| | | .version(updateReqVO.getVersion()) |
| | | .chiefDesigner(updateReqVO.getChiefDesigner()) |
| | | .reviewer(updateReqVO.getReviewer()) |
| | | .planFinishTime(updateReqVO.getPlanFinishTime()) |
| | | .remark(updateReqVO.getRemark()) |
| | | .build(); |
| | | projectMapper.updateById(updateObj); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteProject(Long id) { |
| | | // æ ¡éªåå¨ |
| | | MesPdProjectDO project = validateProjectExists(id); |
| | | // æ ¡éªç¶æä¸ºå¾
åå¸ |
| | | validateProjectInitiate(project); |
| | | // å é¤èµæå表 |
| | | documentService.deleteByProjectId(id); |
| | | // å é¤ |
| | | projectMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProjectDO validateProjectExists(Long id) { |
| | | MesPdProjectDO project = projectMapper.selectById(id); |
| | | if (project == null) { |
| | | throw exception(PD_PROJECT_NOT_EXISTS); |
| | | } |
| | | return project; |
| | | } |
| | | |
| | | @Override |
| | | public MesPdProjectDO getProject(Long id) { |
| | | return projectMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesPdProjectDO> getProjectPage(MesPdProjectPageReqVO pageReqVO) { |
| | | return projectMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public void publishProject(Long id) { |
| | | // æ ¡éªåå¨ |
| | | MesPdProjectDO project = validateProjectExists(id); |
| | | // æ ¡éªç¶æä¸ºå¾
åå¸ |
| | | if (!MesPdProjectStatusEnum.INITIATE.getStatus().equals(project.getStatus())) { |
| | | throw exception(PD_PROJECT_NOT_INITIATE_FOR_PUBLISH); |
| | | } |
| | | // æ´æ°ç¶æ |
| | | projectMapper.updateById(MesPdProjectDO.builder() |
| | | .id(id) |
| | | .status(MesPdProjectStatusEnum.PUBLISH.getStatus()) |
| | | .build()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void uploadProject(Long id, Long userId) { |
| | | // æ ¡éªåå¨ |
| | | MesPdProjectDO project = validateProjectExists(id); |
| | | // æ ¡éªç¶æä¸ºå¾
ä¸ä¼ |
| | | if (!MesPdProjectStatusEnum.PUBLISH.getStatus().equals(project.getStatus())) { |
| | | throw exception(PD_PROJECT_NOT_PUBLISH_FOR_UPLOAD); |
| | | } |
| | | // æ´æ°é¡¹ç®ç¶æä¸ºå¾
å®¡æ ¸ |
| | | projectMapper.updateById(MesPdProjectDO.builder() |
| | | .id(id) |
| | | .status(MesPdProjectStatusEnum.UPLOAD.getStatus()) |
| | | .build()); |
| | | // èªå¨ä¸ºè¯¥é¡¹ç®ä¸ææèµæåå»ºå®¡æ ¸è®°å½ |
| | | List<MesPdDocumentDO> documents = documentService.getDocumentListByProjectId(id); |
| | | for (MesPdDocumentDO document : documents) { |
| | | MesPdDocumentAuditDO audit = MesPdDocumentAuditDO.builder() |
| | | .auditNo(generateAuditNo()) |
| | | .documentId(document.getId()) |
| | | .documentName(document.getDocumentName()) |
| | | .documentVersion(document.getDocumentVersion()) |
| | | .reviewer(project.getReviewer()) |
| | | .auditStatus(0) // å¾
å®¡æ ¸ |
| | | .build(); |
| | | documentAuditMapper.insert(audit); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void auditProject(Long id) { |
| | | // æ ¡éªåå¨ |
| | | MesPdProjectDO project = validateProjectExists(id); |
| | | // æ ¡éªç¶æä¸ºå¾
å®¡æ ¸ |
| | | if (!MesPdProjectStatusEnum.UPLOAD.getStatus().equals(project.getStatus())) { |
| | | throw exception(PD_PROJECT_NOT_UPLOAD_FOR_AUDIT); |
| | | } |
| | | // æ ¡éªè¯¥é¡¹ç®ä¸ææèµæå®¡æ ¸è®°å½åå·²å®¡æ ¸ï¼ä¸åå¨å¾
å®¡æ ¸çè®°å½ï¼ |
| | | List<MesPdDocumentDO> documents = documentService.getDocumentListByProjectId(id); |
| | | List<Long> documentIds = documents.stream().map(MesPdDocumentDO::getId).toList(); |
| | | if (documentAuditMapper.existsPendingAuditByDocumentIds(documentIds)) { |
| | | throw exception(PD_PROJECT_AUDIT_NOT_FINISHED); |
| | | } |
| | | // æ´æ°ç¶æ |
| | | projectMapper.updateById(MesPdProjectDO.builder() |
| | | .id(id) |
| | | .status(MesPdProjectStatusEnum.AUDIT.getStatus()) |
| | | .build()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void archiveProject(Long id, Long userId) { |
| | | // æ ¡éªåå¨ |
| | | MesPdProjectDO project = validateProjectExists(id); |
| | | // æ ¡éªç¶æä¸ºå¾
彿¡£ |
| | | if (!MesPdProjectStatusEnum.AUDIT.getStatus().equals(project.getStatus())) { |
| | | throw exception(PD_PROJECT_NOT_AUDIT_FOR_ARCHIVE); |
| | | } |
| | | // æ´æ°é¡¹ç®ç¶æä¸ºå·²å½æ¡£ |
| | | projectMapper.updateById(MesPdProjectDO.builder() |
| | | .id(id) |
| | | .status(MesPdProjectStatusEnum.ARCHIVE.getStatus()) |
| | | .build()); |
| | | // èªå¨åå»ºå½æ¡£å°è´¦è®°å½ |
| | | MesPdArchiveDO archive = MesPdArchiveDO.builder() |
| | | .archiveCode(generateArchiveCode()) |
| | | .projectId(id) |
| | | .archiver(userId) |
| | | .archiveStatus(1) // 已彿¡£ |
| | | .archiveTime(LocalDateTime.now()) |
| | | .build(); |
| | | archiveMapper.insert(archive); |
| | | } |
| | | |
| | | @Override |
| | | public Map<Long, MesPdProjectDO> getProjectMap(Collection<Long> ids) { |
| | | List<MesPdProjectDO> list = projectMapper.selectBatchIds(ids); |
| | | return convertMap(list, MesPdProjectDO::getId); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesPdProjectDO> getProjectByProductCode(String productCode) { |
| | | return projectMapper.selectList(new QueryWrapper<MesPdProjectDO>().lambda().eq(MesPdProjectDO::getProductCode,productCode).eq(MesPdProjectDO::getStatus, MesPdProjectStatusEnum.ARCHIVE.getStatus())); |
| | | } |
| | | |
| | | private void validateProjectInitiate(MesPdProjectDO project) { |
| | | if (!MesPdProjectStatusEnum.INITIATE.getStatus().equals(project.getStatus())) { |
| | | throw exception(PD_PROJECT_NOT_INITIATE); |
| | | } |
| | | } |
| | | |
| | | private void validateTaskCodeUnique(Long id, String taskCode) { |
| | | MesPdProjectDO existing = projectMapper.selectByTaskCode(taskCode); |
| | | if (existing == null) { |
| | | return; |
| | | } |
| | | // 妿 id 为空ï¼è¯´ææ¯æ°å¢ï¼ç¼ç éå¤ |
| | | if (id == null) { |
| | | throw exception(PD_PROJECT_CODE_DUPLICATE); |
| | | } |
| | | // 妿 id ä¸ä¸ºç©ºï¼è¯´ææ¯ä¿®æ¹ï¼ç¼ç éå¤ä¸ä¸æ¯å䏿¡è®°å½ |
| | | if (!existing.getId().equals(id)) { |
| | | throw exception(PD_PROJECT_CODE_DUPLICATE); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * çæå®¡æ ¸åå·ï¼ä½¿ç¨ç¼ç è§åï¼ |
| | | */ |
| | | private String generateAuditNo() { |
| | | return autoCodeRecordService.generateAutoCode(MesMdAutoCodeRuleCodeEnum.PD_DOCUMENT_AUDIT_CODE.getCode()); |
| | | } |
| | | |
| | | /** |
| | | * çæå½æ¡£ç¼å·ï¼ä½¿ç¨ç¼ç è§åï¼ |
| | | */ |
| | | private String generateArchiveCode() { |
| | | return autoCodeRecordService.generateAutoCode(MesMdAutoCodeRuleCodeEnum.PD_ARCHIVE_CODE.getCode()); |
| | | } |
| | | |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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="cn.iocoder.yudao.module.mes.dal.mysql.pd.archive.MesPdArchiveMapper"> |
| | | |
| | | <!-- |
| | | æ project_id åç»å页æ¥è¯¢ï¼æ¯ç»åææ°ä¸æ¡å½æ¡£è®°å½ |
| | | åæ¶å
³è项ç®è¡¨è·å产åç¼ç ã产ååç§° |
| | | åæ¥è¯¢ç»è®¡æ¯ä¸ªé¡¹ç®ä¸ç彿¡£æ°é |
| | | è¿åææ°å½æ¡£ç updaterãupdate_time |
| | | MyBatis-Plus å页æä»¶ä¼èªå¨æ¦æª IPage åæ°å¹¶æ·»å LIMIT |
| | | --> |
| | | <select id="selectPageGroupByProjectId" resultType="cn.iocoder.yudao.module.mes.controller.admin.pd.archive.vo.MesPdArchiveGroupRespVO"> |
| | | SELECT a.*, p.product_code, p.product_name,p.task_code,p.task_name,su.nickname as archiver_nickname, |
| | | (SELECT COUNT(*) FROM mes_pd_archive cnt WHERE cnt.project_id = a.project_id AND cnt.deleted = 0) AS archive_count |
| | | FROM mes_pd_archive a |
| | | INNER JOIN ( |
| | | SELECT MAX(sub.id) AS id |
| | | FROM mes_pd_archive sub |
| | | WHERE sub.deleted = 0 |
| | | <if test="req.archiveStatus != null"> |
| | | AND sub.archive_status = #{req.archiveStatus} |
| | | </if> |
| | | <if test="req.productCode != null and req.productCode != ''"> |
| | | AND EXISTS ( |
| | | SELECT 1 FROM mes_pd_project pp |
| | | WHERE pp.id = sub.project_id AND pp.deleted = 0 |
| | | AND pp.product_code LIKE CONCAT('%', #{req.productCode}, '%') |
| | | ) |
| | | </if> |
| | | <if test="req.productName != null and req.productName != ''"> |
| | | AND EXISTS ( |
| | | SELECT 1 FROM mes_pd_project pp |
| | | WHERE pp.id = sub.project_id AND pp.deleted = 0 |
| | | AND pp.product_name LIKE CONCAT('%', #{req.productName}, '%') |
| | | ) |
| | | </if> |
| | | GROUP BY sub.project_id |
| | | ) g ON a.id = g.id |
| | | LEFT JOIN mes_pd_project p ON a.project_id = p.id AND p.deleted = 0 |
| | | left join system_users su on su.id = a.archiver |
| | | <where> |
| | | <if test="req.archiveCode != null and req.archiveCode != ''"> |
| | | AND a.archive_code LIKE CONCAT('%', #{req.archiveCode}, '%') |
| | | </if> |
| | | </where> |
| | | ORDER BY a.update_time DESC |
| | | </select> |
| | | |
| | | </mapper> |