diff --git a/admin/src/api/pmdailymenu.js b/admin/src/api/pmdailymenu.js index 840f482..459d9ef 100644 --- a/admin/src/api/pmdailymenu.js +++ b/admin/src/api/pmdailymenu.js @@ -48,6 +48,18 @@ export function pmdailymenuDeleteApi(ids) { }) } +/** + * pmdailymenu批量创建 + * @param menus + */ +export function pmdailymenuBatchCreateApi(menus) { + return request({ + url: `autogencode/pmdailymenu/batchSave`, + method: 'POST', + data: menus + }) +} + /** * pmdailymenu列表 diff --git a/admin/src/views/pm/complaint/suggestion/index.vue b/admin/src/views/pm/complaint/suggestion/index.vue index 563987a..2f9869b 100644 --- a/admin/src/views/pm/complaint/suggestion/index.vue +++ b/admin/src/views/pm/complaint/suggestion/index.vue @@ -63,7 +63,7 @@ prop="ownerName" header-align="center" align="center" - label="业主/租户"> + label="名称"> - - - + + + + + + + + + + label="所属部门"> @@ -364,6 +365,25 @@ }) }) }, + // 处理投诉/建议,将状态修改为已处理(3) + handleComplaint (id) { + this.$confirm('确定要将该投诉/建议标记为已处理吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 调用更新状态API + api.pmcomplaintsuggestionUpdateApi({ + id: id, + status: '3' + }).then(res => { + this.$message.success('处理成功') + this.getDataList() + }).catch(() => { + this.$message.error('处理失败') + }) + }).catch(() => {}) + }, } } diff --git a/admin/src/views/pm/complaint/suggestion/pmcomplaintsuggestion-add-and-update.vue b/admin/src/views/pm/complaint/suggestion/pmcomplaintsuggestion-add-and-update.vue index e2d2ee3..d1a0c47 100644 --- a/admin/src/views/pm/complaint/suggestion/pmcomplaintsuggestion-add-and-update.vue +++ b/admin/src/views/pm/complaint/suggestion/pmcomplaintsuggestion-add-and-update.vue @@ -7,7 +7,7 @@ width="80%"> - + @@ -23,7 +23,7 @@ - + - + @@ -87,8 +87,8 @@ - - + + @@ -175,13 +175,26 @@ - + - + + + + + + + + + @@ -218,12 +231,16 @@ tenantList: [], houseList: [], adminList: [], // 管理员列表 - ownerHouseList: [], // 所选业主/租户的房屋列表 - complaintFiles: [], // 附件文件列表 + ownerHouseList: [], // 所选名称的房屋列表 + beforeProcessFiles: [], // 问题凭证文件列表 + afterProcessFiles: [], // 处理凭证文件列表 + canUploadBeforeProcess: true, // 是否可以上传问题凭证 + canUploadAfterProcess: false, // 是否可以上传处理凭证 + showAfterProcess: false, // 是否显示处理凭证上传组件 dataForm: { id: 0, csType: '' , - status: '0' , + status: '1' , csContent: '' , submitChannel: '' , submitTime: '' , @@ -238,7 +255,8 @@ complainedHouseId: '', ownerCompany: '', ownerCompanyName: '', - files: [] + beforeProcessFiles: [], // 问题凭证 + afterProcessFiles: [] // 处理凭证 }, dataRule: { csType: [ @@ -300,7 +318,7 @@ // 处理业主类型变化 handleOwnerTypeChange(ownerType) { - // 清空业主/租户ID和房屋ID + // 清空名称ID和房屋ID this.dataForm.ownerId = '' this.dataForm.houseId = '' this.dataForm.houseOwnerId = '' @@ -322,7 +340,7 @@ // 清空房屋选择,让用户手动选择 this.dataForm.houseId = '' this.dataForm.houseOwnerId = '' - // 设置业主所属部门 + // 设置所属部门 const owner = this.ownerList.find(item => item.id === ownerId) if (owner && owner.deptId) { this.dataForm.ownerCompany = owner.deptId @@ -416,13 +434,59 @@ this.dataForm.houseOwnerId = '' } }, - // 更新附件文件列表 - updateComplaintFiles(files) { - this.complaintFiles = files - // 将文件保存到dataForm.files中 + // 更新问题凭证文件列表 + updateBeforeProcessFiles(files) { + this.beforeProcessFiles = files + // 将文件保存到dataForm.beforeProcessFiles中 + if (files && files.length > 0) { + // 将FileUploadVO返回的文件格式转换为后端SystemAttachment需要的格式 + this.dataForm.beforeProcessFiles = files.map(file => { + // 处理文件路径,确保符合后端要求的格式 + let attDir = file.attDir || file.attachFileUrl || '' + // 如果路径以/file/public/开头,去掉这个前缀,因为后端存储格式不需要 + if (attDir.startsWith('/file/public/')) { + attDir = attDir.replace('/file/public/', '') + } else if (attDir.startsWith('/file/')) { + attDir = attDir.replace('/file/', '') + } + + return { + // 严格按照SystemAttachment的字段要求设置 + attId: file.id || file.attId || '', // 确保转换为字符串 + name: file.name || file.oldName || '', // 附件名称 + attDir: attDir, // 附件路径 + attSize: file.attSize || '', // 附件大小 + attType: 'before_process', // 问题凭证类型 + // 保留原有字段以保持兼容性 + fileName: file.name || file.oldName || '', + filePath: attDir, + url: attDir, + createTime: null, + createdBy: null, + createTimeStr: null, + delFlag: '0', + updateBy: null, + updateTime: null, + i18nCode: '', + i18nLanguage: '', + originalFileName: file.name || file.oldName || '', + position: 0, + remark: file.remark || '', + sort: 0, + status: '' + } + }) + } else { + this.dataForm.beforeProcessFiles = [] + } + }, + // 更新处理凭证文件列表 + updateAfterProcessFiles(files) { + this.afterProcessFiles = files + // 将文件保存到dataForm.afterProcessFiles中 if (files && files.length > 0) { // 将FileUploadVO返回的文件格式转换为后端SystemAttachment需要的格式 - this.dataForm.files = files.map(file => { + this.dataForm.afterProcessFiles = files.map(file => { // 处理文件路径,确保符合后端要求的格式 let attDir = file.attDir || file.attachFileUrl || '' // 如果路径以/file/public/开头,去掉这个前缀,因为后端存储格式不需要 @@ -438,7 +502,7 @@ name: file.name || file.oldName || '', // 附件名称 attDir: attDir, // 附件路径 attSize: file.attSize || '', // 附件大小 - attType: file.attType || '', // 附件类型 + attType: 'after_process', // 处理凭证类型 // 保留原有字段以保持兼容性 fileName: file.name || file.oldName || '', filePath: attDir, @@ -459,13 +523,14 @@ } }) } else { - this.dataForm.files = [] + this.dataForm.afterProcessFiles = [] } }, init (id) { // 初始化表单验证规则 this.dataForm.id = id || 0 this.visible = true - this.complaintFiles = [] // 清空文件列表 + this.beforeProcessFiles = [] // 清空问题凭证文件列表 + this.afterProcessFiles = [] // 清空处理凭证文件列表 this.$nextTick(function() { this.$refs['dataForm'].resetFields() if (this.dataForm.id) { @@ -479,9 +544,11 @@ data.handlerDate = new Date(data.handlerDate) } this.dataForm = data; - // 设置文件列表 - if (data.files && data.files.length > 0) { - this.complaintFiles = data.files.map(file => { + // 设置文件上传权限 + this.setFileUploadPermissions(data.status); + // 设置问题凭证文件列表 + if (data.beforeProcessFiles && data.beforeProcessFiles.length > 0) { + this.beforeProcessFiles = data.beforeProcessFiles.map(file => { return { id: file.attId, attId: file.attId, @@ -494,7 +561,24 @@ } }) } else { - this.complaintFiles = [] + this.beforeProcessFiles = [] + } + // 设置处理凭证文件列表 + if (data.afterProcessFiles && data.afterProcessFiles.length > 0) { + this.afterProcessFiles = data.afterProcessFiles.map(file => { + return { + id: file.attId, + attId: file.attId, + name: file.name || file.fileName || file.originalFileName, + oldName: file.name || file.fileName || file.originalFileName, + attDir: file.attDir || file.filePath || file.url, + attachFileUrl: file.attDir || file.filePath || file.url, + attSize: file.attSize, + attType: file.attType + } + }) + } else { + this.afterProcessFiles = [] } // 保存房屋ID const houseId = data.houseId; @@ -508,9 +592,36 @@ }); }); }.bind(this)) + } else { + // 新增时的默认权限 + this.setFileUploadPermissions('1'); // 默认为未处理状态 } }.bind(this)) }, + // 设置文件上传权限 + setFileUploadPermissions(status) { + switch (status) { + case '1': // 未处理 + this.canUploadBeforeProcess = true; + this.canUploadAfterProcess = false; + this.showAfterProcess = false; + break; + case '2': // 处理中 + this.canUploadBeforeProcess = false; + this.canUploadAfterProcess = true; + this.showAfterProcess = true; + break; + case '3': // 已处理 + this.canUploadBeforeProcess = false; + this.canUploadAfterProcess = true; + this.showAfterProcess = true; + break; + default: + this.canUploadBeforeProcess = true; + this.canUploadAfterProcess = false; + this.showAfterProcess = false; + } + }, // 表单数据提交 dataSubmit () { this.$refs['dataForm'].validate((valid) => { diff --git a/admin/src/views/pm/daily/menu/pmdailymenu-add-and-update.vue b/admin/src/views/pm/daily/menu/pmdailymenu-add-and-update.vue index 7222e90..af8002e 100644 --- a/admin/src/views/pm/daily/menu/pmdailymenu-add-and-update.vue +++ b/admin/src/views/pm/daily/menu/pmdailymenu-add-and-update.vue @@ -1,40 +1,40 @@ diff --git a/admin/src/views/pm/maintenance/dispatch/pmmaintenancedispatch-add-and-update.vue b/admin/src/views/pm/maintenance/dispatch/pmmaintenancedispatch-add-and-update.vue index ec1c6ff..52b2446 100644 --- a/admin/src/views/pm/maintenance/dispatch/pmmaintenancedispatch-add-and-update.vue +++ b/admin/src/views/pm/maintenance/dispatch/pmmaintenancedispatch-add-and-update.vue @@ -4,30 +4,26 @@ :title="!dataForm.id ? '添加' : '修改'" :close-on-click-modal="false" :append-to-body="true" - :visible.sync="visible" width="800px"> + :visible.sync="visible" width="1000px"> - + - + - + - + - - - - - + - + + + + + - - - - - + - + - - + + - + - + - - - - - + - + - + + + + + - + - - - - - + - + - + @@ -110,7 +102,7 @@ - + @@ -119,7 +111,7 @@ - + @@ -131,7 +123,7 @@ - + @@ -140,15 +132,8 @@ - - - - - - - - - + + 取消 @@ -200,9 +185,8 @@ export default { consumables: '' , costAmount: '' , completePhoto: '' , - ownerConfirm: '' , - status: '' , - remark: '' , + ownerConfirm: '否' , + status: '0' , files: [] }, @@ -408,6 +392,18 @@ export default { // 根据部门ID过滤管理员列表 this.loadAdminList(deptId) }, + // 处理执行人选择,自动带出联系方式 + handleExecutorChange(executorId) { + // 在管理员列表中查找对应的执行人 + const executor = this.adminList.find(item => item.id === executorId) + if (executor) { + // 设置联系方式 + this.dataForm.phone = executor.phone || '' + } else { + // 清空联系方式 + this.dataForm.phone = '' + } + }, // 加载管理员列表数据 loadAdminList(deptId = null) { diff --git a/admin/src/views/pm/maintenance/order/DispatchList.vue b/admin/src/views/pm/maintenance/order/DispatchList.vue index 1cce9a2..84a4ff8 100644 --- a/admin/src/views/pm/maintenance/order/DispatchList.vue +++ b/admin/src/views/pm/maintenance/order/DispatchList.vue @@ -24,7 +24,7 @@ @@ -33,9 +33,11 @@ - + @@ -190,6 +192,42 @@ export default { currentChangeHandle(val) { this.pageIndex = val this.getDataList() + }, + // 业主确认 + ownerConfirm(id) { + this.$confirm('确定要进行业主确认吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + dispatchApi.pmmaintenancedispatchUpdateApi({ + id: id, + ownerConfirm: '是' + }).then(() => { + this.$message.success('业主确认成功') + this.getDataList() + }).catch(() => { + this.$message.error('业主确认失败') + }) + }).catch(() => {}) + }, + // 设置为已处理 + setToProcessed(id) { + this.$confirm('确定要将状态改为已处理吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + dispatchApi.pmmaintenancedispatchUpdateApi({ + id: id, + status: '2' + }).then(() => { + this.$message.success('状态修改成功') + this.getDataList() + }).catch(() => { + this.$message.error('状态修改失败') + }) + }).catch(() => {}) } } } diff --git a/admin/src/views/pm/maintenance/order/index.vue b/admin/src/views/pm/maintenance/order/index.vue index 396b1e0..c7e75ce 100644 --- a/admin/src/views/pm/maintenance/order/index.vue +++ b/admin/src/views/pm/maintenance/order/index.vue @@ -77,7 +77,7 @@ prop="ownerName" header-align="center" align="center" - label="业主/租户"> + label="名称"> {{ '修改' }} {{ '办结' }} + {{ '撤销' }} 删除 @@ -375,6 +376,28 @@ import DictTag from '@/components/DictTag' this.$message.info('已取消办结') }) }, + // 撤销办结订单 + revokeOrder (id) { + this.$confirm('确定要撤销该订单吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + // 调用更新状态的API + api.pmmaintenanceorderUpdateStatusAndRemarkApi({ + id: id, + status: '0', // 0是待处理状态 + remark: '' + }).then(res => { + this.$message.success('撤销成功') + this.getDataList() + }).catch(() => { + this.$message.error('撤销失败') + }) + }).catch(() => { + this.$message.info('已取消撤销') + }) + }, } } diff --git a/admin/src/views/pm/maintenance/order/pmmaintenanceorder-add-and-update.vue b/admin/src/views/pm/maintenance/order/pmmaintenanceorder-add-and-update.vue index 9e7d535..57d4bfc 100644 --- a/admin/src/views/pm/maintenance/order/pmmaintenanceorder-add-and-update.vue +++ b/admin/src/views/pm/maintenance/order/pmmaintenanceorder-add-and-update.vue @@ -21,7 +21,7 @@ - + - + - + - + + + + + + + + + @@ -224,9 +237,13 @@ export default { ownerList: [], tenantList: [], houseList: [], - ownerHouseList: [], // 所选业主/租户的房屋列表 + ownerHouseList: [], // 所选名称的房屋列表 faultPhotoFiles: [], // 故障照片文件列表 + afterProcessFiles: [], // 修复凭证文件列表 dispatchRecords: [], // 报修派单记录列表 + canUploadFaultPhoto: true, // 是否可以上传故障照片 + canUploadAfterProcess: false, // 是否可以上传修复凭证 + showAfterProcess: false, // 是否显示修复凭证上传组件 dataForm: { ownerType: '', ownerId: '', @@ -239,9 +256,10 @@ export default { reportChannel: '', reportTime: '', urgencyLevel: '', - status: '', + status: '0', remark: '', - files: [] + files: [], // 故障照片文件 + afterProcessFiles: [] // 修复凭证文件 }, dataRule: { ownerType: [ @@ -289,7 +307,7 @@ export default { // 处理业主类型变化 handleOwnerTypeChange(ownerType) { - // 清空业主/租户ID和房屋ID + // 清空名称ID和房屋ID this.dataForm.ownerId = '' this.dataForm.houseId = '' this.dataForm.houseOwnerId = '' @@ -384,6 +402,26 @@ export default { this.dataForm.houseOwnerId = '' } }, + // 设置文件上传权限 + setFileUploadPermissions(status) { + switch (status) { + case '0': // 待处理 + case '1': // 处理中 + this.canUploadFaultPhoto = true; + this.canUploadAfterProcess = false; + this.showAfterProcess = false; + break; + case '99': // 已办结 + this.canUploadFaultPhoto = false; + this.canUploadAfterProcess = true; + this.showAfterProcess = true; + break; + default: + this.canUploadFaultPhoto = true; + this.canUploadAfterProcess = false; + this.showAfterProcess = false; + } + }, // 更新故障照片文件列表 updateFaultPhotoFiles(files) { this.faultPhotoFiles = files @@ -406,7 +444,7 @@ export default { name: file.name || file.oldName || '', // 附件名称 attDir: attDir, // 附件路径 attSize: file.attSize || '', // 附件大小 - attType: file.attType || '', // 附件类型 + attType: 'fault_photo', // 故障照片类型 // 保留原有字段以保持兼容性 fileName: file.name || file.oldName || '', filePath: attDir, @@ -430,6 +468,52 @@ export default { this.dataForm.files = [] } }, + // 更新修复凭证文件列表 + updateAfterProcessFiles(files) { + this.afterProcessFiles = files + // 将文件保存到dataForm.afterProcessFiles中 + if (files && files.length > 0) { + // 将FileUploadVO返回的文件格式转换为后端SystemAttachment需要的格式 + this.dataForm.afterProcessFiles = files.map(file => { + // 处理文件路径,确保符合后端要求的格式 + let attDir = file.attDir || file.attachFileUrl || '' + // 如果路径以/file/public/开头,去掉这个前缀,因为后端存储格式不需要 + if (attDir.startsWith('/file/public/')) { + attDir = attDir.replace('/file/public/', '') + } else if (attDir.startsWith('/file/')) { + attDir = attDir.replace('/file/', '') + } + + return { + // 严格按照SystemAttachment的字段要求设置 + attId: file.id || file.attId || '', // 确保转换为字符串 + name: file.name || file.oldName || '', // 附件名称 + attDir: attDir, // 附件路径 + attSize: file.attSize || '', // 附件大小 + attType: 'repair_photo', // 修复凭证类型 + // 保留原有字段以保持兼容性 + fileName: file.name || file.oldName || '', + filePath: attDir, + url: attDir, + createTime: null, + createdBy: null, + createTimeStr: null, + delFlag: '0', + updateBy: null, + updateTime: null, + i18nCode: '', + i18nLanguage: '', + originalFileName: file.name || file.oldName || '', + position: 0, + remark: file.remark || '', + sort: 0, + status: '' + } + }) + } else { + this.dataForm.afterProcessFiles = [] + } + }, init(id) { // 初始化表单验证规则 this.dataForm.id = id || 0 this.visible = true @@ -488,40 +572,57 @@ export default { // 重新设置房屋ID this.$nextTick(() => { // 先设置所有表单字段,确保即使详情中没有的字段也能正确设置 - this.dataForm = { - ...this.dataForm, - id: orderDetail.id, - ownerType: orderDetail.ownerType || '', - ownerId: orderDetail.ownerId || '', - houseId: houseId, - houseOwnerId: orderDetail.houseOwnerId || '', - orderNo: orderDetail.orderNo || '', - faultType: orderDetail.faultType || '', - faultDesc: orderDetail.faultDesc || '', - faultPhoto: orderDetail.faultPhoto || null, - reportChannel: orderDetail.reportChannel || '', - reportTime: orderDetail.reportTime || '', - urgencyLevel: orderDetail.urgencyLevel || '', - status: orderDetail.status || '', - remark: orderDetail.remark || '', - files: orderDetail.files || [] - }; - // 触发房屋选择变化,设置房屋业主ID - this.handleHouseChange(houseId); - // 处理故障照片文件列表 - if (orderDetail.files && orderDetail.files.length > 0) { - // 转换files为FileUploadVO需要的格式 - this.faultPhotoFiles = orderDetail.files.map((file, index) => ({ - attachFileUrl: file.attDir || file.filePath || file.url || '', - attDir: file.attDir || file.filePath || file.url || '', - name: file.name || file.fileName || '', - oldName: file.name || file.fileName || '', - attId: file.attId || '', - uid: file.id || file.fileId || index + new Date().getTime() - })) - } else { - this.faultPhotoFiles = [] - } + this.dataForm = { + ...this.dataForm, + id: orderDetail.id, + ownerType: orderDetail.ownerType || '', + ownerId: orderDetail.ownerId || '', + houseId: houseId, + houseOwnerId: orderDetail.houseOwnerId || '', + orderNo: orderDetail.orderNo || '', + faultType: orderDetail.faultType || '', + faultDesc: orderDetail.faultDesc || '', + faultPhoto: orderDetail.faultPhoto || null, + reportChannel: orderDetail.reportChannel || '', + reportTime: orderDetail.reportTime || '', + urgencyLevel: orderDetail.urgencyLevel || '', + status: orderDetail.status || '', + remark: orderDetail.remark || '', + files: orderDetail.files || [], + afterProcessFiles: orderDetail.afterProcessFiles || [] + }; + // 触发房屋选择变化,设置房屋业主ID + this.handleHouseChange(houseId); + // 设置文件上传权限 + this.setFileUploadPermissions(orderDetail.status || '0'); + // 处理故障照片文件列表 + if (orderDetail.files && orderDetail.files.length > 0) { + // 转换files为FileUploadVO需要的格式 + this.faultPhotoFiles = orderDetail.files.map((file, index) => ({ + attachFileUrl: file.attDir || file.filePath || file.url || '', + attDir: file.attDir || file.filePath || file.url || '', + name: file.name || file.fileName || '', + oldName: file.name || file.fileName || '', + attId: file.attId || '', + uid: file.id || file.fileId || index + new Date().getTime() + })) + } else { + this.faultPhotoFiles = [] + } + // 处理修复凭证文件列表 + if (orderDetail.afterProcessFiles && orderDetail.afterProcessFiles.length > 0) { + // 转换afterProcessFiles为FileUploadVO需要的格式 + this.afterProcessFiles = orderDetail.afterProcessFiles.map((file, index) => ({ + attachFileUrl: file.attDir || file.filePath || file.url || '', + attDir: file.attDir || file.filePath || file.url || '', + name: file.name || file.fileName || '', + oldName: file.name || file.fileName || '', + attId: file.attId || '', + uid: file.id || file.fileId || index + new Date().getTime() + })) + } else { + this.afterProcessFiles = [] + } // 获取该订单的报修派单记录 this.getDispatchRecords() }); @@ -530,9 +631,13 @@ export default { }); }.bind(this)) } else { - // 新增时清空故障照片文件列表 + // 新增时设置默认文件上传权限 + this.setFileUploadPermissions('0'); // 默认为待处理状态 + // 新增时清空故障照片和修复照片文件列表 this.faultPhotoFiles = [] + this.afterProcessFiles = [] this.dataForm.files = [] + this.dataForm.afterProcessFiles = [] // 新增时清空报修派单记录 this.dispatchRecords = [] // 新增时设置默认报修时间为当前时间 diff --git a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmComplaintSuggestionController.java b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmComplaintSuggestionController.java index 1b1f95c..17c9c2a 100644 --- a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmComplaintSuggestionController.java +++ b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmComplaintSuggestionController.java @@ -317,6 +317,9 @@ public class PmComplaintSuggestionController { item.setOwnerDeptName(dept.getDeptName()); } } + + // 设置文件列表 + setFile(item); } CommonPage page = CommonPage.restPage(list); @@ -564,7 +567,7 @@ public class PmComplaintSuggestionController { if (pmComplaintSuggestionService.save(pmComplaintSuggestion)) { // 处理文件 - if (pmComplaintSuggestion.getFiles() != null) { + if (pmComplaintSuggestion.getBeforeProcessFiles() != null || pmComplaintSuggestion.getAfterProcessFiles() != null) { updateFile(pmComplaintSuggestion); } return CommonResult.success(); @@ -579,7 +582,7 @@ public class PmComplaintSuggestionController { public CommonResult update(@RequestBody PmComplaintSuggestion pmComplaintSuggestion){ if (pmComplaintSuggestionService.updateById(pmComplaintSuggestion)) { // 处理文件 - if (pmComplaintSuggestion.getFiles() != null) { + if (pmComplaintSuggestion.getBeforeProcessFiles() != null || pmComplaintSuggestion.getAfterProcessFiles() != null) { updateFile(pmComplaintSuggestion); } return CommonResult.success(); @@ -600,24 +603,56 @@ public class PmComplaintSuggestionController { } private void updateFile(PmComplaintSuggestion pmComplaintSuggestion) { - Long newId = System.currentTimeMillis() + new Random().nextInt(1000); - List files = pmComplaintSuggestion.getFiles(); - if (files != null) { - for (SystemAttachment attachment : files) { - attachment.setFileId(String.valueOf(newId)); + // 生成统一的文件ID + Long fileId = pmComplaintSuggestion.getFileId(); + if (fileId == null) { + fileId = System.currentTimeMillis() + new Random().nextInt(1000); + pmComplaintSuggestion.setFileId(fileId); + } + + // 处理问题凭证文件 + if (pmComplaintSuggestion.getBeforeProcessFiles() != null && !pmComplaintSuggestion.getBeforeProcessFiles().isEmpty()) { + for (SystemAttachment attachment : pmComplaintSuggestion.getBeforeProcessFiles()) { + attachment.setFileId(String.valueOf(fileId)); + attachment.setAttType("before_process"); // 问题凭证类型 + } + systemAttachmentService.saveOrUpdateBatch(pmComplaintSuggestion.getBeforeProcessFiles()); + } + + // 处理处理凭证文件 + if (pmComplaintSuggestion.getAfterProcessFiles() != null && !pmComplaintSuggestion.getAfterProcessFiles().isEmpty()) { + for (SystemAttachment attachment : pmComplaintSuggestion.getAfterProcessFiles()) { + attachment.setFileId(String.valueOf(fileId)); + attachment.setAttType("after_process"); // 处理凭证类型 } - systemAttachmentService.updateBatchById(files); - pmComplaintSuggestion.setFileId(newId); + systemAttachmentService.saveOrUpdateBatch(pmComplaintSuggestion.getAfterProcessFiles()); + } + + // 更新文件ID + if (pmComplaintSuggestion.getId() != null) { pmComplaintSuggestionService.updateById(pmComplaintSuggestion); } } private void setFile(PmComplaintSuggestion pmComplaintSuggestion) { + // 初始化文件列表 + pmComplaintSuggestion.setBeforeProcessFiles(new java.util.ArrayList<>()); + pmComplaintSuggestion.setAfterProcessFiles(new java.util.ArrayList<>()); + + // 根据投诉建议ID查询所有相关文件 Long fileId = pmComplaintSuggestion.getFileId(); if (fileId != null) { - List list = systemAttachmentService.list(new LambdaQueryWrapper() + List allFiles = systemAttachmentService.list(new LambdaQueryWrapper() .eq(SystemAttachment::getFileId, fileId)); - pmComplaintSuggestion.setFiles(list); + + // 根据attType区分问题凭证和处理凭证 + for (SystemAttachment attachment : allFiles) { + if ("before_process".equals(attachment.getAttType())) { + pmComplaintSuggestion.getBeforeProcessFiles().add(attachment); + } else if ("after_process".equals(attachment.getAttType())) { + pmComplaintSuggestion.getAfterProcessFiles().add(attachment); + } + } } } diff --git a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmDailyMenuController.java b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmDailyMenuController.java index 79aface..8063d74 100644 --- a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmDailyMenuController.java +++ b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmDailyMenuController.java @@ -206,4 +206,29 @@ public class PmDailyMenuController { return CommonResult.failed(); } -} + /** + * 批量创建菜单 + */ + @RequestMapping(value = "/batchSave", method = RequestMethod.POST) + public CommonResult batchSave(@RequestBody List menus){ + try { + for (PmDailyMenu menu : menus) { + // 保存菜单 + pmDailyMenuService.save(menu); + + // 保存菜单明细 + if (menu.getPmDailyMenuDtls() != null && !menu.getPmDailyMenuDtls().isEmpty()) { + for (PmDailyMenuDtl dtl : menu.getPmDailyMenuDtls()) { + dtl.setMenuId(menu.getId()); + pmDailyMenuDtlService.save(dtl); + } + } + } + return CommonResult.success(); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("批量创建失败"); + } + } + +} diff --git a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmMaintenanceOrderController.java b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmMaintenanceOrderController.java index 919a7a2..54ec869 100644 --- a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmMaintenanceOrderController.java +++ b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/controller/PmMaintenanceOrderController.java @@ -9,9 +9,17 @@ import java.util.HashMap; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zbkj.common.model.system.SysDept; import com.zbkj.common.request.PageParamRequest; import com.zbkj.common.response.CommonResult; import com.zbkj.common.page.CommonPage; +import com.zbkj.common.utils.SecurityUtil; +import com.zbkj.common.vo.LoginUserVo; +import com.zbkj.service.service.SysDeptService; +import com.zbkj.service.service.SystemAdminService; +import com.zbkj.service.service.UserService; +import com.zbkj.common.model.user.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -34,6 +42,12 @@ import com.zbkj.modules.autogencode.entity.PmHouse; import com.zbkj.modules.autogencode.service.PmHouseService; import com.zbkj.modules.autogencode.entity.PmTenant; import com.zbkj.modules.autogencode.service.PmTenantService; +import com.zbkj.modules.autogencode.entity.PmOwnerHouseRel; +import com.zbkj.modules.autogencode.service.PmOwnerHouseRelService; +import com.zbkj.modules.autogencode.entity.PmTenantHouse; +import com.zbkj.modules.autogencode.service.PmTenantHouseService; +import com.zbkj.modules.autogencode.entity.PmTenantHouseRel; +import com.zbkj.modules.autogencode.service.PmTenantHouseRelService; @@ -61,7 +75,16 @@ public class PmMaintenanceOrderController { @Autowired private PmTenantService pmTenantService; - + @Autowired + private UserService userService; + @Autowired + private PmOwnerHouseRelService pmOwnerHouseRelService; + @Autowired + private PmTenantHouseService pmTenantHouseService; + @Autowired + private PmTenantHouseRelService pmTenantHouseRelService; + @Autowired + private SysDeptService sysDeptService; /** @@ -338,11 +361,24 @@ public class PmMaintenanceOrderController { } private void setFile(PmMaintenanceOrder pmMaintenanceOrder) { + // 初始化文件列表 + pmMaintenanceOrder.setFiles(new ArrayList<>()); + pmMaintenanceOrder.setAfterProcessFiles(new ArrayList<>()); + + // 根据维修单ID查询所有相关文件 Long faultPhoto = pmMaintenanceOrder.getFaultPhoto(); if (faultPhoto != null) { - List list = systemAttachmentService.list(new LambdaQueryWrapper() + List allFiles = systemAttachmentService.list(new LambdaQueryWrapper() .eq(SystemAttachment::getFileId, faultPhoto)); - pmMaintenanceOrder.setFiles(list); + + // 根据attType区分故障照片和修复凭证 + for (SystemAttachment attachment : allFiles) { + if ("fault_photo".equals(attachment.getAttType())) { + pmMaintenanceOrder.getFiles().add(attachment); + } else if ("repair_photo".equals(attachment.getAttType())) { + pmMaintenanceOrder.getAfterProcessFiles().add(attachment); + } + } } } @@ -360,9 +396,95 @@ public class PmMaintenanceOrderController { */ @RequestMapping(value = "/save", method = RequestMethod.POST) public CommonResult save(@RequestBody PmMaintenanceOrder pmMaintenanceOrder){ + // 获取当前用户信息(如果没有通过 uid 设置 create_by) + Long currentUserId = null; + if (pmMaintenanceOrder.getCreateBy() == null) { + LoginUserVo loginUserVo = SecurityUtil.getLoginUserVo(); + if (loginUserVo != null && loginUserVo.getUser() != null) { + // 自动填写create_by + currentUserId = Long.valueOf(loginUserVo.getUser().getId()); + pmMaintenanceOrder.setCreateBy(currentUserId); + } + } else { + currentUserId = pmMaintenanceOrder.getCreateBy(); + } + + // 如果有传uid,根据eb_user中的字段查询对应的业主、租户、部门 + if (pmMaintenanceOrder.getUid() != null) { + User user = userService.getOne(Wrappers.lambdaQuery() + .eq(User::getUid, pmMaintenanceOrder.getUid())); + + if (user != null) { + // 根据dept_id设置所属公司 + if (pmMaintenanceOrder.getCreateDept() == null && user.getDeptId() != null) { + pmMaintenanceOrder.setCreateDept(user.getDeptId()); + } + + // 根据owner_tenant_id设置业主/租户ID和类型 + if (pmMaintenanceOrder.getOwnerId() == null && user.getOwnerTenantId() != null) { + // 根据staff_type区分业主和租户 + if ("1".equals(user.getStaffType())) { + // 业主类型 + pmMaintenanceOrder.setOwnerId(user.getOwnerTenantId()); + pmMaintenanceOrder.setOwnerType("1"); // 业主类型 + } else if ("2".equals(user.getStaffType())) { + // 租户类型 + pmMaintenanceOrder.setOwnerId(user.getOwnerTenantId()); + pmMaintenanceOrder.setOwnerType("2"); // 租户类型 + } else { + // 如果staff_type未设置,回退到原来的查询方式 + // 查询是否为业主 + PmOwner owner = pmOwnerService.getById(user.getOwnerTenantId()); + if (owner != null) { + pmMaintenanceOrder.setOwnerId(owner.getId()); + pmMaintenanceOrder.setOwnerType("1"); // 业主类型 + } else { + // 查询是否为租户 + PmTenant tenant = pmTenantService.getById(user.getOwnerTenantId()); + if (tenant != null) { + pmMaintenanceOrder.setOwnerId(tenant.getId()); + pmMaintenanceOrder.setOwnerType("2"); // 租户类型 + } + } + } + } + + // 根据业主/租户ID查询房屋 + if (pmMaintenanceOrder.getHouseId() == null && pmMaintenanceOrder.getOwnerId() != null) { + if ("1".equals(pmMaintenanceOrder.getOwnerType())) { + // 查询业主的房屋 + List ownerHouseRels = pmOwnerHouseRelService.list(Wrappers.lambdaQuery() + .eq(PmOwnerHouseRel::getOwnerId, pmMaintenanceOrder.getOwnerId())); + + if (ownerHouseRels != null && !ownerHouseRels.isEmpty()) { + pmMaintenanceOrder.setHouseId(ownerHouseRels.get(0).getHouseId()); + } + } else if ("2".equals(pmMaintenanceOrder.getOwnerType())) { + // 查询租户的房屋 + List tenantHouses = pmTenantHouseService.list(Wrappers.lambdaQuery() + .eq(PmTenantHouse::getRentId, pmMaintenanceOrder.getOwnerId())); + + if (tenantHouses != null && !tenantHouses.isEmpty()) { + List tenantHouseRels = pmTenantHouseRelService.list(Wrappers.lambdaQuery() + .eq(PmTenantHouseRel::getTenantHouseId, tenantHouses.get(0).getId())); + + if (tenantHouseRels != null && !tenantHouseRels.isEmpty()) { + pmMaintenanceOrder.setHouseId(tenantHouseRels.get(0).getHouseId()); + } + } + } + } + } + } + // 处理文件保存 - if (pmMaintenanceOrder.getFiles() != null) { - updateFile(pmMaintenanceOrder); + if (pmMaintenanceOrder.getFiles() != null || pmMaintenanceOrder.getAfterProcessFiles() != null) { + updateFiles(pmMaintenanceOrder); + } + + // 办结时检查处理后文件 + if ("99".equals(pmMaintenanceOrder.getStatus()) && (pmMaintenanceOrder.getAfterProcessFiles() == null || pmMaintenanceOrder.getAfterProcessFiles().isEmpty())) { + return CommonResult.failed("办结时必须上传修复凭证"); } if (pmMaintenanceOrderService.save(pmMaintenanceOrder)) { @@ -385,8 +507,13 @@ public class PmMaintenanceOrderController { @RequestMapping(value = "/update", method = RequestMethod.POST) public CommonResult update(@RequestBody PmMaintenanceOrder pmMaintenanceOrder){ // 处理文件更新 - if (pmMaintenanceOrder.getFiles() != null) { - updateFile(pmMaintenanceOrder); + if (pmMaintenanceOrder.getFiles() != null || pmMaintenanceOrder.getAfterProcessFiles() != null) { + updateFiles(pmMaintenanceOrder); + } + + // 办结时检查处理后文件 + if ("99".equals(pmMaintenanceOrder.getStatus()) && (pmMaintenanceOrder.getAfterProcessFiles() == null || pmMaintenanceOrder.getAfterProcessFiles().isEmpty())) { + return CommonResult.failed("办结时必须上传修复凭证"); } if (pmMaintenanceOrderService.updateById(pmMaintenanceOrder)) { @@ -403,15 +530,30 @@ public class PmMaintenanceOrderController { return CommonResult.failed(); } - private void updateFile(PmMaintenanceOrder pmMaintenanceOrder) { - Long newId = System.currentTimeMillis() + new Random().nextInt(1000); - List files = pmMaintenanceOrder.getFiles(); - if (files != null) { - for (SystemAttachment attachment : files) { - attachment.setFileId(String.valueOf(newId)); + private void updateFiles(PmMaintenanceOrder pmMaintenanceOrder) { + // 生成统一的文件ID + Long fileId = pmMaintenanceOrder.getFaultPhoto(); + if (fileId == null) { + fileId = System.currentTimeMillis() + new Random().nextInt(1000); + pmMaintenanceOrder.setFaultPhoto(fileId); + } + + // 处理故障照片文件 + if (pmMaintenanceOrder.getFiles() != null && !pmMaintenanceOrder.getFiles().isEmpty()) { + for (SystemAttachment attachment : pmMaintenanceOrder.getFiles()) { + attachment.setFileId(String.valueOf(fileId)); + attachment.setAttType("fault_photo"); // 设置为故障照片类型 } - systemAttachmentService.updateBatchById(files); - pmMaintenanceOrder.setFaultPhoto(newId); + systemAttachmentService.saveOrUpdateBatch(pmMaintenanceOrder.getFiles()); + } + + // 处理修复凭证文件 + if (pmMaintenanceOrder.getAfterProcessFiles() != null && !pmMaintenanceOrder.getAfterProcessFiles().isEmpty()) { + for (SystemAttachment attachment : pmMaintenanceOrder.getAfterProcessFiles()) { + attachment.setFileId(String.valueOf(fileId)); + attachment.setAttType("repair_photo"); // 设置为修复凭证类型 + } + systemAttachmentService.saveOrUpdateBatch(pmMaintenanceOrder.getAfterProcessFiles()); } } @@ -484,6 +626,16 @@ public class PmMaintenanceOrderController { return CommonResult.failed("订单不存在"); } + // 办结时检查修复照片 + if ("99".equals(status)) { + // 这里需要从前端传递修复照片,或者在前端进行检查 + // 由于此接口主要用于状态和备注的快速修改,建议在前端进行修复照片的检查 + // 如果前端没有传递修复照片,则返回错误 + if (params.get("afterProcessFiles") == null) { + return CommonResult.failed("办结时必须上传修复凭证"); + } + } + // 只修改状态和备注 pmMaintenanceOrder.setStatus(status); pmMaintenanceOrder.setRemark(remark); @@ -499,6 +651,16 @@ public class PmMaintenanceOrderController { */ @RequestMapping(value = "/delete", method = RequestMethod.POST) public CommonResult delete(@RequestBody Long[] ids){ + // 检查每个订单是否有报修派单记录 + for (Long id : ids) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PmMaintenanceDispatch::getOrderId, id); + long count = pmMaintenanceDispatchService.count(queryWrapper); + if (count > 0) { + return CommonResult.failed("报修单下存在报修派单记录,无法删除"); + } + } + if (pmMaintenanceOrderService.removeByIds(Arrays.asList(ids))) { return CommonResult.success(); } diff --git a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmComplaintSuggestion.java b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmComplaintSuggestion.java index 789b71e..e864864 100644 --- a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmComplaintSuggestion.java +++ b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmComplaintSuggestion.java @@ -191,10 +191,16 @@ public class PmComplaintSuggestion implements Serializable { private Long fileId; /** - * 文件 + * 问题凭证文件 */ @TableField(exist = false) - private List files; + private List beforeProcessFiles; + + /** + * 处理凭证文件 + */ + @TableField(exist = false) + private List afterProcessFiles; } diff --git a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmMaintenanceOrder.java b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmMaintenanceOrder.java index b2185af..768dab0 100644 --- a/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmMaintenanceOrder.java +++ b/crmeb/crmeb-admin/src/main/java/com/zbkj/modules/autogencode/entity/PmMaintenanceOrder.java @@ -129,17 +129,30 @@ public class PmMaintenanceOrder implements Serializable { @TableField(fill = FieldFill.INSERT_UPDATE) private Date updateTime; /** - * 租户ID + * 租户ID */ @ApiModelProperty(value = "租户ID") private String tenantId; + + /** + * 用户ID + */ + @ApiModelProperty(value = "用户ID") + @TableField(exist = false) + private Long uid; /** - * 文件 + * 文件 */ @TableField(exist = false) private List files; + /** + * 处理后文件(修复凭证) + */ + @TableField(exist = false) + private List afterProcessFiles; + /** * 报修派单记录列表 */