farm模块-用户完善
This commit is contained in:
@@ -133,6 +133,12 @@
|
|||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-websocket</artifactId>
|
<artifactId>spring-websocket</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.iocoder.boot</groupId>
|
||||||
|
<artifactId>yudao-module-system</artifactId>
|
||||||
|
<version>2025.08-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- MongoDB -->
|
<!-- MongoDB -->
|
||||||
<!-- <dependency>-->
|
<!-- <dependency>-->
|
||||||
|
|||||||
@@ -42,60 +42,60 @@ public class DisasterDataController {
|
|||||||
@Resource
|
@Resource
|
||||||
private DisasterDataService disasterDataService;
|
private DisasterDataService disasterDataService;
|
||||||
|
|
||||||
// @PostMapping("/create")
|
@PostMapping("/create")
|
||||||
// @Operation(summary = "创建灾害数据")
|
@Operation(summary = "创建灾害数据")
|
||||||
// public CommonResult<String> createDisasterData(@Valid @RequestBody DisasterDataSaveReqVO createReqVO) {
|
public CommonResult<String> createDisasterData(@Valid @RequestBody DisasterDataSaveReqVO createReqVO) {
|
||||||
// return success(disasterDataService.createDisasterData(createReqVO));
|
return success(disasterDataService.createDisasterData(createReqVO));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @PutMapping("/update")
|
@PutMapping("/update")
|
||||||
// @Operation(summary = "更新灾害数据")
|
@Operation(summary = "更新灾害数据")
|
||||||
// public CommonResult<Boolean> updateDisasterData(@Valid @RequestBody DisasterDataSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateDisasterData(@Valid @RequestBody DisasterDataSaveReqVO updateReqVO) {
|
||||||
// disasterDataService.updateDisasterData(updateReqVO);
|
disasterDataService.updateDisasterData(updateReqVO);
|
||||||
// return success(true);
|
return success(true);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
// @Operation(summary = "删除灾害数据")
|
@Operation(summary = "删除灾害数据")
|
||||||
// @Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
// public CommonResult<Boolean> deleteDisasterData(@RequestParam("id") String id) {
|
public CommonResult<Boolean> deleteDisasterData(@RequestParam("id") String id) {
|
||||||
// disasterDataService.deleteDisasterData(id);
|
disasterDataService.deleteDisasterData(id);
|
||||||
// return success(true);
|
return success(true);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @DeleteMapping("/delete-list")
|
@DeleteMapping("/delete-list")
|
||||||
// @Parameter(name = "ids", description = "编号", required = true)
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
// @Operation(summary = "批量删除灾害数据")
|
@Operation(summary = "批量删除灾害数据")
|
||||||
// public CommonResult<Boolean> deleteDisasterDataList(@RequestParam("ids") List<String> ids) {
|
public CommonResult<Boolean> deleteDisasterDataList(@RequestParam("ids") List<String> ids) {
|
||||||
// disasterDataService.deleteDisasterDataListByIds(ids);
|
disasterDataService.deleteDisasterDataListByIds(ids);
|
||||||
// return success(true);
|
return success(true);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @GetMapping("/get")
|
@GetMapping("/get")
|
||||||
// @Operation(summary = "获得灾害数据")
|
@Operation(summary = "获得灾害数据")
|
||||||
// @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
// public CommonResult<DisasterDataRespVO> getDisasterData(@RequestParam("id") String id) {
|
public CommonResult<DisasterDataRespVO> getDisasterData(@RequestParam("id") String id) {
|
||||||
// DisasterDataDO disasterData = disasterDataService.getDisasterData(id);
|
DisasterDataDO disasterData = disasterDataService.getDisasterData(id);
|
||||||
// return success(BeanUtils.toBean(disasterData, DisasterDataRespVO.class));
|
return success(BeanUtils.toBean(disasterData, DisasterDataRespVO.class));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @GetMapping("/page")
|
@GetMapping("/page")
|
||||||
// @Operation(summary = "获得灾害数据分页")
|
@Operation(summary = "获得灾害数据分页")
|
||||||
// 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));
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
// @Operation(summary = "导出灾害数据 Excel")
|
@Operation(summary = "导出灾害数据 Excel")
|
||||||
// @ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
// public void exportDisasterDataExcel(@Valid DisasterDataPageReqVO pageReqVO,
|
public void exportDisasterDataExcel(@Valid DisasterDataPageReqVO pageReqVO,
|
||||||
// HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
// pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
// List<DisasterDataDO> list = disasterDataService.getDisasterDataPage(pageReqVO).getList();
|
List<DisasterDataDO> list = disasterDataService.getDisasterDataPage(pageReqVO).getList();
|
||||||
// // 导出 Excel
|
// 导出 Excel
|
||||||
// ExcelUtils.write(response, "灾害数据.xls", "数据", DisasterDataRespVO.class,
|
ExcelUtils.write(response, "灾害数据.xls", "数据", DisasterDataRespVO.class,
|
||||||
// BeanUtils.toBean(list, DisasterDataRespVO.class));
|
BeanUtils.toBean(list, DisasterDataRespVO.class));
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata;
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import jakarta.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.screendisasterdata.ScreenDisasterDataDO;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.screendisasterdata.ScreenDisasterDataService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 大屏数据-灾害数据")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/farm/screen-disaster-data")
|
||||||
|
@Validated
|
||||||
|
public class ScreenDisasterDataController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScreenDisasterDataService screenDisasterDataService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建大屏数据-灾害数据")
|
||||||
|
@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')")
|
||||||
|
public CommonResult<Boolean> updateScreenDisasterData(@Valid @RequestBody ScreenDisasterDataSaveReqVO updateReqVO) {
|
||||||
|
screenDisasterDataService.updateScreenDisasterData(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除大屏数据-灾害数据")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:delete')")
|
||||||
|
public CommonResult<Boolean> deleteScreenDisasterData(@RequestParam("id") String id) {
|
||||||
|
screenDisasterDataService.deleteScreenDisasterData(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除大屏数据-灾害数据")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:delete')")
|
||||||
|
public CommonResult<Boolean> deleteScreenDisasterDataList(@RequestParam("ids") List<String> ids) {
|
||||||
|
screenDisasterDataService.deleteScreenDisasterDataListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得大屏数据-灾害数据")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@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));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得大屏数据-灾害数据分页")
|
||||||
|
@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));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出大屏数据-灾害数据 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('farm:screen-disaster-data:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportScreenDisasterDataExcel(@Valid ScreenDisasterDataPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<ScreenDisasterDataDO> list = screenDisasterDataService.getScreenDisasterDataPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "大屏数据-灾害数据.xls", "数据", ScreenDisasterDataRespVO.class,
|
||||||
|
BeanUtils.toBean(list, ScreenDisasterDataRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 大屏数据-灾害数据分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ScreenDisasterDataPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "基地id", example = "13308")
|
||||||
|
private String baseId;
|
||||||
|
|
||||||
|
@Schema(description = "基地", example = "赵六")
|
||||||
|
private String baseName;
|
||||||
|
|
||||||
|
@Schema(description = "租户id", example = "20837")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "灾害名称", example = "张三")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "灾害类型")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@Schema(description = "发生次数", example = "22355")
|
||||||
|
private Integer disasterCount;
|
||||||
|
|
||||||
|
@Schema(description = "发生月份")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private String[] disasterTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
@Schema(description = "使用状态 (1:启用; 0: 停用)", example = "1")
|
||||||
|
private Integer useStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import cn.idev.excel.annotation.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 大屏数据-灾害数据 Response VO")
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
public class ScreenDisasterDataRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5690")
|
||||||
|
@ExcelProperty("id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "基地id", example = "13308")
|
||||||
|
@ExcelProperty("基地id")
|
||||||
|
private String baseId;
|
||||||
|
|
||||||
|
@Schema(description = "基地", example = "赵六")
|
||||||
|
@ExcelProperty("基地")
|
||||||
|
private String baseName;
|
||||||
|
|
||||||
|
@Schema(description = "灾害名称", example = "张三")
|
||||||
|
@ExcelProperty("灾害名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "灾害类型")
|
||||||
|
@ExcelProperty("灾害类型")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@Schema(description = "发生次数", example = "22355")
|
||||||
|
@ExcelProperty("发生次数")
|
||||||
|
private Integer disasterCount;
|
||||||
|
|
||||||
|
@Schema(description = "发生月份")
|
||||||
|
@ExcelProperty("发生月份")
|
||||||
|
private String disasterTime;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Schema(description = "使用状态 (1:启用; 0: 停用)", example = "1")
|
||||||
|
@ExcelProperty("使用状态 (1:启用; 0: 停用)")
|
||||||
|
private Integer useStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 大屏数据-灾害数据新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class ScreenDisasterDataSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "5690")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "基地id", example = "13308")
|
||||||
|
private String baseId;
|
||||||
|
|
||||||
|
@Schema(description = "基地", example = "赵六")
|
||||||
|
private String baseName;
|
||||||
|
|
||||||
|
@Schema(description = "租户id", example = "20837")
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "灾害名称", example = "张三")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "灾害类型")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
@Schema(description = "发生次数", example = "22355")
|
||||||
|
private Integer disasterCount;
|
||||||
|
|
||||||
|
@Schema(description = "发生月份")
|
||||||
|
private String disasterTime;
|
||||||
|
|
||||||
|
@Schema(description = "使用状态 (1:启用; 0: 停用)", example = "1")
|
||||||
|
private Integer useStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -44,14 +44,12 @@ public class VarietyDataController {
|
|||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建品种数据")
|
@Operation(summary = "创建品种数据")
|
||||||
|
|
||||||
public CommonResult<String> createVarietyData(@Valid @RequestBody VarietyDataSaveReqVO createReqVO) {
|
public CommonResult<String> createVarietyData(@Valid @RequestBody VarietyDataSaveReqVO createReqVO) {
|
||||||
return success(varietyDataService.createVarietyData(createReqVO));
|
return success(varietyDataService.createVarietyData(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@Operation(summary = "更新品种数据")
|
@Operation(summary = "更新品种数据")
|
||||||
|
|
||||||
public CommonResult<Boolean> updateVarietyData(@Valid @RequestBody VarietyDataSaveReqVO updateReqVO) {
|
public CommonResult<Boolean> updateVarietyData(@Valid @RequestBody VarietyDataSaveReqVO updateReqVO) {
|
||||||
varietyDataService.updateVarietyData(updateReqVO);
|
varietyDataService.updateVarietyData(updateReqVO);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -60,7 +58,6 @@ public class VarietyDataController {
|
|||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@Operation(summary = "删除品种数据")
|
@Operation(summary = "删除品种数据")
|
||||||
@Parameter(name = "id", description = "编号", required = true)
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
|
||||||
public CommonResult<Boolean> deleteVarietyData(@RequestParam("id") String id) {
|
public CommonResult<Boolean> deleteVarietyData(@RequestParam("id") String id) {
|
||||||
varietyDataService.deleteVarietyData(id);
|
varietyDataService.deleteVarietyData(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -69,7 +66,6 @@ public class VarietyDataController {
|
|||||||
@DeleteMapping("/delete-list")
|
@DeleteMapping("/delete-list")
|
||||||
@Parameter(name = "ids", description = "编号", required = true)
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
@Operation(summary = "批量删除品种数据")
|
@Operation(summary = "批量删除品种数据")
|
||||||
|
|
||||||
public CommonResult<Boolean> deleteVarietyDataList(@RequestParam("ids") List<String> ids) {
|
public CommonResult<Boolean> deleteVarietyDataList(@RequestParam("ids") List<String> ids) {
|
||||||
varietyDataService.deleteVarietyDataListByIds(ids);
|
varietyDataService.deleteVarietyDataListByIds(ids);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -78,7 +74,6 @@ public class VarietyDataController {
|
|||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@Operation(summary = "获得品种数据")
|
@Operation(summary = "获得品种数据")
|
||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
|
||||||
public CommonResult<VarietyDataRespVO> getVarietyData(@RequestParam("id") String id) {
|
public CommonResult<VarietyDataRespVO> getVarietyData(@RequestParam("id") String id) {
|
||||||
VarietyDataDO varietyData = varietyDataService.getVarietyData(id);
|
VarietyDataDO varietyData = varietyDataService.getVarietyData(id);
|
||||||
return success(BeanUtils.toBean(varietyData, VarietyDataRespVO.class));
|
return success(BeanUtils.toBean(varietyData, VarietyDataRespVO.class));
|
||||||
@@ -86,7 +81,6 @@ public class VarietyDataController {
|
|||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得品种数据分页")
|
@Operation(summary = "获得品种数据分页")
|
||||||
|
|
||||||
public CommonResult<PageResult<VarietyDataRespVO>> getVarietyDataPage(@Valid VarietyDataPageReqVO pageReqVO) {
|
public CommonResult<PageResult<VarietyDataRespVO>> getVarietyDataPage(@Valid VarietyDataPageReqVO pageReqVO) {
|
||||||
PageResult<VarietyDataDO> pageResult = varietyDataService.getVarietyDataPage(pageReqVO);
|
PageResult<VarietyDataDO> pageResult = varietyDataService.getVarietyDataPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, VarietyDataRespVO.class));
|
return success(BeanUtils.toBean(pageResult, VarietyDataRespVO.class));
|
||||||
@@ -94,7 +88,6 @@ public class VarietyDataController {
|
|||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@Operation(summary = "导出品种数据 Excel")
|
@Operation(summary = "导出品种数据 Excel")
|
||||||
|
|
||||||
@ApiAccessLog(operateType = EXPORT)
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
public void exportVarietyDataExcel(@Valid VarietyDataPageReqVO pageReqVO,
|
public void exportVarietyDataExcel(@Valid VarietyDataPageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.dataobject.screendisasterdata;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏数据-灾害数据 DO
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
@TableName("farm_screen_disaster_data")
|
||||||
|
@KeySequence("farm_screen_disaster_data_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ScreenDisasterDataDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.INPUT)
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 基地id
|
||||||
|
*/
|
||||||
|
private String baseId;
|
||||||
|
/**
|
||||||
|
* 基地
|
||||||
|
*/
|
||||||
|
private String baseName;
|
||||||
|
/**
|
||||||
|
* 灾害名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 灾害类型
|
||||||
|
*/
|
||||||
|
private String category;
|
||||||
|
/**
|
||||||
|
* 发生次数
|
||||||
|
*/
|
||||||
|
private Integer disasterCount;
|
||||||
|
/**
|
||||||
|
* 发生月份
|
||||||
|
*/
|
||||||
|
private String disasterTime;
|
||||||
|
/**
|
||||||
|
* 使用状态 (1:启用; 0: 停用)
|
||||||
|
*/
|
||||||
|
private Integer useStatus;
|
||||||
|
|
||||||
|
private String tenantId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.dal.mysql.screendisasterdata;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.screendisasterdata.ScreenDisasterDataDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏数据-灾害数据 Mapper
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface ScreenDisasterDataMapper extends BaseMapperX<ScreenDisasterDataDO> {
|
||||||
|
|
||||||
|
default PageResult<ScreenDisasterDataDO> selectPage(ScreenDisasterDataPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<ScreenDisasterDataDO>()
|
||||||
|
.eqIfPresent(ScreenDisasterDataDO::getBaseId, reqVO.getBaseId())
|
||||||
|
.likeIfPresent(ScreenDisasterDataDO::getBaseName, reqVO.getBaseName())
|
||||||
|
.eqIfPresent(ScreenDisasterDataDO::getTenantId, reqVO.getTenantId())
|
||||||
|
.likeIfPresent(ScreenDisasterDataDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(ScreenDisasterDataDO::getCategory, reqVO.getCategory())
|
||||||
|
.eqIfPresent(ScreenDisasterDataDO::getDisasterCount, reqVO.getDisasterCount())
|
||||||
|
.betweenIfPresent(ScreenDisasterDataDO::getDisasterTime, reqVO.getDisasterTime())
|
||||||
|
.betweenIfPresent(ScreenDisasterDataDO::getCreateTime, reqVO.getCreateTime())
|
||||||
|
.eqIfPresent(ScreenDisasterDataDO::getUseStatus, reqVO.getUseStatus())
|
||||||
|
.orderByDesc(ScreenDisasterDataDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -106,5 +106,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode TRACEABILITY_CODE_NOT_EXISTS = new ErrorCode(1_050_031_000, "溯源码不存在");
|
ErrorCode TRACEABILITY_CODE_NOT_EXISTS = new ErrorCode(1_050_031_000, "溯源码不存在");
|
||||||
|
|
||||||
// ========== 模型管理 1_050_032_000 ==========
|
// ========== 模型管理 1_050_032_000 ==========
|
||||||
ErrorCode QR_CODE_WRITE_FAILED = new ErrorCode(1_050_032_000, "生成二维码失败");
|
ErrorCode SCREEN_DISASTER_DATA_NOT_EXISTS = new ErrorCode(1_050_032_000, "灾害数据不存在");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,11 @@ import cn.iocoder.yudao.module.farm.controller.admin.modelmanagement.vo.ModelMan
|
|||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.productionplan.ProductionPlanDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.productionplan.ProductionPlanMapper;
|
||||||
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
import cn.iocoder.yudao.module.farm.enums.CommonConstants;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.cultivationarea.CultivationAreaService;
|
||||||
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
import cn.iocoder.yudao.module.farm.service.modelmanagement.ModelManagementService;
|
||||||
|
import cn.iocoder.yudao.module.farm.service.productionplan.ProductionPlanService;
|
||||||
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
import cn.iocoder.yudao.module.farm.utils.StrHelperUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -47,7 +50,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
String speciesModelId = reqVO.getSpeciesModelId();
|
String speciesModelId = reqVO.getSpeciesModelId();
|
||||||
|
|
||||||
// 创建模型案例 todo
|
// 创建模型案例 todo
|
||||||
speciesModelId = modelManagementService.createModelManagementCase(speciesModelId,taskId);
|
speciesModelId = modelManagementService.createModelManagementCase(speciesModelId, taskId);
|
||||||
if (speciesModelId.equals("")) {
|
if (speciesModelId.equals("")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -79,6 +82,7 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
obj.setPlotName(e.getPlotName());
|
obj.setPlotName(e.getPlotName());
|
||||||
obj.setTenantId(e.getTenantId());
|
obj.setTenantId(e.getTenantId());
|
||||||
|
|
||||||
|
|
||||||
// 随机字符串 + 地块名称
|
// 随机字符串 + 地块名称
|
||||||
obj.setPlanNumber(StrHelperUtil.generate() +"-"+ e.getPlotName());
|
obj.setPlanNumber(StrHelperUtil.generate() +"-"+ e.getPlotName());
|
||||||
obj.setId(taskId);
|
obj.setId(taskId);
|
||||||
@@ -91,11 +95,10 @@ public class CropFarmingCenterServiceImpl implements CropFarmingCenterService {
|
|||||||
@Override
|
@Override
|
||||||
public ProductionPlanRespVO getProductionPlan(String id) {
|
public ProductionPlanRespVO getProductionPlan(String id) {
|
||||||
LoginUser user = getLoginUser();
|
LoginUser user = getLoginUser();
|
||||||
|
QueryWrapper<ProductionPlanDO> queryWrapper = new QueryWrapper();
|
||||||
ProductionPlanDO productionPlanDO = productionPlanMapper.selectOne(
|
queryWrapper.eq("id", id);
|
||||||
ProductionPlanDO::getId, id,
|
queryWrapper.eq("tenant_id", user.getTenantId());
|
||||||
ProductionPlanDO::getTenantId,user.getTenantId());
|
ProductionPlanDO productionPlanDO = productionPlanMapper.selectOne(queryWrapper);
|
||||||
|
|
||||||
if (productionPlanDO == null) {
|
if (productionPlanDO == null) {
|
||||||
return new ProductionPlanRespVO();
|
return new ProductionPlanRespVO();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.farm.service.personnelmanagement;
|
package cn.iocoder.yudao.module.farm.service.personnelmanagement;
|
||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
@@ -9,7 +10,10 @@ import cn.iocoder.yudao.module.farm.controller.admin.personnelmanagement.vo.Pers
|
|||||||
import cn.iocoder.yudao.module.farm.controller.admin.personnelmanagement.vo.PersonnelManagementSaveReqVO;
|
import cn.iocoder.yudao.module.farm.controller.admin.personnelmanagement.vo.PersonnelManagementSaveReqVO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
import cn.iocoder.yudao.module.farm.dal.dataobject.personnelmanagement.PersonnelManagementDO;
|
||||||
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
import cn.iocoder.yudao.module.farm.dal.mysql.personnelmanagement.PersonnelManagementMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@@ -29,6 +33,10 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private PersonnelManagementMapper personnelManagementMapper;
|
private PersonnelManagementMapper personnelManagementMapper;
|
||||||
|
@Resource
|
||||||
|
private AdminUserMapper userMapper;
|
||||||
|
@Resource
|
||||||
|
private PasswordEncoder passwordEncoder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String createPersonnelManagement(PersonnelManagementSaveReqVO createReqVO) {
|
public String createPersonnelManagement(PersonnelManagementSaveReqVO createReqVO) {
|
||||||
@@ -41,8 +49,17 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
|||||||
// 处理图片集合转换
|
// 处理图片集合转换
|
||||||
handleImageConversion(personnelManagement, createReqVO);
|
handleImageConversion(personnelManagement, createReqVO);
|
||||||
|
|
||||||
|
AdminUserDO adminUserDO = new AdminUserDO();
|
||||||
|
adminUserDO.setUsername(personnelManagement.getPhone());
|
||||||
|
adminUserDO.setNickname(personnelManagement.getName());
|
||||||
|
adminUserDO.setMobile(personnelManagement.getPhone());
|
||||||
|
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);
|
||||||
personnelManagementMapper.insert(personnelManagement);
|
personnelManagementMapper.insert(personnelManagement);
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
return personnelManagement.getId();
|
return personnelManagement.getId();
|
||||||
}
|
}
|
||||||
@@ -121,4 +138,14 @@ public class PersonnelManagementServiceImpl implements PersonnelManagementServic
|
|||||||
personnelManagement.setPicture(reqVO.getPicture());
|
personnelManagement.setPicture(reqVO.getPicture());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对密码进行加密
|
||||||
|
*
|
||||||
|
* @param password 密码
|
||||||
|
* @return 加密后的密码
|
||||||
|
*/
|
||||||
|
private String encodePassword(String password) {
|
||||||
|
return passwordEncoder.encode(password);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.screendisasterdata;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.screendisasterdata.ScreenDisasterDataDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏数据-灾害数据 Service 接口
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
public interface ScreenDisasterDataService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建大屏数据-灾害数据
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
String createScreenDisasterData(@Valid ScreenDisasterDataSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新大屏数据-灾害数据
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateScreenDisasterData(@Valid ScreenDisasterDataSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除大屏数据-灾害数据
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteScreenDisasterData(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除大屏数据-灾害数据
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteScreenDisasterDataListByIds(List<String> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得大屏数据-灾害数据
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 大屏数据-灾害数据
|
||||||
|
*/
|
||||||
|
ScreenDisasterDataDO getScreenDisasterData(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得大屏数据-灾害数据分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 大屏数据-灾害数据分页
|
||||||
|
*/
|
||||||
|
PageResult<ScreenDisasterDataDO> getScreenDisasterDataPage(ScreenDisasterDataPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package cn.iocoder.yudao.module.farm.service.screendisasterdata;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.controller.admin.screendisasterdata.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.dataobject.screendisasterdata.ScreenDisasterDataDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.farm.dal.mysql.screendisasterdata.ScreenDisasterDataMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList;
|
||||||
|
import static cn.iocoder.yudao.module.farm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大屏数据-灾害数据 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 万懋超级管理
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class ScreenDisasterDataServiceImpl implements ScreenDisasterDataService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScreenDisasterDataMapper screenDisasterDataMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createScreenDisasterData(ScreenDisasterDataSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
ScreenDisasterDataDO screenDisasterData = BeanUtils.toBean(createReqVO, ScreenDisasterDataDO.class);
|
||||||
|
screenDisasterDataMapper.insert(screenDisasterData);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return screenDisasterData.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreenDisasterData(ScreenDisasterDataSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateScreenDisasterDataExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
ScreenDisasterDataDO updateObj = BeanUtils.toBean(updateReqVO, ScreenDisasterDataDO.class);
|
||||||
|
screenDisasterDataMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteScreenDisasterData(String id) {
|
||||||
|
// 校验存在
|
||||||
|
validateScreenDisasterDataExists(id);
|
||||||
|
// 删除
|
||||||
|
screenDisasterDataMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteScreenDisasterDataListByIds(List<String> ids) {
|
||||||
|
// 删除
|
||||||
|
screenDisasterDataMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateScreenDisasterDataExists(String id) {
|
||||||
|
if (screenDisasterDataMapper.selectById(id) == null) {
|
||||||
|
throw exception(SCREEN_DISASTER_DATA_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ScreenDisasterDataDO getScreenDisasterData(String id) {
|
||||||
|
return screenDisasterDataMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<ScreenDisasterDataDO> getScreenDisasterDataPage(ScreenDisasterDataPageReqVO pageReqVO) {
|
||||||
|
return screenDisasterDataMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -46,7 +46,6 @@
|
|||||||
<if test="req.useStatus != null">
|
<if test="req.useStatus != null">
|
||||||
AND t.use_status = #{req.useStatus}
|
AND t.use_status = #{req.useStatus}
|
||||||
</if>
|
</if>
|
||||||
AND t.deleted = 0
|
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.dataobject.user;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员管理 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("farm_personnel_management")
|
||||||
|
@KeySequence("farm_personnel_management_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PersonnelManagementDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
@TableId(type = IdType.INPUT)
|
||||||
|
private String id;
|
||||||
|
/**
|
||||||
|
* 用户姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
|
private String department;
|
||||||
|
/**
|
||||||
|
* 电话号
|
||||||
|
*/
|
||||||
|
private String phone;
|
||||||
|
/**
|
||||||
|
* 角色id用,隔开
|
||||||
|
*/
|
||||||
|
private String role;
|
||||||
|
/**
|
||||||
|
* 头像(数据库存储为逗号分隔的字符串)
|
||||||
|
*/
|
||||||
|
@TableField(value = "picture")
|
||||||
|
private String picture;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 头像集合(业务层使用)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<String> pictureList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0=启用,1=停用
|
||||||
|
*/
|
||||||
|
private Integer accountStatus;
|
||||||
|
/**
|
||||||
|
* 基地id
|
||||||
|
*/
|
||||||
|
private String baseId;
|
||||||
|
/**
|
||||||
|
* 基地
|
||||||
|
*/
|
||||||
|
private String baseName;
|
||||||
|
/**
|
||||||
|
* 地块ID
|
||||||
|
*/
|
||||||
|
private String plotId;
|
||||||
|
/**
|
||||||
|
* 地块
|
||||||
|
*/
|
||||||
|
private String plotName;
|
||||||
|
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.PersonnelManagementDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.dal.mysql.user;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.PersonnelManagementDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface PersonnelManagementMapper extends BaseMapperX<PersonnelManagementDO> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.service.user;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
@@ -22,8 +23,10 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqV
|
|||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.UserPostDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.PersonnelManagementDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.dept.UserPostMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.dept.UserPostMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.user.AdminUserMapper;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.user.PersonnelManagementMapper;
|
||||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||||
import cn.iocoder.yudao.module.system.service.dept.PostService;
|
import cn.iocoder.yudao.module.system.service.dept.PostService;
|
||||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||||
@@ -82,6 +85,9 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ConfigApi configApi;
|
private ConfigApi configApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PersonnelManagementMapper personnelManagementMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}",
|
@LogRecord(type = SYSTEM_USER_TYPE, subType = SYSTEM_USER_CREATE_SUB_TYPE, bizNo = "{{#user.id}}",
|
||||||
@@ -110,6 +116,26 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
// 3. 记录操作日志上下文
|
// 3. 记录操作日志上下文
|
||||||
LogRecordContext.putVariable("user", user);
|
LogRecordContext.putVariable("user", user);
|
||||||
|
PersonnelManagementDO userDo = new PersonnelManagementDO();
|
||||||
|
userDo.setName(user.getNickname());
|
||||||
|
userDo.setPhone(user.getMobile());
|
||||||
|
userDo.setDepartment(user.getDeptId().toString());
|
||||||
|
userDo.setTenantId(user.getTenantId().toString());
|
||||||
|
userDo.setPicture(user.getAvatar());
|
||||||
|
userDo.setAccountStatus(0);
|
||||||
|
List<UserPostDO> userPostDOS = convertList(user.getPostIds(),
|
||||||
|
postId -> new UserPostDO().setUserId(user.getId()).setPostId(postId));
|
||||||
|
String roles = "";
|
||||||
|
for (UserPostDO up : userPostDOS) {
|
||||||
|
if (roles.length() > 0) {
|
||||||
|
roles += "," + up.getPostId();
|
||||||
|
} else {
|
||||||
|
roles = up.getPostId().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userDo.setRole(roles);
|
||||||
|
userDo.setId(IdUtil.fastUUID());
|
||||||
|
personnelManagementMapper.insert(userDo);
|
||||||
return user.getId();
|
return user.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +381,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private AdminUserDO validateUserForCreateOrUpdate(Long id, String username, String mobile, String email,
|
private AdminUserDO validateUserForCreateOrUpdate(Long id, String username, String mobile, String email,
|
||||||
Long deptId, Set<Long> postIds) {
|
Long deptId, Set<Long> postIds) {
|
||||||
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
// 关闭数据权限,避免因为没有数据权限,查询不到数据,进而导致唯一校验不正确
|
||||||
return DataPermissionUtils.executeIgnore(() -> {
|
return DataPermissionUtils.executeIgnore(() -> {
|
||||||
// 校验用户存在
|
// 校验用户存在
|
||||||
@@ -442,6 +468,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验旧密码
|
* 校验旧密码
|
||||||
|
*
|
||||||
* @param id 用户 id
|
* @param id 用户 id
|
||||||
* @param oldPassword 旧密码
|
* @param oldPassword 旧密码
|
||||||
*/
|
*/
|
||||||
@@ -476,7 +503,7 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
// 2.1.1 校验字段是否符合要求
|
// 2.1.1 校验字段是否符合要求
|
||||||
try {
|
try {
|
||||||
ValidationUtils.validate(BeanUtils.toBean(importUser, UserSaveReqVO.class).setPassword(initPassword));
|
ValidationUtils.validate(BeanUtils.toBean(importUser, UserSaveReqVO.class).setPassword(initPassword));
|
||||||
} catch (ConstraintViolationException ex){
|
} catch (ConstraintViolationException ex) {
|
||||||
respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage());
|
respVO.getFailureUsernames().put(importUser.getUsername(), ex.getMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user