智慧保安后台管理-外网项目备份
Administrator
2022-01-14 015e0d1feda843d198e736c000b1d27167aef625
token 设置修改
12 files modified
198 ■■■■ changed files
src/main/java/org/springblade/common/config/BladeConfiguration.java 14 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/auth/endpoint/BladeTokenEndPoint.java 4 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/auth/utils/TokenUtil.java 10 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/equipage/controller/fixed.java 134 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/ExamPaperService.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java 6 ●●●●● patch | view | raw | blame | history
src/main/resources/application-test.yml 4 ●●●● patch | view | raw | blame | history
src/main/resources/application.yml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/common/config/BladeConfiguration.java
@@ -39,7 +39,7 @@
        SecureRegistry secureRegistry = new SecureRegistry();
        secureRegistry.setEnabled(true);
        secureRegistry.excludePathPatterns("/blade-auth/**");
        secureRegistry.excludePathPatterns("/blade-user/**");
//        secureRegistry.excludePathPatterns("/blade-user/**");
        secureRegistry.excludePathPatterns("/blade-system/menu/routes");
        secureRegistry.excludePathPatterns("/blade-system/menu/auth-routes");
        secureRegistry.excludePathPatterns("/blade-system/menu/top-menu");
@@ -63,11 +63,11 @@
//        secureRegistry.excludePathPatterns("/train/**");
//        secureRegistry.excludePathPatterns("/examination/**");
//        secureRegistry.excludePathPatterns("/experience/**");
        secureRegistry.excludePathPatterns("/record/**");
        secureRegistry.excludePathPatterns("/revoke/**");
        secureRegistry.excludePathPatterns("/recordk/**");
//        secureRegistry.excludePathPatterns("/record/**");
//        secureRegistry.excludePathPatterns("/revoke/**");
//        secureRegistry.excludePathPatterns("/recordk/**");
//        secureRegistry.excludePathPatterns("/jurisdiction/**");
        secureRegistry.excludePathPatterns("/permit/**");
//        secureRegistry.excludePathPatterns("/permit/**");
//        secureRegistry.excludePathPatterns("/car/**");
//        secureRegistry.excludePathPatterns("/gun/**");
//        secureRegistry.excludePathPatterns("/equipage/**");
@@ -83,8 +83,8 @@
//        secureRegistry.excludePathPatterns("/chatgroup/**");
//        secureRegistry.excludePathPatterns("/chatgroupc/**");
//        secureRegistry.excludePathPatterns("/zc/**");
        secureRegistry.excludePathPatterns("/licet/**");
        secureRegistry.excludePathPatterns("/licetuser/**");
//        secureRegistry.excludePathPatterns("/licet/**");
//        secureRegistry.excludePathPatterns("/licetuser/**");
        return secureRegistry;
    }
