Commit 98bee46a authored by liqin's avatar liqin 💬

bug fixed

parent c569dc0a
......@@ -108,10 +108,11 @@
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
<!-- FastDFS -->
<dependency>
<groupId>net.oschina.zcx7878</groupId>
<artifactId>fastdfs-client-java</artifactId>
<version>1.27.0.0</version>
<groupId>com.github.tobato</groupId>
<artifactId>fastdfs-client</artifactId>
<version>1.27.2</version>
</dependency>
<!-- Swagger2 Document -->
......
......@@ -118,8 +118,8 @@ public class FastDFSUtils {
StorageServer storageServer = null;
StorageClient storageClient = new StorageClient(trackerServer, storageServer);
StorePath storePath = StorePath.praseFromUrl(fileUrl);
int i = storageClient.delete_file(storePath.getGroup(), storePath.getPath());
StorePath1 storePath1 = StorePath1.praseFromUrl(fileUrl);
int i = storageClient.delete_file(storePath1.getGroup(), storePath1.getPath());
System.out.println(i == 0 ? "删除成功" : "删除失败:" + i);
return i == 0;
} catch (Exception e) {
......
package cn.wisenergy.chnmuseum.party.common.dfs;
import com.github.tobato.fastdfs.domain.fdfs.StorePath;
import com.github.tobato.fastdfs.domain.fdfs.ThumbImageConfig;
import com.github.tobato.fastdfs.domain.proto.storage.DownloadByteArray;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.apache.commons.io.FilenameUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
@Component
public class FdfsUtil {
@Resource
private FastFileStorageClient fastFileStorageClient;
@Resource
private ThumbImageConfig thumbImageConfig;
/**
* 上传文件
*
* @param file 文件对象
* @return storePath 文件在服务器中的存储路径 group1/M00/00/08/rBEAA2A_Ci2AU9pHAAYlnPgRYiA554.jpg
* @throws IOException
*/
public String uploadFile(MultipartFile file) throws IOException {
// StorePath storePath = fastFileStorageClient.uploadFile("aifruit", //默认都是放在aifruit分组group
StorePath storePath = fastFileStorageClient.uploadFile(file.getInputStream(),
file.getSize(),
FilenameUtils.getExtension(file.getOriginalFilename()), null);
return storePath.getFullPath(); //返回完整的图片存放路径(含group)
}
/**
* 下载文件(文件字节)
*
* @param fileUrl 文件服务器存储路径 group1/M00/00/08/rBEAA2A_Ci2AU9pHAAYlnPgRYiA554.jpg
* @return byte[] 文件字节
* @throws IOException
*/
public byte[] downloadFileByByte(String fileUrl) {
String group = fileUrl.substring(0, fileUrl.indexOf("/"));
String path = fileUrl.substring(fileUrl.indexOf("/") + 1);
return fastFileStorageClient.downloadFile(group, path, new DownloadByteArray());
}
}
......@@ -9,7 +9,7 @@ import org.apache.commons.lang3.Validate;
* @author yuqih
*
*/
public class StorePath {
public class StorePath1 {
private String group;
......@@ -24,7 +24,7 @@ public class StorePath {
/**
* 存储文件路径
*/
public StorePath() {
public StorePath1() {
}
/**
......@@ -33,7 +33,7 @@ public class StorePath {
* @param group
* @param path
*/
public StorePath(String group, String path) {
public StorePath1(String group, String path) {
super();
this.group = group;
this.path = path;
......@@ -95,7 +95,7 @@ public class StorePath {
* 有效的路径样式为(group/path) 或者 (http://ip/group/path),路径地址必须包含group
* @return
*/
public static StorePath praseFromUrl(String filePath) {
public static StorePath1 praseFromUrl(String filePath) {
Validate.notNull(filePath, "解析文件路径不能为空");
// 获取group起始位置
int groupStartPos = getGroupStartPos(filePath);
......@@ -108,7 +108,7 @@ public class StorePath {
String group = groupAndPath.substring(0, pos);
String path = groupAndPath.substring(pos + 1);
return new StorePath(group, path);
return new StorePath1(group, path);
}
/**
......
package cn.wisenergy.chnmuseum.party.conf;
import com.github.tobato.fastdfs.FdfsClientConfig;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableMBeanExport;
import org.springframework.context.annotation.Import;
import org.springframework.jmx.support.RegistrationPolicy;
@Configuration
@Import(FdfsClientConfig.class)
// Jmx重复注册bean的问题
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
public class FastDfsConfig {
}
......@@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -49,7 +50,9 @@ public class AssetTypeController extends BaseController {
@Resource
private CopyrightOwnerService copyrightOwnerService;
@PostMapping("/save")
@PostMapping(value = "/save",
headers = "content-type=multipart/form-data",
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@RequiresPermissions("asset:type:save")
@ApiOperation(value = "添加视频分类", notes = "添加视频分类")
public Map<String, Object> saveAssetType(@Validated(value = {Add.class}) AssetType assetType) {
......@@ -64,7 +67,9 @@ public class AssetTypeController extends BaseController {
}
}
@PutMapping("/update")
@PutMapping(value = "/update",
headers = "content-type=multipart/form-data",
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@RequiresPermissions("asset:type:update")
@ApiOperation(value = "修改视频分类信息", notes = "修改视频分类信息")
public Map<String, Object> updateAssetType(@Validated AssetType assetType) {
......@@ -75,7 +80,9 @@ public class AssetTypeController extends BaseController {
return getFailResult();
}
@DeleteMapping("/delete/{id}")
@DeleteMapping(value = "/delete/{id}",
headers = "content-type=multipart/form-data",
consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@RequiresPermissions("asset:type:delete")
@ApiOperation(value = "根据ID删除视频分类", notes = "根据ID删除视频分类")
@ApiImplicitParams(value = {
......
......@@ -192,7 +192,7 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiImplicitParam(name = "startDate", value = "创建时间-开始", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endDate", value = "创建时间-结束", paramType = "query", dataType = "String")
})
@PostMapping("/exhibitionBoard/getPageList")
@PostMapping("/exhibitionBoard/getPage")
@RequiresPermissions("exhibition:board:page")
@ApiOperation(value = "获取展板分页列表", notes = "获取展板分页列表")
public ResponseEntity<JSONObject> getExhibitionBoardPageList(GenericPageParam genericPageParam) {
......@@ -202,8 +202,8 @@ public class ChinaMobileRestApiController extends BaseController {
queryWrapper.like(ExhibitionBoard::getName, genericPageParam.getNameOrCode());
}
// 对版权方模糊查询
if (StringUtils.isNotBlank(genericPageParam.getCopyrightOwnerId())) {
queryWrapper.like(ExhibitionBoard::getCopyrightOwnerId, genericPageParam.getCopyrightOwnerId());
if (StringUtils.isNotBlank(genericPageParam.getBoardCopyrightOwnerId())) {
queryWrapper.like(ExhibitionBoard::getCopyrightOwnerId, genericPageParam.getBoardCopyrightOwnerId());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
......@@ -234,7 +234,7 @@ public class ChinaMobileRestApiController extends BaseController {
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "标识ID", dataType = "String", paramType = "path")
})
@GetMapping("/exhibitionBoard/get/{id}")
@GetMapping("/exhibitionBoard/getby/{id}")
@RequiresPermissions("exhibition:board:get:id")
public Map<String, Object> getById(@PathVariable("id") String id) {
ExhibitionBoard exhibitionBoard = exhibitionBoardService.getById(id);
......
......@@ -145,8 +145,8 @@ public class ExhibitionBoardController extends BaseController {
queryWrapper.like(ExhibitionBoard::getName, genericPageParam.getNameOrCode());
}
// 对版权方模糊查询
if (StringUtils.isNotBlank(genericPageParam.getCopyrightOwnerId())) {
queryWrapper.like(ExhibitionBoard::getCopyrightOwnerId, genericPageParam.getCopyrightOwnerId());
if (StringUtils.isNotBlank(genericPageParam.getBoardCopyrightOwnerId())) {
queryWrapper.like(ExhibitionBoard::getCopyrightOwnerId, genericPageParam.getBoardCopyrightOwnerId());
}
// 根据创建时间区间检索
if (genericPageParam.getStartDate() != null && genericPageParam.getEndDate() != null) {
......
......@@ -4,7 +4,7 @@ jwt.expiration=2592000
jwt.issuer=IATA
jwt.authenticationPath=/auth
jwt.authTokenPrefix=Bearer
cacheManager.principalIdFieldName = id
cacheManager.principalIdFieldName=id
mybatis-plus.check-config-location=true
......@@ -21,9 +21,15 @@ mybatis-plus.configuration.cache-enabled=false
mybatis-plus.configuration.call-setters-on-nulls=true
mybatis-plus.configuration.jdbc-type-for-null=null
########################################################
###FastDFS
########################################################
fdfs.so-timeout=1501
fdfs.connect-timeout=601
fdfs.thumb-image.width=150
fdfs.thumb-image.height=150
fdfs.tracker-list[0]=192.168.110.85:22122
dfsFileAccessBasePath=http://111.203.232.175:8085
prefixPat=/data/fastdfs/data
IMAGE_BASE_URL=http://111.203.232.175:8085/
......@@ -45,7 +51,7 @@ spring.mvc.format.date=yyyy-MM-dd HH:mm:ss
spring.web.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/statics/,classpath:/public/
spring.servlet.multipart.enabled=true
spring.servlet.multipart.max-request-size=4096MB
spring.servlet.multipart.max-file-size=2048MB
spring.servlet.multipart.max-file-size=4096MB
spring.web.resources.add-mappings=true
#spring.mvc.converters.preferred-json-mapper=fastjson
......
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