智慧保安后台管理-外网
证书打印信息导出修改,已过考试的,系统每天凌晨1点定时清理,标记为缺考,并生成缺考记录,保安员导入新增年龄判断,超过60岁的不能导入
9 files modified
8 files added
617 ■■■■ changed files
src/main/java/org/springblade/modules/absentrecords/controller/AbsentRecordsController.java 86 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/entity/AbsentRecords.java 63 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/mapper/AbsentRecordsMapper.java 19 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/mapper/AbsentRecordsMapper.xml 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/service/AbsentRecordsService.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/service/AbsentRecordsServiceImpl.java 18 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/vo/AbsentRecordsVo.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml 13 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java 52 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/crontab/Crontab.java 30 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 155 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml 39 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/TrainingRegistrationService.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java 66 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/absentrecords/controller/AbsentRecordsController.java
New file
@@ -0,0 +1,86 @@
package org.springblade.modules.absentrecords.controller;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.absentrecords.entity.AbsentRecords;
import org.springblade.modules.absentrecords.service.AbsentRecordsService;
import org.springframework.web.bind.annotation.*;
/**
 * @author zhongrj
 * @time 2021-11-18
 * @desc 缺考记录控制层
 */
@RestController
@AllArgsConstructor
@RequestMapping("/absentRecords")
public class AbsentRecordsController {
    private final AbsentRecordsService absentRecordsService;
//    /**
//     * 自定义分页
//     * @param query page,size
//     * @param absentRecords 缺考记录信息对象
//     */
//    @GetMapping("/page")
//    public R<IPage<AbsentRecordsVo>> page(AbsentRecordsVo absentRecords, Query query) {
//        IPage<AbsentRecordsVo> pages = absentRecordsService.selectAbsentRecordsPage(Condition.getPage(query), absentRecords);
//        return R.data(pages);
//    }
    /**
     * 新增
     * @param absentRecords 缺考记录信息对象
     */
    @PostMapping("/save")
    @ApiOperation(value = "新增", notes = "传入absentRecords")
    public R save(@RequestBody AbsentRecords absentRecords){
        return R.data(absentRecordsService.save(absentRecords));
    }
    /**
     * 修改
     * @param absentRecords 缺考记录信息对象
     */
    @PostMapping("/update")
    public R update(@RequestBody AbsentRecords absentRecords){
        return R.status(absentRecordsService.updateById(absentRecords));
    }
    /**
     * 新增或修改
     * @param absentRecords 缺考记录信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody AbsentRecords absentRecords){
        return R.data(absentRecordsService.saveOrUpdate(absentRecords));
    }
    /**
     * 删除
     * @param ids 缺考记录信息ids 数组
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        return R.status(absentRecordsService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 详情
     * @param absentRecords 缺考记录信息对象
     */
    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "传入absentRecords")
    public R<AbsentRecords> detail(AbsentRecords absentRecords) {
        AbsentRecords detail = absentRecordsService.getOne(Condition.getQueryWrapper(absentRecords));
        return R.data(detail);
    }
}
src/main/java/org/springblade/modules/absentrecords/entity/AbsentRecords.java
New file
@@ -0,0 +1,63 @@
package org.springblade.modules.absentrecords.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 lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 缺考记录实体类
 * @author zhongrj
 * @time 2021-11-18
 */
@Data
@TableName("sys_absent_records")
public class AbsentRecords implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 制证记录主键id,非自增
     */
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    private Long id;
    /**
     * 缺考人 user_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;
    /**
     * 考试id
     */
    @TableField("exam_id")
    private Long examId;
    /**
     * 报名id
     */
    @TableField("apply_id")
    private Long applyId;
    /**
     * 考生准考证号
     */
    @TableField("candidate_no")
    private String candidateNo;
}
src/main/java/org/springblade/modules/absentrecords/mapper/AbsentRecordsMapper.java
New file
@@ -0,0 +1,19 @@
package org.springblade.modules.absentrecords.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.absentrecords.entity.AbsentRecords;
import org.springblade.modules.accreditation.entity.AccreditationRecords;
import org.springblade.modules.accreditation.excel.ExportSecurityBookPaperExcel;
import org.springblade.modules.accreditation.vo.AccreditationRecordsVo;
import java.util.List;
/**
 * 缺考记录Mapper 接口
 * @author zhongrj
 */
