新增档案静态记录;优化量测逻辑;用户新增家庭住址
This commit is contained in:
parent
da2688abd2
commit
f3e56678cb
|
@ -4,9 +4,9 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.dromara.scale.domain.vo.ArchiveStatisticVo;
|
||||
import org.dromara.scale.domain.vo.ArchiveVo;
|
||||
import org.dromara.scale.service.IArchiveService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
@ -22,16 +22,25 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/scale/archives")
|
||||
public class ArchivesController {
|
||||
public class ArchiveController {
|
||||
|
||||
private final ISysUserService userService;
|
||||
private final IArchiveService archiveService;
|
||||
|
||||
/**
|
||||
* 获取用户档案列表
|
||||
*/
|
||||
@SaCheckPermission("scale:archives:list")
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo<ArchiveVo> pageList(ArchiveVo vo, PageQuery pageQuery) {
|
||||
return archiveService.queryPageList(vo, pageQuery);
|
||||
}
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@SaCheckPermission("scale:archives:list")
|
||||
@GetMapping("/pageList")
|
||||
public TableDataInfo<SysUserVo> list(SysUserBo user, PageQuery pageQuery) {
|
||||
return userService.selectPageUserList(user, pageQuery);
|
||||
@GetMapping("/statistic/pageList")
|
||||
public TableDataInfo<ArchiveStatisticVo> statisticPageList(Long userId, PageQuery pageQuery) {
|
||||
return archiveService.queryStatisticPageList(userId, pageQuery);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package org.dromara.scale.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
|
@ -21,8 +20,6 @@ import org.dromara.scale.service.ISysScalePublishService;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 量表发布
|
||||
*
|
||||
|
@ -102,17 +99,17 @@ public class ScalePublishController extends BaseController {
|
|||
return toAjax(sysScalePublishService.end(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除量表发布
|
||||
*
|
||||
* @param batchNos 主键串
|
||||
*/
|
||||
@SaCheckPermission("scale:publish:remove")
|
||||
@Log(title = "删除量表发布", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{batchNo}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long batchNos) {
|
||||
return toAjax(sysScalePublishService.deleteWithValidByIds(List.of(batchNos), true));
|
||||
}
|
||||
// /**
|
||||
// * 删除量表发布
|
||||
// *
|
||||
// * @param batchNos 主键串
|
||||
// */
|
||||
// @SaCheckPermission("scale:publish:remove")
|
||||
// @Log(title = "删除量表发布", businessType = BusinessType.DELETE)
|
||||
// @DeleteMapping("/{batchNo}")
|
||||
// public R<Void> remove(@NotEmpty(message = "主键不能为空") @PathVariable Long batchNos) {
|
||||
// return toAjax(sysScalePublishService.deleteWithValidByIds(List.of(batchNos), true));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package org.dromara.scale.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>档案静态记录<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/28 14:06
|
||||
*/
|
||||
@Data
|
||||
public class ArchiveStatisticVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long batchNo;
|
||||
|
||||
private String sessionName;
|
||||
|
||||
private Long scaleId;
|
||||
|
||||
private String scaleName;
|
||||
|
||||
private Integer situation;
|
||||
|
||||
private String createTime;
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package org.dromara.scale.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
@ -10,7 +12,8 @@ import java.io.Serializable;
|
|||
* @version V1.0.0
|
||||
* @date 2024/4/26 15:51
|
||||
*/
|
||||
public class ArchivesVo implements Serializable {
|
||||
@Data
|
||||
public class ArchiveVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -42,7 +45,10 @@ public class ArchivesVo implements Serializable {
|
|||
*/
|
||||
private String phonenumber;
|
||||
|
||||
private String remark;
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.dromara.scale.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.dromara.scale.domain.vo.ArchiveStatisticVo;
|
||||
import org.dromara.scale.domain.vo.ArchiveVo;
|
||||
|
||||
@Mapper
|
||||
public interface ArchiveMapper {
|
||||
Page<ArchiveVo> selectArchiveVoPage(@Param("page") Page<ArchiveVo> page, @Param(Constants.WRAPPER) Wrapper<ArchiveVo> queryWrapper);
|
||||
|
||||
Page<ArchiveStatisticVo> selectStatisticVoPage(@Param("page") Page<ArchiveStatisticVo> page, @Param("userId") Long userId);
|
||||
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package org.dromara.scale.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ArchivesMapper {
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.dromara.scale.service;
|
||||
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.scale.domain.vo.ArchiveStatisticVo;
|
||||
import org.dromara.scale.domain.vo.ArchiveVo;
|
||||
|
||||
public interface IArchiveService {
|
||||
|
||||
TableDataInfo<ArchiveVo> queryPageList(ArchiveVo vo, PageQuery pageQuery);
|
||||
TableDataInfo<ArchiveStatisticVo> queryStatisticPageList(Long usetId, PageQuery pageQuery);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package org.dromara.scale.service;
|
||||
|
||||
public interface IArchivesService {
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.scale.domain.vo.ArchiveStatisticVo;
|
||||
import org.dromara.scale.domain.vo.ArchiveVo;
|
||||
import org.dromara.scale.mapper.ArchiveMapper;
|
||||
import org.dromara.scale.service.IArchiveService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>TODO<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/26 15:46
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class ArchiveServiceImpl implements IArchiveService {
|
||||
|
||||
private final ArchiveMapper archiveMapper;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ArchiveVo> queryPageList(ArchiveVo vo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<ArchiveVo> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(vo.getNickName() != null, ArchiveVo::getNickName, vo.getNickName());
|
||||
Page<ArchiveVo> result = archiveMapper.selectArchiveVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ArchiveStatisticVo> queryStatisticPageList(Long userId, PageQuery pageQuery) {
|
||||
Page<ArchiveStatisticVo> result = archiveMapper.selectStatisticVoPage(pageQuery.build(), userId);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package org.dromara.scale.service.impl;
|
||||
|
||||
import org.dromara.scale.service.IArchivesService;
|
||||
|
||||
/**
|
||||
* <p>TODO<p>
|
||||
*
|
||||
* @author cjw
|
||||
* @version V1.0.0
|
||||
* @date 2024/4/26 15:46
|
||||
*/
|
||||
public class ArchivesServiceImpl implements IArchivesService {
|
||||
}
|
|
@ -119,11 +119,10 @@ public class WebServiceImpl implements IWebService {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -135,17 +134,18 @@ public class WebServiceImpl implements IWebService {
|
|||
if (!UserType.STUDENT.getName().equals(userType)) {
|
||||
throw new ServiceException("只有学生账户才能测评");
|
||||
}
|
||||
|
||||
List<SysEvaluationAnswerBo> answerList = bo.getAnswerList();
|
||||
Long recordId = answerList.get(0).getRecordId();
|
||||
SysEvaluationRecord sysEvaluationRecord = recordMapper.selectById(recordId);
|
||||
if (ObjectUtil.isEmpty(sysEvaluationRecord)) {
|
||||
throw new ServiceException("未能查到测量记录,请确认后再提交");
|
||||
throw new ServiceException("未查询到需要测试的记录,请联系管理员");
|
||||
}
|
||||
if (sysEvaluationRecord.getStatus() == 0) {
|
||||
if (sysEvaluationRecord.getCreateTime() == null) {
|
||||
throw new ServiceException("此量表暂未开始作答,请确认后再提交");
|
||||
}
|
||||
|
||||
if (sysEvaluationRecord.getStatus() == 1) {
|
||||
throw new ServiceException("此量表已经答题完毕,请勿重复提交");
|
||||
}
|
||||
boolean allowQueryResult = true;
|
||||
Long scaleId = bo.getScaleId();
|
||||
Map<String, List<SysScaleAnswerVo>> answerMapByQuestion = scaleAnswerService.getScaleAnswerMap(scaleId);
|
||||
|
@ -157,7 +157,6 @@ public class WebServiceImpl implements IWebService {
|
|||
if (keySize != answerSize) {
|
||||
throw new ServiceException("有题目未作选择,请检查后提交");
|
||||
}
|
||||
|
||||
SysScalePublishVo scalePublishVo = recordMapper.selectPublishByUseRecord(recordId);
|
||||
//查询考核结果
|
||||
if (scalePublishVo.getAllowQueryResult() == 0) {
|
||||
|
@ -169,6 +168,11 @@ public class WebServiceImpl implements IWebService {
|
|||
List<SysEvaluationConclusionVo> list = calculateEvaluationResult(scaleId, answerList);
|
||||
List<SysEvaluationConclusion> conclusionAdd = MapstructUtils.convert(list, SysEvaluationConclusion.class);
|
||||
evaluationConclusionMapper.insertBatch(conclusionAdd);
|
||||
//更新记录表完成
|
||||
SysEvaluationRecord update = new SysEvaluationRecord();
|
||||
update.setRecordId(recordId);
|
||||
update.setStatus(StatusEnum.IN_USE.getValue());
|
||||
recordMapper.updateById(update);
|
||||
|
||||
Integer riskLevel = -1;
|
||||
//选择风险等级最高
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.scale.mapper.ArchiveMapper">
|
||||
|
||||
<select id="selectArchiveVoPage" resultType="org.dromara.scale.domain.vo.ArchiveVo">
|
||||
select u.user_id,
|
||||
u.nick_name,
|
||||
u.dept_id,
|
||||
u.sex,
|
||||
u.phonenumber,
|
||||
u.address,
|
||||
d.dept_name
|
||||
from sys_user u
|
||||
left join sys_dept d on d.dept_id = u.dept_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectStatisticVoPage" resultType="org.dromara.scale.domain.vo.ArchiveStatisticVo">
|
||||
select sp.batch_no,
|
||||
sp.session_name,
|
||||
s.scale_id,
|
||||
s.scale_name,
|
||||
MAX(sfr.situation),
|
||||
er.create_time
|
||||
from sys_evaluation_record er
|
||||
left join sys_scale s on s.scale_id = er.scale_id
|
||||
left join sys_scale_publish sp on sp.batch_no = er.batch_no
|
||||
left join sys_evaluation_conclusion ec on ec.record_id = er.record_id
|
||||
left join sys_scale_factor_range sfr on sfr.range_id = ec.factor_range_id
|
||||
where er.user_id = #{userId}
|
||||
and er.status = 1
|
||||
group by er.record_id
|
||||
</select>
|
||||
</mapper>
|
|
@ -4,11 +4,12 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.scale.mapper.SysInterveneRecordMapper">
|
||||
<select id="selectTimeList" resultType="org.dromara.scale.domain.vo.TimeAxisVo">
|
||||
select intervene_id as `id`,
|
||||
CONCAT(DATE_FORMAT(create_time, '%Y-%m-%d'), ' 的预警') as `name`,
|
||||
create_time as `time`,
|
||||
'intervene' as `type`
|
||||
from sys_intervene_record
|
||||
where user_id = #{userId}
|
||||
select ir.intervene_id as `id`,
|
||||
CONCAT(DATE_FORMAT(create_time, '%Y-%m-%d'), ' ', u.nick_name, '的干预') as `name`,
|
||||
ir.create_time as `time`,
|
||||
'intervene' as `type`
|
||||
from sys_intervene_record ir
|
||||
left join sys_user u on u.user_id = ir.counselor_id
|
||||
where ir.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
@ -66,7 +66,7 @@ public class SysOssController extends BaseController {
|
|||
*
|
||||
* @param file 文件
|
||||
*/
|
||||
@SaCheckPermission("system:oss:upload")
|
||||
//@SaCheckPermission("system:oss:upload")
|
||||
@Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
|
||||
|
@ -86,7 +86,7 @@ public class SysOssController extends BaseController {
|
|||
*
|
||||
* @param ossId OSS对象ID
|
||||
*/
|
||||
@SaCheckPermission("system:oss:download")
|
||||
//@SaCheckPermission("system:oss:download")
|
||||
@GetMapping("/download/{ossId}")
|
||||
public void download(@PathVariable Long ossId, HttpServletResponse response) throws IOException {
|
||||
ossService.download(ossId, response);
|
||||
|
|
|
@ -260,7 +260,7 @@ public class SysUserController extends BaseController {
|
|||
/**
|
||||
* 获取部门树列表
|
||||
*/
|
||||
@SaCheckPermission("system:user:list")
|
||||
//@SaCheckPermission("system:user:list")
|
||||
@GetMapping("/deptTree")
|
||||
public R<List<Tree<Long>>> deptTree(SysDeptBo dept) {
|
||||
return R.ok(deptService.selectDeptTreeList(dept));
|
||||
|
|
|
@ -52,6 +52,11 @@ public class SysUser extends BaseEntity {
|
|||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
|
|
|
@ -62,6 +62,11 @@ public class SysUserBo extends BaseEntity {
|
|||
@Size(min = 0, max = 50, message = "邮箱长度不能超过{max}个字符")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
|
|
|
@ -59,6 +59,11 @@ public class SysUserVo implements Serializable {
|
|||
@Sensitive(strategy = SensitiveStrategy.EMAIL)
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 家庭住址
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue