diff --git a/src/main/java/com/mudu/controller/AcheckTaskController.java b/src/main/java/com/mudu/controller/AcheckTaskController.java index 24a0504..6c0a017 100644 --- a/src/main/java/com/mudu/controller/AcheckTaskController.java +++ b/src/main/java/com/mudu/controller/AcheckTaskController.java @@ -1,5 +1,7 @@ package com.mudu.controller; +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.JSONObject; @@ -9,14 +11,11 @@ import com.mudu.entity.dto.request.ACheckQuatzRequest; import com.mudu.entity.dto.request.ACheckQuatzZichaRequest; import com.mudu.entity.dto.response.ACheckXcTpResponse; import com.mudu.service.*; -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.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.text.ParseException; @@ -31,10 +30,12 @@ import static com.mudu.base.domain.AjaxResult.success; * @author dong * @since 2024/3/12 16:37 */ -@RestController -@RequestMapping("pharmaceuticals/aCheck") -@Api(tags = "新增") +//@RestController +//@RequestMapping("pharmaceuticals/aCheck") +//@Api(tags = "新增") @Transactional(rollbackFor = Exception.class) +@Configuration +@EnableScheduling public class AcheckTaskController { /** @@ -96,15 +97,35 @@ public class AcheckTaskController { @Value("${zcUrl}") private String zcUrl; + @Value("${imUrl}") + private String imUrl; + + @Value("${zcXxUrl}") + private String zcXxUrl; + + /** * 新增创建时间为昨天且处于审批通过的工单数据 * - * @param list todo * @Param qymc 企业名称 */ - @PostMapping("/insert") - @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") - public AjaxResult selectAll(@RequestBody List list) throws ParseException { + @Scheduled(cron = "0 0 4 * * ? ") +// @PostMapping("/insert") +// @ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") + public AjaxResult selectAll() throws ParseException { + String responseList = HttpRequest.post(imUrl) + .contentType("application/x-www-form-urlencoded;charset=UTF-8") + .execute() + .body(); + JSONObject jsonResponseList = JSON.parseObject(responseList); + String dataList = jsonResponseList.getString("data"); + if (StrUtil.isEmpty(dataList)) { + return null; + } + List list = JSON.parseArray(dataList, ACheckQuatzRequest.class); + if (CollectionUtil.isEmpty(list)) { + return null; + } for (ACheckQuatzRequest a : list) { String rwzqUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); String xcrwuuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); @@ -531,9 +552,24 @@ public class AcheckTaskController { } - @PostMapping("/ziChainsert") - @ApiOperation(value = "自查") - public AjaxResult zicha(@RequestBody List list) throws ParseException { + + @Scheduled(cron = "0 0 4 * * ? ") +// @PostMapping("/zicha") +// @ApiOperation(value = "自查") + public AjaxResult zicha() throws ParseException { + String responseList = HttpRequest.post(zcXxUrl) + .contentType("application/x-www-form-urlencoded;charset=UTF-8") + .execute() + .body(); + JSONObject jsonResponseList = JSON.parseObject(responseList); + String dataList = jsonResponseList.getString("data"); + if (StrUtil.isEmpty(dataList)) { + return null; + } + List list = JSON.parseArray(dataList, ACheckQuatzZichaRequest.class); + if (CollectionUtil.isEmpty(list)) { + return null; + } for (ACheckQuatzZichaRequest a : list) { String rwzqUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); String zcrwUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 0cb40ba..11ba5a1 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -43,3 +43,9 @@ zcUrl: http://localhost:9028/mudu/quatz/zctp api: http://221.229.220.83:8007/api/ + +#获取工单信息 +imUrl: http://localhost:9028/mudu/quatz/get +#获取自查信息 +zcXxUrl: http://localhost:9028/mudu/quatz/zicha + diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index 0cb40ba..9cae66d 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -42,4 +42,8 @@ zcUrl: http://localhost:9028/mudu/quatz/zctp #图片路径 api: http://221.229.220.83:8007/api/ +#获取工单信息 +imUrl: http://localhost:9028/mudu/quatz/get +#获取自查信息 +zcXxUrl: http://localhost:9028/mudu/quatz/zicha \ No newline at end of file