班前班后图片数据修改

main
dongdingding 9 months ago
parent 245a5a23c3
commit f98092c64a

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest; import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.mudu.entity.ASafeBqbhpx; import com.mudu.entity.ASafeBqbhpx;
import com.mudu.entity.ASafeQyzypgl; 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.entity.dto.response.XcTpResponse;
import com.mudu.service.ASafeBqbhpxService; import com.mudu.service.ASafeBqbhpxService;
import com.mudu.service.ASafeQyzypglService; 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.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional; 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 javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
@ -29,12 +35,12 @@ import java.util.List;
* @author wu * @author wu
* @since 2024/4/26 4:40 * @since 2024/4/26 4:40
*/ */
//@RestController @RestController
//@RequestMapping("mudu/test") @RequestMapping("mudu/test")
//@Api(tags = "班前班后以及特殊作业的数据接收") @Api(tags = "班前班后以及特殊作业的数据接收")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Configuration //@Configuration
@EnableScheduling //@EnableScheduling
public class BqbhTszyQuartz { public class BqbhTszyQuartz {
@Resource @Resource
@ -56,9 +62,9 @@ public class BqbhTszyQuartz {
/** /**
* *
*/ */
// @GetMapping("/bqbh") @GetMapping("/bqbh")
// @ApiOperation(value = "保存班前班后数据") @ApiOperation(value = "保存班前班后数据")
@Scheduled(cron = "0 0 1 * * ? ") // @Scheduled(cron = "0 0 1 * * ? ")
// @Scheduled(cron = "0 0/5 * * * ?") // @Scheduled(cron = "0 0/5 * * * ?")
public void saveBqbh() { public void saveBqbh() {
String res = HttpRequest.get(bqbhUrl).contentType("application/x-www-form-urlencoded;charset=UTF-8").execute().body(); 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.setFJLX("");
xcTpResponse.setFJMC(aSafeBqbhpx.getPxxctp().substring(aSafeBqbhpx.getPxxctp().lastIndexOf("/") + 1)); xcTpResponse.setFJMC(aSafeBqbhpx.getPxxctp().substring(aSafeBqbhpx.getPxxctp().lastIndexOf("/") + 1));
//实体类转为JSONObject //实体类转为JSONObject
JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(xcTpResponse)); JSONArray jsonArray = new JSONArray(xcTpResponse);
aSafeBqbhpx.setPxxctp(String.valueOf(jsonObject)); aSafeBqbhpx.setPxxctp(String.valueOf(jsonArray));
} }
aSafeBqbhpx.setQybh(x.getQyxxbh()); aSafeBqbhpx.setQybh(x.getQyxxbh());
aSafeBqbhpxes.add(aSafeBqbhpx); aSafeBqbhpxes.add(aSafeBqbhpx);

Loading…
Cancel
Save