From 693132b15b03fef99f329abe00bd9bdd6172a83c Mon Sep 17 00:00:00 2001 From: liwen Date: Mon, 3 Jun 2024 17:34:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=BC=94=E7=BB=83?= =?UTF-8?q?=E3=80=81=E5=9F=B9=E8=AE=AD=E3=80=81=E5=8D=AB=E7=94=9F=E6=9C=88?= =?UTF-8?q?=E5=BA=A6=E7=BB=9F=E8=AE=A1=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/controller/HygieneController.java | 15 ++++++++++ .../controller/RehearsalController.java | 18 ++++++++++-- .../safeproduct/controller/TrainController.java | 18 ++++++++++-- .../hzims/safeproduct/mapper/TrainPlanMapper.xml | 11 +++---- .../safeproduct/service/IHygienePlanService.java | 8 +++++ .../safeproduct/service/IRehearsalPlanService.java | 8 +++++ .../safeproduct/service/ITrainPlanService.java | 8 +++++ .../service/impl/HygienePlanServiceImpl.java | 33 +++++++++++++++++++++ .../service/impl/RehearsalPlanServiceImpl.java | 33 +++++++++++++++++++-- .../service/impl/TrainPlanServiceImpl.java | 34 ++++++++++++++++++++++ 10 files changed, 173 insertions(+), 13 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java index 8290da9..1c4de51 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java @@ -230,4 +230,19 @@ public class HygieneController extends BladeController { IPage page = hygieneTemplateService.getHygieneTemplatePage(param, query); return R.data(page); } + + @GetMapping("/detailListByMonth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "hygienePlanStatus", value = "卫生计划状态", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "卫生月度详情列表") + @ApiOperationSupport(order = 20) + @Operate(label = "卫生月度详情列表", type = BusinessType.QUERY, ignore = false) + public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = hygienePlanService.getDetailListByMonth(param, query); + return R.data(page); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index 14cdc89..08d28ce 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -82,8 +82,7 @@ public class RehearsalController extends BladeController { @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "rehearsalStatus", value = "演练状态", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "演练计划分页") @ApiOperationSupport(order = 5) @@ -178,4 +177,19 @@ public class RehearsalController extends BladeController { public void exportRehearsalRecordData(@RequestParam Long id, HttpServletResponse response) { rehearsalRecordService.exportRehearsalRecordData(id, response); } + + @GetMapping("/detailListByMonth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "rehearsalStatus", value = "演练状态", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "演练月度详情列表") + @ApiOperationSupport(order = 15) + @Operate(label = "演练月度详情列表", type = BusinessType.QUERY, ignore = false) + public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = rehearsalPlanService.getDetailListByMonth(query, param); + return R.data(page); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java index 7eda44c..ef252f9 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java @@ -91,8 +91,7 @@ public class TrainController extends BladeController { @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), - @ApiImplicitParam(name = "trainStatus", value = "培训计划状态", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训计划分页") @ApiOperationSupport(order = 5) @@ -276,4 +275,19 @@ public class TrainController extends BladeController { public void exportTrainRecordData(@RequestParam Long id, HttpServletResponse response) { trainRecordService.exportTrainRecordData(id, response); } + + @GetMapping("/detailListByMonth") + @ApiImplicitParams({ + @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "trainStatus", value = "培训计划状态", dataType = "query", paramType = "string") + }) + @ApiOperation(value = "培训月度详情列表") + @ApiOperationSupport(order = 24) + @Operate(label = "培训月度详情列表", type = BusinessType.QUERY, ignore = false) + public R> detailListByMonth(@ApiIgnore @RequestParam Map param, Query query) { + IPage page = trainPlanService.getDetailListByMonth(param, query); + return R.data(page); + } } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml index 19ef188..45cc431 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml @@ -81,14 +81,11 @@ AND unit like concat('%', #{param.unit}, '%') - - AND scheduled_start_time >= #{param.startTime} + + AND scheduled_start_time >= #{param.scheduledStartTime} - - AND scheduled_end_time <= #{param.endTime} - - - AND train_status = #{param.trainStatus} + + AND scheduled_end_time <= #{param.scheduledEndTime} ORDER BY create_time DESC diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java index a564531..484cfcf 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygienePlanService.java @@ -92,4 +92,12 @@ public interface IHygienePlanService extends IService { * @param response 响应类 */ void exportHygienePlanData(Map param, HttpServletResponse response); + + /** + * 查询卫生月度详情列表 + * @param param 参数 + * @param query 分页类 + * @return 月度详情列表 + */ + IPage getDetailListByMonth(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java index d679fc0..7745227 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java @@ -66,4 +66,12 @@ public interface IRehearsalPlanService extends IService { * @return 演练计划数据 */ IPage rehearsalPlanPage(Map param, Query query); + + /** + * 查询月度详情列表 + * @param query 分页类 + * @param param 参数 + * @return 详情列表 + */ + IPage getDetailListByMonth(Query query, Map param); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java index 75e86ed..1aa7ad7 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java @@ -66,4 +66,12 @@ public interface ITrainPlanService extends IService { * @return 培训计划数据 */ IPage trainPlanPage(Map param, Query query); + + /** + * 查询培训月度详情列表 + * @param param 参数 + * @param query 分页类 + * @return 月度详情列表 + */ + IPage getDetailListByMonth(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java index d0d3b88..ea4d1a0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java @@ -371,6 +371,39 @@ public class HygienePlanServiceImpl extends ServiceImpl getDetailListByMonth(Map param, Query query) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String unit = String.valueOf(param.get("unit")); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String hygieneStatus = String.valueOf(param.get("hygienePlanStatus")); + if (!unit.equals("null") && !unit.equals("")) { + queryWrapper.lambda().like(HygienePlanEntity::getUnit, unit); + } + if (!startTime.equals("null") && !startTime.equals("")) { + queryWrapper.lambda().ge(HygienePlanEntity::getScheduledEndTime, startTime); + } + if (!endTime.equals("null") && !endTime.equals("")) { + queryWrapper.lambda().le(HygienePlanEntity::getScheduledEndTime, endTime); + } + if (!hygieneStatus.equals("null") && !hygieneStatus.equals("")) { + // 未完成计划包括UNFINISHED和WAITING两种状态 + if (hygieneStatus.equals("UNFINISHED+WAITING")) { + queryWrapper.lambda().and(wrapper -> wrapper.eq(HygienePlanEntity::getHygienePlanStatus, HygieneStatusEnum.UNFINISHED.getValue()) + .or() + .eq(HygienePlanEntity::getHygienePlanStatus, HygieneStatusEnum.WAITING.getValue())); + } else { + queryWrapper.lambda().eq(HygienePlanEntity::getHygienePlanStatus, hygieneStatus); + } + } + queryWrapper.lambda().orderByDesc(HygienePlanEntity::getCreateTime); + return this.page(Condition.getPage(query), queryWrapper); + } + + /** * 根据单位、名称、时间查询卫生自查计划 * @param unit 单位 * @param name 名称 diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java index 9cd63ef..08c858e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java @@ -276,7 +276,6 @@ public class RehearsalPlanServiceImpl extends ServiceImpl getDetailListByMonth(Query query, Map param) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String unit = String.valueOf(param.get("unit")); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String rehearsalStatus = String.valueOf(param.get("rehearsalStatus")); + if (!unit.equals("null") && !unit.equals("")) { + queryWrapper.lambda().like(RehearsalPlanEntity::getUnit, unit); + } + if (!startTime.equals("null") && !startTime.equals("")) { + queryWrapper.lambda().ge(RehearsalPlanEntity::getScheduledEndTime, startTime); + } + if (!endTime.equals("null") && !endTime.equals("")) { + queryWrapper.lambda().le(RehearsalPlanEntity::getScheduledEndTime, endTime); + } if (!rehearsalStatus.equals("null") && !rehearsalStatus.equals("")) { - queryWrapper.lambda().eq(RehearsalPlanEntity::getRehearsalStatus, rehearsalStatus); + // 未完成计划包括UNFINISHED和WAITING两种状态 + if (rehearsalStatus.equals("UNFINISHED+WAITING")) { + queryWrapper.lambda().and(wrapper -> wrapper.eq(RehearsalPlanEntity::getRehearsalStatus, RehearsalStatusEnum.UNFINISHED.getValue()) + .or() + .eq(RehearsalPlanEntity::getRehearsalStatus, RehearsalStatusEnum.WAITING.getValue())); + } else { + queryWrapper.lambda().eq(RehearsalPlanEntity::getRehearsalStatus, rehearsalStatus); + } } queryWrapper.lambda().orderByDesc(RehearsalPlanEntity::getCreateTime); return this.page(Condition.getPage(query), queryWrapper); diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java index 3f3af95..40fb225 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java @@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; @@ -268,6 +269,39 @@ public class TrainPlanServiceImpl extends ServiceImpl getDetailListByMonth(Map param, Query query) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String unit = String.valueOf(param.get("unit")); + String startTime = String.valueOf(param.get("scheduledStartTime")); + String endTime = String.valueOf(param.get("scheduledEndTime")); + String trainStatus = String.valueOf(param.get("trainStatus")); + if (!unit.equals("null") && !unit.equals("")) { + queryWrapper.lambda().like(TrainPlanEntity::getUnit, unit); + } + if (!startTime.equals("null") && !startTime.equals("")) { + queryWrapper.lambda().ge(TrainPlanEntity::getScheduledEndTime, startTime); + } + if (!endTime.equals("null") && !endTime.equals("")) { + queryWrapper.lambda().le(TrainPlanEntity::getScheduledEndTime, endTime); + } + if (!trainStatus.equals("null") && !trainStatus.equals("")) { + // 未完成计划包括UNFINISHED和WAITING两种状态 + if (trainStatus.equals("UNFINISHED+WAITING")) { + queryWrapper.lambda().and(wrapper -> wrapper.eq(TrainPlanEntity::getTrainStatus, TrainStatusEnum.UNFINISHED.getValue()) + .or() + .eq(TrainPlanEntity::getTrainStatus, TrainStatusEnum.WAITING.getValue())); + } else { + queryWrapper.lambda().eq(TrainPlanEntity::getTrainStatus, trainStatus); + } + } + queryWrapper.lambda().orderByDesc(TrainPlanEntity::getCreateTime); + return this.page(Condition.getPage(query), queryWrapper); + } + + /** * 根据单位和计划时间查询培训计划数据 * @param unit 单位 * @param startTime 计划开始时间