From cc07034948c1da11441aa8553bfc436d74199917 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 09 Sep 2022 10:21:26 +0800
Subject: [PATCH] 溯源地块选择只选择当前农场采收地块

---
 src/main/java/org/springblade/modules/lang/controller/LandController.java |   33 +++++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/springblade/modules/lang/controller/LandController.java b/src/main/java/org/springblade/modules/lang/controller/LandController.java
index c78e810..91de7cf 100644
--- a/src/main/java/org/springblade/modules/lang/controller/LandController.java
+++ b/src/main/java/org/springblade/modules/lang/controller/LandController.java
@@ -113,7 +113,7 @@
 	 */
 	@GetMapping("/selcetByStrainId")
 	public R selcetByStrainId(String strainId,String farmId) {
-		List<Land> list = landService.selectByStrainId(strainId,farmId);
+		List<LandVO> list = landService.selectByStrainId(strainId,farmId);
 		return R.data(list);
 	}
 
@@ -165,7 +165,9 @@
 			} else {
 				v1 = (double) Math.round(area * 100) / 100;
 			}
+			String myArea = land.getLandArea();
 			land.setLandArea(String.valueOf(v1));
+			land.setLandArea(myArea);
 		} else {
 			land.setLandArea("0");
 		}
@@ -181,6 +183,8 @@
 				e.printStackTrace();
 			}
 		}
+
+
 
 		land.setType(1);
 		return R.status(landService.saveLandInfo(land));
@@ -293,7 +297,15 @@
 				e.printStackTrace();
 			}
 		}
-		land.setLandArea(String.valueOf(v1));
+
+		Land myLand = landService.getById(land.getId());
+		if (myLand.getLandArea().equals(land.getLandArea())){
+			land.setLandArea(String.valueOf(v1));
+		}else {
+			land.setLandArea(land.getLandArea());
+		}
+
+
 		return R.status(landService.updateLandById(land));
 	}
 
@@ -332,6 +344,11 @@
 		return R.data(landService.selectLandList(userid));
 	}
 
+	/**
+	 * 获取采收地块列表
+	 */
+	@GetMapping("/selectRecoveryLandList")
+	public R selectRecoveryLandList(String farmId){return R.data(landService.selectRecoveryLandList(farmId));}
 
 	/**
 	 * 地块列表(不分页)
@@ -365,7 +382,7 @@
 			if (unit.equals("0")) {
 				num += area1;
 			}
-			if (unit.equals("1")) {
+			else if (unit.equals("1")) {
 				double v = area1 * 0.1;
 				num += v;
 			} else {
@@ -385,10 +402,10 @@
 			if (unit.equals("0")) {
 				snum += area1;
 			}
-			if (unit.equals("1")) {
+			else if (unit.equals("1")) {
 				double v = area1 * 0.1;
 				snum += v;
-			} else {
+			} else{
 				double v = area1 * 0.0015;
 				snum += v;
 			}
@@ -440,7 +457,7 @@
 			if (unit.equals("0")) {
 				num += area1;
 			}
-			if (unit.equals("1")) {
+			else if (unit.equals("1")) {
 				double v = area1 * 0.1;
 				num += v;
 			} else {
@@ -460,7 +477,7 @@
 			if (unit.equals("0")) {
 				snum += area1;
 			}
-			if (unit.equals("1")) {
+			else if (unit.equals("1")) {
 				double v = area1 * 0.1;
 				snum += v;
 			} else {
@@ -480,7 +497,7 @@
 			if (unit.equals("0")) {
 				wnum += area1;
 			}
-			if (unit.equals("1")) {
+			else if (unit.equals("1")) {
 				double v = area1 * 0.1;
 				wnum += v;
 			} else {

--
Gitblit v1.9.3