From 45eb881ac05b0f9f95deae5eb203c23a7546efcb Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Fri, 05 Nov 2021 18:35:16 +0800
Subject: [PATCH] 成绩修改审核接口修改
---
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml | 2
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml | 14 +
src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.java | 41 +++
src/main/java/org/springblade/modules/exam/entity/ScoreAuditRecords.java | 105 ++++++++
src/main/java/org/springblade/modules/exam/controller/ScoreAuditRecordsController.java | 143 +++++++++++
src/main/java/org/springblade/modules/exam/vo/ScoreAuditRecordsVO.java | 64 ++++
src/main/java/org/springblade/modules/exam/service/ScoreAuditRecordsService.java | 38 ++
src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.xml | 100 +++++++
src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java | 5
src/main/java/org/springblade/modules/exam/entity/ExamScore.java | 6
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java | 6
src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java | 217 ++++++++++++++++
src/main/java/org/springblade/modules/system/controller/UserController.java | 1
13 files changed, 741 insertions(+), 1 deletions(-)
diff --git a/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml b/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
index e207703..5728425 100644
--- a/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
+++ b/src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
@@ -10,6 +10,7 @@
bu.real_name realName,
bu.sex,bu.cardid idCardNo,
bu.securitynumber securityNumber,
+ bu.avatar,
ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age
FROM
sys_accreditation_records sar
@@ -40,6 +41,12 @@
<if test="accreditationRecords.status!=null">
and sar.status = #{accreditationRecords.status}
</if>
+ <if test="accreditationRecords.isAvatar==1">
+ and bu.avatar is not null and bu.avatar!=""
+ </if>
+ <if test="accreditationRecords.isAvatar==2">
+ and (bu.avatar is null or bu.avatar="")
+ </if>
<if test="accreditationRecords.startTime!=null and accreditationRecords.startTime!='' and accreditationRecords.startTime!='undefined'">
and sar.create_time >= #{accreditationRecords.startTime}
</if>
@@ -57,6 +64,7 @@
bu.real_name realName,
bu.sex,bu.cardid idCardNo,
bu.securitynumber securityNumber,
+ bu.avatar,
ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age
FROM
sys_accreditation_records sar
@@ -113,6 +121,12 @@
<if test="accreditationRecords.status!=null">
and sar.status = #{accreditationRecords.status}
</if>
+ <if test="accreditationRecords.isAvatar==1">
+ and bu.avatar is not null and bu.avatar!=""
+ </if>
+ <if test="accreditationRecords.isAvatar==2">
+ and (bu.avatar is null or bu.avatar="")
+ </if>
<if test="accreditationRecords.startTime!=null and accreditationRecords.startTime!='' and accreditationRecords.startTime!='undefined'">
and sar.create_time >= #{accreditationRecords.startTime}
</if>
diff --git a/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java b/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
index 776edcf..79e01b5 100644
--- a/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
+++ b/src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
@@ -70,4 +70,9 @@
* 结束时间
*/
private String endTime;
+
+ /**
+ * 是否有头像 1:有 2:没有上传
+ */
+ private Integer isAvatar;
}
diff --git a/src/main/java/org/springblade/modules/exam/controller/ScoreAuditRecordsController.java b/src/main/java/org/springblade/modules/exam/controller/ScoreAuditRecordsController.java
new file mode 100644
index 0000000..b0b0be5
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/controller/ScoreAuditRecordsController.java
@@ -0,0 +1,143 @@
+package org.springblade.modules.exam.controller;
+
+import com.alibaba.excel.EasyExcel;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.apache.commons.codec.Charsets;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.modules.exam.entity.ExamScore;
+import org.springblade.modules.exam.entity.ScoreAuditRecords;
+import org.springblade.modules.exam.service.ExamScoreService;
+import org.springblade.modules.exam.service.ScoreAuditRecordsService;
+import org.springblade.modules.exam.vo.ScoreAuditRecordsVO;
+import org.springblade.modules.system.service.IUserService;
+import org.springframework.web.bind.annotation.*;
+import java.util.Date;
+
+/**
+ * @author zhongrj
+ * @time 2021-11-4
+ * @desc 考试成绩修改申请记录控制层
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/scoreAuditRecords")
+public class ScoreAuditRecordsController {
+
+ private final ScoreAuditRecordsService scoreAuditRecordsService;
+
+ private final ExamScoreService examScoreService;
+
+ private final IUserService userService;
+
+
+ /**
+ * 自定义分页
+ * @param query page,size
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @GetMapping("/page")
+ public R<IPage<ScoreAuditRecordsVO>> page(ScoreAuditRecordsVO scoreAuditRecords, Query query) {
+ IPage<ScoreAuditRecordsVO> pages = scoreAuditRecordsService.selectScoreAuditRecordsPage(Condition.getPage(query), scoreAuditRecords);
+ return R.data(pages);
+ }
+
+ /**
+ * 新增
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @PostMapping("/save")
+ @ApiOperation(value = "新增", notes = "传入scoreAuditRecords")
+ public R save(@RequestBody ScoreAuditRecords scoreAuditRecords){
+ return R.data(scoreAuditRecordsService.save(scoreAuditRecords));
+ }
+
+
+ /**
+ * 成绩修改申请
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @PostMapping("/scoreUpdateApply")
+ @ApiOperation(value = "新增", notes = "传入scoreAuditRecords")
+ public R scoreUpdateApply(@RequestBody ScoreAuditRecords scoreAuditRecords){
+ //获取考试成绩id
+ scoreAuditRecords.setCreateTime(new Date());
+ //待审核
+ scoreAuditRecords.setStatus(1);
+ //查询成绩
+ ExamScore examScore = examScoreService.getById(scoreAuditRecords.getExamScoreId());
+ scoreAuditRecords.setUserId(Long.parseLong(examScore.getUserId()));
+ //申请并返回数据
+ return R.data(scoreAuditRecordsService.save(scoreAuditRecords));
+ }
+
+
+ /**
+ * 修改
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @PostMapping("/update")
+ public R update(@RequestBody ScoreAuditRecords scoreAuditRecords){
+ return R.status(scoreAuditRecordsService.updateById(scoreAuditRecords));
+ }
+
+ /**
+ * 新增或修改
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @PostMapping("/submit")
+ public R submit(@RequestBody ScoreAuditRecords scoreAuditRecords){
+ return R.data(scoreAuditRecordsService.saveOrUpdate(scoreAuditRecords));
+ }
+
+ /**
+ * 删除
+ * @param ids 考试成绩修改申请记录信息ids 数组
+ */
+ @PostMapping("/remove")
+ public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
+ return R.status(scoreAuditRecordsService.removeByIds(Func.toLongList(ids)));
+ }
+
+ /**
+ * 详情
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @GetMapping("/detail")
+ @ApiOperation(value = "详情", notes = "传入scoreAuditRecords")
+ public R<ScoreAuditRecords> detail(ScoreAuditRecords scoreAuditRecords) {
+ ScoreAuditRecords detail = scoreAuditRecordsService.getOne(Condition.getQueryWrapper(scoreAuditRecords));
+ return R.data(detail);
+ }
+
+
+ /**
+ * 详情
+ * @param scoreAuditRecords 考试成绩修改申请记录信息对象
+ */
+ @GetMapping("/details")
+ @ApiOperation(value = "详情", notes = "传入scoreAuditRecords")
+ public R<ScoreAuditRecordsVO> details(ScoreAuditRecords scoreAuditRecords) {
+ ScoreAuditRecordsVO detail = scoreAuditRecordsService.getScoreAuditRecordsDetails(scoreAuditRecords);
+ return R.data(detail);
+ }
+
+
+ /**
+ * 申请审核
+ * @param scoreAuditRecords 考试成绩修改申请记录审核
+ */
+ @PostMapping("/applyAudit")
+ public R applyAudit(@RequestBody ScoreAuditRecords scoreAuditRecords){
+ return R.status(scoreAuditRecordsService.applyAudit(scoreAuditRecords));
+ }
+
+
+
+}
diff --git a/src/main/java/org/springblade/modules/exam/entity/ExamScore.java b/src/main/java/org/springblade/modules/exam/entity/ExamScore.java
index 1b2f929..0ebb9eb 100644
--- a/src/main/java/org/springblade/modules/exam/entity/ExamScore.java
+++ b/src/main/java/org/springblade/modules/exam/entity/ExamScore.java
@@ -5,6 +5,8 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@@ -37,12 +39,14 @@
/**
* 理论成绩
*/
+ @JsonSerialize(nullsUsing = NullSerializer.class)
@TableField("theory_grade")
private Integer theoryGrade;
/**
* 实操成绩
*/
+ @JsonSerialize(nullsUsing = NullSerializer.class)
@TableField("learn_grade")
private Integer learnGrade;
@@ -50,6 +54,7 @@
/**
* 总成绩
*/
+ @JsonSerialize(nullsUsing = NullSerializer.class)
@TableField("all_grade")
private Integer allGrade;
@@ -93,6 +98,7 @@
* 试卷总分值
*/
@TableField("all_score")
+ @JsonSerialize(nullsUsing = NullSerializer.class)
private Integer allScore;
/**
diff --git a/src/main/java/org/springblade/modules/exam/entity/ScoreAuditRecords.java b/src/main/java/org/springblade/modules/exam/entity/ScoreAuditRecords.java
new file mode 100644
index 0000000..d2bd696
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/entity/ScoreAuditRecords.java
@@ -0,0 +1,105 @@
+package org.springblade.modules.exam.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.NullSerializer;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 考试成绩修改申请记录实体类
+ * @author zhongrj
+ * @time 2021-11-4
+ */
+@Data
+@TableName("sys_score_audit_records")
+public class ScoreAuditRecords implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 考试成绩修改申请记录主键id,非自增
+ */
+ @TableId(value = "id",type = IdType.ASSIGN_ID)
+ private Long id;
+
+ /**
+ * user_id,需要修改的成绩的用户id
+ */
+ @TableField("user_id")
+ private Long userId;
+
+
+ /**
+ * 申请时间
+ */
+ @TableField("create_time")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+
+ /**
+ * 申请理由
+ */
+ @TableField("apply_cause")
+ private String applyCause;
+
+ /**
+ * 创建人(申请人)
+ */
+ @TableField("create_user")
+ private String createUser;
+
+ /**
+ * 状态 1:待审核 2:审核通过 3:审核不通过
+ */
+ private Integer status;
+
+ /**
+ * 审核时间
+ */
+ @TableField("audit_time")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date auditTime;
+
+ /**
+ * 审核详情
+ */
+ @TableField("audit_detail")
+ private String auditDetail;
+
+ /**
+ * 修改前理论成绩分数
+ */
+ @TableField("old_score")
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ private Integer oldScore;
+
+ /**
+ * 需要修改的理论成绩分数
+ */
+ @TableField("new_score")
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ private Integer newScore;
+
+ /**
+ * 考试成绩id
+ */
+ @TableField("exam_score_id")
+ private Long examScoreId;
+
+ /**
+ * 审核人员id
+ */
+ @TableField("audit_user")
+ private Long auditUser;
+
+}
diff --git a/src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.java b/src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.java
new file mode 100644
index 0000000..e88247f
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.java
@@ -0,0 +1,41 @@
+package org.springblade.modules.exam.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.modules.exam.entity.ScoreAuditRecords;
+import org.springblade.modules.exam.vo.ScoreAuditRecordsVO;
+
+import java.util.List;
+
+/**
+ * 考试成绩修改申请记录Mapper 接口
+ * @author zhongrj
+ */
+public interface ScoreAuditRecordsMapper extends BaseMapper<ScoreAuditRecords> {
+
+
+
+ /**
+ * 自定义分页
+ *
+ * @param page 分页
+ * @param recruitment 实体
+ * @return
+ */
+ List<ScoreAuditRecordsVO> selectScoreAuditRecordsPage(IPage page, @Param("scoreAuditRecords") ScoreAuditRecordsVO recruitment);
+
+ /**
+ * 自定义详情信息
+ * @param scoreAuditRecords
+ * @return
+ */
+ ScoreAuditRecordsVO getScoreAuditRecordsDetails(@Param("scoreAuditRecords") ScoreAuditRecords scoreAuditRecords);
+
+ /**
+ * 导出保安员证信息
+ * @param scoreAuditRecords
+ * @return
+ */
+ List<ScoreAuditRecordsVO> exportSecurityPaperList(@Param("scoreAuditRecords") ScoreAuditRecordsVO scoreAuditRecords);
+}
diff --git a/src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.xml b/src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.xml
new file mode 100644
index 0000000..e83fef9
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/mapper/ScoreAuditRecordsMapper.xml
@@ -0,0 +1,100 @@
+<?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.springblade.modules.exam.mapper.ScoreAuditRecordsMapper">
+
+ <!--考试成绩修改申请记录分页信息-->
+ <select id="selectScoreAuditRecordsPage" resultType="org.springblade.modules.exam.vo.ScoreAuditRecordsVO">
+ SELECT
+ ssar.*,
+ bt.dept_name AS deptName,
+ bu.real_name realName,
+ bu.sex,bu.cardid idCardNo,
+ ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
+ bu1.real_name applyRealName,
+ ke.exam_name examName
+ FROM
+ sys_score_audit_records ssar
+ left join
+ blade_user bu
+ on
+ ssar.user_id = bu.id
+ LEFT JOIN
+ blade_dept bt
+ ON
+ bu.dept_id = bt.id
+ left join
+ blade_user bu1
+ on
+ ssar.create_user = bu1.id
+ left join
+ exam_score es
+ on
+ es.id = ssar.exam_score_id
+ left join
+ ksxt_exam ke
+ on
+ ke.id = es.exam_id
+ WHERE
+ 1=1
+ and bu.status = 1
+ and bu.is_deleted = 0
+ <if test="scoreAuditRecords.deptName!=null and scoreAuditRecords.deptName!=''">
+ and bt.dept_name like concat('%', #{scoreAuditRecords.deptName},'%')
+ </if>
+ <if test="scoreAuditRecords.realName!=null and scoreAuditRecords.realName!=''">
+ and bu.real_name like concat('%', #{scoreAuditRecords.realName},'%')
+ </if>
+ <if test="scoreAuditRecords.idCardNo!=null and scoreAuditRecords.idCardNo!=''">
+ and bu.cardid like concat('%', #{scoreAuditRecords.idCardNo},'%')
+ </if>
+ <if test="scoreAuditRecords.applyRealName!=null and scoreAuditRecords.applyRealName!=''">
+ and bu1.real_name like concat('%', #{scoreAuditRecords.applyRealName},'%')
+ </if>
+ <if test="scoreAuditRecords.examName!=null and scoreAuditRecords.examName!=''">
+ and ke.exam_name like concat('%', #{scoreAuditRecords.examName},'%')
+ </if>
+ <if test="scoreAuditRecords.status!=null">
+ and ssar.status = #{scoreAuditRecords.status}
+ </if>
+ <if test="scoreAuditRecords.startTime!=null and scoreAuditRecords.startTime!='' and scoreAuditRecords.startTime!='undefined'">
+ and ssar.create_time >= #{scoreAuditRecords.startTime}
+ </if>
+ <if test="scoreAuditRecords.createTime!=null and scoreAuditRecords.createTime!='' and scoreAuditRecords.createTime!='undefined'">
+ and ssar.create_time = #{scoreAuditRecords.createTime}
+ </if>
+ <if test="scoreAuditRecords.endTime!=null and scoreAuditRecords.endTime!='' and scoreAuditRecords.endTime!='undefined'">
+ and ssar.create_time <= #{scoreAuditRecords.endTime}
+ </if>
+ order by ssar.create_time desc
+ </select>
+
+ <!--自定义详情信息-->
+ <select id="getScoreAuditRecordsDetails" resultType="org.springblade.modules.exam.vo.ScoreAuditRecordsVO">
+ SELECT
+ ssar.*,
+ bt.dept_name AS deptName,
+ bu.real_name realName,
+ bu.sex,bu.cardid idCardNo,
+ ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
+ bu1.real_name applyRealName
+ FROM
+ sys_score_audit_records ssar
+ left join
+ blade_user bu
+ on
+ ssar.user_id = bu.id
+ LEFT JOIN
+ blade_dept bt
+ ON
+ bu.dept_id = bt.id
+ left join
+ blade_user bu1
+ on
+ ssar.create_user = bu1.id
+ WHERE
+ 1=1
+ and bu.status = 1
+ and bu.is_deleted = 0
+ and ssar.id = #{scoreAuditRecords.id}
+ </select>
+</mapper>
diff --git a/src/main/java/org/springblade/modules/exam/service/ScoreAuditRecordsService.java b/src/main/java/org/springblade/modules/exam/service/ScoreAuditRecordsService.java
new file mode 100644
index 0000000..6166b2e
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/service/ScoreAuditRecordsService.java
@@ -0,0 +1,38 @@
+package org.springblade.modules.exam.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.springblade.modules.accreditation.excel.ExportSecurityPaperExcel;
+import org.springblade.modules.exam.entity.ScoreAuditRecords;
+import org.springblade.modules.exam.vo.ScoreAuditRecordsVO;
+
+import java.util.List;
+
+/**
+ * 考试成绩修改申请记录服务类
+ * @author zhongrj
+ */
+public interface ScoreAuditRecordsService extends IService<ScoreAuditRecords> {
+
+ /**
+ * 自定义分页
+ * @param page
+ * @param scoreAuditRecords
+ * @return
+ */
+ IPage<ScoreAuditRecordsVO> selectScoreAuditRecordsPage(IPage<ScoreAuditRecordsVO> page, ScoreAuditRecordsVO scoreAuditRecords);
+
+ /**
+ * 自定义详情信息
+ * @param scoreAuditRecords
+ * @return
+ */
+ ScoreAuditRecordsVO getScoreAuditRecordsDetails(ScoreAuditRecords scoreAuditRecords);
+
+ /**
+ * 申请审核
+ * @param scoreAuditRecords
+ * @return
+ */
+ boolean applyAudit(ScoreAuditRecords scoreAuditRecords);
+}
diff --git a/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java b/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java
new file mode 100644
index 0000000..66f0507
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java
@@ -0,0 +1,217 @@
+
+package org.springblade.modules.exam.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import lombok.AllArgsConstructor;
+import org.springblade.common.utils.QRCodeUtil;
+import org.springblade.modules.FTP.FtpUtil;
+import org.springblade.modules.accreditation.excel.ExportSecurityPaperExcel;
+import org.springblade.modules.exam.entity.ExamScore;
+import org.springblade.modules.exam.entity.ScoreAuditRecords;
+import org.springblade.modules.exam.mapper.ScoreAuditRecordsMapper;
+import org.springblade.modules.exam.service.ExamScoreService;
+import org.springblade.modules.exam.service.ScoreAuditRecordsService;
+import org.springblade.modules.exam.util.SecurityPaperUtil;
+import org.springblade.modules.exam.vo.ScoreAuditRecordsVO;
+import org.springblade.modules.system.entity.User;
+import org.springblade.modules.system.service.IUserService;
+import org.springblade.modules.system.vo.UserVO;
+import org.springblade.modules.training.entity.TrainingRegistration;
+import org.springblade.modules.training.service.TrainingRegistrationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.text.DecimalFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 考试成绩修改申请记录服务实现类
+ * @author zhongrj
+ */
+@Service
+public class ScoreAuditRecordsServiceImpl extends ServiceImpl<ScoreAuditRecordsMapper, ScoreAuditRecords> implements ScoreAuditRecordsService {
+
+ @Autowired
+ private ExamScoreService examScoreService;
+
+ @Autowired
+ private IUserService userService;
+
+ @Autowired
+ private TrainingRegistrationService trainingRegistrationService;
+
+ /**
+ * 自定义分页
+ * @param page
+ * @param scoreAuditRecords
+ * @return
+ */
+ @Override
+ public IPage<ScoreAuditRecordsVO> selectScoreAuditRecordsPage(IPage<ScoreAuditRecordsVO> page, ScoreAuditRecordsVO scoreAuditRecords) {
+ List<ScoreAuditRecordsVO> scoreAuditRecordsVOs = baseMapper.selectScoreAuditRecordsPage(page, scoreAuditRecords);
+ return page.setRecords(scoreAuditRecordsVOs);
+ }
+
+ /**
+ * 自定义详情信息
+ * @param scoreAuditRecords
+ * @return
+ */
+ @Override
+ public ScoreAuditRecordsVO getScoreAuditRecordsDetails(ScoreAuditRecords scoreAuditRecords) {
+ return baseMapper.getScoreAuditRecordsDetails(scoreAuditRecords);
+ }
+
+ /**
+ * 申请审核
+ * @param scoreAuditRecords
+ * @return
+ */
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public boolean applyAudit(ScoreAuditRecords scoreAuditRecords) {
+ //审核
+ //如果是审核通过,则修改考试成绩,并改变培训考试状态,用户培训状态
+ if (scoreAuditRecords.getStatus()==2) {
+ ScoreAuditRecords auditRecords = this.getById(scoreAuditRecords.getId());
+ //查询考试成绩
+ ExamScore examScore = examScoreService.getById(auditRecords.getExamScoreId());
+ //1.修改培训报名考试状态
+ TrainingRegistration trainingRegistration = trainingRegistrationService.getById(examScore.getApplyId());
+ //已考试
+ trainingRegistration.setIsExam(2);
+ //修改
+ trainingRegistrationService.updateById(trainingRegistration);
+
+ //2.修改用户培训考试状态
+ User user = userService.getById(examScore.getUserId());
+ //修改为考试结束状态
+ user.setIsTrain(3);
+
+ //3.修改考试理论成绩
+ examScore.setTheoryGrade(auditRecords.getNewScore());
+ //查询用户年龄
+ UserVO userVO = userService.getUserAgeById(Long.parseLong(examScore.getUserId()));
+ //判断实操成绩是否为空
+ if (null == examScore.getLearnGrade()) {
+ //如果为空,之间修改理论成绩和总成绩
+ //总成绩
+ if (userVO.getAge() <= 50) {
+ examScore.setAllGrade(Math.round(examScore.getTheoryGrade()/2));
+ }
+ if (userVO.getAge() > 50) {
+ examScore.setAllGrade(Math.round(examScore.getTheoryGrade()/2));
+ }
+ if (examScore.getTheoryGrade() >= 60) {
+ //实操成绩暂未录入
+ examScore.setQualified(2);
+ }else {
+ //不合格
+ examScore.setQualified(1);
+ }
+ //更新保安数据
+ userService.updateById(user);
+ //更新成绩数据
+ examScoreService.updateById(examScore);
+
+ //内网培训报名,人员,成绩数据同步
+ String s1 =
+ "update exam_score set theory_grade = " + "'" + examScore.getTheoryGrade() + "'" +
+ ",all_grade = " + "'" + examScore.getAllGrade() + "'" +
+ ",qualified = " + "'" + examScore.getQualified() + "'" +
+ " " + "where id = " + "'" + examScore.getId() + "';"+
+ "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
+ " " + "where id = " + "'" + trainingRegistration.getId() + "';"+
+ "update blade_user set is_train = " + "'" + user.getIsTrain() + "'" +
+ " " + "where id = " + "'" + user.getId() + "'";
+ FtpUtil.sqlFileUpload(s1);
+ } else {
+ if (examScore.getTheoryGrade() >= 60 && examScore.getLearnGrade() >= 60) {
+ //合格
+ examScore.setQualified(0);
+ //如果已有保安证编号,不更保安证编号信息
+ if (null == user.getSecuritynumber() || user.getSecuritynumber() == "") {
+ //去生成保安证编号
+ String pre = SecurityPaperUtil.getSecurityPaper();
+ //查询当前年份已有的保安证编号
+ int count = userService.getSecurityPaperCount(pre);
+ String result = null;
+ if (count == 0) {
+ result = pre + "00001";
+ } else {
+ //格式化
+ DecimalFormat decimalFormat = new DecimalFormat("00000");
+ count++;
+ result = pre + (decimalFormat.format(count));
+ }
+ user.setSecuritynumber(result);
+ //发证日期
+// user.setPaperTime(new Date());
+ //修改为持证保安
+ user.setHold("1");
+ //更新保安数据
+ userService.updateById(user);
+
+// String s1 =
+// "update blade_user set hold = " + "'" + user.getHold() + "'" +
+// ",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
+// ",is_train = " + "'" + user.getIsTrain() + "'" +
+// " " + "where id = " + "'" + user.getId() + "'";
+// FtpUtil.sqlFileUpload(s1);
+ }
+ } else {
+ //不合格
+ examScore.setQualified(1);
+ }
+ //总成绩
+ if (userVO.getAge() <= 50) {
+ if (null != examScore.getTheoryGrade()) {
+ examScore.setAllGrade(Math.round((examScore.getTheoryGrade() + examScore.getLearnGrade()) / 2));
+ } else {
+ examScore.setAllGrade(Math.round(examScore.getLearnGrade() / 2));
+ }
+ }
+ if (userVO.getAge() > 50) {
+ if (null != examScore.getTheoryGrade()) {
+ examScore.setAllGrade(Integer.parseInt(String.valueOf(Math.round(examScore.getTheoryGrade() * 0.5)))
+ + Integer.parseInt(String.valueOf(Math.round(examScore.getLearnGrade() * 0.5))));
+ } else {
+ examScore.setAllGrade(Math.round(examScore.getLearnGrade() / 2));
+ }
+ }
+
+ //更新成绩数据
+ examScoreService.updateById(examScore);
+
+ //内网培训报名,人员,成绩数据同步
+ String s1 =
+ "update exam_score set theory_grade = " + "'" + examScore.getTheoryGrade() + "'" +
+ ",all_grade = " + "'" + examScore.getAllGrade() + "'" +
+ ",qualified = " + "'" + examScore.getQualified() + "'" +
+ " " + "where id = " + "'" + examScore.getId() + "';"+
+ "update sys_training_registration set is_exam = " + "'" + trainingRegistration.getIsExam() + "'" +
+ " " + "where id = " + "'" + trainingRegistration.getId() + "';"+
+ "update blade_user set hold = " + "'" + user.getHold() + "'" +
+ ",securitynumber = " + "'" + user.getSecuritynumber() + "'" +
+ ",is_train = " + "'" + user.getIsTrain() + "'" +
+ " " + "where id = " + "'" + user.getId() + "'";
+ FtpUtil.sqlFileUpload(s1);
+ }
+ }
+ //审核时间
+ scoreAuditRecords.setAuditTime(new Date());
+ //修改申请记录信息
+ baseMapper.updateById(scoreAuditRecords);
+ //返回
+ return true;
+ }
+}
diff --git a/src/main/java/org/springblade/modules/exam/vo/ScoreAuditRecordsVO.java b/src/main/java/org/springblade/modules/exam/vo/ScoreAuditRecordsVO.java
new file mode 100644
index 0000000..1d0fd65
--- /dev/null
+++ b/src/main/java/org/springblade/modules/exam/vo/ScoreAuditRecordsVO.java
@@ -0,0 +1,64 @@
+package org.springblade.modules.exam.vo;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.NullSerializer;
+import lombok.Data;
+import org.springblade.modules.exam.entity.ScoreAuditRecords;
+
+import java.io.Serializable;
+
+/**
+ * 制证记录vo
+ * @author zhongrj
+ * @since 2021-11-2
+ */
+@Data
+public class ScoreAuditRecordsVO extends ScoreAuditRecords implements Serializable {
+
+ /**
+ * 制证人员姓名
+ */
+ private String realName;
+
+ /**
+ * 制证人员组织机构名称
+ */
+ private String deptName;
+
+ /**
+ * 性别
+ */
+ private String sex;
+
+ /**
+ * 制证人员身份证号
+ */
+ private String idCardNo;
+
+ /**
+ * 申请人姓名(培训学校的人)
+ */
+ private String applyRealName;
+
+ /**
+ * 年龄
+ */
+ @JsonSerialize(nullsUsing = NullSerializer.class)
+ private Integer age;
+
+ /**
+ *开始时间
+ */
+ private String startTime;
+
+ /**
+ * 结束时间
+ */
+ private String endTime;
+
+ /**
+ * 考试名称
+ */
+ private String examName;
+
+}
diff --git a/src/main/java/org/springblade/modules/system/controller/UserController.java b/src/main/java/org/springblade/modules/system/controller/UserController.java
index 5b50e4f..acad9c9 100644
--- a/src/main/java/org/springblade/modules/system/controller/UserController.java
+++ b/src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -299,6 +299,7 @@
}
String s1 =
"update blade_user set paper_time = " + "'" + paperTime + "'"
+ + ",user_type = " + "'" + user.getUserType() + "'"
+ " " + "where id = " + "'" + user.getId() + "'";
FtpUtil.sqlFileUpload(s1);
return R.success("修改成功");
diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index 1fa857b..698a148 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -397,7 +397,7 @@
<!--计算保安人员年龄-->
<select id="getUserAgeById" resultType="org.springblade.modules.system.vo.UserVO">
- select id,ifnull(TIMESTAMPDIFF(YEAR, birthday, CURDATE()),0) age,securitynumber,cardid
+ select id,ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING(cardid,7,4),0) age,securitynumber,cardid
from
blade_user
where
diff --git a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
index 573f8f1..241972a 100644
--- a/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
+++ b/src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -471,11 +471,17 @@
user2.setHold("2");
}
}
+ if (null!=userExcel.getRegistered()){
+ user2.setRegistered(userExcel.getRegistered());
+ }else {
+ user2.setRegistered("");
+ }
//更新用户数据
this.updateById(user2);
String s1 =
"update blade_user set hold = " + "'" + user2.getHold() + "'"
+ ",securitynumber = " + "'" + user2.getSecuritynumber() + "'"
+ + ",registered = " + "'" + user2.getRegistered() + "'"
+ " " + "where id = " + "'" + user2.getId() + "'";
FtpUtil.sqlFileUpload(s1);
}
--
Gitblit v1.9.3