فهرست منبع

新增首页地图地块列表和基地列表接口

liuyaowen 10 ماه پیش
والد
کامیت
a3b20c1d9d

+ 47 - 5
src/main/java/com/yunfeiyun/agmp/fms/controller/FmsBlockController.java

@@ -14,23 +14,22 @@ import com.yunfeiyun.agmp.fms.domain.FmsLand;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsBlockBindUserReqVo;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsBlockReqVo;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsPlanReqVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsBlockResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsLandTreeResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanResVo;
+import com.yunfeiyun.agmp.fms.domain.resvo.*;
 import com.yunfeiyun.agmp.fms.mapper.FmsBlockMapper;
 import com.yunfeiyun.agmp.fms.service.IFmsBlockService;
 import com.yunfeiyun.agmp.fms.service.IFmsLandService;
 import com.yunfeiyun.agmp.fms.service.IFmsPlanService;
 import com.yunfeiyun.agmp.fms.util.DataAuthUtil;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
 
 /**
  * 地块Controller
@@ -201,4 +200,47 @@ public class FmsBlockController extends BaseController
     public AjaxResult bindUserList(@RequestParam("blockId") String blockId){
         return AjaxResult.success(fmsBlockService.selectFmsBlockBindUserList(blockId));
     }
+    @GetMapping("/console/map/info")
+    public AjaxResult consoleMapInfo(@Param("landId") String landId,@Param("blockId") String blockId){
+        List<String> blockIds = null;
+        if(SecurityUtils.isValidate()){
+            blockIds = dataAuthUtil.blockList();
+            if(CollectionUtils.isEmpty(blockIds)){
+                return AjaxResult.success();
+            }
+        }
+        FmsBlock blockQuery = new FmsBlock();
+        blockQuery.setBlockIds(blockIds);
+        blockQuery.setBlockId(blockId);
+        blockQuery.setLandId(landId);
+        List<FmsBlock> fmsBlocks = fmsBlockService.selectFmsBlockList(blockQuery);
+        Map<String,FmsBlock> blockMap = new HashMap<>();
+        blockIds = new ArrayList<>();
+        for(FmsBlock fmsBlock : fmsBlocks){
+            blockMap.put(fmsBlock.getBlockId(),fmsBlock);
+            blockIds.add(fmsBlock.getBlockId());
+        }
+        FmsPlanReqVo fmsPlanQuery = new FmsPlanReqVo();
+        fmsPlanQuery.setBlockIds(blockIds);
+        fmsPlanQuery.setTid(SecurityUtils.getTid());
+        fmsPlanQuery.setPlanStatusArray(Arrays.asList(CommonEnums.PLAN_STATUS_START.getCode(), CommonEnums.PLAN_STATUS_NOT_START.getCode()));
+        List<FmsPlanCropResVo> fmsPlanCropResVoList = fmsPlanService.selectFmsCropPlanResVoList(fmsPlanQuery);
+        Map<String, FmsBlockPlanResVo> fmsBlockPlanResVoMap = new HashMap<>();
+        for(FmsPlanCropResVo fmsPlanCropResVo : fmsPlanCropResVoList){
+            FmsBlockPlanResVo fmsBlockPlanResVo = fmsBlockPlanResVoMap.get(fmsPlanCropResVo.getBlockId());
+            if(null == fmsBlockPlanResVo){
+                FmsBlock fmsBlock = blockMap.get(fmsPlanCropResVo.getBlockId());
+                if(null == fmsBlock){
+                    continue;
+                }
+                fmsBlockPlanResVo = new FmsBlockPlanResVo();
+                BeanUtils.copyProperties(fmsBlock,fmsBlockPlanResVo);
+                fmsBlockPlanResVo.setFmsPlanCropResVoList(new ArrayList<>());
+                fmsBlockPlanResVoMap.put(fmsBlockPlanResVo.getBlockId(),fmsBlockPlanResVo);
+            }
+            fmsBlockPlanResVo.getFmsPlanCropResVoList().add(fmsPlanCropResVo);
+        }
+
+        return AjaxResult.success(fmsBlockPlanResVoMap.values());
+    }
 }

+ 0 - 2
src/main/java/com/yunfeiyun/agmp/fms/domain/FmsPlan.java

@@ -5,8 +5,6 @@ import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
 import com.yunfeiyun.agmp.common.enums.CommonEnums;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;

+ 7 - 25
src/main/java/com/yunfeiyun/agmp/fms/domain/reqvo/FmsPlanReqVo.java

@@ -1,8 +1,10 @@
 package com.yunfeiyun.agmp.fms.domain.reqvo;
 
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
+import com.yunfeiyun.agmp.fms.domain.FmsPlan;
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * 种植计划对象 FmsPlan
  * 
@@ -10,31 +12,11 @@ import lombok.Data;
  * @date 2023-05-18
  */
 @Data
