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 |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 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 ea69662..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
@@ -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){
@@ -192,6 +196,7 @@
 	 * @return
 	 */
 	@Override
+	@Transactional
 	public TraceabilityDetailDTO getTraceabilityDetailInfos(Traceability traceability) {
 		TraceabilityDetailDTO dto = new TraceabilityDetailDTO();
 		int count = 0;
@@ -207,7 +212,7 @@
 		//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()));
@@ -215,12 +220,10 @@
 		//4. 查询农事记录信息(种植开始起)
 		List<FarmingRecordVO> farmingRecordVOList = farmingRecordService.getFarmingRecordByFarmPlantId(recoveryVO);
 		//5. 查询企业信息
-		Farm farm = new Farm();
-		farm.setDeptId(traceability1.getDeptId());
-		Farm farmVO = farmService.getOne(new QueryWrapper<>(farm));
+		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);

--
Gitblit v1.9.3