data/db_fn.sql | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/controller/data/MetaController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/controller/show/DataLibController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/controller/show/ExportController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/controller/show/MarkController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/service/sys/DownlogService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
data/db_fn.sql
@@ -354,9 +354,7 @@ relnamespace in (29258) group by type; select count(*) from lf.sys_downlog a inner join lf.sys_user b on a.create_user = b.id inner join lf.sys_download c on a.downid = c.id WHERE 1 = 1 and b.uname like '%管理员%' and c.type = ? and a.create_time >= ? and a.create_time <= ? WHERE 1 = 1 and b.uname like '%管理员%' and c.type = 3 and a.create_time >= ? and a.create_time <= ? select * from lf.sys_download src/main/java/com/lf/server/controller/data/MetaController.java
@@ -23,6 +23,7 @@ import com.lf.server.service.all.BaseQueryService; import com.lf.server.service.data.DownloadService; import com.lf.server.service.data.MetaService; import com.lf.server.service.sys.DownlogService; import com.lf.server.service.sys.TokenService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; @@ -51,6 +52,9 @@ @Autowired BaseQueryService baseQueryService; @Autowired DownlogService downlogService; @Autowired DownloadService downloadService; @@ -445,9 +449,7 @@ } UserEntity ue = tokenService.getCurrentUser(req); de.setDcount(de.getDcount() + 1); de.setDownloadUser(ue.getId()); int rows = downloadService.update(de); downlogService.updateInfos(ue, de, req); String filePath = downloadService.getDownloadFilePath(de); WebHelper.download(filePath, de.getName(), res); src/main/java/com/lf/server/controller/show/DataLibController.java
@@ -10,7 +10,6 @@ import com.lf.server.entity.all.ResponseMsg; import com.lf.server.entity.all.StaticData; import com.lf.server.entity.ctrl.DownloadReqEntity; import com.lf.server.entity.data.DictEntity; import com.lf.server.entity.data.DownloadEntity; import com.lf.server.entity.data.MetaEntity; import com.lf.server.entity.data.MetaFileEntity; @@ -21,6 +20,7 @@ import com.lf.server.service.data.DownloadService; import com.lf.server.service.data.MetaService; import com.lf.server.service.show.DataLibService; import com.lf.server.service.sys.DownlogService; import com.lf.server.service.sys.TokenService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -52,6 +52,9 @@ @Autowired DataLibService dataLibService; @Autowired DownlogService downlogService; @Autowired DownloadService downloadService; @@ -237,9 +240,7 @@ } UserEntity ue = tokenService.getCurrentUser(req); de.setDcount(de.getDcount() + 1); de.setDownloadUser(ue.getId()); int rows = downloadService.update(de); downlogService.updateInfos(ue, de, req); String filePath = downloadService.getDownloadFilePath(de); WebHelper.download(filePath, de.getName(), res); src/main/java/com/lf/server/controller/show/ExportController.java
@@ -11,6 +11,7 @@ import com.lf.server.helper.WebHelper; import com.lf.server.service.data.DownloadService; import com.lf.server.service.show.ExportService; import com.lf.server.service.sys.DownlogService; import com.lf.server.service.sys.TokenService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -36,6 +37,9 @@ @Autowired ExportService exportService; @Autowired DownlogService downlogService; @Autowired DownloadService downloadService; @@ -117,16 +121,14 @@ return; } UserEntity ue = tokenService.getCurrentUser(req); DownloadEntity de = downloadService.selectByGuid(guid); if (null == de) { WebHelper.writeInfo(HttpStatus.NOT_FOUND, "文件不存在", res); return; } de.setDcount(de.getDcount() + 1); de.setDownloadUser(ue.getId()); int rows = downloadService.update(de); UserEntity ue = tokenService.getCurrentUser(req); downlogService.updateInfos(ue, de, req); String filePath = downloadService.getDownloadFilePath(de); WebHelper.download(filePath, de.getName(), res); src/main/java/com/lf/server/controller/show/MarkController.java
@@ -15,6 +15,7 @@ import com.lf.server.service.data.DownloadService; import com.lf.server.service.data.UploaderService; import com.lf.server.service.show.MarkService; import com.lf.server.service.sys.DownlogService; import com.lf.server.service.sys.TokenService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -43,6 +44,9 @@ @Autowired UploaderService uploaderService; @Autowired DownlogService downlogService; @Autowired DownloadService downloadService; @@ -289,9 +293,7 @@ WebHelper.write2Page(res, WebHelper.getErrJson(HttpStatus.NOT_FOUND, "文件不存在")); } de.setDcount(de.getDcount() + 1); de.setDownloadUser(ue.getId()); int rows = downloadService.update(de); downlogService.updateInfos(ue, de, req); String filePath = markService.getDownloadFilePath(de); WebHelper.download(filePath, de.getName(), res); src/main/java/com/lf/server/service/sys/DownlogService.java
@@ -1,11 +1,16 @@ package com.lf.server.service.sys; import com.lf.server.entity.data.DownloadEntity; import com.lf.server.entity.sys.DownlogEntity; import com.lf.server.entity.sys.UserEntity; import com.lf.server.helper.StringHelper; import com.lf.server.helper.WebHelper; import com.lf.server.mapper.sys.DownlogMapper; import com.lf.server.service.data.DownloadService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import java.sql.Timestamp; import java.util.List; @@ -17,6 +22,9 @@ public class DownlogService implements DownlogMapper { @Autowired DownlogMapper downlogMapper; @Autowired DownloadService downloadService; @Override public Integer selectCount(String uname, Integer type, Timestamp start, Timestamp end) { @@ -71,4 +79,20 @@ public Integer updates(List<DownlogEntity> list) { return downlogMapper.updates(list); } /** * 更新下载信息 */ public void updateInfos(UserEntity ue, DownloadEntity de, HttpServletRequest req) { de.setDcount(de.getDcount() + 1); de.setDownloadUser(ue.getId()); int rows = downloadService.update(de); DownlogEntity entity = new DownlogEntity(); entity.setDownid(de.getId()); entity.setCreateUser(ue.getId()); entity.setIp(WebHelper.getIpAddress(req)); rows = downlogMapper.insert(entity); } }