-public class FmsPlanReqVo extends BaseEntity
+public class FmsPlanReqVo extends FmsPlan
 {
-    private static final long serialVersionUID = 1L;
-
-    /** 种植计划标识 */
-    private String planId;
-
-    /** 种植计划编号 */
-    private String planNo;
-
-    /** 基地标识 */
-    private String landId;
-
-    /** 地块标识 */
-    private String blockId;
-
-    /** 作物标识 */
-    private String cropId;
-
     /** 作物名称 */
     private String cropName;
-
-    /** 状态 */
-    private String planStatus;
-
+    
     /** 开始日期 */
     private String startDate;
 
@@ -46,6 +28,6 @@ public class FmsPlanReqVo extends BaseEntity
 
     /** 当前日期 */
     private String updateType;
-    /**租户标识*/
-    private String tid;
+
+    private List<String> planStatusArray;
 }

+ 11 - 0
src/main/java/com/yunfeiyun/agmp/fms/domain/resvo/FmsBlockPlanResVo.java

@@ -0,0 +1,11 @@
+package com.yunfeiyun.agmp.fms.domain.resvo;
+
+import com.yunfeiyun.agmp.fms.domain.FmsBlock;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FmsBlockPlanResVo extends FmsBlock {
+    private List<FmsPlanCropResVo> fmsPlanCropResVoList;
+}

+ 16 - 0
src/main/java/com/yunfeiyun/agmp/fms/domain/resvo/FmsPlanCropResVo.java

@@ -0,0 +1,16 @@
+package com.yunfeiyun.agmp.fms.domain.resvo;
+
+
+import com.yunfeiyun.agmp.fms.domain.FmsCrop;
+import lombok.Data;
+
+@Data
+public class FmsPlanCropResVo extends FmsCrop {
+    private String cropPreview;
+    private String planId;
+    private String landId;
+    private String blockId;
+    private String planPeriodname;
+    private String planStartdate;
+    private String planEnddate;
+}

+ 3 - 0
src/main/java/com/yunfeiyun/agmp/fms/mapper/FmsPlanMapper.java

@@ -4,6 +4,7 @@ import com.yunfeiyun.agmp.fms.domain.FmsPlan;
 import com.yunfeiyun.agmp.fms.domain.dto.FmsPlanByWarnSchedulerDto;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsPlanReqVo;
 import com.yunfeiyun.agmp.fms.domain.resvo.FmsCropPlanAreaResVo;
+import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanCropResVo;
 import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanListOfTaskStatusResVo;
 import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanResVo;
 import org.apache.ibatis.annotations.Param;
@@ -114,4 +115,6 @@ public interface FmsPlanMapper
     List<String> selectBlockManagerByPlanId(@Param("planId") String planId, @Param("tid") String tid);
 
     List<FmsCropPlanAreaResVo> selectCropPlanAreaTop(@Param("blockIds") List<String> blockIds, @Param("tid") String tid);
+
+    List<FmsPlanCropResVo> selectFmsPlanCropResVoList(FmsPlanReqVo fmsPlanQuery);
 }

+ 3 - 4
src/main/java/com/yunfeiyun/agmp/fms/service/IFmsPlanService.java

@@ -4,10 +4,7 @@ import com.yunfeiyun.agmp.fms.domain.FmsBlock;
 import com.yunfeiyun.agmp.fms.domain.FmsPlan;
 import com.yunfeiyun.agmp.fms.domain.dto.FmsPlanByWarnSchedulerDto;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsPlanReqVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsCropPlanAreaResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanDocumentResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanListOfTaskStatusResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanResVo;
+import com.yunfeiyun.agmp.fms.domain.resvo.*;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -114,4 +111,6 @@ public interface IFmsPlanService
     public List<FmsPlanByWarnSchedulerDto> selectPlanListByWarnScheduler(String planEnddate, String tid);
 
     List<FmsCropPlanAreaResVo> selectCropPlanAreaTop(List<String> blockIds, String tid);
+
+    List<FmsPlanCropResVo> selectFmsCropPlanResVoList(FmsPlanReqVo fmsPlanQuery);
 }

