From d336c430e5d22ade703ff12f3d523889eb3d75d6 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 08 十一月 2024 10:54:26 +0800
Subject: [PATCH] action管理 编辑 新增 分类禁用bug
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java | 72 +++++++++++++++++++----------------
1 files changed, 39 insertions(+), 33 deletions(-)
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 033c3f4..52e0be9 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,11 +1,7 @@
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;
@@ -280,17 +276,19 @@
public boolean addSave(OsStatusDTO statusDTO) throws Exception {
VciBaseUtil.alertNotNull(
statusDTO,"鐘舵�佺殑淇℃伅",
- statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О",
- statusDTO.getName(),"鐘舵�佺殑涓枃鍚嶇О"
+ statusDTO.getId(),"鐘舵�佺殑鑻辨枃鍚嶇О"
);
- StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
- if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
- throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"});
+ if (statusDTO.getId().length()>50) {
+ throw new PLException("500",new String[]{"鐘舵�佽嫳鏂囧悕绉颁笉鑳借秴杩�50涓瓧绗︼紒"});
}
// 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�
String regex = "[a-z A-Z]*";
- if ((!statusDTO.getId().matches(regex))) {
+ if (!statusDTO.getId().matches(regex)) {
throw new PLException("500",new String[]{"鍚嶇О鍙兘涓鸿嫳鏂囷紒"});
+ }
+ StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getId());
+ if (Func.isNotEmpty(dbStatePool) && Func.isNotBlank(dbStatePool.oid)) {
+ throw new PLException("500",new String[]{"鍚嶇О閲嶅璇锋洿鎹㈠悕绉帮紒"});
}
//铏界劧浼氳嚜鍔ㄧ敓鎴恛id锛屼絾鏄繖鍎胯缃富閿紝閬垮厤鏀惧叆缂撳瓨鐨勬暟鎹槸娌℃湁oid鐨�
statusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
@@ -351,26 +349,23 @@
for(OsStatusDTO statusDTO : osStatusDTOS){
//oid鍜宼s鍒ょ┖
String oid = statusDTO.getOid();
- //name涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
- String name = statusDTO.getName();
+ //id涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
+ String id = statusDTO.getId();
//鍚庡彴浼氱敤ts杩涜鏁版嵁涓�鑷存�ф牎楠�
Date ts = statusDTO.getTs();
- if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
+ if(Func.isBlank(oid) || Func.isBlank(id) || Func.isEmpty(ts)){
throw new PLException("500",new String[]{"寰呭垹闄ょ殑鐘舵�佸垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佺姸鎬佸悕绉般�恘ame銆戜笉鑳戒负绌猴紒"});
}
StatePool statePool = new StatePool();
statePool.oid = oid;
- statePool.name = name;
+ statePool.name = id;
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 + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"});
- }
}
+ boolean res = platformClientUtil.getStatePoolService().deleteStatePools(statePoolList.toArray(new StatePool[statePoolList.size()]));
//clearCache();
self.selectAllStatusMap();
- return true;
+ return res;
}
/**
@@ -384,7 +379,7 @@
statePool.oid = statusDTO.getOid();
statePool.id = "";
statePool.name = statusDTO.getId();
- statePool.imagePath = statusDTO.getImagePath();
+ //statePool.imagePath = statusDTO.getImagePath();
statePool.description = statusDTO.getDescription()==null?"":statusDTO.getDescription();
String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
long now = VciDateUtil.getNowTime();
@@ -404,14 +399,14 @@
* @return
*/
@Override
- public String exportStatus(String exportFileName, String statusOids) throws PLException {
+ public String exportStatus(String exportFileName, String statusOids,boolean flag/*鎺у埗瀵煎嚭鐨勫垪鍚嶆槸鍚﹀拰瀵煎叆妯℃澘涓�鑷�*/) 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("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪"));
+ List<String> columns = this.getCloumns(flag);
//鍐檈xcel
String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
@@ -433,7 +428,7 @@
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(),2, osStatusVO.getImagePath()));
excelDataList.add(new WriteExcelData(i.get(),3, osStatusVO.getDescription()));
i.getAndIncrement();
});
@@ -453,9 +448,7 @@
//鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
exportFileName = Func.isBlank(exportFileName) ? "鐘舵�佹睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
//璁剧疆鍒楀悕
- List<String> columns = new ArrayList<>(
- Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)")
- );
+ List<String> columns = this.getCloumns(true);
//璁剧疆蹇呭~鍒�
ColumnNameisRed.clear();
ColumnNameisRed.add(0);
@@ -486,6 +479,20 @@
}
/**
+ * 鑾峰彇瀵煎嚭鎴栧鍏ユā鏉跨殑鍒楀悕
+ * @param flag 鏄惁鑾峰彇瀵煎叆妯℃澘鍒楀悕
+ * @return
+ */
+ private List<String> getCloumns(boolean flag){
+ if(flag){
+ return new ArrayList<>(
+ Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)"/*,"鍥剧墖(璺緞)"*/, "鎻忚堪(鍙互涓虹┖)")
+ );
+ }
+ return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩"/*, "鍥剧墖"*/, "鎻忚堪"));
+ }
+
+ /**
* 瀵煎叆鐘舵��
* @param file
* @return
@@ -508,7 +515,6 @@
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());
@@ -518,14 +524,14 @@
} catch (PLException e) {
e.printStackTrace();
logger.error(e.getMessage());
- throw new VciBaseException(e.getMessage());
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
}
- if(Func.isBlank(osStatusPO.getId())){//灞炴�у悕鍒ょ┖
- throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宔numnameerror");
+ if(Func.isBlank(osStatusPO.getId())){//鐘舵�佸悕鍒ょ┖
+ throw new VciBaseException("绗��"+osStatusPO.getRowIndex()+"銆戣锛宻tatusnameerror");
}else if(!osStatusPO.getId().matches("[a-z A-Z]*")){
// 鐘舵�佹睜鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�
throw new VciBaseException("鍚嶇О鍙兘涓鸿嫳鏂囷紒");
- }else if(excelReapeat.containsKey(osStatusPO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲�
+ }else if(excelReapeat.containsKey(osStatusPO.getId())){//鐘舵�佸悕琛ㄦ牸涓垽閲�
throw new VciBaseException("绗��"+excelReapeat.get(osStatusPO.getId())+"銆戣鍜岀銆�"+osStatusPO.getRowIndex()+"銆戣鏁版嵁锛屽悕绉伴噸澶�");
}
//鐘舵�佸悕excel涓垽閲嶅鐞�
@@ -534,7 +540,7 @@
osStatusDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
osStatusDTO.setId(osStatusPO.getId());
osStatusDTO.setName(osStatusPO.getName());
- osStatusDTO.setImagePath(osStatusPO.getImagePath());
+ //osStatusDTO.setImagePath(osStatusPO.getImagePath());
osStatusDTO.setDescription(osStatusPO.getDescription());
statePoolList.add(statusDTO2DO(osStatusDTO));
@@ -548,7 +554,7 @@
e.printStackTrace();
return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
}
- return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�");
+ return BaseResult.success("鐘舵�佸鍏ユ垚鍔燂紒");
}
/**
--
Gitblit v1.9.3