| | |
| | | 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.dto.OsStatusDTO; |
| | | import com.vci.model.OsStatusDO; |
| | | import com.vci.pagemodel.OsStatusVO; |
| | | import com.vci.po.OsStatusPO; |
| | | import com.vci.starter.poi.bo.ReadExcelOption; |
| | | import com.vci.starter.poi.bo.WriteExcelData; |
| | |
| | | import com.vci.starter.web.pagemodel.DataGrid; |
| | | import com.vci.starter.web.pagemodel.PageHelper; |
| | | import com.vci.starter.web.util.*; |
| | | import com.vci.dto.OsStatusDTO; |
| | | import com.vci.model.OsStatusDO; |
| | | import com.vci.pagemodel.OsStatusVO; |
| | | import com.vci.starter.web.util.Lcm.Func; |
| | | 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; |
| | |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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(); |
| | |
| | | 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(); |
| | | }); |
| | |
| | | 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("名称", "标签"/*, "图片"*/, "描述")); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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()); |
| | |
| | | } 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中判重处理 |
| | |
| | | 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)); |
| | | |
| | |
| | | e.printStackTrace(); |
| | | return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e); |
| | | } |
| | | return BaseResult.success("枚举导入成功!"); |
| | | return BaseResult.success("状态导入成功!"); |
| | | } |
| | | |
| | | /** |