fix (farm): 人员管理,大屏
- 人员管理简化流程 - 大屏数据切换接口
This commit is contained in:
@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdata
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.disasterdata.vo.DisasterDataPageReqVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.disasterdata.vo.DisasterDataRespVO;
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.basicdatamanagement.disasterdata.vo.DisasterDataSaveReqVO;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -90,4 +90,20 @@ public class FoundationInfoController {
|
||||
BeanUtils.toBean(list, FoundationInfoRespVO.class));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/data-toggle/get")
|
||||
@Operation(summary = "数据切换-获取")
|
||||
@Parameter(name = "data", description = "数据", required = true)
|
||||
public CommonResult<String> getDataToggle(@RequestParam("data") String data) {
|
||||
String res = "";
|
||||
return success(res);
|
||||
}
|
||||
|
||||
@PostMapping("/data-toggle/create")
|
||||
@Operation(summary = "数据切换-保存")
|
||||
@Parameter(name = "data", description = "数据", required = true)
|
||||
public CommonResult<String> createDataToggle(@RequestParam("data") String data) {
|
||||
|
||||
return success("success");
|
||||
}
|
||||
}
|
||||
@@ -41,14 +41,14 @@ public class ScreenDisasterDataController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建大屏数据-灾害数据")
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:create')")
|
||||
public CommonResult<String> createScreenDisasterData(@Valid @RequestBody ScreenDisasterDataSaveReqVO createReqVO) {
|
||||
return success(screenDisasterDataService.createScreenDisasterData(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新大屏数据-灾害数据")
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:update')")
|
||||
public CommonResult<Boolean> updateScreenDisasterData(@Valid @RequestBody ScreenDisasterDataSaveReqVO updateReqVO) {
|
||||
screenDisasterDataService.updateScreenDisasterData(updateReqVO);
|
||||
return success(true);
|
||||
@@ -57,7 +57,7 @@ public class ScreenDisasterDataController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除大屏数据-灾害数据")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:delete')")
|
||||
public CommonResult<Boolean> deleteScreenDisasterData(@RequestParam("id") String id) {
|
||||
screenDisasterDataService.deleteScreenDisasterData(id);
|
||||
return success(true);
|
||||
@@ -66,7 +66,7 @@ public class ScreenDisasterDataController {
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除大屏数据-灾害数据")
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:delete')")
|
||||
public CommonResult<Boolean> deleteScreenDisasterDataList(@RequestParam("ids") List<String> ids) {
|
||||
screenDisasterDataService.deleteScreenDisasterDataListByIds(ids);
|
||||
return success(true);
|
||||
@@ -75,7 +75,7 @@ public class ScreenDisasterDataController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得大屏数据-灾害数据")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:query')")
|
||||
public CommonResult<ScreenDisasterDataRespVO> getScreenDisasterData(@RequestParam("id") String id) {
|
||||
ScreenDisasterDataDO screenDisasterData = screenDisasterDataService.getScreenDisasterData(id);
|
||||
return success(BeanUtils.toBean(screenDisasterData, ScreenDisasterDataRespVO.class));
|
||||
@@ -83,7 +83,7 @@ public class ScreenDisasterDataController {
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得大屏数据-灾害数据分页")
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:query')")
|
||||
public CommonResult<PageResult<ScreenDisasterDataRespVO>> getScreenDisasterDataPage(@Valid ScreenDisasterDataPageReqVO pageReqVO) {
|
||||
PageResult<ScreenDisasterDataDO> pageResult = screenDisasterDataService.getScreenDisasterDataPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, ScreenDisasterDataRespVO.class));
|
||||
@@ -91,7 +91,7 @@ public class ScreenDisasterDataController {
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出大屏数据-灾害数据 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:export')")
|
||||
// @PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportScreenDisasterDataExcel(@Valid ScreenDisasterDataPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
@@ -28,87 +28,87 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理中心 - 人员管理")
|
||||
@RestController
|
||||
@RequestMapping("/farm/personnel-management")
|
||||
@Validated
|
||||
//@RestController
|
||||
//@RequestMapping("/farm/personnel-management")
|
||||
//@Validated
|
||||
public class PersonnelManagementController {
|
||||
|
||||
@Resource
|
||||
private PersonnelManagementService personnelManagementService;
|
||||
// @Resource
|
||||
// private PersonnelManagementService personnelManagementService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建人员管理")
|
||||
public CommonResult<String> createPersonnelManagement(@Valid @RequestBody PersonnelManagementSaveReqVO createReqVO) {
|
||||
String management = personnelManagementService.createPersonnelManagement(createReqVO);
|
||||
if (management.length() > 0) {
|
||||
return success(management);
|
||||
} else {
|
||||
return error(501,"手机号重复!");
|
||||
}
|
||||
}
|
||||
// @PostMapping("/create")
|
||||
// @Operation(summary = "创建人员管理")
|
||||
// public CommonResult<String> createPersonnelManagement(@Valid @RequestBody PersonnelManagementSaveReqVO createReqVO) {
|
||||
// String management = personnelManagementService.createPersonnelManagement(createReqVO);
|
||||
// if (management.length() > 0) {
|
||||
// return success(management);
|
||||
// } else {
|
||||
// return error(501,"手机号重复!");
|
||||
// }
|
||||
// }
|
||||
|
||||
@PutMapping("/reset")
|
||||
@Operation(summary = "密码重置")
|
||||
public CommonResult<Boolean> reset(@Valid @RequestBody PersonnelManagementSaveReqVO updateReqVO) {
|
||||
personnelManagementService.reset(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
// @PutMapping("/reset")
|
||||
// @Operation(summary = "密码重置")
|
||||
// public CommonResult<Boolean> reset(@Valid @RequestBody PersonnelManagementSaveReqVO updateReqVO) {
|
||||
// personnelManagementService.reset(updateReqVO);
|
||||
// return success(true);
|
||||
// }
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新人员管理")
|
||||
public CommonResult<Boolean> updatePersonnelManagement(@Valid @RequestBody PersonnelManagementSaveReqVO updateReqVO) {
|
||||
personnelManagementService.updatePersonnelManagement(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
// @PutMapping("/update")
|
||||
// @Operation(summary = "更新人员管理")
|
||||
// public CommonResult<Boolean> updatePersonnelManagement(@Valid @RequestBody PersonnelManagementSaveReqVO updateReqVO) {
|
||||
// personnelManagementService.updatePersonnelManagement(updateReqVO);
|
||||
// return success(true);
|
||||
// }
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除人员管理")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
public CommonResult<Boolean> deletePersonnelManagement(@RequestParam("id") String id) {
|
||||
personnelManagementService.deletePersonnelManagement(id);
|
||||
return success(true);
|
||||
}
|
||||
// @DeleteMapping("/delete")
|
||||
// @Operation(summary = "删除人员管理")
|
||||
// @Parameter(name = "id", description = "编号", required = true)
|
||||
// public CommonResult<Boolean> deletePersonnelManagement(@RequestParam("id") String id) {
|
||||
// personnelManagementService.deletePersonnelManagement(id);
|
||||
// return success(true);
|
||||
// }
|
||||
//
|
||||
// @DeleteMapping("/delete-list")
|
||||
// @Parameter(name = "ids", description = "编号", required = true)
|
||||
// @Operation(summary = "批量删除人员管理")
|
||||
// public CommonResult<Boolean> deletePersonnelManagementList(@RequestParam("ids") List<String> ids) {
|
||||
// personnelManagementService.deletePersonnelManagementListByIds(ids);
|
||||
// return success(true);
|
||||
// }
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除人员管理")
|
||||
public CommonResult<Boolean> deletePersonnelManagementList(@RequestParam("ids") List<String> ids) {
|
||||
personnelManagementService.deletePersonnelManagementListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
// @GetMapping("/get")
|
||||
// @Operation(summary = "获得人员管理")
|
||||
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
// public CommonResult<PersonnelManagementRespVO> getPersonnelManagement(@RequestParam("id") String id) {
|
||||
// PersonnelManagementDO personnelManagement = personnelManagementService.getPersonnelManagement(id);
|
||||
// return success(BeanUtils.toBean(personnelManagement, PersonnelManagementRespVO.class));
|
||||
// }
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得人员管理")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<PersonnelManagementRespVO> getPersonnelManagement(@RequestParam("id") String id) {
|
||||
PersonnelManagementDO personnelManagement = personnelManagementService.getPersonnelManagement(id);
|
||||
return success(BeanUtils.toBean(personnelManagement, PersonnelManagementRespVO.class));
|
||||
}
|
||||
// @GetMapping("/page")
|
||||
// @Operation(summary = "获得人员管理分页")
|
||||
// public CommonResult<PageResult<PersonnelManagementRespVO>> getPersonnelManagementPage(@Valid PersonnelManagementPageReqVO pageReqVO) {
|
||||
// PageResult<PersonnelManagementDO> pageResult = personnelManagementService.getPersonnelManagementPage(pageReqVO);
|
||||
// return success(BeanUtils.toBean(pageResult, PersonnelManagementRespVO.class));
|
||||
// }
|
||||
//
|
||||
// @GetMapping("/getList")
|
||||
// @Operation(summary = "获得人员管理全量数据")
|
||||
// public CommonResult<List<PersonnelManagementRespVO>> getList(@Valid PersonnelManagementPageReqVO pageReqVO) {
|
||||
// List<PersonnelManagementDO> pageResult = personnelManagementService.getList(pageReqVO);
|
||||
// return success(BeanUtils.toBean(pageResult, PersonnelManagementRespVO.class));
|
||||
// }
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得人员管理分页")
|
||||
public CommonResult<PageResult<PersonnelManagementRespVO>> getPersonnelManagementPage(@Valid PersonnelManagementPageReqVO pageReqVO) {
|
||||
PageResult<PersonnelManagementDO> pageResult = personnelManagementService.getPersonnelManagementPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PersonnelManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getList")
|
||||
@Operation(summary = "获得人员管理全量数据")
|
||||
public CommonResult<List<PersonnelManagementRespVO>> getList(@Valid PersonnelManagementPageReqVO pageReqVO) {
|
||||
List<PersonnelManagementDO> pageResult = personnelManagementService.getList(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PersonnelManagementRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出人员管理 Excel")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPersonnelManagementExcel(@Valid PersonnelManagementPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PersonnelManagementDO> list = personnelManagementService.getPersonnelManagementPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "人员管理.xls", "数据", PersonnelManagementRespVO.class,
|
||||
BeanUtils.toBean(list, PersonnelManagementRespVO.class));
|
||||
}
|
||||
// @GetMapping("/export-excel")
|
||||
// @Operation(summary = "导出人员管理 Excel")
|
||||
// @ApiAccessLog(operateType = EXPORT)
|
||||
// public void exportPersonnelManagementExcel(@Valid PersonnelManagementPageReqVO pageReqVO,
|
||||
// HttpServletResponse response) throws IOException {
|
||||
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
// List<PersonnelManagementDO> list = personnelManagementService.getPersonnelManagementPage(pageReqVO).getList();
|
||||
// // 导出 Excel
|
||||
// ExcelUtils.write(response, "人员管理.xls", "数据", PersonnelManagementRespVO.class,
|
||||
// BeanUtils.toBean(list, PersonnelManagementRespVO.class));
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -17,20 +17,18 @@ import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.baseinfo.v
|
||||
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.companyinfo.CompanyInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.specieslibrary.SpeciesLibraryMapper;
|
||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||
import cn.iocoder.yudao.module.farm.service.companyinfo.CompanyInfoService;
|
||||
import cn.iocoder.yudao.module.farm.service.deviceinfo.DeviceInfoService;
|
||||
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotLesseeService;
|
||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@@ -69,10 +67,6 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
@Resource
|
||||
private SpeciesLibraryService speciesLibraryService;
|
||||
@Resource
|
||||
private PersonnelManagementMapper personnelManagementMapper;
|
||||
@Resource
|
||||
private PersonnelManagementService personnelManagementService;
|
||||
@Resource
|
||||
private ProductionPlanService productionPlanService;
|
||||
@Resource
|
||||
private PlotInfoService plotInfoService;
|
||||
@@ -82,6 +76,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
private DeviceInfoService deviceInfoService;
|
||||
@Resource
|
||||
private PlotLesseeService plotLesseeService;
|
||||
@Resource
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
@SneakyThrows
|
||||
@Override
|
||||
@@ -143,8 +139,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
|
||||
@Override
|
||||
public BaseInfoDO getBaseInfo(String id) {
|
||||
List<PersonnelManagementDO> personnelList = personnelManagementMapper.selectList();
|
||||
Map<String, String> employeeMap = personnelList.stream().collect(Collectors.toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
||||
Map<String, String> employeeMap = adminUserService.getIdAndNickNameMap();
|
||||
BaseInfoDO baseInfoDO = baseInfoMapper.selectById(id);
|
||||
baseInfoDO.setManagerName(employeeMap.get(baseInfoDO.getManager()));
|
||||
|
||||
@@ -228,9 +223,8 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
public TenantInfoRespVO getBaseOverviewInfo() {
|
||||
long tenantId = getLoginUser().getTenantId();
|
||||
// 人员管理
|
||||
List<PersonnelManagementDO> personnels = personnelManagementMapper.selectList("tenant_id", tenantId);
|
||||
int employeeCount = personnels.size();
|
||||
Map<String, String> employeeMap = personnels.stream().collect(Collectors.toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
||||
Map<String, String> employeeMap = adminUserService.getIdAndNickNameMap();
|
||||
int employeeCount = employeeMap.size();
|
||||
|
||||
// 租户
|
||||
TenantInfoRespVO.TenantInfo tenantInfo = this.getTenantInfo(tenantId, employeeCount);
|
||||
@@ -278,7 +272,7 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
baseInfo.setPlantingPlotCount(productionPlanService.getGrowingPlotCount(baseId));
|
||||
baseInfo.setIotDeviceCount(countByBase);
|
||||
baseInfo.setPlantingTaskCount(productionPlanService.getGrowingPlanCount(baseId));
|
||||
baseInfo.setAdministratorName(getAdministratorName(tenantId, bDO.getManager()));
|
||||
baseInfo.setAdministratorName(adminUserService.getNickNameStrLink(bDO.getManager()));
|
||||
return CommonResult.success(new FarmBaseOverviewRespVO(tenantInfo, baseInfo));
|
||||
}
|
||||
|
||||
@@ -418,13 +412,6 @@ public class BaseInfoServiceImpl implements BaseInfoService {
|
||||
}
|
||||
}
|
||||
|
||||
private String getAdministratorName(String tenantId, String manager) {
|
||||
List<PersonnelManagementDO> personnelList = personnelManagementMapper.selectList("tenant_id", tenantId);
|
||||
Map<String, String> employeeMap = personnelList.stream().collect(Collectors.toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
||||
return personnelManagementService.getEmployeeNameMap(employeeMap, manager);
|
||||
}
|
||||
|
||||
|
||||
private TenantInfoRespVO.TenantInfo getTenantInfo(long tenantId, Integer employeeCount) {
|
||||
// 基地总数
|
||||
Integer baseCount = baseInfoMapper.getBaseCount(tenantId);
|
||||
|
||||
@@ -21,14 +21,12 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.baseinfo.BaseInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.farmingrecord.FarmingRecordDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelfarmingoperationinput.ModelFarmingOperationInputDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.modelmanagement.ModelManagementDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.specieslibrary.SpeciesLibraryDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.farmingrecord.FarmingRecordMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.inputlibrary.InputUsageRecordsMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanUsedGridMapper;
|
||||
@@ -48,6 +46,7 @@ import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
@@ -77,7 +76,6 @@ import static java.util.stream.Collectors.toMap;
|
||||
public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
|
||||
private final SpeciesLibraryMapper speciesLibraryMapper;
|
||||
private final PersonnelManagementMapper personnelManagementMapper;
|
||||
private final BaseInfoMapper baseInfoMapper;
|
||||
private final PlotInfoMapper plotInfoMapper;
|
||||
private final ProductionPlanMapper productionPlanMapper;
|
||||
@@ -95,16 +93,13 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
private final FarmingNameMaintenanceService farmingNameMaintenanceService;
|
||||
private final DictDataService dictDataService;
|
||||
private final ProductionPlanService productionPlanService;
|
||||
private final AdminUserService adminUserService;
|
||||
|
||||
private final GridEventPublisher gridEventPublisher;
|
||||
private final FarmRecordEventPublisher farmRecordEventPublisher;
|
||||
|
||||
public CropFarmingCenterServiceImpl(SpeciesLibraryMapper speciesLibraryMapper, PersonnelManagementMapper personnelManagementMapper, BaseInfoMapper baseInfoMapper, PlotInfoMapper plotInfoMapper, ProductionPlanMapper productionPlanMapper,
|
||||
ProductionPlanUsedGridMapper productionPlanUsedGridMapperMapper, FarmingRecordMapper farmingRecordMapper, InputUsageRecordsMapper inputUsageRecordsMapper, ModelManagementService modelManagementService,
|
||||
FarmingRecordService farmingRecordService,
|
||||
FarmingRecordInputService farmingRecordInputService, PlotInfoService plotInfoService, SpeciesLibraryService speciesLibraryService, FarmingTypeMaintenanceService farmingTypeMaintenanceService, FarmingNameMaintenanceService farmingNameMaintenanceService, DictDataService dictDataService, GridEventPublisher gridEventPublisher, ProductionPlanService productionPlanService, FarmRecordEventPublisher farmRecordEventPublisher) {
|
||||
public CropFarmingCenterServiceImpl(SpeciesLibraryMapper speciesLibraryMapper, BaseInfoMapper baseInfoMapper, PlotInfoMapper plotInfoMapper, ProductionPlanMapper productionPlanMapper, ProductionPlanUsedGridMapper productionPlanUsedGridMapperMapper, FarmingRecordMapper farmingRecordMapper, InputUsageRecordsMapper inputUsageRecordsMapper, ModelManagementService modelManagementService, FarmingRecordService farmingRecordService, FarmingRecordInputService farmingRecordInputService, PlotInfoService plotInfoService, SpeciesLibraryService speciesLibraryService, FarmingTypeMaintenanceService farmingTypeMaintenanceService, FarmingNameMaintenanceService farmingNameMaintenanceService, DictDataService dictDataService, ProductionPlanService productionPlanService, AdminUserService adminUserService, GridEventPublisher gridEventPublisher, FarmRecordEventPublisher farmRecordEventPublisher) {
|
||||
this.speciesLibraryMapper = speciesLibraryMapper;
|
||||
this.personnelManagementMapper = personnelManagementMapper;
|
||||
this.baseInfoMapper = baseInfoMapper;
|
||||
this.plotInfoMapper = plotInfoMapper;
|
||||
this.productionPlanMapper = productionPlanMapper;
|
||||
@@ -119,9 +114,9 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
this.farmingTypeMaintenanceService = farmingTypeMaintenanceService;
|
||||
this.farmingNameMaintenanceService = farmingNameMaintenanceService;
|
||||
this.dictDataService = dictDataService;
|
||||
|
||||
this.gridEventPublisher = gridEventPublisher;
|
||||
this.productionPlanService = productionPlanService;
|
||||
this.adminUserService = adminUserService;
|
||||
this.gridEventPublisher = gridEventPublisher;
|
||||
this.farmRecordEventPublisher = farmRecordEventPublisher;
|
||||
}
|
||||
|
||||
@@ -263,7 +258,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
if (productionPlanDO == null) {
|
||||
throw exception(PRODUCTION_PLAN_NOT_EXISTS);
|
||||
}
|
||||
Map<String, String> employeeNameMap = personnelManagementMapper.selectList().stream().collect(toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
||||
Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
ModelManagementRespVO modelManagementRespVO = modelManagementService.getModelManagement(productionPlanDO.getSpeciesModelId());
|
||||
|
||||
ProductionPlanRespVO productionPlanRespVO = BeanUtils.toBean(productionPlanDO, ProductionPlanRespVO.class);
|
||||
@@ -311,20 +306,6 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
e.setPlanOverview(planOverview);
|
||||
});
|
||||
|
||||
// 响应结构包装 (包装成符合前端需要的格式)
|
||||
// List<ProductionPlanPageRespVO> collect = resultData.getList().stream()
|
||||
// .collect(Collectors.groupingBy(plan -> new AbstractMap.SimpleEntry<>(plan.getBaseId(), plan.getBaseName()), Collectors.toList()))
|
||||
// .entrySet().stream()
|
||||
// .map(entry -> {
|
||||
// ProductionPlanPageRespVO groupedVO = new ProductionPlanPageRespVO();
|
||||
// groupedVO.setBaseId(entry.getKey().getKey());
|
||||
// groupedVO.setBaseName(entry.getKey().getValue());
|
||||
// groupedVO.setPlans(entry.getValue());
|
||||
// return groupedVO;
|
||||
// })
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// long size = collect.size();
|
||||
return resultData;
|
||||
|
||||
}
|
||||
@@ -332,7 +313,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
||||
@Override
|
||||
public PageResult<ProductionPlanResp2VO> getProductionPlanPage2(ProductionPlanPage2ReqVO reqVO) {
|
||||
Map<String, String> speciesNameMap = speciesLibraryMapper.selectList().stream().collect(toMap(SpeciesLibraryDO::getId, SpeciesLibraryDO::getCultivarName, (v1, v2) -> v1));
|
||||
Map<String, String> employeeNameMap = personnelManagementMapper.selectList().stream().collect(toMap(PersonnelManagementDO::getId, PersonnelManagementDO::getName, (v1, v2) -> v1));
|
||||
Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
|
||||
reqVO.setTenantId(getLoginUser().getTenantId().toString());
|
||||
PageResult<ProductionPlanDO> productionPlanDOPageResult = productionPlanMapper.selectPage2(reqVO);
|
||||
|
||||
@@ -19,13 +19,13 @@ import cn.iocoder.yudao.module.farm.service.cropFarmingCenter.CropFarmingCenterS
|
||||
import cn.iocoder.yudao.module.farm.service.deviceinfo.DeviceInfoService;
|
||||
import cn.iocoder.yudao.module.farm.service.farmingrecord.FarmingRecordService;
|
||||
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotInfoService;
|
||||
import cn.iocoder.yudao.module.farm.service.plotinfo.PlotLesseeService;
|
||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||
import cn.iocoder.yudao.module.farm.service.specieslibrary.SpeciesLibraryService;
|
||||
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
||||
import cn.iocoder.yudao.module.farm.utils.LeafletjsUtil;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -51,19 +51,19 @@ public class HomeServiceImpl implements HomeService {
|
||||
private final PlotInfoService plotInfoService;
|
||||
private final ProductionPlanService productionPlanService;
|
||||
private final CropFarmingCenterService cropFarmingCenterService;
|
||||
private final PersonnelManagementService personnelManagementService;
|
||||
private final AdminUserService adminUserService;
|
||||
private final ModelManagementService modelManagementService;
|
||||
private final SpeciesLibraryService speciesLibraryService;
|
||||
private final FarmingRecordService farmingRecordService;
|
||||
private final DeviceInfoService deviceService;
|
||||
private final PlotLesseeService plotLesseeService;
|
||||
|
||||
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, CropFarmingCenterService cropFarmingCenterService, PersonnelManagementService personnelManagementService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService, FarmingRecordService farmingRecordService, DeviceInfoService deviceService, PlotLesseeService plotLesseeService) {
|
||||
public HomeServiceImpl(BaseInfoService baseInfoService, PlotInfoService plotInfoService, ProductionPlanService productionPlanService, CropFarmingCenterService cropFarmingCenterService, AdminUserService adminUserService, ModelManagementService modelManagementService, SpeciesLibraryService speciesLibraryService, FarmingRecordService farmingRecordService, DeviceInfoService deviceService, PlotLesseeService plotLesseeService) {
|
||||
this.baseInfoService = baseInfoService;
|
||||
this.plotInfoService = plotInfoService;
|
||||
this.productionPlanService = productionPlanService;
|
||||
this.cropFarmingCenterService = cropFarmingCenterService;
|
||||
this.personnelManagementService = personnelManagementService;
|
||||
this.adminUserService = adminUserService;
|
||||
this.modelManagementService = modelManagementService;
|
||||
this.speciesLibraryService = speciesLibraryService;
|
||||
this.farmingRecordService = farmingRecordService;
|
||||
@@ -80,7 +80,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
@Override
|
||||
public HomeInfo getHomeInfo(String baseId) {
|
||||
// 员工集合 <id,name>
|
||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||
Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
|
||||
// 基地概要信息
|
||||
BaseOverviewInfo baseOverviewInfo = null;
|
||||
@@ -106,7 +106,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
@Override
|
||||
public HomeInfo getHomeInfoPlus(String baseId) {
|
||||
// 员工集合 <id,name>
|
||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||
// Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
|
||||
// 基地集合
|
||||
List<HomeInfo.BaseInfo> baseList = new ArrayList<>();
|
||||
@@ -120,7 +120,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
@Override
|
||||
public PlotInfo getPlotInfo(String plotId) {
|
||||
// 员工集合 <id,name>
|
||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||
Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
|
||||
PlotInfoDO pObj = plotInfoService.getPlotInfo(plotId);
|
||||
BaseInfoDO bOjb = baseInfoService.getBaseInfo(pObj.getBaseId());
|
||||
@@ -206,7 +206,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
}
|
||||
|
||||
private BaseOverviewInfo getBaseOverviewInfo(BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
|
||||
String employeeName= personnelManagementService.getEmployeeNameMap(employeeNameMap,baseObj.getManager());
|
||||
String employeeName= adminUserService.getNickNameStrLink(baseObj.getManager());
|
||||
int growingPlotCount = productionPlanService.getGrowingPlotCount(baseObj.getId());
|
||||
int growingCropCount = productionPlanService.getGrowingCropCount(baseObj.getId());
|
||||
List<PlotInfoDO> plotInfos = plotInfoService.getPlotInfos(baseObj.getId());
|
||||
@@ -231,7 +231,7 @@ public class HomeServiceImpl implements HomeService {
|
||||
private List<PlotPopupFrame> getPlotPopupFrame(String plotId, Map<String, String> employeeNameMap) {
|
||||
List<PlotPopupFrame> targetList = new ArrayList<>();
|
||||
PlotInfoDO e = plotInfoService.getPlotInfo(plotId);
|
||||
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
||||
String employeeName = adminUserService.getNickNameStrLink(e.getEmployeeId());
|
||||
String beingPlotArea = productionPlanService.getBeingPlotArea(e.getPlotId(), e.getPlotArea());
|
||||
String beingCropName = productionPlanService.getBeingCropName(e.getPlotId());
|
||||
|
||||
@@ -270,13 +270,13 @@ public class HomeServiceImpl implements HomeService {
|
||||
totalArea = (int) Math.round(temp);
|
||||
}
|
||||
|
||||
int personnelCount = personnelManagementService.personnelCount(user.getTenantId()); // 在职人员
|
||||
int personnelCount = adminUserService.countUser();
|
||||
return new BaseOverviewInfo("",baseCount,cropCount,totalArea,personnelCount);
|
||||
}
|
||||
|
||||
|
||||
private PlotInfo getPlotInfo(PlotInfoDO e, BaseInfoDO baseObj, Map<String, String> employeeNameMap) {
|
||||
String employeeName = personnelManagementService.getEmployeeNameMap(employeeNameMap, e.getEmployeeId());
|
||||
String employeeName = adminUserService.getNickNameStrLink(e.getEmployeeId());
|
||||
// 地块详情 (包含计划信息)
|
||||
PlotOrCropInfo plotOrCropInfo = this.getPlotOrCropInfoList(e,"地块详情",employeeName);
|
||||
// 地块浮框信息
|
||||
|
||||
@@ -9,14 +9,10 @@ import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.personnelm
|
||||
import cn.iocoder.yudao.module.farm.controller.admin.managementcenter.personnelmanagement.vo.PersonnelManagementSaveReqVO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.SystemUserDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.SystemUserRoleDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.SystemUserMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.SystemUserRoleMapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -40,12 +36,12 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
|
||||
@Resource
|
||||
private PersonnelManagementMapper personnelManagementMapper;
|
||||
@Resource
|
||||
private SystemUserMapper userMapper;
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
@Resource
|
||||
private SystemUserRoleMapper systemUserRoleMapper;
|
||||
// @Resource
|
||||
// private SystemUserMapper userMapper;
|
||||
// @Resource
|
||||
// private PasswordEncoder passwordEncoder;
|
||||
// @Resource
|
||||
// private SystemUserRoleMapper systemUserRoleMapper;
|
||||
|
||||
@Override
|
||||
public String createPersonnelManagement(PersonnelManagementSaveReqVO createReqVO) {
|
||||
@@ -55,10 +51,10 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
PersonnelManagementDO personnelManagement = BeanUtils.toBean(createReqVO, PersonnelManagementDO.class);
|
||||
personnelManagement.setId(IdUtil.fastUUID());
|
||||
personnelManagement.setTenantId(String.valueOf(user.getTenantId()));
|
||||
SystemUserDO userDO = userMapper.selectByPhone(personnelManagement.getPhone());
|
||||
if (userDO != null) {
|
||||
return "";
|
||||
}
|
||||
// SystemUserDO userDO = userMapper.selectByPhone(personnelManagement.getPhone());
|
||||
// if (userDO != null) {
|
||||
// return "";
|
||||
// }
|
||||
// 处理图片集合转换
|
||||
handleImageConversion(personnelManagement, createReqVO);
|
||||
|
||||
@@ -69,16 +65,16 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
adminUserDO.setAvatar(personnelManagement.getPicture());
|
||||
adminUserDO.setTenantId(user.getTenantId());
|
||||
adminUserDO.setStatus(CommonStatusEnum.ENABLE.getStatus()); // 默认开启
|
||||
String substring = personnelManagement.getPhone().substring(personnelManagement.getPhone().length() - 6);
|
||||
adminUserDO.setPassword(encodePassword(substring)); // 加密密码
|
||||
userMapper.insert(adminUserDO);// 系统用户同步新增
|
||||
// String substring = personnelManagement.getPhone().substring(personnelManagement.getPhone().length() - 6);
|
||||
// adminUserDO.setPassword(encodePassword(substring)); // 加密密码
|
||||
// userMapper.insert(adminUserDO);// 系统用户同步新增
|
||||
// 用户角色关联
|
||||
for (String s : personnelManagement.getRole().split(",")) {
|
||||
SystemUserRoleDO userRoleDO = new SystemUserRoleDO();
|
||||
userRoleDO.setUserId(adminUserDO.getId());
|
||||
userRoleDO.setRoleId(Long.valueOf(s));
|
||||
systemUserRoleMapper.insert(userRoleDO);
|
||||
}
|
||||
// for (String s : personnelManagement.getRole().split(",")) {
|
||||
// SystemUserRoleDO userRoleDO = new SystemUserRoleDO();
|
||||
// userRoleDO.setUserId(adminUserDO.getId());
|
||||
// userRoleDO.setRoleId(Long.valueOf(s));
|
||||
// systemUserRoleMapper.insert(userRoleDO);
|
||||
// }
|
||||
personnelManagementMapper.insert(personnelManagement);
|
||||
// 返回
|
||||
return personnelManagement.getId();
|
||||
@@ -93,20 +89,20 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
|
||||
// 更新
|
||||
PersonnelManagementDO updateObj = BeanUtils.toBean(updateReqVO, PersonnelManagementDO.class);
|
||||
SystemUserDO userDO = userMapper.selectByPhone(managementDO.getPhone());
|
||||
if (updateReqVO.getPhone() != null) userDO.setUsername(updateReqVO.getPhone());
|
||||
if (updateReqVO.getPhone() != null) userDO.setMobile(updateReqVO.getPhone());
|
||||
if (updateReqVO.getName() != null) userDO.setNickname(updateReqVO.getName());
|
||||
if (updateReqVO.getPicture() != null) userDO.setAvatar(updateReqVO.getPicture());
|
||||
// SystemUserDO userDO = userMapper.selectByPhone(managementDO.getPhone());
|
||||
// if (updateReqVO.getPhone() != null) userDO.setUsername(updateReqVO.getPhone());
|
||||
// if (updateReqVO.getPhone() != null) userDO.setMobile(updateReqVO.getPhone());
|
||||
// if (updateReqVO.getName() != null) userDO.setNickname(updateReqVO.getName());
|
||||
// if (updateReqVO.getPicture() != null) userDO.setAvatar(updateReqVO.getPicture());
|
||||
// 处理图片集合转换
|
||||
handleImageConversion(updateObj, updateReqVO);
|
||||
for (String s : managementDO.getRole().split(",")) {
|
||||
SystemUserRoleDO userRoleDO = new SystemUserRoleDO();
|
||||
userRoleDO.setUserId(userDO.getId());
|
||||
userRoleDO.setRoleId(Long.valueOf(s));
|
||||
systemUserRoleMapper.insert(userRoleDO);
|
||||
}
|
||||
userMapper.updateById(userDO);
|
||||
// for (String s : managementDO.getRole().split(",")) {
|
||||
// SystemUserRoleDO userRoleDO = new SystemUserRoleDO();
|
||||
// userRoleDO.setUserId(userDO.getId());
|
||||
// userRoleDO.setRoleId(Long.valueOf(s));
|
||||
// systemUserRoleMapper.insert(userRoleDO);
|
||||
// }
|
||||
// userMapper.updateById(userDO);
|
||||
personnelManagementMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@@ -115,9 +111,9 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
// 校验存在
|
||||
validatePersonnelManagementExists(id);
|
||||
PersonnelManagementDO managementDO = personnelManagementMapper.selectById(id);
|
||||
SystemUserDO userDO = userMapper.selectByPhone(managementDO.getPhone());
|
||||
userMapper.deleteById(userDO.getId());
|
||||
systemUserRoleMapper.delete(SystemUserRoleDO::getUserId, userDO.getId());
|
||||
// SystemUserDO userDO = userMapper.selectByPhone(managementDO.getPhone());
|
||||
// userMapper.deleteById(userDO.getId());
|
||||
// systemUserRoleMapper.delete(SystemUserRoleDO::getUserId, userDO.getId());
|
||||
// 删除
|
||||
personnelManagementMapper.deleteById(id);
|
||||
}
|
||||
@@ -167,10 +163,10 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
@Override
|
||||
public void reset(PersonnelManagementSaveReqVO updateReqVO) {
|
||||
PersonnelManagementDO managementDO = personnelManagementMapper.selectById(updateReqVO.getId());
|
||||
SystemUserDO userDO = userMapper.selectByPhone(managementDO.getPhone());
|
||||
String substring = userDO.getMobile().substring(userDO.getMobile().length() - 6);
|
||||
userDO.setPassword(encodePassword(substring)); // 加密密码
|
||||
userMapper.updateById(userDO);
|
||||
// SystemUserDO userDO = userMapper.selectByPhone(managementDO.getPhone());
|
||||
// String substring = userDO.getMobile().substring(userDO.getMobile().length() - 6);
|
||||
// userDO.setPassword(encodePassword(substring)); // 加密密码
|
||||
// userMapper.updateById(userDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,15 +192,15 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对密码进行加密
|
||||
*
|
||||
* @param password 密码
|
||||
* @return 加密后的密码
|
||||
*/
|
||||
private String encodePassword(String password) {
|
||||
return passwordEncoder.encode(password);
|
||||
}
|
||||
// /**
|
||||
// * 对密码进行加密
|
||||
// *
|
||||
// * @param password 密码
|
||||
// * @return 加密后的密码
|
||||
// */
|
||||
// private String encodePassword(String password) {
|
||||
// return passwordEncoder.encode(password);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Map<String, String> getEmployeeNameMap() {
|
||||
|
||||
@@ -13,9 +13,9 @@ import cn.iocoder.yudao.module.farm.dal.dataobject.plotinfo.PlotInfoDO;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.baseinfo.BaseInfoMapper;
|
||||
import cn.iocoder.yudao.module.farm.dal.mysql.plotinfo.PlotInfoMapper;
|
||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||
import cn.iocoder.yudao.module.farm.service.personnelmanagement.PersonnelManagementService;
|
||||
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||
import cn.iocoder.yudao.module.farm.utils.BigDecimalUtil;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -44,18 +44,19 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
|
||||
private final BaseInfoMapper baseInfoMapper;
|
||||
private final PlotInfoMapper plotInfoMapper;
|
||||
|
||||
private final AdminUserService adminUserService;
|
||||
private final PlotInfoCacheService pCatchService;
|
||||
private final PlotLesseeService plotLesseeService;
|
||||
private final ProductionPlanService productionPlanService;
|
||||
private final PersonnelManagementService personnelManagementService;
|
||||
private final PlotInfoCacheService pCatchService;
|
||||
|
||||
public PlotInfoServiceImpl(BaseInfoMapper baseInfoMapper, PlotInfoMapper plotInfoMapper, PlotLesseeService plotLesseeService, ProductionPlanService productionPlanService, PersonnelManagementService personnelManagementService, PlotInfoCacheService pCatchService) {
|
||||
public PlotInfoServiceImpl(BaseInfoMapper baseInfoMapper, PlotInfoMapper plotInfoMapper, AdminUserService adminUserService, PlotInfoCacheService pCatchService, PlotLesseeService plotLesseeService, ProductionPlanService productionPlanService) {
|
||||
this.baseInfoMapper = baseInfoMapper;
|
||||
this.plotInfoMapper = plotInfoMapper;
|
||||
this.adminUserService = adminUserService;
|
||||
this.pCatchService = pCatchService;
|
||||
this.plotLesseeService = plotLesseeService;
|
||||
this.productionPlanService = productionPlanService;
|
||||
this.personnelManagementService = personnelManagementService;
|
||||
this.pCatchService = pCatchService;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@@ -151,7 +152,7 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
List<PlotInfoDO> list = this.getPlotInfosByCatch(baseId);
|
||||
|
||||
// 员工集合 <id,name>
|
||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||
Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
list.forEach(e -> {
|
||||
e.setEmployeeName(employeeNameMap.get(e.getEmployeeId()));
|
||||
e.setManager(employeeNameMap.get(e.getEmployeeId()));
|
||||
@@ -166,7 +167,7 @@ public class PlotInfoServiceImpl implements PlotInfoService {
|
||||
List<PlotInfoDO> list = this.getPlotInfosByCatch(baseId);
|
||||
|
||||
// 员工集合 <id,name>
|
||||
Map<String, String> employeeNameMap = personnelManagementService.getEmployeeNameMap();
|
||||
Map<String, String> employeeNameMap = adminUserService.getIdAndNickNameMap();
|
||||
list.forEach(e -> {
|
||||
e.setEmployeeName(employeeNameMap.get(e.getEmployeeId()));
|
||||
e.setManager(employeeNameMap.get(e.getEmployeeId()));
|
||||
|
||||
@@ -348,7 +348,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
|
||||
.mapToDouble(ProductionPlanDO::getPredictedArea)
|
||||
.sum();
|
||||
|
||||
if (ObjectUtils.isEmpty(totalArea)) {
|
||||
|
||||
|
||||
if (ObjectUtils.isEmpty(totalArea) || ObjectUtils.isEmpty(plotArea)) {
|
||||
return "0 亩";
|
||||
} else {
|
||||
return (int) Math.round(totalArea) + "/" +plotArea.intValue()+ "亩";
|
||||
|
||||
Reference in New Issue
Block a user