public interface AbsentRecordsMapper extends BaseMapper<AbsentRecords> {
}
src/main/java/org/springblade/modules/absentrecords/mapper/AbsentRecordsMapper.xml
New file
@@ -0,0 +1,5 @@
<?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.absentrecords.mapper.AbsentRecordsMapper">
</mapper>
src/main/java/org/springblade/modules/absentrecords/service/AbsentRecordsService.java
New file
@@ -0,0 +1,14 @@
package org.springblade.modules.absentrecords.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.absentrecords.entity.AbsentRecords;
import java.util.List;
/**
 * 制证记录服务类
 * @author zhongrj
 */
public interface AbsentRecordsService extends IService<AbsentRecords> {
}
src/main/java/org/springblade/modules/absentrecords/service/AbsentRecordsServiceImpl.java
New file
@@ -0,0 +1,18 @@
package org.springblade.modules.absentrecords.service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springblade.modules.absentrecords.entity.AbsentRecords;
import org.springblade.modules.absentrecords.mapper.AbsentRecordsMapper;
import org.springframework.stereotype.Service;
/**
 * 缺考记录服务实现类
 * @author zhongrj
 */
@Service
@AllArgsConstructor
public class AbsentRecordsServiceImpl extends ServiceImpl<AbsentRecordsMapper, AbsentRecords> implements AbsentRecordsService {
}
src/main/java/org/springblade/modules/absentrecords/vo/AbsentRecordsVo.java
New file
@@ -0,0 +1,17 @@
package org.springblade.modules.absentrecords.vo;
import lombok.Data;
import org.springblade.modules.absentrecords.entity.AbsentRecords;
import org.springblade.modules.accreditation.entity.AccreditationRecords;
import java.io.Serializable;
/**
 * 缺考记录vo
 * @author zhongrj
 * @since 2021-11-18
 */
@Data
public class AbsentRecordsVo extends AbsentRecords implements Serializable {
}
src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
@@ -367,9 +367,9 @@
                                    0, // y缩放
                                    1023, //最大1023
                                    255, //最大255
                                    (short) i,  //宽度占几格 0开始
                                    (short) i,  //宽度 0开始
                                    0, //在第几行
                                    (short) i, //宽度占几格 0开始
                                    (short) i, //宽度 0开始
                                    0 //第几列
                                );
                        //插入图片
