Commit 468a6d44 authored by jiawei's avatar jiawei
parents 19b108be 70fea19a
......@@ -153,7 +153,7 @@ public class AssetController extends BaseController {
final List<TBoxOperation> tBoxOperationList = assetService.listBoxByOrgan();
final Map<String, InputStream> map = new LinkedHashMap<>(tBoxOperationList.size());
for (TBoxOperation tBoxOperation : tBoxOperationList) {
map.put(tBoxOperation.getOrganName() + "-" + tBoxOperation.getMac() + ".cipher", IoUtil.toStream(RSAUtils.encrypt(VideoEncryptUtil.cipher, tBoxOperation.getPublicKey()), StandardCharsets.UTF_8));
map.put(tBoxOperation.getOrganName() + "-" + tBoxOperation.getMac().replaceAll(":|-", "_") + ".cipher", IoUtil.toStream(RSAUtils.encrypt(VideoEncryptUtil.cipher, tBoxOperation.getPublicKey()), StandardCharsets.UTF_8));
}
ServletOutputStream outputStream = response.getOutputStream();
String[] paths = map.keySet().toArray(new String[0]);
......
......@@ -117,7 +117,7 @@ public class ChinaMobileRestApiController extends BaseController {
@RequiresAuthentication //@RequiresPermissions("equitment:key")
public Map<String, Object> getBoxPrivateKey(@RequestParam(value = "mac") String mac) {
try {
String macAddress = mac.trim().toUpperCase();
String macAddress = mac.trim().toUpperCase().replaceAll("-|_", ":");
final LambdaQueryWrapper<TBoxOperation> queryWrapper = Wrappers.<TBoxOperation>lambdaQuery().eq(TBoxOperation::getMac, macAddress);
final TBoxOperation tBoxOperation = this.boxOperationService.getOne(queryWrapper);
if (tBoxOperation != null) {
......@@ -660,7 +660,14 @@ public class ChinaMobileRestApiController extends BaseController {
current = currentList.get(0);
}
Map map = new HashMap();
map.put("isLatest", versionNo.equalsIgnoreCase(current.getAppVersion()));
if (StringUtils.isNotBlank(versionNo)) {
if (Long.parseLong(versionNo) >= Long.parseLong(current.getAppVersion())) {
map.put("isLatest", true);
}
} else {
map.put("isLatest", false);
}
map.put("versionNo", current.getAppVersion());
map.put("versionUrl", current.getApkUrl());
map.put("updateLog", current.getUpdateLog());
......
......@@ -17,7 +17,6 @@ import cn.wisenergy.chnmuseum.party.web.controller.base.BaseController;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.tobato.fastdfs.domain.fdfs.FileInfo;
import com.github.tobato.fastdfs.domain.fdfs.MetaData;
import com.github.tobato.fastdfs.exception.FdfsServerException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
......@@ -80,14 +79,14 @@ public class FileUploadController extends BaseController {
try {
FastDFSUtils.deleteFile(fileUrl);
FastDFSUtils.deleteFile(fileUrlCrypto);
} catch (FdfsServerException e) {
} catch (Throwable e) {
this.assetService.removeById(id);
return getResult("文件被已删除");
return getResult("文件已被删除");
}
this.assetService.removeById(id);
return getSuccessResult();
}
return getResult("文件被已删除");
return getResult("文件已被删除");
}
@ApiImplicitParams({
......@@ -178,6 +177,7 @@ public class FileUploadController extends BaseController {
final Set<MetaData> fileMetaData = FastDFSUtils.getFileMetaData(fileUrlCrypto);
String md5 = fileMetaData.stream().filter(x -> "MD5".equals(x.getName())).map(MetaData::getValue).findFirst().get();
asset.setMd5(md5);
asset.setFileUrlCrypto(md5 + ".chnmuseum");
} else if (Arrays.stream(AUDIO_TYPE).anyMatch(s -> Objects.equals(s, finalExtName.toUpperCase()))) {
metaDataSet.add(new MetaData("fileType", FileTypeEnum.AUDIO.name()));
handleResult.setFileType(FileTypeEnum.AUDIO.name());
......@@ -826,7 +826,7 @@ public class FileUploadController extends BaseController {
final long fileSize = fileInfo.getFileSize();
final Asset asset = Asset.builder()
.fileName(originalFilename)
.fileNameCrypto(baseName + ".chnmuseum")
.fileNameCrypto(md5 + ".chnmuseum")
.fileExtName(extName)
.fileType(FileTypeEnum.VIDEO.name())
.fileSize(fileSize)
......
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