feat (farm): 计划管理
- 分页查询相应格式修改 - 添加计划进度字段
This commit is contained in:
@@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanRespVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanUpdateReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordPageReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordRespVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.farmingrecord.vo.FarmingRecordRespVO;
|
||||||
@@ -50,7 +50,7 @@ public class CropFarmingCenterController {
|
|||||||
// 生产计划
|
// 生产计划
|
||||||
@GetMapping("/production-plan/page")
|
@GetMapping("/production-plan/page")
|
||||||
@Operation(summary = "生产计划-分页")
|
@Operation(summary = "生产计划-分页")
|
||||||
public CommonResult<PageResult<ProductionPlanPageRespVO>> getProductionPlanPage(@Valid cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageReqVO pageReqVO) {
|
public CommonResult<PageResult<ProductionPlanRespVO>> getProductionPlanPage(@Valid cn.iocoder.yudao.module.farm.controller.admin.cropFarmingCenter.vo.ProductionPlanPageReqVO pageReqVO) {
|
||||||
return success(cropFarmingCenterService.getProductionPlanPage(pageReqVO));
|
return success(cropFarmingCenterService.getProductionPlanPage(pageReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public class ProductionPlanRespVO {
|
|||||||
private Integer planStatus;
|
private Integer planStatus;
|
||||||
@Schema(description = "计划执行状态-名称")
|
@Schema(description = "计划执行状态-名称")
|
||||||
private String planStatusName;
|
private String planStatusName;
|
||||||
|
@Schema(description = "计划执行进度")
|
||||||
|
private Double planProgress;
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "租户ID")
|
@Schema(description = "租户ID")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public interface CropFarmingCenterService {
|
|||||||
|
|
||||||
void updateProductionPlan(ProductionPlanUpdateReqVO updateReqVO);
|
void updateProductionPlan(ProductionPlanUpdateReqVO updateReqVO);
|
||||||
|
|
||||||
PageResult<ProductionPlanPageRespVO> getProductionPlanPage(ProductionPlanPageReqVO reqVO);
|
PageResult<ProductionPlanRespVO> getProductionPlanPage(ProductionPlanPageReqVO reqVO);
|
||||||
|
|
||||||
int getCropCount(Long tenantId);
|
int getCropCount(Long tenantId);
|
||||||
|
|
||||||
|
|||||||
@@ -220,11 +220,13 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ProductionPlanPageRespVO> getProductionPlanPage(ProductionPlanPageReqVO reqVO) {
|
public PageResult<ProductionPlanRespVO> getProductionPlanPage(ProductionPlanPageReqVO reqVO) {
|
||||||
|
|
||||||
PageResult<ProductionPlanDO> productionPlanDOPageResult = productionPlanMapper.selectPage2(reqVO);
|
PageResult<ProductionPlanDO> productionPlanDOPageResult = productionPlanMapper.selectPage2(reqVO);
|
||||||
PageResult<ProductionPlanRespVO> resultData = BeanUtils.toBean(productionPlanDOPageResult, ProductionPlanRespVO.class);
|
PageResult<ProductionPlanRespVO> resultData = BeanUtils.toBean(productionPlanDOPageResult, ProductionPlanRespVO.class);
|
||||||
resultData.getList().forEach(e -> {
|
resultData.getList().forEach(e -> {
|
||||||
|
// todo 计划进度比例
|
||||||
|
e.setPlanProgress(0.00);
|
||||||
// 计划状态-名称
|
// 计划状态-名称
|
||||||
e.setPlanStatusName(PLAN_MAP.get(e.getPlanStatus()));
|
e.setPlanStatusName(PLAN_MAP.get(e.getPlanStatus()));
|
||||||
// 模型
|
// 模型
|
||||||
@@ -239,20 +241,20 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 响应结构包装 (包装成符合前端需要的格式)
|
// 响应结构包装 (包装成符合前端需要的格式)
|
||||||
List<ProductionPlanPageRespVO> collect = resultData.getList().stream()
|
// List<ProductionPlanPageRespVO> collect = resultData.getList().stream()
|
||||||
.collect(Collectors.groupingBy(plan -> new AbstractMap.SimpleEntry<>(plan.getBaseId(), plan.getBaseName()), Collectors.toList()))
|
// .collect(Collectors.groupingBy(plan -> new AbstractMap.SimpleEntry<>(plan.getBaseId(), plan.getBaseName()), Collectors.toList()))
|
||||||
.entrySet().stream()
|
// .entrySet().stream()
|
||||||
.map(entry -> {
|
// .map(entry -> {
|
||||||
ProductionPlanPageRespVO groupedVO = new ProductionPlanPageRespVO();
|
// ProductionPlanPageRespVO groupedVO = new ProductionPlanPageRespVO();
|
||||||
groupedVO.setBaseId(entry.getKey().getKey());
|
// groupedVO.setBaseId(entry.getKey().getKey());
|
||||||
groupedVO.setBaseName(entry.getKey().getValue());
|
// groupedVO.setBaseName(entry.getKey().getValue());
|
||||||
groupedVO.setPlans(entry.getValue());
|
// groupedVO.setPlans(entry.getValue());
|
||||||
return groupedVO;
|
// return groupedVO;
|
||||||
})
|
// })
|
||||||
.collect(Collectors.toList());
|
// .collect(Collectors.toList());
|
||||||
|
//
|
||||||
long size = collect.size();
|
// long size = collect.size();
|
||||||
return new PageResult<>(collect, size);
|
return resultData;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user