From 895053e3da7d499dfb09b7ff08984d45d9b3fd31 Mon Sep 17 00:00:00 2001 From: typ Date: Wed, 7 Jun 2023 00:03:52 +0800 Subject: [PATCH] oss --- src/main/java/com/subsidy/jobs/RenSheJuJob.java | 6 +++--- src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java | 84 ++++++++++++++++++++++++++++++++++++++++++------------------------------------------ 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/main/java/com/subsidy/jobs/RenSheJuJob.java b/src/main/java/com/subsidy/jobs/RenSheJuJob.java index 446d3af..b298019 100644 --- a/src/main/java/com/subsidy/jobs/RenSheJuJob.java +++ b/src/main/java/com/subsidy/jobs/RenSheJuJob.java @@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentHashMap; /** * 企业职工线上培训 */ -//@Component +@Component public class RenSheJuJob { @@ -118,7 +118,7 @@ public class RenSheJuJob { // renSheJuService.getErrorClass(); // } - @Scheduled(cron = "0 50 23 * * ?") + @Scheduled(cron = "0 30 23 * * ?") @Transactional(rollbackFor = Exception.class) public void logout(){ //让当前用户下线 @@ -140,7 +140,7 @@ public class RenSheJuJob { } - @Scheduled(cron = "0 55 23 * * ?") + @Scheduled(cron = "0 50 23 * * ?") @Transactional(rollbackFor = Exception.class) public void cancelLogin() { diff --git a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java index 8daca4b..571baa5 100644 --- a/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java @@ -102,26 +102,26 @@ public class RenSheJuServiceImpl implements RenSheJuService { System.out.println(JSONObject.fromObject(classBaseInfoDTO).toString()); -// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString()); -// Request request = new Request.Builder() -// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass") -// .method("POST", body) -// .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") -// .addHeader("Content-Type", "application/json") -// .build(); -// Response response = client.newCall(request).execute(); -// -// RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); -// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); -// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2); -// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString()); -// if (200 == response.code()) { -// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); -// } else { -// renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); -// } -// renshejuHistoryMapper.insert(renshejuHistoryDO); -// return rensheResponseVO; + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classBaseInfoDTO).toString()); + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClass") + .method("POST", body) + .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") + .addHeader("Content-Type", "application/json") + .build(); + Response response = client.newCall(request).execute(); + + RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_2); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(classBaseInfoDTO).toString()); + if (200 == response.code()) { + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + } else { + renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); + } + renshejuHistoryMapper.insert(renshejuHistoryDO); + return rensheResponseVO; // return null; } else { RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); @@ -217,27 +217,27 @@ public class RenSheJuServiceImpl implements RenSheJuService { System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO)); if (classHourBasics.size()>0){ -// RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString()); -// -// Request request = new Request.Builder() -// .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClassHourBehavior") -// .method("POST", body) -// .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") -// .addHeader("Content-Type", "application/json") -// .build(); -// Response response = client.newCall(request).execute(); -// -// RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); -// RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); -// renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3); -// renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString()); -// if (200 == response.code()) { -// renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); -// } else { -// renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); -// } -// renshejuHistoryMapper.insert(renshejuHistoryDO); -// return rensheResponseVO; + RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(classHourBehaviorDTO).toString()); + + Request request = new Request.Builder() + .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadClassHourBehavior") + .method("POST", body) + .addHeader("User-Agent", "Apifox/1.0.0 (https://www.apifox.cn)") + .addHeader("Content-Type", "application/json") + .build(); + Response response = client.newCall(request).execute(); + + RensheResponseVO rensheResponseVO = JSON.parseObject(response.body().string(), RensheResponseVO.class); + RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); + renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3); + renshejuHistoryDO.setInputParam(JSONObject.fromObject(classHourBehaviorDTO).toString()); + if (200 == response.code()) { + renshejuHistoryDO.setOutputParam(rensheResponseVO.getCtt().toString()); + } else { + renshejuHistoryDO.setOutputParam(RenSheJuConstant.API_ERROR); + } + renshejuHistoryMapper.insert(renshejuHistoryDO); + return rensheResponseVO; }else { RenshejuHistoryDO renshejuHistoryDO = new RenshejuHistoryDO(); renshejuHistoryDO.setInterfaceName(RenSheJuConstant.POST_3); @@ -549,7 +549,7 @@ public class RenSheJuServiceImpl implements RenSheJuService { uploadImage.setImageDetailList(imageDetailLists); if (imageDetailLists.size() > 0) { - System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadImage)); +// System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(uploadImage)); RequestBody body = RequestBody.create(mediaType, JSONObject.fromObject(uploadImage).toString()); Request request = new Request.Builder() .url(renSheConfig.getUrl() + "/import/downstream/enterprise/uploadImage") -- libgit2 0.25.0