feat (farm): 生产计划管理
- 计划名称 名称规则 修复
This commit is contained in:
@@ -23,14 +23,13 @@ import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementServi
|
||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
@@ -70,7 +69,8 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
public void createProductionPlan(ProductionPlanSaveReqVO reqVO) {
|
||||
|
||||
String speciesModelId = reqVO.getSpeciesModelId();
|
||||
|
||||
Map<String, String> baseNameMap = baseInfoMapper.selectList().stream().collect(Collectors.toMap(BaseInfoDO::getId, BaseInfoDO::getName, (v1, v2) -> v1));
|
||||
Map<String, String> plotNameMap = plotInfoService.getPlotInfos().stream().collect(Collectors.toMap(PlotInfoDO::getPlotId, PlotInfoDO::getPlotName, (v1, v2) -> v1));
|
||||
List<ProductionPlanSaveReqVO.CultivationArea> cultivationAreaList = reqVO.getCultivationAreaList();
|
||||
|
||||
List<ProductionPlanDO> list = new ArrayList<>();
|
||||
@@ -93,16 +93,13 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
obj.setRemark(e.getRemark());
|
||||
|
||||
obj.setBaseId(e.getBaseId());
|
||||
BaseInfoDO baseInfoDO = baseInfoMapper.selectById(e.getBaseId());
|
||||
obj.setBaseName(baseInfoDO.getName());
|
||||
obj.setBaseName(baseNameMap.getOrDefault(e.getBaseId(), ""));
|
||||
obj.setPlotId(e.getPlotId());
|
||||
PlotInfoDO plotInfo = plotInfoService.getPlotInfoByPlotId(e.getPlotId());
|
||||
obj.setPlotName(plotInfo.getPlotName());
|
||||
|
||||
obj.setPlotName(plotNameMap.getOrDefault(e.getPlotId(),""));
|
||||
obj.setTenantId(getLoginUser().getTenantId().toString());
|
||||
obj.setId(IdUtil.fastUUID());
|
||||
|
||||
// 随机字符串 + 地块名称
|
||||
obj.setPlanNumber(StrHelperUtil.generate() + "-" + e.getPlotName());
|
||||
obj.setPlanNumber(StrHelperUtil.generate() + "-" + plotNameMap.getOrDefault(e.getPlotId(),""));
|
||||
String taskId = IdUtil.fastUUID();
|
||||
obj.setId(taskId);
|
||||
// 创建模型案例
|
||||
|
||||
@@ -51,7 +51,9 @@ public interface PlotInfoService {
|
||||
* @return 地块
|
||||
*/
|
||||
PlotInfoDO getPlotInfo(String id);
|
||||
|
||||
List<PlotInfoDO> getPlotInfos(String baseId);
|
||||
List<PlotInfoDO> getPlotInfos();
|
||||
/**
|
||||
* 获得地块分页
|
||||
*
|
||||
|
||||
@@ -80,7 +80,12 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
|
||||
@Override
|
||||
public List<PlotInfoDO> getPlotInfos(String baseId) {
|
||||
return null;
|
||||
return plotInfoMapper.selectList("base_id",baseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PlotInfoDO> getPlotInfos() {
|
||||
return plotInfoMapper.selectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user