diff --git a/jero-boot/db/蔚来标准sql/dev_third_record.sql b/jero-boot/db/蔚来标准sql/dev_third_record.sql index 0468e8dc6..a1169539c 100644 --- a/jero-boot/db/蔚来标准sql/dev_third_record.sql +++ b/jero-boot/db/蔚来标准sql/dev_third_record.sql @@ -1179,10 +1179,10 @@ update onl_cgform_field set is_query = '1', is_read_only = '1' where id = '09fa6 -- 配置表,增加问题知识库预览图片配置 2022-09-27 已同步生产环境 INSERT INTO `laws_weilai`.`sys_config` (`id`, `create_by`, `create_time`, `update_by`, `update_time`, `sys_org_code`, `config`, `config_name`) VALUES ('4', 'admin', '2022-09-28 14:35:30', NULL, NULL, 'A01', 'http://grp.nioint.com/', 'domianWebImgURL'); ---问题知识库,增加字段 发布状态 2022-10-13 未同步生产环境 +--问题知识库,增加字段 发布状态 2022-10-13 已同步生产环境 ALTER TABLE `laws_weilai`.`problem_knowledge_base` ADD COLUMN `release_status` varchar(50) NULL COMMENT '发布状态' AFTER `release_time`; ---处理问题知识库数据,发布人,发布时间,发布状态数据sql 2022-10-13 未同步生产环境 +--处理问题知识库数据,发布人,发布时间,发布状态数据sql 2022-10-13 已同步生产环境 update problem_knowledge_base pkd set pkd.release_status = 'Have released',pkd.release_time = pkd.create_time,pkd.release_user_id = (select su.id from sys_user su where su.username = pkd.create_by) diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java index 6e92fa0dd..d95b68abb 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/CommonController.java @@ -7,7 +7,6 @@ import com.jero.common.api.vo.Result; import com.jero.common.constant.enums.CutEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.api.ISysBaseAPI; -import com.jero.common.system.vo.LoginUser; import com.jero.common.util.RestUtil; import com.jero.common.util.TokenUtils; import com.jero.common.util.oConvertUtils; @@ -19,7 +18,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.shiro.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpHeaders; @@ -27,12 +25,7 @@ import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.util.AntPathMatcher; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -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 org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.HandlerMapping; @@ -41,12 +34,7 @@ import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; +import java.io.*; import java.net.URLDecoder; import java.text.SimpleDateFormat; import java.util.Date; @@ -382,12 +370,13 @@ public class CommonController { fileName = ossFile.getFileName(); response.setContentType("application/force-download");// 设置强制下载不打开 response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes("UTF-8"),"iso-8859-1")); - InputStream download = CosBootUtil.download(filePath); + File file = new File(filePath); if(file.getName().endsWith(".pdf") || file.getName().endsWith(".PDF")){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String currentTime = sdf.format(new Date()); String waterContent = userName+" "+currentTime; + InputStream download = CosBootUtil.download(filePath); newFile = PDFUtils.PDFWatermark(download,uploadpath,file.getName(),waterContent); inputStream = new FileInputStream(newFile.getPath()); }else{ @@ -432,6 +421,83 @@ public class CommonController { } } + /** + * word,excel预览 cos -pdf无水印 + * + * @param id 传入文件id + * @param request + * @param response + */ + @GetMapping(value = "/downLoadFileNOMark") + public void downLoadFileNoPDFWatermarkCos(String id,HttpServletRequest request, HttpServletResponse response,String userName) { + if(StringUtils.isBlank(id)){ + throw new JeroBootException("参数信息不全"); + } + id = id.split("\\.")[0]; + // 查询数据表数据是否存在 + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(OSSFile::getId,id); + OSSFile ossFile = ossFileService.getOne(queryWrapper); + if( null == ossFile){ + throw new JeroBootException("文件不存在"); + } + InputStream inputStream = null; + OutputStream outputStream = null; + File newFile =null; + try { + String fileName = ""; + //本地下载 + String filePath = ossFile.getUrl(); + if(!CosBootUtil.doesObjectExist(filePath)){ + response.setStatus(404); + throw new RuntimeException("文件不存在.."); + } + // 文件名称 + fileName = ossFile.getFileName(); + response.setContentType("application/force-download");// 设置强制下载不打开 + response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes("UTF-8"),"iso-8859-1")); + + File file = new File(filePath); + inputStream = CosBootUtil.download(filePath); + outputStream = response.getOutputStream(); + byte[] buf = new byte[1024]; + int len; + while ((len = inputStream.read(buf)) > 0) { + outputStream.write(buf, 0, len); + } + response.flushBuffer(); + } catch (IOException e) { + log.error("文件下载失败" + e.getMessage()); + response.setStatus(404); + e.printStackTrace(); + } finally { + if (inputStream != null) { + try { + inputStream.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + } + if (outputStream != null) { + try { + outputStream.close(); + } catch (IOException e) { + log.error(e.getMessage(), e); + } + + } + if (newFile != null) { + try { + newFile.delete(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + + } + + } + } + /** * 文件下载 * diff --git a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java index 4a67f32ad..e4198f9f9 100644 --- a/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java +++ b/jero-boot/jero-boot-module-system/src/main/java/com/jero/modules/system/controller/SysUserController.java @@ -127,10 +127,24 @@ public class SysUserController { public Result> queryPageList(SysUser user, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { Result> result = new Result>(); - QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(user, req.getParameterMap()); + Map reqMap = req.getParameterMap(); + Map newReqMap = new HashMap<>(); + for (String key : reqMap.keySet()){ + if(!key.equals("orgCode")){ + newReqMap.put(key,reqMap.get(key)); + } + } + user.setOrgCode(null); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(user, newReqMap); //TODO 外部模拟登陆临时账号,列表不显示 queryWrapper.ne("username", "_reserve_user_external"); - Page page = new Page(pageNo, pageSize); + String[] orgCode = reqMap.get("orgCode"); + if(null != orgCode && orgCode.length > 0){ + List orgCodeList = sysDepartService.getSubDepIdsByDepId(orgCode[0]); + orgCodeList.add(orgCode[0]); + queryWrapper.in("org_code",orgCodeList); + } + Page page = new Page<>(pageNo, pageSize); IPage pageList = sysUserService.page(page, queryWrapper); //批量查询用户的所属部门 @@ -1549,6 +1563,12 @@ public class SysUserController { for (SysDepartTreeModel sdtm: departTreeModelList) { dutList.addAll(findChildNode(sdtm)); } + SysUser admin = sysUserService.getUserByName("admin"); + DepartUserTree dut = new DepartUserTree(); + dut.setId(admin.getId()); + dut.setName(admin.getUsername()); + dut.setType("User"); + dutList.add(dut); result.setResult(dutList); result.setSuccess(true); return result; diff --git a/jero-web/src/components/CollectionType/index.vue b/jero-web/src/components/CollectionType/index.vue index 2f8d6386c..2b59628ee 100644 --- a/jero-web/src/components/CollectionType/index.vue +++ b/jero-web/src/components/CollectionType/index.vue @@ -652,7 +652,7 @@ + :detailDate='detailDate' watermark='download'> @@ -667,6 +667,10 @@ type: Object, default: {}, require: true + }, + watermark: { + type: String, + default: '' } }, data() { diff --git a/jero-web/src/components/uploadFileChangeDown/file.vue b/jero-web/src/components/uploadFileChangeDown/file.vue index e742821cb..19b236668 100644 --- a/jero-web/src/components/uploadFileChangeDown/file.vue +++ b/jero-web/src/components/uploadFileChangeDown/file.vue @@ -43,7 +43,7 @@ import { mapGetters } from 'vuex' export default { name: 'file', - props: ['disableds', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile', 'detailDate'], + props: ['disableds', 'thisFileUploadUrl', 'readonly', 'thisFileType', 'isUploadFile', 'detailDate','watermark'], data() { return { visible: false, @@ -91,7 +91,11 @@ import { mapGetters } from 'vuex' methods: { ...mapGetters(['userInfo']), download() { - downloadFile('/sys/common/downLoadFile', this.template.templateName, { id: this.template.templateId }) + if(this.watermark == 'download'){ + downloadFile('/sys/common/downLoadFileNOMark', this.template.templateName, { id: this.template.templateId }) + } else { + downloadFile('/sys/common/downLoadFile', this.template.templateName, { id: this.template.templateId }) + } }, perentHandleFunc(data) { this.myfileList = data @@ -220,7 +224,11 @@ import { mapGetters } from 'vuex' // let url = window._CONFIG['onlinePreviewDomainURL'] + '?url=' + Base64.encode(this.downLoadFileUrl + '/' + fileQuery.id + fileSuffix) // window.open(url, '_blank') // } else { + if(this.watermark == 'download'){ + downloadFile('/sys/common/downLoadFileNOMark', fileQuery.fileName, { id: fileQuery.id }) + }else { downloadFile('/sys/common/downLoadFile', fileQuery.fileName, { id: fileQuery.id }) + } // } } }