中扬CRM客户关系管理系统
#
LSH
2023-11-28 4d70d2fce0e3dd5f0842cb8161181107dca1d55a
src/main/java/com/zy/crm/manager/controller/ContractController.java
@@ -105,7 +105,13 @@
            }
        }
        if (!signUserId && !signDeptId){
            wrapper.eq("user_id", getUserId());
            if (getRole().getId()==1){
                wrapper.or().eq("host_id",1);
            }else if (getRole().getId()==2){
                wrapper.eq("dept_id",getDeptId());
            }else {
                wrapper.eq("user_id", getUserId());
            }
        }
        if (signHostId){
            wrapper.or().eq("host_id",1);
@@ -265,7 +271,7 @@
        //文件后缀名
        String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
        //上传文件名
        String filename = format.format(new Date()) + suffix;
        String filename = format.format(new Date()) + "_" + file.getOriginalFilename();
        //最终文件路径
        String filepath = path + "/" + filename;
        //OSS文件存储路径
@@ -293,20 +299,17 @@
    @RequestMapping(value = "/contract/download/auth")
    @ManagerAuth(memo = "下载合同")
    public ResponseEntity<InputStreamResource> download(@RequestParam("id") Integer id) {
    public R download(@RequestParam("id") Integer id) {
        Contract contract = contractService.selectById(id);
        if (contract == null) {
            return null;
            return R.error();
        }
        if (Cools.isEmpty(contract.getFilepath())) {
            return null;
            return R.error();
        }
        try {
            return ossService.downloadFile(contract.getFilepath());//从OSS中下载文件
        } catch (Exception e) {
            return null;
        }
        String download = ossService.download(contract.getFilepath());//获取OSS临时下载URL
        return R.ok().add(download);
    }
    @RequestMapping(value = "/contract/export/auth")