From 2e61dd380b8a0f94f386684060af91b79e4d45f0 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期三, 09 十月 2024 17:23:16 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsStatusServiceImpl.java | 54 ++++++++++++++++++++++++------------------------------
1 files changed, 24 insertions(+), 30 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 f8abe1d..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();
@@ -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();
});
@@ -491,10 +486,10 @@
private List<String> getCloumns(boolean flag){
if(flag){
return new ArrayList<>(
- Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)","鍥剧墖(璺緞)", "鎻忚堪(鍙互涓虹┖)")
+ Arrays.asList("鍚嶇О(涓嶈兘涓虹┖)", "鏍囩(瀵瑰悕绉扮殑瑙i噴)"/*,"鍥剧墖(璺緞)"*/, "鎻忚堪(鍙互涓虹┖)")
);
}
- return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩", "鍥剧墖", "鎻忚堪"));
+ return new ArrayList<>(Arrays.asList("鍚嶇О", "鏍囩"/*, "鍥剧墖"*/, "鎻忚堪"));
}
/**
@@ -520,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());
@@ -530,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涓垽閲嶅鐞�
@@ -546,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));
@@ -560,7 +554,7 @@
e.printStackTrace();
return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
}
- return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�");
+ return BaseResult.success("鐘舵�佸鍏ユ垚鍔燂紒");
}
/**
--
Gitblit v1.9.3