智慧保安后台管理-外网
Administrator
2021-08-22 bce12a18795cbab7f5426161ba452d0a6c757d4b
src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -464,14 +464,15 @@
         "update sys_apply set apply_status = " + apply.getApplyStatus() + " " +"where id = " + "'" + apply.getId() + "';" +
            "update blade_user set is_apply = " + user.getIsApply() + " " +"where id = " + "'" + user.getId() + "'";
      String json = JSON.toJSONString(s);
      OutJson.createJsonFile(json, "d:/", "wsql");
      String response = String.valueOf((new Date()).getTime());
      OutJson.createJsonFile(json, "d:/", "w"+response);
      FileInputStream in = null;
      try {
         in = new FileInputStream(new File("D:\\" + fileName));
         in = new FileInputStream(new File("D:\\" + "w"+response+".json"));
      } catch (FileNotFoundException e) {
         e.printStackTrace();
      }
      FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/", fileName, in);
      FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/",  "w"+response+".json", in);
   }
@@ -635,6 +636,23 @@
            examPaper.setExamName(examName);
            //生成考试
            examPaperService.save(examPaper);
            Long sid = examPaper.getId();
            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime());
            String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time) " +
               "values(" + "'" + sid + "'" + "," + "'" + examPaper.getExamName() + "'" + "," + "'" + examPaper.getExamType() +
               "'" + ","  +"'" + format + "'" + ")";
            String json = JSON.toJSONString(s);
            String response = String.valueOf((new Date()).getTime());
            OutJson.createJsonFile(json, "d:/", "w"+response);
            FileInputStream in = null;
            try {
               in = new FileInputStream(new File("D:\\" + "w"+response+".json"));
            } catch (FileNotFoundException e) {
               e.printStackTrace();
            }
            FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/",  "w"+response+".json", in);
            //修改报名信息
            list.forEach(id ->{
               Apply apply = new Apply();
@@ -642,6 +660,20 @@
               apply.setExamId(examPaper.getId());
               apply.setCandidateNo(getCandidateNo(apply));
               applyService.updateById(apply);
               String s1 =
                  "update sys_apply set exam_id = " + apply.getExamId() + "candidate_no = " + "'" + apply.getCandidateNo() + "'" +
                     " " +"where id = " + "'" + apply.getId() + "'";
               String json1 = JSON.toJSONString(s1);
               String response1 = String.valueOf((new Date()).getTime());
               OutJson.createJsonFile(json1, "d:/", "w"+response1);
               FileInputStream in1 = null;
               try {
                  in1 = new FileInputStream(new File("D:\\" + "w"+response1+".json"));
               } catch (FileNotFoundException e) {
                  e.printStackTrace();
               }
               FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/",  "w"+response1+".json", in1);
            });
         }
@@ -664,6 +696,24 @@
            examPaper.setExamName(examName);
            //生成考试
            examPaperService.save(examPaper);
            Long sid = examPaper.getId();
            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examPaper.getStartTime());
            String s = "insert into ksxt_exam(id,exam_name,exam_type,start_time) " +
               "values(" + "'" + sid + "'" + "," + "'" + examPaper.getExamName() + "'" + "," + "'" + examPaper.getExamType() +
               "'" + ","  +"'" + format + "'" + ")";
            String json = JSON.toJSONString(s);
            String response = String.valueOf((new Date()).getTime());
            OutJson.createJsonFile(json, "d:/", "w"+response);
            FileInputStream in = null;
            try {
               in = new FileInputStream(new File("D:\\" + "w"+response+".json"));
            } catch (FileNotFoundException e) {
               e.printStackTrace();
            }
            FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/",  "w"+response+".json", in);
            //修改报名信息
            applyIds.forEach(id ->{
               Apply apply = new Apply();
@@ -671,6 +721,20 @@
               apply.setExamId(examPaper.getId());
               apply.setCandidateNo(getCandidateNo(apply));
               applyService.updateById(apply);
               String s1 =
                  "update sys_apply set exam_id = " + apply.getExamId() + ",candidate_no = " + "'" + apply.getCandidateNo() + "'" +
                     " " +"where id = " + "'" + apply.getId() + "'";
               String json1 = JSON.toJSONString(s1);
               String response1 = String.valueOf((new Date()).getTime());
               OutJson.createJsonFile(json1, "d:/", "w"+response1);
               FileInputStream in1 = null;
               try {
                  in1 = new FileInputStream(new File("D:\\" + "w"+response1+".json"));
               } catch (FileNotFoundException e) {
                  e.printStackTrace();
               }
               FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/",  "w"+response1+".json", in1);
            });
         }
      }
@@ -714,8 +778,27 @@
      examScore.setUserId(apply.getUserId().toString());
      examScore.setApplyId(apply.getId());
      examScore.setExamTime(new Date());
      //新增
      //新增考试成绩
      examScoreService.save(examScore);
      //内网同步
      Long sid = examScore.getId();
      String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(examScore.getExamTime());
      String s = "insert into ksxt_exam(id,exam_time,user_id,exam_id,apply_id) " +
         "values(" + "'" + sid + "'" + "," + "'" +
         format + "'" + "," + "'" +
         examScore.getUserId() +"'" + ","  +"'" +
         examScore.getExamId() +"'" + ","  +"'" +
         examScore.getApplyId() + "'" + ")";
      String json = JSON.toJSONString(s);
      String response = String.valueOf((new Date()).getTime());
      OutJson.createJsonFile(json, "d:/", "w"+response);
      FileInputStream in = null;
      try {
         in = new FileInputStream(new File("D:\\" + "w"+response+".json"));
      } catch (FileNotFoundException e) {
         e.printStackTrace();
      }
      FtpUtil.uploadFile(ftpHost, ftpPort, ftpUserName, ftpPassword, "anbao/", "/",  "w"+response+".json", in);
      return examScore;
   }