From f98092c64addd315cd9ef07a232858149d97563f Mon Sep 17 00:00:00 2001 From: dongdingding <207595406@qq.com> Date: Thu, 13 Jun 2024 10:33:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8F=AD=E5=89=8D=E7=8F=AD=E5=90=8E=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=95=B0=E6=8D=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/mudu/quartz/BqbhTszyQuartz.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java b/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java index 6ad8d93..57918e5 100644 --- a/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java +++ b/src/main/java/com/mudu/quartz/BqbhTszyQuartz.java @@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.mudu.entity.ASafeBqbhpx; import com.mudu.entity.ASafeQyzypgl; @@ -13,11 +14,16 @@ import com.mudu.entity.dto.request.ASafeQyzypglRequest; import com.mudu.entity.dto.response.XcTpResponse; import com.mudu.service.ASafeBqbhpxService; import com.mudu.service.ASafeQyzypglService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.ArrayList; @@ -29,12 +35,12 @@ import java.util.List; * @author wu * @since 2024/4/26 下午4:40 */ -//@RestController -//@RequestMapping("mudu/test") -//@Api(tags = "班前班后以及特殊作业的数据接收") +@RestController +@RequestMapping("mudu/test") +@Api(tags = "班前班后以及特殊作业的数据接收") @Transactional(rollbackFor = Exception.class) -@Configuration -@EnableScheduling +//@Configuration +//@EnableScheduling public class BqbhTszyQuartz { @Resource @@ -56,9 +62,9 @@ public class BqbhTszyQuartz { /** * 保存班前班后数据 */ -// @GetMapping("/bqbh") -// @ApiOperation(value = "保存班前班后数据") - @Scheduled(cron = "0 0 1 * * ? ") + @GetMapping("/bqbh") + @ApiOperation(value = "保存班前班后数据") +// @Scheduled(cron = "0 0 1 * * ? ") // @Scheduled(cron = "0 0/5 * * * ?") public void saveBqbh() { String res = HttpRequest.get(bqbhUrl).contentType("application/x-www-form-urlencoded;charset=UTF-8").execute().body(); @@ -78,8 +84,8 @@ public class BqbhTszyQuartz { xcTpResponse.setFJLX(""); xcTpResponse.setFJMC(aSafeBqbhpx.getPxxctp().substring(aSafeBqbhpx.getPxxctp().lastIndexOf("/") + 1)); //实体类转为JSONObject - JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(xcTpResponse)); - aSafeBqbhpx.setPxxctp(String.valueOf(jsonObject)); + JSONArray jsonArray = new JSONArray(xcTpResponse); + aSafeBqbhpx.setPxxctp(String.valueOf(jsonArray)); } aSafeBqbhpx.setQybh(x.getQyxxbh()); aSafeBqbhpxes.add(aSafeBqbhpx);