学生信息导入优化,添加班级信息;个测导出bug优化;团体导出添加判断接口;干预/预警列表添加数据权限
This commit is contained in:
parent
8ac8a81644
commit
6a70b64dfa
|
@ -45,6 +45,11 @@ public interface CacheNames {
|
|||
*/
|
||||
String SYS_DEPT = "sys_dept#30d";
|
||||
|
||||
/**
|
||||
* 部门
|
||||
*/
|
||||
String SYS_DEPT_CHILD = "sys_dept_child#20m";
|
||||
|
||||
/**
|
||||
* OSS内容
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dromara.common.core.service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通用 部门服务
|
||||
*
|
||||
|
@ -15,4 +17,12 @@ public interface DeptService {
|
|||
*/
|
||||
String selectDeptNameByIds(String deptIds);
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有的叶子部门
|
||||
*
|
||||
* @return dictValue为key,dictLabel为值组成的Map
|
||||
*/
|
||||
Map<String, String> getChildrenDept();
|
||||
|
||||
}
|
||||
|
|
|
@ -104,11 +104,19 @@ public class ExcelDownHandler implements SheetWriteHandler {
|
|||
String dictType = format.dictType();
|
||||
String converterExp = format.readConverterExp();
|
||||
if (StrUtil.isNotBlank(dictType)) {
|
||||
//判断是类型还是部门
|
||||
if("dept".equals(dictType)){
|
||||
Collection<String> values = Optional.ofNullable(deptService.getChildrenDept())
|
||||
.orElseThrow(() -> new ServiceException("不存在班级,请确认后再试"))
|
||||
.values();
|
||||
options = new ArrayList<>(values);
|
||||
}else {
|
||||
// 如果传递了字典名,则依据字典建立下拉
|
||||
Collection<String> values = Optional.ofNullable(dictService.getAllDictByDictType(dictType))
|
||||
.orElseThrow(() -> new ServiceException(String.format("字典 %s 不存在", dictType)))
|
||||
.values();
|
||||
options = new ArrayList<>(values);
|
||||
}
|
||||
} else if (StrUtil.isNotBlank(converterExp)) {
|
||||
// 如果指定了确切的值,则直接解析确切的值
|
||||
options = StrUtil.split(converterExp, format.separator(), true, true);
|
||||
|
|
|
@ -100,7 +100,6 @@ public class ScalePublishController extends BaseController {
|
|||
|
||||
/**
|
||||
* 中止记录
|
||||
*
|
||||
*/
|
||||
@SaCheckPermission("scale:publish:edit")
|
||||
@Log(title = "中止量表发布", businessType = BusinessType.UPDATE)
|
||||
|
@ -111,7 +110,6 @@ public class ScalePublishController extends BaseController {
|
|||
|
||||
/**
|
||||
* 开始记录
|
||||
*
|
||||
*/
|
||||
@SaCheckPermission("scale:publish:edit")
|
||||
@Log(title = "中止量表发布", businessType = BusinessType.UPDATE)
|
||||
|
@ -130,6 +128,7 @@ public class ScalePublishController extends BaseController {
|
|||
public R<Void> delete(@NotNull(message = "主键不能为空") @PathVariable Long batchNo) {
|
||||
return toAjax(sysScalePublishService.deleteById(batchNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出量测记录列表
|
||||
*/
|
||||
|
@ -155,4 +154,18 @@ public class ScalePublishController extends BaseController {
|
|||
FileUtil.del(pdfPath);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出量测记录列表
|
||||
*/
|
||||
@SaCheckPermission("scale:publish:export")
|
||||
@GetMapping("/export/check")
|
||||
public R<Void> exportCheck(BaseQueryBo bo) throws IOException {
|
||||
int num = sysScalePublishService.checkWord(bo);
|
||||
if (num == 0) {
|
||||
return R.fail("本场次暂无完成的量测记录,请测评后再导出");
|
||||
} else {
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,8 @@ 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.common.mybatis.annotation.DataColumn;
|
||||
import org.dromara.common.mybatis.annotation.DataPermission;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
import org.dromara.scale.domain.SysWarnRecord;
|
||||
import org.dromara.scale.domain.bo.BaseQueryBo;
|
||||
|
@ -22,7 +24,10 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysWarnRecordMapper extends BaseMapperPlus<SysWarnRecord, SysWarnRecordVo> {
|
||||
|
||||
@DataPermission({
|
||||
@DataColumn(key = "deptName", value = "d.dept_id"),
|
||||
@DataColumn(key = "userName", value = "u.user_id")
|
||||
})
|
||||
Page<SysWarnRecordVo> selectPageWarnList(@Param("page") Page<SysWarnRecord> page, @Param(Constants.ENTITY) BaseQueryBo query);
|
||||
|
||||
List<SysEvaluationRecordVo> selectEvaluationRecordListByWarnId(Long warnId);
|
||||
|
|
|
@ -53,5 +53,7 @@ public interface ISysScalePublishService {
|
|||
|
||||
String getWordTemplate(BaseQueryBo bo) throws IOException;
|
||||
|
||||
int checkWord(BaseQueryBo bo);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.deepoove.poi.data.style.BorderStyle;
|
|||
import com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
||||
import org.dromara.common.core.service.DeptService;
|
||||
import org.dromara.common.core.utils.DateUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
@ -37,6 +38,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.rmi.ServerException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -59,6 +61,8 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
|
||||
private final ISysConfigService configService;
|
||||
|
||||
private final DeptService deptService;
|
||||
|
||||
/**
|
||||
* 查询量测记录
|
||||
*/
|
||||
|
@ -123,7 +127,8 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
|
||||
SysUserVo user = userMapper.selectVoById(userId);
|
||||
wordData.setNickName(user.getNickName());
|
||||
wordData.setDeptName(user.getDept().getDeptName());
|
||||
String s = deptService.selectDeptNameByIds(Long.toString(user.getDeptId()));
|
||||
wordData.setDeptName(s);
|
||||
wordData.setSex("0".equals(user.getSex()) ? "男" : "女");
|
||||
|
||||
SysScaleVo scale = scaleMapper.selectVoById(scaleId);
|
||||
|
@ -142,8 +147,8 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
//一并处理数据
|
||||
int size = answerVos.size();
|
||||
LinkedList<WordFactor> factors = new LinkedList<>();
|
||||
String[] strings = new String[size];
|
||||
Double[] doubles = new Double[size];
|
||||
List<String> strings = new ArrayList<>();
|
||||
List<Double> doubles = new ArrayList<>();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int i = 0; i < size; i++) {
|
||||
WordEvaluationFactor answerVo = answerVos.get(i);
|
||||
|
@ -193,18 +198,18 @@ public class SysEvaluationRecordServiceImpl implements ISysEvaluationRecordServi
|
|||
}
|
||||
if (!"总分".equals(answerVo.getFactorName())) {
|
||||
//雷达图使用
|
||||
strings[i] = answerVo.getFactorName();
|
||||
doubles[i] = score;
|
||||
strings.add(answerVo.getFactorName());
|
||||
doubles.add(score);
|
||||
}
|
||||
}
|
||||
|
||||
wordData.setFactor(factorTable);
|
||||
wordData.setFactors(factors);
|
||||
//处理雷达图
|
||||
if (strings.length >1) {
|
||||
if (strings.size() > 1) {
|
||||
ChartMultiSeriesRenderData chart = Charts
|
||||
.ofMultiSeries(scale.getScaleName(), strings)
|
||||
.addSeries("因子项", doubles)
|
||||
.ofMultiSeries(scale.getScaleName(), strings.toArray(String[]::new))
|
||||
.addSeries("因子项", doubles.toArray(Double[]::new))
|
||||
.create();
|
||||
WordRadar radar = new WordRadar();
|
||||
radar.setRadarChart(chart);
|
||||
|
|
|
@ -453,6 +453,12 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
|
|||
return wordPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int checkWord(BaseQueryBo bo) {
|
||||
//查询前置,用来判断
|
||||
return recordMapper.selectCompleteNumByBatchNo(bo.getBatchNo());
|
||||
}
|
||||
|
||||
private int processHalfUpPercent(int num, int total) {
|
||||
if (total == 0) {
|
||||
return 0;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
from sys_warn_record wr
|
||||
left join sys_scale_publish sp on sp.batch_no = wr.batch_no
|
||||
left join sys_user u on u.user_id = wr.user_id
|
||||
left join sys_dept d on d.dept_id = u.dept_id
|
||||
<where>
|
||||
<if test="et.nickName != null and et.nickName != ''">
|
||||
u.nick_name like CONCAT('%', #{et.nickName}, '%')
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -27,6 +27,7 @@ public class SysStudentImportVo implements Serializable {
|
|||
* 部门ID
|
||||
*/
|
||||
@ExcelProperty(value = "部门名称")
|
||||
@ExcelDictFormat(dictType = "dept")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.alibaba.excel.event.AnalysisEventListener;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.SpringUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.core.utils.ValidatorUtils;
|
||||
import org.dromara.common.excel.core.ExcelListener;
|
||||
import org.dromara.common.excel.core.ExcelResult;
|
||||
|
@ -16,7 +17,6 @@ import org.dromara.system.domain.bo.SysUserBo;
|
|||
import org.dromara.system.domain.vo.SysStudentImportVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysConfigService;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -31,8 +31,6 @@ public class SysStudentImportListener extends AnalysisEventListener<SysStudentIm
|
|||
|
||||
private final ISysUserService userService;
|
||||
|
||||
private final ISysDeptService deptService;
|
||||
|
||||
private final String password;
|
||||
|
||||
private final Long operUserId;
|
||||
|
@ -45,7 +43,6 @@ public class SysStudentImportListener extends AnalysisEventListener<SysStudentIm
|
|||
public SysStudentImportListener() {
|
||||
String initPassword = SpringUtils.getBean(ISysConfigService.class).selectConfigByKey("sys.user.initPassword");
|
||||
this.userService = SpringUtils.getBean(ISysUserService.class);
|
||||
this.deptService = SpringUtils.getBean(ISysDeptService.class);
|
||||
this.password = BCrypt.hashpw(initPassword);
|
||||
this.operUserId = LoginHelper.getUserId();
|
||||
}
|
||||
|
@ -54,14 +51,14 @@ public class SysStudentImportListener extends AnalysisEventListener<SysStudentIm
|
|||
public void invoke(SysStudentImportVo userVo, AnalysisContext context) {
|
||||
SysUserVo sysUser = this.userService.selectUserByUserName(userVo.getUserName());
|
||||
try {
|
||||
Long deptId = this.deptService.selectIdByName(userVo.getDeptName());
|
||||
if (deptId != 0) {
|
||||
// 验证是否存在这个用户
|
||||
if (ObjectUtil.isNull(sysUser)) {
|
||||
SysUserBo user = BeanUtil.toBean(userVo, SysUserBo.class);
|
||||
ValidatorUtils.validate(user);
|
||||
user.setPassword(password);
|
||||
user.setDeptId(deptId);
|
||||
if (StringUtils.isNotEmpty(userVo.getDeptName())) {
|
||||
user.setDeptId(Long.parseLong(userVo.getDeptName()));
|
||||
}
|
||||
user.setCreateBy(operUserId);
|
||||
userService.insertUser(user);
|
||||
successNum++;
|
||||
|
@ -70,10 +67,6 @@ public class SysStudentImportListener extends AnalysisEventListener<SysStudentIm
|
|||
failureNum++;
|
||||
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(userVo.getUserName()).append(" 已存在");
|
||||
}
|
||||
} else {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>").append(failureNum).append("、账号 ").append(userVo.getUserName()).append(" 查询不到部门");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、账号 " + userVo.getUserName() + " 导入失败:";
|
||||
|
|
|
@ -51,4 +51,6 @@ public interface SysDeptMapper extends BaseMapperPlus<SysDept, SysDeptVo> {
|
|||
|
||||
List<String> findDeptNameByUserIds(String userIds);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dromara.system.service;
|
||||
|
||||
import cn.hutool.core.lang.tree.Tree;
|
||||
import org.dromara.system.domain.SysDept;
|
||||
import org.dromara.system.domain.bo.SysDeptBo;
|
||||
import org.dromara.system.domain.vo.SysDeptVo;
|
||||
|
||||
|
@ -115,6 +116,12 @@ public interface ISysDeptService {
|
|||
*/
|
||||
int deleteDeptById(Long deptId);
|
||||
|
||||
Long selectIdByName(String deptName);
|
||||
/**
|
||||
* 根据角色ID查询部门树信息
|
||||
*
|
||||
* @param parentId 角色ID
|
||||
* @return 选中部门列表
|
||||
*/
|
||||
List<SysDept> selectChildDeptListByParentId(Long parentId);
|
||||
|
||||
}
|
||||
|
|
|
@ -32,9 +32,7 @@ import org.springframework.cache.annotation.CacheEvict;
|
|||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 部门管理 服务实现
|
||||
|
@ -138,6 +136,7 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||
return dept;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过部门ID查询部门名称
|
||||
*
|
||||
|
@ -326,13 +325,33 @@ public class SysDeptServiceImpl implements ISysDeptService, DeptService {
|
|||
return baseMapper.deleteById(deptId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long selectIdByName(String deptName) {
|
||||
SysDept sysDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>().select(SysDept::getDeptId).eq(SysDept::getDeptName, deptName));
|
||||
if (ObjectUtil.isNotNull(sysDept)) {
|
||||
return sysDept.getDeptId();
|
||||
} else {
|
||||
return 0L;
|
||||
public Map<String, String> getChildrenDept() {
|
||||
List<SysDept> deptList = SpringUtils.getAopProxy(this).selectChildDeptListByParentId(100L);
|
||||
if (ObjectUtil.isEmpty(deptList)) {
|
||||
return null;
|
||||
}
|
||||
LinkedHashMap<String, String> map = new LinkedHashMap<>();
|
||||
for (SysDept sysDept : deptList) {
|
||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectChildDeptListByParentId(sysDept.getDeptId());
|
||||
if (ObjectUtil.isNotEmpty(depts)) {
|
||||
for (SysDept dept : depts) {
|
||||
map.put(Long.toString(dept.getDeptId()), dept.getDeptName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@CacheEvict(cacheNames = CacheNames.SYS_DEPT_CHILD, key = "#parentId")
|
||||
@Override
|
||||
public List<SysDept> selectChildDeptListByParentId(Long parentId) {
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
||||
.select(SysDept::getDeptId, SysDept::getDeptName)
|
||||
.eq(SysDept::getParentId, parentId)
|
||||
.orderByAsc(SysDept::getParentId)
|
||||
.orderByAsc(SysDept::getOrderNum)
|
||||
.orderByAsc(SysDept::getDeptId));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,4 +43,11 @@
|
|||
where find_in_set(user_id, #{userIds})
|
||||
group by d.dept_id
|
||||
</select>
|
||||
|
||||
<select id="selectChildListByParentId" resultType="java.lang.Long">
|
||||
select dept_id
|
||||
from sys_dept
|
||||
where parent_id = #{parentId}
|
||||
order by parent_id, order_num, dept_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue