| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetMng; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetType; |
| | | import com.gkhy.safePlatform.targetDuty.excepiton.TargetDutyException; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.req.TargetDivideDetailQueryCriteria; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.req.TargetExamineSaveOrUpdate; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetDivideDetailDto; |
| | | import com.gkhy.safePlatform.targetDuty.model.dto.resp.TargetMngDto; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetExamineRepository; |
| | | import com.gkhy.safePlatform.targetDuty.entity.TargetExamine; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetMngRepository; |
| | | import com.gkhy.safePlatform.targetDuty.repository.TargetTypeRepository; |
| | | import com.gkhy.safePlatform.targetDuty.service.CommonService; |
| | | import com.gkhy.safePlatform.targetDuty.service.TargetDivideDetailService; |
| | | import com.gkhy.safePlatform.targetDuty.service.TargetExamineService; |
| | | import com.gkhy.safePlatform.targetDuty.service.baseService.TargetExamineBaseService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.gkhy.safePlatform.commons.enums.ResultCodes; |
| | |
| | | import com.gkhy.safePlatform.commons.utils.BeanCopyUtils; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | * @since 2022-07-22 09:30:01 |
| | | */ |
| | | @Service("targetExamineService") |
| | | public class TargetExamineServiceImpl extends ServiceImpl<TargetExamineRepository, TargetExamine> implements TargetExamineService { |
| | | public class TargetExamineServiceImpl implements TargetExamineService { |
| | | |
| | | @Autowired |
| | | private TargetExamineRepository targetExamineRepository; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultVO queryAll(PageQuery<TargetExamineQueryCriteria> pageQuery) { |
| | | Long pageIndex = pageQuery.getPageIndex(); |
| | | Long pageSize = pageQuery.getPageSize(); |
| | | IPage<TargetExamine> page = new Page<>(pageIndex, pageSize); |
| | | |
| | | page = baseMapper.selectPage(page, |
| | | QueryHelpPlus.getPredicate(TargetExamine.class, pageQuery.getSearchParams())); |
| | | List<TargetExamineDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), TargetExamineDto.class); |
| | | |
| | | return new SearchResultVO<>( |
| | | true, |
| | | pageIndex, |
| | | pageSize, |
| | | page.getTotal(), |
| | | respList, |
| | | ResultCodes.OK |
| | | ); |
| | | } |
| | | private TargetExamineBaseService targetExamineBaseService; |
| | | |
| | | |
| | | @Override |
| | | public List<TargetExamine> queryAll(TargetExamineQueryCriteria criteria) { |
| | | return baseMapper.selectList(QueryHelpPlus.getPredicate(TargetExamine.class, criteria)); |
| | | return targetExamineBaseService.queryAll(criteria); |
| | | } |
| | | |
| | | @Override |
| | | public void addOrUpdate(TargetExamineSaveOrUpdate infoDto) { |
| | | |
| | | |
| | | if(StringUtils.hasText(infoDto.getDelIds())) { |
| | | List<Long> idList = Arrays.stream(infoDto.getDelIds().split(",")).map(s-> Long.parseLong(s.trim())) |
| | | .collect(Collectors.toList()); |
| | | this.removeByIds(idList); |
| | | public void delete(Long[] ids) { |
| | | if(ids == null){ |
| | | throw new TargetDutyException(ResultCodes.CLIENT_PARAM_ILLEGAL); |
| | | } |
| | | List<Long> idList = Arrays.asList(ids); |
| | | |
| | | infoDto.getExamineList().forEach(f->{ |
| | | f.setTargetId(infoDto.getId()); |
| | | List<TargetExamine> delList = new ArrayList<>(); |
| | | idList.forEach(f->{ |
| | | TargetExamine info = new TargetExamine(); |
| | | info.setDelFlag(1); |
| | | info.setId(f); |
| | | delList.add(info); |
| | | }); |
| | | this.saveOrUpdateBatch(infoDto.getExamineList()); |
| | | targetExamineBaseService.updateBatchById(delList); |
| | | } |
| | | |
| | | } |