模块编辑优化
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
@@ -81,7 +82,7 @@ public class TraceabilityCodeController {
|
|||||||
PageResult<TraceabilityCodeRespVO> respPageResult = new PageResult<>();
|
PageResult<TraceabilityCodeRespVO> respPageResult = new PageResult<>();
|
||||||
respPageResult.setList(pageResult.getList().stream()
|
respPageResult.setList(pageResult.getList().stream()
|
||||||
.map(TraceabilityDataConverter::convertToRespVO)
|
.map(TraceabilityDataConverter::convertToRespVO)
|
||||||
.toList());
|
.collect(Collectors.toList()));
|
||||||
respPageResult.setTotal(pageResult.getTotal());
|
respPageResult.setTotal(pageResult.getTotal());
|
||||||
return success(respPageResult);
|
return success(respPageResult);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class FarmingRecordJob implements JobHandler {
|
|||||||
// 获取[进行中]状态的计划
|
// 获取[进行中]状态的计划
|
||||||
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans();
|
List<ProductionPlanDO> plans = productionPlanService.getProductionPlans();
|
||||||
Map<String, ProductionPlanDO> planMap = plans.stream().filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2)).collect(Collectors.toMap(ProductionPlanDO::getId, e -> e, (v1, v2) -> v1));
|
Map<String, ProductionPlanDO> planMap = plans.stream().filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2)).collect(Collectors.toMap(ProductionPlanDO::getId, e -> e, (v1, v2) -> v1));
|
||||||
List<String> taskIdList = plans.stream().filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2)).map(ProductionPlanDO::getId).toList();
|
List<String> taskIdList = plans.stream().filter(e -> Objects.equals(e.getPlanStatus(), PLAN_STATUS_2)).map(ProductionPlanDO::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
// 获取引用模型集合 key: modelId;
|
// 获取引用模型集合 key: modelId;
|
||||||
Map<String, List<ModelFarmingOperationDO>> modelIdMap = modelManagementService.getRecordList(taskIdList);
|
Map<String, List<ModelFarmingOperationDO>> modelIdMap = modelManagementService.getRecordList(taskIdList);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ import cn.iocoder.yudao.module.farm.dal.mysql.modelweatherdisaster.ModelWeatherD
|
|||||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.SystemUserMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.SystemUserMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
import cn.iocoder.yudao.module.farm.framework.util.ModelManagementConvertUtil;
|
import cn.iocoder.yudao.module.farm.framework.util.ModelManagementConvertUtil;
|
||||||
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
|
||||||
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputLibraryService;
|
import cn.iocoder.yudao.module.farm.service.inputlibrary.InputLibraryService;
|
||||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -215,7 +214,6 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
// 基础字段:仅当请求中非空时才覆盖
|
// 基础字段:仅当请求中非空时才覆盖
|
||||||
if (updateReqVO.getModelName() != null) existing.setModelName(updateReqVO.getModelName());
|
if (updateReqVO.getModelName() != null) existing.setModelName(updateReqVO.getModelName());
|
||||||
if (updateReqVO.getSpeciesId() != null) existing.setSpeciesId(updateReqVO.getSpeciesId());
|
if (updateReqVO.getSpeciesId() != null) existing.setSpeciesId(updateReqVO.getSpeciesId());
|
||||||
if (updateReqVO.getSpeciesName() != null) existing.setSpeciesName(updateReqVO.getSpeciesName());
|
|
||||||
if (updateReqVO.getCycle() != null) existing.setCycle(updateReqVO.getCycle());
|
if (updateReqVO.getCycle() != null) existing.setCycle(updateReqVO.getCycle());
|
||||||
if (updateReqVO.getHarvest() != null) existing.setHarvest(updateReqVO.getHarvest());
|
if (updateReqVO.getHarvest() != null) existing.setHarvest(updateReqVO.getHarvest());
|
||||||
if (updateReqVO.getDescription() != null) existing.setDescription(updateReqVO.getDescription());
|
if (updateReqVO.getDescription() != null) existing.setDescription(updateReqVO.getDescription());
|
||||||
@@ -464,7 +462,7 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
|||||||
public Map<String, List<ModelFarmingOperationDO>> getRecordList(List<String> taskIdList) {
|
public Map<String, List<ModelFarmingOperationDO>> getRecordList(List<String> taskIdList) {
|
||||||
|
|
||||||
List<ModelManagementDO> modelList = modelManagementMapper.selectList("task_id", taskIdList);
|
List<ModelManagementDO> modelList = modelManagementMapper.selectList("task_id", taskIdList);
|
||||||
List<String> modelIdList = modelList.stream().filter(Objects::nonNull).filter(e -> Objects.equals(e.getType(), MODEL_TYPE_2)).map(ModelManagementDO::getId).toList();
|
List<String> modelIdList = modelList.stream().filter(Objects::nonNull).filter(e -> Objects.equals(e.getType(), MODEL_TYPE_2)).map(ModelManagementDO::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<ModelCycleDO> modelCycleList = modelCycleMapper.selectList("model_id", modelIdList);
|
List<ModelCycleDO> modelCycleList = modelCycleMapper.selectList("model_id", modelIdList);
|
||||||
// key modelId , value List<ModelCycleDO>
|
// key modelId , value List<ModelCycleDO>
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
|||||||
|
|
||||||
PageResult<ProductionPlanDO> page = productionPlanMapper.selectPage3(req);
|
PageResult<ProductionPlanDO> page = productionPlanMapper.selectPage3(req);
|
||||||
Long total = page.getTotal();
|
Long total = page.getTotal();
|
||||||
List<FarmProductionPlanRespVO> respList = page.getList().stream().map(e -> new FarmProductionPlanRespVO(e.getId(), e.getPlanNumber())).toList();
|
List<FarmProductionPlanRespVO> respList = page.getList().stream().map(e -> new FarmProductionPlanRespVO(e.getId(), e.getPlanNumber())).collect(Collectors.toList());
|
||||||
|
|
||||||
return CommonResult.success(new PageResult<>(respList, total));
|
return CommonResult.success(new PageResult<>(respList, total));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user