智慧保安后台管理-外网项目备份
Administrator
2021-11-23 d4ad4cd6c127aa5944685c4aa098e0015139e1a4
1.保安公司查询修改
2.报名列表修改
3.考试列表查询修改
4.保安员导入修改
12 files modified
241 ■■■■■ changed files
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml 24 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml 43 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java 24 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java 57 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/controller/UserController.java 30 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java 18 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java
@@ -125,4 +125,11 @@
     * @param list
     */
    void insertBatch(@Param("list")List<ExamExaminationSubject> list);
    /**
     * 查询报名人数
     * @param examPaperVO1
     * @return
     */
    Integer getExamNumber(@Param("examPaper") ExamPaperVO examPaperVO1);
}
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -257,10 +257,14 @@
    <!--查询当前考试的报名人员数量,模拟考试-->
    <select id="getTrainNumber" resultType="java.lang.Integer">
        select count(*) from sys_training_registration
        select count(*) from sys_training_registration str
        left join
            blade_user bu
        on
            bu.id = str.user_id
        where
        train_exam_id = #{examPaper.id}
        and cancel = 1
            bu.is_deleted = 0 and bu.status = 1
        and train_exam_id = #{examPaper.id}
    </select>
    <!--根据用户id查询报名信息-->
@@ -324,4 +328,18 @@
        </foreach>
    </insert>
    <!--查询当前考试的报名人员数量,模拟考试-->
    <select id="getExamNumber" resultType="java.lang.Integer">
        select count(*) from sys_training_registration str
        left join
            blade_user bu
        on
            bu.id = str.user_id
        where
            bu.is_deleted = 0 and bu.status = 1
        and train_exam_id = #{examPaper.id}
        and (is_exam = 2 or is_exam = 3)
        and cancel = 1
    </select>
