From ed8c7a5effd0d423ce1118b680ecdca6fe732609 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 02 七月 2025 16:43:13 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.11.205:9000/r/P2022036_Service --- src/main/java/com/lf/server/controller/show/ApplyController.java | 42 ++++++++++++++++++++++++++++++++++++++---- 1 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/lf/server/controller/show/ApplyController.java b/src/main/java/com/lf/server/controller/show/ApplyController.java index 92c71e5..3d6f7c2 100644 --- a/src/main/java/com/lf/server/controller/show/ApplyController.java +++ b/src/main/java/com/lf/server/controller/show/ApplyController.java @@ -2,17 +2,21 @@ import com.lf.server.annotation.SysLog; import com.lf.server.controller.all.BaseController; +import com.lf.server.entity.all.HttpStatus; 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.DownloadEntity; import com.lf.server.entity.show.ApplyEntity; import com.lf.server.entity.show.FlowEntity; import com.lf.server.entity.sys.UserEntity; import com.lf.server.helper.AesHelper; import com.lf.server.helper.StringHelper; +import com.lf.server.helper.WebHelper; import com.lf.server.service.data.DownloadService; import com.lf.server.service.show.ApplyService; import com.lf.server.service.show.FlowService; +import com.lf.server.service.sys.DownlogService; import com.lf.server.service.sys.TokenService; import com.lf.server.service.sys.UserService; import io.swagger.annotations.Api; @@ -23,6 +27,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import java.sql.Timestamp; import java.util.List; @@ -46,6 +51,12 @@ @Autowired UserService userService; + @Autowired + DownlogService downlogService; + + @Autowired + DownloadService downloadService; + @SysLog() @ApiOperation(value = "鎻掑叆鏁版嵁鐢宠") @ApiImplicitParams({ @@ -61,9 +72,7 @@ if (StringHelper.isEmpty(dr.getPwd())) { return fail("瀵嗙爜涓嶈兘涓虹┖"); } - if (!DownloadService.decryptPwd(dr)) { - return fail("瀵嗙爜瑙e瘑澶辫触", null); - } + dr.setPwd(AesHelper.decrypt(dr.getPwd())); if (StringHelper.isPwdInvalid(dr.getPwd())) { return fail("瀵嗙爜涓嶇鍚堣姹�"); } @@ -225,7 +234,7 @@ int rows = applyService.updateForSubmit(ue.getId(), applyEntity.getId(), flowEntity.getId()); applyEntity = applyService.selectById(applyEntity.getId()); - if (StaticData.TEN == applyEntity.getStatus()) { + if (StaticData.I10 == applyEntity.getStatus()) { UserEntity user = userService.selectUser(applyEntity.getUserid()); applyService.zipDbData(user, applyEntity); } @@ -268,4 +277,29 @@ return fail(ex, null); } } + + @SysLog() + @ApiOperation(value = "涓嬭浇鏂囦欢") + @ApiImplicitParams({ + @ApiImplicitParam(name = "guid", value = "鏂囦欢GUID", dataType = "String", paramType = "query") + }) + @ResponseBody + @GetMapping(value = "/downloadFile") + public void downloadFile(String guid, HttpServletRequest req, HttpServletResponse res) { + try { + DownloadEntity de = downloadService.selectByGuid(guid); + if (null == de) { + WebHelper.writeInfo(HttpStatus.NOT_FOUND, "鏂囦欢涓嶅瓨鍦�", res); + return; + } + + UserEntity ue = tokenService.getCurrentUser(req); + downlogService.updateInfos(ue, de, req); + + String filePath = downloadService.getDownloadFilePath(de); + WebHelper.download(filePath, de.getName(), res); + } catch (Exception ex) { + WebHelper.writeInfo(HttpStatus.ERROR, ex.getMessage(), res); + } + } } -- Gitblit v1.9.3