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.service.plotinfo.PlotInfoService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.AbstractMap;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
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;
|
||||||
@@ -70,7 +69,8 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
public void createProductionPlan(ProductionPlanSaveReqVO reqVO) {
|
public void createProductionPlan(ProductionPlanSaveReqVO reqVO) {
|
||||||
|
|
||||||
String speciesModelId = reqVO.getSpeciesModelId();
|
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<ProductionPlanSaveReqVO.CultivationArea> cultivationAreaList = reqVO.getCultivationAreaList();
|
||||||
|
|
||||||
List<ProductionPlanDO> list = new ArrayList<>();
|
List<ProductionPlanDO> list = new ArrayList<>();
|
||||||
@@ -93,16 +93,13 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
obj.setRemark(e.getRemark());
|
obj.setRemark(e.getRemark());
|
||||||
|
|
||||||
obj.setBaseId(e.getBaseId());
|
obj.setBaseId(e.getBaseId());
|
||||||
BaseInfoDO baseInfoDO = baseInfoMapper.selectById(e.getBaseId());
|
obj.setBaseName(baseNameMap.getOrDefault(e.getBaseId(), ""));
|
||||||
obj.setBaseName(baseInfoDO.getName());
|
|
||||||
obj.setPlotId(e.getPlotId());
|
obj.setPlotId(e.getPlotId());
|
||||||
PlotInfoDO plotInfo = plotInfoService.getPlotInfoByPlotId(e.getPlotId());
|
obj.setPlotName(plotNameMap.getOrDefault(e.getPlotId(),""));
|
||||||
obj.setPlotName(plotInfo.getPlotName());
|
|
||||||
|
|
||||||
obj.setTenantId(getLoginUser().getTenantId().toString());
|
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();
|
String taskId = IdUtil.fastUUID();
|
||||||
obj.setId(taskId);
|
obj.setId(taskId);
|
||||||
// 创建模型案例
|
// 创建模型案例
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ public interface PlotInfoService {
|
|||||||
* @return 地块
|
* @return 地块
|
||||||
*/
|
*/
|
||||||
PlotInfoDO getPlotInfo(String id);
|
PlotInfoDO getPlotInfo(String id);
|
||||||
|
|
||||||
List<PlotInfoDO> getPlotInfos(String baseId);
|
List<PlotInfoDO> getPlotInfos(String baseId);
|
||||||
|
List<PlotInfoDO> getPlotInfos();
|
||||||
/**
|
/**
|
||||||
* 获得地块分页
|
* 获得地块分页
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -80,7 +80,12 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PlotInfoDO> getPlotInfos(String baseId) {
|
public List<PlotInfoDO> getPlotInfos(String baseId) {
|
||||||
return null;
|
return plotInfoMapper.selectList("base_id",baseId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PlotInfoDO> getPlotInfos() {
|
||||||
|
return plotInfoMapper.selectList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user