智慧保安后台管理-外网
Administrator
2021-11-03 d724b0c1a42f564845254f1da7c456aedaeb9fdd
1.新增制证申请
2.新增保安员证信息导出(包含图片,二维码)
1 files renamed
7 files modified
7 files added
809 ■■■■ changed files
src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java 159 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java 69 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/excel/ExportSecurityPaperExcel.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.java 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml 124 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/service/AccreditationRecordsService.java 44 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java 138 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java 73 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/ExamScoreService.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserController.java 27 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 51 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/IUserService.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 59 ●●●●● patch | view | raw | blame | history
src/main/resources/application.yml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
New file
@@ -0,0 +1,159 @@
package org.springblade.modules.accreditation.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.accreditation.excel.ExportSecurityPaperExcel;
import org.springblade.modules.system.service.IUserService;
import org.springblade.modules.accreditation.entity.AccreditationRecords;
import org.springblade.modules.accreditation.service.AccreditationRecordsService;
import org.springblade.modules.accreditation.vo.AccreditationRecordsVo;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.*;
/**
 * @author zhongrj
 * @time 2021-11-3
 * @desc 制证记录控制层
 */
@RestController
@AllArgsConstructor
@RequestMapping("/accreditationRecords")
public class AccreditationRecordsController {
    private final AccreditationRecordsService accreditationRecordsService;
    private final IUserService userService;
    /**
     * 自定义分页
     * @param query page,size
     * @param accreditationRecords 制证记录信息对象
     */
    @GetMapping("/page")
    public R<IPage<AccreditationRecordsVo>> page(AccreditationRecordsVo accreditationRecords, Query query) {
        IPage<AccreditationRecordsVo> pages = accreditationRecordsService.selectAccreditationRecordsPage(Condition.getPage(query), accreditationRecords);
        return R.data(pages);
    }
    /**
     * 新增
     * @param accreditationRecords 制证记录信息对象
     */
    @PostMapping("/save")
    @ApiOperation(value = "新增", notes = "传入accreditationRecords")
    public R save(@RequestBody AccreditationRecords accreditationRecords){
        return R.data(accreditationRecordsService.save(accreditationRecords));
    }
    /**
     * 制证申请(批量)
     * @param accreditationRecords 制证记录信息对象
     */
    @PostMapping("/securityApply")
    @ApiOperation(value = "新增", notes = "传入accreditationRecords")
    public R securityApply(@RequestBody AccreditationRecordsVo accreditationRecords){
        return R.data(accreditationRecordsService.securityApply(accreditationRecords));
    }
    /**
     * 修改
     * @param accreditationRecords 制证记录信息对象
     */
    @PostMapping("/update")
    public R update(@RequestBody AccreditationRecords accreditationRecords){
        return R.status(accreditationRecordsService.updateById(accreditationRecords));
    }
    /**
     * 新增或修改
     * @param accreditationRecords 制证记录信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody AccreditationRecords accreditationRecords){
        return R.data(accreditationRecordsService.saveOrUpdate(accreditationRecords));
    }
    /**
     * 删除
     * @param ids 制证记录信息ids 数组
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        return R.status(accreditationRecordsService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 详情
     * @param accreditationRecords 制证记录信息对象
     */
    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "传入accreditationRecords")
    public R<AccreditationRecords> detail(AccreditationRecords accreditationRecords) {
        AccreditationRecords detail = accreditationRecordsService.getOne(Condition.getQueryWrapper(accreditationRecords));
        return R.data(detail);
    }
    /**
     * 详情
     * @param accreditationRecords 制证记录信息对象
     */
    @GetMapping("/details")
    @ApiOperation(value = "详情", notes = "传入accreditationRecords")
    public R<AccreditationRecordsVo> details(AccreditationRecords accreditationRecords) {
        AccreditationRecordsVo detail = accreditationRecordsService.getAccreditationRecordsDetails(accreditationRecords);
        return R.data(detail);
    }
    /**
     * 导出保安员证信息
     */
    @GetMapping("export-security-paper")
    public void exportSecurityPaper(AccreditationRecordsVo accreditationRecords, HttpServletResponse response) throws IOException {
        //按条件查询成绩数据
        List<ExportSecurityPaperExcel> excels = accreditationRecordsService.exportSecurityPaperList(accreditationRecords);
        String fileName = null;
        try {
            response.setContentType("application/vnd.ms-excel");
            response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
            fileName = URLEncoder.encode("保安员证数据"+ DateUtil.time(), Charsets.UTF_8.name());
            response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
            //修改单元格格式为文本格式
            EasyExcel.write(response.getOutputStream(), ExportSecurityPaperExcel.class)
                .sheet("保安员证数据表")
                //自定义行高
//                .registerWriteHandler(new CustomCellWriteHeightConfig())
                //自定义宽度
//                .registerWriteHandler(new CustomCellWriteWeightConfig())
                //写入
                .doWrite(excels);
        } catch (Throwable var6) {
            throw var6;
        }
//        ExcelUtil.export(response, "保安员证数据" + DateUtil.time(), "保安员证数据表", excels, ExportSecurityPaperExcel.class);
    }
}
src/main/java/org/springblade/modules/accreditation/entity/AccreditationRecords.java
New file
@@ -0,0 +1,69 @@
package org.springblade.modules.accreditation.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-3
 */
