提交问题区分发布与个人
This commit is contained in:
parent
b346396692
commit
7aa0f9e2a6
|
@ -262,7 +262,7 @@ wx:
|
|||
appId: wx2e09db4124332242
|
||||
mchId: 1646701170
|
||||
mchKey: Mozhekejiyouxiangongsi6296296296
|
||||
keyPath: /usr/local/mental/cert
|
||||
keyPath: E:\certs
|
||||
miniapp:
|
||||
configs:
|
||||
- appid: wx2e09db4124332242
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package org.dromara.scale.controller.wx;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
|
@ -19,8 +17,6 @@ import org.dromara.scale.service.ISysScaleOrderService;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 量表订单
|
||||
*
|
||||
|
@ -44,23 +40,11 @@ public class WxScaleOrderController extends BaseController {
|
|||
return sysScaleOrderService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出量表订单列表
|
||||
*/
|
||||
@SaCheckPermission("scale:scaleOrder:export")
|
||||
@Log(title = "量表订单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SysScaleOrderBo bo, HttpServletResponse response) {
|
||||
List<SysScaleOrderVo> list = sysScaleOrderService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "量表订单", SysScaleOrderVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取量表订单详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("scale:scaleOrder:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SysScaleOrderVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
|
@ -70,7 +54,6 @@ public class WxScaleOrderController extends BaseController {
|
|||
/**
|
||||
* 新增量表订单
|
||||
*/
|
||||
@SaCheckPermission("scale:scaleOrder:add")
|
||||
@Log(title = "量表订单", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package org.dromara.scale.domain;
|
||||
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.dromara.common.tenant.core.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
|
@ -40,9 +40,11 @@ public class ScoreRecord extends TenantEntity {
|
|||
private Integer recordStatus;
|
||||
|
||||
/**
|
||||
*
|
||||
* 得分
|
||||
*/
|
||||
private BigDecimal score;
|
||||
private Double oneScore;
|
||||
private Double twoScore;
|
||||
private Double threeScore;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -144,6 +144,8 @@ public class SysScaleVo implements Serializable {
|
|||
|
||||
private BigDecimal price;
|
||||
|
||||
private BigDecimal score;
|
||||
private Double questionScore;
|
||||
private Double resultScore;
|
||||
private Double suggestScore;
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
|||
import org.dromara.scale.domain.SysEvaluationRecord;
|
||||
import org.dromara.scale.domain.vo.StatisticNumVo;
|
||||
import org.dromara.scale.domain.vo.SysEvaluationRecordVo;
|
||||
import org.dromara.scale.domain.vo.SysScalePublishVo;
|
||||
import org.dromara.scale.domain.vo.SysScaleVo;
|
||||
import org.dromara.scale.domain.word.WordEvaluationFactor;
|
||||
|
||||
|
@ -26,8 +25,6 @@ public interface SysEvaluationRecordMapper extends BaseMapperPlus<SysEvaluationR
|
|||
|
||||
List<SysScaleVo> selectPublishScaleListByUserAndBatch(@Param("userId") Long userId, @Param("batchNos") String batchNos);
|
||||
|
||||
SysScalePublishVo selectPublishByUseRecord(Long recordId);
|
||||
|
||||
Page<SysEvaluationRecordVo> selectRecordVoPage(@Param("page") Page<SysEvaluationRecord> page, @Param(Constants.WRAPPER) Wrapper<SysEvaluationRecord> queryWrapper);
|
||||
|
||||
List<WordEvaluationFactor> selectEvaluationFactor4Word(Long recordId);
|
||||
|
|
|
@ -156,12 +156,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
|||
if (keySize != answerSize) {
|
||||
throw new ServiceException("有题目未作选择,请检查后提交");
|
||||
}
|
||||
SysScalePublishVo scalePublishVo = recordMapper.selectPublishByUseRecord(recordId);
|
||||
//查询考核结果
|
||||
Long batchNo = scalePublishVo.getBatchNo();
|
||||
if (scalePublishVo.getAllowQueryResult() == 0) {
|
||||
allowQueryResult = false;
|
||||
}
|
||||
|
||||
List<SysEvaluationAnswer> answerAdd = MapstructUtils.convert(answerList, SysEvaluationAnswer.class);
|
||||
evaluationAnswerMapper.insertBatch(answerAdd);
|
||||
//
|
||||
|
@ -181,25 +176,35 @@ public class EvaluationServiceImpl implements IEvaluationService {
|
|||
update.setStatus(StatusEnum.IN_USE.getValue());
|
||||
update.setUpdateTime(new Date());
|
||||
recordMapper.updateById(update);
|
||||
//判断一个人是否完成所有量表
|
||||
int undoneNum = recordMapper.selectUndoneNumByBatchNoAndUserId(batchNo, loginUser.getUserId());
|
||||
if (undoneNum == 0) {
|
||||
publishMapper.addCompleteNum(batchNo);
|
||||
}
|
||||
|
||||
//选择风险等级最高
|
||||
Optional<SysEvaluationConclusionVo> max = list.stream().filter(e -> e.getWarnStatus() == 1)
|
||||
.max(Comparator.comparingInt(SysEvaluationConclusionVo::getSituation));
|
||||
if (max.isPresent()) {
|
||||
SysWarnRecord wre = new SysWarnRecord();
|
||||
wre.setBatchNo(batchNo);
|
||||
wre.setUserId(loginUser.getUserId());
|
||||
wre.setDeptId(loginUser.getDeptId());
|
||||
wre.setWarnTime(new Date());
|
||||
wre.setSituation(max.get().getSituation());
|
||||
warnRecordService.insertByBo(wre);
|
||||
}
|
||||
Long batchNo = sysEvaluationRecord.getBatchNo();
|
||||
Integer publishFlag = sysEvaluationRecord.getPublishFlag();
|
||||
//判断是个人还是发布
|
||||
if (StatusEnum.IN_USE.getValue().equals(publishFlag)) {
|
||||
SysScalePublishVo scalePublishVo = publishMapper.selectVoById(batchNo);
|
||||
//查询考核结果
|
||||
if (scalePublishVo.getAllowQueryResult() == 0) {
|
||||
allowQueryResult = false;
|
||||
}
|
||||
//判断一个人是否完成所有量表
|
||||
int undoneNum = recordMapper.selectUndoneNumByBatchNoAndUserId(batchNo, loginUser.getUserId());
|
||||
if (undoneNum == 0) {
|
||||
publishMapper.addCompleteNum(batchNo);
|
||||
}
|
||||
|
||||
//选择风险等级最高
|
||||
Optional<SysEvaluationConclusionVo> max = list.stream().filter(e -> e.getWarnStatus() == 1)
|
||||
.max(Comparator.comparingInt(SysEvaluationConclusionVo::getSituation));
|
||||
if (max.isPresent()) {
|
||||
SysWarnRecord wre = new SysWarnRecord();
|
||||
wre.setBatchNo(batchNo);
|
||||
wre.setUserId(loginUser.getUserId());
|
||||
wre.setDeptId(loginUser.getDeptId());
|
||||
wre.setWarnTime(new Date());
|
||||
wre.setSituation(max.get().getSituation());
|
||||
warnRecordService.insertByBo(wre);
|
||||
}
|
||||
}
|
||||
//不允许查看考核结果
|
||||
if (!allowQueryResult) {
|
||||
return null;
|
||||
|
|
|
@ -71,7 +71,6 @@ public class ScoreRecordServiceImpl implements IScoreRecordService {
|
|||
LambdaQueryWrapper<ScoreRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getBusinessId() != null, ScoreRecord::getBusinessId, bo.getBusinessId());
|
||||
lqw.eq(bo.getRecordStatus() != null, ScoreRecord::getRecordStatus, bo.getRecordStatus());
|
||||
lqw.eq(bo.getScore() != null, ScoreRecord::getScore, bo.getScore());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,8 @@ public class SysScaleOrderServiceImpl implements ISysScaleOrderService {
|
|||
|
||||
private final SysScaleOrderMapper baseMapper;
|
||||
|
||||
// private final WxPayService wxService;
|
||||
|
||||
/**
|
||||
* 查询量表订单
|
||||
*
|
||||
|
@ -88,11 +90,14 @@ public class SysScaleOrderServiceImpl implements ISysScaleOrderService {
|
|||
@Override
|
||||
public Boolean insertByBo(SysScaleOrderBo bo) {
|
||||
SysScaleOrder add = MapstructUtils.convert(bo, SysScaleOrder.class);
|
||||
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,15 +53,33 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
|
||||
String peopleTypeName = dictService.getDictLabel("people_type", StrUtil.join(StrUtil.COMMA, sysScaleVo.getPeopleType()));
|
||||
sysScaleVo.setPeopleTypeName(StrUtil.split(peopleTypeName, StrUtil.COMMA));
|
||||
//计算均分
|
||||
List<ScoreRecord> scoreList = scoreMapper.selectList(new LambdaQueryWrapper<ScoreRecord>().select(ScoreRecord::getScore).eq(ScoreRecord::getBusinessId, scaleId).eq(ScoreRecord::getRecordStatus, 0));
|
||||
OptionalDouble averageScore = scoreList.stream()
|
||||
.mapToDouble(score -> score.getScore().doubleValue())
|
||||
//计算问题均分
|
||||
List<ScoreRecord> scoreList = scoreMapper.selectList(new LambdaQueryWrapper<ScoreRecord>().eq(ScoreRecord::getBusinessId, scaleId).eq(ScoreRecord::getRecordStatus, 0));
|
||||
OptionalDouble averageOne = scoreList.stream()
|
||||
.mapToDouble(ScoreRecord::getOneScore)
|
||||
.average();
|
||||
if (averageScore.isPresent()) {
|
||||
sysScaleVo.setScore(BigDecimal.valueOf(averageScore.getAsDouble()));
|
||||
if (averageOne.isPresent()) {
|
||||
sysScaleVo.setQuestionScore(averageOne.getAsDouble());
|
||||
} else {
|
||||
sysScaleVo.setScore(BigDecimal.ZERO);
|
||||
sysScaleVo.setQuestionScore((double) 0);
|
||||
}
|
||||
//计算结果
|
||||
OptionalDouble averageTwo = scoreList.stream()
|
||||
.mapToDouble(ScoreRecord::getTwoScore)
|
||||
.average();
|
||||
if (averageTwo.isPresent()) {
|
||||
sysScaleVo.setResultScore(averageTwo.getAsDouble());
|
||||
} else {
|
||||
sysScaleVo.setResultScore((double) 0);
|
||||
}
|
||||
//计算建议
|
||||
OptionalDouble averageThree = scoreList.stream()
|
||||
.mapToDouble(ScoreRecord::getThreeScore)
|
||||
.average();
|
||||
if (averageThree.isPresent()) {
|
||||
sysScaleVo.setSuggestScore(averageThree.getAsDouble());
|
||||
} else {
|
||||
sysScaleVo.setSuggestScore((double) 0);
|
||||
}
|
||||
SysEvaluationRecord sysEvaluationRecord = recordMapper.selectOne(new LambdaQueryWrapper<SysEvaluationRecord>()
|
||||
.eq(SysEvaluationRecord::getUserId, userId)
|
||||
|
@ -72,6 +90,7 @@ public class SysScaleServiceImpl implements ISysScaleService {
|
|||
return sysScaleVo;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询心理测评量列表
|
||||
*/
|
||||
|
|
|
@ -20,13 +20,6 @@
|
|||
and find_in_set(er.batch_no, #{batchNos})
|
||||
</select>
|
||||
|
||||
<select id="selectPublishByUseRecord" resultType="org.dromara.scale.domain.vo.SysScalePublishVo">
|
||||
select sp.batch_no, sp.allow_query_result
|
||||
from sys_evaluation_record er
|
||||
left join sys_scale_publish sp on er.batch_no = sp.batch_no
|
||||
where er.record_id = #{recordId}
|
||||
</select>
|
||||
|
||||
<select id="selectRecordVoPage" resultType="org.dromara.scale.domain.vo.SysEvaluationRecordVo">
|
||||
select er.*, s.scale_name
|
||||
from sys_evaluation_record er
|
||||
|
|
Loading…
Reference in New Issue