|
|
@@ -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());
|
|
|
+ }
|
|
|
}
|