@@ -397,14 +397,16 @@
            }
            //判断余下的
            if (excelList.size()>0){
                rowNum++;
                rowNum = rowNum + 2;
                //写入表格
                writeBookForEach(excelList,rowNum,workBook,sheet,patriarch);
            }
        }
        //导出数据
        response.setContentType("application/vnd.ms-excel; charset=UTF-8");
        response.setHeader("Content-Disposition", "attachment;filename=" + "证书打印信息导出"+DateUtil.time() + ".xlsx");
        response.setContentType("application/vnd.ms-excel");
        response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
        String fileName = URLEncoder.encode("证书打印信息导出"+ DateUtil.time(), Charsets.UTF_8.name());
        response.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx");
        workBook.write(response.getOutputStream());
    }
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.java
@@ -53,4 +53,18 @@
     * 导出证书制证信息(包含照片)
     */
    List<AccreditationRecordsVo> exportSecurityBookPapers(@Param("accreditationRecords") AccreditationRecordsVo accreditationRecords);
    /**
     * 根据用户 id 查询上岗证申请记录
     * @param id 用户id
     * @return
     */
    int getAccreditationRecordsByUserIdCount(@Param("userId") String id);
    /**
     * 根据用户 id 查询当前人员是否有待审核和审核通过的记录数
     * @param id 用户id
     * @return
     */
    int getAccreditationRecordsByUserIdAuditCount(@Param("userId") String id);
}
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
@@ -45,8 +45,6 @@
        sj.id = si.jurisdiction
        WHERE
            1=1
        and bu.status = 1
        and bu.is_deleted = 0
        <if test="accreditationRecords.deptName!=null and  accreditationRecords.deptName!=''">
            and bt.dept_name like concat('%', #{accreditationRecords.deptName},'%')
        </if>
@@ -403,4 +401,15 @@
            and sar.create_time &lt;= #{accreditationRecords.endTime}
        </if>
    </select>
    <!--根据用户 id 查询上岗证申请记录-->
    <select id="getAccreditationRecordsByUserIdCount" resultType="java.lang.Integer">
        select count(*) from sys_accreditation_records where user_id = #{userId} and type = 1
    </select>
    <!--根据用户 id 查询当前人员是否有待审核和审核通过的记录数-->
    <select id="getAccreditationRecordsByUserIdAuditCount" resultType="java.lang.Integer">
        select count(*) from sys_accreditation_records where (audit_status = 1 or audit_status = 3) and user_id = #{userId} and type = 2
    </select>
</mapper>
src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java
@@ -61,19 +61,47 @@
            records.setAuditStatus(1);
            records.setType(accreditationRecords.getType());
            records.setUserId(Long.parseLong(id));
            //新增
            this.save(records);
            //判断类型,如果是上岗证则判断是否有申请,有申请的不在新增记录
            if (accreditationRecords.getType()==1){
                //查询当前人员是否有申请记录
                int count  = baseMapper.getAccreditationRecordsByUserIdCount(id);
                if (count<1){
                    //新增
                    this.save(records);
            //内网新增
            String s = "insert into sys_accreditation_records(id,user_id,create_time,create_user,status,type,audit_status) " +
                "values(" + "'" + records.getId() + "'" + ","
                + "'" + records.getUserId() + "'" + ","
                + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
                + "'" + records.getCreateUser() +"'" + ","
                + "'" + records.getStatus() +"'" + ","
                + "'" + records.getType() +"'" + ","
                +"'" + records.getAuditStatus() + "'" + ")";
            FtpUtil.sqlFileUpload(s);
                    //内网新增
                    String s = "insert into sys_accreditation_records(id,user_id,create_time,create_user,status,type,audit_status) " +
                        "values(" + "'" + records.getId() + "'" + ","
                        + "'" + records.getUserId() + "'" + ","
                        + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
                        + "'" + records.getCreateUser() +"'" + ","
                        + "'" + records.getStatus() +"'" + ","
                        + "'" + records.getType() +"'" + ","
                        +"'" + records.getAuditStatus() + "'" + ")";
                    FtpUtil.sqlFileUpload(s);
                }
            }
            //判断类型,如果是证书的,审核未通过的可以再次申请,审核通过的,暂时不给于新增记录
            if (accreditationRecords.getType()==2){
                //查询当前人员是否有待审核和审核通过的记录数
                int count  = baseMapper.getAccreditationRecordsByUserIdAuditCount(id);
                if (count<1){
                    //新增
                    this.save(records);
                    //内网新增
                    String s = "insert into sys_accreditation_records(id,user_id,create_time,create_user,status,type,audit_status) " +
                        "values(" + "'" + records.getId() + "'" + ","
                        + "'" + records.getUserId() + "'" + ","
                        + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
                        + "'" + records.getCreateUser() +"'" + ","
                        + "'" + records.getStatus() +"'" + ","
                        + "'" + records.getType() +"'" + ","
                        +"'" + records.getAuditStatus() + "'" + ")";
                    FtpUtil.sqlFileUpload(s);
                }
            }
        });
        return true;
    }
src/main/java/org/springblade/modules/crontab/Crontab.java
New file
@@ -0,0 +1,30 @@
package org.springblade.modules.crontab;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.service.TrainingRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
 * 定时任务
 * @author zhongrj
 * @since 2021-11-18
 */
