fix (farm): 养殖网箱
- 生产计划 - 地块管理
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo;
|
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.grid.ProductionPlanGridRespVO;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -94,18 +95,23 @@ public class ProductionPlanResp2VO {
|
|||||||
private Integer predictedArea;
|
private Integer predictedArea;
|
||||||
@Schema(description = "预计产量")
|
@Schema(description = "预计产量")
|
||||||
private Integer predictedYields;
|
private Integer predictedYields;
|
||||||
@Schema(description = "任务进度",example = "1/10")
|
@Schema(description = "任务进度", example = "1/10")
|
||||||
private String progressBar;
|
private String progressBar;
|
||||||
@Schema(description = "任务百分比",example = "10")
|
@Schema(description = "任务百分比", example = "10")
|
||||||
private String progressRatio;
|
private String progressRatio;
|
||||||
@Schema(description = "任务进度分子",example = "1")
|
@Schema(description = "任务进度分子", example = "1")
|
||||||
private Integer progressNumerator;
|
private Integer progressNumerator;
|
||||||
@Schema(description = "任务进度分母",example = "10")
|
@Schema(description = "任务进度分母", example = "10")
|
||||||
private Integer progressDenominator;
|
private Integer progressDenominator;
|
||||||
@Schema(description = "基地名称")
|
@Schema(description = "基地名称")
|
||||||
private String baseName;
|
private String baseName;
|
||||||
@Schema(description = "基地负责人")
|
@Schema(description = "基地负责人")
|
||||||
private String baseManager;
|
private String baseManager;
|
||||||
|
|
||||||
|
@Schema(description = "地块使用剩余网箱数")
|
||||||
|
private Integer predictedGridNumber;
|
||||||
|
@Schema(description = "养殖网箱信息")
|
||||||
|
private ProductionPlanGridRespVO planGridInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ public class ProductionPlanSaveReqVO {
|
|||||||
private Double remainingArea;
|
private Double remainingArea;
|
||||||
@Schema(description = "占地面积")
|
@Schema(description = "占地面积")
|
||||||
private Double usagePercentage;
|
private Double usagePercentage;
|
||||||
|
@Schema(description = "地块总网箱数")
|
||||||
|
private Integer plotGridNumber;
|
||||||
|
@Schema(description = "地块使用剩余网箱数")
|
||||||
|
private Integer predictedGridNumber;
|
||||||
@Schema(description = "备注")
|
@Schema(description = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.grid;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description: 计划网格响应实体
|
||||||
|
* @author: binda
|
||||||
|
* @date: 2025/11/4 19:54
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ProductionPlanGridRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "计划编号")
|
||||||
|
private String planNumber;
|
||||||
|
@Schema(description = "网格表格背景色")
|
||||||
|
private String color;
|
||||||
|
@Schema(description = "网格集合")
|
||||||
|
private List<Row> rows;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class Row {
|
||||||
|
@Schema(description = "网格序号")
|
||||||
|
private int sort;
|
||||||
|
|
||||||
|
@Schema(description = "网格编码")
|
||||||
|
private String gridCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -41,14 +41,12 @@ public class GridInfoController {
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建网格")
|
@Operation(summary = "创建网格")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:create')")
|
|
||||||
public CommonResult<String> createGridInfo(@Valid @RequestBody GridInfoSaveReqVO createReqVO) {
|
public CommonResult<String> createGridInfo(@Valid @RequestBody GridInfoSaveReqVO createReqVO) {
|
||||||
return success(gridInfoService.createGridInfo(createReqVO));
|
return success(gridInfoService.createGridInfo(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新网格")
|
@Operation(summary = "更新网格")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:update')")
|
|
||||||
public CommonResult<Boolean> updateGridInfo(@Valid @RequestBody GridInfoSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateGridInfo(@Valid @RequestBody GridInfoSaveReqVO updateReqVO) {
|
||||||
gridInfoService.updateGridInfo(updateReqVO);
|
gridInfoService.updateGridInfo(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -57,7 +55,6 @@ public class GridInfoController {
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除网格")
|
@Operation(summary = "删除网格")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:delete')")
|
|
||||||
public CommonResult<Boolean> deleteGridInfo(@RequestParam("id") String id) {
|
public CommonResult<Boolean> deleteGridInfo(@RequestParam("id") String id) {
|
||||||
gridInfoService.deleteGridInfo(id);
|
gridInfoService.deleteGridInfo(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -66,7 +63,6 @@ public class GridInfoController {
|
|||||||
@DeleteMapping("/delete-list")
|
@DeleteMapping("/delete-list")
|
||||||
@Parameter(name = "ids", description = "编号", required = true)
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
@Operation(summary = "批量删除网格")
|
@Operation(summary = "批量删除网格")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:delete')")
|
|
||||||
public CommonResult<Boolean> deleteGridInfoList(@RequestParam("ids") List<String> ids) {
|
public CommonResult<Boolean> deleteGridInfoList(@RequestParam("ids") List<String> ids) {
|
||||||
gridInfoService.deleteGridInfoListByIds(ids);
|
gridInfoService.deleteGridInfoListByIds(ids);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -75,7 +71,6 @@ public class GridInfoController {
|
|||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得网格")
|
@Operation(summary = "获得网格")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:query')")
|
|
||||||
public CommonResult<GridInfoRespVO> getGridInfo(@RequestParam("id") String id) {
|
public CommonResult<GridInfoRespVO> getGridInfo(@RequestParam("id") String id) {
|
||||||
GridInfoDO gridInfo = gridInfoService.getGridInfo(id);
|
GridInfoDO gridInfo = gridInfoService.getGridInfo(id);
|
||||||
return success(BeanUtils.toBean(gridInfo, GridInfoRespVO.class));
|
return success(BeanUtils.toBean(gridInfo, GridInfoRespVO.class));
|
||||||
@@ -83,7 +78,6 @@ public class GridInfoController {
|
|||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得网格分页")
|
@Operation(summary = "获得网格分页")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:query')")
|
|
||||||
public CommonResult<PageResult<GridInfoRespVO>> getGridInfoPage(@Valid GridInfoPageReqVO pageReqVO) {
|
public CommonResult<PageResult<GridInfoRespVO>> getGridInfoPage(@Valid GridInfoPageReqVO pageReqVO) {
|
||||||
PageResult<GridInfoDO> pageResult = gridInfoService.getGridInfoPage(pageReqVO);
|
PageResult<GridInfoDO> pageResult = gridInfoService.getGridInfoPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, GridInfoRespVO.class));
|
return success(BeanUtils.toBean(pageResult, GridInfoRespVO.class));
|
||||||
@@ -91,7 +85,6 @@ public class GridInfoController {
|
|||||||
|
|
||||||
@GetMapping("/getList")
|
@GetMapping("/getList")
|
||||||
@Operation(summary = "获得网格分页")
|
@Operation(summary = "获得网格分页")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:query')")
|
|
||||||
public CommonResult<List<GridInfoRespVO>> getList(@Valid GridInfoPageReqVO pageReqVO) {
|
public CommonResult<List<GridInfoRespVO>> getList(@Valid GridInfoPageReqVO pageReqVO) {
|
||||||
List<GridInfoDO> pageResult = gridInfoService.getList(pageReqVO);
|
List<GridInfoDO> pageResult = gridInfoService.getList(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, GridInfoRespVO.class));
|
return success(BeanUtils.toBean(pageResult, GridInfoRespVO.class));
|
||||||
@@ -99,7 +92,6 @@ public class GridInfoController {
|
|||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出网格 Excel")
|
@Operation(summary = "导出网格 Excel")
|
||||||
@PreAuthorize("@ss.hasPermission('farm:grid-info:export')")
|
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportGridInfoExcel(@Valid GridInfoPageReqVO pageReqVO,
|
public void exportGridInfoExcel(@Valid GridInfoPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo;
|
package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.grid.ProductionPlanGridRespVO;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
@@ -97,27 +98,11 @@ public class BaseInfoRespVO {
|
|||||||
@Schema(description = "网格数量")
|
@Schema(description = "网格数量")
|
||||||
private Integer gridNumber;
|
private Integer gridNumber;
|
||||||
@Schema(description = "网格信息")
|
@Schema(description = "网格信息")
|
||||||
private List<GridInfo> gridOverviewList;
|
private List<ProductionPlanGridRespVO> gridOverviewList;
|
||||||
@Schema(description = "户主流转信息")
|
@Schema(description = "户主流转信息")
|
||||||
private List<PlotLesseeDetailsRespVO> lesseeList;
|
private List<PlotLesseeDetailsRespVO> lesseeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@NoArgsConstructor
|
|
||||||
public static class GridInfo{
|
|
||||||
@Schema(description = "网格ID")
|
|
||||||
private String id;
|
|
||||||
@Schema(description = "网格类型")
|
|
||||||
private String type;
|
|
||||||
@Schema(description = "网格类型-名称")
|
|
||||||
private String typeName;
|
|
||||||
@Schema(description = "网格-行")
|
|
||||||
private Integer gridRow;
|
|
||||||
@Schema(description = "网格-列")
|
|
||||||
private Integer gridColumn;
|
|
||||||
@Schema(description = "网格-颜色")
|
|
||||||
private String color;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,12 @@ public class BaseNameRespVO {
|
|||||||
|
|
||||||
@Schema(description = "剩余面积")
|
@Schema(description = "剩余面积")
|
||||||
private Double remainingArea;
|
private Double remainingArea;
|
||||||
|
|
||||||
|
@Schema(description = "地块总网箱数")
|
||||||
|
private Integer plotGridNumber;
|
||||||
|
|
||||||
|
@Schema(description = "剩余网箱数")
|
||||||
|
private Integer remainingGridNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseNameRespVO(String id, String name) {
|
public BaseNameRespVO(String id, String name) {
|
||||||
|
|||||||
@@ -99,6 +99,14 @@ public class ProductionPlanDO extends BaseDO {
|
|||||||
* 占地面积
|
* 占地面积
|
||||||
*/
|
*/
|
||||||
private Double usagePercentage;
|
private Double usagePercentage;
|
||||||
|
/**
|
||||||
|
* 地块总网箱数
|
||||||
|
*/
|
||||||
|
private Integer plotGridNumber;
|
||||||
|
/**
|
||||||
|
* 地块使用剩余网箱数
|
||||||
|
*/
|
||||||
|
private Integer predictedGridNumber;
|
||||||
/**
|
/**
|
||||||
* 备注
|
* 备注
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -110,8 +110,21 @@ public class CommonConstants {
|
|||||||
public static Map<Integer,String> FARMING_RECORD_TASK_STATUS_MAP = new HashMap<>();
|
public static Map<Integer,String> FARMING_RECORD_TASK_STATUS_MAP = new HashMap<>();
|
||||||
public static Map<Integer,String> PLOT_TYPE_NAME_MAP = new HashMap<>();
|
public static Map<Integer,String> PLOT_TYPE_NAME_MAP = new HashMap<>();
|
||||||
|
|
||||||
|
public static Map<Integer, String> COLOR_MAP = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|
||||||
|
COLOR_MAP.put(1, "#00FFFF"); // 最浅 - 纯青色
|
||||||
|
COLOR_MAP.put(2, "#2AF0B9"); // 很浅 - 海沫绿
|
||||||
|
COLOR_MAP.put(3, "#1DE6B3"); // 浅 - 亮青绿色
|
||||||
|
COLOR_MAP.put(4, "#40E0D0"); // 浅中 - 绿松石色
|
||||||
|
COLOR_MAP.put(5, "#14CCCC"); // 中浅 - 您提供的颜色
|
||||||
|
COLOR_MAP.put(6, "#48D1CC"); // 中 - 中绿松石色
|
||||||
|
COLOR_MAP.put(7, "#00CED1"); // 中深 - 暗青色
|
||||||
|
COLOR_MAP.put(8, "#20B2AA"); // 深 - 浅海绿色
|
||||||
|
COLOR_MAP.put(9, "#0D98BA"); // 很深 - 蓝绿色
|
||||||
|
COLOR_MAP.put(10, "#008B8B"); // 最深 - 深青
|
||||||
|
|
||||||
PLOT_TYPE_NAME_MAP.put(1, "种植地块");
|
PLOT_TYPE_NAME_MAP.put(1, "种植地块");
|
||||||
PLOT_TYPE_NAME_MAP.put(2, "养殖地块");
|
PLOT_TYPE_NAME_MAP.put(2, "养殖地块");
|
||||||
|
|
||||||
|
|||||||
@@ -10,17 +10,17 @@ import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseInfoReqVO;
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseInfoRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewRespVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.grid.ProductionPlanGridRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.BaseStatisticsInfoRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.BaseStatisticsInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.wx.vo.BaseCountInfoRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.wx.vo.BaseCountInfoRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.gridinfo.GridInfoMapper;
|
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
@@ -31,12 +31,10 @@ import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
|||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
@@ -45,15 +43,13 @@ import org.springframework.validation.annotation.Validated;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
|
||||||
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.LEASE_STATUS_MAP;
|
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.*;
|
||||||
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.PLOT_TYPE_NAME_MAP;
|
|
||||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,8 +72,6 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
@Resource
|
@Resource
|
||||||
private PersonnelManagementService personnelManagementService;
|
private PersonnelManagementService personnelManagementService;
|
||||||
@Resource
|
@Resource
|
||||||
private GridInfoMapper gridInfoMapper;
|
|
||||||
@Resource
|
|
||||||
private ProductionPlanService productionPlanService;
|
private ProductionPlanService productionPlanService;
|
||||||
@Resource
|
@Resource
|
||||||
private PlotInfoService plotInfoService;
|
private PlotInfoService plotInfoService;
|
||||||
@@ -124,7 +118,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
validateBaseInfoExists(id);
|
validateBaseInfoExists(id);
|
||||||
// 存在地块,不可删除
|
// 存在地块,不可删除
|
||||||
boolean flag2 = plotInfoService.validatePlotExistByBaseId(id);
|
boolean flag2 = plotInfoService.validatePlotExistByBaseId(id);
|
||||||
if (!flag2) {
|
if (flag2) {
|
||||||
throw exception(PLOT_AREA_EXISTS_ERRORS);
|
throw exception(PLOT_AREA_EXISTS_ERRORS);
|
||||||
}
|
}
|
||||||
// 校验: 存在在种地块时 不允许删除
|
// 校验: 存在在种地块时 不允许删除
|
||||||
@@ -217,11 +211,22 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
BaseNameRespVO obj = new BaseNameRespVO(key, entry.getValue());
|
BaseNameRespVO obj = new BaseNameRespVO(key, entry.getValue());
|
||||||
|
|
||||||
List<BaseNameRespVO.PlotInfoVO> childList = new ArrayList<>();
|
List<BaseNameRespVO.PlotInfoVO> childList = new ArrayList<>();
|
||||||
for (PlotInfoDO aDo : plotInfoDOS) {
|
for (PlotInfoDO p : plotInfoDOS) {
|
||||||
if (aDo.getBaseId().equals(key)) {
|
if (p.getBaseId().equals(key)) {
|
||||||
BigDecimal plotArea = aDo.getPlotArea();
|
BigDecimal plotArea = p.getPlotArea();
|
||||||
double remainingArea = productionPlanService.getPredictedArea(aDo.getPlotId(),plotArea);
|
double remainingArea = productionPlanService.getPredictedArea(p.getId(),plotArea);
|
||||||
childList.add(new BaseNameRespVO.PlotInfoVO(aDo.getPlotId(), aDo.getPlotName(), plotArea, remainingArea));
|
|
||||||
|
int plotGridNumber = p.getGridNumber();
|
||||||
|
int remainingGridNumber = productionPlanService.getPredictedGridNumber(p.getId(), plotGridNumber);
|
||||||
|
|
||||||
|
childList.add(new BaseNameRespVO.PlotInfoVO(
|
||||||
|
p.getPlotId(),
|
||||||
|
p.getPlotName(),
|
||||||
|
plotArea,
|
||||||
|
remainingArea,
|
||||||
|
plotGridNumber,
|
||||||
|
remainingGridNumber
|
||||||
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
obj.setChildren(childList);
|
obj.setChildren(childList);
|
||||||
@@ -311,8 +316,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
private List<BaseInfoRespVO.PlotInfo> packagePlotInfo(Map<String, String> employeeMap, List<PlotInfoDO> plotList) {
|
private List<BaseInfoRespVO.PlotInfo> packagePlotInfo(Map<String, String> employeeMap, List<PlotInfoDO> plotList) {
|
||||||
List<BaseInfoRespVO.PlotInfo> targetList = new ArrayList<>();
|
List<BaseInfoRespVO.PlotInfo> targetList = new ArrayList<>();
|
||||||
for (PlotInfoDO aDo : plotList) {
|
for (PlotInfoDO aDo : plotList) {
|
||||||
// 网格
|
// 网箱
|
||||||
List<BaseInfoRespVO.GridInfo> gridInfos = this.packageGridInfo(aDo.getId());
|
List<ProductionPlanGridRespVO> gridInfos = this.packageGridInfo(aDo.getPlotId());
|
||||||
// 户主
|
// 户主
|
||||||
List<PlotLesseeDetailsRespVO> lesseeList = plotInfoService.getPlotLesseeList2(aDo.getId());
|
List<PlotLesseeDetailsRespVO> lesseeList = plotInfoService.getPlotLesseeList2(aDo.getId());
|
||||||
String plotManager = employeeMap.getOrDefault(aDo.getEmployeeId(), "系统");
|
String plotManager = employeeMap.getOrDefault(aDo.getEmployeeId(), "系统");
|
||||||
@@ -336,16 +341,34 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
|||||||
return targetList;
|
return targetList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<BaseInfoRespVO.GridInfo> packageGridInfo(String plotId) {
|
private List<ProductionPlanGridRespVO> packageGridInfo(String plotId) {
|
||||||
List<GridInfoDO> gridList = gridInfoMapper.selectList("plot_id", plotId);
|
List<ProductionPlanGridRespVO> res = new ArrayList<>();
|
||||||
if (ObjectUtils.isEmpty(gridList)) {
|
|
||||||
return Collections.EMPTY_LIST;
|
List<ProductionPlanDO> productionPlans = productionPlanService.getProductionPlans(plotId);
|
||||||
|
for (int j = 0; j < productionPlans.size(); j++) {
|
||||||
|
ProductionPlanDO p = productionPlans.get(j);
|
||||||
|
|
||||||
|
int predictedGridNumber = p.getPredictedGridNumber();
|
||||||
|
if (predictedGridNumber == 0) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
List<BaseInfoRespVO.GridInfo> gridInfos = BeanUtils.toBean(gridList, BaseInfoRespVO.GridInfo.class);
|
|
||||||
for (BaseInfoRespVO.GridInfo info : gridInfos) {
|
List<ProductionPlanGridRespVO.Row> rows = new ArrayList<>();
|
||||||
info.setTypeName(CommonConstants.GRID_TYPE.get(info.getType()));
|
for (int i = 1; i < predictedGridNumber + 1; i++) {
|
||||||
|
ProductionPlanGridRespVO.Row row = new ProductionPlanGridRespVO.Row();
|
||||||
|
row.setSort(i);
|
||||||
|
row.setGridCode(plotId + "-" + String.format("%04d", i));
|
||||||
|
rows.add(row);
|
||||||
}
|
}
|
||||||
return gridInfos;
|
|
||||||
|
ProductionPlanGridRespVO g = new ProductionPlanGridRespVO();
|
||||||
|
g.setPlanNumber(p.getPlanNumber()+" ("+CommonConstants.PLAN_MAP.get(p.getPlanStatus())+")");
|
||||||
|
g.setColor(COLOR_MAP.getOrDefault(j+1,"#00FFFF"));
|
||||||
|
g.setRows(rows);
|
||||||
|
res.add(g);
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmTypeChartRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.FarmTypeChartRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.InputUsageChartRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.chart.PlantingAreaChartRespVO;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.grid.ProductionPlanGridRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCycleRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelcycle.vo.ModelCycleRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelfarmingoperation.vo.ModelFarmingOperationRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.modelfarmingoperation.vo.ModelFarmingOperationRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.models.vo.ModelManagementRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.modelmanagement.models.vo.ModelManagementRespVO;
|
||||||
@@ -31,6 +32,7 @@ import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
|||||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecord.FarmingRecordMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecord.FarmingRecordMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
@@ -53,10 +55,7 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.Period;
|
import java.time.Period;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
@@ -78,6 +77,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
private final SpeciesLibraryMapper speciesLibraryMapper;
|
private final SpeciesLibraryMapper speciesLibraryMapper;
|
||||||
private final PersonnelManagementMapper personnelManagementMapper;
|
private final PersonnelManagementMapper personnelManagementMapper;
|
||||||
private final BaseInfoMapper baseInfoMapper;
|
private final BaseInfoMapper baseInfoMapper;
|
||||||
|
private final PlotInfoMapper plotInfoMapper;
|
||||||
private final ProductionPlanMapper productionPlanMapper;
|
private final ProductionPlanMapper productionPlanMapper;
|
||||||
private final FarmingRecordMapper farmingRecordMapper;
|
private final FarmingRecordMapper farmingRecordMapper;
|
||||||
private final InputUsageRecordsMapper inputUsageRecordsMapper;
|
private final InputUsageRecordsMapper inputUsageRecordsMapper;
|
||||||
@@ -91,13 +91,14 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
private final FarmingTypeMaintenanceService farmingTypeMaintenanceService;
|
private final FarmingTypeMaintenanceService farmingTypeMaintenanceService;
|
||||||
private final DictDataService dictDataService;
|
private final DictDataService dictDataService;
|
||||||
|
|
||||||
public CropFarmingCenterServiceImpl(SpeciesLibraryMapper speciesLibraryMapper, PersonnelManagementMapper personnelManagementMapper, BaseInfoMapper baseInfoMapper, ProductionPlanMapper productionPlanMapper,
|
public CropFarmingCenterServiceImpl(SpeciesLibraryMapper speciesLibraryMapper, PersonnelManagementMapper personnelManagementMapper, BaseInfoMapper baseInfoMapper, PlotInfoMapper plotInfoMapper, ProductionPlanMapper productionPlanMapper,
|
||||||
FarmingRecordMapper farmingRecordMapper, InputUsageRecordsMapper inputUsageRecordsMapper, ModelManagementService modelManagementService,
|
FarmingRecordMapper farmingRecordMapper, InputUsageRecordsMapper inputUsageRecordsMapper, ModelManagementService modelManagementService,
|
||||||
FarmingRecordService farmingRecordService,
|
FarmingRecordService farmingRecordService,
|
||||||
FarmingRecordInputService farmingRecordInputService, PlotInfoService plotInfoService, SpeciesLibraryService speciesLibraryService, FarmingTypeMaintenanceService farmingTypeMaintenanceService, DictDataService dictDataService) {
|
FarmingRecordInputService farmingRecordInputService, PlotInfoService plotInfoService, SpeciesLibraryService speciesLibraryService, FarmingTypeMaintenanceService farmingTypeMaintenanceService, DictDataService dictDataService) {
|
||||||
this.speciesLibraryMapper = speciesLibraryMapper;
|
this.speciesLibraryMapper = speciesLibraryMapper;
|
||||||
this.personnelManagementMapper = personnelManagementMapper;
|
this.personnelManagementMapper = personnelManagementMapper;
|
||||||
this.baseInfoMapper = baseInfoMapper;
|
this.baseInfoMapper = baseInfoMapper;
|
||||||
|
this.plotInfoMapper = plotInfoMapper;
|
||||||
this.productionPlanMapper = productionPlanMapper;
|
this.productionPlanMapper = productionPlanMapper;
|
||||||
this.farmingRecordMapper = farmingRecordMapper;
|
this.farmingRecordMapper = farmingRecordMapper;
|
||||||
this.inputUsageRecordsMapper = inputUsageRecordsMapper;
|
this.inputUsageRecordsMapper = inputUsageRecordsMapper;
|
||||||
@@ -108,6 +109,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
this.speciesLibraryService = speciesLibraryService;
|
this.speciesLibraryService = speciesLibraryService;
|
||||||
this.farmingTypeMaintenanceService = farmingTypeMaintenanceService;
|
this.farmingTypeMaintenanceService = farmingTypeMaintenanceService;
|
||||||
this.dictDataService = dictDataService;
|
this.dictDataService = dictDataService;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -143,6 +145,8 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
obj.setTotalArea(e.getTotalArea());
|
obj.setTotalArea(e.getTotalArea());
|
||||||
obj.setPredictedArea(e.getPredictedArea());
|
obj.setPredictedArea(e.getPredictedArea());
|
||||||
obj.setUsagePercentage(e.getUsagePercentage());
|
obj.setUsagePercentage(e.getUsagePercentage());
|
||||||
|
obj.setPlotGridNumber(e.getPlotGridNumber());
|
||||||
|
obj.setPredictedGridNumber(e.getPredictedGridNumber());
|
||||||
obj.setRemark(e.getRemark());
|
obj.setRemark(e.getRemark());
|
||||||
obj.setBaseId(e.getBaseId());
|
obj.setBaseId(e.getBaseId());
|
||||||
obj.setBaseName(baseNameMap.getOrDefault(e.getBaseId(), ""));
|
obj.setBaseName(baseNameMap.getOrDefault(e.getBaseId(), ""));
|
||||||
@@ -430,11 +434,38 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
modelInfo.setProgressNumerator(progressNumerator);
|
modelInfo.setProgressNumerator(progressNumerator);
|
||||||
modelInfo.setProgressDenominator(progressDenominator);
|
modelInfo.setProgressDenominator(progressDenominator);
|
||||||
modelInfo.setBaseName(planObj.getBaseName());
|
modelInfo.setBaseName(planObj.getBaseName());
|
||||||
modelInfo.setBaseManager(employeeNameMap.get(employeeId)); // 分割,
|
modelInfo.setBaseManager(employeeNameMap.get(employeeId));
|
||||||
|
// 构建网箱
|
||||||
|
this.buildPlanGrid(planObj,modelInfo);
|
||||||
return modelInfo;
|
return modelInfo;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buildPlanGrid(ProductionPlanDO p, ProductionPlanResp2VO.ModelInfo m) {
|
||||||
|
Integer predictedGridNumber = p.getPredictedGridNumber();
|
||||||
|
String plotCode = p.getPlotId();
|
||||||
|
|
||||||
|
if (predictedGridNumber == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ProductionPlanGridRespVO.Row> rows = new ArrayList<>();
|
||||||
|
for (int i = 1; i < predictedGridNumber + 1; i++) {
|
||||||
|
ProductionPlanGridRespVO.Row row = new ProductionPlanGridRespVO.Row();
|
||||||
|
row.setSort(i);
|
||||||
|
row.setGridCode(plotCode + "-" + String.format("%04d", i));
|
||||||
|
rows.add(row);
|
||||||
|
}
|
||||||
|
|
||||||
|
ProductionPlanGridRespVO planGridInfo = new ProductionPlanGridRespVO();
|
||||||
|
planGridInfo.setPlanNumber(p.getPlanNumber());
|
||||||
|
planGridInfo.setColor(COLOR_MAP.get(1));
|
||||||
|
planGridInfo.setRows(rows);
|
||||||
|
|
||||||
|
m.setPredictedGridNumber(predictedGridNumber);
|
||||||
|
m.setPlanGridInfo(planGridInfo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 农事记录总数 = 模型中的农事记录 + 自定义农事记录
|
* 农事记录总数 = 模型中的农事记录 + 自定义农事记录
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotLesseeMapper;
|
|||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
||||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.google.common.primitives.ImmutableIntArray;
|
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@@ -265,40 +263,33 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
PlotLesseeDO::getLeaseStatus, YES_CODE);
|
PlotLesseeDO::getLeaseStatus, YES_CODE);
|
||||||
|
|
||||||
if (ObjectUtils.isEmpty(sourcePObj)) {
|
if (ObjectUtils.isEmpty(sourcePObj)) {
|
||||||
// 租户表不存在, 说明从未添加过户主信息, 直接录入即可
|
// 首次添加租户信息, 说明从未添加过户主信息, 直接录入即可
|
||||||
// 1. 更新地块
|
|
||||||
p.setPlotLeaseStatus(YES_CODE);
|
|
||||||
plotInfoMapper.updateById(p);
|
|
||||||
// 2. 录入户主表
|
|
||||||
this.pInsert(p,pl,baseNameMap);
|
this.pInsert(p,pl,baseNameMap);
|
||||||
|
|
||||||
successCount++;
|
successCount++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (compareObj(sourcePObj,pl)) {
|
|
||||||
unmodifiedCount++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isEmpty(pl)) {
|
if (this.isEmpty(pl)) {
|
||||||
p.setPlotLeaseStatus(NO_CODE);
|
p.setPlotLeaseStatus(NO_CODE);
|
||||||
plotInfoMapper.updateById(p);
|
plotInfoMapper.updateById(p);
|
||||||
|
|
||||||
sourcePObj.setLeaseStatus(NO_CODE);
|
sourcePObj.setLeaseStatus(NO_CODE);
|
||||||
plotLesseeMapper.updateById(sourcePObj);
|
plotLesseeMapper.updateById(sourcePObj);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.compareObj(sourcePObj,pl)) {
|
||||||
// 1. 更新原地块户主信息
|
// 1. 更新原地块户主信息
|
||||||
sourcePObj.setLeaseStatus(NO_CODE);
|
sourcePObj.setLeaseStatus(NO_CODE);
|
||||||
plotLesseeMapper.updateById(sourcePObj);
|
plotLesseeMapper.updateById(sourcePObj);
|
||||||
|
|
||||||
// 2. 录入新地块户主信息
|
|
||||||
this.pInsert(p,pl,baseNameMap);
|
this.pInsert(p,pl,baseNameMap);
|
||||||
successCount++;
|
successCount++;
|
||||||
|
}else{
|
||||||
|
unmodifiedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
res.setSuccessCount(successCount);
|
res.setSuccessCount(successCount);
|
||||||
res.setFailuresCount(failuresCount);
|
res.setFailuresCount(failuresCount);
|
||||||
@@ -307,66 +298,6 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public PlotLesseeImportRespVO setPlotLesseeInfo(List<PlotLesseeForImportExcelRespVO> req) {
|
|
||||||
//
|
|
||||||
// Map<String, String> baseNameMap = baseInfoMapper.selectList().stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
|
||||||
// Map<String, String> plotNameMap = plotInfoMapper.selectList().stream().collect(Collectors.toMap(PlotInfoDO::getPlotName, PlotInfoDO::getId, (v1, v2) -> v1));
|
|
||||||
//
|
|
||||||
// PlotLesseeImportRespVO res = new PlotLesseeImportRespVO();
|
|
||||||
// res.setTotal(req.size());
|
|
||||||
//
|
|
||||||
// int successCount = 0;
|
|
||||||
// int failuresCount = 0;
|
|
||||||
// int unmodifiedCount = 0;
|
|
||||||
// List<PlotLesseeImportRespVO.Row> row = new ArrayList<>();
|
|
||||||
// for (PlotLesseeForImportExcelRespVO pl : req) {
|
|
||||||
//
|
|
||||||
// PlotInfoDO p = plotInfoMapper.selectOne(PlotInfoDO::getPlotName, pl.getPlotName());
|
|
||||||
// if (ObjectUtils.isEmpty(p)) {
|
|
||||||
// failuresCount++;
|
|
||||||
// row.add(new PlotLesseeImportRespVO.Row(pl.getPlotCode(), pl.getPlotName()));
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// PlotLesseeDO sourcePObj = plotLesseeMapper.selectOne(
|
|
||||||
// PlotLesseeDO::getPlotName, pl.getPlotName(),
|
|
||||||
// PlotLesseeDO::getLeaseStatus, YES_CODE);
|
|
||||||
//
|
|
||||||
// if (ObjectUtils.isEmpty(sourcePObj)) {
|
|
||||||
// // 租户表不存在, 说明从未添加过户主信息, 直接录入即可
|
|
||||||
// // 1. 更新地块
|
|
||||||
// p.setPlotLeaseStatus(YES_CODE);
|
|
||||||
// plotInfoMapper.updateById(p);
|
|
||||||
// // 2. 录入户主表
|
|
||||||
// this.pInsert(p,pl,baseNameMap);
|
|
||||||
//
|
|
||||||
// successCount++;
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (compareObj(sourcePObj,pl)) {
|
|
||||||
// unmodifiedCount++;
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // 1. 更新原地块户主信息
|
|
||||||
// sourcePObj.setLeaseStatus(NO_CODE);
|
|
||||||
// plotLesseeMapper.updateById(sourcePObj);
|
|
||||||
//
|
|
||||||
// // 2. 录入新地块户主信息
|
|
||||||
// this.pInsert(p,pl,baseNameMap);
|
|
||||||
// successCount++;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// res.setSuccessCount(successCount);
|
|
||||||
// res.setFailuresCount(failuresCount);
|
|
||||||
// res.setUnmodifiedCount(unmodifiedCount);
|
|
||||||
// res.setFailuresList(row);
|
|
||||||
// return res;
|
|
||||||
// }
|
|
||||||
|
|
||||||
private void pInsert(PlotInfoDO p,PlotLesseeForImportExcelRespVO pl,Map<String, String> baseNameMap) {
|
private void pInsert(PlotInfoDO p,PlotLesseeForImportExcelRespVO pl,Map<String, String> baseNameMap) {
|
||||||
PlotLesseeDO target = new PlotLesseeDO();
|
PlotLesseeDO target = new PlotLesseeDO();
|
||||||
target.setLeaseName(pl.getLeaseName());
|
target.setLeaseName(pl.getLeaseName());
|
||||||
@@ -384,21 +315,24 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
target.setPlotId(p.getId());
|
target.setPlotId(p.getId());
|
||||||
target.setPlotName(p.getPlotName());
|
target.setPlotName(p.getPlotName());
|
||||||
plotLesseeMapper.insert(target);
|
plotLesseeMapper.insert(target);
|
||||||
|
|
||||||
|
p.setPlotLeaseStatus(YES_CODE);
|
||||||
|
plotInfoMapper.updateById(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对比结果一致返回: true
|
* 对比结果不一致返回: true (至少有一个字段不同)
|
||||||
* 对比结果不一致返回: false
|
* 对比结果一致返回: false (所有字段都相同)
|
||||||
* @param s
|
* @param s
|
||||||
* @param t
|
* @param t
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean compareObj(PlotLesseeDO s , PlotLesseeForImportExcelRespVO t) {
|
private boolean compareObj(PlotLesseeDO s, PlotLesseeForImportExcelRespVO t) {
|
||||||
return Objects.equals(s.getLeaseName(), t.getLeaseName()) &&
|
return ObjectUtils.notEqual(s.getLeaseName(), t.getLeaseName()) ||
|
||||||
Objects.equals(s.getLeaseIdCard(), t.getLeaseIdCard()) &&
|
ObjectUtils.notEqual(s.getLeaseIdCard(), t.getLeaseIdCard()) ||
|
||||||
Objects.equals(s.getLeasePhone(), t.getLeasePhone()) &&
|
ObjectUtils.notEqual(s.getLeasePhone(), t.getLeasePhone()) ||
|
||||||
Objects.equals(s.getLeaseStartDate(), t.getLeaseStartDate()) &&
|
!s.getLeaseStartDate().isEqual(t.getLeaseStartDate()) ||
|
||||||
Objects.equals(s.getLeaseEndDate(), t.getLeaseEndDate());
|
!s.getLeaseEndDate().isEqual(t.getLeaseEndDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEmpty(PlotLesseeForImportExcelRespVO t) {
|
private boolean isEmpty(PlotLesseeForImportExcelRespVO t) {
|
||||||
@@ -455,8 +389,11 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean validatePlotExistByBaseId(String id) {
|
public boolean validatePlotExistByBaseId(String id) {
|
||||||
Long count = plotInfoMapper.selectCount("base_id", id);
|
LambdaQueryWrapperX<PlotInfoDO> x = new LambdaQueryWrapperX<>();
|
||||||
return count <= 0;
|
x.eq(PlotInfoDO::getBaseId, id);
|
||||||
|
x.eq(PlotInfoDO::getDeleted, NO_CODE);
|
||||||
|
Long count = plotInfoMapper.selectCount(x);
|
||||||
|
return count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean validateCurrentPlotArea(String baseId, String plotId, BigDecimal currentPlotArea) {
|
private boolean validateCurrentPlotArea(String baseId, String plotId, BigDecimal currentPlotArea) {
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ public interface ProductionPlanService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
double getPredictedArea(String plotId,BigDecimal plotArea);
|
double getPredictedArea(String plotId,BigDecimal plotArea);
|
||||||
|
Integer getPredictedGridNumber(String plotId,Integer plotGridNumber);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取在种地块面积
|
* 获取在种地块面积
|
||||||
|
|||||||
@@ -309,7 +309,6 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getPredictedArea(String plotId,BigDecimal plotArea) {
|
public double getPredictedArea(String plotId,BigDecimal plotArea) {
|
||||||
|
|
||||||
List<ProductionPlanDO> planList = productionPlanMapper.selectList("plot_id", plotId);
|
List<ProductionPlanDO> planList = productionPlanMapper.selectList("plot_id", plotId);
|
||||||
double sum = planList.stream()
|
double sum = planList.stream()
|
||||||
.filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2))
|
.filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2))
|
||||||
@@ -318,6 +317,17 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||||||
return plotArea.subtract(BigDecimal.valueOf(sum)).doubleValue();
|
return plotArea.subtract(BigDecimal.valueOf(sum)).doubleValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getPredictedGridNumber(String plotId, Integer plotGridNumber) {
|
||||||
|
List<ProductionPlanDO> planList = productionPlanMapper.selectList("plot_id", plotId);
|
||||||
|
Integer sum = planList.stream()
|
||||||
|
.filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2))
|
||||||
|
.mapToInt(ProductionPlanDO::getPredictedGridNumber)
|
||||||
|
.sum();
|
||||||
|
|
||||||
|
return plotGridNumber - sum;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBeingPlotArea(String plotId, BigDecimal plotArea) {
|
public String getBeingPlotArea(String plotId, BigDecimal plotArea) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user