| | |
| | | public List<TraceabilityVO> getTraceabilityList(TraceabilityVO traceability) { |
| | | return baseMapper.getTraceabilityList(traceability); |
| | | } |
| | | |
| | | /** |
| | | * 获取溯源详情信息(包含农产品信息,认证检测信息,产地(地块信息),农事记录,企业信息)扫码 |
| | | * @param traceability |
| | | * @return |
| | | */ |
| | | @Override |
| | | public TraceabilityDetailDTO getTraceabilityDetailInfos(Traceability traceability) { |
| | | TraceabilityDetailDTO dto = new TraceabilityDetailDTO(); |
| | | int count = 0; |
| | | //根据溯源码编号查询溯源信息 |
| | | Traceability traceability1 = baseMapper.selectOne(new QueryWrapper<>(traceability)); |
| | | //记录扫描记录 |
| | | SweepRecord sweepRecord = new SweepRecord(); |
| | | sweepRecord.setCreateTime(new Date()); |
| | | sweepRecord.setCode(traceability.getId().toString()); |
| | | sweepRecord.setDeptId(traceability1.getDeptId()); |
| | | //新增 |
| | | sweepRecordService.save(sweepRecord); |
| | | //1. 查询农产品采收记录信息 |
| | | RecoveryVO recoveryVO = recoveryService.getRecoveryDetail(traceability1.getRecoveryId()); |
| | | //2. 查询相关检测信息 |
| | | List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(traceability1.getDeptId()); |
| | | //3. 查询产地(地块)信息 |
| | | LandVO land = new LandVO(); |
| | | land.setId(Long.parseLong(recoveryVO.getLandId())); |
| | | LandVO landInfo = (LandVO)landService.getLandInfo(land); |
| | | //4. 查询农事记录信息(种植开始起) |
| | | List<FarmingRecordVO> farmingRecordVOList = farmingRecordService.getFarmingRecordByFarmPlantId(recoveryVO); |
| | | //5. 查询企业信息 |
| | | Farm farm = new Farm(); |
| | | farm.setDeptId(traceability1.getDeptId()); |
| | | Farm farmVO = farmService.getOne(new QueryWrapper<>(farm)); |
| | | //6. 数据封装 |
| | | dto.setRecoveryVO(recoveryVO); |
| | | dto.setFarm(farmVO); |
| | | dto.setRecordVOList(farmingRecordVOList); |
| | | dto.setPaperVOList(farmPaperList); |
| | | dto.setLandVO(landInfo); |
| | | //返回 |
| | | return dto; |
| | | } |
| | | } |