yuxc
2024-08-02 247aa6397ebdb5249a1213af11aaaf560568b0c3
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;
@@ -365,14 +361,11 @@
            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[]{"删除状态名称为【" + id + "】的数据时出现错误!"});
            }
        }
        boolean res = platformClientUtil.getStatePoolService().deleteStatePools(statePoolList.toArray(new StatePool[statePoolList.size()]));
        //clearCache();
        self.selectAllStatusMap();
        return true;
        return res;
    }
    /**
@@ -386,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();
@@ -435,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();
        });
@@ -493,10 +486,10 @@
    private List<String> getCloumns(boolean flag){
        if(flag){
            return new ArrayList<>(
                    Arrays.asList("名称(不能为空)", "标签(对名称的解释)","图片(路径)", "描述(可以为空)")
                    Arrays.asList("名称(不能为空)", "标签(对名称的解释)"/*,"图片(路径)"*/, "描述(可以为空)")
            );
        }
        return new ArrayList<>(Arrays.asList("名称", "标签", "图片", "描述"));
        return new ArrayList<>(Arrays.asList("名称", "标签"/*, "图片"*/, "描述"));
    }
    /**
@@ -522,7 +515,6 @@
            List<StatePool> statePoolList = new ArrayList<>();
            //当前excel中是否重复用的判重Map:(key:判重属性,value:行号)
            Map<String, String> excelReapeat = new HashMap<>();
            //判断必填属性是否为空,用户是否已存在,以及部门是否填错等校验逻辑
            poList.stream().forEach(osStatusPO -> {
                try {
                    StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(osStatusPO.getId());
@@ -532,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()+"】行,enumnameerror");
                if(Func.isBlank(osStatusPO.getId())){//状态名判空
                    throw new VciBaseException("第【"+osStatusPO.getRowIndex()+"】行,statusnameerror");
                }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中判重处理
@@ -548,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));
@@ -562,7 +554,7 @@
            e.printStackTrace();
            return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
        }
        return BaseResult.success("枚举导入成功!");
        return BaseResult.success("状态导入成功!");
    }
    /**