From 04b4676f4f8f2674a0fdd52624c417d600f6f06b Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 05 十二月 2023 16:19:30 +0800
Subject: [PATCH] 整合代码
---
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java | 83 ++++++++++++++++++++++++++++++++++++++++-
1 files changed, 80 insertions(+), 3 deletions(-)
diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
index db787cb..5d63bd4 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/MdmEngineController.java
@@ -90,6 +90,72 @@
* @param response 鍝嶅簲瀵硅薄
* @throws IOException 鎶涘嚭寮傚父
*/
+ @GetMapping("/downloadExcelBatchEdit")
+ @VciBusinessLog(operateName = "涓嬭浇鎵归噺鐢宠缂栫爜鐨勫鍏ユā鏉�")
+ public void downloadImportExcelBatchEdit(String codeClassifyOid, HttpServletResponse response) throws IOException{
+ String excelName = mdmIOService.downloadImportExcelBatchEdit(codeClassifyOid);
+ try {
+ ControllerUtil.writeFileToResponse(response,excelName);
+ } catch (Throwable e) {
+ //濡傛灉鍑洪敊,鎶婇敊璇俊鎭啓鍒皌ext
+ String msg = LangBaseUtil.getErrorMsg(e);
+ if(StringUtils.isBlank(msg)){
+ msg = "鏈煡閿欒";
+ }
+ ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null);
+ }
+ }
+
+
+ /**
+ * 瀵煎叆鎵归噺缂栬緫鏁版嵁
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param classifyAttr 鍒嗙被璺緞浣跨敤鐨勫睘鎬�
+ * @param file 鏂囦欢鐨勫唴瀹�
+ */
+ @VciBusinessLog(operateName = "瀵煎叆鎵归噺缂栬緫鏁版嵁")
+ @PostMapping("/batchImportEdit")
+ public R batchImportEdit(String codeClassifyOid, String classifyAttr,MultipartFile file,HttpServletResponse response) throws Throwable {
+ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + file.getOriginalFilename();
+ File file1 = new File(excelFileName);
+ try {
+ file.transferTo(new File(excelFileName));
+ CodeImProtRusultVO codeImProtRusultVO =mdmIOService.batchImportEdit(codeClassifyOid, classifyAttr,file1);
+ if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())||StringUtils.isNotBlank(codeImProtRusultVO.getRedisUuid())){
+ //鏀惧埌map閲�
+ R result = R.fail("瀵煎叆澶辫触");
+ if(StringUtils.isNotBlank(codeImProtRusultVO.getFilePath())) {
+ String filedUUid = ControllerUtil.putErrorFile(codeImProtRusultVO.getFilePath());
+ codeImProtRusultVO.setFileOid(filedUUid);
+ }
+ result.setData(codeImProtRusultVO);
+ return result;
+ }else {
+ return R.success("鎿嶄綔鎴愬姛锛�");
+ }
+ }catch (Throwable e) {
+ logger.error("瀵煎叆閿欒",e);
+ String errorFile = LocalFileUtil.getDefaultTempFolder() + File.separator + "閿欒.txt";
+ LocalFileUtil.writeContentToFile(LangBaseUtil.getErrorMsg(e),errorFile);
+ String uuid=ControllerUtil.putErrorFile(errorFile);
+ CodeImProtRusultVO codeImProtRusultVO =new CodeImProtRusultVO();
+ codeImProtRusultVO.setRedisUuid("");
+ codeImProtRusultVO.setFileOid(uuid);
+ codeImProtRusultVO.setFilePath(errorFile);
+ R r = R.fail("瀵煎叆澶辫触");
+ r.setData(codeImProtRusultVO);
+ return r;
+ }finally {
+ file1.delete();
+ }
+ }
+
+ /**
+ * 涓嬭浇鎵归噺鐢宠鐨勫鍏ユā鏉�
+ * @param codeClassifyOid 鍒嗙被鐨勪富閿�
+ * @param response 鍝嶅簲瀵硅薄
+ * @throws IOException 鎶涘嚭寮傚父
+ */
@GetMapping("/downloadTopImportExcel")
@VciBusinessLog(operateName = "涓嬭浇鎵归噺鐢宠缂栫爜鐨勫鍏ユā鏉�")
public void downloadTopImportExcel(String codeClassifyOid,HttpServletResponse response) throws IOException{
@@ -312,7 +378,7 @@
s = engineService.addSaveCode(orderDTO);
saveLogUtil.operateLog("缂栫爜鐢宠",false,orderDTO.toString());
}catch (Exception e){
- saveLogUtil.operateLog("缂栫爜鐢宠",true,e.getMessage());
+ saveLogUtil.operateLog("缂栫爜鐢宠",true,e.toString());
throw e;
}
return R.success(s);
@@ -779,9 +845,9 @@
@GetMapping("/exportGroupCodeExcel")
@VciBusinessLog(operateName = "瀵煎嚭闆嗗洟鐮�")
public void exportGroupCodeExcel(String codeClassifyOid, HttpServletResponse response) throws IOException{
- String excelName = mdmIOService.exportGroupCodeExcel(codeClassifyOid);
+
try {
- ControllerUtil.writeFileToResponse(response,excelName);
+ String excelName = mdmIOService.exportGroupCodeExcel(codeClassifyOid);
} catch (Throwable e) {
//濡傛灉鍑洪敊,鎶婇敊璇俊鎭啓鍒皌ext
String msg = LangBaseUtil.getErrorMsg(e);
@@ -791,4 +857,15 @@
ControllerUtil.writeDataToResponse(response,msg.getBytes(StandardCharsets.UTF_8),null);
}
}
+
+ /**
+ * 鑾峰彇缁熻鍒嗘瀽鏁版嵁
+ * @param btmNames 涓氬姟绫诲瀷
+ * @return
+ */
+ @GetMapping("/getStatisticAnalysis")
+ @VciBusinessLog(operateName = "鑾峰彇缁熻鍒嗘瀽鏁版嵁")
+ public R getStatisticAnalysis(String btmNames) {
+ return engineService.getStatisticAnalysis(btmNames);
+ }
}
--
Gitblit v1.9.3