</mapper>
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java
@@ -80,6 +80,7 @@
            //模拟考试
            if (examPaperVO1.getExamType()==2) {
                examPaperVO1.setNum(baseMapper.getTrainNumber(examPaperVO1));
                examPaperVO1.setExamNum(baseMapper.getExamNumber(examPaperVO1));
            }
        });
        return examPaperVOIPage;
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java
@@ -56,4 +56,9 @@
     * 得分
     */
    private Long scoreId;
    /**
     * 考试人数
     */
    private Integer examNum;
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.java
@@ -21,6 +21,7 @@
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.information.entity.Information;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.system.entity.Dept;
import java.util.List;
import java.util.Map;
@@ -69,4 +70,32 @@
     */
    void deleteUserByDeptId(@Param("deptId") String deptId);
    String selJurchilder(String id);
    /**
     * 查询当前单位是否有子级单位
     * @param informationVO
     * @return
     */
    List<Dept> getDeptHashChildren(@Param("information") InformationVO informationVO);
    /**
     * 查询单位的人数
     * @param dept
     * @return
     */
    int selectInformationUserNumCount(@Param("dept")Dept dept);
    /**
     * 查询单位的已派遣人数
     * @param dept
     * @return
     */
    int selectInformationDispatcherNumCount(@Param("dept")Dept dept);
    /**
     * 查询单位持证的人数
     * @param dept
     * @return
     */
    int selectInformationHoldNumCount(@Param("dept")Dept dept);
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -97,6 +97,10 @@
        sys_jurisdiction sj
        on
        sj.id = i.jurisdiction
        left join
        blade_dept bd
        on
        bd.id = i.departmentid
        where 1=1
        <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
            and (sj.id=#{information.jurisdiction} or sj.parent_id=#{information.jurisdiction})
@@ -108,7 +112,7 @@
            and i.representative like concat(concat('%', #{information.representative}),'%')
        </if>
        <if test="information.stats!=null and information.stats!=''">
            and i.stats=#{information.stats}
            and i.stats=#{information.stats} and bd.dept_category = 1
        </if>
        <if test="information.departmentid!=null and information.departmentid!=''">
            and i.departmentid=#{information.departmentid}
@@ -410,4 +414,41 @@
        WHERE parent_id = #{id}
    </select>
    <!--查询当前单位是否有子级单位-->
    <select id="getDeptHashChildren" resultType="org.springblade.modules.system.entity.Dept">
        select * from blade_dept where is_deleted = 0 and parent_id = #{information.departmentid}
    </select>
    <!--查询单位的人数-->
    <select id="selectInformationUserNumCount" resultType="java.lang.Integer">
        SELECT COUNT( * ) FROM blade_user
        WHERE 1=1
        and role_id = '1412226235153731586'
        and is_deleted = 0
        AND status=1
        and dept_id = #{dept.id}
    </select>
    <!--查询单位的已派遣人数-->
    <select id="selectInformationDispatcherNumCount" resultType="java.lang.Integer">
        SELECT COUNT( * ) FROM blade_user
        WHERE 1=1
        and role_id = '1412226235153731586'
        and is_deleted = 0
        AND status=1
        AND dispatch=0
        and dept_id = #{dept.id}
    </select>
    <!--查询单位持证的人数-->
    <select id="selectInformationHoldNumCount" resultType="java.lang.Integer">
        SELECT COUNT( * ) FROM blade_user
        WHERE 1=1
        and role_id = '1412226235153731586'
        and is_deleted = 0
        AND status=1
        AND hold=1
        and dept_id = #{dept.id}
    </select>
</mapper>
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java
@@ -66,7 +66,29 @@
    @Override
    public IPage<InformationVO> selectInformationPage(IPage<InformationVO> page, InformationVO information) {
        return page.setRecords(baseMapper.selectInformationPage(page, information));
        List<InformationVO> informationVOS = baseMapper.selectInformationPage(page, information);
        //遍历
        if (informationVOS.size()>0){
            //判断有无子级
            for (InformationVO informationVO : informationVOS) {
                List<Dept> deptList = baseMapper.getDeptHashChildren(informationVO);
                //有子级
                if (deptList.size()>0){
                    for (Dept dept : deptList) {
                        //查询当前子单位的人数
                        Integer z = baseMapper.selectInformationUserNumCount(dept) + Integer.parseInt(informationVO.getZnum());
                        informationVO.setZnum(z.toString());
                        //已派遣人数
                        Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + Integer.parseInt(informationVO.getPnum());
                        informationVO.setPnum(p.toString());
                        //持证人数
                        Integer c = baseMapper.selectInformationHoldNumCount(dept) + Integer.parseInt(informationVO.getCnum());
                        informationVO.setCnum(c.toString());
                    }
                }
            }
        }
        return page.setRecords(informationVOS);
    }
    @Override
src/main/java/org/springblade/modules/resource/endpoint/OssEndpoint.java
@@ -180,6 +180,63 @@
        return R.data(bladeFile);
    }
    /**
     * 上传文件
     *
     * @param file 文件
     * @return ObjectStat
     */
    @SneakyThrows
    @PostMapping("/put-file-user-avatar")
    public R putFileUserAvatar(@RequestParam MultipartFile file) {
        double size = file.getSize()/1024;
        if (size<=30){
            throw new ServiceException("图片大小不能低于30KB");
        }
        //填写你文件上传的地址以及相应信息
        String url = "http://223.82.109.183:2081";
        String access = "zhbaadmin";
        String secret = "zhbapassword";
        String bucket = "zhba";
        MinioClient minioClient =
            MinioClient.builder()
                .endpoint(url)
                .credentials(access, secret)
                .build();
        // 检查存储桶是否已经存在
        boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucket).build());
        if (!isExist) {
            // 创建一个名为zip的存储桶,用于zip文件。
            minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucket).build());
            minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
        }
        String fileName = file.getOriginalFilename();
        String newName = "upload/picture/" + UUID.randomUUID().toString().replaceAll("-", "")
            + fileName.substring(fileName.lastIndexOf("."));
        InputStream in = file.getInputStream();
        String[] split = newName.split("/");
        //创建头部信息
        Map<String, String> headers = new HashMap<>(1 << 2);
        //添加自定义内容类型
        headers.put("Content-Type", "application/octet-stream");
        //上传
        minioClient.putObject(
            PutObjectArgs.builder().bucket(bucket).object(newName).stream(
                in, in.available(), -1)
                .headers(headers)
                .build());
        InputStream inputStream = file.getInputStream();
        FtpUtil.uploadFile(FtpConfig.ftpHost, ftpPort, FtpConfig.ftpUserName, ftpPassword, ftpPath, "/", split[2], inputStream);
        in.close();
        String urls = "http://223.82.109.183:2081/zhba/" + newName;
        //数据封装
        Map<String, Object> map = new HashMap<>(2);
        map.put("name", newName);
        map.put("url", urls);
        //返回
        return R.data(map);
    }
    /**
     * app 文件上传
src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -318,6 +318,14 @@
            }
        }
        //如果是异常标记
        if (null!=user.getExaminationType() && !user.getExaminationType().equals("")){
            if (user.getExaminationType().equals("1")) {
                //吊销保安证
                user.setHold("3");
            }
        }
        user.setPassword(user1.getPassword());
        userService.updateById(user);
        String rtime;
@@ -394,6 +402,7 @@
                + ",registered = " + "'" + user.getRegistered() + "'"
                + ",securitynumber = " + "'" + user.getSecuritynumber() + "'"
                + ",hold = " + "'" + user.getHold() + "'"
                + ",cell = " + "'" + user.getCell() + "'"
                + " " + "where id = " + "'" + user.getId() + "'";
        FtpUtil.sqlFileUpload(s1);
        return R.success("修改成功");
@@ -904,14 +913,21 @@
            if (null!=user.getCell() && !user.getCell().equals("")) {
                if (user.getCell().equals("2")){
                    list.forEach(user2 -> {
                        user2.setStatus(2);
                        //先将原有人员离职  cell 1:手动录入  2:自动录入
                        userService.updateById(user2);
                        //内网同步
                        String s1 = "update blade_user set status = " + user2.getStatus() +
                            " where id = " + "'" + user2.getId() + "'";
                        FtpUtil.sqlFileUpload(s1);
                        //判断是否在本单位,如果是本单位,则不能再次新增
                        if(!user2.getDeptId().equals(user.getDeptId())) {
                            user2.setStatus(2);
                            //先将原有人员离职  cell 1:手动录入  2:自动录入
                            userService.updateById(user2);
                            //内网同步
                            String s1 = "update blade_user set status = " + user2.getStatus() +
                                " where id = " + "'" + user2.getId() + "'";
                            FtpUtil.sqlFileUpload(s1);
                        }else {
                            throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
                        }
                    });
                }else {
                    throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
                }
            }else {
                throw new ServiceException(StringUtil.format("当前用户 [{}] 已存在!", user.getAccount()));
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -800,7 +800,6 @@
     * @param isCovered
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void importSecurity(List<SecurityExcel> data, Boolean isCovered, String deptId) {
        //将不能导入的保安员账号存起来
        List<String> errorList = new ArrayList<>();
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml
@@ -61,7 +61,7 @@
        <if test="trainingRegistration.idCardNo!=null and  trainingRegistration.idCardNo!=''">
            and bu.cardid like concat('%', #{trainingRegistration.idCardNo},'%')
        </if>
        <if test="trainingRegistration.cancel!=null">
        <if test="trainingRegistration.cancel!=null and trainingRegistration.cancel!=0">
            and sr.cancel = #{trainingRegistration.cancel}
        </if>
        <if test="trainingRegistration.isTrain!=null">
src/main/java/org/springblade/modules/workreport/controller/WorkReportController.java
@@ -185,13 +185,19 @@
        if (null!=detail.getReplyDeptIds() && detail.getReplyDeptIds()!="" && !detail.getReplyDeptIds().isEmpty()) {
            List<String> replyDeptIds = Arrays.asList(detail.getReplyDeptIds().split(","));
            StringBuilder replyDeptNameInfo = new StringBuilder();
            for (String deptId : replyDeptIds) {
                //查询接收人单位信息
                Dept deptDetail = deptService.getById(Long.parseLong(deptId));
                replyDeptNameInfo = replyDeptNameInfo.append(deptDetail.getDeptName()).append(",");
            if (replyDeptIds.size()>0) {
                for (String deptId : replyDeptIds) {
                    //查询接收人单位信息
                    Dept deptDetail = deptService.getById(Long.parseLong(deptId));
                    if (null!= deptDetail) {
                        replyDeptNameInfo = replyDeptNameInfo.append(deptDetail.getDeptName()).append(",");
                    }
                }
                if (replyDeptNameInfo.length()>0) {
                    //截取
                    return replyDeptNameInfo.substring(0, replyDeptNameInfo.length() - 1);
                }
            }
            //截取
            return replyDeptNameInfo.substring(0, replyDeptNameInfo.length() - 1);
        }
        return null;
    }