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);