Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/estate_expert
| | |
| | | @ApiOperation("【APP】在岗情况列表") |
| | | @PostMapping("/onduty/list") |
| | | public Result listOnDutyRecords(@ApiParam(hidden = true) Session session, |
| | | @RequestParam(value = "planId", required = false) Integer planId, |
| | | @RequestParam(value = "checkTaskId") Integer checkTaskId, |
| | | @RequestParam(value = "mine", required = false) Boolean mine, |
| | | @Validated @RequestBody PageReq pageReq) { |
| | | // 根据 mine 参数决定是否筛选"我创建的" |
| | | var creatorId = mine != null && mine ? ((User) session.getUser()).getId() : null; |
| | | |
| | | // 调用 Service 层的 JPA 查询方法 |
| | | return Result.success(onDutyService.listOnDutyRecords(planId, creatorId, pageReq)); |
| | | return Result.success(onDutyService.listOnDutyRecords(checkTaskId, creatorId, pageReq)); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | @ApiOperation(value = "【APP】岗位列表") |
| | | @PostMapping("/position/list") |
| | | public Result list(@Validated @RequestBody PageReq pageReq) { |
| | | public Result<Position> list(@Validated @RequestBody PageReq pageReq) { |
| | | Page<Position> page = positionService.lambdaQuery().page(new Page<>(pageReq.getPage(), pageReq.getSize())); |
| | | return Result.success(PageRespMp.of(page)); |
| | | } |
| | |
| | | /** |
| | | * 岗位详情 |
| | | */ |
| | | @ApiOperation(value = "【APP】岗位详情") |
| | | @ApiOperation(value = "【APP】岗位详情",response = Position.class) |
| | | @GetMapping("/position/detail") |
| | | public Result getPositionDetail(@RequestParam("id") Integer id) { |
| | | public Result<Position> getPositionDetail(@RequestParam("id") Integer id) { |
| | | Position position = positionService.getById(id); |
| | | if (position == null) { |
| | | throw new RuntimeException("岗位不存在"); |
| | |
| | | @ApiOperation("【APP】检查情况列表") |
| | | @PostMapping("/checkinfo/list") |
| | | public Result listCheckInfoRecords(@ApiParam(hidden = true) Session session, |
| | | @RequestParam(value = "planId", required = false) Integer planId, |
| | | @RequestParam(value = "checkTaskId") Integer checkTaskId, |
| | | @RequestParam(value = "mine", required = false) Boolean mine, |
| | | @Validated @RequestBody PageReq pageReq) { |
| | | // 根据 mine 参数决定是否筛选"我创建的" |
| | | var creatorId = mine != null && mine ? ((User) session.getUser()).getId() : null; |
| | | |
| | | // 调用 Service 层的 JPA 查询方法 |
| | | return Result.success(checkService.listCheckInfoRecords(planId, creatorId, pageReq)); |
| | | return Result.success(checkService.listCheckInfoRecords(checkTaskId, creatorId, pageReq)); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 检查信息详情 |
| | | */ |
| | | @ApiOperation("【APP】检查信息详情") |
| | | @ApiOperation(value = "【APP】检查信息详情", response = Check.class) |
| | | @GetMapping("/checkinfo/detail") |
| | | public Result getCheckInfoDetail(@RequestParam("id") Integer id) { |
| | | public Result<Check> getCheckInfoDetail(@RequestParam("id") Integer id) { |
| | | Check check = checkService.getById(id); |
| | | if (check == null) { |
| | | throw new RuntimeException("检查信息不存在"); |
| | |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 检查任务id |
| | | */ |
| | | @TableField("check_task_id") |
| | | @ApiModelProperty("检查任务ID") |
| | | private Integer checkTaskId; |
| | | |
| | | /** |
| | | * 计划id |
| | | */ |
| | |
| | | |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 检查任务id |
| | | */ |
| | | @TableField("check_task_id") |
| | | @ApiModelProperty("检查任务ID") |
| | | private Integer checkTaskIdId; |
| | | |
| | | /** |
| | | * 计划id |
| | | */ |
| | | @TableField("plan_id") |
| | | @ApiModelProperty("计划id") |
| | | private Integer planId; |
| | | |
| | | /** |
| | | * 项目id |
| | | */ |
| | |
| | | @ApiModel("添加检查信息请求") |
| | | public class AddCheckInfoRequest { |
| | | |
| | | @ApiModelProperty(value = "计划ID", required = true) |
| | | @NotNull(message = "计划ID不能为空") |
| | | private Integer planId; |
| | | |
| | | @ApiModelProperty(value = "项目ID", required = true) |
| | | @NotNull(message = "项目ID不能为空") |
| | | private Integer projectId; |
| | | |
| | | @ApiModelProperty(value = "委托方ID", required = true) |
| | | @NotNull(message = "委托方ID不能为空") |
| | | private Integer clientId; |
| | | @NotNull(message = "检查任务ID") |
| | | @ApiModelProperty(value = "检查任务ID", required = true) |
| | | Integer checkTaskIdId; |
| | | |
| | | @ApiModelProperty(value = "检查标题", required = true) |
| | | @NotBlank(message = "检查标题不能为空") |
| | |
| | | package com.estate.expert.admin.domain.common.request; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Builder; |
| | |
| | | @Builder |
| | | public class AddOnDutyRequest { |
| | | |
| | | @ApiModelProperty(value = "项目ID", required = true) |
| | | @NotNull(message = "项目ID不能为空") |
| | | Integer projectId; |
| | | |
| | | @ApiModelProperty(value = "计划ID", required = true) |
| | | @NotNull(message = "计划ID不能为空") |
| | | Integer planId; |
| | | @NotNull(message = "检查任务ID") |
| | | @ApiModelProperty(value = "检查任务ID", required = true) |
| | | Integer checkTaskIdId; |
| | | |
| | | @ApiModelProperty(value = "岗位ID", required = true) |
| | | @NotNull(message = "岗位ID不能为空") |
| | |
| | | * 分页查询检查情况列表(JPA 实现) |
| | | * 用于新的列表查询接口,支持"全部/我创建的"筛选 |
| | | * |
| | | * @param planId 计划ID(可选) |
| | | * @param creatorId 创建者ID(null表示查询全部) |
| | | * @param pageReq 分页请求 |
| | | * @param checkTaskId 计划ID(可选) |
| | | * @param creatorId 创建者ID(null表示查询全部) |
| | | * @param pageReq 分页请求 |
| | | * @return 检查情况分页结果 |
| | | */ |
| | | PageRespMp<Check> listCheckInfoRecords(Integer planId, Integer creatorId, PageReq pageReq); |
| | | PageRespMp<Check> listCheckInfoRecords(Integer checkTaskId, Integer creatorId, PageReq pageReq); |
| | | |
| | | /** |
| | | * 添加检查信息 |
| | |
| | | * 分页查询在岗情况列表(JPA 实现) |
| | | * 用于新的列表查询接口,支持"全部/我创建的"筛选 |
| | | * |
| | | * @param planId 计划ID(可选) |
| | | * @param creatorId 创建者ID(null表示查询全部) |
| | | * @param pageReq 分页请求 |
| | | * @param checkTaskId 计划ID(可选) |
| | | * @param creatorId 创建者ID(null表示查询全部) |
| | | * @param pageReq 分页请求 |
| | | * @return 在岗情况分页结果 |
| | | */ |
| | | PageRespMp<OnDuty> listOnDutyRecords(Integer planId, Integer creatorId, PageReq pageReq); |
| | | PageRespMp<OnDuty> listOnDutyRecords(Integer checkTaskId, Integer creatorId, PageReq pageReq); |
| | | |
| | | /** |
| | | * 编辑在岗情况记录 |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneId; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageRespMp<Check> listCheckInfoRecords(Integer planId, Integer creatorId, PageReq pageReq) { |
| | | Page<Check> page = lambdaQuery().eq(Check::getPlanId, planId).eq(Objects.nonNull(creatorId), Check::getCreatorId, creatorId) |
| | | public PageRespMp<Check> listCheckInfoRecords(Integer checkTaskId, Integer creatorId, PageReq pageReq) { |
| | | Page<Check> page = lambdaQuery().eq(Check::getCheckTaskId, checkTaskId).eq(Objects.nonNull(creatorId), Check::getCreatorId, creatorId) |
| | | .page(new Page<>(pageReq.getPage(), pageReq.getSize())); |
| | | // 将 Spring Data Page 转换为自定义 PageResp |
| | | return PageRespMp.of(page); |
| | |
| | | check.setIntegrityNotification(request.getIntegrityNotification()); |
| | | |
| | | // 3. 设置关联字段 |
| | | check.setPlanId(request.getPlanId()); |
| | | check.setProjectId(request.getProjectId()); |
| | | check.setClientId(request.getClientId()); |
| | | check.setCheckTaskId(request.getCheckTaskIdId()); |
| | | |
| | | // 4. 设置创建者ID(MyBatis Plus 使用 creatorId 字段) |
| | | check.setCreatorId(creator.getId()); |
| | |
| | | @Override |
| | | @Transactional |
| | | public OnDuty add(User creator, AddOnDutyRequest request) { |
| | | // 1. 查询项目信息,获取 clientId |
| | | Project project = projectRepository.findById(request.getProjectId()) |
| | | .orElseThrow(() -> new RuntimeException("项目不存在")); |
| | | |
| | | if (project.getClient() == null) { |
| | | throw new RuntimeException("项目未关联委托方"); |
| | | } |
| | | Integer clientId = project.getClient().getId(); |
| | | |
| | | // 2. 查询岗位信息,获取 positionName(MyBatis Plus 方式) |
| | | Position position = positionService.getById(request.getPositionId()); |
| | | if (position == null) { |
| | |
| | | |
| | | // 4. 构建 OnDuty 实体 |
| | | OnDuty onDuty = new OnDuty(); |
| | | onDuty.setPlanId(request.getPlanId()); |
| | | onDuty.setProjectId(request.getProjectId()); |
| | | onDuty.setClientId(clientId); |
| | | onDuty.setCheckTaskIdId(request.getCheckTaskIdId()); |
| | | onDuty.setContent("人员在岗"); // 固定值 |
| | | onDuty.setPositionId(request.getPositionId()); |
| | | onDuty.setPositionName(positionName); |
| | |
| | | * 用于新的列表查询接口,支持"全部/我创建的"筛选 |
| | | */ |
| | | @Override |
| | | public PageRespMp<OnDuty> listOnDutyRecords(Integer planId, Integer creatorId, PageReq pageReq) { |
| | | Page<OnDuty> page = lambdaQuery().eq(OnDuty::getPlanId, planId).eq(Objects.nonNull(creatorId), OnDuty::getCreatorId, creatorId) |
| | | public PageRespMp<OnDuty> listOnDutyRecords(Integer checkTaskId, Integer creatorId, PageReq pageReq) { |
| | | Page<OnDuty> page = lambdaQuery().eq(OnDuty::getCheckTaskIdId, checkTaskId).eq(Objects.nonNull(creatorId), OnDuty::getCreatorId, creatorId) |
| | | .page(new Page<>(pageReq.getPage(), pageReq.getSize())); |
| | | //转换为 PageRespMp |
| | | return PageRespMp.of(page); |