@Data
@TableName("sys_accreditation_records")
public class AccreditationRecords 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;
    /**
     * 制证人 组织机构id
     */
//    @TableField("dept_id")
//    private Long deptId;
    /**
     * 申请时间
     */
    @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("create_user")
    private String createUser;
    /**
     * 状态 1:未制证  2:已制证
     */
    private Integer status;
    /**
     * 制证时间
     */
    @TableField("accreditation_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date accreditationTime;
}
src/main/java/org/springblade/modules/accreditation/excel/ExportSecurityPaperExcel.java
File was renamed from src/main/java/org/springblade/modules/system/excel/ExportSecurityPaperExcel.java
@@ -14,7 +14,7 @@
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.excel;
package org.springblade.modules.accreditation.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.java
New file
@@ -0,0 +1,43 @@
package org.springblade.modules.accreditation.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.apply.excel.ApplyInfoExcel;
import org.springblade.modules.accreditation.entity.AccreditationRecords;
import org.springblade.modules.accreditation.vo.AccreditationRecordsVo;
import org.springblade.modules.system.vo.UserVO;
import java.util.List;
/**
 * 制证记录Mapper 接口
 * @author zhongrj
 */
public interface AccreditationRecordsMapper extends BaseMapper<AccreditationRecords> {
    /**
     * 自定义分页
     *
     * @param page   分页
     * @param recruitment 实体
     * @return
     */
    List<AccreditationRecordsVo> selectAccreditationRecordsPage(IPage page, @Param("accreditationRecords") AccreditationRecordsVo recruitment);
    /**
     * 自定义详情信息
     * @param accreditationRecords
     * @return
     */
    AccreditationRecordsVo getAccreditationRecordsDetails(@Param("accreditationRecords") AccreditationRecords accreditationRecords);
    /**
     * 导出保安员证信息
     * @param accreditationRecords
     * @return
     */
    List<AccreditationRecordsVo> exportSecurityPaperList(@Param("accreditationRecords") AccreditationRecordsVo accreditationRecords);
}
src/main/java/org/springblade/modules/accreditation/mapper/AccreditationRecordsMapper.xml
New file
@@ -0,0 +1,124 @@
<?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.accreditation.mapper.AccreditationRecordsMapper">
    <!--制证申请分页信息-->
    <select id="selectAccreditationRecordsPage" resultType="org.springblade.modules.accreditation.vo.AccreditationRecordsVo">
        SELECT
            sar.*,
            bt.dept_name AS deptName,
            bu.real_name realName,
            bu.sex,bu.cardid idCardNo,
            bu.securitynumber securityNumber,
            ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age
        FROM
            sys_accreditation_records sar
        left join
            blade_user bu
        on
            sar.user_id = bu.id
        LEFT JOIN
            blade_dept bt
        ON
            bu.dept_id = bt.id
        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>
        <if test="accreditationRecords.realName!=null and  accreditationRecords.realName!=''">
            and bu.real_name like concat('%', #{accreditationRecords.realName},'%')
        </if>
        <if test="accreditationRecords.idCardNo!=null and  accreditationRecords.idCardNo!=''">
            and bu.cardid like concat('%', #{accreditationRecords.idCardNo},'%')
        </if>
        <if test="accreditationRecords.securityNumber!=null and  accreditationRecords.securityNumber!=''">
            and bu.securitynumber like concat('%', #{accreditationRecords.securityNumber},'%')
        </if>
        <if test="accreditationRecords.status!=null">
            and sar.status = #{accreditationRecords.status}
        </if>
        <if test="accreditationRecords.startTime!=null and accreditationRecords.startTime!='' and accreditationRecords.startTime!='undefined'">
            and sar.create_time &gt;= #{accreditationRecords.startTime}
        </if>
        <if test="accreditationRecords.endTime!=null and accreditationRecords.endTime!='' and accreditationRecords.endTime!='undefined'">
            and sar.create_time &lt;= #{accreditationRecords.endTime}
        </if>
        order by sar.create_time desc
    </select>
    <!--自定义详情信息-->
    <select id="getAccreditationRecordsDetails" resultType="org.springblade.modules.accreditation.vo.AccreditationRecordsVo">
        SELECT
        sar.*,
        bt.dept_name AS deptName,
        bu.real_name realName,
        bu.sex,bu.cardid idCardNo,
        bu.securitynumber securityNumber,
        ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age
        FROM
        sys_accreditation_records sar
        left join
        blade_user bu
        on
        sar.user_id = bu.id
        LEFT JOIN
        blade_dept bt
        ON
        bu.dept_id = bt.id
        WHERE
        1=1
        and sar.id =#{accreditationRecords.id}
    </select>
    <!--导出保安员证信息-->
    <select id="exportSecurityPaperList" resultType="org.springblade.modules.accreditation.vo.AccreditationRecordsVo">
        SELECT
        sar.*,
        bt.dept_name AS deptName,
        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
        left join
        blade_user bu
        on
        sar.user_id = bu.id
        LEFT JOIN
        blade_dept bt
        ON
        bu.dept_id = bt.id
        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>
        <if test="accreditationRecords.realName!=null and  accreditationRecords.realName!=''">
            and bu.real_name like concat('%', #{accreditationRecords.realName},'%')
        </if>
        <if test="accreditationRecords.idCardNo!=null and  accreditationRecords.idCardNo!=''">
            and bu.cardid like concat('%', #{accreditationRecords.idCardNo},'%')
        </if>
        <if test="accreditationRecords.securityNumber!=null and  accreditationRecords.securityNumber!=''">
            and bu.securitynumber like concat('%', #{accreditationRecords.securityNumber},'%')
        </if>
        <if test="accreditationRecords.status!=null">
            and sar.status = #{accreditationRecords.status}
        </if>
        <if test="accreditationRecords.startTime!=null and accreditationRecords.startTime!='' and accreditationRecords.startTime!='undefined'">
            and sar.create_time &gt;= #{accreditationRecords.startTime}
        </if>
        <if test="accreditationRecords.endTime!=null and accreditationRecords.endTime!='' and accreditationRecords.endTime!='undefined'">
            and sar.create_time &lt;= #{accreditationRecords.endTime}
        </if>
        order by sar.create_time desc
    </select>
</mapper>
src/main/java/org/springblade/modules/accreditation/service/AccreditationRecordsService.java
New file
@@ -0,0 +1,44 @@
package org.springblade.modules.accreditation.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.accreditation.entity.AccreditationRecords;
import org.springblade.modules.accreditation.vo.AccreditationRecordsVo;
import org.springblade.modules.accreditation.excel.ExportSecurityPaperExcel;
import java.util.List;
/**
 * 制证记录服务类
 * @author zhongrj
 */
public interface AccreditationRecordsService extends IService<AccreditationRecords> {
    /**
     * 自定义分页
     * @param page
     * @param accreditationRecords
     * @return
     */
    IPage<AccreditationRecordsVo> selectAccreditationRecordsPage(IPage<AccreditationRecordsVo> page, AccreditationRecordsVo accreditationRecords);
    /**
     * 制证申请(批量)
     * @param accreditationRecords 制证记录信息对象
     */
    boolean securityApply(AccreditationRecordsVo accreditationRecords);
    /**
     * 自定义详情信息
     * @param accreditationRecords
     * @return
     */
    AccreditationRecordsVo getAccreditationRecordsDetails(AccreditationRecords accreditationRecords);
    /**
     * 导出保安员证信息
     * @param accreditationRecords
     * @return
     */
    List<ExportSecurityPaperExcel> exportSecurityPaperList(AccreditationRecordsVo accreditationRecords);
}
src/main/java/org/springblade/modules/accreditation/service/impl/AccreditationRecordsServiceImpl.java
New file
@@ -0,0 +1,138 @@
package org.springblade.modules.accreditation.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.accreditation.entity.AccreditationRecords;
import org.springblade.modules.accreditation.mapper.AccreditationRecordsMapper;
import org.springblade.modules.accreditation.service.AccreditationRecordsService;
import org.springblade.modules.accreditation.vo.AccreditationRecordsVo;
import org.springframework.stereotype.Service;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
 * 制证记录服务实现类
 * @author zhongrj
 */
@Service
@AllArgsConstructor
public class AccreditationRecordsServiceImpl extends ServiceImpl<AccreditationRecordsMapper, AccreditationRecords> implements AccreditationRecordsService {
    /**
     * 自定义分页
     * @param page
     * @param accreditationRecords
     * @return
     */
    @Override
    public IPage<AccreditationRecordsVo> selectAccreditationRecordsPage(IPage<AccreditationRecordsVo> page, AccreditationRecordsVo accreditationRecords) {
        List<AccreditationRecordsVo> accreditationRecordsVos = baseMapper.selectAccreditationRecordsPage(page, accreditationRecords);
        return page.setRecords(accreditationRecordsVos);
    }
    /**
     * 制证申请(批量)
     * @param accreditationRecords 制证记录信息对象
     */
    @Override
    public boolean securityApply(AccreditationRecordsVo accreditationRecords) {
        //读取ids
        List<String> list = Arrays.asList(accreditationRecords.getIds().split(","));
        //遍历
        list.forEach(id->{
            AccreditationRecords records = new AccreditationRecords();
            records.setCreateTime(new Date());
            records.setCreateUser(accreditationRecords.getCreateUser());
            records.setStatus(1);
            records.setUserId(Long.parseLong(id));
            //新增
            this.save(records);
            //内网新增
            String s = "insert into sys_apply(id,user_id,create_time,create_user,status) " +
                "values(" + "'" + records.getId() + "'" + ","
                + "'" + records.getUserId() + "'" + ","
                + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(records.getCreateTime()) + "'" + ","
                + "'" + records.getCreateUser() +"'" + ","
                +"'" + records.getStatus() + "'" + ")";
            FtpUtil.sqlFileUpload(s);
        });
        return true;
    }
    /**
     * 自定义详情信息
     * @param accreditationRecords
     * @return
     */
    @Override
    public AccreditationRecordsVo getAccreditationRecordsDetails(AccreditationRecords accreditationRecords) {
        return baseMapper.getAccreditationRecordsDetails(accreditationRecords);
    }
    /**
     * 导出保安员证信息
     * @param accreditationRecords
     * @return
     */
    @Override
    public List<ExportSecurityPaperExcel> exportSecurityPaperList(AccreditationRecordsVo accreditationRecords) {
        //查询数据
        List<AccreditationRecordsVo> accreditationRecordsVos = baseMapper.exportSecurityPaperList(accreditationRecords);
        if (accreditationRecordsVos.size()>0) {
            //返回的集合数据
            List<ExportSecurityPaperExcel> list = new ArrayList<>();
            //遍历
            accreditationRecordsVos.forEach(accreditationRecordsVo -> {
                ExportSecurityPaperExcel excel = new ExportSecurityPaperExcel();
                //数据转换封装
                excel.setRealName(accreditationRecordsVo.getRealName());
                excel.setIdCardNo(accreditationRecordsVo.getIdCardNo());
                excel.setDeptName(accreditationRecordsVo.getDeptName());
                //如果头像有
                if (null != accreditationRecordsVo.getAvatar() && accreditationRecordsVo.getAvatar() != "") {
                    try {
                        if (accreditationRecordsVo.getAvatar().contains("http:")) {
                            excel.setAvatar(new URL(accreditationRecordsVo.getAvatar()));
                        }
                    } catch (MalformedURLException e) {
                        e.printStackTrace();
                    }
                }
                //如果保安证编号不为空
                if (null != accreditationRecordsVo.getSecurityNumber() && accreditationRecordsVo.getSecurityNumber() != "") {
                    //去生成二维码
                    String url = "http://223.82.109.183:2080/securityInfo.html";
                    String encoded = null;
                    try {
                        encoded = URLEncoder.encode(accreditationRecordsVo.getSecurityNumber(), "UTF-8");
                        String content = url + "?securityNumber=" + encoded;
                        URLEncoder.encode(content, "utf-8");
                        byte[] qrCodeImage = QRCodeUtil.getQRCodeImage(content, 350, 350);
                        //设置二维码
                        excel.setQrCode(qrCodeImage);
                        excel.setSecurityNumber(accreditationRecordsVo.getSecurityNumber());
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                list.add(excel);
            });
            return list;
        }
        return null;
    }
}
src/main/java/org/springblade/modules/accreditation/vo/AccreditationRecordsVo.java
New file
@@ -0,0 +1,73 @@
package org.springblade.modules.accreditation.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.modules.accreditation.entity.AccreditationRecords;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 制证记录vo
 * @author zhongrj
 * @since 2021-11-2
 */
@Data
public class AccreditationRecordsVo extends AccreditationRecords implements Serializable {
    /**
     * 制证人员姓名
     */
    private String realName;
    /**
     * 制证人员组织机构名称
     */
    private String deptName;
    /**
     * 性别
     */
    private String sex;
    /**
     * 制证人员身份证号
     */
    private String idCardNo;
    /**
     * 头像
     */
    private String avatar;
    /**
     * 保安证二维码
     */
    private String qrCode;
    /**
     * 保安证编号
     */
    private String securityNumber;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 申请ids
     */
    private String ids;
    /**
     *开始时间
     */
    private String startTime;
    /**
     * 结束时间
     */
    private String endTime;
}
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
@@ -1,7 +1,6 @@
package org.springblade.modules.exam.controller;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
@@ -9,7 +8,6 @@
import lombok.AllArgsConstructor;
import org.apache.commons.codec.Charsets;
import org.springblade.common.excel.RowWriteHandler;
import org.springblade.common.utils.arg;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
@@ -26,10 +24,7 @@
import org.springblade.modules.exam.util.SecurityPaperUtil;
import org.springblade.modules.exam.vo.ExamScoreVO;
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.ExportSecurityPaperExcel;
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;
@@ -39,7 +34,6 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.sql.Array;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
src/main/java/org/springblade/modules/exam/service/ExamScoreService.java
@@ -7,7 +7,6 @@
import org.springblade.modules.exam.excel.ExportExamScoreExcel;
import org.springblade.modules.exam.vo.ExamScoreVO;
import org.springblade.modules.exam.vo.UpdateParamVo;
import org.springblade.modules.system.excel.ExportSecurityPaperExcel;
import java.util.List;
import java.util.Map;
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -415,33 +415,6 @@
//        ExcelUtil.export(response, "用户数据" + DateUtil.time(), "用户数据表", list, UserExcel.class);
//    }
    /**
     * 导出保安员证信息
     */
    @GetMapping("export-security-paper")
    public void exportSecurityPaper(UserVO user, HttpServletResponse response) throws IOException {
        //按条件查询成绩数据
        List<ExportSecurityPaperExcel> excels = userService.exportSecurityPaperList(user);
        String fileName = null;
        try {
            response.setContentType("application/vnd.ms-excel");
            response.setCharacterEncoding(org.apache.commons.codec.Charsets.UTF_8.name());
            fileName = URLEncoder.encode("保安员证数据", Charsets.UTF_8.name());
            response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
            //修改单元格格式为文本格式
            EasyExcel.write(response.getOutputStream(), ExportSecurityPaperExcel.class)
                .sheet("保安员证数据表")
                //自定义行高
//                .registerWriteHandler(new CustomCellWriteHeightConfig())
                //自定义宽度
//                .registerWriteHandler(new CustomCellWriteWeightConfig())
                //写入
                .doWrite(excels);
        } catch (Throwable var6) {
            throw var6;
        }
//        ExcelUtil.export(response, "保安员证数据" + DateUtil.time(), "保安员证数据表", excels, ExportSecurityPaperExcel.class);
    }
    /**
     * 导出模板
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -577,55 +577,4 @@
    </select>
    <!--导出保安员证信息-->
    <select id="exportSecurityPaperList" resultType="org.springblade.modules.system.vo.UserVO">
        select
        bu.*,bd.dept_name deptName
        from
        blade_user bu
        left join
        blade_dept bd
        on
        bu.dept_id = bd.id
        left join
        blade_role br
        on
        br.id = bu.role_id
        where
        bu.is_deleted = 0
        and role_alias = '保安'
        <if test="user.realName!=null and user.realName != ''">
            and bu.real_name like concat(concat('%', #{user.realName}),'%')
        </if>
        <if test="user.userType!=null and user.userType != ''">
            and bu.user_type = #{user.userType}
        </if>
        <if test="user.nativeplace!=null and user.nativeplace != ''">
            and bu.nativeplace = #{user.nativeplace}
        </if>
        <if test="user.deptId!=null and user.deptId != ''">
            and bu.dept_id = #{user.deptId}
        </if>
        <if test="user.sex!=null and user.sex != ''">
            and bu.sex = #{user.sex}
        </if>
        <if test="user.dispatch!=null and user.dispatch != ''">
            <if test="user.dispatch==1">
                and (bu.dispatch = #{user.dispatch} or bu.dispatch is null)
            </if>
            <if test="user.dispatch==0">
                and bu.dispatch = #{user.dispatch}
            </if>
        </if>
        <if test="user.status!=null and user.status != ''">
            and bu.status = #{user.status}
        </if>
        <if test="user.jurisdiction!=null and user.jurisdiction != ''">
            and bu.jurisdiction = #{user.jurisdiction}
        </if>
        <if test="user.securitynumber!=null and user.securitynumber != ''">
            and bu.securitynumber = #{user.securitynumber}
        </if>
        ORDER BY bu.id
    </select>
</mapper>
src/main/java/org/springblade/modules/system/service/IUserService.java
@@ -17,22 +17,17 @@
package org.springblade.modules.system.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
import org.springblade.modules.auth.enums.UserEnum;
import org.springblade.modules.exam.vo.ExamScoreVO;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.entity.UserInfo;
import org.springblade.modules.system.entity.UserOauth;
import org.springblade.modules.system.excel.ExportSecurityPaperExcel;
import org.springblade.modules.system.excel.QrCodeExcel;
import org.springblade.modules.system.excel.UserExcel;
import org.springblade.modules.system.node.TreeNode;
import org.springblade.modules.system.vo.UserVO;
import org.springblade.modules.zc.entity.Zc;
import java.util.List;
import java.util.Map;
@@ -326,10 +321,5 @@
     */
    void importQrCode(List<QrCodeExcel> data, Boolean isCovered, String deptId);
    /**
     * 导出保安员证信息
     * @param user
     * @return
     */
    List<ExportSecurityPaperExcel> exportSecurityPaperList(UserVO user);
}
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -44,7 +44,6 @@
import org.springblade.modules.information.entity.Information;
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.system.entity.*;
import org.springblade.modules.system.excel.ExportSecurityPaperExcel;
import org.springblade.modules.system.excel.QrCodeExcel;
import org.springblade.modules.system.excel.UserExcel;
import org.springblade.modules.system.mapper.UserMapper;
@@ -52,10 +51,6 @@
import org.springblade.modules.system.service.*;
import org.springblade.modules.system.vo.UserVO;
import org.springblade.modules.system.wrapper.UserWrapper;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -63,8 +58,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -892,55 +885,5 @@
    }
    /**
     * 导出保安员证信息
     * @param user
     * @return
     */
    @Override
    public List<ExportSecurityPaperExcel> exportSecurityPaperList(UserVO user) {
        //查询数据
        List<UserVO> userVOList = baseMapper.exportSecurityPaperList(user);
        if (userVOList.size()>0) {
            //返回的集合数据
            List<ExportSecurityPaperExcel> list = new ArrayList<>();
            //遍历
            userVOList.forEach(userVO -> {
                ExportSecurityPaperExcel excel = new ExportSecurityPaperExcel();
                //数据转换封装
                excel.setRealName(userVO.getRealName());
                excel.setIdCardNo(userVO.getCardid());
                excel.setDeptName(userVO.getDeptName());
                //如果头像有
                if (null != userVO.getAvatar() && userVO.getAvatar() != "") {
                    try {
                        if (userVO.getAvatar().contains("http:")) {
                            excel.setAvatar(new URL(userVO.getAvatar()));
                        }
                    } catch (MalformedURLException e) {
                        e.printStackTrace();
                    }
                }
                //如果保安证编号不为空
                if (null != userVO.getSecuritynumber() && userVO.getSecuritynumber() != "") {
                    //去生成二维码
                    String url = "http://223.82.109.183:2080/securityInfo.html";
                    String encoded = null;
                    try {
                        encoded = URLEncoder.encode(userVO.getSecuritynumber(), "UTF-8");
                        String content = url + "?securityNumber=" + encoded;
                        URLEncoder.encode(content, "utf-8");
                        byte[] qrCodeImage = QRCodeUtil.getQRCodeImage(content, 350, 350);
                        //设置二维码
                        excel.setQrCode(qrCodeImage);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                list.add(excel);
            });
            return list;
        }
        return null;
    }
}
src/main/resources/application.yml
@@ -214,6 +214,7 @@
      - /liveLocation/**
      - /qrCode/**
      - /blade-resource/attach/detail
      - /accreditationRecords/export-security-paper
    #授权认证配置