| | |
| | | import com.vci.starter.web.util.LangBaseUtil; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.vci.starter.web.util.VciDateUtil; |
| | | import com.vci.web.dto.OsStatusDTO; |
| | | import com.vci.web.model.OsStatusDO; |
| | | import com.vci.web.pageModel.OsStatusVO; |
| | | import com.vci.dto.OsStatusDTO; |
| | | import com.vci.model.OsStatusDO; |
| | | import com.vci.pagemodel.OsStatusVO; |
| | | import com.vci.starter.web.util.WebThreadLocalUtil; |
| | | 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.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import javax.swing.*; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vci.frameworkcore.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | import static com.vci.constant.FrameWorkBusLangCodeConstant.DATA_OID_NOT_EXIST; |
| | | |
| | | |
| | | /** |
| | | * 状态的服务 |
| | |
| | | * @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)); |
| | |
| | | * @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 -> { |
| | |
| | | * @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 { |
| | |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param statePoolList 状态内容 |
| | | */ |
| | | @Override |
| | | public void batchEditSave(List<StatePool> statePoolList) { |
| | | public boolean batchEditSave(List<StatePool> statePoolList) { |
| | | if(!CollectionUtils.isEmpty(statePoolList)){ |
| | | for(StatePool statePool : statePoolList) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param statusDTO 状态的数据传输对象 |
| | | */ |
| | | @Override |
| | | public void addSave(OsStatusDTO statusDTO) { |
| | | VciBaseUtil.alertNotNull(statusDTO,"状态的信息",statusDTO.getId(),"状态的英文名称",statusDTO.getName(),"状态的中文名称"); |
| | | public boolean addSave(OsStatusDTO statusDTO) throws Exception { |
| | | VciBaseUtil.alertNotNull( |
| | | statusDTO,"状态的信息", |
| | | statusDTO.getId(),"状态的英文名称", |
| | | statusDTO.getName(),"状态的中文名称" |
| | | ); |
| | | StatePool dbStatePool = platformClientUtil.getStatePoolService().getStatePool(statusDTO.getName()); |
| | | if (Func.isNotEmpty(dbStatePool) || Func.isNotBlank(dbStatePool.oid)) { |
| | | throw new PLException("500",new String[]{"名称重复请更换名称!"}); |
| | | } |
| | | // 状态池名称只能为英文字母 |
| | | String regex = "[a-z A-Z]*"; |
| | | if ((!dbStatePool.name.matches(regex))) { |
| | | throw new PLException("500",new String[]{"名称只能为英文!"}); |
| | | } |
| | | //虽然会自动生成oid,但是这儿设置主键,避免放入缓存的数据是没有oid的 |
| | | statusDTO.setOid(VciBaseUtil.getPk()); |
| | | StatePool pool = statusDTO2DO(statusDTO); |
| | | List<StatePool> poolList = new ArrayList<>(); |
| | | poolList.add(pool); |
| | | batchAddStatus(poolList); |
| | | clearCache(); |
| | | //clearCache(); |
| | | self.selectAllStatusMap(); |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑状态 |
| | | * @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()); |
| | |
| | | batchEditSave(poolList); |
| | | clearCache(); |
| | | self.selectAllStatusMap(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param oids 主键 |
| | | */ |
| | | @Override |
| | | public void delete(String oids){ |
| | | public boolean delete(String oids){ |
| | | VciBaseUtil.alertNotNull(oids,"主键"); |
| | | //判断是否被引用 |
| | | List<OsStatusVO> statusVOList1 = selectByOidCollection(VciBaseUtil.str2List(oids)); |
| | |
| | | }); |
| | | clearCache(); |
| | | self.selectAllStatusMap(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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.createTime = now; |