diff --git a/core/src/main/java/com/dite/znpt/constant/Message.java b/core/src/main/java/com/dite/znpt/constant/Message.java index d694614..974043f 100644 --- a/core/src/main/java/com/dite/znpt/constant/Message.java +++ b/core/src/main/java/com/dite/znpt/constant/Message.java @@ -20,7 +20,9 @@ public class Message implements Serializable { public static final String IMAGE_SOURCE_IS_NOT_EXIST = "图像类型不存在"; public static final String DEFECT_ID_IS_NOT_EXIST = "缺陷id不存在"; public static final String PROJECT_ID_IS_NOT_EXIST = "项目id不存在"; + public static final String PROJECT_STATUS_IS_NOT_COMPLETED = "项目[{}]的状态不是已完工"; public static final String TURBINE_ID_IS_NOT_EXIST = "机组id不存在"; + public static final String TURBINE_STATUS_IS_NOT_COMPLETED = "机组[{}]的状态不是已完工"; public static final String PART_ID_IS_NOT_EXIST = "部件id不存在"; public static final String USER_ID_NOT_EXIST = "用户id不存在"; public static final String USER_ID_NOT_EXIST_OR_ILLEGAL = "用户id不存在或者不合法"; @@ -67,4 +69,5 @@ public class Message implements Serializable { public static final String SUGGESTION_ID_IS_NOT_EXIST = "维修建议id不存在"; public static final String SUGGESTION_LEVEL_TYPE_FORBID_REPEAT = "存在缺陷级别为[{}]缺陷类型为[{}]的维修建议"; public static final String CHECK_SCHEME_ID_IS_NOT_EXIST = "检查方案id不存在"; + public static final String INSPECTION_REPORT_ID_IS_NOT_EXIST = "检查报告id不存在"; } diff --git a/core/src/main/java/com/dite/znpt/converts/Converts.java b/core/src/main/java/com/dite/znpt/converts/Converts.java index a8f7ba6..35a0e18 100644 --- a/core/src/main/java/com/dite/znpt/converts/Converts.java +++ b/core/src/main/java/com/dite/znpt/converts/Converts.java @@ -108,5 +108,7 @@ public interface Converts { CheckSchemeResp toCheckSchemeResp(CheckSchemeEntity entity); CheckSchemeEntity toCheckSchemeEntity(CheckSchemeReq req); + + InspectionReportEntity toInspectionReportEntity(InspectionReportReq req); } diff --git a/core/src/main/java/com/dite/znpt/domain/entity/CheckSchemeEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/CheckSchemeEntity.java index d007394..ae4d742 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/CheckSchemeEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/CheckSchemeEntity.java @@ -52,6 +52,6 @@ public class CheckSchemeEntity extends AuditableEntity implements Serializable { private String remark; @ApiModelProperty("删除标志(0代表存在 1代表删除)") - @TableField("delFlag") + @TableField("del_flag") private String delFlag; } diff --git a/core/src/main/java/com/dite/znpt/domain/entity/InspectionReportEntity.java b/core/src/main/java/com/dite/znpt/domain/entity/InspectionReportEntity.java index be836b3..308e6a2 100644 --- a/core/src/main/java/com/dite/znpt/domain/entity/InspectionReportEntity.java +++ b/core/src/main/java/com/dite/znpt/domain/entity/InspectionReportEntity.java @@ -13,7 +13,6 @@ import lombok.EqualsAndHashCode; import java.io.Serial; import java.io.Serializable; import java.time.LocalDate; -import java.time.LocalDateTime; /** * @author Bear.G @@ -78,7 +77,7 @@ public class InspectionReportEntity extends AuditableEntity implements Serializa @ApiModelProperty("报告编制时间") @TableField("report_write_time") - private LocalDateTime reportWriteTime; + private LocalDate reportWriteTime; @ApiModelProperty("报告复核人员id") @TableField("report_reviewer") @@ -86,7 +85,7 @@ public class InspectionReportEntity extends AuditableEntity implements Serializa @ApiModelProperty("报告复核时间") @TableField("report_review_time") - private LocalDateTime reportReviewTime; + private LocalDate reportReviewTime; @ApiModelProperty("报告审核人员id") @TableField("report_auditor") @@ -94,5 +93,5 @@ public class InspectionReportEntity extends AuditableEntity implements Serializa @ApiModelProperty("报告审核时间") @TableField("report_audit_time") - private LocalDateTime reportAuditTime; + private LocalDate reportAuditTime; } diff --git a/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeListReq.java b/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeListReq.java new file mode 100644 index 0000000..514f615 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeListReq.java @@ -0,0 +1,27 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.io.Serial; +import java.io.Serializable; +import java.util.List; + +/** + * @Author: gaoxiong + * @Date: 2025/7/9 23:35 + * @Description: + */ +@Data +@ApiModel("检查方案列表查询请求实体") +public class CheckSchemeListReq implements Serializable { + + @Serial + private static final long serialVersionUID = 1345082408495150993L; + + @ApiModelProperty("检查方式,枚举CheckMethodEnum") + private List checkMethod; +} diff --git a/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeReq.java b/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeReq.java index 6935dbe..02c0ab2 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeReq.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/CheckSchemeReq.java @@ -44,7 +44,6 @@ public class CheckSchemeReq implements Serializable { @ApiModelProperty("检查方式,枚举CheckMethodEnum") private String checkMethod; - @NotBlank(message = "备注不能为空") @Size(max = 500, message = "备注不能超过500个字") @ApiModelProperty("备注") private String remark; diff --git a/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportCoverInfo.java b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportCoverInfo.java index 19d51ec..697e437 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportCoverInfo.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportCoverInfo.java @@ -1,6 +1,7 @@ package com.dite.znpt.domain.vo; import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -38,6 +39,7 @@ public class InspectionReportCoverInfo implements Serializable { @ApiModelProperty("报告编制人员") private String reportWriterName; + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("报告编制时间") private LocalDateTime reportWriteTime; @@ -47,6 +49,7 @@ public class InspectionReportCoverInfo implements Serializable { @ApiModelProperty("报告复核人员") private String reportReviewerName; + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("报告复核时间") private LocalDateTime reportReviewTime; @@ -56,6 +59,7 @@ public class InspectionReportCoverInfo implements Serializable { @ApiModelProperty("报告审核人员") private String reportAuditName; + @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("报告审核时间") private LocalDateTime reportAuditTime; } diff --git a/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportListReq.java b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportListReq.java new file mode 100644 index 0000000..9daa4d3 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportListReq.java @@ -0,0 +1,40 @@ +package com.dite.znpt.domain.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; + +/** + * @author Bear.G + * @date 2025/7/14/周一 15:32 + * @description + */ +@Data +@ApiModel("检查报告列表请求实体") +public class InspectionReportListReq implements Serializable { + @Serial + private static final long serialVersionUID = -8122588121700840604L; + + @ApiModelProperty("主标题") + private String title; + + @ApiModelProperty("副标题") + private String subTile; + + @ApiModelProperty("项目id") + private String projectId; + + @ApiModelProperty("机组id") + private String turbineId; + + @ApiModelProperty("风场名字") + private String farmName; + + @ApiModelProperty("委托单位") + private String client; + + +} diff --git a/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportListResp.java b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportListResp.java new file mode 100644 index 0000000..80153c0 --- /dev/null +++ b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportListResp.java @@ -0,0 +1,59 @@ +package com.dite.znpt.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.time.LocalDateTime; + +/** + * @author Bear.G + * @date 2025/7/14/周一 15:32 + * @description + */ +@Data +@ApiModel("检查报告列表响应实体") +public class InspectionReportListResp implements Serializable { + @Serial + private static final long serialVersionUID = -7652873535955803183L; + + @ApiModelProperty("报告id") + private String reportId; + + @ApiModelProperty("主标题") + private String title; + + @ApiModelProperty("副标题") + private String subTitle; + + @ApiModelProperty("报告编制人员") + private String reportWriterName; + + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("报告编制时间") + private LocalDateTime reportWriteTime; + + @ApiModelProperty("项目id") + private String projectId; + + @ApiModelProperty("项目名称") + private String projectName; + + @ApiModelProperty("风场名字") + private String farmName; + + @ApiModelProperty("委托单位") + private String client; + + @ApiModelProperty("机组id") + private String turbineId; + + @ApiModelProperty("机组名称") + private String turbineName; + + @ApiModelProperty("机组编码") + private String turbineCode; +} diff --git a/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportReq.java b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportReq.java index c679385..dd5ebe4 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportReq.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/InspectionReportReq.java @@ -1,17 +1,16 @@ package com.dite.znpt.domain.vo; -import com.baomidou.mybatisplus.annotation.IdType; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; import java.io.Serial; import java.io.Serializable; import java.time.LocalDate; -import java.time.LocalDateTime; /** * @Author: gaoxiong @@ -24,55 +23,68 @@ public class InspectionReportReq implements Serializable { @Serial private static final long serialVersionUID = 4937399975205847660L; - @ApiModelProperty("报告id") - private String reportId; - + @NotBlank(message = "主标题不能为空") + @Size(max = 50, message = "主标题长度不能超过50") @ApiModelProperty("主标题") private String title; + @NotBlank(message = "副标题不能为空") + @Size(max = 50, message = "副标题长度不能超过50") @ApiModelProperty("副标题") private String subTitle; @ApiModelProperty("封面") private String coverImage; + @NotBlank(message = "项目id不能为空") @ApiModelProperty("项目id") private String projectId; + @NotBlank(message = "机组id不能为空") @ApiModelProperty("机组id") private String turbineId; + @NotNull(message = "检查日期不能为空") @JsonFormat(pattern = "yyyy-MM-dd") @ApiModelProperty("检查日期") private LocalDate checkDate; - @ApiModelProperty("检查位置") - private String checkPosition; - + @NotBlank(message = "检查内容不能为空") @ApiModelProperty("检查内容") private String checkContent; - @ApiModelProperty("检查方式,多个方式英文逗号分隔") + @NotBlank(message = "检查内容不能为空") + @ApiModelProperty("检查方式,多个方式英文逗号分隔,枚举:CheckMethodEnum") private String checkMethod; + @NotBlank(message = "检查人员不能为空") @ApiModelProperty("检查人员id,多个人员英文逗号分隔") private String checkUserId; + @NotBlank(message = "报告编制人员不能为空") @ApiModelProperty("报告编制人员id") private String reportWriter; + @JsonFormat(pattern = "yyyy-MM-dd") + @NotNull(message = "报告编制时间不能为空") @ApiModelProperty("报告编制时间") - private LocalDateTime reportWriteTime; + private LocalDate reportWriteTime; + @NotBlank(message = "报告复核人员不能为空") @ApiModelProperty("报告复核人员id") private String reportReviewer; + @JsonFormat(pattern = "yyyy-MM-dd") + @NotNull(message = "报告复核时间不能为空") @ApiModelProperty("报告复核时间") - private LocalDateTime reportReviewTime; + private LocalDate reportReviewTime; + @NotBlank(message = "报告审核人员不能为空") @ApiModelProperty("报告审核人员id") private String reportAuditor; + @JsonFormat(pattern = "yyyy-MM-dd") + @NotNull(message = "报告审核时间不能为空") @ApiModelProperty("报告审核时间") - private LocalDateTime reportAuditTime; + private LocalDate reportAuditTime; } diff --git a/core/src/main/java/com/dite/znpt/domain/vo/TurbineResp.java b/core/src/main/java/com/dite/znpt/domain/vo/TurbineResp.java index beb18d9..7e60769 100644 --- a/core/src/main/java/com/dite/znpt/domain/vo/TurbineResp.java +++ b/core/src/main/java/com/dite/znpt/domain/vo/TurbineResp.java @@ -18,7 +18,7 @@ public class TurbineResp implements Serializable { @Serial private static final long serialVersionUID = -1403719853347580858L; - @ApiModelProperty("机组号") + @ApiModelProperty("机组id") private String turbineId; @ApiModelProperty("项目id") diff --git a/core/src/main/java/com/dite/znpt/mapper/InspectionReportMapper.java b/core/src/main/java/com/dite/znpt/mapper/InspectionReportMapper.java index f9a62ab..8a42c64 100644 --- a/core/src/main/java/com/dite/znpt/mapper/InspectionReportMapper.java +++ b/core/src/main/java/com/dite/znpt/mapper/InspectionReportMapper.java @@ -2,6 +2,12 @@ package com.dite.znpt.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.dite.znpt.domain.entity.InspectionReportEntity; +import com.dite.znpt.domain.vo.InspectionReportListReq; +import com.dite.znpt.domain.vo.InspectionReportListResp; +import com.dite.znpt.domain.vo.InspectionReportResp; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @author Bear.G @@ -9,4 +15,7 @@ import com.dite.znpt.domain.entity.InspectionReportEntity; * @description */ public interface InspectionReportMapper extends BaseMapper { + + List listInspectionReportListResp(@Param("req") InspectionReportListReq req); + InspectionReportResp getInspectionReportResp(@Param("reportId") String reportId); } diff --git a/core/src/main/java/com/dite/znpt/service/CheckSchemeService.java b/core/src/main/java/com/dite/znpt/service/CheckSchemeService.java index 78e7e6f..06274c0 100644 --- a/core/src/main/java/com/dite/znpt/service/CheckSchemeService.java +++ b/core/src/main/java/com/dite/znpt/service/CheckSchemeService.java @@ -13,8 +13,8 @@ import java.util.List; * @Description: */ public interface CheckSchemeService extends IService { - List page(String checkMethod); - List list(String checkMethod); + List page(List checkMethods); + List list(List checkMethods); CheckSchemeResp detail(String checkSchemeId); void save(CheckSchemeReq req); void update(String checkSchemeId, CheckSchemeReq req); diff --git a/core/src/main/java/com/dite/znpt/service/InspectionReportService.java b/core/src/main/java/com/dite/znpt/service/InspectionReportService.java index 6723e3a..df8db79 100644 --- a/core/src/main/java/com/dite/znpt/service/InspectionReportService.java +++ b/core/src/main/java/com/dite/znpt/service/InspectionReportService.java @@ -2,6 +2,12 @@ package com.dite.znpt.service; import com.baomidou.mybatisplus.extension.service.IService; import com.dite.znpt.domain.entity.InspectionReportEntity; +import com.dite.znpt.domain.vo.InspectionReportListReq; +import com.dite.znpt.domain.vo.InspectionReportListResp; +import com.dite.znpt.domain.vo.InspectionReportReq; +import com.dite.znpt.domain.vo.InspectionReportResp; + +import java.util.List; /** * @author Bear.G @@ -9,4 +15,9 @@ import com.dite.znpt.domain.entity.InspectionReportEntity; * @description */ public interface InspectionReportService extends IService { + List page(InspectionReportListReq req); + List list(InspectionReportListReq req); + InspectionReportResp detail(String reportId); + void save(InspectionReportReq req); + void update(String reportId, InspectionReportReq req); } diff --git a/core/src/main/java/com/dite/znpt/service/impl/CheckSchemeServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/CheckSchemeServiceImpl.java index 7c0535b..6d5829c 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/CheckSchemeServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/CheckSchemeServiceImpl.java @@ -28,14 +28,16 @@ import java.util.List; public class CheckSchemeServiceImpl extends ServiceImpl implements CheckSchemeService { @Override - public List page(String checkMethod) { + public List page(List checkMethods) { PageUtil.startPage(); - return this.list(checkMethod); + return this.list(checkMethods); } @Override - public List list(String checkMethod) { - List result = Converts.INSTANCE.toCheckSchemeResp(this.list(Wrappers.lambdaQuery(CheckSchemeEntity.class).eq(StrUtil.isNotBlank(checkMethod), CheckSchemeEntity::getCheckMethod, checkMethod))); + public List list(List checkMethods) { + List result = Converts.INSTANCE.toCheckSchemeResp( + this.list(Wrappers.lambdaQuery(CheckSchemeEntity.class).in(null != checkMethods && !checkMethods.isEmpty(), CheckSchemeEntity::getCheckMethod, checkMethods)) + ); result.forEach(resp -> { resp.setCheckMethodLabel(CheckMethodEnum.getDescByCode(resp.getCheckMethod())); }); diff --git a/core/src/main/java/com/dite/znpt/service/impl/InspectionReportServiceImpl.java b/core/src/main/java/com/dite/znpt/service/impl/InspectionReportServiceImpl.java index b2d352a..0304d35 100644 --- a/core/src/main/java/com/dite/znpt/service/impl/InspectionReportServiceImpl.java +++ b/core/src/main/java/com/dite/znpt/service/impl/InspectionReportServiceImpl.java @@ -1,12 +1,29 @@ package com.dite.znpt.service.impl; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dite.znpt.constant.Message; +import com.dite.znpt.converts.Converts; import com.dite.znpt.domain.entity.InspectionReportEntity; +import com.dite.znpt.domain.entity.ProjectEntity; +import com.dite.znpt.domain.entity.TurbineEntity; +import com.dite.znpt.domain.vo.InspectionReportListReq; +import com.dite.znpt.domain.vo.InspectionReportListResp; +import com.dite.znpt.domain.vo.InspectionReportReq; +import com.dite.znpt.domain.vo.InspectionReportResp; +import com.dite.znpt.enums.ProjectStatusEnum; +import com.dite.znpt.exception.ServiceException; import com.dite.znpt.mapper.InspectionReportMapper; +import com.dite.znpt.service.InspectionReportService; +import com.dite.znpt.service.ProjectService; +import com.dite.znpt.service.TurbineService; +import com.dite.znpt.util.PageUtil; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import java.io.Serial; -import java.io.Serializable; +import javax.annotation.Resource; +import java.util.List; /** * @author Bear.G @@ -14,7 +31,62 @@ import java.io.Serializable; * @description */ @Service -public class InspectionReportServiceImpl extends ServiceImpl implements Serializable { - @Serial - private static final long serialVersionUID = 1460849450000057636L; +public class InspectionReportServiceImpl extends ServiceImpl implements InspectionReportService { + + @Resource + private ProjectService projectService; + + @Resource + private TurbineService turbineService; + + @Override + public List page(InspectionReportListReq req) { + PageUtil.startPage(); + return this.list(req); + } + + @Override + public List list(InspectionReportListReq req) { + return this.baseMapper.listInspectionReportListResp(req); + } + + @Override + public InspectionReportResp detail(String reportId) { + return this.baseMapper.getInspectionReportResp(reportId); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void save(InspectionReportReq req) { + this.save(validation(req)); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void update(String reportId, InspectionReportReq req) { + if(this.getById(reportId) == null){ + throw new ServiceException(Message.INSPECTION_REPORT_ID_IS_NOT_EXIST); + } + InspectionReportEntity entity = validation(req); + entity.setReportId(reportId); + this.updateById(entity); + } + + private InspectionReportEntity validation(InspectionReportReq req){ + ProjectEntity project = projectService.getById(req.getProjectId()); + if(null == project){ + throw new ServiceException(Message.PROJECT_ID_IS_NOT_EXIST); + } + if(ProjectStatusEnum.COMPLETED.getCode() != project.getStatus()){ + throw new ServiceException(StrUtil.format(Message.PROJECT_STATUS_IS_NOT_COMPLETED, project.getProjectName())); + } + TurbineEntity turbine = turbineService.getById(req.getTurbineId()); + if(null == turbine){ + throw new ServiceException(Message.TURBINE_ID_IS_NOT_EXIST); + } + if(ProjectStatusEnum.COMPLETED.getCode() != turbine.getStatus()){ + throw new ServiceException(StrUtil.format(Message.TURBINE_STATUS_IS_NOT_COMPLETED, turbine.getTurbineName())); + } + return Converts.INSTANCE.toInspectionReportEntity(req); + } } diff --git a/core/src/main/resources/mapper/InspectionReportMapper.xml b/core/src/main/resources/mapper/InspectionReportMapper.xml index 6a13b56..a98f8e4 100644 --- a/core/src/main/resources/mapper/InspectionReportMapper.xml +++ b/core/src/main/resources/mapper/InspectionReportMapper.xml @@ -1,4 +1,10 @@ + + \ No newline at end of file diff --git a/web/src/main/java/com/dite/znpt/web/controller/CheckSchemeController.java b/web/src/main/java/com/dite/znpt/web/controller/CheckSchemeController.java index c8e30dc..0dd4abb 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/CheckSchemeController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/CheckSchemeController.java @@ -27,14 +27,14 @@ public class CheckSchemeController { @ApiOperation(value = "分页查询检查方案信息", httpMethod = "GET") @GetMapping("/page") - public PageResult page(@RequestParam(required = false) String checkMethod){ - return PageResult.ok(checkSchemeService.page(checkMethod)); + public PageResult page(@RequestParam(required = false) List checkMethods){ + return PageResult.ok(checkSchemeService.page(checkMethods)); } @ApiOperation(value = "查询检查方案信息列表", httpMethod = "GET") @GetMapping("/list") - public Result> list(@RequestParam(required = false) String checkMethod){ - return Result.ok(checkSchemeService.list(checkMethod)); + public Result> list(@RequestParam(required = false) List checkMethods){ + return Result.ok(checkSchemeService.list(checkMethods)); } @ApiOperation(value = "查询检查方案详情", httpMethod = "GET") diff --git a/web/src/main/java/com/dite/znpt/web/controller/InspectionReportController.java b/web/src/main/java/com/dite/znpt/web/controller/InspectionReportController.java index 090f103..2e49681 100644 --- a/web/src/main/java/com/dite/znpt/web/controller/InspectionReportController.java +++ b/web/src/main/java/com/dite/znpt/web/controller/InspectionReportController.java @@ -1,8 +1,19 @@ package com.dite.znpt.web.controller; +import com.dite.znpt.domain.PageResult; +import com.dite.znpt.domain.Result; +import com.dite.znpt.domain.vo.InspectionReportListReq; +import com.dite.znpt.domain.vo.InspectionReportListResp; +import com.dite.znpt.domain.vo.InspectionReportReq; +import com.dite.znpt.domain.vo.InspectionReportResp; +import com.dite.znpt.service.InspectionReportService; import io.swagger.annotations.Api; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import io.swagger.annotations.ApiOperation; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; /** * @author Bear.G @@ -13,4 +24,40 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/inspection-report") public class InspectionReportController { + + @Resource + private InspectionReportService inspectionReportService; + + + @ApiOperation(value = "分页查询检查报告列表", httpMethod = "GET") + @GetMapping("/page") + public PageResult page(InspectionReportListReq req) { + return PageResult.ok(inspectionReportService.page(req)); + } + + @ApiOperation(value = "查询检查报告列表", httpMethod = "GET") + @GetMapping("/list") + public Result> list(InspectionReportListReq req) { + return Result.ok(inspectionReportService.list(req)); + } + + @ApiOperation(value = "查询检查报告详情", httpMethod = "GET") + @GetMapping("/detail/{reportId}") + public Result detail(@PathVariable String reportId) { + return Result.ok(inspectionReportService.detail(reportId)); + } + + @ApiOperation(value = "新增检查报告", httpMethod = "POST") + @PostMapping + public Result add(@Validated @RequestBody InspectionReportReq req) { + inspectionReportService.save(req); + return Result.ok(); + } + + @ApiOperation(value = "修改检查报告", httpMethod = "PUT") + @PostMapping("/{reportId}") + public Result edit(@PathVariable String reportId, @Validated @RequestBody InspectionReportReq req) { + inspectionReportService.update(reportId, req); + return Result.ok(); + } }