为了以后统计,修改量表测评逻辑,并因为改动逻辑优化之前代码
This commit is contained in:
parent
e24c52a4e2
commit
57dc8d7859
|
@ -3,7 +3,7 @@ package org.dromara.scale.controller;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
import org.dromara.scale.service.IStatisticService;
|
import org.dromara.scale.service.IStatisticService;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -30,7 +30,7 @@ public class StatisticController extends BaseController {
|
||||||
* 获取完成情况统计
|
* 获取完成情况统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/complete/all")
|
@GetMapping("/complete/all")
|
||||||
public R<StatisticCompleteVo> getComplete(Long batchNo, Long scaleId) {
|
public R<StatisticNumVo> getComplete(Long batchNo, Long scaleId) {
|
||||||
return R.ok(statisticService.getComplete4All(batchNo, scaleId));
|
return R.ok(statisticService.getComplete4All(batchNo, scaleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,12 +38,12 @@ public class StatisticController extends BaseController {
|
||||||
* 获取完成情况统计
|
* 获取完成情况统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/complete/class")
|
@GetMapping("/complete/class")
|
||||||
public R<List<StatisticCompleteVo>> getComplete4Class(Long batchNo, Long scaleId) {
|
public R<List<StatisticNumVo>> getComplete4Class(Long batchNo, Long scaleId) {
|
||||||
return R.ok(statisticService.getComplete4Class(batchNo, scaleId));
|
return R.ok(statisticService.getComplete4Class(batchNo, scaleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完成情况统计
|
* 获取预警情况统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/warn/all")
|
@GetMapping("/warn/all")
|
||||||
public R<StatisticWarnVo> getWarn(Long batchNo, Long scaleId) {
|
public R<StatisticWarnVo> getWarn(Long batchNo, Long scaleId) {
|
||||||
|
@ -51,11 +51,25 @@ public class StatisticController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取完成情况统计
|
* 获取预警情况统计
|
||||||
*/
|
*/
|
||||||
@GetMapping("/warn/class")
|
@GetMapping("/warn/class")
|
||||||
public R<List<StatisticWarnVo>> getWarn4Class(Long batchNo, Long scaleId) {
|
public R<List<StatisticWarnVo>> getWarn4Class(Long batchNo, Long scaleId) {
|
||||||
return R.ok(statisticService.getWarn4Class(batchNo, scaleId));
|
return R.ok(statisticService.getWarn4Class(batchNo, scaleId));
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取预警情况统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/factor/all")
|
||||||
|
public R<List<StatisticNumVo>> getFactor(Long batchNo, Long scaleId) {
|
||||||
|
return R.ok(statisticService.getFactor4All(batchNo, scaleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取预警情况统计
|
||||||
|
*/
|
||||||
|
@GetMapping("/factor/class")
|
||||||
|
public R<List<StatisticNumVo>> getFactor4Class(Long batchNo, Long scaleId) {
|
||||||
|
return R.ok(statisticService.getFactor4Class(batchNo, scaleId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,8 @@ public class SysInterveneRecordController extends BaseController {
|
||||||
return toAjax(sysInterveneRecordService.insertByBo(bo));
|
return toAjax(sysInterveneRecordService.insertByBo(bo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改干预记录
|
* 修改干预记录
|
||||||
*/
|
*/
|
||||||
|
@ -86,15 +88,5 @@ public class SysInterveneRecordController extends BaseController {
|
||||||
// return toAjax(sysInterveneRecordService.updateByBo(bo));
|
// return toAjax(sysInterveneRecordService.updateByBo(bo));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除干预记录
|
|
||||||
*
|
|
||||||
* @param interveneIds 主键串
|
|
||||||
*/
|
|
||||||
// @SaCheckPermission("scale:intervene:remove")
|
|
||||||
// @Log(title = "干预记录", businessType = BusinessType.DELETE)
|
|
||||||
// @DeleteMapping("/{interveneIds}")
|
|
||||||
// public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long[] interveneIds) {
|
|
||||||
// return toAjax(sysInterveneRecordService.deleteWithValidByIds(List.of(interveneIds), true));
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.scale.domain.bo.SubmitAnswerBo;
|
import org.dromara.scale.domain.bo.SubmitAnswerBo;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
|
||||||
import org.dromara.scale.domain.vo.QuestionAnswerVo;
|
import org.dromara.scale.domain.vo.QuestionAnswerVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
import org.dromara.scale.service.IWebService;
|
import org.dromara.scale.service.IWebService;
|
||||||
|
@ -57,9 +56,10 @@ public class WebController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@Log(title = "量测记录", businessType = BusinessType.INSERT)
|
@Log(title = "量测记录", businessType = BusinessType.INSERT)
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PostMapping("/record")
|
@PostMapping("/record/{id}")
|
||||||
public R<Long> addRecord(@Validated(AddGroup.class) @RequestBody SysEvaluationRecordBo bo) {
|
public R<Void> addRecord(@NotNull(message = "主键不能为空")
|
||||||
return R.ok(webService.newRecord(bo));
|
@PathVariable Long id) {
|
||||||
|
return toAjax(webService.newRecord(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.dromara.scale.domain;
|
package org.dromara.scale.domain;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -48,10 +46,15 @@ public class SysEvaluationRecord {
|
||||||
*/
|
*/
|
||||||
private Long batchNo;
|
private Long batchNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录状态0初始化,1开始测试
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@TableField(fill = FieldFill.INSERT)
|
//@TableField(fill = FieldFill.INSERT)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,10 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import io.github.linpeilie.annotations.AutoMapping;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -17,6 +20,7 @@ import java.util.Date;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("sys_scale_publish")
|
@TableName("sys_scale_publish")
|
||||||
|
@AutoMapper(target = SysScalePublishVo.class, reverseConvertGenerate = false)
|
||||||
public class SysScalePublish {
|
public class SysScalePublish {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
@ -31,11 +35,13 @@ public class SysScalePublish {
|
||||||
/**
|
/**
|
||||||
* 量表id,以逗号隔开
|
* 量表id,以逗号隔开
|
||||||
*/
|
*/
|
||||||
|
@AutoMapping(target = "scaleIds", expression = "java(cn.hutool.core.util.StrUtil.split(source.getScaleIds(), \",\"))")
|
||||||
private String scaleIds;
|
private String scaleIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 量表名称 以逗号隔开
|
* 量表名称 以逗号隔开
|
||||||
*/
|
*/
|
||||||
|
@AutoMapping(target = "scaleNames", expression = "java(cn.hutool.core.util.StrUtil.split(source.getScaleNames(), \",\"))")
|
||||||
private String scaleNames;
|
private String scaleNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,5 +43,7 @@ public class SysEvaluationRecordBo {
|
||||||
@NotNull(message = "td_scale_publish表主键不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "td_scale_publish表主键不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long batchNo;
|
private Long batchNo;
|
||||||
|
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class SysScalePublishBo {
|
||||||
/**
|
/**
|
||||||
* 部门分组id
|
* 部门分组id
|
||||||
*/
|
*/
|
||||||
//@NotNull(message = "部门分组id不能为空", groups = { AddGroup.class, EditGroup.class })
|
@NotNull(message = "年级分组id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
private Long deptId;
|
private Long deptId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@ import java.io.Serializable;
|
||||||
* @date 2024/4/17 15:21
|
* @date 2024/4/17 15:21
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class StatisticCompleteVo implements Serializable {
|
public class StatisticNumVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
|
@ -54,6 +54,11 @@ public class SysEvaluationRecordVo implements Serializable {
|
||||||
@ExcelProperty(value = "td_scale_publish表主键")
|
@ExcelProperty(value = "td_scale_publish表主键")
|
||||||
private Long batchNo;
|
private Long batchNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录状态0初始化,1开始测试
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private String scaleName;
|
private String scaleName;
|
||||||
|
|
|
@ -2,9 +2,7 @@ package org.dromara.scale.domain.vo;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.scale.domain.SysScalePublish;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -20,7 +18,6 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
@AutoMapper(target = SysScalePublish.class)
|
|
||||||
public class SysScalePublishVo implements Serializable {
|
public class SysScalePublishVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
@ -36,13 +33,13 @@ public class SysScalePublishVo implements Serializable {
|
||||||
* 量表id,以逗号隔开
|
* 量表id,以逗号隔开
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "量表id,以逗号隔开")
|
@ExcelProperty(value = "量表id,以逗号隔开")
|
||||||
private String scaleIds;
|
List<String> scaleIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 量表名称 以逗号隔开
|
* 量表名称 以逗号隔开
|
||||||
*/
|
*/
|
||||||
@ExcelProperty(value = "量表名称 以逗号隔开")
|
@ExcelProperty(value = "量表名称 以逗号隔开")
|
||||||
private String scaleNames;
|
List<String> scaleNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 场次名称
|
* 场次名称
|
||||||
|
|
|
@ -139,4 +139,6 @@ public class SysScaleVo implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
private boolean used;
|
private boolean used;
|
||||||
|
|
||||||
|
private Long recordId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
import org.dromara.scale.domain.SysScalePublish;
|
import org.dromara.scale.domain.SysScalePublish;
|
||||||
import org.dromara.scale.domain.vo.EvaluationVo;
|
import org.dromara.scale.domain.vo.EvaluationVo;
|
||||||
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
|
|
||||||
|
@ -20,14 +20,14 @@ import java.util.List;
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, SysScalePublishVo> {
|
public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, SysScalePublishVo> {
|
||||||
|
|
||||||
StatisticCompleteVo selectSingleAllAvaluation(Long batchNo);
|
StatisticNumVo selectSingleAllAvaluation(Long batchNo);
|
||||||
|
|
||||||
StatisticCompleteVo selectSingleCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
StatisticNumVo selectSingleCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
|
||||||
List<StatisticCompleteVo> selectAllAvaluation(Long batchNo);
|
List<StatisticNumVo> selectAllAvaluation(Long batchNo);
|
||||||
|
|
||||||
List<StatisticCompleteVo> selectCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
List<StatisticNumVo> selectCompleteAvaluation(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
List<EvaluationVo> selectEvaluationVoList(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
List<EvaluationVo> selectEvaluationVoList(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
@ -36,4 +36,8 @@ public interface SysScalePublishMapper extends BaseMapperPlus<SysScalePublish, S
|
||||||
StatisticWarnVo selectStatisticWarn(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
StatisticWarnVo selectStatisticWarn(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
List<StatisticWarnVo> selectStatisticWarn4Class(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
List<StatisticWarnVo> selectStatisticWarn4Class(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticNumVo> selectStatisticFactor(@Param("batchNo")Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticNumVo> selectStatisticFactor4Class(@Param("batchNo") Long batchNo, @Param("scaleId") Long scaleId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.dromara.scale.service;
|
package org.dromara.scale.service;
|
||||||
|
|
||||||
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -8,12 +8,16 @@ import java.util.List;
|
||||||
public interface IStatisticService {
|
public interface IStatisticService {
|
||||||
|
|
||||||
|
|
||||||
StatisticCompleteVo getComplete4All(Long batchNo, Long scaleId);
|
StatisticNumVo getComplete4All(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
List<StatisticCompleteVo> getComplete4Class(Long batchNo, Long scaleId);
|
List<StatisticNumVo> getComplete4Class(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
|
|
||||||
StatisticWarnVo getWarn4All(Long batchNo, Long scaleId);
|
StatisticWarnVo getWarn4All(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId);
|
List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticNumVo> getFactor4All(Long batchNo, Long scaleId);
|
||||||
|
|
||||||
|
List<StatisticNumVo> getFactor4Class(Long batchNo, Long scaleId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package org.dromara.scale.service;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
||||||
|
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||||
import org.dromara.scale.domain.vo.SysEvaluationRecordVo;
|
import org.dromara.scale.domain.vo.SysEvaluationRecordVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -31,6 +32,9 @@ public interface ISysEvaluationRecordService {
|
||||||
List<SysEvaluationRecordVo> queryList(SysEvaluationRecordBo bo);
|
List<SysEvaluationRecordVo> queryList(SysEvaluationRecordBo bo);
|
||||||
|
|
||||||
|
|
||||||
|
void insertBathByPublish(SysScalePublishBo bo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.dromara.scale.service;
|
package org.dromara.scale.service;
|
||||||
|
|
||||||
import org.dromara.scale.domain.bo.SubmitAnswerBo;
|
import org.dromara.scale.domain.bo.SubmitAnswerBo;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
|
||||||
import org.dromara.scale.domain.vo.QuestionAnswerVo;
|
import org.dromara.scale.domain.vo.QuestionAnswerVo;
|
||||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
|
|
||||||
|
@ -14,7 +13,7 @@ public interface IWebService {
|
||||||
|
|
||||||
List<QuestionAnswerVo> queryQuestionAnswerListByScaleId(Long scaleId);
|
List<QuestionAnswerVo> queryQuestionAnswerListByScaleId(Long scaleId);
|
||||||
|
|
||||||
Long newRecord(SysEvaluationRecordBo bo);
|
Boolean newRecord(Long recordId);
|
||||||
|
|
||||||
Map<String,Object> submitAnswer(SubmitAnswerBo bo);
|
Map<String,Object> submitAnswer(SubmitAnswerBo bo);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.dromara.scale.service.impl;
|
package org.dromara.scale.service.impl;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.scale.domain.vo.StatisticCompleteVo;
|
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||||
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
import org.dromara.scale.domain.vo.StatisticWarnVo;
|
||||||
import org.dromara.scale.mapper.SysScalePublishMapper;
|
import org.dromara.scale.mapper.SysScalePublishMapper;
|
||||||
import org.dromara.scale.service.IStatisticService;
|
import org.dromara.scale.service.IStatisticService;
|
||||||
|
@ -26,22 +26,22 @@ public class StatisticService implements IStatisticService {
|
||||||
private final SysScalePublishMapper scalePublishMapper;
|
private final SysScalePublishMapper scalePublishMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public StatisticCompleteVo getComplete4All(Long batchNo, Long scaleId) {
|
public StatisticNumVo getComplete4All(Long batchNo, Long scaleId) {
|
||||||
StatisticCompleteVo all = scalePublishMapper.selectSingleAllAvaluation(batchNo);
|
StatisticNumVo all = scalePublishMapper.selectSingleAllAvaluation(batchNo);
|
||||||
int total = all.getValue();
|
int total = all.getValue();
|
||||||
StatisticCompleteVo already = scalePublishMapper.selectSingleCompleteAvaluation(batchNo, scaleId);
|
StatisticNumVo already = scalePublishMapper.selectSingleCompleteAvaluation(batchNo, scaleId);
|
||||||
int alreadyValue = already.getValue();
|
int alreadyValue = already.getValue();
|
||||||
all.setSpareValue(total - alreadyValue);
|
all.setSpareValue(total - alreadyValue);
|
||||||
return all;
|
return all;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StatisticCompleteVo> getComplete4Class(Long batchNo, Long scaleId) {
|
public List<StatisticNumVo> getComplete4Class(Long batchNo, Long scaleId) {
|
||||||
List<StatisticCompleteVo> all = scalePublishMapper.selectAllAvaluation(batchNo);
|
List<StatisticNumVo> all = scalePublishMapper.selectAllAvaluation(batchNo);
|
||||||
Map<String, Integer> collect = all.stream().collect(Collectors.groupingBy(StatisticCompleteVo::getName,
|
Map<String, Integer> collect = all.stream().collect(Collectors.groupingBy(StatisticNumVo::getName,
|
||||||
Collectors.collectingAndThen(Collectors.mapping(StatisticCompleteVo::getValue, Collectors.toList()),
|
Collectors.collectingAndThen(Collectors.mapping(StatisticNumVo::getValue, Collectors.toList()),
|
||||||
values -> values.get(0))));
|
values -> values.get(0))));
|
||||||
List<StatisticCompleteVo> completeList = scalePublishMapper.selectCompleteAvaluation(batchNo, scaleId);
|
List<StatisticNumVo> completeList = scalePublishMapper.selectCompleteAvaluation(batchNo, scaleId);
|
||||||
completeList.forEach(a -> {
|
completeList.forEach(a -> {
|
||||||
String name = a.getName();
|
String name = a.getName();
|
||||||
int total = collect.get(name);
|
int total = collect.get(name);
|
||||||
|
@ -59,4 +59,15 @@ public class StatisticService implements IStatisticService {
|
||||||
public List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId) {
|
public List<StatisticWarnVo> getWarn4Class(Long batchNo, Long scaleId) {
|
||||||
return scalePublishMapper.selectStatisticWarn4Class(batchNo, scaleId);
|
return scalePublishMapper.selectStatisticWarn4Class(batchNo, scaleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticNumVo> getFactor4All(Long batchNo, Long scaleId) {
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticNumVo> getFactor4Class(Long batchNo, Long scaleId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,13 +6,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.scale.constant.StatusEnum;
|
||||||
import org.dromara.scale.domain.SysEvaluationRecord;
|
import org.dromara.scale.domain.SysEvaluationRecord;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
||||||
|
import org.dromara.scale.domain.bo.SysScalePublishBo;
|
||||||
import org.dromara.scale.domain.vo.SysEvaluationRecordVo;
|
import org.dromara.scale.domain.vo.SysEvaluationRecordVo;
|
||||||
import org.dromara.scale.mapper.SysEvaluationRecordMapper;
|
import org.dromara.scale.mapper.SysEvaluationRecordMapper;
|
||||||
import org.dromara.scale.service.ISysEvaluationRecordService;
|
import org.dromara.scale.service.ISysEvaluationRecordService;
|
||||||
|
import org.dromara.system.domain.SysUser;
|
||||||
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
|
import org.dromara.system.service.ISysDeptService;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,6 +34,10 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
||||||
|
|
||||||
private final SysEvaluationRecordMapper baseMapper;
|
private final SysEvaluationRecordMapper baseMapper;
|
||||||
|
|
||||||
|
private final ISysDeptService deptService;
|
||||||
|
|
||||||
|
private final SysUserMapper userMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询量测记录
|
* 查询量测记录
|
||||||
*/
|
*/
|
||||||
|
@ -63,5 +74,27 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
||||||
return lqw;
|
return lqw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Async
|
||||||
|
@Override
|
||||||
|
public void insertBathByPublish(SysScalePublishBo bo) {
|
||||||
|
Long deptId = bo.getDeptId();
|
||||||
|
Long batchNo = bo.getBatchNo();
|
||||||
|
List<String> scaleIds = bo.getScaleIds();
|
||||||
|
//判断人数
|
||||||
|
boolean flag = deptService.isParent(deptId);
|
||||||
|
List<SysUser> sysUsers = userMapper.selectStudentListByDeptId(deptId, flag);
|
||||||
|
List<SysEvaluationRecord> recordList = new ArrayList<>();
|
||||||
|
for (String scaleId : scaleIds) {
|
||||||
|
for (SysUser user : sysUsers) {
|
||||||
|
SysEvaluationRecord record = new SysEvaluationRecord();
|
||||||
|
record.setUserId(user.getUserId());
|
||||||
|
record.setDeptId(user.getDeptId());
|
||||||
|
record.setBatchNo(batchNo);
|
||||||
|
record.setScaleId(Long.parseLong(scaleId));
|
||||||
|
record.setStatus(StatusEnum.DISABLED.getValue());
|
||||||
|
recordList.add(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
baseMapper.insertBatch(recordList, 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,9 +23,9 @@ import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||||
import org.dromara.scale.mapper.SysScaleMapper;
|
import org.dromara.scale.mapper.SysScaleMapper;
|
||||||
import org.dromara.scale.mapper.SysScalePublishMapper;
|
import org.dromara.scale.mapper.SysScalePublishMapper;
|
||||||
|
import org.dromara.scale.service.ISysEvaluationRecordService;
|
||||||
import org.dromara.scale.service.ISysScalePublishService;
|
import org.dromara.scale.service.ISysScalePublishService;
|
||||||
import org.dromara.system.domain.vo.SysDeptVo;
|
import org.dromara.system.service.ISysDeptService;
|
||||||
import org.dromara.system.mapper.SysDeptMapper;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
@ -50,7 +50,9 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
|
|
||||||
private final SysScaleMapper scaleMapper;
|
private final SysScaleMapper scaleMapper;
|
||||||
|
|
||||||
private final SysDeptMapper deptMapper;
|
private final ISysDeptService deptService;
|
||||||
|
|
||||||
|
private final ISysEvaluationRecordService evaluationRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询量发布
|
* 查询量发布
|
||||||
|
@ -128,6 +130,8 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
}
|
}
|
||||||
//加入延迟队列
|
//加入延迟队列
|
||||||
QueueUtils.addDelayedQueueObject("scalePublish-delay-queue", add.getBatchNo(), l, TimeUnit.MILLISECONDS);
|
QueueUtils.addDelayedQueueObject("scalePublish-delay-queue", add.getBatchNo(), l, TimeUnit.MILLISECONDS);
|
||||||
|
//预处理量测记录,方便后续统计与查询
|
||||||
|
evaluationRecordService.insertBathByPublish(bo);
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +176,7 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
Long deptId = scalePublishVo.getDeptId();
|
Long deptId = scalePublishVo.getDeptId();
|
||||||
//为父级
|
//为父级
|
||||||
List<EvaluationVo> evaluationVos;
|
List<EvaluationVo> evaluationVos;
|
||||||
if (isParent(deptId)) {
|
if (deptService.isParent(deptId)) {
|
||||||
evaluationVos = baseMapper.selectEvaluationVoList4Parent(batchNo, scaleId);
|
evaluationVos = baseMapper.selectEvaluationVoList4Parent(batchNo, scaleId);
|
||||||
} else {
|
} else {
|
||||||
evaluationVos = baseMapper.selectEvaluationVoList(batchNo, scaleId);
|
evaluationVos = baseMapper.selectEvaluationVoList(batchNo, scaleId);
|
||||||
|
@ -186,13 +190,4 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
||||||
return evaluationVos;
|
return evaluationVos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isParent(Long deptId) {
|
|
||||||
SysDeptVo dept = deptMapper.selectDeptById(deptId);
|
|
||||||
List<String> split = StrUtil.split(dept.getAncestors(), StringUtils.SEPARATOR);
|
|
||||||
if (split.size() <= 2) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import org.dromara.scale.constant.StatusEnum;
|
||||||
import org.dromara.scale.domain.*;
|
import org.dromara.scale.domain.*;
|
||||||
import org.dromara.scale.domain.bo.SubmitAnswerBo;
|
import org.dromara.scale.domain.bo.SubmitAnswerBo;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationAnswerBo;
|
import org.dromara.scale.domain.bo.SysEvaluationAnswerBo;
|
||||||
import org.dromara.scale.domain.bo.SysEvaluationRecordBo;
|
|
||||||
import org.dromara.scale.domain.vo.*;
|
import org.dromara.scale.domain.vo.*;
|
||||||
import org.dromara.scale.mapper.*;
|
import org.dromara.scale.mapper.*;
|
||||||
import org.dromara.scale.service.ISysScaleAnswerService;
|
import org.dromara.scale.service.ISysScaleAnswerService;
|
||||||
|
@ -94,18 +93,19 @@ public class WebServiceImpl implements IWebService {
|
||||||
sysScalePublishVo = publishMapper.selectVoOne(lqw);
|
sysScalePublishVo = publishMapper.selectVoOne(lqw);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//都没有则查针对全部的发布
|
//都没有则查针对全部的发布 暂时不考虑
|
||||||
if (sysScalePublishVo == null) {
|
// if (sysScalePublishVo == null) {
|
||||||
LambdaQueryWrapper<SysScalePublish> lqw = Wrappers.lambdaQuery();
|
// LambdaQueryWrapper<SysScalePublish> lqw = Wrappers.lambdaQuery();
|
||||||
lqw.eq(SysScalePublish::getDeptId, null);
|
// lqw.eq(SysScalePublish::getDeptId, null);
|
||||||
lqw.eq(SysScalePublish::getStatus, StatusEnum.IN_USE.getValue());
|
// lqw.eq(SysScalePublish::getStatus, StatusEnum.IN_USE.getValue());
|
||||||
sysScalePublishVo = publishMapper.selectVoOne(lqw);
|
// sysScalePublishVo = publishMapper.selectVoOne(lqw);
|
||||||
}
|
// }
|
||||||
if (sysScalePublishVo == null) {
|
if (sysScalePublishVo == null) {
|
||||||
return new SysScalePublishVo();
|
return new SysScalePublishVo();
|
||||||
}
|
}
|
||||||
Long batchNo = sysScalePublishVo.getBatchNo();
|
Long batchNo = sysScalePublishVo.getBatchNo();
|
||||||
String scaleIds = sysScalePublishVo.getScaleIds();
|
List<String> scaleIds = sysScalePublishVo.getScaleIds();
|
||||||
|
//todo
|
||||||
List<SysScaleVo> publishScaleVos = scaleMapper.findSysScaleByIds(StrUtil.join(StrUtil.COMMA, scaleIds));
|
List<SysScaleVo> publishScaleVos = scaleMapper.findSysScaleByIds(StrUtil.join(StrUtil.COMMA, scaleIds));
|
||||||
List<SysEvaluationRecordVo> recordVos = recordMapper.selectSclaeRecordListByUserAndBatch(userId, batchNo);
|
List<SysEvaluationRecordVo> recordVos = recordMapper.selectSclaeRecordListByUserAndBatch(userId, batchNo);
|
||||||
for (SysScaleVo publishScaleVo : publishScaleVos) {
|
for (SysScaleVo publishScaleVo : publishScaleVos) {
|
||||||
|
@ -114,7 +114,8 @@ public class WebServiceImpl implements IWebService {
|
||||||
//已做过量表
|
//已做过量表
|
||||||
for (SysEvaluationRecordVo recordVo : recordVos) {
|
for (SysEvaluationRecordVo recordVo : recordVos) {
|
||||||
if (publishScaleVo.getScaleId().equals(recordVo.getScaleId())) {
|
if (publishScaleVo.getScaleId().equals(recordVo.getScaleId())) {
|
||||||
publishScaleVo.setUsed(true);
|
publishScaleVo.setRecordId(recordVo.getRecordId());
|
||||||
|
publishScaleVo.setUsed(recordVo.getStatus() == 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,18 +129,20 @@ public class WebServiceImpl implements IWebService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long newRecord(SysEvaluationRecordBo bo) {
|
public Boolean newRecord(Long recordId) {
|
||||||
LoginUser loginUser = getLoginUser();
|
//LoginUser loginUser = getLoginUser();
|
||||||
SysEvaluationRecord add = MapstructUtils.convert(bo, SysEvaluationRecord.class);
|
SysEvaluationRecord evaluationRecord = recordMapper.selectById(recordId);
|
||||||
add.setUserId(loginUser.getUserId());
|
if (evaluationRecord == null) {
|
||||||
add.setDeptId(loginUser.getDeptId());
|
throw new ServiceException("未查询到需要测试的记录,请联系管理员");
|
||||||
add.setCreateTime(new Date());
|
|
||||||
validEntityBeforeSave(add);
|
|
||||||
boolean flag = recordMapper.insert(add) > 0;
|
|
||||||
if (flag) {
|
|
||||||
bo.setRecordId(add.getRecordId());
|
|
||||||
}
|
}
|
||||||
return add.getRecordId();
|
if (evaluationRecord.getStatus() == 1) {
|
||||||
|
throw new ServiceException("此量表已经答题完毕,请勿重复提交");
|
||||||
|
}
|
||||||
|
SysEvaluationRecord update = new SysEvaluationRecord();
|
||||||
|
update.setRecordId(recordId);
|
||||||
|
update.setCreateTime(new Date());
|
||||||
|
update.setStatus(StatusEnum.IN_USE.getValue());
|
||||||
|
return recordMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@ -163,6 +166,9 @@ public class WebServiceImpl implements IWebService {
|
||||||
if (ObjectUtil.isEmpty(sysEvaluationRecord)) {
|
if (ObjectUtil.isEmpty(sysEvaluationRecord)) {
|
||||||
throw new ServiceException("未能查到测量记录,请确认后提交");
|
throw new ServiceException("未能查到测量记录,请确认后提交");
|
||||||
}
|
}
|
||||||
|
if (sysEvaluationRecord.getStatus() == 1) {
|
||||||
|
throw new ServiceException("此量表已经答题完毕,请勿重复提交");
|
||||||
|
}
|
||||||
SysScalePublishVo scalePublishVo = recordMapper.selectPublishByUseRecord(recordId);
|
SysScalePublishVo scalePublishVo = recordMapper.selectPublishByUseRecord(recordId);
|
||||||
//查询考核结果
|
//查询考核结果
|
||||||
if (scalePublishVo.getAllowQueryResult() == 0) {
|
if (scalePublishVo.getAllowQueryResult() == 0) {
|
||||||
|
@ -208,16 +214,6 @@ public class WebServiceImpl implements IWebService {
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validEntityBeforeSave(SysEvaluationRecord entity) {
|
|
||||||
//TODO 做一些数据校验,如唯一约束
|
|
||||||
List<SysEvaluationRecordVo> recordList = recordMapper.selectVoList(new LambdaQueryWrapper<SysEvaluationRecord>()
|
|
||||||
.eq(SysEvaluationRecord::getBatchNo, entity.getBatchNo())
|
|
||||||
.eq(SysEvaluationRecord::getUserId, entity.getUserId())
|
|
||||||
.eq(SysEvaluationRecord::getScaleId, entity.getScaleId()));
|
|
||||||
if (!ObjectUtil.isEmpty(recordList)) {
|
|
||||||
throw new ServiceException("本场次中你已做过此量表");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<SysEvaluationConclusionVo> calculateEvaluationResult(Long scaleId, List<SysEvaluationAnswerBo> answerList) {
|
private List<SysEvaluationConclusionVo> calculateEvaluationResult(Long scaleId, List<SysEvaluationAnswerBo> answerList) {
|
||||||
Long recordId = answerList.get(0).getRecordId();
|
Long recordId = answerList.get(0).getRecordId();
|
||||||
|
|
|
@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
from sys_evaluation_record
|
from sys_evaluation_record
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
and batch_no = #{batchNo}
|
and batch_no = #{batchNo}
|
||||||
|
and status = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPublishByUseRecord" resultType="org.dromara.scale.domain.vo.SysScalePublishVo">
|
<select id="selectPublishByUseRecord" resultType="org.dromara.scale.domain.vo.SysScalePublishVo">
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.scale.mapper.SysScalePublishMapper">
|
<mapper namespace="org.dromara.scale.mapper.SysScalePublishMapper">
|
||||||
<select id="selectSingleAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
<select id="selectSingleAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on d.dept_id = sp.dept_id
|
left join sys_dept d on d.dept_id = sp.dept_id
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectSingleCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
<select id="selectSingleCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on d.dept_id = sp.dept_id
|
left join sys_dept d on d.dept_id = sp.dept_id
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
<select id="selectAllAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||||
select d.dept_name as `name`, count(u.user_id) as `value`
|
select d.dept_name as `name`, count(u.user_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on d.parent_id = sp.dept_id
|
left join sys_dept d on d.parent_id = sp.dept_id
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticCompleteVo">
|
<select id="selectCompleteAvaluation" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||||
select d.dept_name as `name`, count(er.record_id) as `value`
|
select d.dept_name as `name`, count(er.record_id) as `value`
|
||||||
from sys_scale_publish sp
|
from sys_scale_publish sp
|
||||||
left join sys_dept d on d.parent_id = sp.dept_id
|
left join sys_dept d on d.parent_id = sp.dept_id
|
||||||
|
@ -98,4 +98,12 @@
|
||||||
and ec.status = 1
|
and ec.status = 1
|
||||||
group by d.dept_id
|
group by d.dept_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectStatisticFactor" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectStatisticFactor4Class" resultType="org.dromara.scale.domain.vo.StatisticNumVo">
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
@ -118,4 +118,7 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> {
|
||||||
|
|
||||||
int updatePasswordBatchById(List<SysUserVo> list);
|
int updatePasswordBatchById(List<SysUserVo> list);
|
||||||
|
|
||||||
|
|
||||||
|
List<SysUser> selectStudentListByDeptId(@Param("deptId") Long deptId,@Param("flag") boolean flag);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,4 +114,6 @@ public interface ISysDeptService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteDeptById(Long deptId);
|
int deleteDeptById(Long deptId);
|
||||||
|
|
||||||
|
boolean isParent(Long deptId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.lang.tree.Tree;
|
import cn.hutool.core.lang.tree.Tree;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
@ -325,4 +326,14 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
||||||
return baseMapper.deleteById(deptId);
|
return baseMapper.deleteById(deptId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isParent(Long deptId) {
|
||||||
|
SysDeptVo dept = baseMapper.selectDeptById(deptId);
|
||||||
|
List<String> split = StrUtil.split(dept.getAncestors(), StringUtils.SEPARATOR);
|
||||||
|
if (split.size() <= 2) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SysUserMapper">
|
<mapper namespace="org.dromara.system.mapper.SysUserMapper">
|
||||||
|
|
||||||
<!-- 多结构嵌套自动映射需带上每个实体的主键id 否则映射会失败 -->
|
<!-- 多结构嵌套自动映射需带上每个实体的主键id 否则映射会失败 -->
|
||||||
<resultMap type="org.dromara.system.domain.vo.SysUserVo" id="SysUserResult">
|
<resultMap type="org.dromara.system.domain.vo.SysUserVo" id="SysUserResult">
|
||||||
<id property="userId" column="user_id"/>
|
<id property="userId" column="user_id"/>
|
||||||
|
@ -65,9 +64,24 @@
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectPageUserList" resultMap="SysUserResult">
|
<select id="selectPageUserList" resultMap="SysUserResult">
|
||||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex,
|
select u.user_id,
|
||||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
u.dept_id,
|
||||||
d.dept_name, d.leader, u1.user_name as leaderName
|
u.nick_name,
|
||||||
|
u.user_name,
|
||||||
|
u.email,
|
||||||
|
u.avatar,
|
||||||
|
u.phonenumber,
|
||||||
|
u.sex,
|
||||||
|
u.status,
|
||||||
|
u.del_flag,
|
||||||
|
u.login_ip,
|
||||||
|
u.login_date,
|
||||||
|
u.create_by,
|
||||||
|
u.create_time,
|
||||||
|
u.remark,
|
||||||
|
d.dept_name,
|
||||||
|
d.leader,
|
||||||
|
u1.user_name as leaderName
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user u1 on u1.user_id = d.leader
|
left join sys_user u1 on u1.user_id = d.leader
|
||||||
|
@ -75,9 +89,24 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserList" resultMap="SysUserResult">
|
<select id="selectUserList" resultMap="SysUserResult">
|
||||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.sex,
|
select u.user_id,
|
||||||
u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
|
u.dept_id,
|
||||||
d.dept_name, d.leader, u1.user_name as leaderName
|
u.nick_name,
|
||||||
|
u.user_name,
|
||||||
|
u.email,
|
||||||
|
u.avatar,
|
||||||
|
u.phonenumber,
|
||||||
|
u.sex,
|
||||||
|
u.status,
|
||||||
|
u.del_flag,
|
||||||
|
u.login_ip,
|
||||||
|
u.login_date,
|
||||||
|
u.create_by,
|
||||||
|
u.create_time,
|
||||||
|
u.remark,
|
||||||
|
d.dept_name,
|
||||||
|
d.leader,
|
||||||
|
u1.user_name as leaderName
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user u1 on u1.user_id = d.leader
|
left join sys_user u1 on u1.user_id = d.leader
|
||||||
|
@ -85,7 +114,14 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllocatedList" resultMap="SysUserResult">
|
<select id="selectAllocatedList" resultMap="SysUserResult">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
select distinct u.user_id,
|
||||||
|
u.dept_id,
|
||||||
|
u.user_name,
|
||||||
|
u.nick_name,
|
||||||
|
u.email,
|
||||||
|
u.phonenumber,
|
||||||
|
u.status,
|
||||||
|
u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role sur on u.user_id = sur.user_id
|
left join sys_user_role sur on u.user_id = sur.user_id
|
||||||
|
@ -94,7 +130,14 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUnallocatedList" resultMap="SysUserResult">
|
<select id="selectUnallocatedList" resultMap="SysUserResult">
|
||||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
select distinct u.user_id,
|
||||||
|
u.dept_id,
|
||||||
|
u.user_name,
|
||||||
|
u.nick_name,
|
||||||
|
u.email,
|
||||||
|
u.phonenumber,
|
||||||
|
u.status,
|
||||||
|
u.create_time
|
||||||
from sys_user u
|
from sys_user u
|
||||||
left join sys_dept d on u.dept_id = d.dept_id
|
left join sys_dept d on u.dept_id = d.dept_id
|
||||||
left join sys_user_role sur on u.user_id = sur.user_id
|
left join sys_user_role sur on u.user_id = sur.user_id
|
||||||
|
@ -104,27 +147,32 @@
|
||||||
|
|
||||||
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.del_flag = '0' and u.user_name = #{userName}
|
where u.del_flag = '0'
|
||||||
|
and u.user_name = #{userName}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.del_flag = '0' and u.phonenumber = #{phonenumber}
|
where u.del_flag = '0'
|
||||||
|
and u.phonenumber = #{phonenumber}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
|
<select id="selectUserByEmail" parameterType="String" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.del_flag = '0' and u.email = #{email}
|
where u.del_flag = '0'
|
||||||
|
and u.email = #{email}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserById" parameterType="Long" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.del_flag = '0' and u.user_id = #{userId}
|
where u.del_flag = '0'
|
||||||
|
and u.user_id = #{userId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUserListByDeptId" parameterType="Long" resultMap="SysUserResult">
|
<select id="selectUserListByDeptId" parameterType="Long" resultMap="SysUserResult">
|
||||||
<include refid="selectUserVo"/>
|
<include refid="selectUserVo"/>
|
||||||
where u.del_flag = '0' and u.dept_id = #{deptId}
|
where u.del_flag = '0'
|
||||||
|
and u.dept_id = #{deptId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<update id="updatePasswordBatchById" parameterType="java.util.List">
|
<update id="updatePasswordBatchById" parameterType="java.util.List">
|
||||||
|
@ -134,4 +182,24 @@
|
||||||
WHERE user_id = #{item.userId}
|
WHERE user_id = #{item.userId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectStudentListByDeptId" resultType="org.dromara.system.domain.SysUser">
|
||||||
|
select u.*
|
||||||
|
from sys_dept d
|
||||||
|
left join sys_user u on u.dept_id = d.dept_id
|
||||||
|
<where>
|
||||||
|
<choose>
|
||||||
|
<when test="flag == true">
|
||||||
|
d.parent_id = #{deptId}
|
||||||
|
</when>
|
||||||
|
<when test="flag != true">
|
||||||
|
and d.dept_id = #{deptId}
|
||||||
|
</when>
|
||||||
|
<!-- 如果以上都不成立,则使用其他条件 -->
|
||||||
|
<otherwise>
|
||||||
|
and d.dept_id is null
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue