diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java index 58a4bc6f..3ef59ad8 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/annotation/Excel.java @@ -53,6 +53,9 @@ public @interface Excel */ public int scale() default -1; + public boolean isLink() default false; + + public String linkText() default ""; /** * BigDecimal 舍入规则 默认:BigDecimal.ROUND_HALF_EVEN */ diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index 12a63688..235a4dae 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -27,45 +27,15 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.RegExUtils; import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.poi.hssf.usermodel.HSSFClientAnchor; -import org.apache.poi.hssf.usermodel.HSSFPicture; -import org.apache.poi.hssf.usermodel.HSSFPictureData; -import org.apache.poi.hssf.usermodel.HSSFShape; -import org.apache.poi.hssf.usermodel.HSSFSheet; -import org.apache.poi.hssf.usermodel.HSSFWorkbook; +import org.apache.poi.common.usermodel.HyperlinkType; +import org.apache.poi.hssf.usermodel.*; import org.apache.poi.ooxml.POIXMLDocumentPart; -import org.apache.poi.ss.usermodel.BorderStyle; -import org.apache.poi.ss.usermodel.Cell; -import org.apache.poi.ss.usermodel.CellStyle; -import org.apache.poi.ss.usermodel.CellType; -import org.apache.poi.ss.usermodel.ClientAnchor; -import org.apache.poi.ss.usermodel.DataValidation; -import org.apache.poi.ss.usermodel.DataValidationConstraint; -import org.apache.poi.ss.usermodel.DataValidationHelper; -import org.apache.poi.ss.usermodel.DateUtil; -import org.apache.poi.ss.usermodel.Drawing; -import org.apache.poi.ss.usermodel.FillPatternType; -import org.apache.poi.ss.usermodel.Font; -import org.apache.poi.ss.usermodel.HorizontalAlignment; -import org.apache.poi.ss.usermodel.IndexedColors; -import org.apache.poi.ss.usermodel.Name; -import org.apache.poi.ss.usermodel.PictureData; -import org.apache.poi.ss.usermodel.Row; -import org.apache.poi.ss.usermodel.Sheet; -import org.apache.poi.ss.usermodel.VerticalAlignment; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.streaming.SXSSFWorkbook; -import org.apache.poi.xssf.usermodel.XSSFClientAnchor; -import org.apache.poi.xssf.usermodel.XSSFDataValidation; -import org.apache.poi.xssf.usermodel.XSSFDrawing; -import org.apache.poi.xssf.usermodel.XSSFPicture; -import org.apache.poi.xssf.usermodel.XSSFShape; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.apache.poi.xssf.usermodel.*; import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1016,6 +986,7 @@ public class ExcelUtil { // 创建cell cell = row.createCell(column); + if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge()) { CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column); @@ -1059,7 +1030,20 @@ public class ExcelUtil // 设置列类型 setCellVo(value, attr, cell); } + if(attr.isLink()){ + CreationHelper createHelper= row.getSheet().getWorkbook().getCreationHelper(); + XSSFHyperlink link = (XSSFHyperlink) createHelper.createHyperlink(HyperlinkType.URL); + link.setAddress((String) value); + cell.setHyperlink(link); + if( StringUtils.isNotEmpty (attr.linkText())){ + cell.setCellValue(attr.linkText()); + }else{ + cell.setCellValue(value.toString()); + } + + } addStatisticsData(column, Convert.toStr(value), attr); + } } catch (Exception e) diff --git a/ruoyi-ui/src/views/work/workFile/index.vue b/ruoyi-ui/src/views/work/workFile/index.vue index c736e2e0..ec9c83a0 100644 --- a/ruoyi-ui/src/views/work/workFile/index.vue +++ b/ruoyi-ui/src/views/work/workFile/index.vue @@ -10,7 +10,7 @@ /> - + - - + + + + v-for="dict in depts" + :key="dict.deptId" + :label="dict.deptName" + :value="dict.deptId" + > @@ -97,7 +98,8 @@ @@ -170,6 +172,16 @@ > + + + + + @@ -217,7 +229,8 @@ export default { pageSize: 10, fileBelong: null, fileName: null, - isDel:null + isDel:null, + deptId:0, }, // 表单参数 form: {}, @@ -226,6 +239,9 @@ export default { fileBelong: [ { required: true, message: "请选择文件归属", trigger: "blur" } ], + deptId:[ + { required: true, message: "请选择子公司", trigger: "blur" } + ], remark: [ { required: false}, { max: 200,message: "最多输入200字符" } @@ -233,13 +249,20 @@ export default { }, // 传达时间时间范围 daterangeMarksTime: [], - fileList: [] + fileList: [], + depts: [], }; }, created() { this.getList(); + this.$api.publics.getZgsDeptList().then((d) => { + this.depts = d?.data || []; + }); }, methods: { + doFileBelongChange(){ + this.queryParams.deptId=0; + }, /** 查询文件传达列表 */ getList() { this.loading = true; diff --git a/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/BgWorkFileController.java b/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/BgWorkFileController.java index 9316c630..7ee76317 100644 --- a/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/BgWorkFileController.java +++ b/yanzhu-bigscreen/src/main/java/com/yanzhu/jh/bigscreen/web/controller/BgWorkFileController.java @@ -25,9 +25,10 @@ public class BgWorkFileController extends BaseController { * @return */ @GetMapping("/getWorkFileList") - public TableDataInfo getWorkFileList(String fileBelong){ + public TableDataInfo getWorkFileList(String fileBelong,long deptId){ WorkFile workFile = new WorkFile(); workFile.setFileBelong(fileBelong); + workFile.setDeptId(deptId); return getDataTable(workFileService.selectWorkFileListLimit20(workFile)); } diff --git a/yanzhu-jh/src/main/java/com/yanzhu/jh/trouble/domain/vo/SmzSspProblemmodifyExport.java b/yanzhu-jh/src/main/java/com/yanzhu/jh/trouble/domain/vo/SmzSspProblemmodifyExport.java index 0db3a5a4..d75a9880 100644 --- a/yanzhu-jh/src/main/java/com/yanzhu/jh/trouble/domain/vo/SmzSspProblemmodifyExport.java +++ b/yanzhu-jh/src/main/java/com/yanzhu/jh/trouble/domain/vo/SmzSspProblemmodifyExport.java @@ -2,40 +2,43 @@ package com.yanzhu.jh.trouble.domain.vo; import com.ruoyi.common.annotation.Excel; import com.yanzhu.jh.trouble.domain.SmzSspProblemmodify; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; import java.util.Date; public class SmzSspProblemmodifyExport { - @Excel(name = "项目名称") + @Excel(name = "项目名称",align= HorizontalAlignment.LEFT,width =30 ) private String problemArea; - @Excel(name = "总包单位") + @Excel(name = "总包单位",align= HorizontalAlignment.LEFT,width =30) private String deptName; - - @Excel(name = "隐患类型") + @Excel(name = "隐患图片",isLink = true,color = IndexedColors.BLUE,linkText="查看图片") + private String marksPicture; + @Excel(name = "隐患类型" ,align= HorizontalAlignment.CENTER,width =24) private String dangerType; - @Excel(name = "问题描述") + @Excel(name = "问题描述" ,align= HorizontalAlignment.LEFT,width =32) private String workParts; - @Excel(name = "整改要求") + @Excel(name = "整改要求" ,align= HorizontalAlignment.LEFT,width =30) private String changeInfo; - @Excel(name = "整改截至时间", width = 30, dateFormat = "yyyy-MM-dd HH:ss") + @Excel(name = "整改截至时间", width = 20, dateFormat = "yyyy-MM-dd HH:ss") private Date nickedTime; - @Excel(name = "隐患整改人") + @Excel(name = "隐患整改人",align= HorizontalAlignment.LEFT,width =30) private String lordSent; @Excel(name = "流程状态") private String checkState; - @Excel(name = "复检人") + @Excel(name = "复检人",align= HorizontalAlignment.LEFT,width =30) private String recheckSend; - @Excel(name = "抄送人") + @Excel(name = "抄送人",align= HorizontalAlignment.LEFT,width =30) private String copySend; - @Excel(name = "提交用户") + @Excel(name = "提交用户",align= HorizontalAlignment.LEFT,width =30) private String createBy; - @Excel(name = "提交时间", width = 30, dateFormat = "yyyy-MM-dd HH:ss") + @Excel(name = "提交时间", width = 20, dateFormat = "yyyy-MM-dd HH:ss") private Date createTime; public static SmzSspProblemmodifyExport newItem(SmzSspProblemmodify it) { @@ -52,9 +55,18 @@ public class SmzSspProblemmodifyExport { d.copySend=it.getCopySend()+" "+it.getCopySendUser(); d.createBy=it.getCreateBy()+" "+it.getCreateUser(); d.createTime=it.getCreateTime(); + d.marksPicture="http://62.234.3.186"+it.getMarksPicture(); return d; } + public String getMarksPicture() { + return marksPicture; + } + + public void setMarksPicture(String marksPicture) { + this.marksPicture = marksPicture; + } + public String getProblemArea() { return problemArea; } diff --git a/yanzhu-jh/src/main/java/com/yanzhu/jh/work/domain/WorkFile.java b/yanzhu-jh/src/main/java/com/yanzhu/jh/work/domain/WorkFile.java index 6de38eff..75fdba91 100644 --- a/yanzhu-jh/src/main/java/com/yanzhu/jh/work/domain/WorkFile.java +++ b/yanzhu-jh/src/main/java/com/yanzhu/jh/work/domain/WorkFile.java @@ -58,6 +58,26 @@ public class WorkFile extends BaseEntity private Long readNum; //文件列表 + + private Long deptId; + private String deptName; + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + private List> fileList; public void setId(Long id) diff --git a/yanzhu-jh/src/main/java/com/yanzhu/jh/work/service/impl/WorkFileServiceImpl.java b/yanzhu-jh/src/main/java/com/yanzhu/jh/work/service/impl/WorkFileServiceImpl.java index 4dae5cb7..7295c2e3 100644 --- a/yanzhu-jh/src/main/java/com/yanzhu/jh/work/service/impl/WorkFileServiceImpl.java +++ b/yanzhu-jh/src/main/java/com/yanzhu/jh/work/service/impl/WorkFileServiceImpl.java @@ -80,6 +80,7 @@ public class WorkFileServiceImpl implements IWorkFileService if(fileList!=null && fileList.size()>0){ for(Map fileMap:fileList){ WorkFile lastingModel = new WorkFile(); + lastingModel.setDeptId(workFile.getDeptId()); lastingModel.setFileBelong(workFile.getFileBelong()); lastingModel.setFileType(FileUtils.getFileLastNameUpCase(Convert.toStr(fileMap.get("original")))); lastingModel.setFileName(Convert.toStr(fileMap.get("original"))); diff --git a/yanzhu-jh/src/main/resources/mapper/work/WorkFileMapper.xml b/yanzhu-jh/src/main/resources/mapper/work/WorkFileMapper.xml index a64c6287..1e04fd4a 100644 --- a/yanzhu-jh/src/main/resources/mapper/work/WorkFileMapper.xml +++ b/yanzhu-jh/src/main/resources/mapper/work/WorkFileMapper.xml @@ -20,10 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + - select id, file_belong, file_type, file_name, file_path, file_md5, file_size, is_del, download_num, read_num, create_by, create_time, update_by, update_time, remark from work_file + select id, file_belong, file_type, file_name, file_path, file_md5, file_size, is_del, download_num, read_num, create_by, create_time, update_by, update_time, remark,dept_id,dept_name + from ( SELECT a.*,b.dept_name + FROM work_file a LEFT JOIN sys_dept b ON a.dept_id=b.dept_id ) work_file