@Component
public class Crontab {
    @Autowired
    private TrainingRegistrationService trainingRegistrationService;
    /**
     * 定时任务,每天凌晨1点执行一次,
     * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
     */
    @Scheduled(cron = "* * 1 * * ?")
//    @Scheduled(cron = "*/30 * * * * ?")
    public void examApplyStatus(){
        //自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
        trainingRegistrationService.examApplyStatus();
    }
}
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -804,12 +804,13 @@
    public void importSecurity(List<SecurityExcel> data, Boolean isCovered, String deptId) {
        //将不能导入的保安员账号存起来
        List<String> errorList = new ArrayList<>();
        //将需要新增的保安员信息存入集合
        List<User> insertList = new ArrayList<>();
        //年龄不符的保安员信息存入集合
        List<String> ageErrorList = new ArrayList<>();
        //将需要更新的保安员信息存入集合
        List<User> updateList = new ArrayList<>();
        //导入状态,默认为true ,如果有一个出现问题则为 false
        AtomicBoolean status = new AtomicBoolean(true);
        AtomicBoolean agetStatus = new AtomicBoolean(true);
        data.forEach(userExcel -> {
            User user = Objects.requireNonNull(BeanUtil.copy(userExcel, User.class));
            //设置部门id
@@ -847,37 +848,39 @@
                        user.setHold("2");
                    }
                }
                //分配保安角色
                Role role = new Role();
                role.setRoleAlias("保安");
                Role oneRole = roleService.getOne(Condition.getQueryWrapper(role));
                user.setRoleId(oneRole.getId().toString());
                //判断年龄,超过60岁的不入
                if (AgeUtil.idCardToAge(user.getCardid())<60) {
                    //分配保安角色
                    Role role = new Role();
                    role.setRoleAlias("保安");
                    Role oneRole = roleService.getOne(Condition.getQueryWrapper(role));
                    user.setRoleId(oneRole.getId().toString());
                //性别
                if (null != userExcel.getSex()) {
                    if (userExcel.getSex().equals("男")) {
                        user.setSex(1);
                    //性别
                    if (null != userExcel.getSex()) {
                        if (userExcel.getSex().equals("男")) {
                            user.setSex(1);
                        }
                        if (userExcel.getSex().equals("女")) {
                            user.setSex(2);
                        }
                    }
                    if (userExcel.getSex().equals("女")) {
                        user.setSex(2);
                    }
                }
                //设置账号
                user.setAccount(user.getCardid());
                //获取默认密码配置
                user.setPassword(user.getCardid().substring(user.getCardid().length() - 6));
                //加密
                if (Func.isNotEmpty(user.getPassword())) {
                    user.setPassword(DigestUtil.encrypt(user.getPassword()));
                }
                Integer userCount = baseMapper.selectCountAccount(user.getAccount());
                if (userCount > 0 && Func.isEmpty(user.getId())) {
                    throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
                }
                //新增
                this.save(user);
                //内网同步
                    //设置账号
                    user.setAccount(user.getCardid());
                    //获取默认密码配置
                    user.setPassword(user.getCardid().substring(user.getCardid().length() - 6));
                    //加密
                    if (Func.isNotEmpty(user.getPassword())) {
                        user.setPassword(DigestUtil.encrypt(user.getPassword()));
                    }
                    Integer userCount = baseMapper.selectCountAccount(user.getAccount());
                    if (userCount > 0 && Func.isEmpty(user.getId())) {
                        throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
                    }
                    //新增
                    this.save(user);
                    //内网同步
//                String s = "insert into blade_user(" +
//                    "id,tenant_id,account,password,real_name,phone,sex,role_id,dept_id," +
//                    "cardid,nation,registered,securitynumber,hold,status,is_deleted) " +
@@ -898,41 +901,45 @@
//                    "," + "'" + user.getStatus() + "'" +
//                    "," + "'" + user.getIsDeleted() + "'"
//                    + ")";
                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," +
                    "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() + "'" +
                    "," + "'" + user.getDeptId() + "'" +
                    "," + "'" + user.getCardid() + "'" +
                    "," + "'" + user.getNativeplace() + "'" +
                    "," + "'" + user.getNation() + "'" +
                    "," + "'" + user.getFingerprint() + "'" +
                    "," + "'" + user.getEducation() + "'" +
                    "," + "'" + user.getPoliticaloutlook() + "'" +
                    "," + "'" + user.getHealstats() + "'"+
                    "," + "'" + user.getHeight() + "'" +
                    "," + "'" + user.getAddress() + "'" +
                    "," + "'" + user.getRegistered() + "'" +
                    "," + "'" + user.getSecuritynumber() + "'" +
                    "," + "'" + user.getHold() + "'" +
                    "," + "'" + user.getJurisdiction() + "'" +
                    "," + "'" + user.getExaminationType() + "'" +
                    "," + "'" + user.getStatus() + "'" +
                    "," + "'" + user.getIsDeleted() + "'" +
                    "," + "'" + user.getDispatch() + "'" + ")";
                FtpUtil.sqlFileUpload(s);
                    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," +
                        "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() + "'" +
                        "," + "'" + user.getDeptId() + "'" +
                        "," + "'" + user.getCardid() + "'" +
                        "," + "'" + user.getNativeplace() + "'" +
                        "," + "'" + user.getNation() + "'" +
                        "," + "'" + user.getFingerprint() + "'" +
                        "," + "'" + user.getEducation() + "'" +
                        "," + "'" + user.getPoliticaloutlook() + "'" +
                        "," + "'" + user.getHealstats() + "'" +
                        "," + "'" + user.getHeight() + "'" +
                        "," + "'" + user.getAddress() + "'" +
                        "," + "'" + user.getRegistered() + "'" +
                        "," + "'" + user.getSecuritynumber() + "'" +
                        "," + "'" + user.getHold() + "'" +
                        "," + "'" + user.getJurisdiction() + "'" +
                        "," + "'" + user.getExaminationType() + "'" +
                        "," + "'" + user.getStatus() + "'" +
                        "," + "'" + user.getIsDeleted() + "'" +
                        "," + "'" + user.getDispatch() + "'" + ")";
                    FtpUtil.sqlFileUpload(s);
                }else {
                    agetStatus.set(false);
                    ageErrorList.add(user.getCardid());
                }
            }else {
                //匹配组织机构是否一致,如果不一致
                if(!user2.getDeptId().equals(user.getDeptId())){
@@ -972,9 +979,21 @@
            }
        });
        //如果所有数据导入有一个异常
        if (!status.get()){
            String errorAccount = StringUtils.join(errorList, "\\\n");
            throw new ServiceException("用户:["+errorAccount+"]导入失败!已在其他单位存在!");
        if (!status.get() || !agetStatus.get()){
            if (!status.get() && agetStatus.get()) {
                String errorAccount = StringUtils.join(errorList, "\\\n");
                throw new ServiceException("用户:[" + errorAccount + "]导入失败!已在其他单位存在!");
            }
            if (!agetStatus.get() && status.get()) {
                String errorAccount = StringUtils.join(ageErrorList, "\\\n");
                throw new ServiceException("用户:[" + errorAccount + "]导入失败!年龄不符!");
            }
            if (!status.get() && !agetStatus.get()) {
                String errorAccount = StringUtils.join(errorList, "\\\n");
                String errorAgeAccount = StringUtils.join(ageErrorList, "\\\n");
                throw new ServiceException("用户:[" + errorAccount + "]导入失败!已在其他单位存在!"+
                    "用户:[" + errorAgeAccount + "]导入失败!年龄不符!");
            }
        }
    }
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.absentrecords.entity.AbsentRecords;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.vo.TrainingRegistrationVo;
@@ -58,4 +59,12 @@
     * @return
     */
    List<TrainingRegistration> getTrainIds(@Param("trainingRegistration") TrainingRegistrationVo trainingRegistration);
    /**
     * 查询考试申请审核通过,已报名,未考试的人员
     * @param trainingRegistration
     * @return
     */
    List<TrainingRegistration> selectTrainingRegistrationList(@Param("trainingRegistration") TrainingRegistration trainingRegistration);
}
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml
@@ -34,7 +34,7 @@
            1=1
        and bu.status = 1
        and bu.is_deleted = 0
        <if test="trainingRegistration.isExam!=null">
        <if test="trainingRegistration.isExam!=null and trainingRegistration.isExam!=0">
            and is_exam = #{trainingRegistration.isExam}
        </if>
        <if test="trainingRegistration.trainingUnitId!=null and  trainingRegistration.trainingUnitId!=''">
