feat (farm): 模型管理-农事记录
- 对其添加可修改条件验证 - 增加 临时工 字段
This commit is contained in:
@@ -30,13 +30,12 @@ public class FarmingRecordCreateReqVO {
|
||||
|
||||
@Schema(description = "执行人ID列表")
|
||||
private List<String> executor;
|
||||
@Schema(description = "临时工姓名列表")
|
||||
private List<String> dayLaborer;
|
||||
|
||||
@Schema(description = "实际用工")
|
||||
private Integer actualLaborCost;
|
||||
|
||||
@Schema(description = "日工", example = "111,111,111")
|
||||
private String dayLaborer;
|
||||
|
||||
@Schema(description = "实际投入品ID", example = "5691")
|
||||
private String actualInputId;
|
||||
|
||||
|
||||
@@ -35,8 +35,13 @@ public class FarmingRecordSaveReqVO {
|
||||
@Schema(description = "生产计划ID", example = "24782")
|
||||
private String productionPlanId;
|
||||
|
||||
@Schema(description = "模型管理(引用类型)-农事记录iD", example = "24782")
|
||||
private String modelFarmingOperationId;
|
||||
|
||||
@Schema(description = "执行人")
|
||||
private String executor;
|
||||
@Schema(description = "临时工姓名列表")
|
||||
private String dayLaborer;
|
||||
|
||||
@Schema(description = "实际用工")
|
||||
private Integer actualLaborCost;
|
||||
|
||||
@@ -72,5 +72,12 @@ public class ModelFarmingOperationRespVO {
|
||||
@Schema(description = "租户id", example = "31485")
|
||||
@ExcelProperty("租户id")
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 如果当前模型-农事记录已经被创建至 种植中心-农事记录下, 则不可修改
|
||||
*/
|
||||
@Schema(description = "可修改状态 (1:是; 0:否;)", example = "31485")
|
||||
private Integer usableType;
|
||||
|
||||
private List<ModelFarmingOperationInputDO> farmingOperationInputDOS;
|
||||
}
|
||||
|
||||
@@ -58,10 +58,18 @@ public class FarmingRecordDO extends BaseDO {
|
||||
* 生产计划ID
|
||||
*/
|
||||
private String productionPlanId;
|
||||
/**
|
||||
* 模型管理(引用类型)-农事记录iD
|
||||
*/
|
||||
private String modelFarmingOperationId;
|
||||
/**
|
||||
* 执行人
|
||||
*/
|
||||
private String executor;
|
||||
/**
|
||||
* 临时工姓名
|
||||
*/
|
||||
private String dayLaborer;
|
||||
/**
|
||||
* 实际用工
|
||||
*/
|
||||
|
||||
@@ -80,7 +80,10 @@ public class CommonConstants {
|
||||
|
||||
|
||||
public final static Integer FARMING_RECORD_STATUS_1 = 1;//开始
|
||||
public final static Integer FARMING_RECORD_STATUS_2 = 2; // "开始";
|
||||
public final static Integer FARMING_RECORD_STATUS_2 = 2; // "结束";
|
||||
|
||||
public final static Integer FARM_MODEL_FARMING_OPERATION_USABLE_TYPE_1 = 1; // 可用
|
||||
public final static Integer FARM_MODEL_FARMING_OPERATION_USABLE_TYPE_2 = 2; // 不可用
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class FarmingRecordJob implements JobHandler {
|
||||
if (endDate.isEqual(LocalDate.now())) {
|
||||
// 结束日期在今天
|
||||
e.setTaskStatus(FARMING_RECORD_STATUS_2);
|
||||
farmingRecordService.createFarmingRecord(e);
|
||||
farmingRecordService.updateFarmingRecord(e);
|
||||
}
|
||||
}
|
||||
return "success";
|
||||
@@ -112,6 +112,7 @@ public class FarmingRecordJob implements JobHandler {
|
||||
saveObj.setTaskScope(p.getPlanNumber());
|
||||
saveObj.setTaskTime(taskTime);
|
||||
saveObj.setProductionPlanId(p.getId());
|
||||
saveObj.setModelFarmingOperationId(e.getId());
|
||||
saveObj.setExecutor("系统");
|
||||
saveObj.setActualLaborCost(e.getUsed());
|
||||
saveObj.setActualInputId(""); // TODO: 2025/9/2
|
||||
@@ -123,6 +124,7 @@ public class FarmingRecordJob implements JobHandler {
|
||||
saveObj.setPlotId(p.getPlotId());
|
||||
saveObj.setPlotName(p.getPlotName());
|
||||
saveObj.setTenantId(p.getTenantId());
|
||||
saveObj.setModelFarmingOperationId(e.getId());
|
||||
|
||||
List<FarmingRecordInputDO> inputDOList = new ArrayList<>();
|
||||
for (ModelFarmingOperationInputDO m : e.getInvestGoodsList()) {
|
||||
|
||||
@@ -176,6 +176,7 @@ public class FarmingRecordServiceImpl implements FarmingRecordService {
|
||||
saveReqVO.setPlotId(createReqVO.getPlotId());
|
||||
saveReqVO.setProductionPlanId(createReqVO.getProductionPlanId());
|
||||
saveReqVO.setExecutor(executor);
|
||||
saveReqVO.setDayLaborer(String.join(",", createReqVO.getDayLaborer()));
|
||||
saveReqVO.setActualLaborCost(createReqVO.getActualLaborCost());
|
||||
saveReqVO.setFeedbackNotes(createReqVO.getFeedbackNotes());
|
||||
saveReqVO.setFeedbackImageUrlList(createReqVO.getFeedbackImageUrlList());
|
||||
|
||||
@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.modelfarmingoperation.vo.Mo
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelManagementSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.inputlibrary.InputLibraryDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelcycle.ModelCycleDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelenvironmentindex.ModelEnvironmentIndexDO;
|
||||
@@ -20,6 +21,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.modelpestdiseaseweed.ModelPes
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelweatherdisaster.ModelWeatherDisasterDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.SystemUserDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecord.FarmingRecordMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelcycle.ModelCycleMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelenvironmentindex.ModelEnvironmentIndexMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.modelfarmingoperation.ModelFarmingOperationMapper;
|
||||
@@ -30,10 +32,12 @@ 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.enums.CommonConstants;
|
||||
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.specieslibrary.SpeciesLibraryService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -42,7 +46,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
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.module.farm.enums.CommonConstants.MODEL_TYPE_2;
|
||||
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.*;
|
||||
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.MODEL_MANAGEMENT_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@@ -74,6 +78,8 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
||||
private InputLibraryService inputLibraryService;
|
||||
@Resource
|
||||
private SystemUserMapper systemUserMapper;
|
||||
@Resource
|
||||
private FarmingRecordMapper farmingRecordMapper;
|
||||
|
||||
@Override
|
||||
public String createModelManagement(ModelManagementSaveReqVO createReqVO) {
|
||||
@@ -298,6 +304,9 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
||||
aDo.setPackageUnitName(DictFrameworkUtils.parseDictDataLabel("asset_price", aDo.getPackageUnit()));
|
||||
}
|
||||
respVO.setFarmingOperationInputDOS(farmingOperationInputDOS);
|
||||
|
||||
int usableType = this.getModelFarmingOperationForUsableType(e.getId());
|
||||
respVO.setUsableType(usableType);
|
||||
respVOS.add(respVO);
|
||||
});
|
||||
vo.setFarmingOperationDOS(respVOS);
|
||||
@@ -307,6 +316,17 @@ public class ModelManagementServiceImpl implements ModelManagementService {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型管理-农事记录 如果已经被录入到了 种植中心-农事记录下 ,则不可编辑
|
||||
*
|
||||
* @param modelFarmingOperationId
|
||||
* @return
|
||||
*/
|
||||
private int getModelFarmingOperationForUsableType(String modelFarmingOperationId) {
|
||||
FarmingRecordDO recordDO = farmingRecordMapper.selectOne("model_farming_operation_id", modelFarmingOperationId);
|
||||
return ObjectUtils.isEmpty(recordDO) ? FARM_MODEL_FARMING_OPERATION_USABLE_TYPE_1 : FARM_MODEL_FARMING_OPERATION_USABLE_TYPE_2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<ModelManagementDO> getModelManagementPage(ModelManagementPageReqVO pageReqVO) {
|
||||
pageReqVO.setType(1);
|
||||
|
||||
Reference in New Issue
Block a user