From f169e1c657ce85cb5988101f053f42d5645edcc4 Mon Sep 17 00:00:00 2001 From: liwen Date: Thu, 28 Dec 2023 16:46:50 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E6=BC=94=E7=BB=83&?= =?UTF-8?q?=E5=9F=B9=E8=AE=AD&=E4=BC=9A=E8=AE=AE=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E9=83=A8=E5=88=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/constants/SafeProductConstant.java | 2 + .../safeproduct/entity/ConferenceRecordEntity.java | 2 +- .../safeproduct/controller/BaseController.java | 56 ++++++++++++++++++++++ .../safeproduct/controller/TrainController.java | 22 +-------- .../safeproduct/mapper/ConferencePlanMapper.xml | 8 ++-- .../safeproduct/mapper/RehearsalPlanMapper.xml | 2 +- .../service/impl/ConferencePlanServiceImpl.java | 4 +- 7 files changed, 67 insertions(+), 29 deletions(-) create mode 100644 hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/BaseController.java diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java index 84ae0c6..bcfb2fb 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/constants/SafeProductConstant.java @@ -8,6 +8,8 @@ package com.hnac.hzims.safeproduct.constants; */ public interface SafeProductConstant { + String TENANT_ID = "200000"; + int SUCCESS = 1; int FAILURE = 0; diff --git a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java index 42968dd..1aa0309 100644 --- a/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java +++ b/hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/ConferenceRecordEntity.java @@ -37,7 +37,7 @@ public class ConferenceRecordEntity extends BaseEntity { @ApiModelProperty("会议实际结束时间") private Date actualEndTime; - @Size(max = 250, message = "记录人字段长度不能超过250") + @Size(max = 20, message = "记录人字段长度不能超过20") @ApiModelProperty("记录人") private String recorder; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/BaseController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/BaseController.java new file mode 100644 index 0000000..a920746 --- /dev/null +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/BaseController.java @@ -0,0 +1,56 @@ +package com.hnac.hzims.safeproduct.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.hnac.hzims.safeproduct.constants.SafeProductConstant; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.secure.BladeUser; +import org.springblade.core.tool.api.R; +import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 公用业务接口类 + * + * @author liwen + * @date 2023-12-28 + */ +@RestController +@AllArgsConstructor +@RequestMapping("/base") +@Api(value = "公用业务", tags = "公用业务接口") +public class BaseController extends BladeController { + + private final ISysClient sysClient; + + private final IUserClient userClient; + + @GetMapping("/getDeptName") + @ApiOperation(value = "获取所属机构名") + @ApiOperationSupport(order = 1) + public R getDeptName() { + BladeUser bladeUser = getUser(); + String deptId = bladeUser.getDeptId(); + if (StringUtils.isNotBlank(deptId)) { + return sysClient.getDeptName(Long.valueOf(deptId)); + } + return R.data(null, "所属机构为空"); + } + + @GetMapping("/getUserList") + @ApiOperation(value = "获取用户列表") + @ApiOperationSupport(order = 2) + public R> getUserList(@RequestParam String name) { + return userClient.userListByCodeAndNameAndAccount(SafeProductConstant.TENANT_ID, null, name, null); + } +} 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 92d703c..d306a47 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 @@ -21,12 +21,9 @@ import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; -import org.apache.commons.lang3.StringUtils; import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Query; -import org.springblade.core.secure.BladeUser; import org.springblade.core.tool.api.R; -import org.springblade.system.feign.ISysClient; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; @@ -55,8 +52,6 @@ public class TrainController extends BladeController { private final ITestScoreService testScoreService; - private final ISysClient sysClient; - @PostMapping("/saveTrainPlan") @ApiOperation(value = "新增培训计划") @ApiOperationSupport(order = 1) @@ -224,18 +219,6 @@ public class TrainController extends BladeController { return R.data(page); } - @GetMapping("/getDeptName") - @ApiOperation(value = "获取所属机构名") - @ApiOperationSupport(order = 22) - public R getDeptName() { - BladeUser bladeUser = getUser(); - String deptId = bladeUser.getDeptId(); - if (StringUtils.isNotBlank(deptId)) { - return sysClient.getDeptName(Long.valueOf(deptId)); - } - return R.data(null, "所属机构为空"); - } - @GetMapping("/exportTrainPlanData") @ApiImplicitParams({ @ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), @@ -243,7 +226,7 @@ public class TrainController extends BladeController { @ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训计划数据导出") - @ApiOperationSupport(order = 23) + @ApiOperationSupport(order = 22) public void exportTrainPlanData(@ApiIgnore @RequestParam Map param, HttpServletResponse response) { trainPlanService.exportTrainPlanData(param, response); } @@ -253,9 +236,8 @@ public class TrainController extends BladeController { @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string") }) @ApiOperation(value = "培训记录数据导出") - @ApiOperationSupport(order = 24) + @ApiOperationSupport(order = 23) public void exportTrainRecordData(@ApiIgnore @RequestParam Map param, HttpServletResponse response) { trainRecordService.exportTrainRecordData(param, response); } - } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/ConferencePlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/ConferencePlanMapper.xml index 841cf7c..c71d0dc 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/ConferencePlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/ConferencePlanMapper.xml @@ -10,13 +10,13 @@ LEFT JOIN hzims_conference_record t2 ON t1.id = t2.conference_plan_id WHERE t1.is_deleted = 0 - - AND t1.unit = #{unit} + + AND t1.unit like concat('%', #{unit}, '%') - + AND t1.scheduled_start_time >= #{startTime} - + AND t1.scheduled_end_time < #{endTime} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml index 66626be..e3f1b14 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml @@ -72,7 +72,7 @@ WHERE t1.is_deleted = 0 - AND t1.unit like #{unit} + AND t1.unit like concat('%', #{unit}, '%') AND t1.scheduled_start_time >= #{startTime} diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java index eb8f3af..2d742ce 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java @@ -10,11 +10,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.dto.ConferenceExportDTO; -import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO; import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; import com.hnac.hzims.safeproduct.enums.ConferenceMethodEnum; import com.hnac.hzims.safeproduct.enums.ConferenceStatusEnum; -import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper; import com.hnac.hzims.safeproduct.service.IConferencePlanService; import com.hnac.hzims.safeproduct.service.IConferenceRecordService; @@ -67,7 +65,7 @@ public class ConferencePlanServiceImpl extends ServiceImpl