| | |
| | | package com.iailab.module.model.mcs.pre.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.iailab.framework.common.page.PageData; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.iailab.framework.common.pojo.PageResult; |
| | | import com.iailab.framework.common.service.impl.BaseServiceImpl; |
| | | import com.iailab.framework.common.util.object.BeanUtils; |
| | | import com.iailab.module.model.mcs.pre.dao.MmPredictItemDao; |
| | | import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
| | | import com.iailab.module.model.mcs.pre.entity.*; |
| | |
| | | import com.iailab.module.model.mcs.pre.enums.ItemTypeEnum; |
| | | import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
| | | import com.iailab.module.model.mcs.pre.service.SequenceNumService; |
| | | import com.iailab.module.model.mcs.pre.vo.MmPredictItemPageReqVO; |
| | | 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 javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author PanZhibao |
| | | * @date 2021年04月26日 14:03 |
| | | */ |
| | | @Service("mmPredictItemService") |
| | | public class MmPredictItemServiceImpl extends BaseServiceImpl<MmPredictItemDao, MmPredictItemEntity> implements MmPredictItemService { |
| | | @Service |
| | | public class MmPredictItemServiceImpl extends ServiceImpl<MmPredictItemDao, MmPredictItemEntity> implements MmPredictItemService { |
| | | |
| | | @Autowired |
| | | private DmModuleItemServiceImpl dmModuleItemService; |
| | |
| | | @Autowired |
| | | private SequenceNumService sequenceNumService; |
| | | |
| | | @Override |
| | | public PageResult<MmPredictItemRespVO> getPageList(Map<String, Object> params) { |
| | | PageResult<MmPredictItemRespVO> result = new PageResult(); |
| | | IPage<MmPredictItemRespVO> page = baseDao.getPageList( |
| | | getPage(params, "CREATE_TIME", false), |
| | | params |
| | | ); |
| | | result.setList(page.getRecords()); |
| | | result.setTotal(page.getTotal()); |
| | | return result; |
| | | } |
| | | @Autowired |
| | | private MmPredictItemDao mmPredictItemDao; |
| | | |
| | | private QueryWrapper<MmPredictItemEntity> getWrapper(Map<String, Object> params) { |
| | | QueryWrapper<MmPredictItemEntity> wrapper = new QueryWrapper<>(); |
| | | return wrapper; |
| | | @Override |
| | | public PageResult<MmPredictItemEntity> queryPage(MmPredictItemPageReqVO reqVO) { |
| | | return mmPredictItemDao.selectPage(reqVO); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void add(MmPredictItemEntity mmPredictItemEntity) { |
| | | mmPredictItemDao.insert(mmPredictItemEntity); |
| | | } |
| | | |
| | | @Override |
| | | public void update(MmPredictItemEntity mmPredictItemEntity) { |
| | | mmPredictItemDao.updateById(mmPredictItemEntity); |
| | | } |
| | | |
| | | /* |
| | | public void savePredictItem(MmPredictItemDTO mmPredictItemDto) { |
| | | MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem(); |
| | | predictItem.setId(UUID.randomUUID().toString()); |
| | |
| | | mMmPredictMergeItem.setItemid(predictItem.getId()); |
| | | mmPredictMergeItemService.savePredictMergeItem(mMmPredictMergeItem); |
| | | } |
| | | insert(predictItem); |
| | | mmPredictItemDao.insert(predictItem); |
| | | DmModuleItemEntity dmModuleItem = mmPredictItemDto.getDmModuleItem(); |
| | | dmModuleItem.setItemid(predictItem.getId()); |
| | | dmModuleItemService.saveModuleItem(dmModuleItem); |
| | |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | mmItemOutput.setItemid(predictItem.getId()); |
| | | mmItemOutputService.saveMmItemOutput(mmItemOutput); |
| | | } |
| | | |
| | | }*/ |
| | | /* |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void update(MmPredictItemDTO mmPredictItemDto) { |
| | | MmPredictItemEntity predictItem = mmPredictItemDto.getMmPredictItem(); |
| | | predictItem.setUpdateTime(new Date()); |
| | |
| | | |
| | | MmItemOutputEntity mmItemOutput = mmPredictItemDto.getMmItemOutput(); |
| | | mmItemOutputService.update(mmItemOutput); |
| | | } |
| | | |
| | | }*/ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void deleteBatch(String[] itemIds) { |
| | | deleteBatchIds(Arrays.asList(itemIds)); |
| | | mmPredictItemDao.deleteBatchIds(Arrays.asList(itemIds)); |
| | | mmPredictMergeItemService.deleteBatch(itemIds); |
| | | mmPredictModelService.deleteBatch(itemIds); |
| | | mmItemOutputService.deleteBatch(itemIds); |
| | | } |
| | | |
| | | @Override |
| | | public MmPredictItemDTO getDetailById(String id, Map<String, Object> params) { |
| | | MmPredictItemDTO mmPredictItemDto = new MmPredictItemDTO(); |
| | | MmPredictItemEntity predictItem = selectById(id); |
| | | public MmPredictItemDTO info(String id) { |
| | | MmPredictItemEntity predictItem = mmPredictItemDao.selectById(id); |
| | | MmPredictItemDTO mmPredictItemDto = BeanUtils.toBean(predictItem, MmPredictItemDTO.class); |
| | | return mmPredictItemDto; |
| | | } |
| | | /* |
| | | |
| | | @Override |
| | | public MmPredictItemDTO info(String id) { |
| | | MmPredictItemEntity predictItem = mmPredictItemDao.selectById(id); |
| | | MmPredictItemDTO mmPredictItemDto = BeanUtils.toBean(predictItem, MmPredictItemDTO.class); |
| | | mmPredictItemDto.setMmPredictItem(predictItem); |
| | | mmPredictItemDto.setDmModuleItem(dmModuleItemService.getByItemid(id)); |
| | | mmPredictItemDto.setMmItemOutput(mmItemOutputService.getByItemid(id)); |
| | |
| | | } else if (ItemTypeEnum.MERGE_ITEM.getName().equals(itemType.getItemtypename())) { |
| | | mmPredictItemDto.setMmPredictMergeItem(mmPredictMergeItemService.getByItemid(id)); |
| | | } |
| | | |
| | | return mmPredictItemDto; |
| | | } |
| | | |
| | | @Override |
| | | public boolean exportItemResult(HttpServletResponse response, HttpServletRequest request, String id, Map<String, Object> params) { |
| | | //MmPredictItemDTO mmPredictItemDto = this.getPredictValuesById(id, params); |
| | | //List<MmItemResultEntity> itemResultList = mmPredictItemDto.getMmItemResultList(); |
| | | |
| | | return true; |
| | | } |
| | | */ |
| | | |
| | | @Override |
| | | public int check(MmPredictItemEntity mmPredictItem) { |
| | |
| | | QueryWrapper<MmPredictItemEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.ne(StringUtils.isNotBlank(id), "id", id); |
| | | queryWrapper.and(wrapper -> wrapper.eq("itemname", itemname).or().eq("itemno", itemno)); |
| | | List<MmPredictItemEntity> list = baseDao.selectList(queryWrapper); |
| | | List<MmPredictItemEntity> list = mmPredictItemDao.selectList(queryWrapper); |
| | | return list.size(); |
| | | } |
| | | |
| | | @Override |
| | | public Long count() { |
| | | QueryWrapper<MmPredictItemEntity> queryWrapper = new QueryWrapper<>(); |
| | | return baseDao.selectCount(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<ItemVO> getByModuleId(String moduleId) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | |
| | | return baseDao.getByModuleId(params); |
| | | return mmPredictItemDao.getByModuleId(params); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | params.put("ITEMNO", itemNo); |
| | | List<ItemVO> list = baseDao.getItem(params); |
| | | List<ItemVO> list = mmPredictItemDao.getItem(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | params.put("ITEMID", itemId); |
| | | List<ItemVO> list = baseDao.getItem(params); |
| | | List<ItemVO> list = mmPredictItemDao.getItem(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | Map<String, Object> params = new HashMap(1); |
| | | params.put("ITEMID", itemId); |
| | | List<MergeItemVO> list = baseDao.getMergeItemByItemId(params); |
| | | List<MergeItemVO> list = mmPredictItemDao.getMergeItemByItemId(params); |
| | | if (CollectionUtils.isEmpty(list)) { |
| | | return null; |
| | | } |