From 7baa8e63bcba6eae2728d806a78239d522b36dfc Mon Sep 17 00:00:00 2001 From: Administrator <1923636941@qq.com> Date: Fri, 24 Feb 2023 11:32:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=99=85=E8=BF=9B=E5=BA=A6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MaterialApproachRecordController.java | 4 +-- .../MaterialDetectionReportController.java | 5 ++-- .../material/entity/qo/DetectionDateQO.java | 24 ++++++++++++++++++ .../MaterialDetectionReportService.java | 3 ++- .../MaterialDetectionReportServiceImpl.java | 14 ++++++++--- .../project/entity/vo/ActualProgressVO.java | 13 +++++++++- .../service/impl/ProgressTaskServiceImpl.java | 25 +++++++++++-------- .../controller/WindowDisplayController.java | 2 +- 8 files changed, 69 insertions(+), 21 deletions(-) create mode 100644 src/main/java/com/zhgd/xmgl/modules/material/entity/qo/DetectionDateQO.java diff --git a/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialApproachRecordController.java b/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialApproachRecordController.java index c54a9beb8..021c44a8d 100644 --- a/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialApproachRecordController.java +++ b/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialApproachRecordController.java @@ -126,8 +126,8 @@ public class MaterialApproachRecordController { @ApiOperation(value = "删除材料进场记录 信息", notes = "删除材料进场记录 信息", httpMethod = "POST") @ApiImplicitParam(name = "id", value = "材料进场记录 ID", paramType = "query", required = true, dataType = "Integer") @PostMapping(value = "/delete") - public Result delete(@RequestParam(name = "id", required = true) String id) { - materialApproachRecordService.removeById(id); + public Result delete(@RequestBody String id) { + materialApproachRecordService.removeById(JSON.parseObject(id).get("id").toString()); return Result.ok(); } diff --git a/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialDetectionReportController.java b/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialDetectionReportController.java index 7b3c72b7f..bf4fdb514 100644 --- a/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialDetectionReportController.java +++ b/src/main/java/com/zhgd/xmgl/modules/material/controller/MaterialDetectionReportController.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.xmgl.modules.material.entity.MaterialDetectionReport; +import com.zhgd.xmgl.modules.material.entity.qo.DetectionDateQO; import com.zhgd.xmgl.modules.material.entity.qo.MaterialDetectionReportQO; import com.zhgd.xmgl.modules.material.entity.qo.SumQualifiedRatioVO; import com.zhgd.xmgl.modules.material.service.MaterialDetectionReportService; @@ -65,8 +66,8 @@ public class MaterialDetectionReportController { @ApiImplicitParam(name = "projectSn", value = "项目sn", dataType = "string", dataTypeClass = String.class, paramType = "query"), @ApiImplicitParam(name = "size", value = "返回条数,默认10条", dataType = "string", dataTypeClass = String.class, defaultValue = "10", paramType = "query") }) - public Result> limitByDetectionDate(String projectSn, @RequestParam(name = "size", defaultValue = "10") Integer size) { - return Result.success(materialDetectionReportService.limitByDetectionDate(projectSn, size)); + public Result> limitByDetectionDate(DetectionDateQO qo) { + return Result.success(materialDetectionReportService.limitByDetectionDate(qo)); } /** diff --git a/src/main/java/com/zhgd/xmgl/modules/material/entity/qo/DetectionDateQO.java b/src/main/java/com/zhgd/xmgl/modules/material/entity/qo/DetectionDateQO.java new file mode 100644 index 000000000..97255d90e --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/modules/material/entity/qo/DetectionDateQO.java @@ -0,0 +1,24 @@ +package com.zhgd.xmgl.modules.material.entity.qo; + +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel +public class DetectionDateQO { + /** + * 事件类型 + */ + @TableField(value = "event_type") + @ApiModelProperty(value = "事件类型") + private String eventType; + + @ApiModelProperty(value = "楼层") + private String floor; + + private String projectSn; + + private Integer size; +} diff --git a/src/main/java/com/zhgd/xmgl/modules/material/service/MaterialDetectionReportService.java b/src/main/java/com/zhgd/xmgl/modules/material/service/MaterialDetectionReportService.java index f1c5276bd..61476db16 100644 --- a/src/main/java/com/zhgd/xmgl/modules/material/service/MaterialDetectionReportService.java +++ b/src/main/java/com/zhgd/xmgl/modules/material/service/MaterialDetectionReportService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.zhgd.xmgl.modules.material.entity.MaterialDetectionReport; +import com.zhgd.xmgl.modules.material.entity.qo.DetectionDateQO; import com.zhgd.xmgl.modules.material.entity.qo.MaterialDetectionReportQO; import com.zhgd.xmgl.modules.material.entity.qo.SumQualifiedRatioVO; @@ -27,6 +28,6 @@ public interface MaterialDetectionReportService extends IService limitByDetectionDate(String projectSn, Integer size); + List limitByDetectionDate(DetectionDateQO qo); } diff --git a/src/main/java/com/zhgd/xmgl/modules/material/service/impl/MaterialDetectionReportServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/material/service/impl/MaterialDetectionReportServiceImpl.java index a50274b75..3674fbbd3 100644 --- a/src/main/java/com/zhgd/xmgl/modules/material/service/impl/MaterialDetectionReportServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/material/service/impl/MaterialDetectionReportServiceImpl.java @@ -8,10 +8,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.zhgd.xmgl.modules.material.entity.MaterialDetectionReport; +import com.zhgd.xmgl.modules.material.entity.qo.DetectionDateQO; import com.zhgd.xmgl.modules.material.entity.qo.MaterialDetectionReportQO; import com.zhgd.xmgl.modules.material.entity.qo.SumQualifiedRatioVO; import com.zhgd.xmgl.modules.material.mapper.MaterialDetectionReportMapper; import com.zhgd.xmgl.modules.material.service.MaterialDetectionReportService; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -68,10 +70,16 @@ public class MaterialDetectionReportServiceImpl extends ServiceImpl limitByDetectionDate(String projectSn, Integer size) { + public List limitByDetectionDate(DetectionDateQO qo) { + if (qo.getSize() == null) { + qo.setSize(10); + } // 查询材料检验报告条件 根据需求调整 - LambdaQueryWrapper wrapper = Wrappers.lambdaQuery().eq(MaterialDetectionReport::getProjectSn, projectSn); + LambdaQueryWrapper wrapper = Wrappers.lambdaQuery() + .eq(MaterialDetectionReport::getProjectSn, qo.getProjectSn()) + .eq(StringUtils.isNoneBlank(qo.getFloor()), MaterialDetectionReport::getFloor, qo.getFloor()) + .eq(StringUtils.isNoneBlank(qo.getEventType()), MaterialDetectionReport::getEventType, qo.getEventType()); wrapper.orderByDesc(MaterialDetectionReport::getDetectionDate); - return materialDetectionReportMapper.selectPage(new Page<>(1, size), wrapper).getRecords(); + return materialDetectionReportMapper.selectPage(new Page<>(1, qo.getSize()), wrapper).getRecords(); } } \ No newline at end of file diff --git a/src/main/java/com/zhgd/xmgl/modules/project/entity/vo/ActualProgressVO.java b/src/main/java/com/zhgd/xmgl/modules/project/entity/vo/ActualProgressVO.java index 20daeb0d7..39014bd04 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/entity/vo/ActualProgressVO.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/entity/vo/ActualProgressVO.java @@ -1,5 +1,7 @@ package com.zhgd.xmgl.modules.project.entity.vo; +import com.baomidou.mybatisplus.annotation.FieldStrategy; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -48,6 +50,14 @@ public class ActualProgressVO { @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") @DateTimeFormat(pattern = "yyyy-MM-dd") private Date actualStartDate; + /** + * 实际完成时间 + */ + @TableField(value = "actual_finish_date", updateStrategy = FieldStrategy.IGNORED) + @ApiModelProperty(value = "实际完成时间") + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date actualFinishDate; /** * 状态,1提前 ,2正常,3延迟 @@ -55,11 +65,12 @@ public class ActualProgressVO { @ApiModelProperty(value = "状态,1提前 ,2正常,3延迟") private Integer status; - public ActualProgressVO(String taskName, Date startDate, Date finishDate, Date actualStartDate, Integer status) { + public ActualProgressVO(String taskName, Date startDate, Date finishDate, Date actualStartDate, Integer status,Date actualFinishDate) { this.taskName = taskName; this.startDate = startDate; this.finishDate = finishDate; this.actualStartDate = actualStartDate; + this.actualFinishDate = actualFinishDate; this.status = status; } } diff --git a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressTaskServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressTaskServiceImpl.java index ba13d9441..80c78abbd 100644 --- a/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressTaskServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/project/service/impl/ProgressTaskServiceImpl.java @@ -403,22 +403,25 @@ public class ProgressTaskServiceImpl extends ServiceImpl { Date startDate = progressTask.getStartDate(); + Date finishDate = progressTask.getFinishDate(); Date actualStartDate = progressTask.getActualStartDate(); - + Date actualFinishDate = progressTask.getActualFinishDate(); + long datePeriod = finishDate.getTime() - startDate.getTime(); int status; - if (actualStartDate == null || (startDate.getTime() < actualStartDate.getTime()) - || (progressTask.getActualFinishDate() != null && progressTask.getActualFinishDate().getTime() > progressTask.getFinishDate().getTime()) - || (progressTask.getActualFinishDate() == null && progressTask.getFinishDate().before(new Date()))) { - // 实际开始时间晚于预计开始时间 - status = 3; - } else if (startDate.getTime() > actualStartDate.getTime()) { - // 实际开始时间比预计开始时间早 + //状态 1:提前 2正常 3延迟 + if (actualStartDate != null && actualFinishDate != null && actualFinishDate.getTime() - actualStartDate.getTime() < datePeriod) { + //1:提前 status = 1; - } else { - // 实际开始时间等于预计开始时间 + } else if ((actualStartDate == null && actualFinishDate == null) || + (actualStartDate != null && actualFinishDate != null && actualFinishDate.getTime() - actualStartDate.getTime() == datePeriod) || + (actualStartDate != null && actualFinishDate == null && System.currentTimeMillis() - actualStartDate.getTime() <= datePeriod)) { + //2正常 status = 2; + } else { + //3延迟 + status = 3; } - return new ActualProgressVO(progressTask.getTaskName(), startDate, progressTask.getFinishDate(), actualStartDate, status); + return new ActualProgressVO(progressTask.getTaskName(), startDate, progressTask.getFinishDate(), actualStartDate, status, actualFinishDate); }).collect(Collectors.toList()); } diff --git a/src/main/java/com/zhgd/xmgl/modules/windowdisplay/controller/WindowDisplayController.java b/src/main/java/com/zhgd/xmgl/modules/windowdisplay/controller/WindowDisplayController.java index 5fb4a1876..ef6b7d61d 100644 --- a/src/main/java/com/zhgd/xmgl/modules/windowdisplay/controller/WindowDisplayController.java +++ b/src/main/java/com/zhgd/xmgl/modules/windowdisplay/controller/WindowDisplayController.java @@ -74,7 +74,7 @@ public class WindowDisplayController { @GetMapping(value = "/list") @ApiOperation(value = "所有亮点展示") public Result> list(WindowDisplay windowDisplay) { - return Result.success(windowDisplayService.list(new LambdaQueryWrapper<>(windowDisplay).orderByDesc(WindowDisplay::getUpdateDate))); + return Result.success(windowDisplayService.list(new LambdaQueryWrapper<>(windowDisplay).orderByDesc(WindowDisplay::getUpdateDate).last("limit 4"))); } /**