智慧保安后台管理-外网项目备份
1. 派遣查询修改
2. 车辆定位接口修改,会报空指针
3. 日志输出修改管理
4. 证书导出Png图片不显示bug修复
14 files modified
299 ■■■■ changed files
src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java 10 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherUnitServiceImpl.java 8 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/dispatcher/vo/DispatcherUnitVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/controller/fixed.java 91 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/controller/InformationController.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml 73 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/IInformationService.java 14 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java 17 ●●●●● patch | view | raw | blame | history
src/main/resources/application-test.yml 2 ●●● patch | view | raw | blame | history
src/main/resources/log/logback-dev.xml 37 ●●●●● patch | view | raw | blame | history
src/main/resources/log/logback-test.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/accreditation/controller/AccreditationRecordsController.java
@@ -346,6 +346,9 @@
                //如果头像有
                if (null != list.get(i).getAvatar() && list.get(i).getAvatar() != "") {
                    if (list.get(i).getAvatar().contains("http:")) {
                        //获取图片格式
                        int lastIndexOf = list.get(i).getAvatar().lastIndexOf(".");
                        String pictureType = list.get(i).getAvatar().substring(lastIndexOf + 1);
                        //画图的顶级管理器,一个sheet只能获取一个(一定要注意这点)
                        BufferedImage bufferImg = null;
                        //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
@@ -356,7 +359,7 @@
                            e.printStackTrace();
                        }
                        try {
                            ImageIO.write(bufferImg, "jpg", byteArrayOut);
                            ImageIO.write(bufferImg, pictureType, byteArrayOut);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
@@ -429,6 +432,9 @@
            //如果头像有
            if (null != list.get(i).getAvatar() && list.get(i).getAvatar() != "") {
                if (list.get(i).getAvatar().contains("http:")) {
                    //获取图片格式
                    int lastIndexOf = list.get(i).getAvatar().lastIndexOf(".");
                    String pictureType = list.get(i).getAvatar().substring(lastIndexOf + 1);
                    //画图的顶级管理器,一个sheet只能获取一个(一定要注意这点)
                    BufferedImage bufferImg = null;
                    //先把读进来的图片放到一个ByteArrayOutputStream中,以便产生ByteArray
@@ -439,7 +445,7 @@
                        e.printStackTrace();
                    }
                    try {
                        ImageIO.write(bufferImg, "jpg", byteArrayOut);
                        ImageIO.write(bufferImg, pictureType, byteArrayOut);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherMapper.xml
@@ -15,7 +15,7 @@
    <!--派遣记录分页数据-->
    <select id="selectDispatcherPage" resultType="org.springblade.modules.dispatcher.vo.DispatcherVO">
        select
            sd.*,bu.real_name securityName,sdu.name dispatcherCompany,bu.cardid idCardNo
            sd.*,bu.real_name securityName,sdu.name dispatcherCompany,bu.cardid idCardNo,bd.dept_name deptName
        from
            sys_dispatcher sd
        left join
@@ -26,6 +26,10 @@
            blade_user bu
        on
            bu.id = sd.user_ids
        left join
            blade_dept bd
        on
            bd.id = bu.dept_id
        left join
            sys_jurisdiction sj
        on
@@ -53,6 +57,9 @@
        </if>
        <if test="dispatcher.securityName!=null and  dispatcher.securityName!=''">
            and bu.real_name like concat('%', #{dispatcher.securityName},'%')
        </if>
        <if test="dispatcher.deptName!=null and  dispatcher.deptName!=''">
            and bd.dept_name like concat('%', #{dispatcher.deptName},'%')
        </if>
        <if test="dispatcher.cardid!=null and  dispatcher.cardid!=''">
            and sd.cardid like concat('%', #{dispatcher.cardid},'%')
@@ -90,6 +97,7 @@
        where
        1=1
        and dispatcher_unit_id = #{dispatcherUnitVO1.id}
        and status = 0
    </select>
    <!--查询用的派遣信息-->
src/main/java/org/springblade/modules/dispatcher/mapper/DispatcherUnitMapper.xml
@@ -51,6 +51,13 @@
                or ( sdu.start_time &lt;= #{dispatcherUnit.overTime} and sdu.start_time &gt;= #{dispatcherUnit.beginTime})
            </if>
        </if>
        <if test="dispatcherUnit.isExpire==1">
            and sdu.start_time &lt;= now()
            and sdu.end_time &gt; now()
        </if>
        <if test="dispatcherUnit.isExpire==2">
            and sdu.end_time &lt;= now()
        </if>
    </select>
    <!--自定义树-->
src/main/java/org/springblade/modules/dispatcher/service/impl/DispatcherUnitServiceImpl.java
@@ -57,10 +57,10 @@
    @Override
    public IPage<DispatcherUnitVO> selectDispatcherUnitPage(IPage<DispatcherUnitVO> page, DispatcherUnitVO dispatcherUnitVO) {
        List<DispatcherUnitVO> dispatcherUnitVOS = baseMapper.selectDispatcherUnitPage(page, dispatcherUnitVO);
//        dispatcherUnitVOS.forEach(dispatcherUnitVO1 -> {
//            //查询派遣记录条数
//            dispatcherUnitVO1.setNum(dispatcherService.getDispatcherCount(dispatcherUnitVO1));
//        });
        dispatcherUnitVOS.forEach(dispatcherUnitVO1 -> {
            //查询派遣记录条数
            dispatcherUnitVO1.setNum(dispatcherService.getDispatcherCount(dispatcherUnitVO1));
        });
        return page.setRecords(dispatcherUnitVOS);
    }
src/main/java/org/springblade/modules/dispatcher/vo/DispatcherUnitVO.java
@@ -62,4 +62,9 @@
     * 辖区名称
     */
    private String jurisdictionName;
    /**
     * 是否到期
     */
    private Integer isExpire;
}
src/main/java/org/springblade/modules/equipage/controller/fixed.java
@@ -228,50 +228,53 @@
                res = HttpReqUtil.getInstance().doPost(url, params, null);
                String a = "[" + res + "]";
                JSONArray jsonArray = JSONArray.fromObject(a);
                String data = jsonArray.getJSONObject(0).get("data").toString();
                String b = "[" + data + "]";
                JSONArray jsonArrayb = JSONArray.fromObject(b);
                String x = jsonArrayb.getJSONObject(0).get("x").toString();
                String y = jsonArrayb.getJSONObject(0).get("y").toString();
                String timestamp = jsonArrayb.getJSONObject(0).get("timestamp").toString();
                //实时位置实体类
                LiveLocation liveLocation = new LiveLocation();
                liveLocation.setType(2);
                String carnumber = maps.get(i).get("carnumber").toString();
                liveLocation.setWorkerId(carnumber);
                //经度
                liveLocation.setLongitude(x);
                //纬度
                liveLocation.setLatitude(y);
                Date date = timeStamp2Date(timestamp);
                liveLocation.setRecordTime(date);
                //先查询是否已有实时位置信息,如果有,则更新,没有则插入
                LiveLocation liveLocationInfo = liveLocationService.getLiveLocationInfo(liveLocation);
                boolean status = false;
                if (null == liveLocationInfo) {
                    //新增
                    status = liveLocationService.save(liveLocation);
                    //数据推送
                    String s1 =
                        "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time) " +
                            "values(" + "'" + liveLocation.getId() + "'" + "," +
                            "'" + liveLocation.getType() + "'" + "," +
                            "'" + liveLocation.getWorkerId() + "'" + "," +
                            "'" + liveLocation.getLongitude() + "'" + "," +
                            "'" + liveLocation.getLatitude() + "'" + "," +
                            "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'"  + ")";
                    FtpUtil.sqlFileUpload(s1);
                } else {
                    status = liveLocationService.updateById(liveLocationInfo);
                    //内网同步
                    String s1 =
                        "update sys_live_location set type = " + "'" + liveLocationInfo.getType() + "'" +
                            ",worker_id = " + "'" + liveLocationInfo.getWorkerId() + "'" +
                            ",longitude = " + "'" + liveLocationInfo.getLongitude() + "'" +
                            ",latitude = " + "'" + liveLocationInfo.getLatitude() + "'" +
                            ",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocationInfo.getRecordTime()) + "'" +
                            " " + "where id = " + "'" + liveLocationInfo.getId() + "'";
                    FtpUtil.sqlFileUpload(s1);
                String code = jsonArray.getJSONObject(0).get("code").toString();
                if (Integer.parseInt(code)==200) {
                    String data = jsonArray.getJSONObject(0).get("data").toString();
                    String b = "[" + data + "]";
                    JSONArray jsonArrayb = JSONArray.fromObject(b);
                    String x = jsonArrayb.getJSONObject(0).get("x").toString();
                    String y = jsonArrayb.getJSONObject(0).get("y").toString();
                    String timestamp = jsonArrayb.getJSONObject(0).get("timestamp").toString();
                    //实时位置实体类
                    LiveLocation liveLocation = new LiveLocation();
                    liveLocation.setType(2);
                    String carnumber = maps.get(i).get("carnumber").toString();
                    liveLocation.setWorkerId(carnumber);
                    //经度
                    liveLocation.setLongitude(x);
                    //纬度
                    liveLocation.setLatitude(y);
                    Date date = timeStamp2Date(timestamp);
                    liveLocation.setRecordTime(date);
                    //先查询是否已有实时位置信息,如果有,则更新,没有则插入
                    LiveLocation liveLocationInfo = liveLocationService.getLiveLocationInfo(liveLocation);
                    boolean status = false;
                    if (null == liveLocationInfo) {
                        //新增
                        status = liveLocationService.save(liveLocation);
                        //数据推送
                        String s1 =
                            "insert into sys_live_location(id,type,worker_id,longitude,latitude,record_time) " +
                                "values(" + "'" + liveLocation.getId() + "'" + "," +
                                "'" + liveLocation.getType() + "'" + "," +
                                "'" + liveLocation.getWorkerId() + "'" + "," +
                                "'" + liveLocation.getLongitude() + "'" + "," +
                                "'" + liveLocation.getLatitude() + "'" + "," +
                                "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocation.getRecordTime()) + "'" + ")";
                        FtpUtil.sqlFileUpload(s1);
                    } else {
                        status = liveLocationService.updateById(liveLocationInfo);
                        //内网同步
                        String s1 =
                            "update sys_live_location set type = " + "'" + liveLocationInfo.getType() + "'" +
                                ",worker_id = " + "'" + liveLocationInfo.getWorkerId() + "'" +
                                ",longitude = " + "'" + liveLocationInfo.getLongitude() + "'" +
                                ",latitude = " + "'" + liveLocationInfo.getLatitude() + "'" +
                                ",record_time = " + "'" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(liveLocationInfo.getRecordTime()) + "'" +
                                " " + "where id = " + "'" + liveLocationInfo.getId() + "'";
                        FtpUtil.sqlFileUpload(s1);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -523,4 +523,13 @@
        ExcelUtil.export(response, "保安员统计数据" + DateUtil.time(), "保安员统计数据表", list, ExportInformationSecurityStatistics.class);
    }
    /**
     * 保安员详情
     */
    @PostMapping("/selectUIn")
    public R<IPage> selectUIn(String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil, Query query) {
        IPage list = informationService.selectUIn(Condition.getPage(query), deptid, name, hold, photo, examinationtype, dispatch, soil);
        return R.data(list);
    }
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.java
@@ -201,4 +201,18 @@
     * @return
     */
    List<ExportInformationExcel> exportBusinessStatis(@Param("information") InformationVO information);
    /**
     * 保安员详情
     * @param page
     * @param deptid
     * @param name
     * @param hold
     * @param photo
     * @param examinationtype
     * @param dispatch
     * @param soil
     * @return
     */
    List<List> selectUIn(IPage<List> page, String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil);
}
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -1241,4 +1241,77 @@
        </if>
    </select>
    <!--保安人员详情-->
    <select id="selectUIn" resultType="java.util.HashMap">
        SELECT
        u.real_name,
        u.securitynumber,
        u.cardid,
        u.phone,
        u.hold,
        u.soil,
        u.photo,
        u.examination_type,
        u.dispatch,
        bd.dept_name enterpriseName
        FROM
        blade_user u
        LEFT JOIN blade_dept bd ON bd.id = u.dept_id
        WHERE
        u.role_id = '1412226235153731586'
        AND u.is_deleted = 0
        AND u.`status` = 1
        and bd.is_deleted = 0
        <if test="deptid!=null and deptid!=''">
            and bd.id in
            (
            select id from blade_dept where id = #{deptid}
            union all
            (SELECT
            id
            FROM
            (
            SELECT
            t1.id,t1.parent_id,t1.dept_name,
            IF
            ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
            FROM
            ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
            ( SELECT @pids := #{deptid} ) t2
            ) t3
            WHERE
            ischild != 0
            )
            )
        </if>
        <if test="name!=null and name!=''">
            and real_name like concat('%', #{name},'%')
        </if>
        <if test="hold!=null and hold!=''">
            <if test="hold==0">
                and hold=#{hold}
            </if>
            <if test="hold==1">
                and hold=#{hold}
            </if>
        </if>
        <if test="photo!=null and photo!=''">
            <if test="photo==0">
                AND avatar is not null and avatar!=""
            </if>
            <if test="photo==1">
                AND (avatar is null or avatar = "")
            </if>
        </if>
        <if test="examinationtype!=null and examinationtype!=''">
            and examination_type=#{examinationtype}
        </if>
        <if test="dispatch!=null and dispatch!=''">
            and dispatch=#{dispatch}
        </if>
        <if test="soil !=null and soil !=''">
            and soil =#{soil}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/information/service/IInformationService.java
@@ -112,4 +112,18 @@
     * @return
     */
    List<ExportInformationSecurityStatistics> exportSecurityStatisInfo(InformationVO information);
    /**
     * 保安员详情
     * @param page
     * @param deptid
     * @param name
     * @param hold
     * @param photo
     * @param examinationtype
     * @param dispatch
     * @param soil
     * @return
     */
    IPage selectUIn(IPage<List> page, String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil);
}
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java
@@ -390,4 +390,21 @@
        }
        return list;
    }
    /**
     * 保安员详情
     * @param page
     * @param deptid
     * @param name
     * @param hold
     * @param photo
     * @param examinationtype
     * @param dispatch
     * @param soil
     * @return
     */
    @Override
    public IPage selectUIn(IPage<List> page, String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil) {
        return page.setRecords(baseMapper.selectUIn(page,deptid, name, hold, photo, examinationtype, dispatch,soil));
    }
}
src/main/resources/application-test.yml
@@ -13,7 +13,7 @@
    #  commandTimeout: 5000
  datasource:
    # MySql
    url: jdbc:mysql://223.82.109.183:2083/zhbaw-test?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
    url: jdbc:mysql://223.82.109.183:2083/zhbaw?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
    username: root
    password: zhba0728
src/main/resources/log/logback-dev.xml
@@ -21,6 +21,43 @@
        </encoder>
    </appender>
    <!-- 生成日志文件 -->
    <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件输出的文件名 -->
            <FileNamePattern>/home/zhongsong/log/info/info-%d{yyyy-MM-dd}.log</FileNamePattern>
            <maxHistory>10</maxHistory>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] [%logger{50}] %n%-5level: %msg%n</pattern>
        </encoder>
        <!-- 打印日志级别 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>INFO</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <!-- 生成日志文件 -->
    <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件输出的文件名 -->
            <FileNamePattern>/home/zhongsong/log/warn/warn-%d{yyyy-MM-dd}.log</FileNamePattern>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] [%logger{50}] %n%-5level: %msg%n</pattern>
        </encoder>
        <!-- 打印日志级别 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>WARN</level>
            <level>ERROR</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>
    <if condition='property("ELK_MODE").toUpperCase().contains("TRUE")'>
        <then>
            <!-- 推送日志至elk -->
src/main/resources/log/logback-test.xml
@@ -25,7 +25,7 @@
    <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件输出的文件名 -->
            <FileNamePattern>target/blade/log/info-%d{yyyy-MM-dd}.log</FileNamePattern>
            <FileNamePattern>D:/log/info-%d{yyyy-MM-dd}.log</FileNamePattern>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] [%logger{50}] %n%-5level: %msg%n</pattern>