Merge branch 'develop_3' into 'develop_master'
Develop 3 See merge request !58
This commit is contained in:
@@ -37,6 +37,12 @@
|
||||
<artifactId>UserAgentUtils</artifactId>
|
||||
<version>1.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
<version>5.5.13</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package com.adc.da.util;
|
||||
|
||||
import com.itextpdf.text.BaseColor;
|
||||
import com.itextpdf.text.Element;
|
||||
import com.itextpdf.text.Rectangle;
|
||||
import com.itextpdf.text.pdf.*;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
/**
|
||||
* @Description:水印
|
||||
* @Author: super_liu
|
||||
@@ -15,7 +23,7 @@ public class WaterMarkUtil {
|
||||
*/
|
||||
public static boolean waterMark(String inputFile,
|
||||
String outputFile, String waterMarkName) {
|
||||
/* try {
|
||||
try {
|
||||
PdfReader reader = new PdfReader(inputFile);
|
||||
Field f = PdfReader.class.getDeclaredField("encrypted");
|
||||
f.setAccessible(true);
|
||||
@@ -65,8 +73,7 @@ public class WaterMarkUtil {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}*/
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.adc.da.main.file;
|
||||
|
||||
import org.springframework.boot.web.servlet.MultipartConfigFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.unit.DataSize;
|
||||
|
||||
import javax.servlet.MultipartConfigElement;
|
||||
|
||||
@Configuration
|
||||
public class FileUploadConfiuration {
|
||||
@Bean
|
||||
public MultipartConfigElement multipartConfigElement() {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
//单个文件大小200mb
|
||||
factory.setMaxFileSize(DataSize.ofMegabytes(200L));
|
||||
//设置总上传数据大小10GB
|
||||
factory.setMaxRequestSize(DataSize.ofGigabytes(10L));
|
||||
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.adc.da.slrs.sarResource.dao;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -19,4 +20,6 @@ public interface TsResourceDao extends BaseMapper<TsResource> {
|
||||
|
||||
List<TsResource> selectMenuByRole(TsResource sarMenuEO);
|
||||
|
||||
int insertTsRoleResource(HashMap<String,Object> map);
|
||||
|
||||
}
|
||||
|
||||
+9
@@ -7,6 +7,7 @@ import com.adc.da.login.util.UserUtils;
|
||||
import com.adc.da.slrs.sarResource.dao.TsResourceDao;
|
||||
import com.adc.da.slrs.sarResource.entity.TsResource;
|
||||
import com.adc.da.slrs.sarResource.service.ITsResourceService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.adc.da.utils.treetool.Tree;
|
||||
import com.adc.da.utils.treetool.TreeNode;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
@@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -145,6 +147,7 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
tsResourceQueryWrapper.eq("sor_divide",tsResource.getSorDivide());
|
||||
}
|
||||
tsResourceQueryWrapper.isNull("PARENT_ID");
|
||||
tsResourceQueryWrapper.orderByAsc("DISPLAY_SEQ");
|
||||
List<TsResource> TsResources=dao.selectList(tsResourceQueryWrapper);
|
||||
for(TsResource TsResource:TsResources){
|
||||
TsResource.setChildren(recursionGetChildren((TsResource)));
|
||||
@@ -166,6 +169,12 @@ public class TsResourceServiceImpl extends ServiceImpl<TsResourceDao, TsResource
|
||||
}
|
||||
}
|
||||
dao.insert(TsResource);
|
||||
// 把新生成的子目录加入用户的权限的下----插入ts_role_resource表
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("resourceId",TsResource.getId());
|
||||
map.put("roleId",1);
|
||||
dao.insertTsRoleResource(map);
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -22,6 +22,7 @@ import io.swagger.annotations.Api;
|
||||
import com.adc.da.base.web.BaseController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -59,8 +60,22 @@ public class SarStandAttrDetailsController extends BaseController<SarStandAttrDe
|
||||
// 标准属性字段
|
||||
List<SarStandAttrDetails> getInlandStandList = InitStandAttrUtil.standInlandAttrFieldList;
|
||||
resultMap.put(SarTypeEnum.INLAND_STAND.getValue(),getInlandStandList);
|
||||
|
||||
|
||||
List<SarStandAttrDetails> getForeignStandList = InitStandAttrUtil.standForeignAttrFieldList;
|
||||
//新增字段
|
||||
// Iterator<SarStandAttrDetails> iterator = getInlandStandList.iterator();
|
||||
// while (iterator.hasNext()){
|
||||
// SarStandAttrDetails next = iterator.next();
|
||||
//
|
||||
// if (next.getAttrName().matches("能源类型|适用产品线|适用认证|责任工程师|关联文件")){
|
||||
// getForeignStandList.add(next);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
resultMap.put(SarTypeEnum.FOREIGN_STAND.getValue(),getForeignStandList);
|
||||
|
||||
|
||||
// 政策属性字段
|
||||
List<SarStandAttrDetails> getInlandLawsList = InitStandAttrUtil.lawsInlandAttrFieldList;
|
||||
resultMap.put(SarTypeEnum.INLAND_LAWS.getValue(),getInlandLawsList);
|
||||
|
||||
+18
-10
@@ -185,16 +185,24 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
*/
|
||||
public List<SarStandardsInfo> getSarStandardsInfoPage(SarStandardsInfoEOPage page) throws Exception {
|
||||
//查询当前登录人角色拥有权限的菜单
|
||||
List<String> getMenuIdList=tsUserService.getResourceId(new TsResource());
|
||||
// List<String> getMenuIdList = sarMenuEOService.queryRoleMenuIdList(page.getStandType() + "_STAND", null);
|
||||
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
|
||||
page.setMenuRoleList(getMenuIdList);
|
||||
} else {
|
||||
page.setMenuRoleList(null);
|
||||
}
|
||||
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
|
||||
if (ids != null && !ids.isEmpty()) {
|
||||
page.setMenuAllChildrenIdList(ids);
|
||||
if(page.getMenuId() != null ){
|
||||
QueryWrapper<TsResource> qw = new QueryWrapper<>();
|
||||
qw.eq("ID",page.getMenuId());
|
||||
qw.isNull("PARENT_ID");
|
||||
List<TsResource> children = iTsResourceService.list(qw);
|
||||
if(children.isEmpty() && !page.getMenuId().equals("nomenu")){
|
||||
List<String> getMenuIdList = tsUserService.getResourceId(new TsResource());
|
||||
if (getMenuIdList != null && !getMenuIdList.isEmpty()) {
|
||||
page.setMenuRoleList(getMenuIdList);
|
||||
} else {
|
||||
page.setMenuRoleList(null);
|
||||
}
|
||||
List<String> ids = iTsResourceService.getChildMenuList(page.getMenuId());
|
||||
if (ids != null && !ids.isEmpty()) {
|
||||
page.setMenuAllChildrenIdList(ids);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Integer rowCount = dao.getSarStandardsInfoCount(page);
|
||||
page.getPager().setRowCount(rowCount);
|
||||
|
||||
@@ -30,8 +30,9 @@ public class FieldConvertUtil {
|
||||
public static String exportBaseFieldNames = "标准体系,是否纳入认证清单,标准性质,标准类别,标准编号,标准年份,中文名称,英文名称," +
|
||||
"文本状态,发布日期"; // 导出基础表字段 //删除 实施日期 2021-05-28
|
||||
|
||||
public static String exportBaseFieldNamesForeign = "重要度,标准类别,标准编号,标准年份/系列,中文名称,英文名称," +
|
||||
"标准状态,发布日期,文本说明"; // 导出基础表字段
|
||||
public static String exportBaseFieldNamesForeign = "标准类别,标准编号,标准年份,中文名称,英文名称," +
|
||||
"文本状态,发布日期,文本说明,是否纳入认证清单,体系类别,标签,适用产品线,适用认证,能源类型,责任工程师," +
|
||||
"关联文件,发布稿,增补件,勘误件,草案"; // 导出基础表字段
|
||||
|
||||
public static String exportAttrFieldNamesInland = "归口管理部门,发布机构,工作组信息,我司参与深度,适用车辆类型,要求类型," +
|
||||
"标签,发布稿(必读),增补件(必读),报批稿,送审稿,征求意见稿,草案,相关资料,新车型实施日期(文本),在产车实施日期(文本)," +
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
<result column="remarks" property="remarks" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
||||
<!-- SAR_MENU table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
parent_id, menu_name, sor_divide, id, modify_time, creation_time, valid_flag, display_seq, parent_ids, remarks
|
||||
@@ -69,6 +71,12 @@
|
||||
</trim>
|
||||
</sql>
|
||||
|
||||
|
||||
<insert id="insertTsRoleResource" parameterType="java.util.Map">
|
||||
INSERT INTO ts_role_resource
|
||||
VALUES(#{roleId},#{resourceId} )
|
||||
</insert>
|
||||
|
||||
<!-- 插入记录 -->
|
||||
<insert id="insert" parameterType="com.adc.da.slrs.sarResource.entity.TsResource" >
|
||||
<!-- <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
|
||||
|
||||
@@ -77,6 +77,28 @@
|
||||
<artifactId>dom4j</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- pdf -->
|
||||
<dependency>
|
||||
<groupId>com.lowagie</groupId>
|
||||
<artifactId>itext</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.lowagie</groupId>
|
||||
<artifactId>itextasian</artifactId>
|
||||
<version>2.1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itextpdf</artifactId>
|
||||
<version>5.5.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itextpdf</groupId>
|
||||
<artifactId>itext-asian</artifactId>
|
||||
<version>5.2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
package com.adc.da.att.controller;
|
||||
|
||||
import com.adc.da.att.dao.UserDao;
|
||||
import com.adc.da.att.entity.AttFileEO;
|
||||
import com.adc.da.att.entity.TsUser;
|
||||
import com.adc.da.att.service.IAttFileEOService;
|
||||
import com.adc.da.att.vo.AttFileVo;
|
||||
import com.adc.da.file.store.IFileStore;
|
||||
import com.adc.da.http.ResponseMessage;
|
||||
import com.adc.da.http.Result;
|
||||
import com.adc.da.sys.entity.UserEO;
|
||||
import com.adc.da.util.MD5Util;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.adc.da.util.WaterMarkUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
@@ -46,6 +50,9 @@ public class AttFileEOController {
|
||||
@Autowired
|
||||
private IFileStore iFileStore;
|
||||
|
||||
@Autowired
|
||||
private UserDao userDao;
|
||||
|
||||
@Value("${file.path}")
|
||||
private String filePath;//文件存储路径
|
||||
|
||||
@@ -249,7 +256,7 @@ public class AttFileEOController {
|
||||
@ApiOperation(value = "|File|下载文件加水印")
|
||||
@GetMapping("/downloadFileForSarWaterMark")
|
||||
// @RequiresPermissions("sys:file:downloadFileForSar")
|
||||
public void downloadFileForSarWaterMark(String fileId, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
public void downloadFileForSarWaterMark(String userId,String fileId, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
AttFileEO attFileEO = attFileEOService.getFileInfo(fileId);
|
||||
InputStream is = null;
|
||||
OutputStream os = null;
|
||||
@@ -265,24 +272,39 @@ public class AttFileEOController {
|
||||
}
|
||||
String waterFilePath = newFilePath + attFileEO.getOldFileName();
|
||||
// 添加水印
|
||||
String waterContent = "";
|
||||
// String userId = LoginUserUtil.getUserId();
|
||||
// String userMsg = "";
|
||||
// UserEO userEO = userEOService.selectByPrimaryKey(userId);
|
||||
// if (userEO != null) {
|
||||
// userMsg = userEO.getUname() + ",";
|
||||
// if (StringUtils.isNotEmpty(userEO.getWorkNum())) {
|
||||
// userMsg += userEO.getWorkNum() + ",";
|
||||
// }
|
||||
// }
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");//设置日期格式
|
||||
String date = df.format(new Date());
|
||||
// waterContent = userMsg + date;
|
||||
String userMsg = "";
|
||||
String date="";
|
||||
TsUser tsUser = userDao.selectById(userId);
|
||||
if (tsUser != null) {
|
||||
userMsg = tsUser.getUname() + ",";
|
||||
if (StringUtils.isNotEmpty(tsUser.getWorkNum())) {
|
||||
userMsg += tsUser.getWorkNum() + ",";
|
||||
}
|
||||
}else {
|
||||
//没有用户信息时
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");//设置日期格式
|
||||
date = df.format(new Date());
|
||||
}
|
||||
|
||||
String waterContent = userMsg + date;
|
||||
//2020年9月5日 去掉水印处理
|
||||
// WaterMarkUtil.waterMark(oldFilePath,waterFilePath,waterContent);
|
||||
//2021年7月25日要求下载生成水印
|
||||
WaterMarkUtil.waterMark(oldFilePath,waterFilePath,waterContent);
|
||||
response.setHeader("Content-Disposition", "attachment;filename=\""+fileOldName+"\"");
|
||||
response.setContentType("application/octet-stream");
|
||||
File file = new File(filePath+attFileEO.getFilePath()+attFileEO.getFileName());
|
||||
|
||||
String downloadFilePath="";
|
||||
String fileName=attFileEO.getFileName();
|
||||
String suffix=fileName.substring(fileName.lastIndexOf(".")+1);
|
||||
//只能在pdf中添加水印,
|
||||
//非pdf文件直接下载原文件
|
||||
if (suffix.equals("pdf")){
|
||||
downloadFilePath=waterFilePath;
|
||||
}else {
|
||||
downloadFilePath=oldFilePath;
|
||||
}
|
||||
|
||||
File file = new File(downloadFilePath);
|
||||
is = new FileInputStream(file);
|
||||
os = response.getOutputStream();
|
||||
IOUtils.copy(is, os);
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.adc.da.att.dao;
|
||||
|
||||
import com.adc.da.att.entity.TsUser;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
public interface UserDao extends BaseMapper<TsUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.adc.da.att.entity;
|
||||
|
||||
import com.adc.da.base.entity.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class TsUser extends BaseEntity implements Serializable {
|
||||
@TableId
|
||||
private String usid;
|
||||
@TableField
|
||||
private String uname;
|
||||
@TableField
|
||||
private String workNum;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user