+ 6 - 4
src/main/java/com/yunfeiyun/agmp/fms/service/impl/FmsPlanServiceImpl.java

@@ -14,10 +14,7 @@ import com.yunfeiyun.agmp.fms.domain.FmsPlan;
 import com.yunfeiyun.agmp.fms.domain.dto.FmsPlanByWarnSchedulerDto;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsPlanReqVo;
 import com.yunfeiyun.agmp.fms.domain.reqvo.FmsTaskrcdListReqVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsCropPlanAreaResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanDocumentResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanListOfTaskStatusResVo;
-import com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanResVo;
+import com.yunfeiyun.agmp.fms.domain.resvo.*;
 import com.yunfeiyun.agmp.fms.domain.vo.FmsTaskrcdVo;
 import com.yunfeiyun.agmp.fms.mapper.FmsBlockMapper;
 import com.yunfeiyun.agmp.fms.mapper.FmsPlanMapper;
@@ -435,6 +432,11 @@ public class FmsPlanServiceImpl implements IFmsPlanService {
         return fmsPlanMapper.selectCropPlanAreaTop(blockIds,tid);
     }
 
+    @Override
+    public List<FmsPlanCropResVo> selectFmsCropPlanResVoList(FmsPlanReqVo fmsPlanQuery) {
+        return fmsPlanMapper.selectFmsPlanCropResVoList(fmsPlanQuery);
+    }
+
     private String dateStrAdd(String data,Integer days){
         Calendar calendar = Calendar.getInstance();
         try {

+ 46 - 2
src/main/resources/mapper/FmsPlanMapper.xml

@@ -374,7 +374,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="planPlanenddate != null">#{planPlanenddate},</if>
             <if test="planStartdate != null">#{planStartdate},</if>
             <if test="planEnddate != null">#{planEnddate},</if>
-            <if test="planStatus != null">#{planStatus},</if>
+            <if test="planStatus != null">#{planStatusArray},</if>
             <if test="planRemark != null">#{planRemark},</if>
             <if test="planCreator != null">#{planCreator},</if>
             <if test="planCreateddate != null">#{planCreateddate},</if>
@@ -397,7 +397,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="planPlanenddate != null">planPlanenddate = #{planPlanenddate},</if>
             <if test="planStartdate != null">planStartdate = #{planStartdate},</if>
             <if test="planEnddate != null">planEnddate = #{planEnddate},</if>
-            <if test="planStatus != null">planStatus = #{planStatus},</if>
+            <if test="planStatus != null">planStatus = #{planStatusArray},</if>
             <if test="planRemark != null">planRemark = #{planRemark},</if>
             <if test="planCreator != null">planCreator = #{planCreator},</if>
             <if test="planCreateddate != null">planCreateddate = #{planCreateddate},</if>
@@ -511,4 +511,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY sum( planArea ) DESC
 
     </select>
+
+    <select id="selectFmsPlanCropResVoList" resultType="com.yunfeiyun.agmp.fms.domain.resvo.FmsPlanCropResVo">
+        select
+        p.*,
+        c.cropId,
+        c.cropName,
+        c.cropType,
+        c.cropMaintype,
+        c.tid
+        from
+        FmsPlan p
+        LEFT JOIN
+        (select * from FmsCrop where tid = #{tid}) c on p.cropId = c.cropId
+        <where>
+            p.tid = #{tid}
+            <if test="planNo != null  and planNo != ''"> and p.planNo = #{planNo}</if>
+            <if test="landId != null  and landId != ''"> and p.landId = #{landId}</if>
+            <if test="blockId != null  and blockId != ''"> and p.blockId = #{blockId}</if>
+            <if test="cropId != null  and cropId != ''"> and p.cropId = #{cropId}</if>
+            <if test="cropName != null  and cropName != ''"> and c.cropName = #{cropName}</if>
+            <if test="planStatus != null  and planStatus != ''">
+                and p.planStatus = #{planStatus}
+            </if>
+            <if test="startDate != null  and startDate != ''">
+                and p.planPlanenddate >=  #{startDate}
+            </if>
+            <if test=" endDate != null  and endDate != ''">
+                and p.planPlanstartdate <![CDATA[ <= ]]>  #{endDate}
+            </if>
+            <if test="blockIds != null and blockIds.size() > 0">
+                AND p.blockId in
+                <foreach collection="blockIds" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+            <if test="planStatusArray != null and planStatusArray.size() > 0">
+                AND p.planStatus in
+                <foreach collection="planStatusArray" index="index" item="item" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+
+        </where>
+    </select>
 </mapper>