fix (farm): 微信端,权限

- 提供微信端所需接口
- 修复页面权限问题
This commit is contained in:
达富斌
2025-10-13 17:45:24 +08:00
parent 0470e0a6e8
commit b17d34534d
15 changed files with 194 additions and 67 deletions

View File

@@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.farm.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
/**
* @description: 联系我们
* @author: binda
* @date: 2025/10/13 17:25
*/
@Data
@Configuration
@ConfigurationProperties(prefix = "company")
public class CompanyConf {
private String contactNumber;
private String email;
private String address;
}

View File

@@ -230,17 +230,4 @@ public class CropFarmingCenterController {
return success(res); return success(res);
} }
/**
* === === 微信端 === ===
*/
@GetMapping("/production-plan/wx/page")
@Operation(summary = "生产计划-分页(微信端)")
public CommonResult<PageResult<ProductionPlanResp2VO>> getProductionPlanPageForWx(@Valid ProductionPlanPage2ReqVO pageReqVO) {
PageResult<ProductionPlanResp2VO> page = cropFarmingCenterService.getProductionPlanPage2(pageReqVO);
List<ProductionPlanResp2VO> list = page.getList();
List<ProductionPlanResp2VO> resetList = list.stream().filter(vo -> !"project".equals(vo.getType())).collect(Collectors.toList());
long size = resetList.size();
return success(new PageResult<ProductionPlanResp2VO>(resetList,size));
}
} }

View File

@@ -124,15 +124,4 @@ public class BaseInfoController {
return success(res); return success(res);
} }
/**
* === === 微信端 === ===
*/
@GetMapping("/wx/base/list")
@Operation(summary = "基地列表(微信端)")
public CommonResult<List<BaseInfoForWxRespVO>> getBaseListForWx() {
List<BaseInfoForWxRespVO> res = baseInfoService.getBaseListForWx();
return success(res);
}
} }

View File

@@ -100,13 +100,4 @@ public class PlotInfoController {
BeanUtils.toBean(list, PlotInfoRespVO.class)); BeanUtils.toBean(list, PlotInfoRespVO.class));
} }
/**
* === === 微信端 === ===
*/
@GetMapping("/wx/plot-device/list")
@Operation(summary = "微信端-常用地块集合")
public CommonResult<List<RegularPlotInfoRespVO>> getRegularPlotInfoList() {
return success(plotInfoService.getRegularPlotInfoList());
}
} }

View File

