| | |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
| | | import com.iailab.module.model.mdk.vo.ItemVO; |
| | | import com.iailab.module.model.mdk.vo.MergeItemVO; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | |
| | | @Autowired |
| | | private MmPredictItemDao mmPredictItemDao; |
| | | |
| | | private static HashMap<String, ItemVO> itemVOHashMap = new HashMap<>(); |
| | | |
| | | @Override |
| | | public PageResult<MmPredictItemRespVO> queryPage(MmPredictItemPageReqVO reqVO) { |
| | |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | |
| | | // 清空缓存 |
| | | clearCatch(); |
| | | } |
| | | |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | mmItemOutputService.deleteByItemId(predictItem.getId()); |
| | | List<MmItemOutputEntity> mmItemOutput = mmPredictItemDto.getMmItemOutputList(); |
| | | mmItemOutput.forEach(e -> { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | if (!CollectionUtils.isEmpty(mmItemOutput)) { |
| | | mmItemOutput.forEach(e -> { |
| | | // 尽量保存原有id |
| | | if (StringUtils.isBlank(e.getId())) { |
| | | e.setId(UUID.randomUUID().toString()); |
| | | } |
| | | e.setItemid(predictItem.getId()); |
| | | }); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | | |
| | | // 清空缓存 |
| | | clearCatch(); |
| | | } |
| | | |
| | | @DSTransactional(rollbackFor = Exception.class) |
| | |
| | | mmPredictMergeItemService.deleteBatch(itemIds); |
| | | mmPredictModelService.deleteBatch(itemIds); |
| | | mmItemOutputService.deleteBatch(itemIds); |
| | | |
| | | // 清空缓存 |
| | | clearCatch(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (itemType != null && ItemTypeEnum.NORMAL_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | MmPredictModelEntity mmPredictModel = mmPredictModelService.getByItemid(id); |
| | | mmPredictItemDto.setMmPredictModel(mmPredictModel); |
| | | mmPredictItemDto.setMmModelArithSettingsList(mmModelArithSettingsService.getByModelid(mmPredictModel.getId())); |
| | | mmPredictItemDto.setMmModelArithSettingsList(mmModelArithSettingsService.getByModelId(mmPredictModel.getId())); |
| | | mmPredictItemDto.setMmModelParamList(mmModelParamService.getByModelid(mmPredictModel.getId())); |
| | | mmPredictItemDto.setMmPredictMergeItem(new MmPredictMergeItemEntity()); |
| | | } else if (itemType != null && ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ItemVO getItemById(String itemId) { |
| | | public void clearCatch() { |
| | | itemVOHashMap.clear(); |
| | | } |
| | | |
| | | @Override |
| | | public ItemVO getItemByIdFromCache(String itemId) { |
| | | if (StringUtils.isBlank(itemId)) { |
| | | return null; |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | if (!itemVOHashMap.containsKey(itemId)) { |
| | | Map<String, Object> params = new HashMap<>(1); |
| | | params.put("ITEMID", itemId); |
| | | List<ItemVO> list = mmPredictItemDao.getItem(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | | itemVOHashMap.put(itemId, list.get(0)); |
| | | } |
| | | return itemVOHashMap.get(itemId); |
| | | } |
| | | |
| | | @Override |
| | | public ItemVO getItemById(String itemId) { |
| | | Map<String, Object> params = new HashMap<>(1); |
| | | params.put("ITEMID", itemId); |
| | | List<ItemVO> list = mmPredictItemDao.getItem(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public ItemVO getItemByOutPutId(String outPutId) { |
| | | if (StringUtils.isBlank(outPutId)) { |
| | | return null; |
| | | } |
| | | MmItemOutputEntity outPutById = mmItemOutputService.getOutPutById(outPutId); |
| | | if (ObjectUtils.isEmpty(outPutById)) { |
| | | return null; |
| | | } |
| | | String itemId = outPutById.getItemid(); |
| | | return getItemByIdFromCache(itemId); |
| | | } |
| | | |
| | | @Override |
| | | public MergeItemVO getMergeItemByItemId(String itemId) { |
| | | if (StringUtils.isBlank(itemId)) { |
| | | return null; |