From 72b971c98c46531064d74b68fc8fe8864ed0b544 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Tue, 08 Nov 2022 09:04:56 +0800
Subject: [PATCH] 大屏溯源统计次数sql修改
---
src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java | 61 ++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java b/src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java
index 311eaf9..8959d12 100644
--- a/src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java
+++ b/src/main/java/org/springblade/modules/traceability/service/impl/TraceabilityServiceImpl.java
@@ -29,6 +29,7 @@
import org.springblade.modules.traceability.vo.TraceabilityVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import sun.misc.BASE64Encoder;
import javax.sound.midi.Receiver;
@@ -74,6 +75,11 @@
@Override
public IPage<TraceabilityVO> selectTraceabilityPage(IPage<TraceabilityVO> page, TraceabilityVO traceability) {
return page.setRecords(baseMapper.selectTraceabilityPage(page, traceability));
+ }
+
+ @Override
+ public IPage<TraceabilityVO> selectTraceabilityXcxPage(IPage<TraceabilityVO> page, TraceabilityVO traceability) {
+ return page.setRecords(baseMapper.selectTraceabilityXcxPage(page, traceability));
}
@Override
@@ -130,7 +136,7 @@
//插入扫描记录
SweepRecord sweepRecord = new SweepRecord();
sweepRecord.setCreateTime(new Date());
- sweepRecord.setCode(traceability.getId().toString());
+ sweepRecord.setCode(traceability1.getId().toString());
sweepRecord.setDeptId(traceability1.getDeptId());
//新增
sweepRecordService.save(sweepRecord);
@@ -138,20 +144,18 @@
//1. 查询农产品采收记录信息
RecoveryVO recoveryVO = recoveryService.getRecoveryDetail(traceability1.getRecoveryId());
//2. 查询相关检测信息
- List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(traceability1.getDeptId());
+ List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(recoveryVO.getFarmId(),recoveryVO.getFarmPlantId());
//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));
+ //5. 查询农场信息
+ Farm farm = farmService.getById(recoveryVO.getFarmId());
//6. 数据封装
dto.setRecoveryVO(recoveryVO);
- dto.setFarm(farmVO);
+ dto.setFarm(farm);
dto.setRecordVOList(farmingRecordVOList);
dto.setPaperVOList(farmPaperList);
dto.setLandVO(landInfo);
@@ -159,7 +163,7 @@
if (null!=recoveryVO){
count = count + 20;
}
- if (null!=farmVO){
+ if (null!=farm){
count = count + 20;
}
if (null==landInfo){
@@ -185,4 +189,45 @@
public List<TraceabilityVO> getTraceabilityList(TraceabilityVO traceability) {
return baseMapper.getTraceabilityList(traceability);
}
+
+ /**
+ * 获取溯源详情信息(包含农产品信息,认证检测信息,产地(地块信息),农事记录,企业信息)扫码
+ * @param traceability
+ * @return
+ */
+ @Override
+ @Transactional
+ 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(traceability1.getId().toString());
+ sweepRecord.setDeptId(traceability1.getDeptId());
+ //新增
+ sweepRecordService.save(sweepRecord);
+ //1. 查询农产品采收记录信息
+ RecoveryVO recoveryVO = recoveryService.getRecoveryDetail(traceability1.getRecoveryId());
+ //2. 查询相关检测信息
+ List<FarmPaperVO> farmPaperList = farmPaperService.getFarmPaperList(recoveryVO.getFarmId(),recoveryVO.getFarmPlantId());
+ //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 = farmService.getById(recoveryVO.getFarmId());
+ //6. 数据封装
+ dto.setRecoveryVO(recoveryVO);
+ dto.setFarm(farm);
+ dto.setRecordVOList(farmingRecordVOList);
+ dto.setPaperVOList(farmPaperList);
+ dto.setLandVO(landInfo);
+ //返回
+ return dto;
+ }
}
--
Gitblit v1.9.3