@@ -36,14 +36,14 @@ public class DeviceClassifyController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建设备分类") @Operation(summary = "创建设备分类")
@PreAuthorize("@ss.hasPermission('farm:device-classify:create')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:create')")
public CommonResult<Long> createDeviceClassify(@Valid @RequestBody DeviceClassifySaveReqVO createReqVO) { public CommonResult<Long> createDeviceClassify(@Valid @RequestBody DeviceClassifySaveReqVO createReqVO) {
return success(deviceClassifyService.createDeviceClassify(createReqVO)); return success(deviceClassifyService.createDeviceClassify(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新设备分类") @Operation(summary = "更新设备分类")
@PreAuthorize("@ss.hasPermission('farm:device-classify:update')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:update')")
public CommonResult<Boolean> updateDeviceClassify(@Valid @RequestBody DeviceClassifySaveReqVO updateReqVO) { public CommonResult<Boolean> updateDeviceClassify(@Valid @RequestBody DeviceClassifySaveReqVO updateReqVO) {
deviceClassifyService.updateDeviceClassify(updateReqVO); deviceClassifyService.updateDeviceClassify(updateReqVO);
return success(true); return success(true);
@@ -52,7 +52,7 @@ public class DeviceClassifyController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除设备分类") @Operation(summary = "删除设备分类")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('farm:device-classify:delete')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:delete')")
public CommonResult<Boolean> deleteDeviceClassify(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteDeviceClassify(@RequestParam("id") Long id) {
deviceClassifyService.deleteDeviceClassify(id); deviceClassifyService.deleteDeviceClassify(id);
return success(true); return success(true);
@@ -61,7 +61,7 @@ public class DeviceClassifyController {
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除设备分类") @Operation(summary = "批量删除设备分类")
@PreAuthorize("@ss.hasPermission('farm:device-classify:delete')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:delete')")
public CommonResult<Boolean> deleteDeviceClassifyList(@RequestParam("ids") List<Long> ids) { public CommonResult<Boolean> deleteDeviceClassifyList(@RequestParam("ids") List<Long> ids) {
deviceClassifyService.deleteDeviceClassifyListByIds(ids); deviceClassifyService.deleteDeviceClassifyListByIds(ids);
return success(true); return success(true);
@@ -70,7 +70,7 @@ public class DeviceClassifyController {
@GetMapping("/get") @GetMapping("/get")
@Operation(summary = "获得设备分类") @Operation(summary = "获得设备分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('farm:device-classify:query')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:query')")
public CommonResult<DeviceClassifyRespVO> getDeviceClassify(@RequestParam("id") Long id) { public CommonResult<DeviceClassifyRespVO> getDeviceClassify(@RequestParam("id") Long id) {
DeviceClassifyDO deviceClassify = deviceClassifyService.getDeviceClassify(id); DeviceClassifyDO deviceClassify = deviceClassifyService.getDeviceClassify(id);
return success(BeanUtils.toBean(deviceClassify, DeviceClassifyRespVO.class)); return success(BeanUtils.toBean(deviceClassify, DeviceClassifyRespVO.class));
@@ -78,7 +78,7 @@ public class DeviceClassifyController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得设备分类分页") @Operation(summary = "获得设备分类分页")
@PreAuthorize("@ss.hasPermission('farm:device-classify:query')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:query')")
public CommonResult<PageResult<DeviceClassifyRespVO>> getDeviceClassifyPage(@Valid DeviceClassifyPageReqVO pageReqVO) { public CommonResult<PageResult<DeviceClassifyRespVO>> getDeviceClassifyPage(@Valid DeviceClassifyPageReqVO pageReqVO) {
PageResult<DeviceClassifyDO> pageResult = deviceClassifyService.getDeviceClassifyPage(pageReqVO); PageResult<DeviceClassifyDO> pageResult = deviceClassifyService.getDeviceClassifyPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DeviceClassifyRespVO.class)); return success(BeanUtils.toBean(pageResult, DeviceClassifyRespVO.class));
@@ -93,7 +93,7 @@ public class DeviceClassifyController {
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出设备分类 Excel") @Operation(summary = "导出设备分类 Excel")
@PreAuthorize("@ss.hasPermission('farm:device-classify:export')") // @PreAuthorize("@ss.hasPermission('farm:device-classify:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportDeviceClassifyExcel(@Valid DeviceClassifyPageReqVO pageReqVO, public void exportDeviceClassifyExcel(@Valid DeviceClassifyPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {

View File

@@ -80,7 +80,7 @@ public class DisasterDataController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得灾害数据分页") @Operation(summary = "获得灾害数据分页")
@PreAuthorize("@ss.hasPermission('farm:disaster-data:query')") // @PreAuthorize("@ss.hasPermission('farm:disaster-data:query')")
public CommonResult<PageResult<DisasterDataRespVO>> getDisasterDataPage(@Valid DisasterDataPageReqVO pageReqVO) { public CommonResult<PageResult<DisasterDataRespVO>> getDisasterDataPage(@Valid DisasterDataPageReqVO pageReqVO) {
PageResult<DisasterDataDO> pageResult = disasterDataService.getDisasterDataPage(pageReqVO); PageResult<DisasterDataDO> pageResult = disasterDataService.getDisasterDataPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, DisasterDataRespVO.class)); return success(BeanUtils.toBean(pageResult, DisasterDataRespVO.class));

View File

@@ -38,14 +38,14 @@ public class EnvironmentIndicatorsController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建环境指标维护") @Operation(summary = "创建环境指标维护")
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:create')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:create')")
public CommonResult<Integer> createEnvironmentIndicators(@Valid @RequestBody EnvironmentIndicatorsSaveReqVO createReqVO) { public CommonResult<Integer> createEnvironmentIndicators(@Valid @RequestBody EnvironmentIndicatorsSaveReqVO createReqVO) {
return success(environmentIndicatorsService.createEnvironmentIndicators(createReqVO)); return success(environmentIndicatorsService.createEnvironmentIndicators(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新环境指标维护") @Operation(summary = "更新环境指标维护")
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:update')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:update')")
public CommonResult<Boolean> updateEnvironmentIndicators(@Valid @RequestBody EnvironmentIndicatorsSaveReqVO updateReqVO) { public CommonResult<Boolean> updateEnvironmentIndicators(@Valid @RequestBody EnvironmentIndicatorsSaveReqVO updateReqVO) {
environmentIndicatorsService.updateEnvironmentIndicators(updateReqVO); environmentIndicatorsService.updateEnvironmentIndicators(updateReqVO);
return success(true); return success(true);
@@ -54,7 +54,7 @@ public class EnvironmentIndicatorsController {
@DeleteMapping("/delete") @DeleteMapping("/delete")
@Operation(summary = "删除环境指标维护") @Operation(summary = "删除环境指标维护")
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:delete')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:delete')")
public CommonResult<Boolean> deleteEnvironmentIndicators(@RequestParam("id") Integer id) { public CommonResult<Boolean> deleteEnvironmentIndicators(@RequestParam("id") Integer id) {
environmentIndicatorsService.deleteEnvironmentIndicators(id); environmentIndicatorsService.deleteEnvironmentIndicators(id);
return success(true); return success(true);
@@ -63,7 +63,7 @@ public class EnvironmentIndicatorsController {
@DeleteMapping("/delete-list") @DeleteMapping("/delete-list")
@Parameter(name = "ids", description = "编号", required = true) @Parameter(name = "ids", description = "编号", required = true)
@Operation(summary = "批量删除环境指标维护") @Operation(summary = "批量删除环境指标维护")
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:delete')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:delete')")
public CommonResult<Boolean> deleteEnvironmentIndicatorsList(@RequestParam("ids") List<Integer> ids) { public CommonResult<Boolean> deleteEnvironmentIndicatorsList(@RequestParam("ids") List<Integer> ids) {
environmentIndicatorsService.deleteEnvironmentIndicatorsListByIds(ids); environmentIndicatorsService.deleteEnvironmentIndicatorsListByIds(ids);
return success(true); return success(true);
@@ -80,7 +80,7 @@ public class EnvironmentIndicatorsController {
@GetMapping("/page") @GetMapping("/page")
@Operation(summary = "获得环境指标维护分页") @Operation(summary = "获得环境指标维护分页")
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:query')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:query')")
public CommonResult<PageResult<EnvironmentIndicatorsRespVO>> getEnvironmentIndicatorsPage(@Valid EnvironmentIndicatorsPageReqVO pageReqVO) { public CommonResult<PageResult<EnvironmentIndicatorsRespVO>> getEnvironmentIndicatorsPage(@Valid EnvironmentIndicatorsPageReqVO pageReqVO) {
PageResult<EnvironmentIndicatorsDO> pageResult = environmentIndicatorsService.getEnvironmentIndicatorsPage(pageReqVO); PageResult<EnvironmentIndicatorsDO> pageResult = environmentIndicatorsService.getEnvironmentIndicatorsPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnvironmentIndicatorsRespVO.class)); return success(BeanUtils.toBean(pageResult, EnvironmentIndicatorsRespVO.class));
@@ -88,7 +88,7 @@ public class EnvironmentIndicatorsController {
@GetMapping("/list") @GetMapping("/list")
@Operation(summary = "根据设备分类获取") @Operation(summary = "根据设备分类获取")
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:query')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:query')")
public CommonResult<List<EnvironmentIndicatorsRespVO>> getEnvironmentIndicatorsList(@Valid EnvironmentIndicatorsPageReqVO pageReqVO) { public CommonResult<List<EnvironmentIndicatorsRespVO>> getEnvironmentIndicatorsList(@Valid EnvironmentIndicatorsPageReqVO pageReqVO) {
List<EnvironmentIndicatorsDO> pageResult = environmentIndicatorsService.getEnvironmentIndicatorsList(pageReqVO); List<EnvironmentIndicatorsDO> pageResult = environmentIndicatorsService.getEnvironmentIndicatorsList(pageReqVO);
return success(BeanUtils.toBean(pageResult, EnvironmentIndicatorsRespVO.class)); return success(BeanUtils.toBean(pageResult, EnvironmentIndicatorsRespVO.class));
@@ -96,7 +96,7 @@ public class EnvironmentIndicatorsController {
@GetMapping("/export-excel") @GetMapping("/export-excel")
@Operation(summary = "导出环境指标维护 Excel") @Operation(summary = "导出环境指标维护 Excel")
@PreAuthorize("@ss.hasPermission('farm:environment-indicators:export')") // @PreAuthorize("@ss.hasPermission('farm:environment-indicators:export')")
@ApiAccessLog(operateType = EXPORT) @ApiAccessLog(operateType = EXPORT)
public void exportEnvironmentIndicatorsExcel(@Valid EnvironmentIndicatorsPageReqVO pageReqVO, public void exportEnvironmentIndicatorsExcel(@Valid EnvironmentIndicatorsPageReqVO pageReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {

View File

@@ -2,7 +2,12 @@ package cn.iocoder.yudao.module.farm.controller.admin.wx;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.farm.config.CompanyConf;
import cn.iocoder.yudao.module.farm.controller.admin.api.vo.DeviceStateRespVO; import cn.iocoder.yudao.module.farm.controller.admin.api.vo.DeviceStateRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.ProductionPlanPage2ReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.cropfarmingcenter.vo.ProductionPlanResp2VO;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.RegularPlotInfoRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.farmnews.vo.FarmInformationPageReqVO; import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.farmnews.vo.FarmInformationPageReqVO;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.farmnews.vo.FarmInformationPageRespVO; import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.farmnews.vo.FarmInformationPageRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.wx.vo.*; import cn.iocoder.yudao.module.farm.controller.admin.wx.vo.*;
@@ -10,6 +15,7 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.deviceinfo.DeviceInfoDO; import cn.iocoder.yudao.module.farm.dal.dataobject.deviceinfo.DeviceInfoDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO; import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService; import cn.iocoder.yudao.module.farm.service.baseinfo.BaseInfoService;
import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterService;
import cn.iocoder.yudao.module.farm.service.deviceinfo.DeviceInfoService; import cn.iocoder.yudao.module.farm.service.deviceinfo.DeviceInfoService;
import cn.iocoder.yudao.module.farm.service.farminformation.FarmInformationService; import cn.iocoder.yudao.module.farm.service.farminformation.FarmInformationService;
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService; import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
@@ -30,7 +36,9 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUser;
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.BINDING_STATE_MAP; import static cn.iocoder.yudao.module.farm.enums.CommonConstants.BINDING_STATE_MAP;
import static cn.iocoder.yudao.module.farm.enums.CommonConstants.DEVICE_STATE_MAP; import static cn.iocoder.yudao.module.farm.enums.CommonConstants.DEVICE_STATE_MAP;
@@ -53,8 +61,10 @@ public class WxController {
private final BaseInfoService baseInfoService; private final BaseInfoService baseInfoService;
private final PlotInfoService plotInfoService; private final PlotInfoService plotInfoService;
private final ProductionPlanService productionPlanService; private final ProductionPlanService productionPlanService;
private final CropFarmingCenterService cropFarmingCenterService;
private final CompanyConf companyConf;
public WxController(FarmInformationService farmInformationService, DeviceInfoService deviceInfoService, FarmingRecordService farmingRecordService, MessageCenterService messageCenterService, BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService) { public WxController(FarmInformationService farmInformationService, DeviceInfoService deviceInfoService, FarmingRecordService farmingRecordService, MessageCenterService messageCenterService, BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, CropFarmingCenterService cropFarmingCenterService, CompanyConf companyConf) {
this.farmInformationService = farmInformationService; this.farmInformationService = farmInformationService;
this.deviceInfoService = deviceInfoService; this.deviceInfoService = deviceInfoService;
this.farmingRecordService = farmingRecordService; this.farmingRecordService = farmingRecordService;
@@ -62,15 +72,12 @@ public class WxController {
this.baseInfoService = baseInfoService; this.baseInfoService = baseInfoService;
this.plotInfoService = plotInfoService; this.plotInfoService = plotInfoService;
this.productionPlanService = productionPlanService; this.productionPlanService = productionPlanService;
this.cropFarmingCenterService = cropFarmingCenterService;
this.companyConf = companyConf;
} }
@Operation(summary = "农业资讯")
@GetMapping("/farm-information/page")
public CommonResult<PageResult<FarmInformationPageRespVO>> getFarmInformation(@Valid FarmInformationPageReqVO req) {
PageResult<FarmInformationPageRespVO> result = farmInformationService.getFarmInformationPage(req);
return CommonResult.success(result);
}
@GetMapping("/farming-record/executing-state") @GetMapping("/farming-record/executing-state")
@Operation(summary = "进行中农事计划") @Operation(summary = "进行中农事计划")
@@ -79,17 +86,6 @@ public class WxController {
return CommonResult.success(new RecordExecutingStateRespVO(20)); return CommonResult.success(new RecordExecutingStateRespVO(20));
} }
@GetMapping("/message-center/abnormal-state")
@Operation(summary = "异常信息")
public CommonResult<List<AbnormalMessageRespVO>> getAbnormalMessage() {
List<AbnormalMessageRespVO> res = new ArrayList<>();
res.add(new AbnormalMessageRespVO("土壤湿度过低", "低于3%"));
res.add(new AbnormalMessageRespVO("土壤湿度过低", "低于3%"));
res.add(new AbnormalMessageRespVO("土壤湿度过低", "低于3%"));
return CommonResult.success(res);
}
@GetMapping("/device-info/get") @GetMapping("/device-info/get")
@Operation(summary = "获取设备信息") @Operation(summary = "获取设备信息")
@Parameter(name = "baseId", description = "基地编号") @Parameter(name = "baseId", description = "基地编号")
@@ -165,4 +161,64 @@ public class WxController {
}).toList(); }).toList();
} }
@GetMapping("/base-info/list")
@Operation(summary = "基地列表")
public CommonResult<List<BaseInfoForWxRespVO>> getBaseListForWx() {
List<BaseInfoForWxRespVO> res = baseInfoService.getBaseListForWx();
return success(res);
}
@GetMapping("/base-info/count")
@Operation(summary = "获取租户下的基地&地块总数")
@Parameter(name = "tenantId", description = "租户编号")
public CommonResult<BaseCountInfoRespVO> getBaseCountInfoRespVO(@RequestParam("tenantId") String tenantId) {
BaseCountInfoRespVO res = baseInfoService.countBaseInfo(tenantId);
return CommonResult.success(res);
}
@GetMapping("/plot-device/list")
@Operation(summary = "微信端-常用地块集合")
public CommonResult<List<RegularPlotInfoRespVO>> getRegularPlotInfoList() {
return success(plotInfoService.getRegularPlotInfoList());
}
@GetMapping("/production-plan/page")
@Operation(summary = "生产计划-分页(微信端)")
public CommonResult<PageResult<ProductionPlanResp2VO>> getProductionPlanPageForWx(@Valid ProductionPlanPage2ReqVO pageReqVO) {
PageResult<ProductionPlanResp2VO> page = cropFarmingCenterService.getProductionPlanPage2(pageReqVO);
List<ProductionPlanResp2VO> list = page.getList();
List<ProductionPlanResp2VO> resetList = list.stream().filter(vo -> !"project".equals(vo.getType())).collect(Collectors.toList());
long size = resetList.size();
return success(new PageResult<ProductionPlanResp2VO>(resetList,size));
}
@Operation(summary = "农业资讯")
@GetMapping("/farm-information/page")
public CommonResult<PageResult<FarmInformationPageRespVO>> getFarmInformation(@Valid FarmInformationPageReqVO req) {
// TODO: 2025/10/13 待实现
PageResult<FarmInformationPageRespVO> result = farmInformationService.getFarmInformationPage(req);
return CommonResult.success(result);
}
@GetMapping("/message-center/abnormal-state")
@Operation(summary = "异常信息")
public CommonResult<List<AbnormalMessageRespVO>> getAbnormalMessage() {
// TODO: 2025/10/13 待实现
List<AbnormalMessageRespVO> res = new ArrayList<>();
res.add(new AbnormalMessageRespVO("土壤湿度过低", "低于3%"));
res.add(new AbnormalMessageRespVO("土壤湿度过低", "低于3%"));
res.add(new AbnormalMessageRespVO("土壤湿度过低", "低于3%"));
return CommonResult.success(res);
}
@GetMapping("/company-info/get")
@Operation(summary = "联系我们")
public CommonResult<TenantCompanyInfoRespVO> getTenantCompanyInfoRespVO() {
return success(new TenantCompanyInfoRespVO(
companyConf.getContactNumber(),
companyConf.getEmail(),
companyConf.getAddress()));
}
} }

View File

@@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.farm.controller.admin.wx.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 基地与地块信息
* @author: binda
* @date: 2025/10/13 17:07
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseCountInfoRespVO {
@Schema(description = "基地总数")
private long baseCount;
@Schema(description = "地块总数")
private long plotCount;
}

View File

@@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.farm.controller.admin.wx.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: 公司信息
* @author: binda
* @date: 2025/10/13 17:22
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TenantCompanyInfoRespVO {
@Schema(description = "联系电话")
private String contactNumber;
@Schema(description = "邮箱")
private String email;
@Schema(description = "公司地址")
private String companyAddress;
}

View File

@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewResp
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.BaseStatisticsInfoRespVO; import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.BaseStatisticsInfoRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*; import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO; import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.wx.vo.BaseCountInfoRespVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO; import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
import jakarta.validation.Valid; import jakarta.validation.Valid;
@@ -117,4 +118,11 @@ public interface BaseInfoService {
List<BaseAndPlotNamesRespVO> getBasePlotList(); List<BaseAndPlotNamesRespVO> getBasePlotList();
BaseStatisticsInfoRespVO getBaseStatisticsInfo(String baseId); BaseStatisticsInfoRespVO getBaseStatisticsInfo(String baseId);
/**
* 获取租户下 基地总数 * 地块总数
* @param tenantId
* @return
*/
BaseCountInfoRespVO countBaseInfo(String tenantId);
} }

View File

@@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.farm.controller.admin.api.vo.FarmBaseOverviewResp
import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.BaseStatisticsInfoRespVO; import cn.iocoder.yudao.module.farm.controller.admin.digitalcockpit.vo.BaseStatisticsInfoRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*; import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.*;
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO; import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.vo.wx.BaseInfoForWxRespVO;
import cn.iocoder.yudao.module.farm.controller.admin.wx.vo.BaseCountInfoRespVO;
import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO; import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO; import cn.iocoder.yudao.module.farm.dal.dataobject.companyinfo.CompanyInfoDO;
import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO; import cn.iocoder.yudao.module.farm.dal.dataobject.gridinfo.GridInfoDO;
@@ -450,4 +451,16 @@ public class BaseInfoServiceImpl implements BaseInfoService {
public BaseStatisticsInfoRespVO getBaseStatisticsInfo(String baseId) { public BaseStatisticsInfoRespVO getBaseStatisticsInfo(String baseId) {
return baseInfoMapper.getBaseStatisticsInfo(baseId); return baseInfoMapper.getBaseStatisticsInfo(baseId);
} }
@Override
public BaseCountInfoRespVO countBaseInfo(String tenantId) {
LambdaQueryWrapperX<BaseInfoDO> x = new LambdaQueryWrapperX<>();
x.eq(BaseInfoDO::getTenantId, tenantId);
x.eq(BaseInfoDO::getDeleted, CommonConstants.NO_CODE);
long bCount = baseInfoMapper.selectCount(x);
long pCount = plotInfoService.countPlotByTenantId(tenantId);
return new BaseCountInfoRespVO(bCount,pCount);
}
} }

View File

@@ -102,4 +102,6 @@ public interface PlotInfoService {
List<RegularPlotInfoRespVO> getRegularPlotInfoList(); List<RegularPlotInfoRespVO> getRegularPlotInfoList();
int countPlot(String baseId); int countPlot(String baseId);
Long countPlotByTenantId(String tenantId);
} }

View File

@@ -208,4 +208,12 @@ public class PlotInfoServiceImpl implements PlotInfoService {
Long count = plotInfoMapper.selectCount(PlotInfoDO::getBaseId, baseId); Long count = plotInfoMapper.selectCount(PlotInfoDO::getBaseId, baseId);
return count.intValue(); return count.intValue();
} }
@Override
public Long countPlotByTenantId(String tenantId) {
LambdaQueryWrapperX<PlotInfoDO> wrapperX = new LambdaQueryWrapperX<>();
wrapperX.eq(PlotInfoDO::getTenantId, tenantId);
wrapperX.eq(PlotInfoDO::getDeleted, CommonConstants.NO_CODE);
return plotInfoMapper.selectCount(wrapperX);
}
} }

View File

@@ -69,7 +69,7 @@ flowable:
mybatis-plus: mybatis-plus:
configuration: configuration:
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config: global-config:
db-config: db-config:
id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。 id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。
@@ -393,5 +393,9 @@ weather:
url-1: https://restapi.amap.com/v3/geocode/regeo?location={0},{1}&key={2} # 经纬度逆解析 GET url-1: https://restapi.amap.com/v3/geocode/regeo?location={0},{1}&key={2} # 经纬度逆解析 GET
url-2: https://restapi.amap.com/v3/weather/weatherInfo?city={0}&key={1} # 获取天气信息 GET url-2: https://restapi.amap.com/v3/weather/weatherInfo?city={0}&key={1} # 获取天气信息 GET
company:
contact-number: 40088888
email: weixucz@isoftstone.com
address: 江西省南昌市xxx-xxx-C4-1717室