1.保安员新增接口修改,单个新增保安员默认密码为身份证号后6位,账号为身份证号,
2.考试成绩可以按天导出
3.个人图片批量导入接口修改
4.保安员批量导入修改,如有重复的账号导入的跳过,导入完成后返回提示信息
9 files modified
1 files added
| | |
| | | package org.springblade.modules.exam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.excel.ExamScoreExcel; |
| | | import org.springblade.modules.exam.excel.ExamScoreImporter; |
| | | import org.springblade.modules.exam.excel.ExportExamScoreExcel; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | | import org.springblade.modules.exam.util.SecurityPaperUtil; |
| | |
| | | import org.springblade.modules.exam.vo.UpdateParamVo; |
| | | import org.springblade.modules.system.entity.Role; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.service.IRoleService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springblade.modules.system.vo.UserVO; |
| | |
| | | return R.status(examScoreService.refreshTrainExamInfo(updateParamVo)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出成绩 |
| | | */ |
| | | @GetMapping("export-examScore") |
| | | @ApiOperationSupport(order = 14) |
| | | @ApiOperation(value = "导出成绩") |
| | | public void exportExamScore(HttpServletResponse response,ExamScoreVO examScoreVO) { |
| | | System.out.println("examScoreVO = " + examScoreVO); |
| | | //按条件查询成绩数据 |
| | | List<ExportExamScoreExcel> examScoreExcels = examScoreService.exportExamScoreList(examScoreVO); |
| | | //导出成绩集合数据 |
| | | ExcelUtil.export(response, "成绩数据", "成绩数据表", examScoreExcels, ExportExamScoreExcel.class); |
| | | } |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.exam.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * ExamPaymentExcel |
| | | * @author zhongrj |
| | | * @since 2021-10-19 |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class ExportExamScoreExcel implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ColumnWidth(30) |
| | | @ExcelProperty("考试名称") |
| | | private String examName; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("姓名") |
| | | private String securityName; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("身份证号码") |
| | | private String idCardNo; |
| | | |
| | | @ColumnWidth(25) |
| | | @ExcelProperty("所属公司") |
| | | private String companyName; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("考试开始时间") |
| | | private String examTime; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("考试结束时间") |
| | | private String examEndTime; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("理论成绩") |
| | | private Integer theoryGrade; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("实操成绩") |
| | | private Integer learnGrade; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("总成绩") |
| | | private Integer allGrade; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.excel.ExportExamScoreExcel; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.training.entity.TrainingRegistration; |
| | | |
| | |
| | | |
| | | List<ExamScore> getLheoryGradeLess60(); |
| | | |
| | | /** |
| | | * 按条件查询成绩数据 |
| | | * @param examScoreVO |
| | | * @return |
| | | */ |
| | | List<ExportExamScoreExcel> getExamScoreList(@Param("examScore") ExamScoreVO examScoreVO); |
| | | } |
| | |
| | | <if test="examScore.qualified!=null"> |
| | | and es.qualified = #{examScore.qualified} |
| | | </if> |
| | | <if test="examScore.examDate!=null"> |
| | | and date_format(es.exam_time,'%Y-%m-%d') = #{examScore.examDate} |
| | | </if> |
| | | </select> |
| | | |
| | | <!--考试成绩详情信息--> |
| | |
| | | <select id="getLheoryGradeLess60" resultType="org.springblade.modules.exam.entity.ExamScore"> |
| | | select * from exam_score where all_grade < 30 |
| | | </select> |
| | | |
| | | <!--导出-按条件查询成绩数据-模拟考试--> |
| | | <select id="getExamScoreList" resultType="org.springblade.modules.exam.excel.ExportExamScoreExcel"> |
| | | SELECT |
| | | ke.exam_name examName,bu.real_name securityName,bu.cardid idCardNo, |
| | | bd.dept_name companyName, |
| | | es.exam_time examTime,exam_end_time examEndTime, |
| | | es.theory_grade theoryGrade,es.learn_grade learnGrade, |
| | | all_grade allGrade |
| | | from |
| | | exam_score es |
| | | left join |
| | | ksxt_exam ke |
| | | on |
| | | ke.id = es.exam_id |
| | | left join |
| | | blade_user bu |
| | | on |
| | | es.user_id = bu.id |
| | | left join |
| | | blade_dept bd |
| | | on |
| | | bd.id = bu.dept_id |
| | | left join |
| | | sys_training_registration str |
| | | on |
| | | str.id = es.apply_id |
| | | where |
| | | 1=1 |
| | | and (str.is_exam = 2 or str.is_exam = 3) |
| | | <if test="examScore.examName!=null and examScore.examName!=''"> |
| | | and ke.exam_name like concat('%', #{examScore.examName},'%') |
| | | </if> |
| | | <if test="examScore.companyName!=null and examScore.companyName!=''"> |
| | | and bd.dept_name like concat('%', #{examScore.companyName},'%') |
| | | </if> |
| | | <if test="examScore.securityName!=null and examScore.securityName!=''"> |
| | | and bu.real_name like concat('%', #{examScore.securityName},'%') |
| | | </if> |
| | | <if test="examScore.account!=null and examScore.account!=''"> |
| | | and bu.account like concat('%', #{examScore.account},'%') |
| | | </if> |
| | | <if test="examScore.trainUnitId!=null"> |
| | | and str.training_unit_id = #{examScore.trainUnitId} |
| | | </if> |
| | | <if test="examScore.userId!=null and examScore.userId!=''"> |
| | | and es.user_id = #{examScore.userId} |
| | | </if> |
| | | <if test="examScore.deptId!=null and examScore.deptId!=''"> |
| | | and bd.id = #{examScore.deptId} |
| | | </if> |
| | | <if test="examScore.isExam!=null and examScore.isExam!=''"> |
| | | and str.is_exam = #{examScore.isExam} |
| | | </if> |
| | | <if test="examScore.examType!=null and examScore.examType!=''"> |
| | | and ke.exam_type = #{examScore.examType} |
| | | </if> |
| | | <if test="examScore.candidateNo!=null and examScore.candidateNo!=''"> |
| | | and es.candidate_no = #{examScore.candidateNo} |
| | | </if> |
| | | <if test="examScore.qualified!=null"> |
| | | and es.qualified = #{examScore.qualified} |
| | | </if> |
| | | <if test="examScore.examDate!=null and examScore.examDate!=''"> |
| | | and date_format(es.exam_time,'%Y-%m-%d') = #{examScore.examDate} |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.excel.ExamScoreExcel; |
| | | import org.springblade.modules.exam.excel.ExportExamScoreExcel; |
| | | import org.springblade.modules.exam.vo.ExamScoreVO; |
| | | import org.springblade.modules.exam.vo.UpdateParamVo; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | boolean refreshTrainExamInfo(UpdateParamVo updateParamVo); |
| | | |
| | | /** |
| | | * 按条件查询成绩数据 |
| | | * @param examScoreVO |
| | | * @return |
| | | */ |
| | | List<ExportExamScoreExcel> exportExamScoreList(ExamScoreVO examScoreVO); |
| | | } |
| | |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springblade.modules.exam.entity.ExamSubjectChoices; |
| | | import org.springblade.modules.exam.excel.ExamScoreExcel; |
| | | import org.springblade.modules.exam.excel.ExportExamScoreExcel; |
| | | import org.springblade.modules.exam.mapper.ExamScoreMapper; |
| | | import org.springblade.modules.exam.service.ExamPaperService; |
| | | import org.springblade.modules.exam.service.ExamScoreService; |
| | |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | /** |
| | | * 按条件查询成绩数据 |
| | | * @param examScoreVO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ExportExamScoreExcel> exportExamScoreList(ExamScoreVO examScoreVO) { |
| | | return baseMapper.getExamScoreList(examScoreVO); |
| | | } |
| | | } |
| | |
| | | package org.springblade.modules.exam.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import lombok.Data; |
| | | import org.springblade.modules.exam.entity.ExamScore; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | */ |
| | | private Long trainUnitId; |
| | | |
| | | /** |
| | | * 考试时间 |
| | | */ |
| | | private String examDate; |
| | | |
| | | } |
| | |
| | | |
| | | List<MultipartFile> fileList = new ArrayList<>(); |
| | | //获取图片文件 |
| | | fileList = fileUtil.getSubFiles(desPath+File.separator+namePath,fileList); |
| | | // fileList = fileUtil.getSubFiles(desPath+File.separator+namePath,fileList); |
| | | fileList = fileUtil.getSubFiles(desPath,fileList); |
| | | for (MultipartFile multipartFile : fileList){ |
| | | if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) { |
| | | String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf(".")); |
| | |
| | | |
| | | List<MultipartFile> fileList = new ArrayList<>(); |
| | | //获取图片文件 |
| | | fileList = fileUtil.getSubFiles(desPath+File.separator+namePath,fileList); |
| | | fileList = fileUtil.getSubFiles(desPath,fileList); |
| | | for (MultipartFile multipartFile : fileList){ |
| | | if(multipartFile.getName().toLowerCase().endsWith(".png") || multipartFile.getName().toLowerCase().endsWith(".jpg")) { |
| | | String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "") + multipartFile.getName().substring(multipartFile.getName().lastIndexOf(".")); |
| | |
| | | User user1 = userService.getById(user.getId()); |
| | | user.setPassword(user1.getPassword()); |
| | | userService.updateById(user); |
| | | Date birthday1 = user.getBirthday(); |
| | | String birthday; |
| | | String rtime; |
| | | if (user.getBirthday() == null) { |
| | | birthday = null; |
| | | } else { |
| | | birthday = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(user.getBirthday()); |
| | | } |
| | | |
| | | if (user.getRtime() == null) { |
| | | rtime = null; |
| | | } else { |
| | |
| | | public R securitySave(@Valid @RequestBody Map<String, Object> userMap) { |
| | | //获取user |
| | | User user = JSON.parseObject(JSON.toJSONString(userMap.get("user")), User.class); |
| | | //判断是否为空 |
| | | // if (null!=user.getHold()){ |
| | | //持证 |
| | | // if (user.getHold().equals("1")){ |
| | | //分配保安角色 |
| | | Role role = new Role(); |
| | | role.setRoleAlias("保安"); |
| | |
| | | user.setRoleId(oneRole.getId().toString()); |
| | | user.setDispatch("1"); |
| | | user.setExaminationType("0"); |
| | | user.setAccount(user.getCardid()); |
| | | |
| | | Integer userCount = userService.selectCount(user.getAccount()); |
| | | if (userCount > 0 && Func.isEmpty(user.getId())) { |
| | |
| | | // } |
| | | // } |
| | | //密码加密 |
| | | if (Func.isNotEmpty(user.getPassword())) { |
| | | user.setPassword(DigestUtil.encrypt(user.getPassword())); |
| | | if (Func.isNotEmpty(user.getCardid())) { |
| | | // user.setPassword(DigestUtil.encrypt(user.getPassword())); |
| | | //取身份证号码后6位作为密码 |
| | | user.setPassword(DigestUtil.encrypt(user.getCardid().substring(user.getCardid().length() - 6))); |
| | | } |
| | | user.setTenantId("000000"); |
| | | //用户新增 |
| | | boolean status = userService.save(user); |
| | | |
| | | String birthday; |
| | | String rtime; |
| | | if (user.getBirthday() == null) { |
| | | birthday = null; |
| | | } else { |
| | | birthday = new SimpleDateFormat("yyyy-MM-dd").format(user.getBirthday()); |
| | | } |
| | | |
| | | if (user.getRtime() == null) { |
| | | rtime = null; |
| | | } else { |
| | | rtime = new SimpleDateFormat("yyyy-MM-dd").format(user.getRtime()); |
| | | } |
| | | |
| | | //头像 |
| | | if (null!=user.getAvatar() && !user.getAvatar().equals("")) { |
| | | user.setAvatar(FtpConfig.ip + user.getAvatar().substring(26)); |
| | |
| | | |
| | | String s = "insert into blade_user(id,tenant_id,account,password,name,real_name,avatar,email,phone,sex,role_id,dept_id,cardid,nativePlace,nation,fingerprint,education," + |
| | | "politicaloutlook,healstats,height,address,registered,rtime,securitynumber,hold,jurisdiction,examination_type,status,is_deleted,dispatch) " + |
| | | "values(" + "'" + user.getId() + "'" + "," + "'" + user.getTenantId() + "'" + "," + "'" + user.getAccount() + "'" + "," + |
| | | "'" + user.getPassword() + "'" + "," + "'" + user.getName() + "'" + "," + "'" + user.getRealName() + "'" + "," + "'" + user.getAvatar() + "'" + "," + |
| | | "'" + user.getEmail() + "'" + "," + "'" + user.getPhone() + "'" + "," + "'" + user.getSex() + "'" + "," + "'" + user.getRoleId() + "'" + |
| | | "values(" + "'" + user.getId() + "'" + |
| | | "," + "'" + user.getTenantId() + "'" + |
| | | "," + "'" + user.getAccount() + "'" + |
| | | "," + "'" + user.getPassword() + "'" + |
| | | "," + "'" + user.getName() + "'" + |
| | | "," + "'" + user.getRealName() + "'" + |
| | | "," + "'" + user.getAvatar() + "'" + |
| | | "," + "'" + user.getEmail() + "'" + |
| | | "," + "'" + user.getPhone() + "'" + |
| | | "," + "'" + user.getSex() + "'" + |
| | | "," + "'" + user.getRoleId() + "'" + |
| | | "," + "'" + user.getDeptId() + "'" + |
| | | "," + "'" + user.getCardid() + "'" + |
| | | "," + "'" + user.getNativeplace() + "'" + |
| | |
| | | package org.springblade.modules.system.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.zxing.WriterException; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.common.cache.DictCache; |
| | | import org.springblade.common.cache.ParamCache; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.cache.UserCache; |
| | | import org.springblade.common.constant.AgeUtil; |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.constant.TenantConstant; |
| | | import org.springblade.common.enums.DictEnum; |
| | | import org.springblade.common.utils.QRCodeUtil; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | |
| | | import org.springblade.core.tool.utils.*; |
| | | import org.springblade.modules.FTP.FtpUtil; |
| | | import org.springblade.modules.auth.enums.UserEnum; |
| | | import org.springblade.modules.dispatcher.service.IDispatcherService; |
| | | import org.springblade.modules.dispatcher.vo.DispatcherUnitVO; |
| | | import org.springblade.modules.dispatcher.vo.DispatcherVO; |
| | | import org.springblade.modules.information.entity.Information; |
| | | import org.springblade.modules.information.service.IInformationService; |
| | | import org.springblade.modules.jurisdiction.entity.Jurisdiction; |
| | | import org.springblade.modules.system.entity.*; |
| | | import org.springblade.modules.system.excel.QrCodeExcel; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | | /** |
| | | * 服务实现类 |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | // @Transactional(rollbackFor = Exception.class) |
| | | public void importUser(List<UserExcel> data, Boolean isCovered,String deptId) { |
| | | //将不能导入的保安员账号存起来 |
| | | List<String> errorList = new ArrayList<>(); |
| | | //导入状态,默认为true ,如果有一个出现问题则为 false |
| | | AtomicBoolean status = new AtomicBoolean(true); |
| | | data.forEach(userExcel -> { |
| | | User user = Objects.requireNonNull(BeanUtil.copy(userExcel, User.class)); |
| | | //设置部门id |
| | |
| | | if (null!=deptIds && !deptIds.equals("")) { |
| | | if (null != deptId && !deptId.equals("")) { |
| | | if (!deptId.equals(deptIds)) { |
| | | throw new ServiceException("不能导入不是本公司的保安员数据!"); |
| | | throw new ServiceException("导入失败!不能导入不是本公司的保安员数据!"); |
| | | } |
| | | } |
| | | user.setDeptId(deptIds); |
| | | }else { |
| | | //如果deptIds 为空,则说明还没有改公司 |
| | | throw new ServiceException("公司名:"+user.getDeptId()+"不存在!"); |
| | | throw new ServiceException("导入失败!公司名:["+user.getDeptId()+"]不存在!"); |
| | | } |
| | | //判断当前用户是否已在本单位,如果是的更新数据 |
| | | User user1 = new User(); |
| | | user1.setAccount(user.getCardid()); |
| | | System.out.println("user.getCardid() = " + user.getCardid()); |
| | | // System.out.println("user.getCardid() = " + user.getCardid()); |
| | | user1.setIsDeleted(0); |
| | | user1.setStatus(1); |
| | | User user2 = this.getOne(Condition.getQueryWrapper(user1)); |
| | |
| | | //匹配组织机构是否一致,如果不一致 |
| | | if(!user2.getDeptId().equals(user.getDeptId())){ |
| | | Dept dept = deptService.getById(user2.getDeptId()); |
| | | throw new ServiceException("用户:"+"["+user.getCardid()+"]"+"已在["+dept.getDeptName()+"]存在!"); |
| | | // throw new ServiceException("用户:"+"["+user.getCardid()+"]"+"已在其他单位存在!"); |
| | | status.set(false); |
| | | //加入集合 |
| | | errorList.add(user.getCardid()); |
| | | //forEach 只能使用 return 跳出本次循环 |
| | | return; |
| | | }else { |
| | | //如果是一致,则更新用户数据 |
| | | //判断是否持证 |
| | |
| | | } |
| | | } |
| | | }); |
| | | //如果所有数据导入有一个异常 |
| | | if (!status.get()){ |
| | | String errorAccount = StringUtils.join(errorList, "\\\n"); |
| | | throw new ServiceException("用户:["+errorAccount+"]导入失败!已在其他单位存在!"); |
| | | } |
| | | } |
| | | |
| | | // @Override |