@@ -209,4 +209,41 @@
        </if>
        limit #{trainingRegistration.serialStart},#{trainingRegistration.serialEnd}
    </select>
    <!--报名培训分页信息-->
    <select id="selectTrainingRegistrationList" resultType="org.springblade.modules.training.entity.TrainingRegistration">
        SELECT
        sr.*
        FROM
        sys_training_registration sr
        LEFT JOIN
        blade_dept bt0
        ON
        sr.training_unit_id = bt0.id
        left join
        blade_user bu
        on
        sr.user_id = bu.id
        LEFT JOIN
        blade_dept bt
        ON
        bu.dept_id = bt.id
        left join
        ksxt_exam ke
        on
        ke.id = sr.train_exam_id
        WHERE
        1=1
        and bu.status = 1
        and bu.is_deleted = 0
        <if test="trainingRegistration.isExam!=null">
            and is_exam = #{trainingRegistration.isExam}
        </if>
        <if test="trainingRegistration.auditStatus!=null and trainingRegistration.auditStatus!=0">
            and sr.audit_status = #{trainingRegistration.auditStatus}
        </if>
        <if test="trainingRegistration.cancel!=null">
            and sr.cancel = #{trainingRegistration.cancel}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/training/service/TrainingRegistrationService.java
@@ -62,4 +62,9 @@
     * @return
     */
    List<TrainingRegistration> getTrainIds(TrainingRegistrationVo trainingRegistrationVo);
    /**
     * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
     */
    void examApplyStatus();
}
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
@@ -9,6 +9,8 @@
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.modules.FTP.FtpUtil;
import org.springblade.modules.absentrecords.entity.AbsentRecords;
import org.springblade.modules.absentrecords.service.AbsentRecordsService;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.exam.entity.ExamPaper;
@@ -45,6 +47,8 @@
    private final IUserDeptService userDeptService;
    private final ExamPaperService examPaperService;
    private final AbsentRecordsService absentRecordsService;
    @Override
