From a13255b4129ee8a7a7b7e1ecd8e02dd2c78f7c17 Mon Sep 17 00:00:00 2001 From: 田源 <tianyuan@vci-tech.com> Date: 星期四, 16 一月 2025 16:19:20 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java | 50 ++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 38 insertions(+), 12 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java index 3d37d4c..cd18e44 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebPortalVIController.java @@ -1,13 +1,12 @@ package com.vci.web.controller; +import com.vci.constant.FrameWorkLangCodeConstant; import com.vci.corba.common.PLException; import com.vci.dto.ClonePortalVIDTOList; import com.vci.dto.DeletePortalVIDTOList; -import com.vci.dto.OsBtmTypeDTO; import com.vci.dto.PortalVIDTO; import com.vci.pagemodel.KeyValue; import com.vci.pagemodel.PortalVIVO; -import com.vci.starter.web.annotation.controller.VciUnCheckRight; import com.vci.starter.web.annotation.log.VciBusinessLog; import com.vci.starter.web.exception.VciBaseException; import com.vci.starter.web.pagemodel.BaseQueryObject; @@ -15,28 +14,29 @@ import com.vci.starter.web.pagemodel.DataGrid; import com.vci.starter.web.util.ControllerUtil; import com.vci.starter.web.util.LangBaseUtil; +import com.vci.starter.web.util.LocalFileUtil; import com.vci.starter.web.util.VciBaseUtil; import com.vci.web.enumpck.ItemDblEnum; -import com.vci.web.enumpck.ItemTypeEnum; +import com.vci.enumpck.UI.ItemTypeEnum; import com.vci.web.service.OsPortalVIServiceI; -import com.vci.web.service.WebBtmIOServiceI; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; - +import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; -import java.io.FileNotFoundException; +import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.List; /** - * 鍏紡鎺у埗鍣� + * 琛ㄥ崟/琛ㄦ牸鎺у埗鍣� * @author weidy * @date 2022-2-11 */ +@VciBusinessLog(modelName="琛ㄥ崟/琛ㄦ牸鎺у埗鍣�",notStore=true) @RestController @RequestMapping("/portalVIController") public class WebPortalVIController { @@ -93,10 +93,9 @@ }else{ return portalVIServiceI.addSave(portalVIDTO); } - } /** - * 涓氬姟绫诲瀷鍒犻櫎 + * 琛ㄥ崟/table鍒犻櫎 * btmTypeDTO 涓氬姟绫诲瀷瀵硅薄 * @return 鍒犻櫎缁撴灉 */ @@ -113,7 +112,7 @@ } } /** - * 涓氬姟绫诲瀷鍒犻櫎 + * 琛ㄥ崟/table鍒犻櫎 * btmTypeDTO 涓氬姟绫诲瀷瀵硅薄 * @return 鍒犻櫎缁撴灉 */ @@ -129,8 +128,11 @@ return BaseResult.fail(exceptionMessage); } } + /** - * + * 琛ㄥ崟/table鍏嬮殕 + * @param portalVIDTOList clong瀵硅薄 + * @return */ @PostMapping("/clone") @VciBusinessLog(operateName = "鍏嬮殕琛ㄥ崟/琛ㄦ牸") @@ -139,7 +141,7 @@ return portalVIServiceI.clone(portalVIDTOList) ? BaseResult.success("鍏嬮殕鎴愬姛锛�"):BaseResult.fail("鍏嬮殕澶辫触锛�"); } catch (Throwable e) { e.printStackTrace(); - String exceptionMessage = "鍒犻櫎琛ㄥ崟鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); + String exceptionMessage = "鍏嬮殕琛ㄥ崟/琛ㄦ牸鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e); logger.error(exceptionMessage); return BaseResult.fail(exceptionMessage); } @@ -165,6 +167,30 @@ } } } + + /** + * 瀵煎嚭鏁版嵁搴撶殑琛ㄤ俊鎭埌excel + * @param file 涓婁紶鐨勬枃浠� + */ + @PostMapping("/importData") + @VciBusinessLog(operateName = "瀵煎叆琛ㄥ崟/琛ㄦ牸") + public BaseResult importData(MultipartFile file){ + String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename()); + File file1 = new File(excelFileName); + try { + file.transferTo(new File(excelFileName)); + if (file != null) { + return portalVIServiceI.importData(file1); + } else { + return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"}); + } + }catch (Throwable e) { + throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e); + }finally { + file1.delete(); + } + } + /** * 鑾峰彇灞炴�у瓧娈电被鍨� */ -- Gitblit v1.9.3