| | |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springblade.modules.farm.entity.FarmingRecord; |
| | | import org.springblade.modules.farm.service.FarmingRecordService; |
| | | import org.springblade.modules.farmplant.entity.FarmPlant; |
| | | import org.springblade.modules.farmplant.entity.Strain; |
| | | import org.springblade.modules.farmplant.service.FarmPlantService; |
| | | import org.springblade.modules.farmplant.service.StrainService; |
| | | import org.springblade.modules.farmplant.vo.FarmPlantVO; |
| | | import org.springblade.modules.farmplant.vo.StrainVO; |
| | | import org.springblade.modules.lang.entity.Land; |
| | |
| | | |
| | | |
| | | private final ILandService landService; |
| | | |
| | | private final StrainService strainService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 首页秧苗产品总和 |
| | | */ |
| | | @GetMapping("/strainCountYM") |
| | | public R<IPage<FarmPlantVO>> strainCountYM(FarmPlantVO farmPlant, Query query) { |
| | | IPage<FarmPlantVO> pages = farmplantService.selectFarmPlantPageCountYM(Condition.getPage(query), farmPlant); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | @GetMapping("/getFarmPlantList") |
| | | public R getFarmPlantList(FarmPlantVO farmPlant) { |
| | | return R.data(farmplantService.getFarmPlantList(farmPlant)); |
| | | } |
| | | |
| | | /** |
| | | * 查询种养记录列表(秧苗)(不分页) |
| | | * @param farmPlant |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFarmPlantYMList") |
| | | public R getFarmPlantYMList(FarmPlantVO farmPlant) { |
| | | return R.data(farmplantService.getFarmPlantYMList(farmPlant)); |
| | | } |
| | | |
| | | |
| | |
| | | farmPlant.setCreateTime(new Date()); |
| | | boolean save = farmplantService.save(farmPlant); |
| | | if (save) { |
| | | Strain strain = strainService.getById(farmPlant.getStrainId()); |
| | | //同时生成农事记录 |
| | | FarmingRecord record = new FarmingRecord(); |
| | | record.setCreateTime(new Date()); |
| | |
| | | record.setTime(farmPlant.getTransplanTime()); |
| | | record.setDeptId(farmPlant.getDeptId()); |
| | | record.setTenantId(farmPlant.getTenantId()); |
| | | record.setStrainId(farmPlant.getStrainId()); |
| | | if (farmPlant.getPlantingWay().equals("0")) { |
| | | //移栽 |
| | | record.setType("10"); |
| | |
| | | //直播 |
| | | record.setType("11"); |
| | | } |
| | | if(farmPlant.getPlantingWay().equals("2")){ |
| | | //秧苗 |
| | | record.setType("13"); |
| | | } |
| | | record.setLandId(farmPlant.getLandId()); |
| | | record.setOperator(farmPlant.getCreateUser()); |
| | | record.setContent("品种: " + farmPlant.getVarieties()); |
| | | if (StringUtil.isBlank(farmPlant.getVarieties())){ |
| | | record.setContent("品种: " + strain.getStrainName()); |
| | | }else { |
| | | record.setContent("品种: " + strain.getStrainName()+"-"+farmPlant.getVarieties()); |
| | | } |
| | | //新增 |
| | | farmingRecordService.save(record); |
| | | |