src/main/java/org/springblade/modules/auth/endpoint/BladeTokenEndPoint.java
@@ -135,8 +135,10 @@
            if (loginType.equals(1)) {
                //判断角色
                if (!userInfo.getRoles().get(0).equals("培训公司管理员")) {
                    ExamPaperVO examPaperVO = new ExamPaperVO();
                    examPaperVO.setUserId(userInfo.getUser().getId().toString());
                    //查询考生考试信息
                    List<ExamPaperVO> examDetail = examPaperService.getExamDetail(userInfo.getUser().getId().toString());
                    List<ExamPaperVO> examDetail = examPaperService.getExamDetail(examPaperVO);
                    if (examDetail.size()==0) {
                        return authInfo.set("error_description", "当前没有查询到考试信息");
                    }
src/main/java/org/springblade/modules/auth/utils/TokenUtil.java
@@ -95,11 +95,11 @@
        param.put(TokenConstant.NICK_NAME, user.getRealName());
        param.put(TokenConstant.ROLE_NAME, Func.join(userInfo.getRoles()));
        param.put(TokenConstant.DETAIL, userInfo.getDetail());
        param.put("jurisdiction", user.getJurisdiction());
        param.put("cardid", user.getCardid());
        param.put("Id", user.getId());
        param.put("rname", userInfo.getRoles());
        param.put("list", user);
//        param.put("jurisdiction", user.getJurisdiction());
//        param.put("cardid", user.getCardid());
//        param.put("Id", user.getId());
//        param.put("rname", userInfo.getRoles());
//        param.put("list", user);
        //拼装accessToken
        try {
src/main/java/org/springblade/modules/equipage/controller/fixed.java
@@ -1,5 +1,6 @@
package org.springblade.modules.equipage.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import net.sf.json.JSONArray;
import net.sf.json.JSONException;
@@ -19,6 +20,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import springfox.documentation.spring.web.json.Json;
import java.io.IOException;
import java.text.DateFormat;
@@ -62,71 +64,75 @@
            String res = null;
            res = HttpReqUtil.getInstance().doPost(url, params, null);
            System.out.println("res = " + res);
            JSONArray jsonArray = JSONArray.fromObject(res);
            JSONArray sortedJsonArray = new JSONArray();
            List<JSONObject> jsonValues = new ArrayList<JSONObject>();
            for (int j = 0; j < jsonArray.size(); j++) {
                jsonValues.add(jsonArray.getJSONObject(j));
            }
            Collections.sort(jsonValues, new Comparator<JSONObject>() {
                private static final String KEY_NAME = "date";
                String string1;
                String string2;
                @Override
                public int compare(JSONObject a, JSONObject b) {
                    try {
                        string1 = a.getString(KEY_NAME).replaceAll("-", "");
                        string2 = b.getString(KEY_NAME).replaceAll("-", "");
                    } catch (JSONException e) {
                        // 处理异常
                    }
                    //这里是按照时间逆序排列,不加负号为正序排列
                    return -string1.compareTo(string2);
            Map<String,Object> map =(Map<String,Object>) com.alibaba.fastjson.JSON.parse("header");
            System.out.println("map = " + map.get("code"));
            if (!map.get("code").equals("3")) {
                JSONArray jsonArray = JSONArray.fromObject(res);
                JSONArray sortedJsonArray = new JSONArray();
                List<JSONObject> jsonValues = new ArrayList<JSONObject>();
                for (int j = 0; j < jsonArray.size(); j++) {
                    jsonValues.add(jsonArray.getJSONObject(j));
                }
            });
            for (int c = 0; c < jsonArray.size(); c++) {
                sortedJsonArray.add(jsonValues.get(c));
            }
            //经度
            String gis_jd = sortedJsonArray.getJSONObject(0).getString("gis_jd");
            //纬度
            String gis_wd = sortedJsonArray.getJSONObject(0).getString("gis_wd");
            String date = sortedJsonArray.getJSONObject(0).getString("date");
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date dates = formatter.parse(date);
            //经度
            liveLocation.setLongitude(gis_jd);
            liveLocation.setLatitude(gis_wd);
            //纬度
            liveLocation.setRecordTime(dates);
            //先查询是否已有实时位置信息,如果有,则更新,没有则插入
            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);
                Collections.sort(jsonValues, new Comparator<JSONObject>() {
                    private static final String KEY_NAME = "date";
                    String string1;
                    String string2;
                    @Override
                    public int compare(JSONObject a, JSONObject b) {
                        try {
                            string1 = a.getString(KEY_NAME).replaceAll("-", "");
                            string2 = b.getString(KEY_NAME).replaceAll("-", "");
                        } catch (JSONException e) {
                            // 处理异常
                        }
                        //这里是按照时间逆序排列,不加负号为正序排列
                        return -string1.compareTo(string2);
                    }
                });
                for (int c = 0; c < jsonArray.size(); c++) {
                    sortedJsonArray.add(jsonValues.get(c));
                }
                //经度
                String gis_jd = sortedJsonArray.getJSONObject(0).getString("gis_jd");
                //纬度
                String gis_wd = sortedJsonArray.getJSONObject(0).getString("gis_wd");
                String date = sortedJsonArray.getJSONObject(0).getString("date");
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                Date dates = formatter.parse(date);
                //经度
                liveLocation.setLongitude(gis_jd);
                liveLocation.setLatitude(gis_wd);
                //纬度
                liveLocation.setRecordTime(dates);
                //先查询是否已有实时位置信息,如果有,则更新,没有则插入
                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);
                }
            }
        }
    }
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java
@@ -240,12 +240,13 @@
    /**
     * 查询考生考试信息
     * @param userId 用户id
     * @param examPaper 用户id
     * @return
     */
    @GetMapping("/getExamDetail")
    public R getExamDetail(String userId){
        return R.data(examPaperService.getExamDetail(userId));
    @PostMapping("/getExamDetail")
    public R getExamDetail(@RequestBody ExamPaperVO examPaper){
        System.out.println("examPaper = " + examPaper);
        return R.data(examPaperService.getExamDetail(examPaper));
    }
    /**
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java
@@ -66,10 +66,10 @@
    /**
     * 查询考生考试信息
     * @param userId 用户id
     * @param examPaper 用户id
     * @return
     */
    List<ExamPaperVO> getExamDetail(String userId);
    List<ExamPaperVO> getExamDetail(@Param("examPaper") ExamPaperVO examPaper);
    /**
     * 查询是当前前缀已生成准考证号码最大的一位
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -237,7 +237,7 @@
            exam_score es
        on
        es.apply_id = str.id
        where str.user_id = #{userId}
        where str.user_id = #{examPaper.userId}
        and bu.is_train = 1
        and (str.is_exam = 1 or str.is_exam = 3)
        and ke.audit_status = 1
src/main/java/org/springblade/modules/exam/service/ExamPaperService.java
@@ -73,10 +73,10 @@
    /**
     * 查询考生考试信息
     * @param userId 用户id
     * @param examPaper 用户id
     * @return
     */
    List<ExamPaperVO> getExamDetail(String userId);
    List<ExamPaperVO> getExamDetail(ExamPaperVO examPaper);
    /**
     * 查询是当前前缀已生成准考证号码最大的一位
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java
@@ -164,13 +164,13 @@
    /**
     * 查询考生考试信息
     * @param userId 用户id
     * @param examPaper 用户id
     * @return
     */
    @Override
    public List<ExamPaperVO> getExamDetail(String userId) {
    public List<ExamPaperVO> getExamDetail(ExamPaperVO examPaper) {
        //查询考试信息
        return baseMapper.getExamDetail(userId);
        return baseMapper.getExamDetail(examPaper);
    }
    /**
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java
@@ -83,4 +83,10 @@
     * 考试开始时间
     */
    private Date examStartTime;
    /**
     * 用户id
     */
    private String userId;
}
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: ZHba@0112
@@ -39,7 +39,7 @@
#ftp 设置
ftp:
  sqlConnect: 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
  sqlConnect: 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
  ftpHost: 192.168.0.199
  ftpPort: 21
  ftpUserName: arsn
src/main/resources/application.yml
@@ -201,7 +201,6 @@
      - /blade-resource/attach/detail
      - /registerUnit/save
      - /zc/inster
      - /apply/getApplyDetailList
    #授权认证配置