@@ -313,4 +317,66 @@
        trainingRegistrationVo.setSerialEnd(trainingRegistrationVo.getSerialEnd() -trainingRegistrationVo.getSerialStart());
        return baseMapper.getTrainIds(trainingRegistrationVo);
    }
    /**
     * 自动处理之前报了名,申请了考试又没有去考试的,做缺考标记,并将报名状态修改为已取消报名
     */
    @Override
    public void examApplyStatus() {
        //封装条件
        TrainingRegistration trainingRegistration = new TrainingRegistration();
        trainingRegistration.setCancel(1);
        trainingRegistration.setAuditStatus(1);
        trainingRegistration.setIsExam(1);
        //查询考试申请审核通过,已报名,未考试的人员
        List<TrainingRegistration> trainingRegistrationList = baseMapper.selectTrainingRegistrationList(trainingRegistration);
        if (trainingRegistrationList.size()>0) {
            trainingRegistrationList.forEach(trainingRegistration1 -> {
                //判断时间
                //查询考试信息
                ExamPaper paper = examPaperService.getById(trainingRegistration1.getTrainExamId());
                if (null!=paper) {
                    //比对考试结束时间
                    Date now = new Date();
                    Date exanEndTime = paper.getEndTime();
                    //考试截止时间小于当前时间,说明已过考试时间
                    if (exanEndTime.before(now)) {
                        //修改报名状态
                        trainingRegistration1.setCancel(2);
                        //缺考标记
                        trainingRegistration1.setIsExam(4);
                        this.updateById(trainingRegistration1);
                        //修改保安报名状态
                        User user = userService.getById(trainingRegistration1.getUserId());
                        user.setIsTrain(2);
                        userService.updateById(user);
                        //生成缺考记录
                        AbsentRecords absentRecords = new AbsentRecords();
                        absentRecords.setUserId(user.getId());
                        absentRecords.setApplyId(trainingRegistration1.getId());
                        absentRecords.setExamId(Long.parseLong(trainingRegistration1.getTrainExamId()));
                        absentRecords.setCandidateNo(trainingRegistration1.getCandidateNo());
                        absentRecords.setCreateTime(new Date());
                        //新增
                        absentRecordsService.save(absentRecords);
                        //内网同步
                        String s =
                            "update sys_training_registration set cancel = " + trainingRegistration1.getCancel() +
                                ",is_exam = " + "'" + trainingRegistration1.getIsExam() + "'" +
                                " " + "where id = " + "'" + trainingRegistration1.getId() + "';" +
                                "update blade_user set is_train = " + user.getIsTrain() + " " + "where id = " + "'" + user.getId() + "';" +
                                "insert into sys_absent_records(id,user_id,create_time,exam_id,apply_id,candidate_no) " +
                                "values(" + "'" + absentRecords.getId() + "'" + ","
                                + "'" + absentRecords.getUserId() + "'" + ","
                                + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(absentRecords.getCreateTime()) + "'" + ","
                                + "'" + absentRecords.getExamId() + "'" + ","
                                + "'" + absentRecords.getApplyId() + "'" + ","
                                + "'" + absentRecords.getCandidateNo() + "'" + ")";
                        FtpUtil.sqlFileUpload(s);
                    }
                }
            });
        }
    }
}