Commit e2abea94 by liangkaiping

copy

parent ce27cec6
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.5.RELEASE" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.26" level="project" />
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.7.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.7.RELEASE" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.1.5.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.9.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.7.RELEASE" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cloud-documents</artifactId>
<groupId>com.yizhi</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.yizhi</groupId>
<artifactId>cloud-documents-api</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-common-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-orm</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-util</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.yizhi.documents.application.enums;
import lombok.Data;
public enum DocumentType {
DOCUMENT(1,"文档"),
PICTURE(2,"图片"),
AUDIO(3,"音频"),
VIDEO(4,"视频"),
OTHER(5,"其他");
private Integer type;
private String typeName;
DocumentType(Integer type, String typeName) {
this.type = type;
this.typeName = typeName;
}
public Integer getType() {
return type;
}
public String getTypeName() {
return typeName;
}
}
package com.yizhi.documents.application.enums;
public enum TermialType {
//类型:1、PC; 2、weixin; 3、app; 4、manage
PC(1, "PC端"),
WEIXIN(2, "微信端"),
APP(3, "APP端"),
MANAGE(4, "管理端");
private Integer type;
private String typeName;
TermialType(Integer type, String typeName) {
this.type = type;
this.typeName = typeName;
}
public Integer getType() {
return type;
}
public String getTypeName() {
return typeName;
}
}
package com.yizhi.documents.application.feign;
import com.yizhi.documents.application.vo.documents.DocumentClassifyTreeVo;
import com.yizhi.documents.application.vo.documents.DocumentClassifyVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@FeignClient(name = "documents", contextId = "DocumentClassifyClient")
public interface DocumentClassifyClient {
@PostMapping("/classify/save")
public ParamsVo save(@RequestBody DocumentClassifyVo classify);
@PostMapping("/classify/update")
public Boolean update(@RequestBody DocumentClassifyVo classifyVo);
@GetMapping("/classify/delete")
public ParamsVo delete(@RequestParam(value = "id") Long id);
@GetMapping("/classify/query")
public List<DocumentClassifyTreeVo> queryClassfy(@RequestParam(value = "showThirdClassfy") Boolean showThirdClassfy);
@GetMapping("/classify/queryById")
public DocumentClassifyVo queryById(@RequestParam("id") Long id);
}
package com.yizhi.documents.application.feign;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.documents.application.vo.documents.DocumentParamVo;
import com.yizhi.documents.application.vo.documents.DocumentVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import com.yizhi.documents.application.vo.documents.UploadVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@FeignClient(name = "documents", contextId = "DocumentClient")
public interface DocumentClient {
@PostMapping("/document/upload")
public Boolean upload(@RequestBody UploadVo uploadVo);
@GetMapping("/document/delete")
public ParamsVo delete(@RequestParam("documentId") Long documentId, @RequestParam("needDelete") Boolean needDelete);
@PostMapping("/document/query/onCondition")
public Page<DocumentVo> query(@RequestBody DocumentParamVo documentParamVo);
@PostMapping("/document/update")
public ParamsVo update(@RequestBody UploadVo uploadVo);
@GetMapping("/document/query/byId")
public DocumentVo queryById(@RequestParam("id") Long id);
@GetMapping("/document/download")
public ParamsVo download(@RequestParam("id") Long id, @RequestParam("termialType") Integer termialType);
@GetMapping("/document/query/ByRelationId")
public Page<DocumentVo> queryByIds(@RequestParam("relationId") Long relationId,
@RequestParam("relationType") Integer relationType,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);
@PostMapping("/document/export/list")
public void export(@RequestBody DocumentParamVo documentParamVo);
@PostMapping("/document/verifyVedio")
public boolean verifyVedio(@RequestBody List<Long> documentIds);
@PostMapping("/document/updateVedioTranscodeUrl")
public boolean updateVedioTranscodeUrl(@RequestBody Map<String, String> map);
}
package com.yizhi.documents.application.feign;
import com.yizhi.documents.application.vo.documents.DocumentRelationVo;
import com.yizhi.documents.application.vo.documents.ModelVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@FeignClient(name = "documents", contextId = "DocumentRelationClient")
public interface DocumentRelationClient {
@PostMapping("/documentRelation/delete")
public Boolean delete(@RequestBody ModelVo modelVo);
@PostMapping("/documentRelation/batch/save")
public Boolean save(@RequestBody DocumentRelationVo documentRelationVo);
@PostMapping("/documentRelation/move")
public Boolean move(@RequestBody DocumentRelationVo documentRelationVo);
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Api("储存第一层分类")
@Data
public class DocumentClassifyTreeVo {
@ApiModelProperty(value = "分类信息")
private DocumentClassifyVo classifyVo;
@ApiModelProperty(value = "储存第二层分类")
private List<SecondClassifyVo> children = new ArrayList<>();
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "ClassifyVo", description = "")
public class DocumentClassifyVo {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "分类父id 一级分类则为0")
private Long parentId;
@ApiModelProperty(value = "顶层节点id 一级分类则为0")
private Long rootId;
@ApiModelProperty(value = "分类层级")
private Integer layer;
@ApiModelProperty(value = "分类名称")
private String name;
@ApiModelProperty(value = "分类编码")
private Integer code;
@ApiModelProperty(value = "分类描述")
private String description;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "编码名称 站点内从1000开始自增,显示为1000-一级分类 以 code+name 组成")
private String codeName;
@ApiModelProperty(value = "父分类的分类名称")
private String parentName;
}
package com.yizhi.documents.application.vo.documents;
import com.yizhi.core.application.context.RequestContext;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(value = "资料查询所需参数")
public class DocumentParamVo {
@ApiModelProperty(value = "是否过滤类型 默认不过滤")
private Integer enableTypeFilter;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "资料名称或编码")
private String name;
@ApiModelProperty(value = "资料类型")
private Integer type;
@ApiModelProperty(value = "关联模块类型:1、课程;2、培训项目")
private Integer relationType;
@ApiModelProperty(value = "关联的模块id")
private Long relationId;
@ApiModelProperty(value = "是否过滤 默认过滤")
private Boolean enableFilter = true;
@ApiModelProperty(value = "分页页码")
private Integer pageNo = 1;
@ApiModelProperty(value = "分页行数")
private Integer pageSize = 10;
@ApiModelProperty(value = "任务名称")
private String taskName;
@ApiModelProperty(value = "任务序号")
private String serialNo;
@ApiModelProperty(value = "任务id")
private Long taskId;
@ApiModelProperty("上下文信息")
private RequestContext context;
@ApiModelProperty(value = "开始时间")
private String startDate;
@ApiModelProperty(value = "结束时间")
private String endDate;
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DocumentRelationVo", description = "")
public class DocumentRelationVo {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "资料ids")
private List<Long> documentIds;
@ApiModelProperty(value = "关联模块类型:1、课程;2、培训项目")
private Integer relationType;
@ApiModelProperty(value = "关联的模块id")
private Long relationId;
@ApiModelProperty(value = "是否上移 true:上移 false:下移")
private Boolean moveUp;
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.annotations.TableField;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DocumentVo", description = "")
public class DocumentVo {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "资料关联关系id")
private Long documentRelationId;
@ApiModelProperty(value = "序号")
private Integer no;
@ApiModelProperty(value = "前端回显需要")
private String uId;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "资料名称")
private String name;
@ApiModelProperty(value = "资料编码需要")
private Integer code;
@ApiModelProperty(value = "资料编码名称")
private String codeName;
@ApiModelProperty(value = "下载次数")
private Integer downloadTimes;
@ApiModelProperty(value = "资料大小")
private Double fileSize;
@ApiModelProperty(value = "资料大小名称")
private String fileSizeName;
@ApiModelProperty(value = "资料大小名称")
private String fileName;
@ApiModelProperty(value = "资料类型 :1、文档;2、图片;3、音频;4、视频;5、其他")
private Integer type;
@ApiModelProperty(value = "资料类型名称 :1、文档;2、图片;3、音频;4、视频;5、其他")
private String typeName;
@ApiModelProperty(value = "下载路径")
private String url;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "上传人名称")
private String createAccounName;
@ApiModelProperty(value = "文件后缀名称")
private String suffixName;
@ApiModelProperty(value = "关键词,逗号分隔")
private String keywords;
@TableField("video_ld")
private String videoLd;
@TableField("video_sd")
private String videoSd;
@TableField("video_hd")
private String videoHd;
@ApiModelProperty(notes = "是否是视频文件,0否,1是")
@TableField(value = "is_video")
private Integer isVideo;
private List<PdfPagesVo> pdfPageVos;
}
package com.yizhi.documents.application.vo.documents;
import com.yizhi.core.application.context.RequestContext;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class DownloadParamsVo {
@ApiModelProperty (value = "资料ID")
private Long documentId;
@ApiModelProperty(value = "资料名字")
private String documentName;
@ApiModelProperty(value = "上下文")
private RequestContext context;
@ApiModelProperty(value = "任务名称")
private String taskName;
@ApiModelProperty(value = "任务序号")
private String serialNo;
@ApiModelProperty(value = "任务id")
private Long taskId;
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api("参数Vo")
public class ModelVo {
@ApiModelProperty(value = "相应泛型id主键 必传!!!")
private Long id;
@ApiModelProperty(value = "是否强制删除")
private Boolean needDelete;
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "ParamsVo", description = "储存返回信息")
public class ParamsVo {
@ApiModelProperty("错误信息")
private String errorMsg;
@ApiModelProperty("是否成功")
private Boolean success;
@ApiModelProperty("返回数据")
private Object successData;
}
package com.yizhi.documents.application.vo.documents;
import lombok.Data;
@Data
public class PdfPage{
private String imageUrl;
}
package com.yizhi.documents.application.vo.documents;
import com.baomidou.mybatisplus.activerecord.Model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@Api(tags = "PdfPagesVo", description = "pdf图片")
public class PdfPagesVo extends Model<PdfPagesVo>{
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "页数")
private Integer pdfPage;
@ApiModelProperty(value = "业务id")
private Long bizId;
@ApiModelProperty(value = "业务类型")
private Integer bizType;
@ApiModelProperty(value = "图片地址")
private String imageUrl;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Api("储存的第二层分类")
@Data
public class SecondClassifyVo {
@ApiModelProperty(value = "分类信息")
private DocumentClassifyVo classifyVo;
@ApiModelProperty(value = "储存第三层分类")
private List<ThirdClassifyVo> children = new ArrayList<>();
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(tags = "ThirdClassifyVo", description = "")
public class ThirdClassifyVo {
@ApiModelProperty(value = "分类信息")
private DocumentClassifyVo classifyVo;
}
package com.yizhi.documents.application.vo.documents;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@Api(value = "上传资料vo")
public class UploadVo {
@ApiModelProperty(value = "资料id")
private Long id;
@ApiModelProperty(value = "分类id ")
private Long classfyId;
@ApiModelProperty(value = "下载路径 ")
private String url;
@ApiModelProperty(value = "资料名称 ")
private String name;
@ApiModelProperty(value = "文件名称 ")
private String fileName;
@ApiModelProperty(value = "文件后缀名称")
private String suffixName;
@ApiModelProperty(value = "资料大小")
private Double fileSize;
@ApiModelProperty(value = "前端回显需要")
private String uuId;
@ApiModelProperty(value = "pdf解析后的图片地址")
private String pdfUrl;
@ApiModelProperty(value = "关键词")
private String keywords;
}
package com.yizhi.documents.application.vo.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "Classify", description = "")
public class DocumentClassifyVo extends Model<DocumentClassifyVo> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "分类父id 一级分类则为0")
private Long parentId;
@ApiModelProperty(value = "顶层节点id 一级分类则为0")
private Long rootId;
@ApiModelProperty(value = "分类层级")
private Integer layer;
@ApiModelProperty(value = "分类名称")
private String name;
@ApiModelProperty(value = "分类编码")
private Integer code;
@ApiModelProperty(value = "分类描述")
private String description;
@ApiModelProperty(value = "是否已删除 0:未删除、1:已删除 默认为0")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
private Long createById;
@ApiModelProperty(value = "创建者名称")
private String createByName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者id")
private Long updateById;
@ApiModelProperty(value = "修改者名称")
private String updateByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "站点id")
private Long siteId;
@ApiModelProperty(value = "组织id")
private Long orgId;
@ApiModelProperty(value = "企业id")
private Long companyId;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.vo.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DocumentRelationVo", description = "")
public class DocumentRelationVo extends Model<DocumentRelationVo> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "资料id")
private Long documentId;
@ApiModelProperty(value = "关联模块类型:1、课程;2、培训项目")
private Integer relationType;
@ApiModelProperty(value = "关联的模块id")
private Long relationId;
@ApiModelProperty(value = "排序")
private Integer sort;
@ApiModelProperty(value = "是否已删除 0:未删除、1:已删除 默认为0")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
private Long createById;
@ApiModelProperty(value = "创建者名称")
private String createByName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者id")
private Long updateById;
@ApiModelProperty(value = "修改者名称")
private String updateByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "站点id")
private Long siteId;
@ApiModelProperty(value = "组织id")
private Long orgId;
@ApiModelProperty(value = "企业id")
private Long companyId;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.vo.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DocumentVo", description = "")
public class DocumentVo extends Model<DocumentVo> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "分类id")
private Long classifyId;
@ApiModelProperty(value = "资料名称")
private String name;
@ApiModelProperty(value = "资料编码需要")
private Integer code;
@ApiModelProperty(value = "资料编码")
private String codeName;
@ApiModelProperty(value = "下载次数")
private Integer downloadTimes;
@ApiModelProperty(value = "前端回显需要")
private String uId;
@ApiModelProperty(value = "转码播放需要")
private String vId;
@ApiModelProperty(value = "文件名称")
private String fileName;
@ApiModelProperty(value = "资料大小")
private Double fileSize;
@ApiModelProperty(value = "资料类型 :1、文档;2、图片;3、音频;4、视频;5、其他")
private Integer type;
@ApiModelProperty(value = "下载路径")
private String url;
@ApiModelProperty(value = "是否已删除 0:未删除、1:已删除 默认为0")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
private Long createById;
@ApiModelProperty(value = "创建者名称")
private String createByName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者id")
private Long updateById;
@ApiModelProperty(value = "修改者名称")
private String updateByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "站点id")
private Long siteId;
@ApiModelProperty(value = "组织id")
private Long orgId;
@ApiModelProperty(value = "企业id")
private Long companyId;
@ApiModelProperty(value = "文件后缀名称")
private String suffixName;
@ApiModelProperty(value = "pdf解析后地址")
private String pdfUrl;
@ApiModelProperty(value = "关键词,逗号分隔")
private String keywords;
private String videoLd;
private String videoSd;
private String videoHd;
@ApiModelProperty(notes = "是否是视频文件,0否,1是")
private Integer isVideo;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.vo.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DownloadRecordVo", description = "")
public class DownloadRecordVo extends Model<DownloadRecordVo> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "资料id")
private Long documentId;
@ApiModelProperty(value = "资料名陈")
private String documentName;
@ApiModelProperty(value = "终端类型:1、PC; 2、weixin; 3、app; 4、manage")
private Integer termialType;
@ApiModelProperty(value = "下载路径")
private String url;
@ApiModelProperty(value = "创建者id")
private Long createById;
@ApiModelProperty(value = "创建者名称")
private String createByName;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者id")
private Long updateById;
@ApiModelProperty(value = "修改者名称")
private String updateByName;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "站点id")
private Long siteId;
@ApiModelProperty(value = "组织id")
private Long orgId;
@ApiModelProperty(value = "企业id")
private Long companyId;
@Override
protected Serializable pkVal() {
return this.id;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>cloud-documents</artifactId>
<groupId>com.yizhi</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.yizhi</groupId>
<artifactId>cloud-documents-service</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-comment-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-system-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-common-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-orm</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-util</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-documents-api</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>com.netflix.ribbon</groupId>
<artifactId>ribbon-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.yizhi</groupId>
<artifactId>cloud-orm</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- deploy 时跳过该模块 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.yizhi.documents.application;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
/**
* @Author: hutao
* @Date: 2019
*/
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.yizhi"})
@ComponentScan(basePackages = {"com.yizhi"})
public class DocumentProjectApplication {
public static void main(String[] args) {
SpringApplication.run(DocumentProjectApplication.class, args);
}
}
package com.yizhi.documents.application.controller;
import com.yizhi.documents.application.domain.DocumentClassify;
import com.yizhi.documents.application.service.ClassifyService;
import com.yizhi.documents.application.service.DocumentService;
import com.yizhi.documents.application.vo.documents.DocumentClassifyTreeVo;
import com.yizhi.documents.application.vo.documents.DocumentClassifyVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import com.yizhi.documents.application.vo.documents.SecondClassifyVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@RestController
@RequestMapping("/classify")
public class ClassifyComtroller {
@Autowired
private ClassifyService classifyService;
@Autowired
private DocumentService documentService;
@PostMapping("/save")
public ParamsVo save(@RequestBody DocumentClassify classify) {
ParamsVo paramsVo = new ParamsVo();
if (null != classify.getParentId()) {
DocumentClassify classifyTem = classifyService.selectById(classify.getParentId());
if (null != classifyTem) {
if (classifyTem.getLayer() == 3) {
paramsVo.setErrorMsg("分类最多为三级!");
paramsVo.setSuccess(false);
return paramsVo;
}
}
}
if (classifyService.save(classify)) {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
}
return paramsVo;
}
@PostMapping("/update")
public Boolean update(@RequestBody DocumentClassifyVo classifyVo) {
if (classifyService.update(classifyVo)) {
return true;
}
return false;
}
@GetMapping("/delete")
public ParamsVo delete(@RequestParam("id") Long id) {
ParamsVo paramsVo = new ParamsVo();
if (null != id) {
DocumentClassify classify = classifyService.selectById(id);
if (classify == null) {
paramsVo.setErrorMsg("数据库不存在该id!");
paramsVo.setSuccess(false);
} else {
//判断是否关联了资料
Integer i = documentService.queryRelationCount(id);
//判断是否有子分类
Boolean hasChildrenClassify = classifyService.haveChildrenClassify(id);
if (hasChildrenClassify || i > 0) {
paramsVo.setSuccess(false);
paramsVo.setErrorMsg("该分类下有子分类或者已关联资料,无法删除!");
} else {
if (classifyService.delete(classify)) {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
} else {
paramsVo.setErrorMsg("删除失败!");
paramsVo.setSuccess(false);
}
}
}
}
return paramsVo;
}
/**
* 查询 树形结构的分类
*
* @param showThirdClassfy 是否显示 第三级分类
* @return
*/
@GetMapping("/query")
public List<DocumentClassifyTreeVo> queryClassfy(@RequestParam("showThirdClassfy") Boolean showThirdClassfy) {
List<DocumentClassifyTreeVo> classifyTreeVos = classifyService.queryClassifyList();
;
if (!showThirdClassfy) {
classifyTreeVos.forEach(a -> {
List<SecondClassifyVo> children = a.getChildren();
children.forEach(b -> {
b.setChildren(new ArrayList<>());
});
});
}
return classifyTreeVos;
}
@GetMapping("/queryById")
public DocumentClassifyVo queryById(@RequestParam("id") Long id) {
DocumentClassify classify = this.classifyService.selectById(id);
if (classify != null) {
DocumentClassifyVo classifyVo = new DocumentClassifyVo();
classifyVo.setId(classify.getId());
classifyVo.setName(classify.getName());
classifyVo.setDescription(classify.getDescription());
if (classify.getLayer() != 1) {
DocumentClassify parentClassify = this.classifyService.selectById(classify.getParentId());
if (parentClassify != null) {
classifyVo.setParentName(parentClassify.getName());
}
}
return classifyVo;
}
return null;
}
}
\ No newline at end of file
package com.yizhi.documents.application.controller;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.documents.application.domain.Document;
import com.yizhi.documents.application.download.DocumentListExcel;
import com.yizhi.documents.application.mapper.DocumentMapper;
import com.yizhi.documents.application.service.DocumentRelationService;
import com.yizhi.documents.application.service.DocumentService;
import com.yizhi.documents.application.util.WorkUtil;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.documents.application.vo.documents.*;
import com.yizhi.util.application.constant.TpActivityType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@RestController
@RequestMapping("/document")
public class DocumentComtroller {
@Autowired
private DocumentService documentService;
@Autowired
private DocumentRelationService documentRelationService;
@Autowired
private DocumentListExcel documentListExcel;
@Autowired
private WorkUtil workUtil;
@Autowired
private DocumentMapper documentMapper;
@Autowired
private PdfPagesClient pdfPagesClient;
private Logger LOGGER = LoggerFactory.getLogger(DocumentComtroller.class);
@PostMapping("/upload")
public Boolean upload(@RequestBody UploadVo uploadVo) {
return documentService.upload(uploadVo);
}
@GetMapping("/delete")
public ParamsVo delete(@RequestParam("documentId") Long documentId,
@RequestParam("needDelete") Boolean needDelete) {
ParamsVo paramsVo = new ParamsVo();
Document document = documentService.selectById(documentId);
if (document == null) {
paramsVo.setErrorMsg("数据库不存在该id!");
paramsVo.setSuccess(false);
return paramsVo;
} else {
document.setDeleted(1);
if (documentRelationService.hasRelation(documentId)) {
paramsVo.setErrorMsg("该资料已被课程和培训项目引用,若继续删除将同时删除对应引用关系");
paramsVo.setSuccess(false);
//是否强制删除 则删除资料及其关联关系
if (needDelete) {
if (documentRelationService.delete(null, documentId) && documentService.updateById(document)) {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
return paramsVo;
}
}
} else {
if (needDelete) {
if (documentService.updateById(document)) {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
}
} else {
paramsVo.setErrorMsg("确定删除该资料,删除后不可恢复。");
paramsVo.setSuccess(false);
}
}
}
return paramsVo;
}
@PostMapping("/query/onCondition")
public Page<DocumentVo> query(@RequestBody DocumentParamVo documentParamVo) {
if (null != documentParamVo) {
RequestContext context = ContextHolder.get();
documentParamVo.setContext(context);
return documentService.queryOnCondition(documentParamVo);
}
return null;
}
@PostMapping("/update")
public ParamsVo update(@RequestBody UploadVo uploadVo) {
return documentService.update(uploadVo);
}
/**
* @param
* @return
*/
@GetMapping("/query/byId")
public DocumentVo queryById(@RequestParam Long id) {
DocumentVo vo = new DocumentVo();
List<PdfPage> pages = new ArrayList<PdfPage>();
if (null != id) {
Document document = documentService.selectById(id);
if (document == null) {
return null;
} else {
if (document.getSuffixName().equalsIgnoreCase("pdf")) {
try {
List<com.yizhi.comment.application.vo.domain.PdfPagesVo> list = pdfPagesClient.list(id, TpActivityType.TYPE_DOCUMENT);
List<PdfPagesVo> pagesVos=new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
for (com.yizhi.comment.application.vo.domain.PdfPagesVo p:list) {
PdfPagesVo pdfPagesVo=new PdfPagesVo();
pdfPagesVo.setId(p.getId());
pdfPagesVo.setBizId(p.getBizId());
pdfPagesVo.setBizType(p.getBizType());
pdfPagesVo.setImageUrl(p.getImageUrl());
pdfPagesVo.setPdfPage(p.getPdfPage());
pagesVos.add(pdfPagesVo);
}
vo.setPdfPageVos(pagesVos);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
vo.setSuffixName(document.getSuffixName());
vo.setUrl(document.getUrl());
vo.setIsVideo(document.getIsVideo());
vo.setVideoSd(document.getVideoSd());
vo.setVideoHd(document.getVideoHd());
vo.setVideoLd(document.getVideoLd());
return vo;
}
}
return null;
}
@GetMapping("/download")
public ParamsVo download(@RequestParam("id") Long id, @RequestParam("termialType") Integer termialType) {
return documentService.download(id, termialType);
}
@GetMapping("/query/ByRelationId")
public Page<DocumentVo> queryByIds(@RequestParam("relationId") Long relationId,
@RequestParam("relationType") Integer relationType,
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize
) {
return documentService.queryByRelationId(relationId, relationType, pageNo, pageSize);
}
//导出资料列表
@PostMapping("/export/list")
public void export(@RequestBody DocumentParamVo documentParamVo) {
RequestContext context = ContextHolder.get();
documentParamVo.setContext(context);
System.out.println("===================进入下载=======================!");
documentListExcel.execute(documentParamVo, true);
}
@GetMapping("/initalData")
public void test() {
List<Document> list = documentMapper.initalData();
if (!CollectionUtils.isEmpty(list)) {
for (Document a : list) {
String s = workUtil.polyUploadVid(a.getFileName(), a.getUrl());
LOGGER.info("返回的vid:" + s);
if (s == null) {
continue;
}
Document document = new Document();
document.setId(a.getId());
document.setVId(s);
documentService.updateById(document);
}
}
}
@PostMapping("/verifyVedio")
public boolean verifyVedio(@RequestBody List<Long> documentIds) {
int num = documentService.verifyVideo(documentIds);
return num == documentIds.size();
}
@PostMapping("updateVedioTranscodeUrl")
public boolean updateVedioTranscodeUrl(@RequestBody Map<String, String> map) {
Long id = Long.valueOf(map.get("id"));
String videoLd = map.get("ld");
String videoHd = map.get("hd");
String videoSd = map.get("sd");
return documentService.updateVedioTranscodeUrl(id, videoLd, videoHd, videoSd);
}
}
package com.yizhi.documents.application.controller;
import com.yizhi.documents.application.service.DocumentRelationService;
import com.yizhi.documents.application.vo.documents.DocumentRelationVo;
import com.yizhi.documents.application.vo.documents.ModelVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@RestController
@RequestMapping("/documentRelation")
public class DocumentRelationComtroller {
@Autowired
DocumentRelationService documentRelationService;
@PostMapping("/delete")
public Boolean delete(@RequestBody ModelVo modelVo) {
return documentRelationService.delete(modelVo.getId(), null);
}
@PostMapping("/batch/save")
public Boolean save(@RequestBody DocumentRelationVo documentRelationVo) {
return documentRelationService.batchSave(documentRelationVo.getDocumentIds(), documentRelationVo.getRelationId(), documentRelationVo.getRelationType());
}
@PostMapping("/move")
public Boolean move(@RequestBody DocumentRelationVo documentRelationVo) {
ParamsVo paramsVo = documentRelationService.move(documentRelationVo);
if (paramsVo.getSuccess()) {
return true;
} else {
return false;
}
}
}
package com.yizhi.documents.application.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 前端控制器
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@RestController
@RequestMapping("/downloadRecord")
public class DownloadRecordComtroller {
}
package com.yizhi.documents.application.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DocumentVo", description = "")
@TableName("document")
public class Document extends Model<Document> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Long id;
@ApiModelProperty(value = "分类id")
@TableField("classify_id")
private Long classifyId;
@ApiModelProperty(value = "资料名称")
@TableField("name")
private String name;
@ApiModelProperty(value = "资料编码需要")
@TableField("code")
private Integer code;
@ApiModelProperty(value = "资料编码")
@TableField("code_name")
private String codeName;
@ApiModelProperty(value = "下载次数")
@TableField("download_times")
private Integer downloadTimes;
@ApiModelProperty(value = "前端回显需要")
@TableField("u_id")
private String uId;
@ApiModelProperty(value = "转码播放需要")
@TableField("v_id")
private String vId;
@ApiModelProperty(value = "文件名称")
@TableField("file_name")
private String fileName;
@ApiModelProperty(value = "资料大小")
@TableField("file_size")
private Double fileSize;
@ApiModelProperty(value = "资料类型 :1、文档;2、图片;3、音频;4、视频;5、其他")
@TableField("type")
private Integer type;
@ApiModelProperty(value = "下载路径")
@TableField("url")
private String url;
@ApiModelProperty(value = "是否已删除 0:未删除、1:已删除 默认为0")
@TableField("deleted")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(value = "修改者名称")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(value = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@ApiModelProperty(value = "文件后缀名称")
@TableField("suffix_name")
private String suffixName;
@ApiModelProperty(value = "pdf解析后地址")
@TableField("pdf_url")
private String pdfUrl;
@ApiModelProperty(value = "关键词,逗号分隔")
@TableField("keywords")
private String keywords;
@TableField("video_ld")
private String videoLd;
@TableField("video_sd")
private String videoSd;
@TableField("video_hd")
private String videoHd;
@ApiModelProperty(notes = "是否是视频文件,0否,1是")
@TableField(value = "is_video")
private Integer isVideo;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "Classify", description = "")
@TableName("classify")
public class DocumentClassify extends Model<DocumentClassify> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Long id;
@ApiModelProperty(value = "分类父id 一级分类则为0")
@TableField("parent_id")
private Long parentId;
@ApiModelProperty(value = "顶层节点id 一级分类则为0")
@TableField("root_id")
private Long rootId;
@ApiModelProperty(value = "分类层级")
@TableField("layer")
private Integer layer;
@ApiModelProperty(value = "分类名称")
@TableField("name")
private String name;
@ApiModelProperty(value = "分类编码")
@TableField("code")
private Integer code;
@ApiModelProperty(value = "分类描述")
@TableField("description")
private String description;
@ApiModelProperty(value = "是否已删除 0:未删除、1:已删除 默认为0")
@TableField("deleted")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(value = "修改者名称")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(value = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DocumentRelationVo", description = "")
@TableName("document_relation")
public class DocumentRelation extends Model<DocumentRelation> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Long id;
@ApiModelProperty(value = "资料id")
@TableField("document_id")
private Long documentId;
@ApiModelProperty(value = "关联模块类型:1、课程;2、培训项目")
@TableField("relation_type")
private Integer relationType;
@ApiModelProperty(value = "关联的模块id")
@TableField("relation_id")
private Long relationId;
@ApiModelProperty(value = "排序")
@TableField("sort")
private Integer sort;
@ApiModelProperty(value = "是否已删除 0:未删除、1:已删除 默认为0")
@TableField("deleted")
private Integer deleted;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(value = "修改者名称")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(value = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.domain;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Data
@Api(tags = "DownloadRecordVo", description = "")
@TableName("download_record")
public class DownloadRecord extends Model<DownloadRecord> {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId("id")
private Long id;
@ApiModelProperty(value = "资料id")
@TableField("document_id")
private Long documentId;
@ApiModelProperty(value = "资料名陈")
@TableField("document_name")
private String documentName;
@ApiModelProperty(value = "终端类型:1、PC; 2、weixin; 3、app; 4、manage")
@TableField("termial_type")
private Integer termialType;
@ApiModelProperty(value = "下载路径")
@TableField("url")
private String url;
@ApiModelProperty(value = "创建者id")
@TableField(value = "create_by_id", fill = FieldFill.INSERT)
private Long createById;
@ApiModelProperty(value = "创建者名称")
@TableField(value = "create_by_name", fill = FieldFill.INSERT)
private String createByName;
@ApiModelProperty(value = "创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "更新者id")
@TableField(value = "update_by_id", fill = FieldFill.INSERT)
private Long updateById;
@ApiModelProperty(value = "修改者名称")
@TableField(value = "update_by_name", fill = FieldFill.INSERT)
private String updateByName;
@ApiModelProperty(value = "修改时间")
@TableField(value = "update_time", fill = FieldFill.INSERT)
private Date updateTime;
@ApiModelProperty(value = "站点id")
@TableField("site_id")
private Long siteId;
@ApiModelProperty(value = "组织id")
@TableField("org_id")
private Long orgId;
@ApiModelProperty(value = "企业id")
@TableField("company_id")
private Long companyId;
@Override
protected Serializable pkVal() {
return this.id;
}
}
package com.yizhi.documents.application.download;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.documents.application.service.ClassifyService;
import com.yizhi.documents.application.service.DocumentService;
import com.yizhi.documents.application.vo.documents.DocumentParamVo;
import com.yizhi.documents.application.vo.documents.DocumentVo;
import com.itextpdf.text.log.Logger;
import com.itextpdf.text.log.LoggerFactory;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.context.TaskContext;
import com.yizhi.core.application.file.constant.FileConstant;
import com.yizhi.core.application.file.task.AbstractDefaultTask;
import com.yizhi.core.application.file.util.OssUpload;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
public class DocumentListExcel extends AbstractDefaultTask<String, DocumentParamVo> {
@Autowired
private DocumentService documentService;
@Autowired
private ClassifyService classifyService;
private static final Logger logger = LoggerFactory.getLogger(DocumentListExcel.class);
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmm");
private SimpleDateFormat dateFormat1 = new SimpleDateFormat("yyyy/MM/dd HH:mm");
@Override
protected String execute(DocumentParamVo paramVo) {
System.out.println("开始创建下载任务!");
RequestContext context = paramVo.getContext();
Long companyId = context.getCompanyId();
Long siteId = context.getSiteId();
Long accountId = context.getAccountId();
String taskName = paramVo.getTaskName();
String serialNo = paramVo.getSerialNo();
Long taskId = paramVo.getTaskId();
paramVo.setEnableFilter(false);//不过滤
paramVo.setPageNo(1);
paramVo.setPageSize(Integer.MAX_VALUE);
Date taskDate = new Date();
TaskContext taskContext = new TaskContext(taskId, serialNo, taskName, accountId, taskDate, siteId, companyId);
System.out.println("开始创建下载任务 第二步!");
working(taskContext);
System.out.println("开始创建下载任务 第三步!");
//查询出需要的数据
Integer dataNum = 0;
List<DocumentVo> records = null;
Page<DocumentVo> page = documentService.queryOnCondition(paramVo);
System.out.println("开始创建下载任务 第四步!");
Map<Long, String> classifyNameMap = new HashMap<>();
if (page != null && page.getRecords() != null) {
dataNum = page.getTotal();
records = page.getRecords();
//获取所有的分类id
classifyNameMap = classifyService.getClassifyName(paramVo.getContext());
}
System.out.println("开始输出文件!");
//需要返回的URL
String upLoadUrl = null;
try {
//开始创建excel
XSSFWorkbook workbook = new XSSFWorkbook();
String sheetName = "资料信息列表" + "_" + dateFormat.format(taskDate);
XSSFSheet sheet = workbook.createSheet(sheetName);
// 创建第1行
XSSFRow row = sheet.createRow((int) 0);
//创建单元格格式
XSSFCellStyle style = workbook.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);//创建居中格式
style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
XSSFCell cell = null;
//创建标题行
row = fillTitle(style, cell, row);
System.out.println("开始填充数据!");
//开始填充数据
fillData(sheet, row, records, classifyNameMap);
//上传到OSS,返回url
upLoadUrl = outputFile(upLoadUrl, sheetName, workbook, taskContext);
System.out.println("导出成功!"+"文件路径为"+upLoadUrl);
} catch (Exception e) {
e.printStackTrace();
fail(taskContext, "资料库导出过程中发生错误,请查看日志");
logger.error("创建Excel的过程中发生错误");
}
return upLoadUrl;
}
private XSSFRow fillTitle(XSSFCellStyle style, XSSFCell cell, XSSFRow row) {
cell = row.createCell((short) 0);
cell.setCellStyle(style);
cell.setCellValue("资料编码");
cell = row.createCell((short) 1);
cell.setCellStyle(style);
cell.setCellValue("资料名称");
cell = row.createCell((short) 2);
cell.setCellStyle(style);
cell.setCellValue("资料类型");
cell = row.createCell((short) 3);
cell.setCellStyle(style);
cell.setCellValue("上传者");
cell = row.createCell((short) 4);
cell.setCellStyle(style);
cell.setCellValue("上传/更新时间");
cell = row.createCell((short) 5);
cell.setCellStyle(style);
cell.setCellValue("资料大小");
cell = row.createCell((short) 6);
cell.setCellStyle(style);
cell.setCellValue("下载次数");
cell = row.createCell((short) 7);
cell.setCellStyle(style);
cell.setCellValue("资料分类");
return row;
}
private void fillData(XSSFSheet sheet, XSSFRow row, List<DocumentVo> records, Map<Long, String> classifyNameMap) {
if (!CollectionUtils.isEmpty(records)) {
Integer rowIndex = 1;
int i = 1;
int y = 0;
for (DocumentVo vo : records) {
row = sheet.createRow(i++);
//开始给每个单元格赋值
DocumentVo documentVo = records.get(y++);
Integer cellSize = 0;
row.createCell(cellSize).setCellValue(documentVo.getCodeName());
cellSize++;
row.createCell(cellSize).setCellValue(documentVo.getName());
cellSize++;
row.createCell(cellSize).setCellValue(documentVo.getTypeName());
cellSize++;
row.createCell(cellSize).setCellValue(documentVo.getCreateAccounName());
cellSize++;
String time = dateFormat1.format(documentVo.getUpdateTime());
row.createCell(cellSize).setCellValue(time);
cellSize++;
row.createCell(cellSize).setCellValue(documentVo.getFileSizeName());
cellSize++;
row.createCell(cellSize).setCellValue(documentVo.getDownloadTimes());
cellSize++;
String name = null;
if (classifyNameMap != null) {
name = classifyNameMap.get(documentVo.getClassifyId());
}
row.createCell(cellSize).setCellValue(name);
}
}
}
private String outputFile(String upLoadUrl, String sheetName, Workbook workbook, TaskContext taskContext) throws IOException {
String requestPath = FileConstant.SAVE_PATH;
// String requestPath = "E\\";
File fileDir = new File(requestPath);
if (!fileDir.exists()) {
fileDir.mkdir();
}
StringBuffer fileNameSb = new StringBuffer().append(sheetName).append(".xlsx");
String fileName = fileNameSb.toString();
String path = new StringBuffer().append(requestPath).append(fileNameSb).toString();
FileOutputStream os = null;
File file = null;
try {
os = new FileOutputStream(path);
workbook.write(os);
//阿里云返回url
upLoadUrl = OssUpload.upload(path, fileName);
file = new File(path);
success(taskContext, "成功", upLoadUrl);
System.out.println("往任务里面放入文件路径"+taskContext.getTaskName());
} catch (Exception e1) {
e1.printStackTrace();
fail(taskContext, "写入过程中发生错误");
logger.error("写入数据到Excel的过程中或者上传到阿里云中发生错误");
} finally {
if (os != null) {
os.close();
}
if (workbook != null) {
workbook.cloneSheet(0);
}
if (file != null) {
file.delete();
}
}
return upLoadUrl;
}
}
package com.yizhi.documents.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.documents.application.domain.DocumentClassify;
import com.yizhi.documents.application.vo.documents.DocumentClassifyVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface ClassifyMapper extends BaseMapper<DocumentClassify> {
/**
* 查询最大的code值
*
* @return
*/
//所有的orgId均没有用到
public Integer queryMaxCode(@Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
public List<DocumentClassifyVo> queryClassifyTree(@Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
public Integer haveChildrenClassify(@Param("classifyId") Long classifyId, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
List<Long> queryChildrenClassify(@Param("classifyId") Long classifyId, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
}
package com.yizhi.documents.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.yizhi.documents.application.domain.Document;
import com.yizhi.documents.application.vo.documents.DocumentVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface DocumentMapper extends BaseMapper<Document> {
/**
* 查询最大的code值 每天都是从1开始递增
*
* @return
*/
public Integer queryMaxCode(@Param("currentDate") String currentDate, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
/**
* @param classifyIds 分类ids
* @param name 资料名字 or 资料编码
* @param type 资料类型
* @param companyId
* @param siteId
* @param orgId
* @return
*/
public List<DocumentVo> queryOnCondition(@Param("classifyIds") List<Long> classifyIds, @Param("name") String name, @Param("type") Integer type,
@Param("filterDocumentIds") List<Long> filterDocumentIds , @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId, @Param("enableTypeFilter") Integer enableTypeFilter, Page page, @Param("startDate") String startDate, @Param("endDate") String endDate);
public List<DocumentVo> queryByRelationId(@Param("relationId") Long relationId, @Param("relationType") Integer relationType, @Param("companyId") Long companyId, @Param("siteId") Long siteId, Page page);
public List<Document> initalData();
/**
* 确认文件是视屏文件
* @param ids
* @return
*/
Integer verifyVideo(@Param("ids") List<Long> ids);
public Boolean updateVedioTranscodeUrl(@Param("id") Long id,@Param("videoLd") String videoLd,@Param("videoHd") String videoHd,@Param("videoSd") String videoSd);
}
package com.yizhi.documents.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.documents.application.domain.DocumentRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface DocumentRelationMapper extends BaseMapper<DocumentRelation> {
//所有的orgId 暂时没有用到
public List<Long> returnDocumentIds(@Param("relationId") Long relationId, @Param("relationType") Integer relationType, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
public Integer delete(@Param("id") Long id, @Param("documentId") Long documentId, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
public Integer queryMaxSort(@Param("relationId") Long relationId, @Param("relationType") Integer relationType, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
public DocumentRelation queryBySort(@Param("orgiSort") Integer orgiSort, @Param("relationId") Long relationId, @Param("relationType") Integer relationType, @Param("moveType") Integer moveType, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
public List<Long> getFilterDocumentIds(@Param("relationId") Long relationId, @Param("relationType") Integer relationType, @Param("companyId") Long companyId, @Param("siteId") Long siteId, @Param("orgId") Long orgId);
}
package com.yizhi.documents.application.mapper;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.yizhi.documents.application.domain.DownloadRecord;
/**
* <p>
* Mapper 接口
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface DownloadRecordMapper extends BaseMapper<DownloadRecord> {
}
package com.yizhi.documents.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.documents.application.domain.DocumentClassify;
import com.yizhi.documents.application.vo.documents.DocumentClassifyTreeVo;
import com.yizhi.documents.application.vo.documents.DocumentClassifyVo;
import com.yizhi.core.application.context.RequestContext;
import java.util.List;
import java.util.Map;
/**
* <p>
* 服务类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface ClassifyService extends IService<DocumentClassify> {
public Boolean save(DocumentClassify classify);
public Boolean update(DocumentClassifyVo classifyVo);
public Boolean delete(DocumentClassify classify);
public List<DocumentClassifyTreeVo> queryClassifyList();
public Boolean haveChildrenClassify(Long ClassifyId);
public Map<Long,String> getClassifyName(RequestContext context);
}
package com.yizhi.documents.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.documents.application.domain.DocumentRelation;
import com.yizhi.documents.application.vo.documents.DocumentRelationVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface DocumentRelationService extends IService<DocumentRelation> {
/**
* 逻辑删除
*
* @param id 根据主键删除
* @param documentId 根据资料id删除
* @return
*/
public Boolean delete(Long id, Long documentId);
/**
* 看是否该资料被相关模块关联
*
* @param documentId
* @return
*/
public Boolean hasRelation(Long documentId);
/**
* 根据模块id,类型 返回 资料id的list集合
*
* @param relationId 模块id 比如 培训id 、课程id
* @param relationType 关联模块类型:1、课程;2、培训项目
* @return
*/
public List<Long> returnDocumentIds(Long relationId, Integer relationType);
Boolean batchSave(List<Long> documentIds, Long relationId, Integer relationType);
public ParamsVo move(DocumentRelationVo documentRelationVo);
}
package com.yizhi.documents.application.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.documents.application.domain.Document;
import com.yizhi.documents.application.vo.documents.DocumentParamVo;
import com.yizhi.documents.application.vo.documents.DocumentVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import com.yizhi.documents.application.vo.documents.UploadVo;
import java.util.List;
/**
* <p>
* 服务类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface DocumentService extends IService<Document> {
/**
* 根据分类id 查询是否有资料被关联
*
* @param classfyId
* @return
*/
public Integer queryRelationCount(Long classfyId);
public Boolean upload(UploadVo uploadVo);
/**
* 按条件查询列表
*
* @param paramVo
* @return
*/
public Page<DocumentVo> queryOnCondition(DocumentParamVo paramVo);
public ParamsVo update(UploadVo uploadVo);
public ParamsVo download(Long id, Integer termialType);
public Page<DocumentVo> queryByRelationId(Long relationId, Integer relationType, Integer pageNo, Integer pageSize);
public Integer verifyVideo(List<Long> ids);
public Boolean updateVedioTranscodeUrl(Long id,String videoLd,String videoHd,String videoSd);
}
package com.yizhi.documents.application.service;
import com.baomidou.mybatisplus.service.IService;
import com.yizhi.documents.application.domain.DownloadRecord;
/**
* <p>
* 服务类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
public interface DownloadRecordService extends IService<DownloadRecord> {
Boolean save(DownloadRecord downloadRecord);
}
package com.yizhi.documents.application.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.documents.application.domain.DocumentClassify;
import com.yizhi.documents.application.mapper.ClassifyMapper;
import com.yizhi.documents.application.service.ClassifyService;
import com.yizhi.documents.application.util.WorkUtil;
import com.yizhi.documents.application.vo.documents.DocumentClassifyTreeVo;
import com.yizhi.documents.application.vo.documents.DocumentClassifyVo;
import com.yizhi.documents.application.vo.documents.SecondClassifyVo;
import com.yizhi.documents.application.vo.documents.ThirdClassifyVo;
import com.yizhi.application.orm.hierarchicalauthorization.HQueryUtil;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.*;
/**
* <p>
* 服务实现类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Service
@Transactional
public class ClassifyServiceImple extends ServiceImpl<ClassifyMapper, DocumentClassify> implements ClassifyService {
@Autowired
IdGenerator idGenerator;
@Autowired
WorkUtil workUtil;
private static final Logger LOGGER = LoggerFactory.getLogger(ClassifyServiceImple.class);
@Override
public Boolean save(DocumentClassify classify) {
RequestContext context = ContextHolder.get();
Long id = classify.getId();
Long parentId = classify.getParentId();
Long rootId = classify.getRootId();
Date curentDate = new Date();
if (null == id) {
//id为null,进行插入操作
classify.setId(idGenerator.generate());
classify.setCompanyId(context.getCompanyId());
classify.setSiteId(context.getSiteId());
classify.setOrgId(context.getOrgId());
classify.setCreateByName(context.getAccountName());
classify.setCreateById(context.getAccountId());
classify.setCreateTime(curentDate);
classify.setDeleted(0);
//parentId、rootId都为0,一级分类
//parentId不为0,rootId为0,二级分类
//parentId、rootId都不为0,三级分类
if (parentId != 0) {
if (rootId != 0) {
//该新建分类为三级分类
classify.setLayer(3);
} else {
//该新建分类为二级分类
classify.setLayer(2);
classify.setRootId(parentId);
}
this.baseMapper.insert(classify);
} else {
//该新建分类为一级分类
classify.setParentId(0l);
classify.setRootId(0l);
classify.setLayer(1);
//完整的分类编码=为“code--name” code 只存储数字部分
String key = context.getSiteId().toString();
Boolean hasLock = false;
//之所以这么写是因为 不知道为什么在查询code最大值时,会随机性拼接createById
StringBuilder sql = new StringBuilder(" select Max(code) as code from classify c where c.layer =1 and c.deleted = 0 and c.site_id = ");
sql.append(context.getSiteId()).append(" and c.company_id = ").append(context.getCompanyId());
Connection connection = null;
try {
connection = this.sqlSessionBatch().getConnection();
Statement statement = connection.createStatement();
LOGGER.info("执行的sql={}", sql.toString());
ResultSet rs = statement.executeQuery(sql.toString());
while (rs.next()){
Integer code = rs.getInt("code");
code = (code == null ? 999 : code) + 1;
classify.setCode(code);
this.baseMapper.insert(classify);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
// while (!hasLock) {
// //谁锁住了谁执行 true 为当前线程锁住 false说明已被其他人锁住啦
// if (workUtil.lock(key)) {
// try {
// Integer code = this.baseMapper.queryMaxCode(context.getCompanyId(), context.getSiteId(), context.getOrgId());
// code = (code == null ? 999 : code) + 1;
// classify.setCode(code);
// this.baseMapper.insert(classify);
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// hasLock = true;
// //释放锁
// workUtil.dealLock(key);
// }
// }
// }
}
return true;
}
return false;
}
@Override
public Boolean update(DocumentClassifyVo classifyVo) {
RequestContext context = ContextHolder.get();
Date curentDate = new Date();
if (null != classifyVo) {
DocumentClassify updateClassify = new DocumentClassify();
if (classifyVo.getParentId() != null && classifyVo.getParentId() != 0) {
DocumentClassify parentClassify = this.baseMapper.selectById(classifyVo.getParentId());
if (parentClassify != null) {
//获取层级
Integer layer = parentClassify.getLayer();
if (layer == 1) {
updateClassify.setRootId(parentClassify.getId());
} else {
updateClassify.setRootId(parentClassify.getParentId());
}
updateClassify.setLayer((++layer));
updateClassify.setParentId(classifyVo.getParentId());
} else {
return false;
}
}
updateClassify.setId(classifyVo.getId());
updateClassify.setName(classifyVo.getName());
updateClassify.setDescription(classifyVo.getDescription());
updateClassify.setUpdateTime(curentDate);
updateClassify.setUpdateByName(context.getAccountName());
updateClassify.setUpdateById(context.getAccountId());
try {
if (this.baseMapper.updateById(updateClassify) == 1) {
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
@Override
public Boolean delete(DocumentClassify classify) {
classify.setDeleted(1);
try {
this.baseMapper.updateById(classify);
return true;
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
@Override
public List<DocumentClassifyTreeVo> queryClassifyList() {
RequestContext context = ContextHolder.get();
//开启分级授权
HQueryUtil.startHQ(DocumentClassify.class);
List<DocumentClassifyTreeVo> classifyTreeVos = new ArrayList<>();
List<DocumentClassifyVo> classifyVos = this.baseMapper.queryClassifyTree(context.getCompanyId(), context.getSiteId(), context.getOrgId());
if (!CollectionUtils.isEmpty(classifyVos)) {
//储存第一级分类 <id ,对应的VO>
Map<Long, DocumentClassifyTreeVo> rootClassifyMap = new HashMap<>();
//储存第二级分类 《id,对应的vo》
Map<Long, SecondClassifyVo> secondClassifyMap = new HashMap<>();
for (DocumentClassifyVo vo : classifyVos) {
if (vo.getLayer() == 1) {
vo.setCodeName(vo.getCode() + "--" + vo.getName());
DocumentClassifyTreeVo classifyTreeVo = new DocumentClassifyTreeVo();
classifyTreeVo.setClassifyVo(vo);
classifyTreeVos.add(classifyTreeVo);
if (!rootClassifyMap.containsKey(vo.getId())) {
rootClassifyMap.put(vo.getId(), classifyTreeVo);
}
}
}
for (DocumentClassifyVo vo : classifyVos) {
if (vo.getLayer() == 2) {
if (null != rootClassifyMap.get(vo.getParentId())) {
DocumentClassifyTreeVo classifyTreeVo = rootClassifyMap.get(vo.getParentId());
if (null != classifyTreeVo) {
SecondClassifyVo secondClassifyVo = new SecondClassifyVo();
vo.setCodeName(vo.getName());
secondClassifyVo.setClassifyVo(vo);
classifyTreeVo.getChildren().add(secondClassifyVo);
if (!secondClassifyMap.containsKey(vo.getId())) {
secondClassifyMap.put(vo.getId(), secondClassifyVo);
}
}
}
}
}
for (DocumentClassifyVo vo : classifyVos) {
if (vo.getLayer() == 3) {
if (null != secondClassifyMap.get(vo.getParentId())) {
SecondClassifyVo secondClassifyVo = secondClassifyMap.get(vo.getParentId());
ThirdClassifyVo thirdClassifyVo = new ThirdClassifyVo();
vo.setCodeName(vo.getName());
thirdClassifyVo.setClassifyVo(vo);
if (null != secondClassifyVo) {
secondClassifyVo.getChildren().add(thirdClassifyVo);
}
}
}
}
}
return classifyTreeVos;
}
@Override
public Boolean haveChildrenClassify(Long classifyId) {
RequestContext context = ContextHolder.get();
Integer count = this.baseMapper.haveChildrenClassify(classifyId, context.getCompanyId(), context.getSiteId(), context.getOrgId());
if (count > 0) {
return true;
} else
return false;
}
@Override
public Map<Long, String> getClassifyName(RequestContext context) {
Map<Long, String> classifyNameMap = null;
DocumentClassify classifyTem = new DocumentClassify();
classifyTem.setSiteId(context.getSiteId());
classifyTem.setCompanyId(context.getCompanyId());
List<DocumentClassify> classifiesAll = this.baseMapper.selectList(new EntityWrapper<>(classifyTem));
if (!CollectionUtils.isEmpty(classifiesAll)) {
classifyNameMap = new HashMap<>(classifiesAll.size());
for (DocumentClassify classify : classifiesAll) {
if (!classifyNameMap.containsKey(classify.getId())) {
classifyNameMap.put(classify.getId(), classify.getName());
}
}
for (DocumentClassify classify : classifiesAll) {
if (classify.getLayer() == 2) {
String name = classifyNameMap.get(classify.getId());
String parentName = classifyNameMap.get(classify.getParentId());
classifyNameMap.put(classify.getId(), (parentName + "/" + name));
} else if (classify.getLayer() == 3) {
String name = classifyNameMap.get(classify.getId());
String parentName = classifyNameMap.get(classify.getParentId());
classifyNameMap.put(classify.getId(), parentName + "/" + name);
}
}
}
return classifyNameMap;
}
}
package com.yizhi.documents.application.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.documents.application.domain.DocumentRelation;
import com.yizhi.documents.application.mapper.DocumentRelationMapper;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.documents.application.service.DocumentRelationService;
import com.yizhi.documents.application.vo.documents.DocumentRelationVo;
import com.yizhi.documents.application.vo.documents.ParamsVo;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Service
public class DocumentRelationServiceImple extends ServiceImpl<DocumentRelationMapper, DocumentRelation> implements DocumentRelationService {
@Autowired
private IdGenerator idGenerator;
private final static Integer MOVE_UP = 1;
private final static Integer MOVE_DOWN = 2;
@Override
public Boolean delete(Long id, Long documentId) {
RequestContext context = ContextHolder.get();
Integer i = this.baseMapper.delete(id, documentId, context.getCompanyId(), context.getSiteId(), context.getOrgId());
if (i > 0 ) {
return true;
}
return false;
}
@Override
public Boolean hasRelation(Long documentId) {
DocumentRelation documentRelation = new DocumentRelation();
documentRelation.setDocumentId(documentId);
documentRelation.setDeleted(0);
EntityWrapper wrapper = new EntityWrapper(documentRelation);
if (this.baseMapper.selectCount(wrapper) > 0) {
return true;
}
return false;
}
@Override
public List<Long> returnDocumentIds(Long relationId, Integer relationType) {
RequestContext context = ContextHolder.get();
return this.baseMapper.returnDocumentIds(relationId, relationType, context.getCompanyId(), context.getSiteId(), context.getOrgId());
}
@Override
public Boolean batchSave(List<Long> documentIds, Long relationId, Integer relationType) {
if (CollectionUtils.isEmpty(documentIds)) {
return false;
}
Date curentDate = new Date();
RequestContext context = ContextHolder.get();
for (Long documentId : documentIds) {
DocumentRelation relation = new DocumentRelation();
relation.setId(idGenerator.generate());
relation.setRelationId(relationId);
relation.setRelationType(relationType);
relation.setDocumentId(documentId);
Integer maxSort = this.baseMapper.queryMaxSort(relationId, relationType, context.getCompanyId(), context.getSiteId(), context.getOrgId());
maxSort = maxSort == null ? 1 : maxSort;
relation.setSort((++maxSort));
relation.setCompanyId(context.getCompanyId());
relation.setSiteId(context.getSiteId());
relation.setOrgId(context.getOrgId());
relation.setCreateByName(context.getAccountName());
relation.setCreateById(context.getAccountId());
relation.setCreateTime(curentDate);
relation.setDeleted(0);
try {
this.baseMapper.insert(relation);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
return true;
}
@Override
public ParamsVo move(DocumentRelationVo documentRelationVo) {
RequestContext context = ContextHolder.get();
ParamsVo paramsVo = new ParamsVo();
DocumentRelation orginRelation = this.baseMapper.selectById(documentRelationVo.getId());
if (orginRelation == null) {
paramsVo.setErrorMsg("数据库不存在该id!");
paramsVo.setSuccess(false);
return paramsVo;
} else {
Integer orginSort = orginRelation.getSort();
DocumentRelation targetRelation;
//是否上移
if (documentRelationVo.getMoveUp()) {
targetRelation = this.baseMapper.queryBySort(orginSort, documentRelationVo.getRelationId(), documentRelationVo.getRelationType(), MOVE_UP, context.getCompanyId(), context.getSiteId(), context.getOrgId());
} else {
targetRelation = this.baseMapper.queryBySort(orginSort, documentRelationVo.getRelationId(), documentRelationVo.getRelationType(), MOVE_DOWN, context.getCompanyId(), context.getSiteId(), context.getOrgId());
}
if (targetRelation != null) {
Integer targetSort = targetRelation.getSort();
orginRelation.setSort(targetSort);
targetRelation.setSort(orginSort);
try {
Integer tem = this.baseMapper.updateById(orginRelation);
Integer tem1 = this.baseMapper.updateById(targetRelation);
if (tem == 1 && tem1 == 1) {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
}
} catch (Exception e) {
e.printStackTrace();
}
} else {
paramsVo.setErrorMsg("移动失败!");
paramsVo.setSuccess(false);
}
}
return paramsVo;
}
}
package com.yizhi.documents.application.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.documents.application.domain.Document;
import com.yizhi.documents.application.domain.DownloadRecord;
import com.yizhi.documents.application.enums.DocumentType;
import com.yizhi.documents.application.enums.TermialType;
import com.yizhi.documents.application.mapper.ClassifyMapper;
import com.yizhi.documents.application.mapper.DocumentMapper;
import com.yizhi.documents.application.mapper.DocumentRelationMapper;
import com.yizhi.documents.application.service.DocumentRelationService;
import com.yizhi.documents.application.service.DocumentService;
import com.yizhi.documents.application.service.DownloadRecordService;
import com.yizhi.documents.application.util.CommonUtils;
import com.yizhi.documents.application.util.WorkUtil;
import com.yizhi.application.orm.hierarchicalauthorization.HQueryUtil;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.comment.application.feign.PdfPagesClient;
import com.yizhi.comment.application.vo.PdfVO;
import com.yizhi.comment.application.vo.domain.PdfPagesVo;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import com.yizhi.core.application.event.EventWrapper;
import com.yizhi.core.application.publish.CloudEventPublisher;
import com.yizhi.documents.application.vo.documents.*;
import com.yizhi.util.application.constant.TpActivityType;
import com.yizhi.util.application.event.AssignmentMediaTranscodingEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Service
@Transactional
public class DocumentServiceImple extends ServiceImpl<DocumentMapper, Document> implements DocumentService {
@Autowired
private IdGenerator idGenerator;
@Autowired
private WorkUtil workUtil;
@Autowired
private DocumentMapper documentMapper;
@Autowired
private ClassifyMapper classifyMapper;
@Autowired
private DownloadRecordService downloadRecordService;
@Autowired
private DocumentRelationMapper relationMapper;
@Autowired
private DocumentRelationService documentRelationService;
@Autowired
private CommonUtils commonUtils;
private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
@Autowired
private CloudEventPublisher cloudEventPublisher;
@Autowired
private PdfPagesClient pdfPagesClient;
@Override
public Integer queryRelationCount(Long classfyId) {
Document document = new Document();
document.setClassifyId(classfyId);
document.setDeleted(0);
EntityWrapper entityWrapper = new EntityWrapper(document);
return this.baseMapper.selectCount(entityWrapper);
}
@Override
public Boolean upload(UploadVo uploadVo) {
RequestContext context = ContextHolder.get();
Date curentDate = new Date();
if (null != uploadVo) {
Document document = new Document();
document.setId(idGenerator.generate());
document.setClassifyId(uploadVo.getClassfyId());
document.setFileName(uploadVo.getFileName());
document.setFileSize(uploadVo.getFileSize());
document.setType(workUtil.documentType(uploadVo.getSuffixName()));
document.setUId(uploadVo.getUuId());
document.setDownloadTimes(0);
document.setName(uploadVo.getName());
document.setUrl(uploadVo.getUrl());
String dateFormat = sdf.format(curentDate);
Integer code = documentMapper.queryMaxCode(dateFormat, context.getCompanyId(), context.getSiteId(), context.getOrgId());
code = (code == null ? 1 : ++code);
document.setCode(code);
//给编码名称赋值
document.setCodeName(getCodeName(code, dateFormat));
document.setCompanyId(context.getCompanyId());
document.setSiteId(context.getSiteId());
document.setOrgId(context.getOrgId());
document.setCreateByName(context.getAccountName());
document.setCreateById(context.getAccountId());
document.setCreateTime(curentDate);
document.setDeleted(0);
document.setSuffixName(uploadVo.getSuffixName());
document.setKeywords(uploadVo.getKeywords());
if (workUtil.documentType(uploadVo.getSuffixName())== DocumentType.VIDEO.getType()||workUtil.documentType(uploadVo.getSuffixName())==DocumentType.AUDIO.getType()) {
AssignmentMediaTranscodingEvent event = new AssignmentMediaTranscodingEvent();
List<AssignmentMediaTranscodingEvent.FileDTO> fileDTOS = new ArrayList<>();
fileDTOS.add(event.new FileDTO(document.getId(), document.getUrl()));
event.setType(TpActivityType.TYPE_DOCUMENT);
event.setFiles(fileDTOS);
cloudEventPublisher.publish("assignmentMediaTranscoding",
new EventWrapper(0L, event));
}
if (uploadVo.getSuffixName().equalsIgnoreCase("pdf")) {
List<PdfVO> pdfVOs = new ArrayList<PdfVO>();
PdfVO pdfVO = new PdfVO();
pdfVO.setBizId(document.getId());
pdfVO.setBizType(TpActivityType.TYPE_DOCUMENT);
pdfVO.setCompanyId(document.getCompanyId());
pdfVO.setSiteId(document.getSiteId());
pdfVO.setCreateById(document.getCreateById());
pdfVO.setOriginalFile(document.getFileName());
pdfVO.setOriginalFileUrl(document.getUrl());
pdfVOs.add(pdfVO);
try {
if (!CollectionUtils.isEmpty(pdfVOs)) {
cloudEventPublisher.publish("pdfToPng",
new EventWrapper(0L, pdfVOs));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
Integer insert = documentMapper.insert(document);
return true;
} catch (Exception e) {
e.printStackTrace();
}
}
return false;
}
private String getCodeName(Integer code, String dateFormat) {
String codeName = null;
if (code > 0 && code < 10) {
codeName = dateFormat + "00" + code;
} else if (code >= 10 && code < 100) {
codeName = dateFormat + "0" + code;
} else {
codeName = dateFormat + code;
}
return codeName;
}
@Override
public Page<DocumentVo> queryOnCondition(DocumentParamVo paramVo) {
RequestContext context = paramVo.getContext();
ContextHolder.set(context);
System.out.println("开始查询资料!");
//开启分级授权
HQueryUtil.startHQ(Document.class);
Long conpanyId = context.getCompanyId();
Long siteId = context.getSiteId();
Long orgId = context.getOrgId();
String startDate = paramVo.getStartDate();
String endDate = paramVo.getEndDate();
endDate = endDate+" 23:59:59";
Long classifyId = paramVo.getClassifyId();
List<Long> classifyIds = null;
if (classifyId != null) {
classifyIds = classifyMapper.queryChildrenClassify(classifyId, conpanyId, siteId, orgId);
}
String name = paramVo.getName();
Integer type = paramVo.getType();
Page page = new Page(paramVo.getPageNo(), paramVo.getPageSize());
List<DocumentVo> documentVos = new ArrayList<>();
//需要过滤的资料ids
List<Long> filterList = null;
//查询已关联的资料,进行过滤
if (paramVo.getEnableFilter()) {
if (paramVo.getRelationId() != null && paramVo.getRelationType() != null) {
filterList = relationMapper.getFilterDocumentIds(paramVo.getRelationId(), paramVo.getRelationType(), conpanyId, siteId, orgId);
}
}
documentVos = documentMapper.queryOnCondition(classifyIds, name, type, filterList, conpanyId, siteId, orgId, paramVo.getEnableTypeFilter(), page,startDate,endDate);
if (!CollectionUtils.isEmpty(documentVos)) {
Integer no = 0;
for (DocumentVo a : documentVos) {
++no;
//组装数据
a = fillDate(a, no);
}
}
page.setRecords(documentVos);
return page;
}
@Override
public ParamsVo update(UploadVo uploadVo) {
Date curentDate = new Date();
ParamsVo paramsVo = new ParamsVo();
RequestContext context = ContextHolder.get();
Document document = documentMapper.selectById(uploadVo.getId());
if (null == document) {
paramsVo.setErrorMsg("id不存在!");
paramsVo.setSuccess(false);
} else {
document.setUrl(uploadVo.getUrl());
document.setName(uploadVo.getName());
document.setFileName(uploadVo.getFileName());
document.setFileSize(uploadVo.getFileSize());
document.setUpdateById(context.getAccountId());
document.setUpdateByName(context.getAccountName());
document.setUpdateTime(curentDate);
document.setType(workUtil.documentType(uploadVo.getSuffixName()));
document.setSuffixName(uploadVo.getSuffixName());
document.setKeywords(uploadVo.getKeywords());
if (workUtil.documentType(uploadVo.getSuffixName())==DocumentType.VIDEO.getType()||workUtil.documentType(uploadVo.getSuffixName())==DocumentType.AUDIO.getType()) {
AssignmentMediaTranscodingEvent event = new AssignmentMediaTranscodingEvent();
List<AssignmentMediaTranscodingEvent.FileDTO> fileDTOS = new ArrayList<>();
fileDTOS.add(event.new FileDTO(document.getId(), document.getUrl()));
event.setType(TpActivityType.TYPE_DOCUMENT);
event.setFiles(fileDTOS);
cloudEventPublisher.publish("assignmentMediaTranscoding",
new EventWrapper(0L, event));
}
if (uploadVo.getSuffixName().equalsIgnoreCase("pdf")) {
List<PdfVO> pdfVOs = new ArrayList<PdfVO>();
PdfVO pdfVO = new PdfVO();
pdfVO.setBizId(document.getId());
pdfVO.setBizType(TpActivityType.TYPE_DOCUMENT);
pdfVO.setCompanyId(document.getCompanyId());
pdfVO.setSiteId(document.getSiteId());
pdfVO.setCreateById(document.getUpdateById());
pdfVO.setOriginalFile(document.getFileName());
pdfVO.setOriginalFileUrl(document.getUrl());
pdfVOs.add(pdfVO);
try {
if (!CollectionUtils.isEmpty(pdfVOs)) {
cloudEventPublisher.publish("pdfToPng",
new EventWrapper(0L, pdfVOs));
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try {
if (documentMapper.updateById(document) == 1) {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
}
} catch (Exception e) {
e.printStackTrace();
}
}
return paramsVo;
}
@Override
public ParamsVo download(Long id, Integer termialType) {
ParamsVo paramsVo = new ParamsVo();
Document document = this.documentMapper.selectById(id);
if (document == null) {
paramsVo.setSuccess(false);
paramsVo.setErrorMsg("id不存在!");
return paramsVo;
} else {
//向下载记录表 插一条记录
Boolean saveSuccess = null;
try {
DownloadRecord downloadRecord = new DownloadRecord();
downloadRecord.setTermialType(termialType);
downloadRecord.setDocumentId(id);
downloadRecord.setDocumentName(document.getName());
saveSuccess = downloadRecordService.save(downloadRecord);
} catch (Exception e) {
e.printStackTrace();
throw e;
}
if (saveSuccess == false) {
paramsVo.setSuccess(false);
paramsVo.setErrorMsg("下载失败!");
return paramsVo;
}
//管理端下载 不算下载次数
if (!TermialType.MANAGE.getType().equals(termialType)) {
document.setDownloadTimes((document.getDownloadTimes() + 1));
DocumentVo vo = new DocumentVo();
vo.setSuffixName(document.getSuffixName());
vo.setUrl(document.getUrl());
vo.setIsVideo(document.getIsVideo());
vo.setVideoSd(document.getVideoSd());
vo.setVideoHd(document.getVideoHd());
vo.setVideoLd(document.getVideoLd());
if (document.getSuffixName().equalsIgnoreCase("pdf")) {
try {
List<PdfPagesVo> list = pdfPagesClient.list(id, TpActivityType.TYPE_DOCUMENT);
List<com.yizhi.documents.application.vo.documents.PdfPagesVo> pagesVos=new ArrayList<>();
if (!CollectionUtils.isEmpty(list)) {
for (PdfPagesVo p:list) {
com.yizhi.documents.application.vo.documents.PdfPagesVo pdfPagesVo=new com.yizhi.documents.application.vo.documents.PdfPagesVo();
pdfPagesVo.setId(p.getId());
pdfPagesVo.setBizId(p.getBizId());
pdfPagesVo.setBizType(p.getBizType());
pdfPagesVo.setImageUrl(p.getImageUrl());
pdfPagesVo.setPdfPage(p.getPdfPage());
pagesVos.add(pdfPagesVo);
}
vo.setPdfPageVos(pagesVos);
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
paramsVo.setSuccessData(vo);
} else {
paramsVo.setSuccess(true);
paramsVo.setErrorMsg(null);
paramsVo.setSuccessData(document.getUrl());
}
}
return paramsVo;
}
@Override
public Page<DocumentVo> queryByRelationId(Long relationId, Integer relationType, Integer pageNo, Integer pageSize) {
//开启分级授权
HQueryUtil.startHQ(Document.class);
RequestContext context = ContextHolder.get();
Page<DocumentVo> page = new Page<>(pageNo, pageSize);
System.out.println(context.getCompanyId() + "=====" + context.getSiteId());
List<DocumentVo> documentVos = this.baseMapper.queryByRelationId(relationId, relationType, context.getCompanyId(), context.getSiteId(), page);
Integer no = (pageNo - 1) * pageSize;
for (DocumentVo a : documentVos) {
++no;
//组装数据
a = fillDate(a, no);
}
// List<Long> documentIds = documentRelationService.returnDocumentIds(relationId, relationType);
// page.setTotal(documentIds == null ? 0 : documentIds.size());
page.setRecords(documentVos);
return page;
}
/**
* @param a
* @param no 序号
* @return
*/
private DocumentVo fillDate(DocumentVo a, Integer no) {
String fileSizeName = null;
//给资料大小名称附上单位
if (a.getFileSize() >= (1024 * 1024)) {
//只保留一位小数
fileSizeName = String.format("%.1f", a.getFileSize() / (1024 * 1024)) + "M";
} else {
fileSizeName = String.format("%.1f", a.getFileSize() / 1024) + "K";
}
a.setFileSizeName(fileSizeName);
//给序号赋值
a.setNo((no));
//将文件类型变成中文名称
switch (a.getType()) {
case 1:
a.setTypeName(DocumentType.DOCUMENT.getTypeName());
break;
case 2:
a.setTypeName(DocumentType.PICTURE.getTypeName());
break;
case 3:
a.setTypeName(DocumentType.AUDIO.getTypeName());
break;
case 4:
a.setTypeName(DocumentType.VIDEO.getTypeName());
break;
case 5:
a.setTypeName(DocumentType.OTHER.getTypeName());
break;
}
return a;
}
@Override
public Integer verifyVideo(List<Long> ids) {
return this.baseMapper.verifyVideo(ids);
}
@Override
public Boolean updateVedioTranscodeUrl(Long id, String videoLd, String videoHd, String videoSd) {
// TODO Auto-generated method stub
return this.baseMapper.updateVedioTranscodeUrl(id, videoLd, videoHd, videoSd);
}
}
package com.yizhi.documents.application.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yizhi.documents.application.domain.DownloadRecord;
import com.yizhi.documents.application.mapper.DownloadRecordMapper;
import com.yizhi.documents.application.service.DownloadRecordService;
import com.yizhi.application.orm.id.IdGenerator;
import com.yizhi.core.application.context.ContextHolder;
import com.yizhi.core.application.context.RequestContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* <p>
* 服务实现类
* </p>
*
* @author hutao
* @since 2019-06-11
*/
@Service
public class DownloadRecordServiceImple extends ServiceImpl<DownloadRecordMapper, DownloadRecord> implements DownloadRecordService {
@Autowired
IdGenerator idGenerator;
@Override
public Boolean save(DownloadRecord downloadRecord) {
RequestContext context = ContextHolder.get();
Date curentDate = new Date();
if (downloadRecord != null) {
downloadRecord.setId(idGenerator.generate());
downloadRecord.setCompanyId(context.getCompanyId());
downloadRecord.setSiteId(context.getSiteId());
downloadRecord.setOrgId(context.getOrgId());
downloadRecord.setCreateByName(context.getAccountName());
downloadRecord.setCreateById(context.getAccountId());
downloadRecord.setCreateTime(curentDate);
if (this.baseMapper.insert(downloadRecord) == 1) {
return true;
}
}
return false;
}
}
package com.yizhi.documents.application.util;
public class CaseLibraryConstants {
/**
* 文档解析用的第三方插件和解析后存放的图片目录
*/
public static String OPENOFFICE_PATH = "/opt/openoffice4";
// public static String OPENOFFICE_PATH = "/Applications/OpenOffice.app/Contents";
public static String DOC_PATH = "/home/file/doc";
// public static String DOC_PATH = "/Users/dingxiaowei/aaa/doc";
}
package com.yizhi.documents.application.util;
import com.alibaba.fastjson.JSON;
import org.icepdf.core.exceptions.PDFException;
import org.icepdf.core.exceptions.PDFSecurityException;
import org.icepdf.core.pobjects.Document;
import org.icepdf.core.pobjects.Page;
import org.icepdf.core.util.GraphicsRenderingHints;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* *
*
* @param
* @author dingxiaowei
* @date 2019/7/18
* @return
*/
@Component
public class CommonUtils {
private static final Logger LOGGER = LoggerFactory.getLogger(CommonUtils.class);
@Autowired
private UpConvert upConvert;
@Value("${ACTIVE}")
public String active;
/**
* 将上传的pdf转换成图片拼接富文本
*
* @param pdfFileName
* @param pdfOssUrl
*/
public String translatePdfToPhoto(String pdfOssUrl, String pdfFileName) {
if (StringUtils.isEmpty(pdfOssUrl) || StringUtils.isEmpty(pdfFileName)) {
return null;
}
String imageDir = null;
try {
imageDir = upConvert.convert(pdfOssUrl, pdfFileName, CaseLibraryConstants.DOC_PATH, 200, 0, CaseLibraryConstants.OPENOFFICE_PATH);
} catch (IOException e) {
LOGGER.error("将上传的pdf转换成图片拼接富文本,错误:", e);
}
File dir = new File(imageDir);
File[] files = dir.listFiles();
String uploadFile;
String key;
List<String> imageOssPathList = new ArrayList<>(files.length);
if (files.length > 0) {
for (File file : files) {
uploadFile = file.getAbsolutePath();
key = pdfFileName.substring(0, pdfFileName.lastIndexOf(".")) + "/" + file.getName();
String result = OssUpload.upload(uploadFile, key, active);
imageOssPathList.add(result);
}
//上传完成以后,将本地文件夹删除
deleteDir(dir);
}
if (!CollectionUtils.isEmpty(imageOssPathList)) {
String htmlBR = "<p><br></p>";
String content = htmlBR;
StringBuilder sb = new StringBuilder(content);
for (int i = 1; i <= imageOssPathList.size(); i++) {
for (String image : imageOssPathList) {
String index = image.substring(image.lastIndexOf("/") + 1, image.lastIndexOf("."));
if (index.equals(String.valueOf(i))) {
sb.append("<p><img src=\" " + image.substring(0, image.lastIndexOf("g")+1) + " \" /></p>");
sb.append("<p><br></p>");
}
}
}
return sb.toString();
}
return null;
}
public String downLoadFromUrl(String urlStr, String fileName, String outputFilePath) {
File file = null;
// FileInfo fileInfo = new FileInfo();
try {
URL url = new URL(urlStr);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
//防止屏蔽程序抓取而返回403错误
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
conn.setRequestProperty("Charsert", "UTF-8");
conn.setRequestProperty("Accept-Charset", "UTF-8");
//得到输入流
InputStream inputStream = conn.getInputStream();
//获取自己数组
byte[] buffer = new byte[1024];
int len = 0;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
while ((len = inputStream.read(buffer)) != -1) {
bos.write(buffer, 0, len);
}
bos.close();
byte[] getData = bos.toByteArray();
//文件保存位置
File saveDir = new File(outputFilePath);
if (!saveDir.exists()) {
saveDir.mkdirs();
}
file = new File(saveDir + File.separator + fileName);
FileOutputStream fos = new FileOutputStream(file);
fos.write(getData);
if (fos != null) {
fos.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (Exception e) {
LOGGER.info("fileName={},outputFilePath={}", fileName, outputFilePath);
LOGGER.info("urlStr={},异常={}", urlStr, JSON.toJSONString(e));
}
return file.getAbsolutePath();
}
// /**
// * pdf转pdf(scale 默认1.0)
// * @param pdfPath pdf路径
// * @param outputFilePath 输出图片路径
// * @param endPage 截取到n页结束
// * @param filename 文件名
// * @throws InterruptedException
// * @throws PDFException
// * @throws PDFSecurityException
// * @throws IOException
// */
// public boolean convert(String pdfPath, String outputFilePath,int endPage,String filename)
// throws InterruptedException, PDFException, PDFSecurityException, IOException {
// return convert(pdfPath, outputFilePath,1.0f,endPage,filename);
// }
public String pdfToPng(String pdfPath, String outputFilePath, int dpi, int flag) {
try {
boolean retStatus = pdfToPng1(pdfPath, outputFilePath, 1.5f, flag, "");
} catch (Exception e) {
LOGGER.info("Pdf转Png发生错误{}", JSON.toJSONString(e));
}
return outputFilePath;
}
/**
* pdf转pdf
*
* @param pdfPath pdf路径
* @param outputFilePath 输出图片路径
* @param scale 放大比例 (放大比例越大越清晰)
* @param endPage 截取到n页结束
* @param filename 文件名
* @throws InterruptedException
* @throws PDFException
* @throws PDFSecurityException
* @throws IOException
*/
public boolean pdfToPng1(String pdfPath, String outputFilePath, float scale, int endPage, String filename)
throws InterruptedException, PDFException, PDFSecurityException, IOException {
if (createDirectory(outputFilePath)) {
Document document = new Document();
document.setFile(pdfPath);
int pages = document.getNumberOfPages();
if (endPage > 0) {//大于0则打印具体页数
if (endPage < pages) {
pages = endPage;
}
}
//float scale = 2.0f;
float rotation = 0f;
for (int i = 0; i < pages; i++) {
BufferedImage image = (BufferedImage)
document.getPageImage(i,
GraphicsRenderingHints.PRINT,
Page.BOUNDARY_TRIMBOX, rotation, scale);
RenderedImage rendImage = image;
String imgFilePathPrefix = outputFilePath + File.separator + filename + (i + 1) + ".png";
File file = new File(imgFilePathPrefix);
ImageIO.write(rendImage, "png", file);
image.flush();
document.dispose();
}
}
return true;
}
private static boolean createDirectory(String folder) {
File dir = new File(folder);
if (dir.exists()) {
return true;
} else {
return dir.mkdirs();
}
}
//删除法目录方法
private static boolean deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
//递归删除目录中的子目录下
for (int i = 0; i < children.length; i++) {
boolean success = deleteDir(new File(dir, children[i]));
if (!success) {
return false;
}
}
}
// 目录此时为空,可以删除
return dir.delete();
}
}
package com.yizhi.documents.application.util;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @web
* @author admmin
* @Description: 文件下载 POST GET
*/
public class HttpClientUtils {
/**
* 最大线程池
*/
public static final int THREAD_POOL_SIZE = 5;
public interface HttpClientDownLoadProgress {
public void onProgress(int progress);
}
public static HttpClientUtils httpClientDownload;
public ExecutorService downloadExcutorService;
public HttpClientUtils() {
downloadExcutorService = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
}
public static HttpClientUtils getInstance() {
if (httpClientDownload == null) {
httpClientDownload = new HttpClientUtils();
}
return httpClientDownload;
}
/**
* 下载文件
*
* @param url
* @param filePath
*/
public void download(final String url, final String filePath) {
downloadExcutorService.execute(new Runnable() {
@Override
public void run() {
httpDownloadFile(url, filePath, null, null);
}
});
}
/**
* 下载文件
*
* @param url
* @param filePath
* @param progress
* 进度回调
*/
public void download(final String url, final String filePath,
final HttpClientDownLoadProgress progress) {
downloadExcutorService.execute(new Runnable() {
@Override
public void run() {
httpDownloadFile(url, filePath, progress, null);
}
});
}
/**
* 下载文件
*
* @param url
* @param filePath
*/
public void httpDownloadFile(String url, String filePath,
HttpClientDownLoadProgress progress, Map<String, String> headMap) {
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpGet httpGet = new HttpGet(url);
setGetHead(httpGet, headMap);
CloseableHttpResponse response1 = httpclient.execute(httpGet);
try {
System.out.println(response1.getStatusLine());
HttpEntity httpEntity = response1.getEntity();
long contentLength = httpEntity.getContentLength();
InputStream is = httpEntity.getContent();
// 根据InputStream 下载文件
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buffer = new byte[4096];
int r = 0;
long totalRead = 0;
while ((r = is.read(buffer)) > 0) {
output.write(buffer, 0, r);
totalRead += r;
if (progress != null) {// 回调进度
progress.onProgress((int) (totalRead * 100 / contentLength));
}
}
FileOutputStream fos = new FileOutputStream(filePath);
output.writeTo(fos);
output.flush();
output.close();
fos.close();
EntityUtils.consume(httpEntity);
} finally {
response1.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* get请求
*
* @param url
* @return
*/
public String httpGet(String url) {
return httpGet(url, null);
}
/**
* http get请求
*
* @param url
* @return
*/
public String httpGet(String url, Map<String, String> headMap) {
String responseContent = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpGet httpGet = new HttpGet(url);
CloseableHttpResponse response1 = httpclient.execute(httpGet);
setGetHead(httpGet, headMap);
try {
System.out.println(response1.getStatusLine());
HttpEntity entity = response1.getEntity();
responseContent = getRespString(entity);
System.out.println("debug:" + responseContent);
EntityUtils.consume(entity);
} finally {
response1.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return responseContent;
}
public String httpPost(String url, Map<String, String> paramsMap) {
return httpPost(url, paramsMap, null);
}
/**
* http的post请求
*
* @param url
* @param paramsMap
* @return
*/
public String httpPost(String url, Map<String, String> paramsMap,
Map<String, String> headMap) {
String responseContent = null;
CloseableHttpClient httpclient = HttpClients.createDefault();
try {
HttpPost httpPost = new HttpPost(url);
setPostHead(httpPost, headMap);
setPostParams(httpPost, paramsMap);
CloseableHttpResponse response = httpclient.execute(httpPost);
try {
System.out.println(response.getStatusLine());
HttpEntity entity = response.getEntity();
responseContent = getRespString(entity);
EntityUtils.consume(entity);
} finally {
response.close();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("responseContent = " + responseContent);
return responseContent;
}
/**
* 设置POST的参数
*
* @param httpPost
* @param paramsMap
* @throws Exception
*/
public void setPostParams(HttpPost httpPost, Map<String, String> paramsMap)
throws Exception {
if (paramsMap != null && paramsMap.size() > 0) {
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
Set<String> keySet = paramsMap.keySet();
for (String key : keySet) {
nvps.add(new BasicNameValuePair(key, paramsMap.get(key)));
}
// httpPost.setEntity(new UrlEncodedFormEntity(nvps));
httpPost.setEntity(new UrlEncodedFormEntity(nvps, StandardCharsets.UTF_8));
}
}
/**
* 设置http的HEAD
*
* @param httpPost
* @param headMap
*/
public void setPostHead(HttpPost httpPost, Map<String, String> headMap) {
if (headMap != null && headMap.size() > 0) {
Set<String> keySet = headMap.keySet();
for (String key : keySet) {
httpPost.addHeader(key, headMap.get(key));
}
}
}
/**
* 设置http的HEAD
*
* @param httpGet
* @param headMap
*/
public void setGetHead(HttpGet httpGet, Map<String, String> headMap) {
if (headMap != null && headMap.size() > 0) {
Set<String> keySet = headMap.keySet();
for (String key : keySet) {
httpGet.addHeader(key, headMap.get(key));
}
}
}
/**
* 上传文件
*
* @param serverUrl
* 服务器地址
* @param localFilePath
* 本地文件路径
* @param serverFieldName
* @param params
* @return
* @throws Exception
*/
/**
* 将返回结果转化为String
*
* @param entity
* @return
* @throws Exception
*/
public String getRespString(HttpEntity entity) throws Exception {
if (entity == null) {
return null;
}
InputStream is = entity.getContent();
StringBuffer strBuf = new StringBuffer();
byte[] buffer = new byte[4096];
int r = 0;
while ((r = is.read(buffer)) > 0) {
strBuf.append(new String(buffer, 0, r, "UTF-8"));
}
return strBuf.toString();
}
}
package com.yizhi.documents.application.util;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSException;
import com.aliyun.oss.model.CompleteMultipartUploadResult;
import com.aliyun.oss.model.UploadFileRequest;
import com.aliyun.oss.model.UploadFileResult;
import com.netflix.client.ClientException;
public class OssUpload {
public static String upload(String uploadFile,String key,String active){
String endpoint = "";
String accessKeyId = "";
String accessKeySecret = "";
String bucketName = "";
if ("dev".equals(active)||"sit".equals(active)||"uat".equals(active)) {
endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
accessKeyId = "LTAInZlfTwk5fCDJ";
accessKeySecret = "UavtbFb2vUvRxiwUMLvUEelXTQtHCB";
bucketName = "fulan-test";
} else {
endpoint = "http://oss-cn-shanghai.aliyuncs.com";
accessKeyId = "LTAIeBliOjnD6v25";
accessKeySecret = "qd6iAV7tUvumvEiXxv9IGJbSdHcnmH";
bucketName = "cloud-wmy";
}
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
try {
UploadFileRequest uploadFileRequest = new UploadFileRequest(bucketName, key);
// 待上传的本地文件
uploadFileRequest.setUploadFile(uploadFile);
// 设置并发下载数,默认1
uploadFileRequest.setTaskNum(5);
// 设置分片大小,默认100KB
uploadFileRequest.setPartSize(1024 * 1024 * 1);
// 开启断点续传,默认关闭
uploadFileRequest.setEnableCheckpoint(true);
UploadFileResult uploadResult = ossClient.uploadFile(uploadFileRequest);
CompleteMultipartUploadResult multipartUploadResult =
uploadResult.getMultipartUploadResult();
System.out.println(multipartUploadResult.getLocation());
return multipartUploadResult.getLocation();
} catch (OSSException oe) {
System.out.println("Caught an OSSException, which means your request made it to OSS, "
+ "but was rejected with an error response for some reason.");
System.out.println("Error Message: " + oe.getErrorCode());
System.out.println("Error Code: " + oe.getErrorCode());
System.out.println("Request ID: " + oe.getRequestId());
System.out.println("Host ID: " + oe.getHostId());
return "error";
} catch (ClientException ce) {
System.out.println("Caught an ClientException, which means the client encountered "
+ "documents serious internal problem while trying to communicate with OSS, "
+ "such as not being able to access the network.");
System.out.println("Error Message: " + ce.getMessage());
return "error";
} catch (Throwable e) {
e.printStackTrace();
return "error";
} finally {
ossClient.shutdown();
}
}
}
package com.yizhi.documents.application.util;
import com.itextpdf.text.log.Logger;
import com.itextpdf.text.log.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 上传文件转换为图片 进行逻辑判断 完成
*
* @author wangfeida
*/
@Component
public class UpConvert {
private final Logger logger = LoggerFactory.getLogger(UpConvert.class);
@Autowired
private CommonUtils commonUtils;
/** 测试函数
* inputFilePathName 网络流的url
* fileName 生成的文件名字
* outputFilePath 输出路径
* dpi 分辨率 值越大分辨率越高 转换效率也越长
* flag 0
* openOffice 插件所在的路径
*
* @param args
* @throws IOException
*/
// public static void main(String[] args) throws IOException {
// String url="http://fulan-test.oss-cn-hangzhou.aliyuncs.com/%E6%B5%8B%E8%AF%95%E7%8E%AF%E5%A2%83%E5%8F%91%E5%B8%832018.02.28.docx";
//// String url2="http://fulan-test.oss-cn-hangzhou.aliyuncs.com/%E7%AE%80%E5%8E%86.pdf";
// String outputFilePath=UtilConstants.DOC_PATH;
// int dpi=1000;
// int flag=0;
// String fileName = "简历.docx";
//// String fileName2 = "注册.pdf";
// String openOffice= UtilConstants.OPENOFFICE_PATH;
// UpConvert upConvert=new UpConvert();
// String x=upConvert.convert(url,fileName,outputFilePath, dpi,flag,openOffice);
// System.out.println(x);
// }
/**
* inputFilePathName 网络流的url
* fileName 生成的文件名字
* outputFilePath 输出路径
* dpi 分辨率 值越大分辨率越高 转换效率也越长
* flag 0
* openOffice 插件所在的路径
*
* @throws IOException
*/
//inputFilePathName 流名字
public String convert(String url, String fileName, String outputFilePath, int dpi, int flag, String getofficeHome) throws IOException {
String filePath = commonUtils.downLoadFromUrl(url, fileName, outputFilePath); //网络流地址 需要保存的文件名字 保存的路径 filePath是文件的下载地址
//判断是否是指定的几种类型
String suffix = fileName.substring(fileName.lastIndexOf(".") + 1);
if (isAppoint(suffix)) {
//创建文件夹
File file1 = new File(filePath);
int dot = file1.getName().lastIndexOf('.');
String imagePDFName = file1.getName().substring(0, dot);
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");//设置日期格式
outputFilePath = outputFilePath + File.separator + imagePDFName + df.format(new Date()); //此目录下创建一个以传入文件名字的文件夹
String result = commonUtils.pdfToPng(filePath, outputFilePath, dpi, flag);
file1.delete();
return result;
} else {
return "不是指定的格式";
}
}
/**
* 判断文件类型是否是指定的文件类型
*/
public boolean isAppoint(String fileName) {
if (fileName.equals("pdf") || fileName.equals("ppt") || fileName.equals("pptx") || fileName.equals("doc")
|| fileName.equals("docx") || fileName.equals("xls") || fileName.equals("xlsx")
|| fileName.equals("csv")) {
return true;
} else {
logger.error("文件格式错误");
return false;
}
}
}
package com.yizhi.documents.application.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yizhi.documents.application.enums.DocumentType;
import com.yizhi.core.application.cache.RedisCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
public class WorkUtil {
@Autowired
private RedisCache redisCache;
private static final int expireTime = 3;
@Value("${polyv.remote.url}")
private String polyvUrl;
@Value("${polyv.writetoken}")
private String writeToken;
@Value("${polyv.cataId}")
private String cataId;
private Logger LOGGER = LoggerFactory.getLogger(WorkUtil.class);
public Integer documentType(String suffixName) {
if (suffixName.equalsIgnoreCase("pdf") || suffixName.equalsIgnoreCase("doc") || suffixName.equalsIgnoreCase("xlsx")
|| suffixName.equalsIgnoreCase("xls") || suffixName.equalsIgnoreCase("ppt")
|| suffixName.equalsIgnoreCase("pptx") || suffixName.equalsIgnoreCase("docx")) {
return DocumentType.DOCUMENT.getType();
}
if (suffixName.equalsIgnoreCase("bmp") || suffixName.equalsIgnoreCase("jpg") || suffixName.equalsIgnoreCase("png") || suffixName.equalsIgnoreCase("tif")
|| suffixName.equalsIgnoreCase("gif") || suffixName.equalsIgnoreCase("pcx") || suffixName.equalsIgnoreCase("tga")
|| suffixName.equalsIgnoreCase("exif") || suffixName.equalsIgnoreCase("fpx") || suffixName.equalsIgnoreCase("svg")
|| suffixName.equalsIgnoreCase("psd") || suffixName.equalsIgnoreCase("cdr") || suffixName.equalsIgnoreCase("pcd")
|| suffixName.equalsIgnoreCase("dxf") || suffixName.equalsIgnoreCase("ufo") || suffixName.equalsIgnoreCase("eps")
|| suffixName.equalsIgnoreCase("ai") || suffixName.equalsIgnoreCase("raw") || suffixName.equalsIgnoreCase("WMF")
|| suffixName.equalsIgnoreCase("webp")|| suffixName.equalsIgnoreCase("jpeg")) {
return DocumentType.PICTURE.getType();
}
if (suffixName.equalsIgnoreCase("mp3") || suffixName.equalsIgnoreCase("wma") || suffixName.equalsIgnoreCase("wav")
|| suffixName.equalsIgnoreCase("mp3pro") || suffixName.equalsIgnoreCase("cd") || suffixName.equalsIgnoreCase("wave")
|| suffixName.equalsIgnoreCase("aiff") || suffixName.equalsIgnoreCase("mpeg") || suffixName.equalsIgnoreCase("mpeg-4")
|| suffixName.equalsIgnoreCase("midi") || suffixName.equalsIgnoreCase("RealAudio") || suffixName.equalsIgnoreCase("VQF")
|| suffixName.equalsIgnoreCase("OggVorbis") || suffixName.equalsIgnoreCase("AMR") || suffixName.equalsIgnoreCase("APE")
|| suffixName.equalsIgnoreCase("FLAC") || suffixName.equalsIgnoreCase("AAC") || suffixName.equalsIgnoreCase("ogg")
|| suffixName.equalsIgnoreCase("flac") || suffixName.equalsIgnoreCase("aac")) {
return DocumentType.AUDIO.getType();
}
if (suffixName.equalsIgnoreCase("mp4") || suffixName.equalsIgnoreCase("avi") || suffixName.equalsIgnoreCase("mov") || suffixName.equalsIgnoreCase("flv")
|| suffixName.equalsIgnoreCase("mvb") || suffixName.equalsIgnoreCase("MPEG") || suffixName.equalsIgnoreCase("ASF")
|| suffixName.equalsIgnoreCase("3GP") || suffixName.equalsIgnoreCase("MKV") || suffixName.equalsIgnoreCase("F4V")
|| suffixName.equalsIgnoreCase("RMVB") || suffixName.equalsIgnoreCase("RM") || suffixName.equalsIgnoreCase("MOV")
|| suffixName.equalsIgnoreCase("QT") || suffixName.equalsIgnoreCase("NAVI") || suffixName.equalsIgnoreCase("DivX")
|| suffixName.equalsIgnoreCase("MPG") || suffixName.equalsIgnoreCase("DAT") || suffixName.equalsIgnoreCase("rm")
|| suffixName.equalsIgnoreCase("vob") || suffixName.equalsIgnoreCase("rmvb") || suffixName.equalsIgnoreCase("mkv")
|| suffixName.equalsIgnoreCase("f4v") || suffixName.equalsIgnoreCase("3gp") || suffixName.equalsIgnoreCase("wmv")
|| suffixName.equalsIgnoreCase("vob")) {
return DocumentType.VIDEO.getType();
}
return DocumentType.OTHER.getType();
}
public boolean lock(String cachKey) {
String key = "lock_documents:" + cachKey;
String value = "xxxx";
Boolean result = redisCache.setIfAbsent(key, value);// 0 已经存在 1原始不存在
if (result) {// 如果不存在,存储完,给设置过期时间
redisCache.expire(key, expireTime);
return true;
}
// 如果已经存在,证明有别的服务给设置过
return false;
}
/**
* 锁释放
*
* @param cachKey
*/
public void dealLock(String cachKey) {
String key = "lock_documents:" + cachKey;
redisCache.delete(key);
}
/**
* 上传保利威视
*
* @param
* @date 2019年3月4日
*/
public String polyUploadVid(String fileName, String fileUrl) {
HttpClientUtils httpClientUtils = new HttpClientUtils();
// 远程上传保利威视 视频
Map<String, String> polyvMap = new HashMap<String, String>(16);
polyvMap.put("fileUrl", fileUrl);
polyvMap.put("writetoken", writeToken);
polyvMap.put("title", fileName);
polyvMap.put("cataid",cataId);
LOGGER.info("参数的polyvMap:" + polyvMap);
String reStr = httpClientUtils.httpPost(polyvUrl, polyvMap);
LOGGER.info("上传保利威视的远程视的结果:" + reStr);
JSONObject polyResult = JSON.parseObject(reStr);
LOGGER.info("保利威视返回的结果:" + reStr);
if (null != reStr && polyResult.containsKey("data")) {
String data = polyResult.getString("data");
JSONArray jsonArray = JSON.parseArray(data);
JSONObject dat = JSON.parseObject(jsonArray.get(0).toString());
String vid = dat.getString("vid");
LOGGER.info("保利威视的vid:" + vid);
return vid;
} else {
LOGGER.info("视频上传异常!");
return null;
}
}
}
\ No newline at end of file
server.port=35006
spring.application.name=documents
ACTIVE=${spring.profiles.active}
spring.profiles.active=wmy401
# nacos
spring.cloud.nacos.config.shared-dataids=common-${spring.profiles.active}.properties
spring.cloud.nacos.config.namespace=${spring.profiles.active}
spring.cloud.nacos.config.prefix=${spring.application.name}
spring.cloud.nacos.config.file-extension=properties
spring.cloud.nacos.config.server-addr=127.0.0.1:8850
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.documents.application.mapper.ClassifyMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yizhi.documents.application.domain.DocumentClassify">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="root_id" property="rootId"/>
<result column="layer" property="layer"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="description" property="description"/>
<result column="deleted" property="deleted"/>
<result column="create_by_id" property="createById"/>
<result column="create_by_name" property="createByName"/>
<result column="create_time" property="createTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by_name" property="updateByName"/>
<result column="update_time" property="updateTime"/>
<result column="site_id" property="siteId"/>
<result column="org_id" property="orgId"/>
<result column="company_id" property="companyId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, parent_id, root_id, layer, name, code, description, deleted, create_by_id, create_by_name, create_time, update_by_id, update_by_name, update_time, site_id, org_id, company_id
</sql>
<select id="queryMaxCode" resultType="java.lang.Integer">
select Max(code) from classify c
where c.layer =1 and c.deleted = 0 and c.site_id = #{siteId} and c.company_id = #{companyId}
</select>
<resultMap id="ClassifyVoMap" type="com.yizhi.documents.application.vo.documents.DocumentClassifyVo">
<id column="id" property="id"/>
<result column="parent_id" property="parentId"/>
<result column="root_id" property="rootId"/>
<result column="layer" property="layer"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="description" property="description"/>
</resultMap>
<select id="queryClassifyTree" resultMap="ClassifyVoMap">
select c.id, c.parent_id, c.root_id, c.layer, c.name, c.code, c.description from classify c
where c.deleted =0 and c.site_id = #{siteId} and c.company_id = #{companyId}
</select>
<select id="haveChildrenClassify" resultType="java.lang.Integer">
select count(1) from classify c
where c.deleted =0 and c.site_id = #{siteId} and c.company_id = #{companyId}
<if test="classifyId != null">
and (c.parent_id =#{classifyId} or c.root_id=#{classifyId})
</if>
</select>
<select id="queryChildrenClassify" resultType="java.lang.Long">
select id from classify c
where c.deleted =0 and c.site_id = #{siteId} and c.company_id = #{companyId}
<if test="classifyId != null">
and c.id = #{classifyId} or c.parent_id =#{classifyId} or c.root_id = #{classifyId}
</if>
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.documents.application.mapper.DocumentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yizhi.documents.application.domain.Document">
<id column="id" property="id"/>
<result column="classify_id" property="classifyId"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="code_name" property="codeName"/>
<result column="download_times" property="downloadTimes"/>
<result column="u_id" property="uId"/>
<result column="v_id" property="vId"/>
<result column="file_size" property="fileSize"/>
<result column="file_name" property="fileName"/>
<result column="type" property="type"/>
<result column="url" property="url"/>
<result column="deleted" property="deleted"/>
<result column="create_by_id" property="createById"/>
<result column="create_by_name" property="createByName"/>
<result column="create_time" property="createTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by_name" property="updateByName"/>
<result column="update_time" property="updateTime"/>
<result column="site_id" property="siteId"/>
<result column="org_id" property="orgId"/>
<result column="company_id" property="companyId"/>
<result column="suffix_name" property="suffixName"/>
<result column="keywords" property="keywords"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, classify_id, u_id,name,v_id, code,code_name, download_times,vId file_size,file_name,type, url, deleted, create_by_id, create_by_name, create_time, update_by_id, update_by_name, update_time, site_id, org_id, company_id,suffix_name,keywords
</sql>
<select id="queryMaxCode" resultType="java.lang.Integer">
select Max(code) from document d
where d.deleted =0 and d.site_id = #{siteId} and d.company_id = #{companyId}
and date_format(d.create_time,'%Y%m%d')= #{currentDate}
</select>
<resultMap id="DocumentVoMap" type="com.yizhi.documents.application.vo.documents.DocumentVo">
<id column="id" property="id"/>
<result column="documentRelationId" property="documentRelationId"/>
<result column="classify_id" property="classifyId"/>
<result column="name" property="name"/>
<result column="code" property="code"/>
<result column="code_name" property="codeName"/>
<result column="u_id" property="uId"/>
<result column="v_id" property="vId"/>
<result column="file_name" property="fileName"/>
<result column="download_times" property="downloadTimes"/>
<result column="file_size" property="fileSize"/>
<result column="type" property="type"/>
<result column="url" property="url"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="create_by_name" property="createAccounName"/>
<result column="suffix_name" property="suffixName"/>
<result column="keywords" property="keywords"/>
</resultMap>
<select id="queryOnCondition" resultMap="DocumentVoMap">
select id, classify_id,u_id, name, code,code_name, download_times, file_size,file_name, type, url,create_time,update_time,create_by_name,suffix_name,keywords
from
document d
where d.deleted = 0 and d.site_id = #{siteId} and d.company_id = #{companyId}
<if test="classifyIds != null and classifyIds.size()>0">
and d.classify_id in
<foreach collection="classifyIds" item="classifyId" open="(" separator="," close=")">
#{classifyId}
</foreach>
</if>
<if test="name != null and name !=''">
and (d.name like concat('%',#{name},'%')
or d.code_name like concat('%',#{name},'%')
or d.keywords like concat('%',#{name},'%'))
</if>
<if test="type != null and type > 0">
and d.type = #{type}
</if>
<if test="filterDocumentIds !=null and filterDocumentIds.size()>0">
and d.id not in
<foreach collection="filterDocumentIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="enableTypeFilter==1">
and d.suffix_name in('mp3','wma','wav','ape','flac','ogg','aac','mp4','wmv','vob','mpg','mov','mkv','flv','3gp','f4v','rmvb','avi','PDF','jpeg','jpg','png','gif')
</if>
<if test="startDate != null and startDate != '' and endDate != null and endDate !=''">
and create_time BETWEEN str_to_date( #{startDate}, '%Y-%m-%d %H:%i:%s'
)
AND str_to_date( #{endDate}, '%Y-%m-%d
%H:%i:%s' )
</if>
order by create_time desc
</select>
<select id="queryByRelationId" resultMap="DocumentVoMap">
select d.id,dr.id as documentRelationId, d.code_name,d.classify_id,
d.name, d.code, d.download_times, d.file_size,d.file_name, d.type, d.url,d.create_time,d.keywords,
d.suffix_name
from document d
INNER JOIN document_relation dr ON (dr.document_id = d.id AND dr.deleted = 0 AND dr.site_id =#{siteId} AND dr.company_id = #{companyId}
AND dr.relation_id = #{relationId} AND dr.relation_type = #{relationType})
where d.deleted =0 and d.site_id = #{siteId} and d.company_id = #{companyId}
ORDER BY dr.sort
</select>
<select id="initalData" resultMap="BaseResultMap">
select * from document
where type =4 and deleted=0 and v_id is null
</select>
<update id="verifyVideo">
update document
set is_video = 1
where id in
(<foreach collection="ids" separator="," item="id">
#{id}
</foreach>)
</update>
<update id="updateVedioTranscodeUrl">
update document
set video_ld = #{videoLd},video_sd = #{videoSd},video_hd = #{videoHd}
where id = #{id}
</update>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.documents.application.mapper.DocumentRelationMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yizhi.documents.application.domain.DocumentRelation">
<id column="id" property="id"/>
<result column="document_id" property="documentId"/>
<result column="relation_type" property="relationType"/>
<result column="relation_id" property="relationId"/>
<result column="sort" property="sort"/>
<result column="deleted" property="deleted"/>
<result column="create_by_id" property="createById"/>
<result column="create_by_name" property="createByName"/>
<result column="create_time" property="createTime"/>
<result column="update_by_id" property="updateById"/>
<result column="update_by_name" property="updateByName"/>
<result column="update_time" property="updateTime"/>
<result column="site_id" property="siteId"/>
<result column="org_id" property="orgId"/>
<result column="company_id" property="companyId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, document_id,relation_type, relation_id,sort,deleted, create_by_id, create_by_name, create_time, update_by_id, update_by_name, update_time, site_id, org_id, company_id
</sql>
<select id="returnDocumentIds" resultType="java.lang.Long">
select document_id from document_relation d
where d.deleted =0 and d.site_id = #{siteId} and d.company_id = #{companyId}
and d.relation_type= #{relationType}and d.relation_id =#{relationId}
order by d.sort
</select>
<update id="delete">
update document_relation d set d.deleted = 1
where d.site_id = #{siteId} and d.company_id = #{companyId}
<if test="id != null">
and d.id = #{id}
</if>
<if test="documentId != null">
and d.document_id = #{documentId}
</if>
</update>
<select id="queryMaxSort" resultType="java.lang.Integer">
select max(sort) from document_relation d
where d.deleted =0 and d.site_id = #{siteId} and d.company_id = #{companyId}
and d.relation_type= #{relationType}and d.relation_id =#{relationId}
</select>
<select id="queryBySort" resultMap="BaseResultMap">
select id,sort from document_relation d
where d.deleted = 0 and d.site_id = #{siteId} and d.company_id = #{companyId}
and d.relation_type= #{relationType}and d.relation_id =#{relationId}
<if test="moveType == 1">
and <![CDATA[#{orgiSort} > d.sort]]>
ORDER BY sort desc
</if>
<if test="moveType == 2">
and <![CDATA[#{orgiSort} < d.sort]]>
ORDER BY sort
</if>
limit 1
</select>
<select id="getFilterDocumentIds" resultType="java.lang.Long">
select document_id from document_relation d
where d.deleted =0 and d.site_id = #{siteId} and d.company_id = #{companyId}
and d.relation_type= #{relationType}and d.relation_id =#{relationId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yizhi.documents.application.mapper.DownloadRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.yizhi.documents.application.domain.DownloadRecord">
<id column="id" property="id" />
<result column="document_id" property="documentId" />
<result column="document_name" property="documentName" />
<result column="termial_type" property="termialType" />
<result column="url" property="url" />
<result column="create_by_id" property="createById" />
<result column="create_by_name" property="createByName" />
<result column="create_time" property="createTime" />
<result column="update_by_id" property="updateById" />
<result column="update_by_name" property="updateByName" />
<result column="update_time" property="updateTime" />
<result column="site_id" property="siteId" />
<result column="org_id" property="orgId" />
<result column="company_id" property="companyId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, document_id, document_name, termial_type, url, create_by_id, create_by_name, create_time, update_by_id, update_by_name, update_time, site_id, org_id, company_id
</sql>
</mapper>
package com.yizhi.documents.application;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import static org.junit.Assert.*;
@SpringBootTest
@RunWith(SpringRunner.class)
public class DocumentVoProjectApplicationTest {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yizhi</groupId>
<artifactId>wmy-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modules>
<module>cloud-documents-api</module>
<module>cloud-documents-service</module>
</modules>
<groupId>com.yizhi</groupId>
<artifactId>cloud-documents</artifactId>
<version>1.0-SNAPSHOT</version>
<name>cloud-documents</name>
<packaging>pom</packaging>
<repositories>
<repository>
<id>wmy4.0</id>
<url>http://mvn.km365.pw/nexus/content/groups/wmy4.0-group/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment