Browse Source

update: 培训管理优化

zhongwei
liwen 10 months ago
parent
commit
1d0a93fe7d
  1. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java
  2. 31
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java
  3. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  4. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java
  5. 23
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml
  6. 10
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java
  7. 20
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml
  8. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java
  9. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java
  10. 13
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java
  11. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java
  12. BIN
      hzims-service/safeproduct/src/main/resources/template/培训记录表.docx

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/entity/TestEntity.java

@ -74,4 +74,7 @@ public class TestEntity extends BaseEntity {
@Size(max = 1000, message = "考试附件字段长度不能超过1000") @Size(max = 1000, message = "考试附件字段长度不能超过1000")
@ApiModelProperty("考试附件") @ApiModelProperty("考试附件")
private String filePath; private String filePath;
@ApiModelProperty("考试方式")
private String testMethod;
} }

31
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/enums/TestMethodEnum.java

@ -0,0 +1,31 @@
package com.hnac.hzims.safeproduct.enums;
/**
* 考试方式枚举类
*
* @author liwen
* @date 2024-01-25
*/
public enum TestMethodEnum {
ONLINE("ONLINE", "线上"),
OFFLINE("OFFLINE", "线下"),
MIXED("MIXED", "线上+线下");
private final String value;
private final String desc;
TestMethodEnum(String value, String desc) {
this.value = value;
this.desc = desc;
}
public String getValue() {
return value;
}
public String getDesc() {
return desc;
}
}

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -124,13 +124,14 @@ public class TrainController extends BladeController {
@GetMapping("/trainRecordPage") @GetMapping("/trainRecordPage")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string") @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "startTime", value = "计划开始时间", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "endTime", value = "计划结束时间", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "培训记录分页") @ApiOperation(value = "培训记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = trainRecordService.page(Condition.getPage(query), Condition.getQueryWrapper( IPage<TrainRecordEntity> page = trainRecordService.trainRecordPage(param, query);
param, TrainRecordEntity.class).lambda().orderByDesc(TrainRecordEntity::getCreateTime));
return R.data(page); return R.data(page);
} }
@ -173,13 +174,14 @@ public class TrainController extends BladeController {
@GetMapping("/testPage") @GetMapping("/testPage")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"), @ApiImplicitParam(name = "trainPlanId", value = "培训计划id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string") @ApiImplicitParam(name = "trainRecordId", value = "培训记录id", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "testName", value = "考试名称", dataType = "query", paramType = "string"),
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string")
}) })
@ApiOperation(value = "考试记录分页") @ApiOperation(value = "考试记录分页")
@ApiOperationSupport(order = 16) @ApiOperationSupport(order = 16)
public R<IPage<TestEntity>> testPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<TestEntity>> testPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TestEntity> page = testService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TestEntity.class) IPage<TestEntity> page = testService.testPage(param, query);
.lambda().orderByDesc(TestEntity::getCreateTime));
return R.data(page); return R.data(page);
} }

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.java

@ -1,11 +1,13 @@
package com.hnac.hzims.safeproduct.mapper; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity; import com.hnac.hzims.safeproduct.entity.TestEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 考试记录Mapper类 * 考试记录Mapper类
@ -22,4 +24,12 @@ public interface TestMapper extends BaseMapper<TestEntity> {
* @return 考试记录名称列表 * @return 考试记录名称列表
*/ */
List<TestDTO> getTestNameList(String trainPlanId); List<TestDTO> getTestNameList(String trainPlanId);
/**
* 考试记录分页
* @param param 入参
* @param page 分页类
* @return 考试记录数据
*/
IPage<TestEntity> testPage(IPage<TestEntity> page, Map<String, Object> param);
} }

23
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml

