update code

dev_xds
haha 2023-09-15 00:22:38 +08:00
parent 4f74fb35f7
commit 64f878f661
8 changed files with 112 additions and 59 deletions

View File

@ -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
*/

View File

@ -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<T>
{
// 创建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<T>
// 设置列类型
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)

View File

@ -10,7 +10,7 @@
/>
</el-form-item>
<el-form-item label="文件归属" prop="fileBelong">
<el-select v-model="queryParams.fileBelong" placeholder="请选择文件归属" clearable>
<el-select v-model="queryParams.fileBelong" placeholder="请选择文件归属" clearable @change="doFileBelongChange">
<el-option
v-for="dict in dict.type.work_file_belong"
:key="dict.value"
@ -19,14 +19,15 @@
/>
</el-select>
</el-form-item>
<el-form-item label="文件状态" prop="isDel">
<el-select v-model="queryParams.isDel" placeholder="请选择文件归属" clearable>
<el-form-item label="子公司" v-show="queryParams.fileBelong==3">
<el-select v-model="queryParams.deptId" placeholder="请选择子公司" clearable>
<el-option label="产发集团" :value="0"></el-option>
<el-option
v-for="dict in dict.type.sys_common_isdel"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
v-for="dict in depts"
:key="dict.deptId"
:label="dict.deptName"
:value="dict.deptId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="上传时间">
@ -97,7 +98,8 @@
<el-table-column label="主键" align="center" prop="id" v-if="false"/>
<el-table-column label="文件归属" align="center" width="80" prop="fileBelong">
<template slot-scope="scope">
<dict-tag :options="dict.type.work_file_belong" :value="scope.row.fileBelong"/>
<dict-tag :options="dict.type.work_file_belong" :value="scope.row.fileBelong" v-if="scope.row.fileBelong<3"/>
<span v-else>{{ scope.row.deptName}}</span>
</template>
</el-table-column>
<el-table-column label="文件名称" align="left" prop="fileName" show-overflow-tooltip width="300"/>
@ -170,6 +172,16 @@
></el-option>
</el-select>
</el-form-item>
<el-form-item label="子公司" v-if="form.fileBelong==3" prop="deptId">
<el-select v-model="form.deptId" placeholder="请选择子公司" clearable>
<el-option
v-for="dict in depts"
:key="dict.deptId"
:label="dict.deptName"
:value="dict.deptId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="上传文件" prop="fileData">
<FileUpload @input="fileInput"/>
</el-form-item>
@ -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;

View File

@ -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));
}

View File

@ -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;
}

View File

@ -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<Map<String,Object>> fileList;
public void setId(Long id)

View File

@ -80,6 +80,7 @@ public class WorkFileServiceImpl implements IWorkFileService
if(fileList!=null && fileList.size()>0){
for(Map<String,Object> 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")));

View File

@ -20,10 +20,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
</resultMap>
<sql id="selectWorkFileVo">
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
</sql>
<select id="selectWorkFileList" parameterType="WorkFile" resultMap="WorkFileResult">
@ -31,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="isDel != null "> and is_del = #{isDel}</if>
<if test="fileBelong != null and fileBelong != ''"> and file_belong = #{fileBelong}</if>
<if test="deptId != null and deptId>0"> and dept_id = #{deptId}</if>
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
<if test="params.beginMarksTime != null and params.beginMarksTime != '' and params.endMarksTime != null and params.endMarksTime != ''"> and create_time between #{params.beginMarksTime} and #{params.endMarksTime}</if>
</where>
@ -42,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
and is_del = 0
<if test="fileBelong != null and fileBelong != ''"> and file_belong = #{fileBelong}</if>
<if test="deptId!=null and deptId>0">and dept_id =#{deptId}</if>
</where>
order by create_time desc
Limit 20
@ -69,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="deptId != null">dept_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fileBelong != null">#{fileBelong},</if>
@ -85,6 +92,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="deptId != null">#{deptId},</if>
</trim>
</insert>
@ -105,6 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
</trim>
where id = #{id}
</update>