From 93cfe891a02766e0c56c5781eb6ca8a5cc5fb16f Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 31 七月 2024 11:43:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java | 65 +++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java | 2
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java | 13
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java | 39 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java | 74 ++++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java | 2
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 2
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java | 160 ++++++++
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java | 54 +++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java | 23 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java | 8
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java | 300 ++++++++++++++--
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java | 5
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java | 37 +
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java | 4
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java | 234 +++++++++++++
16 files changed, 940 insertions(+), 82 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java
index 9c1890b..5771a28 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsStatusDTO.java
@@ -33,10 +33,75 @@
private String description;
/**
+ * 鍥剧墖璺緞
+ */
+ public String imagePath;
+
+ /**
+ * 鍒涘缓浜�
+ */
+ private String creator;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ private Date createTime;
+
+ /**
+ * 鏈�鍚庝慨鏀逛汉
+ */
+ private String lastModifier;
+
+ /**
+ * 鏈�鍚庝慨鏀规椂闂达紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss
+ */
+ private Date lastModifyTime;
+
+ /**
* 鏃堕棿鎴筹紝鐢ㄤ簬鏍¢獙鏄惁鏈�鏂版暟鎹�
*/
private Date ts;
+ public void setCreator(String creator) {
+ this.creator = creator;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public void setLastModifier(String lastModifier) {
+ this.lastModifier = lastModifier;
+ }
+
+ public void setLastModifyTime(Date lastModifyTime) {
+ this.lastModifyTime = lastModifyTime;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public String getLastModifier() {
+ return lastModifier;
+ }
+
+ public Date getLastModifyTime() {
+ return lastModifyTime;
+ }
+
+ public String getCreator() {
+ return creator;
+ }
+
+ public String getImagePath() {
+ return imagePath;
+ }
+
+ public void setImagePath(String imagePath) {
+ this.imagePath = imagePath;
+ }
+
public String getOid() {
return oid;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java
index ce790e9..c484307 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsStatusVO.java
@@ -36,6 +36,11 @@
private String description;
/**
+ * 鍥剧墖璺緞
+ */
+ public String imagePath;
+
+ /**
* 涓氬姟绫诲瀷鍚嶇О
*/
private String btmname;
@@ -70,6 +75,14 @@
*/
private Date ts;
+ public String getImagePath() {
+ return imagePath;
+ }
+
+ public void setImagePath(String imagePath) {
+ this.imagePath = imagePath;
+ }
+
public String getOid() {
return oid;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java
index 71aa533..d64806f 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java
@@ -52,7 +52,7 @@
/**
* 灞炴�х被鍨�
*/
- @ExcelColumn(value="灞炴�х被鍨�",nullable = false)
+ @ExcelColumn(value="灞炴�х被鍨�(璇峰弬鐓ф柊澧炵晫闈㈢殑灞炴�х被鍨嬪~鍐�)",nullable = false)
private String attributeDataType;
/**
@@ -112,7 +112,7 @@
/**
* 灞炴�ч暱搴�
*/
- @ExcelColumn(value="鍙栧�艰寖鍥�")
+ @ExcelColumn(value="鍙栧�艰寖鍥�)")
private String range;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java
new file mode 100644
index 0000000..c443178
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsStatusPO.java
@@ -0,0 +1,54 @@
+package com.vci.po;
+
+import com.vci.starter.poi.annotation.ExcelColumn;
+import com.vci.starter.web.pagemodel.BaseModelVO;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * 灞炴�ф睜瀵煎叆瀵硅薄
+ * @author ludc
+ * @date 2024/7/19 11:11
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OsStatusPO extends BaseModelVO {
+
+ /**
+ * 绂佹淇敼杩欎釜鍊�
+ */
+ private static final long serialVersionUID = -2239512786206928201L;
+
+ /**
+ * 鎵�鍦ㄦ暟鎹
+ */
+ @ExcelColumn(rowIndexColumn = true,value = "")
+ private String rowIndex;
+
+ /**
+ * 灞炴�ц嫳鏂囧悕绉�
+ */
+ @ExcelColumn(value="鍚嶇О(涓嶈兘涓虹┖)",nullable = false)
+ private String id;
+
+ /**
+ * 鏍囩
+ */
+ @ExcelColumn(value="鏍囩(瀵瑰悕绉扮殑瑙i噴)")
+ private String name;
+
+ /**
+ * 灞炴�х被鍨�
+ */
+ @ExcelColumn(value="鍥剧墖(璺緞)")
+ private String imagePath;
+
+ /**
+ * 鎻忚堪
+ */
+ @ExcelColumn(value="鎻忚堪(鍙互涓虹┖)")
+ private String description;
+
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
index d08bcbb..6a52208 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -117,7 +117,7 @@
/**
* 蹇呭~鍒�
*/
- private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>();
+ private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
/**
* 鐢ㄦ埛鍒嗛〉鏌ヨ鏃惰幏鍙栭儴闂ㄦ斁鍒拌繖閲岄伩鍏嶉噸澶嶆煡璇�
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
index f33a04a..adf0e3e 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -52,7 +52,7 @@
* @return 灞炴�х殑鏄剧ず瀵硅薄
*/
@GetMapping("/gridAttribute")
- @VciUnCheckRight
+ @VciBusinessLog(operateName = "灞炴�у垪琛�")
public BaseResult<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject){
try {
return BaseResult.dataGrid(attributeService.gridAttribute(baseQueryObject));
@@ -107,7 +107,6 @@
*/
@PutMapping( "/updateAttribute")
@VciBusinessLog(operateName = "淇敼灞炴��")
- @VciUnCheckRight
public BaseResult updateAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
try {
return attributeService.updateAttribute(osAttributeDTO) ? BaseResult.success("灞炴�т慨鏀规垚鍔燂紒"):BaseResult.fail("灞炴�т慨鏀瑰け璐ワ紒");
@@ -208,7 +207,7 @@
* @return
*/
@PostMapping("/importAttributes")
- @VciUnCheckRight
+ @VciBusinessLog(operateName = "瀵煎叆灞炴��")
public BaseResult importAttributes(MultipartFile file){
String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
File file1 = new File(excelFileName);
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
index 8b592a7..5d9a344 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
@@ -18,8 +18,11 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
+import java.io.IOException;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -57,7 +60,6 @@
* @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
*/
@GetMapping("/getAllLtName")
- @VciUnCheckRight
public BaseResult getAllLtName(){
try {
return BaseResult.dataList(linkTypeService.getAllLtName());
@@ -155,4 +157,74 @@
return objectBaseResult;
}
}
+ /**
+ * 閾炬帴绫诲瀷鍒犻櫎
+ * linkType 閾炬帴绫诲瀷瀵硅薄
+ * @return 鍒犻櫎缁撴灉
+ */
+ @DeleteMapping("/deleteLink")
+ public BaseResult deleteLink(@RequestBody LinkType linkType){
+ try {
+ return linkTypeService.deleteLink(linkType);
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 涓�鑷存�ф鏌�
+ * @return 鍒犻櫎缁撴灉
+ */
+ @GetMapping("/checkLinkType")
+ public BaseResult checkLinkType(){
+ try {
+ return linkTypeService.checkLinkType();
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 涓�鑷存�ф鏌ヤ慨澶嶆暟鎹簱琛�
+ * repairData 闇�瑕佷慨澶嶇殑鏁版嵁
+ * @return 淇缁撴灉
+ */
+ @PostMapping("/repairTable")
+ public BaseResult repairTable(@RequestBody String repairData){
+ try {
+ return linkTypeService.repairTable(repairData);
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ } catch (IOException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(500);
+ objectBaseResult.setMsg(e.getMessage());
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 鍒涘缓瑙嗗浘
+ * @return 鍒涘缓缁撴灉
+ */
+ @PostMapping("/createView")
+ public BaseResult createView(){
+ try {
+ return linkTypeService.createView();
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java
index 718362f..2371ba8 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/VciOsStatusController.java
@@ -1,16 +1,33 @@
package com.vci.web.controller;
+import com.vci.constant.FrameWorkLangCodeConstant;
+import com.vci.dto.OsAttributeDTO;
+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;
import com.vci.starter.web.pagemodel.BaseResult;
-import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.dto.OsStatusDTO;
import com.vci.pagemodel.OsLifeCycleVO;
import com.vci.pagemodel.OsStatusVO;
+import com.vci.starter.web.util.ControllerUtil;
+import com.vci.starter.web.util.LocalFileUtil;
+import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsLifeCycleServiceI;
import com.vci.web.service.OsStatusServiceI;
+import com.vci.web.util.Func;
+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.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
/**
* 鐘舵�佺殑鎺у埗鍣�
@@ -35,14 +52,27 @@
private OsLifeCycleServiceI lifeCycleService;
/**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ /**
* 鐘舵�佺殑鍒楄〃
* @param queryObject 鏌ヨ瀵硅薄
* @return 鏄剧ず瀵硅薄
*/
@GetMapping("/gridStatus")
@VciBusinessLog(operateName = "鏌ョ湅鐘舵�佸垪琛�")
- public DataGrid<OsStatusVO> gridStatus(BaseQueryObject queryObject){
- return statusService.gridStatus(queryObject.getConditionMap(),queryObject.getPageHelper());
+ @VciUnCheckRight
+ public BaseResult<OsStatusVO> gridStatus(BaseQueryObject queryObject){
+ try {
+ return BaseResult.dataGrid(statusService.gridStatus(queryObject.getConditionMap(),queryObject.getPageHelper()));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "灞炴�х鐞嗗垪琛ㄦ煡璇㈡椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
/**
@@ -51,8 +81,17 @@
* @return 浣跨敤鐨勭敓鍛藉懆鏈熺殑瀵硅薄
*/
@GetMapping("/listUsed")
- public DataGrid<OsLifeCycleVO> listUsed(String oid){
- return lifeCycleService.listStatusUsed(oid);
+ @VciBusinessLog(operateName = "鏌ヨ鐘舵�佹睜鐨勫簲鐢ㄨ寖鍥�")
+ @VciUnCheckRight
+ public BaseResult<OsLifeCycleVO> listUsed(String oid){
+ try {
+ return BaseResult.dataGrid(lifeCycleService.listStatusUsed(oid));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "灞炴�х鐞嗗垪琛ㄦ煡璇㈡椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
/**
@@ -61,9 +100,15 @@
* @return 鎵ц缁撴灉
*/
@PostMapping("/addSave")
- public BaseResult addSave(OsStatusDTO statusDTO){
- statusService.addSave(statusDTO);
- return BaseResult.success();
+ public BaseResult addSave(@RequestBody OsStatusDTO statusDTO){
+ try {
+ return statusService.addSave(statusDTO) ? BaseResult.success("娣诲姞鐘舵�佹垚鍔燂紒"):BaseResult.fail("娣诲姞鐘舵�佸け璐ワ紒");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "娣诲姞鐘舵�佹椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
/**
@@ -72,20 +117,32 @@
* @return 鎵ц缁撴灉
*/
@PutMapping("/editSave")
- public BaseResult editSave(OsStatusDTO statusDTO){
- statusService.editSave(statusDTO);
- return BaseResult.success();
+ public BaseResult editSave(@RequestBody OsStatusDTO statusDTO){
+ try {
+ return statusService.editSave(statusDTO) ? BaseResult.success("淇敼鐘舵�佹垚鍔燂紒"):BaseResult.fail("淇敼鐘舵�佸け璐ワ紒");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "淇敼鐘舵�佹椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
/**
* 鍒犻櫎鐘舵��
- * @param oids 鐘舵�佺殑涓婚敭
+ * @param osStatusDTOS 鐘舵�佺殑DTO瀵硅薄
* @return 鎵ц缁撴灉
*/
- @DeleteMapping("/delete")
- public BaseResult delete(String oids){
- statusService.delete(oids);
- return BaseResult.success();
+ @DeleteMapping("/deleteStatus")
+ public BaseResult deleteStatus(@RequestBody List<OsStatusDTO> osStatusDTOS){
+ try {
+ return statusService.deleteStatus(osStatusDTOS) ? BaseResult.success("鍒犻櫎鐘舵�佹垚鍔燂紒"):BaseResult.fail("鍒犻櫎鐘舵�佸け璐ワ紒");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鍒犻櫎鐘舵�佹椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
/**
@@ -98,4 +155,75 @@
return BaseResult.success(statusService.getObjectByOid(oid));
}
+ /**
+ * 瀵煎嚭鐘舵��
+ * @param exportFileName
+ * @param statusOids
+ * @param response
+ */
+ @GetMapping( "/exportStatus")
+ @VciBusinessLog(operateName = "瀵煎嚭鐘舵��")
+ public void exportStatus(String exportFileName,String statusOids, HttpServletResponse response){
+ try {
+ String excelPath = statusService.exportStatus(exportFileName,statusOids);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ } catch (Exception e) {
+ String msg = "瀵煎嚭鐘舵�佹椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 涓嬭浇鐘舵�佸鍏ユā鏉�
+ * @param exportFileName
+ * @param response
+ */
+ @GetMapping( "/downloadStatusTemplate")
+ @VciBusinessLog(operateName = "瀵煎嚭鐘舵��")
+ public void downloadStatusTemplate(String exportFileName, HttpServletResponse response){
+ try {
+ String excelPath = statusService.downloadStatusTemplate(exportFileName);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ } catch (Exception e) {
+ String msg = "涓嬭浇鏋氫妇瀵煎叆妯℃澘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 瀵煎叆鐘舵��
+ * @param file
+ * @return
+ */
+ @PostMapping("/importStatus")
+ @VciBusinessLog(operateName = "瀵煎叆鐘舵��")
+ public BaseResult importStatus(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 statusService.importStatus(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();
+ }
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
index fd64b1b..0fae7cb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
@@ -9,6 +9,7 @@
import com.vci.pagemodel.OsLinkTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeVO;
+import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -122,4 +123,26 @@
* @return 淇濆瓨缁撴灉
*/
BaseResult addAndEditLink(LinkType linkType, Boolean addFlag) throws PLException;
+ /**
+ * 閾炬帴绫诲瀷鍒犻櫎
+ * linkType 閾炬帴绫诲瀷瀵硅薄
+ * @return 鍒犻櫎缁撴灉
+ */
+ BaseResult deleteLink(LinkType linkType) throws PLException;
+ /**
+ * 涓�鑷存�ф鏌�
+ * @return 鍒犻櫎缁撴灉
+ */
+ BaseResult checkLinkType() throws PLException;
+ /**
+ * 涓�鑷存�ф鏌ヤ慨澶嶆暟鎹簱琛�
+ * repairData 闇�瑕佷慨澶嶇殑鏁版嵁
+ * @return 淇缁撴灉
+ */
+ BaseResult repairTable(String repairData) throws PLException, IOException;
+ /**
+ * 鍒涘缓瑙嗗浘
+ * @return 鍒涘缓缁撴灉
+ */
+ BaseResult createView() throws PLException;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java
index f3b3835..4b1b4a7 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsStatusServiceI.java
@@ -1,11 +1,14 @@
package com.vci.web.service;
+import com.vci.corba.common.PLException;
import com.vci.corba.omd.stm.StatePool;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.dto.OsStatusDTO;
import com.vci.pagemodel.OsStatusVO;
+import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -54,13 +57,13 @@
* 鎵归噺娣诲姞鐘舵��
* @param statePoolList 鐘舵�佸唴瀹�
*/
- void batchAddStatus(List<StatePool> statePoolList);
+ boolean batchAddStatus(List<StatePool> statePoolList) throws Exception;
/**
* 鎵归噺淇敼鐘舵��
* @param statePoolList 鐘舵�佸唴瀹�
*/
- void batchEditSave(List<StatePool> statePoolList);
+ boolean batchEditSave(List<StatePool> statePoolList) throws Exception;
/**
* 鐘舵�佸垪琛�
@@ -88,19 +91,19 @@
* 娣诲姞鐘舵��
* @param statusDTO 鐘舵�佺殑鏁版嵁浼犺緭瀵硅薄
*/
- void addSave(OsStatusDTO statusDTO);
+ boolean addSave(OsStatusDTO statusDTO) throws Exception;
/**
* 缂栬緫鐘舵��
* @param statusDTO 鐘舵�佺殑鏁版嵁浼犺緭瀵硅薄
*/
- void editSave(OsStatusDTO statusDTO);
+ boolean editSave(OsStatusDTO statusDTO)throws Exception ;
/**
* 鍒犻櫎鐘舵��
- * @param oids 涓婚敭
+ * @param osStatusDTOS
*/
- void delete(String oids);
+ boolean deleteStatus(List<OsStatusDTO> osStatusDTOS) throws PLException;
/**
* 鐘舵�佺殑鏁版嵁浼犺緭瀵硅薄杞崲涓烘暟鎹璞�
@@ -108,4 +111,28 @@
* @return 骞冲彴鐨勬暟鎹璞�
*/
StatePool statusDTO2DO(OsStatusDTO statusDTO);
+
+ /**
+ * 瀵煎嚭閫変腑鐨勭姸鎬�
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param statusOids 闇�瑕佸鍑虹殑灞炴�у悕绉�
+ * @return
+ */
+ String exportStatus(String exportFileName,String statusOids) throws PLException;
+
+ /**
+ * 涓嬭浇鐘舵�佸鍏ユā鏉�
+ * @param exportFileName
+ * @return
+ * @throws PLException
+ */
+ String downloadStatusTemplate(String exportFileName) throws Exception;
+
+ /**
+ * 瀵煎叆鐘舵��
+ * @param file
+ * @return
+ */
+ BaseResult importStatus(File file) throws Exception;
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
index 2d0e461..8b6c442 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -33,6 +33,7 @@
import com.vci.web.properties.UsedNames;
import com.vci.web.service.OsAttributeServiceI;
import com.vci.web.service.OsBaseServiceI;
+import com.vci.web.service.OsEnumServiceI;
import com.vci.web.service.OsLinkTypeServiceI;
import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
@@ -111,6 +112,13 @@
@Autowired(required = false)
@Lazy
private OsBtmServiceImpl osBtmService;
+
+ /**
+ * 鏋氫妇鐨勬湇鍔�
+ */
+ @Autowired
+ @Lazy
+ private OsEnumServiceI enumService;
/**
* 蹇呭~鍒�
@@ -511,7 +519,7 @@
if(hasInstance && !compatible){
throw new PLException("500",new String[]{"鏃犳晥鍙樻洿, 涓嶅吋瀹瑰凡浜х敓鐨勬暟鎹紒"});
}
- String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+ String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
osAttributeDTO.setLastModifier(userId);
osAttributeDTO.setCreator(osAttributeVO.getCreator());
osAttributeDTO.setCreateTime(osAttributeVO.getCreateTime());
@@ -557,9 +565,9 @@
attributeDef.rage = osAttributeDTO.getRange().replace("<","<");
}
attributeDef.ts = Func.format((Func.isNotEmpty(osAttributeDTO.getTs()) ? osAttributeDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
- attributeDef.creator = "developer";//Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
+ attributeDef.creator = Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
attributeDef.createTime = Func.isEmpty(osAttributeDTO.getCreateTime()) ? System.currentTimeMillis():osAttributeDTO.getCreateTime().getTime();
- attributeDef.modifier = "developer";//Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
+ attributeDef.modifier = Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
attributeDef.modifyTime = System.currentTimeMillis();
//other闇�瑕佽嚜琛屽鐞�
StringBuffer sb = new StringBuffer();
@@ -600,6 +608,7 @@
if(StringUtils.isNotBlank(osAttributeDTO.getLinkTypeName())){
//鍙傜収閾炬帴绫诲瀷
sb.append(LINKTYPENAME).append(" = ").append(osAttributeDTO.getLinkTypeName()).append(";");
+ sb.append(VERSION).append(" = ").append(osAttributeDTO.getVersion()).append(";");
}
sb.append(LENGTH).append(" = ").append(length > osAttributeDTO.getAttrLength()?length:osAttributeDTO.getAttrLength()).append(";");
if (StringUtils.isNotBlank(osAttributeDTO.getEnumId())) {
@@ -812,7 +821,7 @@
if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
throw new PLException("500",new String[]{"寰呭垹闄ょ殑灞炴�у垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佸睘鎬у悕銆恘ame銆戜笉鑳戒负绌猴紒"});
}
- //鍒ゆ柇鏋氫妇鏄惁鏈夎寮曠敤
+ //鍒ゆ柇灞炴�ф槸鍚︽湁琚紩鐢�
List<Map<String, String>> usedAttrList = this.getUsedAttributeList(name);
if(Func.isNotEmpty(usedAttrList)){
throw new PLException("500",new String[]{"鍒犻櫎鐨勫睘鎬т腑锛屽睘鎬у悕绉颁负锛氥��" + name + "銆�,宸茶寮曠敤锛�"});
@@ -934,7 +943,7 @@
//璁剧疆鍒楀悕
List<String> columns = new ArrayList<>(
Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪",
- "灞炴�х被鍨�", "鍏佽涓虹┖(鏄�/鍚�)", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�",
+ "灞炴�х被鍨�(璇峰弬鐓ф柊澧炵晫闈㈢殑灞炴�х被鍨嬪~鍐�)", "鍏佽涓虹┖(鏄�/鍚�)", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�",
"鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�")
);
//璁剧疆蹇呭~鍒�
@@ -1010,6 +1019,22 @@
//灞炴�у悕excel涓垽閲嶅鐞�
excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex());
OsAttributeDTO osAttributeDTO = new OsAttributeDTO();
+ //鏌ヨ鏋氫妇鏄惁瀛樺湪锛屽~鍐欎簡鏋氫妇浣嗘病濉啓鍙栧�艰寖鍥达紝杩欐椂鍊欑洿鎺ヤ娇鐢ㄦ灇涓鹃」鍊间綔涓洪粯璁ょ殑range
+ if(Func.isNotBlank(osAttributePO.getEnumId()) && Func.isBlank(osAttributePO.getRange())){
+ try {
+ OsEnumVO enumVO = enumService.getEnumTypeById(osAttributePO.getEnumId());
+ if(Func.isEmpty(enumVO)){
+ throw new VciBaseException("绗��" + osAttributePO.getRowIndex() + "銆戣鏁版嵁,閫氳繃鏋氫妇鍚嶇О銆�" + osAttributePO.getEnumId()
+ + "銆戞湭鑾峰彇鍒版灇涓句俊鎭�!");
+ }
+ String itemValues = enumVO.getItemMaps().values().stream().collect(Collectors.joining(";"));
+ osAttributeDTO.setRange(itemValues);
+ } catch (PLException e) {
+ e.printStackTrace();
+ throw new VciBaseException("鏋氫妇鏌ヨ澶辫触锛屽師鍥狅細"+e.getMessage());
+ }
+ osAttributeDTO.setBtmTypeId(osAttributePO.getEnumId());
+ }
osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
osAttributeDTO.setId(osAttributePO.getId());
osAttributeDTO.setName(osAttributePO.getName());
@@ -1045,7 +1070,7 @@
}
} catch (PLException e) {
e.printStackTrace();
- throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒灞炴�у璞″悕涓猴細銆�" + dto.getId() + "銆戯紝鍘熷洜锛�"+e.getMessage());
+ throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒灞炴�у璞″悕涓猴細銆�" + dto.getId() + "銆戯紝鍘熷洜锛�"+VciBaseUtil.getExceptionMessage(e));
}
});
}catch (Exception e){
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
index 97f5267..1a59db5 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -392,7 +392,7 @@
//鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
exportFileName = Func.isBlank(exportFileName) ? "鏋氫妇绫诲瀷瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
//璁剧疆鍒楀悕
- List<String> columns = new ArrayList<>(Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害", "鏋氫妇椤瑰悕绉�", "鏋氫妇鍊�", "鎻忚堪"));
+ List<String> columns = new ArrayList<>(Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害","鍒涘缓鏃堕棿", "鏋氫妇椤瑰悕绉�", "鏋氫妇鍊�", "鎻忚堪"));
//鍐檈xcel
String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
@@ -433,9 +433,9 @@
//澶勭悊鏋氫妇椤瑰啓鍏�
for (int j = 0; j < enumVOItems.size(); j++) {
OsEnumItemVO osEnumItemVO = enumVOItems.get(j);
- excelDataList.add(new WriteExcelData(startRow+j,7, true,osEnumItemVO.getName()));
- excelDataList.add(new WriteExcelData(startRow+j,8, true, osEnumItemVO.getValue()));
- excelDataList.add(new WriteExcelData(startRow+j,9, true, osEnumItemVO.getDescription()));
+ excelDataList.add(new WriteExcelData(startRow+j,5, true,osEnumItemVO.getName()));
+ excelDataList.add(new WriteExcelData(startRow+j,6, true, osEnumItemVO.getValue()));
+ excelDataList.add(new WriteExcelData(startRow+j,7, true, osEnumItemVO.getDescription()));
}
startRow += enumVOItems.size();
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
index a1deb7c..96c7c05 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLifeCycleServiceImpl.java
@@ -483,7 +483,7 @@
}
/**
- * 鐘舵�佸湪鐢熷懡鍛ㄦ湡涓娇鐢ㄧ殑鍕ゅ揩
+ * 鐘舵�佸湪鐢熷懡鍛ㄦ湡涓娇鐢ㄧ殑鑼冨洿
*
* @param statusOid 鐘舵�佺殑涓婚敭
* @return 鐢熷懡鍛ㄦ湡鐨勪俊鎭�
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
index d785735..8b2cf40 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -1,7 +1,10 @@
package com.vci.web.service.impl;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
+import com.vci.corba.omd.btm.BizType;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.omd.utils.ObjectTool;
@@ -26,6 +29,7 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@@ -369,6 +373,236 @@
platformClientUtil.getLinkTypeService().modifyLinkType(linkType);
return BaseResult.success(null,"淇濆瓨鎴愬姛锛�");
}
+ /**
+ * 閾炬帴绫诲瀷鍒犻櫎
+ * linkType 閾炬帴绫诲瀷瀵硅薄
+ * @return 鍒犻櫎缁撴灉
+ */
+ @Override
+ public BaseResult deleteLink(LinkType linkType) throws PLException {
+ if(platformClientUtil.getLinkTypeService().hasData(linkType.name)){
+ throw new PLException("500",new String[] {"绫诲瀷宸叉湁瀹炰緥, 涓嶈繘琛屽垹闄ゆ搷浣�"});
+ }
+ boolean flag = platformClientUtil.getLinkTypeService().deleteLinkType(linkType);
+ if(!flag){
+ throw new PLException("500",new String[] {"鍒犻櫎澶辫触"});
+ }else{
+ return BaseResult.success();
+ }
+ }
+ /**
+ * 涓�鑷存�ф鏌�
+ * @return 鍒犻櫎缁撴灉
+ */
+ @Override
+ public BaseResult checkLinkType() throws PLException {
+ String[] result = platformClientUtil.getLinkTypeService().linkTypeConsistencyCheck();
+ Map<String, String> dbCheckMap = new HashMap<String, String>();
+ for(int i = 0; i < result.length; i++){
+ String info = result[i];
+ if(info.equals("")){
+ continue;
+ }
+ String[] infos = info.split("/DML");
+ String typeName = infos[0];
+ String dml = infos[1];
+ dbCheckMap.put(typeName, dml);
+ }
+ Map<String, List<String>> btmCheckMap = usedBtmCheck();
+ if(dbCheckMap.size() < 1 && (btmCheckMap == null || btmCheckMap.size() < 1)){
+ return BaseResult.successMsg("鏁版嵁搴撲腑鐨勮〃缁撴瀯涓庣被鍨嬩竴鑷�, 閾炬帴绫诲瀷寮曠敤鐨勪笟鍔$被鍨嬪叏閮ㄦ纭瓨鍦�,鏃犻渶淇!!");
+ }else{
+ Map<String,Object> returnData = new HashMap<>();
+ returnData.put("dbCheckMap",dbCheckMap);
+ returnData.put("btmCheckMap",btmCheckMap);
+ List<Map> list = new ArrayList<>();
+ list.add(returnData);
+ return BaseResult.dataList(500,list,"闇�瑕佽繘琛屽垪鐨勪慨澶嶏紒锛�");
+ }
+ }
+
+ /**
+ * 涓�鑷存�ф鏌ヤ慨澶嶆暟鎹簱琛�
+ * repairData 闇�瑕佷慨澶嶇殑鏁版嵁
+ * @return 淇缁撴灉
+ */
+ @Override
+ public BaseResult repairTable(String repairData) throws PLException, IOException {
+ Map<String, Object> map = new ObjectMapper().readValue(repairData, new TypeReference<Map<String,Object>>(){});
+ HashMap<String,Object> dbCheckMap = (HashMap<String, Object>) map.get("dbCheckMap");
+ HashMap<String,List<String>> btmCheckMap = (HashMap<String, List<String>>) map.get("btmCheckMap");
+ List returnList = new ArrayList<>();
+ Map returnMap = new HashMap();
+ if(dbCheckMap.size() > 0){
+ List<String> list = getRepairDML(dbCheckMap);
+ if(list.size() < 1){
+ return BaseResult.success();
+ }
+ String[] result = platformClientUtil.getLinkTypeService().executeRepair(list.toArray(new String[0]));
+ List<String> resultList = Arrays.asList(result);
+ for (String typeName : resultList) {
+ if(dbCheckMap.containsKey(typeName)){
+ dbCheckMap.remove(typeName);
+ }else if(dbCheckMap.containsKey(typeName + "_ADD")){
+ String sql = String.valueOf(dbCheckMap.get(typeName));
+ sql = sql.substring(sql.indexOf(";") + 1, sql.length());
+ dbCheckMap.put(typeName, sql);
+ }else if(dbCheckMap.containsKey(typeName + "_DROP")){
+ String sql = String.valueOf(dbCheckMap.get(typeName));
+ sql = sql.substring(0, sql.indexOf(";"));
+ dbCheckMap.put(typeName, sql);
+ }
+ }
+ if(!dbCheckMap.isEmpty()){
+ returnMap.put("dbCheckMap",dbCheckMap);
+ }
+ }
+
+ if(btmCheckMap.size() > 0){
+ List<String> result = repairXml(btmCheckMap);
+ for(int i = 0; i < result.size(); i++){
+ String typeName = result.get(i);
+ if(btmCheckMap.containsKey(typeName)){
+ btmCheckMap.remove(typeName);
+ }
+ }
+ if(!btmCheckMap.isEmpty()){
+ returnMap.put("btmCheckMap",btmCheckMap);
+ }
+ }
+ returnList.add(returnMap);
+ return BaseResult.success(returnList);
+ }
+ /**
+ * 鍒涘缓瑙嗗浘
+ * @return 鍒涘缓缁撴灉
+ */
+ @Override
+ public BaseResult createView() throws PLException {
+ boolean f = platformClientUtil.getLinkTypeService().createView();
+ if(f){
+ return BaseResult.success("鍒涘缓瑙嗗浘鎴愬姛");
+ }else{
+ return BaseResult.success("鍒涘缓瑙嗗浘澶辫触");
+ }
+ }
+
+
+ /**
+ * 淇閾炬帴绫诲瀷鐨剎ml鏂囦欢
+ * @return
+ */
+ private List<String> repairXml(HashMap<String, List<String>> btmCheckMap){
+ List<String> result = new ArrayList<String>();
+ for(Iterator<String> ite = btmCheckMap.keySet().iterator(); ite.hasNext();){
+ String linkName = ite.next();
+ List<String> list = btmCheckMap.get(linkName);
+ LinkType link = null;
+ try {
+ link = platformClientUtil.getLinkTypeService().getLinkType(linkName);
+ } catch (PLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ continue;
+ }
+ //灏唋ist涓寘鍚殑F_btm绉婚櫎, 閲嶆柊璁剧疆btmItemsFrom
+ String[] btms_ = link.btmItemsFrom;
+ List<String> btms = new ArrayList<String>();
+ for(int i = 0; i < btms_.length; i++){
+ if(!list.contains("F_" + btms_[i])){
+ btms.add(btms_[i]);
+ }else{
+ if(link.primitivesFrom.equals(btms_[i])){
+ link.primitivesFrom = "";
+ }
+ }
+ }
+ link.btmItemsFrom = btms.toArray(new String[0]);
+
+ //灏唋ist涓寘鍚殑T_btm绉婚櫎, 閲嶆柊璁剧疆btmItemsTo
+ btms_ = link.btmItemsTo;
+ btms = new ArrayList<String>();
+ for(int i = 0; i < btms_.length; i++){
+ if(!list.contains("T_" + btms_[i])){
+ btms.add(btms_[i]);
+ }else{
+ if(link.primitivesTo.equals(btms_[i])){
+ link.primitivesTo = "";
+ }
+ }
+ }
+ link.btmItemsTo = btms.toArray(new String[0]);
+ link.id = link.name;
+ try {
+ if(platformClientUtil.getLinkTypeService().modifyLinkType(link)){
+ result.add(linkName);
+ }
+ } catch (PLException e) {
+ e.printStackTrace();
+ }
+ }
+ return result;
+ }
+ /**
+ * 鑾峰彇闇�瑕佷慨澶嶇殑浼猻ql
+ * @return
+ */
+ private List<String> getRepairDML(HashMap<String, Object> dbCheckMap) {
+ List<String> list = new ArrayList<String>();
+ for(Iterator<String> ite = dbCheckMap.keySet().iterator(); ite.hasNext();){
+ String type = ite.next();
+ String dml = String.valueOf(dbCheckMap.get(type));
+ list.add(type + "/DML" + dml);
+ }
+ return list;
+ }
+ /**
+ * 妫�鏌ユ墍鏈夌殑閾炬帴绫诲瀷, 褰撻摼鎺ョ被鍨嬩腑寮曠敤鐨勪笟鍔$被鍨嬪凡缁忎笉瀛樺湪鏃�, 鍒犻櫎璇ラ摼鎺ョ被鍨嬩腑瀵逛笟鍔$被鍨嬬殑寮曠敤
+ * @return
+ */
+ private Map<String, List<String>> usedBtmCheck(){
+ try {
+ Map<String, List<String>> map = new HashMap<String, List<String>>();
+ LinkType[] links = platformClientUtil.getLinkTypeService().getLinkTypes();
+ for(int i = 0; i < links.length; i++){
+ LinkType link = links[i];
+ String[] btms = link.btmItemsFrom;
+ for(int k = 0; k < btms.length; k++){
+ String btmName = btms[k];
+ BizType btm = platformClientUtil.getBtmService().getBizTypeByName(btmName);
+ if(btm == null || btm.name.equals("")){
+ List<String> list = map.get(link.name);
+ if(list == null){
+ list = new ArrayList<String>();
+ list.add("F_" + btmName);
+ }else{
+ list.add("F_" + btmName);
+ }
+ map.put(link.name, list);
+ }
+ }
+ btms = link.btmItemsTo;
+ for(int k = 0; k < btms.length; k++){
+ String btmName = btms[k];
+ BizType btm = platformClientUtil.getBtmService().getBizTypeByName(btmName);
+ if(btm == null || btm.name.equals("")){
+ List<String> list = map.get(link.name);
+ if(list == null){
+ list = new ArrayList<String>();
+ list.add("T_" + btmName);
+ }else{
+ list.add("T_" + btmName);
+ }
+ map.put(link.name, list);
+ }
+ }
+ }
+ return map;
+ } catch (PLException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
/**
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
index 9f3f54c..033c3f4 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java
@@ -1,24 +1,35 @@
package com.vci.web.service.impl;
import com.vci.corba.common.PLException;
+import com.vci.corba.omd.atm.AttributeDef;
import com.vci.corba.omd.stm.StatePool;
+import com.vci.dto.OsAttributeDTO;
+import com.vci.pagemodel.OsEnumVO;
+import com.vci.po.OsAttributePO;
+import com.vci.po.OsStatusPO;
+import com.vci.starter.poi.bo.ReadExcelOption;
+import com.vci.starter.poi.bo.WriteExcelData;
+import com.vci.starter.poi.bo.WriteExcelOption;
+import com.vci.starter.poi.constant.ExcelLangCodeConstant;
+import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
-import com.vci.starter.web.util.LangBaseUtil;
-import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.starter.web.util.VciDateUtil;
+import com.vci.starter.web.util.*;
import com.vci.dto.OsStatusDTO;
import com.vci.model.OsStatusDO;
import com.vci.pagemodel.OsStatusVO;
import com.vci.web.service.OsLifeCycleServiceI;
import com.vci.web.service.OsStatusServiceI;
import com.vci.web.service.WebBoServiceI;
+import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.util.HSSFColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,7 +37,9 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import java.io.File;
import java.util.*;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST;
@@ -65,6 +78,11 @@
private OsLifeCycleServiceI lifeCycleService;
/**
+ * 蹇呭~鍒�
+ */
+ private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
+
+ /**
* 鍔犺浇鑷韩
*/
@Autowired(required = false)
@@ -78,11 +96,12 @@
* @return 鏄剧ず瀵硅薄
*/
@Override
- public OsStatusVO statusDO2VO(com.vci.corba.omd.stm.StatePool statePool) {
+ public OsStatusVO statusDO2VO(StatePool statePool) {
OsStatusVO statusVO = new OsStatusVO();
if(statePool!=null){
statusVO.setOid(statePool.oid);
statusVO.setCreator(statePool.creator);
+ statusVO.setImagePath(statePool.imagePath);
statusVO.setLastModifier(statePool.modifier);
try {
statusVO.setCreateTime(new Date(statePool.createTime));
@@ -105,7 +124,7 @@
* @return 鏄剧ず瀵硅薄
*/
@Override
- public List<OsStatusVO> statusDO2VOs(Collection<com.vci.corba.omd.stm.StatePool> statePools) {
+ public List<OsStatusVO> statusDO2VOs(Collection<StatePool> statePools) {
List<OsStatusVO> statusVOS = new ArrayList<>();
if(!CollectionUtils.isEmpty(statePools)){
statePools.stream().forEach(statePool -> {
@@ -169,7 +188,7 @@
* @param statePoolList 鐘舵�佸唴瀹�
*/
@Override
- public void batchAddStatus(List<StatePool> statePoolList) {
+ public boolean batchAddStatus(List<StatePool> statePoolList) throws Exception{
if(!CollectionUtils.isEmpty(statePoolList)){
for(StatePool statePool : statePoolList) {
try {
@@ -178,7 +197,9 @@
throw WebUtil.getVciBaseException(e);
}
}
+ return true;
}
+ return false;
}
/**
@@ -186,7 +207,7 @@
* @param statePoolList 鐘舵�佸唴瀹�
*/
@Override
- public void batchEditSave(List<StatePool> statePoolList) {
+ public boolean batchEditSave(List<StatePool> statePoolList) {
if(!CollectionUtils.isEmpty(statePoolList)){
for(StatePool statePool : statePoolList) {
try {
@@ -196,6 +217,7 @@
}
}
}
+ return true;
}
/**
@@ -255,57 +277,100 @@
* @param statusDTO 鐘舵�佺殑鏁版嵁浼犺緭瀵硅薄
*/
@Override
- public void addSave(OsStatusDTO statusDTO) {
- VciBaseUtil.alertNotNull(statusDTO,"鐘舵�佺殑淇℃伅",statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О",statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О");
- statusDTO.setOid(VciBaseUtil.getPk());
- StatePool pool = statusDTO2DO(statusDTO);
- List<StatePool> poolList = new ArrayList<>();
- poolList.add(pool);
- batchAddStatus(poolList);
- clearCache();
- self.selectAllStatusMap();
+ public boolean addSave(OsStatusDTO statusDTO) throws Exception {
+ VciBaseUtil.alertNotNull(
+ statusDTO,"鐘舵�佺殑淇℃伅",
+ statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О",
+ statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О"
+ );
+ StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
+ if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
+ throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"});
+ }
+ // 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�
+ String regex = "[a-z A-Z]*";
+ if ((!statusDTO.getId().matches(regex))) {
+ throw new PLException("500",new String[]{"鍚嶇О鍙兘涓鸿嫳鏂囷紒"});
+ }
+ //铏界劧浼氳嚜鍔ㄧ敓鎴恛id锛屼絾鏄繖鍎胯缃富閿紝閬垮厤鏀惧叆缂撳瓨鐨勬暟鎹槸娌℃湁oid鐨�
+ statusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
+ try {
+ boolean res = batchAddStatus(Arrays.asList(statusDTO2DO(statusDTO)));
+ self.selectAllStatusMap();
+ return res;
+ }catch (Exception e){
+ e.printStackTrace();
+ logger.error(e.getMessage());
+ return false;
+ }
}
-
/**
* 缂栬緫鐘舵��
* @param statusDTO 鐘舵�佺殑鏁版嵁浼犺緭瀵硅薄
*/
@Override
- public void editSave(OsStatusDTO statusDTO){
- VciBaseUtil.alertNotNull(statusDTO,"鐘舵�佺殑淇℃伅",statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О",statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О",statusDTO.getOid(),"涓婚敭");
+ public boolean editSave(OsStatusDTO statusDTO) throws Exception {
+ VciBaseUtil.alertNotNull(statusDTO,"鐘舵�佺殑淇℃伅",
+ statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О",
+ statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О",
+ statusDTO.getOid(),"涓婚敭");
OsStatusVO statusVO = getObjectByOid(statusDTO.getOid());
+ if(Func.isEmpty(statusVO) || Func.isBlank(statusVO.getOid())){
+ throw new PLException("500",new String[]{"淇敼鐨勭姸鎬佸璞′笉瀛樺湪锛�"});
+ }
StatePool pool = statusDTO2DO(statusDTO);
pool.creator = statusVO.getCreator();
pool.createTime = VciDateUtil.getTime(statusVO.getCreateTime());
- List<StatePool> poolList = new ArrayList<>();
- poolList.add(pool);
- batchEditSave(poolList);
- clearCache();
- self.selectAllStatusMap();
+ try {
+ boolean res = batchEditSave(Arrays.asList(pool));
+ self.selectAllStatusMap();
+ return res;
+ }catch (Exception e){
+ e.printStackTrace();
+ logger.error(e.getMessage());
+ return false;
+ }
}
/**
* 鍒犻櫎鐘舵��
- * @param oids 涓婚敭
+ * @param osStatusDTOS
*/
@Override
- public void delete(String oids){
- VciBaseUtil.alertNotNull(oids,"涓婚敭");
- //鍒ゆ柇鏄惁琚紩鐢�
- List<OsStatusVO> statusVOList1 = selectByOidCollection(VciBaseUtil.str2List(oids));
- if(statusVOList1.stream().anyMatch(statusVO -> lifeCycleService.checkStatusUsed(statusVO))){
+ public boolean deleteStatus(List<OsStatusDTO> osStatusDTOS) throws PLException {
+ VciBaseUtil.alertNotNull(osStatusDTOS,"寰呭垹闄ょ殑灞炴�у垪琛�");
+ Set<String> oids = osStatusDTOS.stream().map(OsStatusDTO::getOid).collect(Collectors.toSet());
+ List<OsStatusVO> osStatusVOList = selectByOidCollection(oids);
+ //鍒ゆ柇鏋氫妇鏄惁鏈夎寮曠敤
+ if(osStatusVOList.stream().anyMatch(statusVO -> lifeCycleService.checkStatusUsed(statusVO))){
throw new VciBaseException("鐘舵�佸湪鐢熷懡鍛ㄦ湡涓浣跨敤锛屼笉鑳藉垹闄�");
}
- statusVOList1.stream().forEach(statusVO -> {
- try {
- platformClientUtil.getStatePoolService().deleteStatePool(statusVO2DO(statusVO));
- }catch (Throwable e){
- throw new VciBaseException(LangBaseUtil.getErrorMsg(e),new String[]{},e);
+ //骞冲彴鐨刣eleteStatus鏂规硶蹇呬紶涓変釜鍙傛暟锛宱id銆乶ame鍜宼s
+ List<StatePool> statePoolList = new ArrayList<>();
+ for(OsStatusDTO statusDTO : osStatusDTOS){
+ //oid鍜宼s鍒ょ┖
+ String oid = statusDTO.getOid();
+ //name涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
+ String name = statusDTO.getName();
+ //鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠�
+ Date ts = statusDTO.getTs();
+ if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
+ throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐘舵�佸垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"});
}
- });
- clearCache();
+ StatePool statePool = new StatePool();
+ statePool.oid = oid;
+ statePool.name = name;
+ statePool.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
+ statePoolList.add(statePool);
+ boolean res = platformClientUtil.getStatePoolService().deleteStatePool(statePool);
+ if(!res){
+ throw new PLException("500",new String[]{"鍒犻櫎鐘舵�佸悕绉颁负銆�" + name + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"});
+ }
+ }
+ //clearCache();
self.selectAllStatusMap();
+ return true;
}
/**
@@ -319,16 +384,171 @@
statePool.oid = statusDTO.getOid();
statePool.id = "";
statePool.name = statusDTO.getId();
+ statePool.imagePath = statusDTO.getImagePath();
statePool.description = statusDTO.getDescription()==null?"":statusDTO.getDescription();
- String userId = VciBaseUtil.getCurrentUserId();
+ String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
long now = VciDateUtil.getNowTime();
- statePool.creator = userId;
+ statePool.creator = Func.isBlank(statusDTO.getCreator()) ? userId:statusDTO.getCreator();
statePool.createTime = now;
statePool.modifier = userId;
statePool.modifyTime = now;
statePool.ts = statusDTO.getTs()==null?VciDateUtil.getNowString(VciDateUtil.DateTimeMillFormat):VciDateUtil.date2Str(statusDTO.getTs(),VciDateUtil.DateTimeMillFormat);
statePool.tag = statusDTO.getName();
return statePool;
+ }
+
+ /**
+ * 瀵煎嚭閫変腑鐨勭姸鎬�
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param statusOids 闇�瑕佸鍑虹殑灞炴�у悕绉�
+ * @return
+ */
+ @Override
+ public String exportStatus(String exportFileName, String statusOids) throws PLException {
+ if(Func.isBlank(statusOids)){
+ throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勫睘鎬�!"});
+ }
+ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+ exportFileName = Func.isBlank(exportFileName) ? "鐘舵�佹睜鐘舵�佸鍑篲" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+ //璁剧疆鍒楀悕
+ List<String> columns = new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪"));
+
+ //鍐檈xcel
+ String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < columns.size(); index++) {
+ excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+ }
+ //鎸夌収灞炴�у悕鏌ヨ灞炴�э紝鐒跺悗澶勭悊灞炴�у鍑�
+ List<String> statusOidList = Func.toStrList(statusOids);
+ AtomicInteger i = new AtomicInteger(1);
+ statusOidList.stream().forEach(oid->{
+ OsStatusVO osStatusVO = this.getObjectByOid(oid);
+ excelDataList.add(new WriteExcelData(i.get(),0, osStatusVO.getId()));
+ excelDataList.add(new WriteExcelData(i.get(),1, osStatusVO.getName()));
+ excelDataList.add(new WriteExcelData(i.get(),2, osStatusVO.getImagePath()));
+ excelDataList.add(new WriteExcelData(i.get(),3, osStatusVO.getDescription()));
+ i.getAndIncrement();
+ });
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ return excelPath;
+ }
+
+ /**
+ * 涓嬭浇鐘舵�佸鍏ユā鏉�
+ * @param exportFileName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public String downloadStatusTemplate(String exportFileName) throws Exception {
+ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+ exportFileName = Func.isBlank(exportFileName) ? "鐘舵�佹睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+ //璁剧疆鍒楀悕
+ List<String> columns = new ArrayList<>(
+ Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)")
+ );
+ //璁剧疆蹇呭~鍒�
+ ColumnNameisRed.clear();
+ ColumnNameisRed.add(0);
+
+ //鍐檈xcel
+ String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < columns.size(); index++) {
+ //鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹�
+ if(ColumnNameisRed.contains(index)){
+ WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index));
+ excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
+ excelDataList.add(excelData);
+ }else{
+ excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+ }
+ }
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ return excelPath;
+ }
+
+ /**
+ * 瀵煎叆鐘舵��
+ * @param file
+ * @return
+ */
+ @Override
+ public BaseResult importStatus(File file) throws Exception {
+ VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
+ if(!file.exists()){
+ throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
+ }
+ try{
+ //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞�
+ ReadExcelOption excelOption = new ReadExcelOption();
+ List<OsStatusPO> poList = ExcelUtil.readDataObjectFromExcel(file, OsStatusPO.class,excelOption,(value, po, fieldName)->{});
+ //鍘婚櫎閮芥槸绌虹殑鎯呭喌
+ if(CollectionUtils.isEmpty(poList)){
+ return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
+ }
+ //excel鍒ら噸锛屾暟鎹牎楠岋紝dto瀵硅薄杞崲锛屽瓨鍌ㄥ璞¤浆鎹紝鎵ц淇濆瓨
+ List<StatePool> statePoolList = new ArrayList<>();
+ //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
+ Map<String, String> excelReapeat = new HashMap<>();
+ //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
+ poList.stream().forEach(osStatusPO -> {
+ try {
+ StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(osStatusPO.getId());
+ if(Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)){
+ throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛屽悕绉板湪绯荤粺涓凡缁忓瓨鍦�,璇蜂慨鏀�!");
+ }
+ } catch (PLException e) {
+ e.printStackTrace();
+ logger.error(e.getMessage());
+ throw new VciBaseException(e.getMessage());
+ }
+ if(Func.isBlank(osStatusPO.getId())){//灞炴�у悕鍒ょ┖
+ throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宔numnameerror");
+ }else if(!osStatusPO.getId().matches("[a-z A-Z]*")){
+ // 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�
+ throw new VciBaseException("鍚嶇О鍙兘涓鸿嫳鏂囷紒");
+ }else if(excelReapeat.containsKey(osStatusPO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲�
+ throw new VciBaseException("绗��"+excelReapeat.get(osStatusPO.getId())+"銆戣鍜岀銆�"+osStatusPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�");
+ }
+ //鐘舵�佸悕excel涓垽閲嶅鐞�
+ excelReapeat.put(osStatusPO.getId(),osStatusPO.getRowIndex());
+ OsStatusDTO osStatusDTO = new OsStatusDTO();
+ osStatusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
+ osStatusDTO.setId(osStatusPO.getId());
+ osStatusDTO.setName(osStatusPO.getName());
+ osStatusDTO.setImagePath(osStatusPO.getImagePath());
+ osStatusDTO.setDescription(osStatusPO.getDescription());
+ statePoolList.add(statusDTO2DO(osStatusDTO));
+
+ });
+ //鎵ц淇濆瓨鎿嶄綔
+ batchAddStatus(statePoolList);
+ }catch (Exception e){
+ if(logger.isErrorEnabled()){
+ logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+ }
+ e.printStackTrace();
+ return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
+ }
+ return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�");
}
/**
@@ -352,7 +572,5 @@
statePool.tag = statusVO.getName();
return statePool;
}
-
-
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
index e5380cc..51c02df 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/WebBtmIOServiceImpl.java
@@ -201,7 +201,7 @@
* @param statusDTOList 瑕佸鍏ョ殑鐘舵�佺殑鏁版嵁浼犺緭瀵硅薄鍒楄〃
* @throws VciBaseException 鏌ヨ鎴栬�呮墽琛屽嚭閿欑殑鏃跺�欎細鎶涘嚭寮傚父
*/
- private void importStatus( Collection<OsStatusDTO> statusDTOList) throws VciBaseException{
+ private void importStatus( Collection<OsStatusDTO> statusDTOList) throws Exception {
//瑕佸鍏ョ殑鐘舵�佺殑鎵�鏈夎嫳鏂囧悕绉�
List<String> statusIdList = new ArrayList<String>();
Iterator<OsStatusDTO> iterator = statusDTOList.iterator();
--
Gitblit v1.9.3