@ -15,4 +15,27 @@
ORDER BY ORDER BY
create_time DESC create_time DESC
</select> </select>
<select id="testPage" resultType="com.hnac.hzims.safeproduct.entity.TestEntity">
SELECT
*
FROM
hzims_test
WHERE
is_deleted = 0
<if test="param.trainPlanId != null and param.trainPlanId != ''">
AND train_plan_id = #{param.trainPlanId}
</if>
<if test="param.trainRecordId != null and param.trainRecordId != ''">
AND train_record_id = #{param.trainRecordId}
</if>
<if test="param.testName != null and param.testName != ''">
AND test_name like concat('%', #{param.testName}, '%)'
</if>
<if test="param.unit != null and param.unit != ''">
AND test_name like concat('%', #{param.unit}, '%)'
</if>
ORDER BY
create_time DESC
</select>
</mapper> </mapper>

10
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.java

@ -1,12 +1,14 @@
package com.hnac.hzims.safeproduct.mapper; package com.hnac.hzims.safeproduct.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 培训记录Mapper类 * 培训记录Mapper类
@ -30,4 +32,12 @@ public interface TrainRecordMapper extends BaseMapper<TrainRecordEntity> {
* @return 培训记录表VO类 * @return 培训记录表VO类
*/ */
TrainRecordDetailVO getTrainRecordDetailById(Long id); TrainRecordDetailVO getTrainRecordDetailById(Long id);
/**
* 培训记录分页
* @param param 入参
* @param page 分页类
* @return 培训记录数据
*/
IPage<TrainRecordEntity> trainRecordPage(IPage<TrainRecordEntity> page, Map<String, Object> param);
} }

20
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainRecordMapper.xml

@ -27,4 +27,24 @@
t1.is_deleted = 0 t1.is_deleted = 0
AND t1.id = #{id} AND t1.id = #{id}
</select> </select>
<select id="trainRecordPage" resultType="com.hnac.hzims.safeproduct.entity.TrainRecordEntity">
SELECT
*
FROM
hzims_train_record
WHERE
is_deleted = 0
<if test="param.trainPlanId != null and param.trainPlanId != ''">
AND train_plan_id = #{param.trainPlanId}
</if>
<if test="param.startTime != null and param.startTime != ''">
AND actual_start_time >= #{param.startTime}
</if>
<if test="param.endTime != null and param.endTime != ''">
AND actual_end_time &lt;= #{param.endTime}
</if>
ORDER BY
create_time DESC
</select>
</mapper> </mapper>

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITestService.java

@ -1,11 +1,14 @@
package com.hnac.hzims.safeproduct.service; package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.dto.TestDTO;
import com.hnac.hzims.safeproduct.entity.TestEntity; import com.hnac.hzims.safeproduct.entity.TestEntity;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 考试记录服务类 * 考试记录服务类
@ -63,4 +66,12 @@ public interface ITestService extends IService<TestEntity> {
* @return true-成功false-失败 * @return true-成功false-失败
*/ */
boolean updateTest(TestEntity testEntity); boolean updateTest(TestEntity testEntity);
/**
* 考试记录分页
* @param param 入参
* @param query 分页类
* @return 考试记录数据
*/
IPage<TestEntity> testPage(Map<String, Object> param, Query query);
} }

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainRecordService.java

@ -1,12 +1,15 @@
package com.hnac.hzims.safeproduct.service; package com.hnac.hzims.safeproduct.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.safeproduct.dto.TrainRecordDTO; import com.hnac.hzims.safeproduct.dto.TrainRecordDTO;
import com.hnac.hzims.safeproduct.entity.TrainRecordEntity; import com.hnac.hzims.safeproduct.entity.TrainRecordEntity;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.springblade.core.mp.support.Query;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 培训记录服务类 * 培训记录服务类
@ -64,4 +67,12 @@ public interface ITrainRecordService extends IService<TrainRecordEntity> {
* @return 培训记录表VO类 * @return 培训记录表VO类
*/ */
TrainRecordDetailVO getTrainRecordDetailById(Long id); TrainRecordDetailVO getTrainRecordDetailById(Long id);
/**
* 培训记录分页
* @param param 入参
* @param query 分页类
* @return 培训记录数据
*/
IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query);
} }

13
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TestServiceImpl.java

@ -3,6 +3,8 @@ package com.hnac.hzims.safeproduct.service.impl;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
import com.hnac.hzims.safeproduct.dto.TestDTO; import com.hnac.hzims.safeproduct.dto.TestDTO;
@ -14,6 +16,7 @@ import com.hnac.hzims.safeproduct.mapper.TrainPlanMapper;
import com.hnac.hzims.safeproduct.service.ITestScoreService; import com.hnac.hzims.safeproduct.service.ITestScoreService;
import com.hnac.hzims.safeproduct.service.ITestService; import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.BaseUtil;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -23,6 +26,7 @@ import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -175,6 +179,15 @@ public class TestServiceImpl extends ServiceImpl<TestMapper, TestEntity> impleme
} }
/** /**
* 考试记录分页
*/
@Override
public IPage<TestEntity> testPage(Map<String, Object> param, Query query) {
IPage<TestEntity> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.testPage(page, param);
}
/**
* 获取成绩列表 * 获取成绩列表
* @param testEntity 考试记录实体类 * @param testEntity 考试记录实体类
* @param person 参考人员 * @param person 参考人员

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -4,6 +4,8 @@ import cn.afterturn.easypoi.entity.ImageEntity;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.constants.SafeProductConstant;
@ -18,6 +20,7 @@ import com.hnac.hzims.safeproduct.service.ITestService;
import com.hnac.hzims.safeproduct.service.ITrainRecordService; import com.hnac.hzims.safeproduct.service.ITrainRecordService;
import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO; import com.hnac.hzims.safeproduct.vo.TrainRecordDetailVO;
import org.springblade.core.mp.support.Query;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -180,6 +183,15 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
} }
/** /**
* 培训记录分页
*/
@Override
public IPage<TrainRecordEntity> trainRecordPage(Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = new Page<>(query.getCurrent(), query.getSize());
return baseMapper.trainRecordPage(page, param);
}
/**
* 查询是否存在同月编号 * 查询是否存在同月编号
* @param currentMonth 当月 * @param currentMonth 当月
* @return 存在则返回上一编号否则返回null * @return 存在则返回上一编号否则返回null

BIN
hzims-service/safeproduct/src/main/resources/template/培训记录表.docx

Binary file not shown.
Loading…
Cancel
Save