fix (farm): 首页
- 首页加载内容拆分 - 新增获取地块信息接口
This commit is contained in:
@@ -42,6 +42,13 @@ public class HomeController {
|
||||
return success(homeService.getHomeInfo(baseId));
|
||||
}
|
||||
|
||||
@Operation(summary = "农场首页-地块详情")
|
||||
@GetMapping("/plot/get")
|
||||
@Parameter(name = "plotId", description = "地块ID")
|
||||
public CommonResult<HomeInfo.PlotInfo> getPlotInfo(@RequestParam("plotId") String plotId) {
|
||||
return success(homeService.getPlotInfo(plotId));
|
||||
}
|
||||
|
||||
@Operation(summary = "农场首页-基地名称列表")
|
||||
@GetMapping("/baseNames")
|
||||
public CommonResult<List<BaseNameVO>> getBaseNameList() {
|
||||
@@ -63,7 +70,7 @@ public class HomeController {
|
||||
@Parameter(name = "tenantId", description = "租户ID")
|
||||
public CommonResult<QrDetailsRespVO> scanQrCodes(@RequestParam("baseId") String baseId,
|
||||
@RequestParam("tenantId") String tenantId) {
|
||||
QrDetailsRespVO res = homeService.scanQrCodes(baseId,tenantId);
|
||||
QrDetailsRespVO res = homeService.scanQrCodes(baseId, tenantId);
|
||||
return success(res);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.farm.service.home;
|
||||
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.BaseNameVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.HomeInfo;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.OutlinedInfoVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.home.vo.QrDetailsRespVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,6 +22,8 @@ public interface HomeService {
|
||||
*/
|
||||
HomeInfo getHomeInfo(String baseId);
|
||||
|
||||
HomeInfo.PlotInfo getPlotInfo(String plotId);
|
||||
|
||||
List<BaseNameVO> getBaseNameList();
|
||||
|
||||
/**
|
||||
|
||||
@@ -150,6 +150,41 @@ public class HomeServiceImpl implements HomeService {
|
||||
return targetList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlotInfo getPlotInfo(String plotId) {
|
||||
// 员工集合 <id,name>
|
||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||
|
||||
PlotInfoDO pObj = plotInfoService.getPlotInfo(plotId);
|
||||
BaseInfoDO bOjb = baseInfoService.getBaseInfo(pObj.getBaseId());
|
||||
|
||||
return this.getPlotInfo(pObj,bOjb,employeeNameMap);
|
||||
}
|
||||
|
||||
private PlotInfo getPlotInfo(PlotInfoDO e, BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
|
||||
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
||||
// 地块详情 (包含计划信息)
|
||||
PlotOrCropInfo plotOrCropInfo = this.getPlotOrCropInfoList(e,"地块详情",employeeName);
|
||||
// 地块浮框信息
|
||||
List<PlotPopupFrame> plotPopupFrame = this.getPlotPopupFrame(e.getId(), employeeNameMap);
|
||||
// 户主流转信息
|
||||
List<PlotLesseeDetailsRespVO> lesseeList = plotInfoService.getPlotLesseeList(e.getId());
|
||||
|
||||
PlotInfo t = new PlotInfo();
|
||||
t.setBaseId(e.getBaseId());
|
||||
t.setBaseName(baseObj.getName());
|
||||
t.setPlotId(e.getPlotId());
|
||||
t.setPlotName(e.getPlotName());
|
||||
t.setPlotArea(BigDecimalUtil.roundedViaMath(e.getPlotArea()));
|
||||
t.setManager(employeeName);
|
||||
t.setPoint(e.getPoint());
|
||||
t.setPlotColor(e.getPlotColor());
|
||||
t.setPlotOrCropInfo(plotOrCropInfo);
|
||||
t.setPlotPopupFrames(plotPopupFrame);
|
||||
t.setLesseeList(lesseeList);
|
||||
return t;
|
||||
}
|
||||
|
||||
private List<PlotInfo> getPlotInfoList(BaseInfoDO baseObj,Map<String, String> employeeNameMap) {
|
||||
List<PlotInfo> targetList = new ArrayList<>();
|
||||
List<PlotInfoDO> plotList = plotInfoService.getPlotInfos(baseObj.getId());
|
||||
@@ -171,9 +206,9 @@ public class HomeServiceImpl implements HomeService {
|
||||
t.setManager(employeeName);
|
||||
t.setPoint(e.getPoint());
|
||||
t.setPlotColor(e.getPlotColor());
|
||||
t.setPlotOrCropInfo(plotOrCropInfo);
|
||||
// t.setPlotOrCropInfo(plotOrCropInfo);
|
||||
t.setPlotPopupFrames(plotPopupFrame);
|
||||
t.setLesseeList(lesseeList);
|
||||
// t.setLesseeList(lesseeList);
|
||||
targetList.add(t);
|
||||
}
|
||||
return targetList;
|
||||
|
||||
Reference in New Issue
Block a user