Merge remote-tracking branch 'origin/master'
| | |
| | | }) |
| | | } |
| | | |
| | | export const getLazyList = (data) => { |
| | | return request({ |
| | | url: '/api/ubcs-log/localLog/lazy-list', |
| | | method: 'post', |
| | | data: data, |
| | | }) |
| | | } |
| | | export const downLoadLog = (data) => { |
| | | return request({ |
| | | url: '/api/ubcs-log/localLog/downLoadLog', |
| | | method: 'post', |
| | | data:data, |
| | | }) |
| | | } |
| | | export const deleteLocalLog = (data) => { |
| | | return request({ |
| | | url: '/api/ubcs-log/localLog/deleteLogFile', |
| | | method: 'delete', |
| | | data: data |
| | | }) |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud ref="crud" |
| | | v-model="form" |
| | | :before-close="beforeClose" |
| | | :before-open="beforeOpen" |
| | | :data="data" |
| | | :option="option" |
| | | :permission="permissionList" |
| | | :table-loading="loading" |
| | | @row-del="rowDel" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @selection-change="selectionChange" |
| | | @row-click="clickRowChange" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad" |
| | | @tree-load="treeLoad"> |
| | | <template slot="menu" slot-scope="scope"> |
| | | <el-button |
| | | icon="el-icon-download el-icon--right" |
| | | size="small" |
| | | type="text" |
| | | :loading="downloadLoading" |
| | | @click="downLoadLogFile(scope.row)" |
| | | v-if="permissionList.downLoadBtn" |
| | | >ä¸è½½ |
| | | </el-button> |
| | | </template> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getLazyList, deleteLocalLog,downLoadLog} from "@/api/logs"; |
| | | import func from "@/util/func"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | logPath: "", |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | option: { |
| | | height: "auto", |
| | | lazy: true, |
| | | columnBtn: false, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | tree: true, |
| | | border: true, |
| | | index: true, |
| | | selection: true, |
| | | editBtn: false, |
| | | delBtn: true, |
| | | addBtn: false, |
| | | viewBtn: false, |
| | | // menuWidth: 300, |
| | | dialogClickModal: false, |
| | | highlightCurrentRow: true, //è¡é䏿¶é«äº® |
| | | rowKey: "logName", //è¡æ°æ®ç Keyï¼ç¨æ¥ä¼å Table çæ¸²æ |
| | | column: [ |
| | | { |
| | | label: "æå¡åç§°", |
| | | prop: "serviceName", |
| | | width:'120', |
| | | search: true |
| | | }, |
| | | { |
| | | label: "æå¡ID", |
| | | prop: "serviceId", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "æ¥å¿è·¯å¾", |
| | | prop: "logPath", |
| | | width:'160' |
| | | }, |
| | | { |
| | | label: "æ¥å¿åç§°", |
| | | prop: "logName", |
| | | width:'80', |
| | | }, |
| | | { |
| | | label: "æ¥å¿ç±»å", |
| | | prop: "logType" |
| | | }, |
| | | { |
| | | label: "å建æ¶é´", |
| | | prop: "createTime", |
| | | width:'180' |
| | | }, |
| | | { |
| | | label: "æåä¿®æ¹æ¶é´", |
| | | prop: "lastModifier", |
| | | width:'180' |
| | | } |
| | | ] |
| | | }, |
| | | data: [], |
| | | downloadLoading: false, |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | delBtn: this.vaildData(this.permission.localLog.localLog_delete, false), |
| | | downLoadBtn: this.vaildData(this.permission.localLog.localLog_dwonload, false) |
| | | }; |
| | | } |
| | | }, |
| | | methods: { |
| | | |
| | | downLoadLogFile(row){ |
| | | this.downloadLoading = true; |
| | | let logPath = row.hasChildren ? row.logPath:row.logPath+"\\"+row.logName; |
| | | downLoadLog(Object.assign({},row,{logFullPaths:logPath})).then(res=>{ |
| | | func.downloadFileByBlobHandler(res); |
| | | this.downloadLoading = false; |
| | | }).catch((res)=>{ |
| | | //this.$message.warning(res) |
| | | this.downloadLoading = false; |
| | | }) |
| | | }, |
| | | // è¡å é¤ |
| | | rowDel(row, index, done) { |
| | | this.$confirm("ç¡®å®å°éæ©çæ¥å¿æä»¶å é¤?", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }) |
| | | .then(() => { |
| | | let logPath = row.hasChildren ? row.logPath:row.logPath+"\\"+row.logName; |
| | | return deleteLocalLog(Object.assign({},row,{logFullPaths:logPath})); |
| | | }) |
| | | .then(() => { |
| | | this.$message({ |
| | | type: "success", |
| | | message: "æä½æå!" |
| | | }); |
| | | // æ°æ®åè°è¿è¡å·æ° |
| | | done(row); |
| | | //this.onLoad(); |
| | | }); |
| | | }, |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.parentId = 0; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.parentId = ''; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | clickRowChange(row) { |
| | | this.$refs.crud.toggleSelection(); |
| | | this.selectionList = row; |
| | | this.$refs.crud.setCurrentRow(row); |
| | | this.$refs.crud.toggleRowSelection(row); //éä¸å½åè¡ |
| | | }, |
| | | selectionChange(list) { |
| | | this.selectionList = list; |
| | | this.$refs.crud.setCurrentRow(this.selectionList[list.length - 1]); |
| | | }, |
| | | selectionClear() { |
| | | this.selectionList = []; |
| | | this.$refs.crud.toggleSelection(); |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | //Object.assign(params, this.query) |
| | | getLazyList({"logPath": this.logPath}).then(res => { |
| | | this.data = res.data.data; |
| | | this.loading = false; |
| | | this.selectionClear(); |
| | | }); |
| | | }, |
| | | treeLoad(tree, treeNode, resolve) { |
| | | const logPath = tree.logPath; |
| | | getLazyList({"logPath": logPath}).then(res => { |
| | | resolve(res.data.data); |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <basic-container> |
| | | <avue-crud :option="option" |
| | | :table-loading="loading" |
| | | :data="data" |
| | | ref="crud" |
| | | v-model="form" |
| | | :permission="permissionList" |
| | | :page.sync="page" |
| | | :before-open="beforeOpen" |
| | | @search-change="searchChange" |
| | | @search-reset="searchReset" |
| | | @current-change="currentChange" |
| | | @size-change="sizeChange" |
| | | @refresh-change="refreshChange" |
| | | @on-load="onLoad"> |
| | | </avue-crud> |
| | | </basic-container> |
| | | </template> |
| | | |
| | | <script> |
| | | import {getUsualList, getUsualLogs} from "@/api/logs"; |
| | | import {mapGetters} from "vuex"; |
| | | |
| | | export default { |
| | | data() { |
| | | return { |
| | | form: {}, |
| | | selectionList: [], |
| | | query: {}, |
| | | loading: true, |
| | | page: { |
| | | pageSize: 10, |
| | | currentPage: 1, |
| | | total: 0 |
| | | }, |
| | | option: { |
| | | height: 'auto', |
| | | calcHeight: 30, |
| | | columnBtn:false, |
| | | tip: false, |
| | | searchShow: true, |
| | | searchMenuSpan: 6, |
| | | border: true, |
| | | index: true, |
| | | viewBtn: true, |
| | | editBtn: false, |
| | | addBtn: false, |
| | | delBtn: false, |
| | | menuWidth: 120, |
| | | dialogType: 'drawer', |
| | | column: [ |
| | | { |
| | | label: "ç¨æ·å", |
| | | prop: "serviceId", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "å§å", |
| | | prop: "serverHost", |
| | | search: true |
| | | }, |
| | | { |
| | | label: "ç¨æ·id", |
| | | prop: "serverIp" |
| | | }, |
| | | { |
| | | label: "模å", |
| | | prop: "env", |
| | | width:'80' |
| | | }, |
| | | { |
| | | label: "æ¶é´", |
| | | prop: "logLevel" |
| | | }, |
| | | { |
| | | label: "æä½ç»æ", |
| | | prop: "logId" |
| | | }, |
| | | { |
| | | label: "æè¿°", |
| | | prop: "requestUri" |
| | | }, |
| | | ] |
| | | }, |
| | | data: [] |
| | | }; |
| | | }, |
| | | computed: { |
| | | ...mapGetters(["permission"]), |
| | | permissionList() { |
| | | return { |
| | | viewBtn: this.vaildData(this.permission.log_usual.log_usual_view, false) |
| | | }; |
| | | } |
| | | }, |
| | | methods: { |
| | | searchReset() { |
| | | this.query = {}; |
| | | this.onLoad(this.page); |
| | | }, |
| | | searchChange(params, done) { |
| | | this.query = params; |
| | | this.page.currentPage = 1; |
| | | this.onLoad(this.page, params); |
| | | done(); |
| | | }, |
| | | beforeOpen(done, type) { |
| | | if (["edit", "view"].includes(type)) { |
| | | getUsualLogs(this.form.id).then(res => { |
| | | this.form = res.data.data; |
| | | }); |
| | | } |
| | | done(); |
| | | }, |
| | | currentChange(currentPage){ |
| | | this.page.currentPage = currentPage; |
| | | }, |
| | | sizeChange(pageSize){ |
| | | this.page.pageSize = pageSize; |
| | | }, |
| | | refreshChange() { |
| | | this.onLoad(this.page, this.query); |
| | | }, |
| | | onLoad(page, params = {}) { |
| | | this.loading = true; |
| | | getUsualList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => { |
| | | const data = res.data.data; |
| | | this.page.total = data.total; |
| | | this.data = data.records; |
| | | this.loading = false; |
| | | }); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style> |
| | | </style> |
| | |
| | | proxy: { |
| | | '/api': { |
| | | //æ¬å°æå¡æ¥å£å°å |
| | | // target: 'http://127.0.0.1:37000', |
| | | target: 'http://127.0.0.1:37000', |
| | | // target: 'http://192.168.1.51:37000', |
| | | target: 'http://dev.vci-tech.com:37000', |
| | | // target: 'http://dev.vci-tech.com:37000', |
| | | //yxc |
| | | // target: 'http:// 192.168.0.104:37000', |
| | | // target: 'http://192.168.0.105:37000', |
| | |
| | | return result; |
| | | } |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | } |
| | | return result; |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.dto; |
| | | |
| | | import com.vci.ubcs.log.entity.LocalLog; |
| | | import javafx.scene.Parent; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ludc |
| | | * @date 2023/11/23 11:17 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class LocalLogVO extends LocalLog implements Serializable { |
| | | |
| | | /** |
| | | * åºåå |
| | | */ |
| | | private static final long serialVersionUID = 2217599544701726981L; |
| | | |
| | | /** |
| | | * æ¥å¿å
¨è·¯å¾éå |
| | | */ |
| | | private String logFullPaths; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.entity; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @author ludc |
| | | * @date 2023/10/31 15:43 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class LocalLog implements Serializable { |
| | | |
| | | /** |
| | | * åºåå |
| | | */ |
| | | private static final long serialVersionUID = 2217599544701726181L; |
| | | |
| | | /** |
| | | * æ¥å¿æå±æå¡åç§° |
| | | */ |
| | | private String serviceName; |
| | | |
| | | /** |
| | | * æå¡id |
| | | */ |
| | | private String serviceId; |
| | | |
| | | /** |
| | | * æ¥å¿æä»¶æå¨çè·¯å¾ |
| | | */ |
| | | private String logPath; |
| | | |
| | | /** |
| | | * æ¥å¿åç§° |
| | | */ |
| | | private String logName; |
| | | |
| | | /** |
| | | * æ¥å¿ç±»å |
| | | */ |
| | | private String logType; |
| | | |
| | | /** |
| | | * æ¥å¿å建æ¶é´ |
| | | */ |
| | | private String createTime; |
| | | |
| | | /** |
| | | * æ¥å¿çæåä¿®æ¹æ¶é´ |
| | | */ |
| | | private String lastModifier; |
| | | |
| | | /** |
| | | * æ¯å¦å
å«åå¨åæä»¶ |
| | | */ |
| | | private Boolean hasChildren; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.entity; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ç®¡ç:(å
æ¬ç»å½æ¥å¿ãæä½æ¥å¿ãæææ¥å¿ï¼ä»¥å管çåç以ä¸ä¸ç§æ¥å¿) |
| | | * @author ludc |
| | | * @date 2023/11/24 10:58 |
| | | */ |
| | | @Data |
| | | @AllArgsConstructor |
| | | @NoArgsConstructor |
| | | public class LogOperate implements Serializable { |
| | | |
| | | /** |
| | | * åºåå |
| | | */ |
| | | private static final long serialVersionUID = 2217599544701724211L; |
| | | |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | private String oid; |
| | | |
| | | /** |
| | | * ç¨æ·å |
| | | */ |
| | | private String userName; |
| | | |
| | | /** |
| | | * å§å |
| | | */ |
| | | private String realName; |
| | | |
| | | /** |
| | | * ipå°å |
| | | */ |
| | | private String ip; |
| | | |
| | | /** |
| | | * 模å |
| | | */ |
| | | private String model; |
| | | |
| | | /** |
| | | * æä½ |
| | | */ |
| | | private String operate; |
| | | |
| | | /** |
| | | * æ¶é´ |
| | | */ |
| | | private String time; |
| | | |
| | | /** |
| | | * æä½ç»æ |
| | | */ |
| | | private String operateResult; |
| | | |
| | | /** |
| | | * æè¿° |
| | | */ |
| | | private String description; |
| | | |
| | | } |
| | |
| | | */ |
| | | package com.vci.ubcs.resource.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | import org.springblade.core.tenant.mp.TenantEntity; |
| | | |
| | | /** |
| | |
| | | @TableName("pl_attach") |
| | | @EqualsAndHashCode(callSuper = true) |
| | | @ApiModel(value = "Attach对象", description = "é件表") |
| | | public class Attach extends TenantEntity { |
| | | public class Attach extends BaseEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | */ |
| | | @ApiModelProperty(value = "é件大å°") |
| | | private Long attachSize; |
| | | |
| | | /** |
| | | * ç§æ·ID |
| | | */ |
| | | @ApiModelProperty(value = "ç§æ·ID") |
| | | @TableField("TENANT_ID") |
| | | private String tenantId; |
| | | |
| | | } |
| | |
| | | @Slf4j |
| | | public class FileDownloadUtil { |
| | | |
| | | /** |
| | | * ä¸è½½æä»¶ |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param fileObjectBO æä»¶çä¿¡æ¯ï¼å
嫿件çè¾å
¥æµ |
| | | * @throws IOException ä¸è½½å¼å¸¸ä¼æåº |
| | | */ |
| | | public static void downloadFile(HttpServletResponse response, FileObjectBO fileObjectBO) throws IOException { |
| | | downloadFile(response,fileObjectBO,true); |
| | | } |
| | | /** |
| | | * ä¸è½½æä»¶ |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param fileObjectBO æä»¶çä¿¡æ¯ï¼å
嫿件çè¾å
¥æµ |
| | | * @throws IOException ä¸è½½å¼å¸¸ä¼æåº |
| | | */ |
| | | public static void downloadFile(HttpServletResponse response, FileObjectBO fileObjectBO) throws IOException { |
| | | downloadFile(response,fileObjectBO,true); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æä»¶ |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param fileObjectBO æä»¶çä¿¡æ¯ï¼å
嫿件çè¾å
¥æµ |
| | | * @param closeInputStream æ¯å¦å
³éæµ |
| | | * @throws IOException ä¸è½½åºéçæ¶åæåºå¼å¸¸ |
| | | */ |
| | | public static void downloadFile(HttpServletResponse response, FileObjectBO fileObjectBO,boolean closeInputStream) throws IOException { |
| | | MediaType mediaType = MediaTypeFactory.getMediaType(fileObjectBO.getBucketName() + "." + fileObjectBO.getFileExtension()).orElse(MediaType.APPLICATION_OCTET_STREAM); |
| | | // 设置强å¶ä¸è½½ä¸æå¼ |
| | | response.setContentType(mediaType.toString()+";application/force-download;charset=UTF-8"); |
| | | try{ |
| | | String fileName = URLEncoder.encode(fileObjectBO.getName() + "." + fileObjectBO.getFileExtension(), "UTF8"); |
| | | response.addHeader("Content-Disposition", "attachment;filename="+ fileName+ ";filename*=utf-8''"); |
| | | }catch(Exception e){ |
| | | if(log.isErrorEnabled()){ |
| | | log.error("设置æä»¶çåç§°å°ååºæµçæ¶ååºé",e); |
| | | } |
| | | } |
| | | response.setCharacterEncoding("UTF-8"); |
| | | Cookie cookie = new Cookie("fileDownload", "true"); |
| | | cookie.setPath("/"); |
| | | response.addCookie(cookie); |
| | | /** |
| | | * ä¸è½½æä»¶ |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param fileObjectBO æä»¶çä¿¡æ¯ï¼å
嫿件çè¾å
¥æµ |
| | | * @param closeInputStream æ¯å¦å
³éæµ |
| | | * @throws IOException ä¸è½½åºéçæ¶åæåºå¼å¸¸ |
| | | */ |
| | | public static void downloadFile(HttpServletResponse response, FileObjectBO fileObjectBO,boolean closeInputStream) throws IOException { |
| | | MediaType mediaType = MediaTypeFactory.getMediaType(fileObjectBO.getBucketName() + "." + fileObjectBO.getFileExtension()).orElse(MediaType.APPLICATION_OCTET_STREAM); |
| | | // 设置强å¶ä¸è½½ä¸æå¼ |
| | | response.setContentType(mediaType.toString()+";application/force-download;charset=UTF-8"); |
| | | try{ |
| | | String fileName = URLEncoder.encode(fileObjectBO.getName() + "." + fileObjectBO.getFileExtension(), "UTF8"); |
| | | response.addHeader("Content-Disposition", "attachment;filename="+ fileName+ ";filename*=utf-8''"); |
| | | }catch(Exception e){ |
| | | if(log.isErrorEnabled()){ |
| | | log.error("设置æä»¶çåç§°å°ååºæµçæ¶ååºé",e); |
| | | } |
| | | } |
| | | response.setCharacterEncoding("UTF-8"); |
| | | Cookie cookie = new Cookie("fileDownload", "true"); |
| | | cookie.setPath("/"); |
| | | response.addCookie(cookie); |
| | | if(closeInputStream) { |
| | | try (InputStream ins = (fileObjectBO.getInputStream() != null ? fileObjectBO.getInputStream() : new FileInputStream(fileObjectBO.getFileLocalPath()))) { |
| | | IOUtils.copy(ins, response.getOutputStream()); |
| | |
| | | throw e; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æä»¶ |
| | | * @param response ååºå¯¹è±¡ |
| | | * @param fileObjectBO æä»¶çä¿¡æ¯ï¼å
嫿件çè¾å
¥æµ |
| | | * @param closeInputStream æ¯å¦å
³éæµ |
| | | * @throws IOException ä¸è½½åºéçæ¶åæåºå¼å¸¸ |
| | | */ |
| | | public static void downloadFileLocal(HttpServletResponse response, FileObjectBO fileObjectBO,boolean closeInputStream) throws IOException { |
| | | MediaType mediaType = MediaTypeFactory.getMediaType(fileObjectBO.getFileExtension()).orElse(MediaType.APPLICATION_OCTET_STREAM); |
| | | // 设置强å¶ä¸è½½ä¸æå¼ |
| | | response.setContentType(mediaType.toString()+";application/force-download;charset=UTF-8"); |
| | | try{ |
| | | String fileName = URLEncoder.encode(fileObjectBO.getName(), "UTF8"); |
| | | response.addHeader("Content-Disposition", "attachment;filename="+ fileName+ ";filename*=utf-8''"); |
| | | }catch(Exception e){ |
| | | if(log.isErrorEnabled()){ |
| | | log.error("设置æä»¶çåç§°å°ååºæµçæ¶ååºé",e); |
| | | } |
| | | } |
| | | response.setCharacterEncoding("UTF-8"); |
| | | Cookie cookie = new Cookie("fileDownload", "true"); |
| | | cookie.setPath("/"); |
| | | response.addCookie(cookie); |
| | | if(closeInputStream) { |
| | | try (InputStream ins = (fileObjectBO.getInputStream() != null ? fileObjectBO.getInputStream() : new FileInputStream(fileObjectBO.getFileLocalPath()))) { |
| | | IOUtils.copy(ins, response.getOutputStream()); |
| | | } catch (IOException e) { |
| | | //æå¯è½å®¢æ·ç«¯ç龿¥ |
| | | if (log.isErrorEnabled()) { |
| | | log.error("åå
¥æä»¶å°ååºæµåºé", e); |
| | | } |
| | | throw e; |
| | | } |
| | | }else{ |
| | | try { |
| | | InputStream ins = (fileObjectBO.getInputStream() != null ? fileObjectBO.getInputStream() : new FileInputStream(fileObjectBO.getFileLocalPath())); |
| | | IOUtils.copy(ins, response.getOutputStream()); |
| | | } catch (IOException e) { |
| | | //æå¯è½å®¢æ·ç«¯ç龿¥ |
| | | if (log.isErrorEnabled()) { |
| | | log.error("åå
¥æä»¶å°ååºæµåºé", e); |
| | | } |
| | | throw e; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | * @author Chill |
| | | */ |
| | | @EnableDiscoveryClient |
| | | @EnableFeignClients("org.springblade") |
| | | @EnableFeignClients(basePackages = {"com.vci.ubcs", "org.springblade"}) |
| | | @SpringBootApplication |
| | | public class LogApplication { |
| | | |
| | |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.util.Map; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.vci.ubcs.log.dto.LocalLogVO; |
| | | import com.vci.ubcs.log.service.ILogLocalService; |
| | | import com.vci.ubcs.log.entity.LocalLog; |
| | | import com.vci.ubcs.resource.utils.FileDownloadUtil; |
| | | import com.vci.ubcs.starter.web.util.ControllerUtil; |
| | | import com.vci.ubcs.starter.web.util.LangBaseUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.rmi.ServerException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ¬å°ç³»ç»æ¥å¿ |
| | | * @author ludc |
| | | * @date 2023/10/31 15:37 |
| | | */ |
| | | @NonDS |
| | | @Slf4j |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/localLog") |
| | | public class LogLocalController { |
| | | |
| | | private final ILogLocalService logLocalService; |
| | | |
| | | /** |
| | | * è·åæ¥å¿æä»¶å表 |
| | | * @param localLog |
| | | * @return |
| | | */ |
| | | @PostMapping("/lazy-list") |
| | | public R<List<LocalLog>> getSystemLogList(@RequestBody LocalLog localLog){ |
| | | return R.data(logLocalService.getSystemLogList(localLog.getLogPath())); |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æ¥å¿æä»¶ |
| | | * @param localLogVO ä¸è½½æ¥å¿çå
¨è·¯å¾éå |
| | | * @param response |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/downLoadLog",method = {RequestMethod.GET,RequestMethod.POST}) |
| | | public void downloadLogByServiceName(@RequestBody LocalLogVO localLogVO, HttpServletResponse response) throws IOException { |
| | | try { |
| | | //ControllerUtil.writeFileToResponse(response,excelName); |
| | | FileDownloadUtil.downloadFileLocal(response, logLocalService.downloadLogByServiceNameAndFileName(localLogVO),true); |
| | | } catch (Throwable e) { |
| | | //妿åºé,æé误信æ¯åå°text |
| | | String msg = LangBaseUtil.getErrorMsg(e); |
| | | if(StringUtils.isBlank(msg)){ |
| | | msg = "æªç¥é误"; |
| | | } |
| | | ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å 餿¥å¿æä»¶ |
| | | * @param localLogVO |
| | | * @return |
| | | * @throws ServerException |
| | | */ |
| | | @DeleteMapping("/deleteLogFile") |
| | | public R deleteLogFile(@RequestBody LocalLogVO localLogVO) throws ServerException { |
| | | return logLocalService.deleteLogFile(localLogVO); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.controller; |
| | | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ç®¡ç:(å
æ¬ç»å½æ¥å¿ãæä½æ¥å¿ãæææ¥å¿ï¼ä»¥å管çåç以ä¸ä¸ç§æ¥å¿) |
| | | * @author ludc |
| | | * @date 2023/11/24 10:43 |
| | | */ |
| | | @NonDS |
| | | @Slf4j |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/operateLog") |
| | | public class LogOperateController { |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.vci.ubcs.log.entity.LogOperate; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ç®¡ç:(å
æ¬ç»å½æ¥å¿ãæä½æ¥å¿ãæææ¥å¿ï¼ä»¥å管çåç以ä¸ä¸ç§æ¥å¿) |
| | | * @author ludc |
| | | * @date 2023/11/24 10:50 |
| | | */ |
| | | @Mapper |
| | | public interface LogOperateMapper extends BaseMapper<LogOperate> { |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.service; |
| | | |
| | | import com.vci.ubcs.log.dto.LocalLogVO; |
| | | import com.vci.ubcs.log.entity.LocalLog; |
| | | import com.vci.ubcs.resource.bo.FileObjectBO; |
| | | import org.springblade.core.tool.api.R; |
| | | |
| | | import java.rmi.ServerException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * æ¬å°ç³»ç»æ¥å¿ |
| | | * @author ludc |
| | | * @date 2023/10/31 15:38 |
| | | */ |
| | | public interface ILogLocalService { |
| | | |
| | | /** |
| | | * æ¥çï¼æ¬å°ç³»ç»æ¥å¿å表 |
| | | * @param logParentPath |
| | | * @return |
| | | */ |
| | | List<LocalLog> getSystemLogList(String logParentPath); |
| | | |
| | | /** |
| | | * ä¸è½½ï¼æ ¹æ®æå¡åæå¨æä»¶ååæä»¶åä¸è½½æä»¶ |
| | | * @param localLogVO ä¸è½½æ¥å¿ç对象 |
| | | * @return æä»¶çä¿¡æ¯ |
| | | */ |
| | | FileObjectBO downloadLogByServiceNameAndFileName(LocalLogVO localLogVO) throws ServerException; |
| | | |
| | | /** |
| | | * å é¤ï¼æ ¹æ®æå¡æå¨æä»¶åï¼åæ¥å¿æä»¶åç§°å é¤ |
| | | * @param localLogVO |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | R deleteLogFile(LocalLogVO localLogVO) throws ServerException; |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vci.ubcs.log.entity.LogOperate; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ç®¡ç:(å
æ¬ç»å½æ¥å¿ãæä½æ¥å¿ãæææ¥å¿ï¼ä»¥å管çåç以ä¸ä¸ç§æ¥å¿) |
| | | * @author ludc |
| | | * @date 2023/11/24 10:50 |
| | | */ |
| | | public interface ILogOperateService extends IService<LogOperate> { |
| | | |
| | | /** |
| | | * ä¿åæä½æ¥å¿ |
| | | * @param logOperate |
| | | * @return |
| | | */ |
| | | boolean saveLogOperate(LogOperate logOperate); |
| | | |
| | | /** |
| | | * æ¡ä»¶æ¥è¯¢è·åæ¥å¿å表 |
| | | * @param logOperate |
| | | * @return |
| | | */ |
| | | List<LogOperate> listByCondition(LogOperate logOperate); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.service.impl; |
| | | |
| | | import com.vci.ubcs.log.dto.LocalLogVO; |
| | | import com.vci.ubcs.log.service.ILogLocalService; |
| | | import com.vci.ubcs.log.entity.LocalLog; |
| | | import com.vci.ubcs.resource.utils.FileUtil; |
| | | import com.vci.ubcs.resource.utils.ZipUtil; |
| | | import com.vci.ubcs.resource.vo.FileObjectVO; |
| | | import com.vci.ubcs.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.util.BeanUtil; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.io.IOUtils; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import com.vci.ubcs.omd.cache.EnumCache; |
| | | import com.vci.ubcs.omd.enums.EnumEnum; |
| | | import com.vci.ubcs.resource.bo.FileObjectBO; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.*; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.nio.file.FileSystems; |
| | | import java.nio.file.Files; |
| | | import java.nio.file.Path; |
| | | import java.nio.file.attribute.BasicFileAttributes; |
| | | import java.rmi.ServerException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * æ¬å°ç³»ç»æ¥å¿ |
| | | * @author ludc |
| | | * @date 2023/10/31 15:39 |
| | | */ |
| | | @Service |
| | | @Slf4j |
| | | public class LogLocalServiceImpl implements ILogLocalService{ |
| | | |
| | | /** |
| | | * å个æå¡åæ¾ççç¶è·¯å¾ |
| | | */ |
| | | @Value("${local-log.parent-path:/data1/ubcs/ubcs-server}") |
| | | private String PARENTPATH; |
| | | |
| | | /** |
| | | * æ¥å¿æä»¶çå
·ä½ä½ç½® |
| | | */ |
| | | @Value("${local-log.log-path:/target/log}") |
| | | private String LOGPATH; |
| | | |
| | | /** |
| | | * å½åæä½ç³»ç»ï¼æ¯å¦ä¸ºwindowsç³»ç» |
| | | */ |
| | | private Boolean isWindows = true; |
| | | |
| | | { |
| | | String os = System.getProperty("os.name").toLowerCase(); |
| | | //é»è®¤å°±é
置为windowsçï¼å¦æä¸æ¯å½åç³»ç»ä¸æ¯windowså°±éè¦å¯¹å
¶è½¬æ¢ä¸ºlinuxçæä»¶è·¯å¾æ ¼å¼ |
| | | if (!os.contains("win")) { |
| | | this.PARENTPATH = this.PARENTPATH.substring(this.PARENTPATH.lastIndexOf(":") + 1).replace("\\", "/"); |
| | | this.LOGPATH = this.LOGPATH.replace("\\", "/"); |
| | | this.isWindows = false; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å缩æä»¶çå·¥å
·ç±» |
| | | */ |
| | | @Resource |
| | | private ZipUtil zipUtil; |
| | | |
| | | /** |
| | | * è·åæ¬å°æ¥å¿å表 |
| | | * @param logParentPath |
| | | * @return |
| | | */ |
| | | //@Override |
| | | public List<LocalLog> getSystemLogList(String logParentPath) { |
| | | List<LocalLog> localLogs = new ArrayList<>(); |
| | | // ä¸ä¸ºç©ºè¯´ææ¯å è½½å½åè¿ä¸ªæå¡è·¯å¾ä¸çæ¥å¿æä»¶ |
| | | if(Func.isNotEmpty(logParentPath)){ |
| | | File file = new File(logParentPath); |
| | | if (file.isDirectory()) { |
| | | File[] files = file.listFiles(); |
| | | Arrays.stream(files).forEach(item->{ |
| | | // ç»å»ºæ¥å¿æä»¶å¯¹è±¡ |
| | | LocalLog localLog = new LocalLog(); |
| | | localLog.setLogName(item.getName()); |
| | | localLog.setLogType(getLogType(item.getName())); |
| | | localLog.setCreateTime(getLastModifiedOrCreatTime(false,logParentPath)); |
| | | localLog.setLastModifier(getLastModifiedOrCreatTime(true,logParentPath)); |
| | | localLog.setLogPath(logParentPath); |
| | | String serviceId = getServiceId(logParentPath); |
| | | localLog.setServiceId(serviceId); |
| | | localLog.setServiceName(getServiceName(serviceId)); |
| | | localLog.setHasChildren(false); |
| | | localLogs.add(localLog); |
| | | }); |
| | | } |
| | | }else { |
| | | File fileDir = new File(PARENTPATH); |
| | | File[] childDir = fileDir.listFiles(); |
| | | Arrays.stream(childDir).forEach(dir->{ |
| | | if(dir.getName().contains("ubcs_")){ |
| | | String fullPath = dir.getPath() + LOGPATH; |
| | | File file = new File(fullPath); |
| | | LocalLog localLog = new LocalLog(); |
| | | localLog.setLastModifier(getLastModifiedOrCreatTime(true,fullPath)); |
| | | localLog.setCreateTime(getLastModifiedOrCreatTime(false,fullPath)); |
| | | localLog.setLogPath(fullPath); |
| | | String serviceId = getServiceId(file.getPath()); |
| | | localLog.setServiceId(serviceId); |
| | | String serviceName = getServiceName(serviceId); |
| | | localLog.setServiceName(serviceName); |
| | | localLog.setLogType(serviceName+"æ¥å¿ç¶ç®å½"); |
| | | localLog.setLogName(serviceName+"æ¥å¿ç¶ç®å½"); |
| | | localLog.setHasChildren(true); |
| | | localLogs.add(localLog); |
| | | } |
| | | }); |
| | | } |
| | | return localLogs; |
| | | } |
| | | |
| | | /** |
| | | * è·åæä»¶æåä¿®æ¹æè
å建æ¶é´ |
| | | * @param isModifier |
| | | * @return |
| | | */ |
| | | private String getLastModifiedOrCreatTime(boolean isModifier,String pathStr) { |
| | | Path path = FileSystems.getDefault().getPath(pathStr); |
| | | String date = ""; |
| | | try { |
| | | BasicFileAttributes attr = Files.readAttributes(path, BasicFileAttributes.class); |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // æ¯è·åæåä¿®æ¹æ¶é´ |
| | | if(isModifier){ |
| | | date = dateFormat.format(new Date(attr.lastModifiedTime().toMillis())); |
| | | }else { |
| | | date = dateFormat.format(new Date(attr.creationTime().toMillis())); |
| | | } |
| | | } catch (IOException e) { |
| | | throw new ServiceException("Error reading file date attributes: " + e.getMessage()); |
| | | } |
| | | return date; |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥å¿ç±»å |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | private String getLogType(String fileName){ |
| | | //夿æ¥å¿ççç±»å |
| | | if (fileName.contains("error")) { |
| | | return "Error"; |
| | | } else if (fileName.contains("info")) { |
| | | return "Info"; |
| | | } else if (fileName.contains("warning")) { |
| | | return "Warning"; |
| | | } else { |
| | | return "Unknown"; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæå¡ID |
| | | * @param servciePath |
| | | * @return |
| | | */ |
| | | private String getServiceId(String servciePath){ |
| | | // æ ¹æ®å½åæä½ç³»ç»æ¥å³å®æ¯éè¿ä»ä¹åç¬¦æ¥æªå |
| | | String[] parts = servciePath.split(this.isWindows ? "\\\\":"/"); |
| | | String extractedString = ""; |
| | | if(parts.length > 3){ |
| | | extractedString = parts[parts.length - 3]; |
| | | } |
| | | return extractedString; |
| | | } |
| | | |
| | | /** |
| | | * è·åæå¡åç§° |
| | | * @param serViceId |
| | | * @return |
| | | */ |
| | | private String getServiceName(String serViceId){ |
| | | return EnumCache.getValue(EnumEnum.SERCIVE_NAME_ROLE, serViceId); |
| | | } |
| | | |
| | | /** |
| | | * æªåè·¯å¾ä¸çæ¥å¿æä»¶åç§° |
| | | * @param logFullPath |
| | | * @return |
| | | */ |
| | | private String getLogFileName(String logFullPath){ |
| | | // æ ¹æ®å½åæä½ç³»ç»æ¥å³å®æ¯éè¿ä»ä¹åç¬¦æ¥æªå |
| | | String[] parts = logFullPath.split(this.isWindows ? "\\\\":"/"); |
| | | String logFileName = ""; |
| | | if(parts.length > 3){ |
| | | logFileName = parts[parts.length - 1]; |
| | | } |
| | | return logFileName; |
| | | } |
| | | |
| | | /** |
| | | * ä¸è½½æ¥å¿æä»¶ |
| | | * @param localLogVO ä¸è½½æ¥å¿å¯¹è±¡ |
| | | * @return |
| | | * @throws ServerException |
| | | */ |
| | | @Override |
| | | public FileObjectBO downloadLogByServiceNameAndFileName(LocalLogVO localLogVO) throws ServerException { |
| | | if(Func.isEmpty(localLogVO) || Func.isEmpty(localLogVO.getLogPath())){ |
| | | throw new ServerException("æªè·åå°è¯¥æ¥å¿è·¯å¾ï¼"); |
| | | } |
| | | FileObjectBO fileObjectBO = new FileObjectBO(); |
| | | String logFullPaths = localLogVO.getLogFullPaths(); |
| | | // 夿æ¯å¦æ¯ç¶ç®å½ |
| | | if(!localLogVO.getHasChildren()){ |
| | | //åªä¸è½½ä¸ä¸ªæ¥å¿æä»¶ |
| | | File file = new File(logFullPaths); |
| | | if(!file.isFile() || !file.exists()){ |
| | | throw new ServerException("æ¬å°æ¥å¿æä»¶è·¯å¾"+ logFullPaths +"䏿ªæ¾å°æ¥å¿"); |
| | | } |
| | | try { |
| | | fileObjectBO.setName(file.getName()); |
| | | fileObjectBO.setInputStream(new FileInputStream(file)); |
| | | fileObjectBO.setFileLocalPath(logFullPaths); |
| | | fileObjectBO.setFileExtension(".log"); |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException("è·åæä»¶çæµæé®é¢",new String[]{logFullPaths},e); |
| | | } |
| | | }else{ |
| | | // æ¯ç¶ç®å½ï¼æä»¥éè¦è·åå°ä¸é¢çææåç®å½ |
| | | // æå¤ä¸ªï¼éè¦ä½¿ç¨zipè¿è¡å缩 |
| | | String tempFolder = FileUtil.getDefaultTempFolder(); |
| | | File[] file1 = new File(logFullPaths).listFiles(); |
| | | if(file1.length > 0){ |
| | | Arrays.stream(file1).forEach(item->{ |
| | | String fileName = tempFolder + File.separator + System.currentTimeMillis() + ".log"; |
| | | File file = new File(fileName); |
| | | try { |
| | | if(!file.exists()) { |
| | | file.createNewFile(); |
| | | } |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException("å建æä»¶åºé,{0}",new String[]{fileName}); |
| | | } |
| | | File logFile = new File(item.getPath()); |
| | | if(!logFile.exists() || !logFile.isFile()){ |
| | | throw new VciBaseException("æ¬å°æ¥å¿æä»¶è·¯å¾"+item.getPath()+"䏿ªæ¾å°æ¥å¿"); |
| | | } |
| | | |
| | | try(OutputStream os = new FileOutputStream(file); |
| | | InputStream ins = new FileInputStream(logFile); |
| | | ){ |
| | | IOUtils.copy(ins,os); |
| | | }catch (Throwable e){ |
| | | throw new VciBaseException("ä¸è½½æä»¶å°ä¸´æ¶æä»¶å¤¹éåºé,{0}",new String[]{fileName}); |
| | | } |
| | | }); |
| | | String zipName = new File(tempFolder).getPath() + File.separator + getLogFileName(logFullPaths) + "ç"+file1.length + "个æä»¶.zip"; |
| | | zipUtil.folderToZipFile(tempFolder,zipName); |
| | | fileObjectBO.setFileLocalPath(zipName); |
| | | fileObjectBO.setFileExtension(".log"); |
| | | if(log.isDebugEnabled()){ |
| | | log.debug("ä¸è½½æä»¶çä¿¡æ¯,",zipName); |
| | | } |
| | | } |
| | | } |
| | | return fileObjectBO; |
| | | } |
| | | |
| | | /** |
| | | * å 餿¥å¿æä»¶ |
| | | * @param localLogVO æä»¶å
¨è·¯å¾éå |
| | | * @throws ServerException |
| | | */ |
| | | @Override |
| | | public R deleteLogFile(LocalLogVO localLogVO) throws ServerException { |
| | | List<String> resMsgs = new ArrayList<>(); |
| | | // 夿æ¯å¦æ¯æ¥å¿é¡¶å±ç®å½ |
| | | if(localLogVO.getHasChildren()){ |
| | | // æ¯é¡¶å±ç®å½ï¼éè¦å¾ªç¯å»å é¤å
å«çæææ¥å¿æä»¶ |
| | | File parentFile = new File(localLogVO.getLogFullPaths()); |
| | | if(parentFile.isDirectory()){ |
| | | Arrays.stream(parentFile.listFiles()).forEach(logFile->{ |
| | | if (logFile.exists()) { |
| | | //å é¤å¤±è´¥çç´æ¥è®°å½ä¸æä»¶å |
| | | if (!logFile.delete()) { |
| | | resMsgs.add(getLogFileName(logFile.getPath())); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }else { |
| | | // å个å é¤ |
| | | File file = new File(localLogVO.getLogFullPaths()); |
| | | if (file.exists()) { |
| | | //å é¤å¤±è´¥çç´æ¥è®°å½ä¸æä»¶å |
| | | if (!file.delete()) { |
| | | resMsgs.add(getLogFileName(localLogVO.getLogFullPaths())); |
| | | } |
| | | } |
| | | } |
| | | return resMsgs.size()==0 ? R.success("å 餿å!"):R.fail("以䏿¥å¿æä»¶ï¼"+resMsgs.stream().collect(Collectors.joining(","))+"å é¤å¤±è´¥!"); |
| | | } |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.log.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.vci.ubcs.log.entity.LogOperate; |
| | | import com.vci.ubcs.log.mapper.LogOperateMapper; |
| | | import com.vci.ubcs.log.service.ILogOperateService; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * æä½æ¥å¿ç®¡ç:(å
æ¬ç»å½æ¥å¿ãæä½æ¥å¿ãæææ¥å¿ï¼ä»¥å管çåç以ä¸ä¸ç§æ¥å¿) |
| | | * @author ludc |
| | | * @date 2023/11/24 10:51 |
| | | */ |
| | | @Service |
| | | public class LogOperateServiceImpl extends ServiceImpl<LogOperateMapper,LogOperate> implements ILogOperateService { |
| | | |
| | | @Autowired |
| | | private LogOperateMapper logOperateMapper; |
| | | |
| | | /** |
| | | * ä¿åæä½æ¥å¿ |
| | | * @param logOperate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean saveLogOperate(LogOperate logOperate) { |
| | | if(Func.isEmpty(logOperate)){ |
| | | return false; |
| | | } |
| | | return SqlHelper.retBool(logOperateMapper.insert(logOperate)); |
| | | } |
| | | |
| | | /** |
| | | * æ¡ä»¶æ¥è¯¢è·åæ¥å¿å表 |
| | | * @param logOperate |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<LogOperate> listByCondition(LogOperate logOperate) { |
| | | QueryWrapper<LogOperate> queryWrapper = Condition.getQueryWrapper(logOperate); |
| | | this.list(queryWrapper); |
| | | return this.list(queryWrapper); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.vci.ubcs.resource.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vci.ubcs.resource.dto.FileObjectDTO; |
| | | import com.vci.ubcs.resource.dto.FileReleaseDTO; |
| | |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | |
| | | @Slf4j |
| | | public class FileController { |
| | | |
| | | /** |
| | | * æä»¶æå¡ |
| | | */ |
| | | @Autowired |
| | | private IFileService fileService; |
| | | /** |
| | | * æä»¶æå¡ |
| | | */ |
| | | @Autowired |
| | | private IFileService fileService; |
| | | |
| | | /** |
| | | * æ ¹æ®æä»¶ä¸»é®ä¸è½½æä»¶ |
| | | * @param fileOids æä»¶çä¸»é® |
| | | * @param response ååºç对象 |
| | | * @return æ§è¡ç»æï¼åªæä¸è½½å¤±è´¥çæ¶åæä¼è¿æ · |
| | | */ |
| | | /** |
| | | * æ ¹æ®æä»¶ä¸»é®ä¸è½½æä»¶ |
| | | * @param fileOids æä»¶çä¸»é® |
| | | * @param response ååºç对象 |
| | | * @return æ§è¡ç»æï¼åªæä¸è½½å¤±è´¥çæ¶åæä¼è¿æ · |
| | | */ |
| | | @RequestMapping(value = "/downloadFilesByOids",method = {RequestMethod.GET,RequestMethod.POST}) |
| | | public String downloadFilesByOids(@RequestParam String fileOids, HttpServletResponse response){ |
| | | try{ |
| | | public void downloadFilesByOids(@RequestParam String fileOids, HttpServletResponse response) throws IOException { |
| | | try { |
| | | //ControllerUtil.writeFileToResponse(response,excelName); |
| | | FileDownloadUtil.downloadFile(response, fileService.downloadFileByOids(VciBaseUtil.str2List(fileOids))); |
| | | }catch (Throwable e){ |
| | | return JSON.toJSONString(R.fail(LangBaseUtil.getErrorMsg(e))); |
| | | } catch (Throwable e) { |
| | | //妿åºé,æé误信æ¯åå°text |
| | | String msg = LangBaseUtil.getErrorMsg(e); |
| | | if(StringUtils.isBlank(msg)){ |
| | | msg = "æªç¥é误"; |
| | | } |
| | | ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null); |
| | | } |
| | | //å 为设置äºååºcontentType,æä»¥è¿å¿ä¸è½åç´æ¥è¿åRäºï¼å¯è½ä¼å¯¼è´æ¥é |
| | | return JSON.toJSONString(R.success("ä¸è½½å®æ")) ; |
| | | } |
| | | |
| | | /** |
| | | * æä»¶å é¤ |
| | | * @param oids æä»¶çä¸»é® |
| | | * @return æä»¶å
容 |
| | | */ |
| | | @DeleteMapping("/deleteFile") |
| | | public R deleteFile(@RequestBody Collection<String> oids){ |
| | | /** |
| | | * æä»¶å é¤ |
| | | * @param oids æä»¶çä¸»é® |
| | | * @return æä»¶å
容 |
| | | */ |
| | | @DeleteMapping("/deleteFile") |
| | | public R deleteFile(@RequestBody Collection<String> oids){ |
| | | try { |
| | | fileService.deleteFiles(oids); |
| | | }catch (Throwable e){ |
| | |
| | | log.debug(msg); |
| | | return R.fail(msg); |
| | | } |
| | | return R.success("å 餿å"); |
| | | } |
| | | return R.success("å 餿å"); |
| | | } |
| | | |
| | | /** |
| | | * å端页é¢åæä»¶ä¸ä¼ ã(å
æ°æ®ï¼åæä»¶æ¨¡å¼ä¸ä¼ ) |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @param fileObjectDTO æä»¶ä¿¡æ¯ä¼ è¾å¯¹è±¡ |
| | | * @return æä»¶ä¿¡æ¯æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping("/uploadFile") |
| | | public R<FileObjectVO> uploadFile(MultipartFile file, FileObjectDTO fileObjectDTO){ |
| | | if (file != null ) { |
| | | return fileService.uploadFile(file, fileObjectDTO); |
| | | } else { |
| | | return R.fail("æ ä¸ä¼ çæä»¶"); |
| | | } |
| | | } |
| | | /** |
| | | * å端页é¢åæä»¶ä¸ä¼ ã(å
æ°æ®ï¼åæä»¶æ¨¡å¼ä¸ä¼ ) |
| | | * @param file ä¸ä¼ çæä»¶ |
| | | * @param fileObjectDTO æä»¶ä¿¡æ¯ä¼ è¾å¯¹è±¡ |
| | | * @return æä»¶ä¿¡æ¯æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping("/uploadFile") |
| | | public R<FileObjectVO> uploadFile(MultipartFile file, FileObjectDTO fileObjectDTO){ |
| | | if (file != null ) { |
| | | return fileService.uploadFile(file, fileObjectDTO); |
| | | } else { |
| | | return R.fail("æ ä¸ä¼ çæä»¶"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¨ä¸ä¼ æä»¶åï¼ä¿åæä»¶çä¿¡æ¯ |
| | | * @param fileObjectDTO æä»¶ä¿¡æ¯ä¼ è¾å¯¹è±¡ |
| | | * @return æä»¶ä¿¡æ¯æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping("/saveFileAfterUpload") |
| | | public R<FileObjectVO> saveFileAfterUpload( @RequestBody FileObjectDTO fileObjectDTO){ |
| | | return fileService.saveFileAfterUpload(fileObjectDTO); |
| | | } |
| | | /** |
| | | * å¨ä¸ä¼ æä»¶åï¼ä¿åæä»¶çä¿¡æ¯ |
| | | * @param fileObjectDTO æä»¶ä¿¡æ¯ä¼ è¾å¯¹è±¡ |
| | | * @return æä»¶ä¿¡æ¯æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping("/saveFileAfterUpload") |
| | | public R<FileObjectVO> saveFileAfterUpload( @RequestBody FileObjectDTO fileObjectDTO){ |
| | | return fileService.saveFileAfterUpload(fileObjectDTO); |
| | | } |
| | | |
| | | /** |
| | | * å°åæ°æ®ä¸çæææä»¶å
±äº«å°å
¶ä»çä¸å¡æ°æ®ä¸ |
| | | * @param shareDTO æä»¶å享 |
| | | * @return æä»¶ä¿¡æ¯æ¾ç¤ºå¯¹è±¡,æ¯å¤ä¸ª |
| | | */ |
| | | @PostMapping("/shareFiles") |
| | | public R<List<FileObjectVO>> shareFiles(@RequestBody FileShareDTO shareDTO){ |
| | | return fileService.shareFiles(shareDTO); |
| | | } |
| | | /** |
| | | * å°åæ°æ®ä¸çæææä»¶å
±äº«å°å
¶ä»çä¸å¡æ°æ®ä¸ |
| | | * @param shareDTO æä»¶å享 |
| | | * @return æä»¶ä¿¡æ¯æ¾ç¤ºå¯¹è±¡,æ¯å¤ä¸ª |
| | | */ |
| | | @PostMapping("/shareFiles") |
| | | public R<List<FileObjectVO>> shareFiles(@RequestBody FileShareDTO shareDTO){ |
| | | return fileService.shareFiles(shareDTO); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * ä¿®æ¹æä»¶ä¿¡æ¯(ä¸å«æä»¶),注æobjectNameåfilePathä¸ä¼åå |
| | | * @param fileDTOs æä»¶çæ°æ®å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PostMapping("/updateFileInfos") |
| | | public R updateFileInfos(@RequestBody Collection<FileObjectDTO> fileDTOs){ |
| | | return fileService.updateFileInfos(fileDTOs); |
| | | } |
| | | /** |
| | | * ä¿®æ¹æä»¶ä¿¡æ¯(ä¸å«æä»¶),注æobjectNameåfilePathä¸ä¼åå |
| | | * @param fileDTOs æä»¶çæ°æ®å¯¹è±¡ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PostMapping("/updateFileInfos") |
| | | public R updateFileInfos(@RequestBody Collection<FileObjectDTO> fileDTOs){ |
| | | return fileService.updateFileInfos(fileDTOs); |
| | | } |
| | | |
| | | /** |
| | | * æä»¶çæ |
| | | * @param ids æä»¶çä¸»é® |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PutMapping("/releasedFiles") |
| | | public R releasedFiles(@RequestBody Collection<String> ids){ |
| | | return fileService.releasedFiles(ids); |
| | | } |
| | | /** |
| | | * æä»¶çæ |
| | | * @param ids æä»¶çä¸»é® |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PutMapping("/releasedFiles") |
| | | public R releasedFiles(@RequestBody Collection<String> ids){ |
| | | return fileService.releasedFiles(ids); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæå®æä»¶ä¸å¡æ°æ®åçæ |
| | | * @param releaseDTOS çæçç¸å
³ä¿¡æ¯ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PutMapping("/releasedFilesForOwn") |
| | | public R releasedFilesForOwn(@RequestBody Collection<FileReleaseDTO> releaseDTOS){ |
| | | return fileService.releasedFilesForOwn(releaseDTOS); |
| | | } |
| | | /** |
| | | * æ¹éæå®æä»¶ä¸å¡æ°æ®åçæ |
| | | * @param releaseDTOS çæçç¸å
³ä¿¡æ¯ |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PutMapping("/releasedFilesForOwn") |
| | | public R releasedFilesForOwn(@RequestBody Collection<FileReleaseDTO> releaseDTOS){ |
| | | return fileService.releasedFilesForOwn(releaseDTOS); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使ç¨ä¸å¡ç±»åæ¥è¯¢æä»¶çä¿¡æ¯ï¼æä¾ç»é¡µé¢è°ç¨ |
| | | * @param fileQuery æ¥è¯¢å¯¹è±¡ |
| | | * @return æä»¶çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @RequestMapping(value = "/listFiles",method = {RequestMethod.GET,RequestMethod.POST}) |
| | | public R<IPage<FileObjectVO>> listFiles(FileQuery fileQuery, Query query){ |
| | | return R.data(fileService.listFiles(fileQuery,query)); |
| | | } |
| | | /** |
| | | * 使ç¨ä¸å¡ç±»åæ¥è¯¢æä»¶çä¿¡æ¯ï¼æä¾ç»é¡µé¢è°ç¨ |
| | | * @param fileQuery æ¥è¯¢å¯¹è±¡ |
| | | * @return æä»¶çæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @RequestMapping(value = "/listFiles",method = {RequestMethod.GET,RequestMethod.POST}) |
| | | public R<IPage<FileObjectVO>> listFiles(FileQuery fileQuery, Query query){ |
| | | return R.data(fileService.listFiles(fileQuery,query)); |
| | | } |
| | | |
| | | /** |
| | | * ä½¿ç¨æä»¶ä¸»é®è·å对象 |
| | | * @param oid ä¸»é® |
| | | * @return æä»¶æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/get") |
| | | public FileObjectVO get(String oid){ |
| | | return fileService.get(oid); |
| | | } |
| | | /** |
| | | * ä½¿ç¨æä»¶ä¸»é®è·å对象 |
| | | * @param oid ä¸»é® |
| | | * @return æä»¶æ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/get") |
| | | public FileObjectVO get(String oid){ |
| | | return fileService.get(oid); |
| | | } |
| | | |
| | | /** |
| | | * ä½¿ç¨æä»¶ç䏻鮿¹éè·å对象 |
| | | * @param oids æä»¶ç主é®éå |
| | | * @return æä»¶çæ¾ç¤ºä¿¡æ¯ |
| | | */ |
| | | @GetMapping("/listFilesByOids") |
| | | public List<FileObjectVO> listFilesByOids( Collection<String> oids){ |
| | | return fileService.listFilesByOids(oids); |
| | | } |
| | | /** |
| | | * ä½¿ç¨æä»¶ç䏻鮿¹éè·å对象 |
| | | * @param oids æä»¶ç主é®éå |
| | | * @return æä»¶çæ¾ç¤ºä¿¡æ¯ |
| | | */ |
| | | @GetMapping("/listFilesByOids") |
| | | public List<FileObjectVO> listFilesByOids( Collection<String> oids){ |
| | | return fileService.listFilesByOids(oids); |
| | | } |
| | | |
| | | } |
| | |
| | | secret-key: Reo4wW8EWF4gSizUmVsNjWfbDZzR3rBYFn5Jehd9 |
| | | bucket-name: vci-ubcs |
| | | |
| | | #å
³é驼峰å½åæ å° |
| | | mybatis-plus: |
| | | configuration: |
| | | map-underscore-to-camel-case: false |
| | |
| | | |
| | | |
| | | <select id="selectAttachPage" resultMap="attachResultMap"> |
| | | select * from blade_attach where is_deleted = 0 |
| | | select * from blade_attach where isdeleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <select id="selectSmsPage" resultMap="smsResultMap"> |
| | | select * from pl_sys_sms where is_deleted = 0 |
| | | select * from pl_sys_sms where isdeleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | try { |
| | | count = dockingPreAttrMappingMapper.selectCount(Wrappers.<DockingPreAttrMapping>query().lambda().eq(DockingPreAttrMapping::getTargetClassifyId, targetClassifyId).eq(DockingPreAttrMapping::getSourceClassifyId,sourceClassifyId)); |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | } finally { |
| | | return count>0?true:false; |
| | | } |
| | |
| | | } |
| | | return R.success(message); |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | log.error("è·åæ°æ®æ¨¡å失败"+e); |
| | | R.fail(message); |
| | | } |
| | |
| | | } |
| | | |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | log.error("è·åç³è¯·åç¶æå¤±è´¥"+e); |
| | | throw new VciBaseException(message); |
| | | } |
| | |
| | | */ |
| | | package com.vci.ubcs.code; |
| | | |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import org.springblade.core.cloud.client.UbcsCloudApplication; |
| | | import org.springblade.core.launch.UbcsApplication; |
| | | import org.springblade.core.launch.constant.AppConstant; |
| | | import org.springframework.context.annotation.ComponentScan; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | /** |
| | | * Codeå¯å¨å¨ |
| | |
| | | this.setHttpToThreadLocal(request); |
| | | result= universalInterfaceI.syncEditData(dataString,dataType); |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | logger.error("syncData->"+e.getMessage()); |
| | | } |
| | | return result; |
| | |
| | | QueryWrapper<SystemClassifyRole> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("systemOid",systemOid); |
| | | wrapper.eq("systemId",systemId); |
| | | List<SystemClassifyRole> systemClassifyRoles = this.listByIds(roleList.stream().map(SystemClassifyRole ::getOid).collect(Collectors.toList()));; |
| | | List<SystemClassifyRole> systemClassifyRoles = this.listByIds(roleList.stream().map(SystemClassifyRole ::getOid).collect(Collectors.toList())); |
| | | this.remove(wrapper); |
| | | List<SystemClassifyRole> newSCRoles = new ArrayList<>(); |
| | | //æ°æ®å¤ç |
| | |
| | | String sqlHasPage = pageHelper.getLimit() > 0 ? ("select * from (select A.*,rownum RN from (" + sql + whereSubfixForPage) : sql; |
| | | String sqlCount = "select count(1) from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) |
| | | + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; |
| | | String sqlId = "select ID from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) |
| | | String sqlId = "select t.ID from " + tableName + SPACE + "t" + SPACE + joinTableList.values().stream().collect(Collectors.joining(SPACE)) |
| | | + (StringUtils.isBlank(whereSql) ? "" : " where ") + whereSql; |
| | | CodeTemplateAttrSqlBO sqlBO = new CodeTemplateAttrSqlBO(); |
| | | sqlBO.setTableName(tableName); |
| | |
| | | String idFieldName = attrVOS.stream().filter(s -> VciQueryWrapperForDO.ID_FIELD.equalsIgnoreCase(s.getId())).findFirst().orElseGet(() -> new CodeClassifyTemplateAttrVO()).getName(); |
| | | getFieldIndexMap(titleRowData, attrNameIdMap, fieldIndexMap); |
| | | //å
ä¸ç¨ç®¡å±æ§æ¯å¦é½åå¨ï¼å
转æ¢ä¸ä¸æ°æ® |
| | | List<ClientBusinessObject> cboList = new CopyOnWriteArrayList<>(); |
| | | List<ClientBusinessObject> cboList = new ArrayList<>(); |
| | | String fullPath = getFullPath(classifyFullInfo); |
| | | //æä»¬éè¦è·åå°ææçä¸çº§åç±»çoidçè·¯å¾ï¼å 为åé¢éè¦ |
| | | Map<String/**主é®**/, String/**è·¯å¾**/> childOidPathMap = getChildClassifyPathMap(classifyFullInfo, fullPath); |
| | |
| | | //æåå¼ç»åè§å |
| | | batchSwitchComponentAttrOnOrder(attrVOS,cboList); |
| | | //3.夿å
³é®å±æ§ |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorMap); |
| | | CodeImportResultVO keyResultVO = batchCheckKeyAttrOnOrder(classifyFullInfo, templateVO, cboList,errorKeyMap); |
| | | Set<String> selfRepeatRowIndexList = keyResultVO.getSelfRepeatRowIndexList(); |
| | | Set<String> keyAttrRepeatRowIndexList = keyResultVO.getKeyAttrRepeatRowIndexList(); |
| | | |
| | | Map<String,List<String>>keyAttrOkOidTORepeatOidMap= keyResultVO.getKeyAttrOkOidTORepeatOidMap(); |
| | | if(!CollectionUtils.isEmpty(selfRepeatRowIndexList)){ |
| | | selfRepeatRowIndexList.stream().forEach(rowIndex->{ |
| | |
| | | resultDataObjectDetailDO.setMsg(errorMap.getOrDefault(rowIndex,"") + ";å
³é®å±æ§ä¸ç³»ç»ä¸çéå¤" ); |
| | | resultDataObjectDetailDOs.add(resultDataObjectDetailDO); |
| | | */ |
| | | errorKeyMap.put(rowIndex, "å
³é®å±æ§ä¸ç³»ç»ä¸çéå¤;" + errorMap.getOrDefault(rowIndex,"")); |
| | | Map<String, List<BaseModel>> indexTODataMap=keyResultVO.getIndexTODataMap(); |
| | | if(indexTODataMap.containsKey(rowIndex)){ |
| | | List<BaseModel> baseModelList= indexTODataMap.get(rowIndex); |
| | | } |
| | | errorKeyMap.put(rowIndex, "å
³é®å±æ§ä¸ç³»ç»ä¸çéå¤;" + errorKeyMap.getOrDefault(rowIndex,"")); |
| | | }); |
| | | } |
| | | //æ ¡éªå±æ§æ¯å¦æ£ç¡®éè¯¯ä¿¡æ¯ |
| | |
| | | return; |
| | | } |
| | | //final String[] sql = {"select count(*) from " + tableName + " t where 1 = 1 "}; |
| | | final String[] sql = {"select id from " + tableName + " t where 1 = 1 "}; |
| | | final String[] sql = {"select t.id from " + tableName + " t where 1 = 1 "}; |
| | | conditionMap.forEach((key, value) -> { |
| | | if(StringUtils.isBlank(value)||value.equals(QueryOptionConstant.ISNULL)){ |
| | | sql[0] += " and " + key + " is null "; |
| | |
| | | if(!CollectionUtils.isEmpty(nullRowIndex)){ |
| | | String checkAttr = requiredAttrMap.values().stream().map(CodeClassifyTemplateAttrVO::getName).collect(Collectors.joining(",")); |
| | | nullRowIndex.stream().forEach(rowIndex->{ |
| | | errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";æ ¡éªè§åä¸éè¿ï¼ææ ¡éªç屿§ä¸º" + checkAttr); |
| | | errorMap.put(rowIndex,errorMap.getOrDefault(rowIndex,"") + ";æ ¡éªè§åå¿
填项ä¸éè¿ï¼å¦ææå¿
填屿§ä¸ºç©ºï¼åå¡«ã/ã代æ¿,ææ ¡éªç屿§ä¸º" + checkAttr); |
| | | }); |
| | | } |
| | | } |
| | |
| | | } |
| | | }); |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | msg="ç¼ç æ´æ¹/ç¶ææ´æ¹/å é¤:"+e.getMessage(); |
| | | /* XMLResultSystemVO XMLResultSystemVO=new XMLResultSystemVO(); |
| | | XMLResultSystemVO.setErrorid(errorid); |
| | |
| | | issucess=true; |
| | | resultData.setLibrary(libraryVo); |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | msg="æ¥è¯¢å类失败:"+e.getMessage(); |
| | | }finally { |
| | | resultData.setErrorid(errorid); |
| | |
| | | msg = "æ¥å£åæ°ï¼library æªæ¥è¯¢å°å¯¹åºçåºèç¹ä¿¡æ¯"; |
| | | } |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | msg="æ¥è¯¢æ°æ®å¤±è´¥:"+e.getMessage(); |
| | | }finally { |
| | | resultDataVO.setErrorid(errorid); |
| | |
| | | issucess=true; |
| | | resultClassifyRuleData.setLibrary(resultLibraryVO); |
| | | }catch (Throwable e){ |
| | | e.printStackTrace();; |
| | | e.printStackTrace(); |
| | | msg="æ¥è¯¢å类失败:"+e.getMessage(); |
| | | }finally { |
| | | resultClassifyRuleData.setErrorid(errorid); |
| | |
| | | |
| | | @Override |
| | | public CodeButtonVO entityVO(CodeButton codebutton) { |
| | | CodeButtonVO codebuttonVO = new CodeButtonVO();; |
| | | CodeButtonVO codebuttonVO = new CodeButtonVO(); |
| | | BeanUtilForVCI.copyPropertiesIgnoreCase(codebutton,codebuttonVO); |
| | | Objects.requireNonNull(codebuttonVO); |
| | | codebuttonVO.setUsedpositiontypeText(DictCache.getValue("codeButtonPosition", codebutton.getUsedPositionType())); |
| | |
| | | return countConfigService.saveMdmCountConfig(mdmCountConfigVO); |
| | | } |
| | | |
| | | |
| | | } |