|
@@ -5,6 +5,7 @@ import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.io.file.FileWriter;
|
|
|
import cn.hutool.core.util.ZipUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.nacos.client.config.utils.IOUtils;
|
|
|
import com.alibaba.nacos.common.util.UuidUtils;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -320,23 +321,20 @@ public class ComListAllLogic {
|
|
|
}
|
|
|
|
|
|
public void download(String id, String downloadPwd, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
- AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
- //最多下载10个
|
|
|
- IPage<ComList> comListIPage = commonMapper.queryComList(new Page(1, 10), adminUser.getAdminWebsitIds(), adminUser.getUserName());
|
|
|
- if (CollectionUtils.isEmpty(comListIPage.getRecords())) {
|
|
|
- return;
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
+ ComList comList = comListService.getById(id);
|
|
|
+ if (comList.getIsPwd() && !StringUtils.equals(comList.getDownloadPwd(), downloadPwd)) {
|
|
|
+ throw new RemoteServiceException("下载密码校验失败,请联系相关人员");
|
|
|
}
|
|
|
- List<String> comListIds = comListIPage.getRecords().stream().map(ComList::getId).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(comListIds))
|
|
|
- return;
|
|
|
+ log.info("【中心文件下发下载】:{}", JSONObject.toJSONString(adminUser));
|
|
|
List<ComDetail> comDetails = comDetailService.lambdaQuery()
|
|
|
- .in(ComDetail::getComListId, comListIds)
|
|
|
- .in(ComDetail::getWebsitId, adminUser.getAdminWebsitIds()).list();
|
|
|
+ .eq(ComDetail::getComListId, id)
|
|
|
+ .in(ComDetail::getWebsitId, adminUser.getAdminWebsitIds())
|
|
|
+ .list();
|
|
|
+
|
|
|
if (CollectionUtils.isEmpty(comDetails)) {
|
|
|
- return;
|
|
|
+ throw new RemoteServiceException("暂无您可下载的内容");
|
|
|
}
|
|
|
- List<String> comDetailIds = comDetails.stream().map(ComDetail::getId).collect(Collectors.toList());
|
|
|
- comDetailService.lambdaUpdate().set(ComDetail::getIsDownload, true).in(ComDetail::getId, comDetailIds).update();
|
|
|
this.download(comDetails, adminUser, response);
|
|
|
}
|
|
|
|