定时任务修改,配置文件修改

main
dongdingding 8 months ago
parent 5030fc33dc
commit eda56542f7

@ -1,5 +1,7 @@
package com.mudu.controller; package com.mudu.controller;
import cn.hutool.core.collection.CollectionUtil;
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.JSONObject; 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.request.ACheckQuatzZichaRequest;
import com.mudu.entity.dto.response.ACheckXcTpResponse; import com.mudu.entity.dto.response.ACheckXcTpResponse;
import com.mudu.service.*; import com.mudu.service.*;
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.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.transaction.annotation.Transactional; 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 javax.annotation.Resource;
import java.text.ParseException; import java.text.ParseException;
@ -31,10 +30,12 @@ import static com.mudu.base.domain.AjaxResult.success;
* @author dong * @author dong
* @since 2024/3/12 16:37 * @since 2024/3/12 16:37
*/ */
@RestController //@RestController
@RequestMapping("pharmaceuticals/aCheck") //@RequestMapping("pharmaceuticals/aCheck")
@Api(tags = "新增") //@Api(tags = "新增")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Configuration
@EnableScheduling
public class AcheckTaskController { public class AcheckTaskController {
/** /**
@ -96,15 +97,35 @@ public class AcheckTaskController {
@Value("${zcUrl}") @Value("${zcUrl}")
private String zcUrl; private String zcUrl;
@Value("${imUrl}")
private String imUrl;
@Value("${zcXxUrl}")
private String zcXxUrl;
/** /**
* *
* *
* @param list todo
* @Param qymc * @Param qymc
*/ */
@PostMapping("/insert") @Scheduled(cron = "0 0 4 * * ? ")
@ApiOperation(value = "新增创建时间为昨天且处于审批通过的工单数据") // @PostMapping("/insert")
public AjaxResult selectAll(@RequestBody List<ACheckQuatzRequest> list) throws ParseException { // @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<ACheckQuatzRequest> list = JSON.parseArray(dataList, ACheckQuatzRequest.class);
if (CollectionUtil.isEmpty(list)) {
return null;
}
for (ACheckQuatzRequest a : list) { for (ACheckQuatzRequest a : list) {
String rwzqUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); String rwzqUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String xcrwuuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); String xcrwuuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
@ -531,9 +552,24 @@ public class AcheckTaskController {
} }
@PostMapping("/ziChainsert")
@ApiOperation(value = "自查") @Scheduled(cron = "0 0 4 * * ? ")
public AjaxResult zicha(@RequestBody List<ACheckQuatzZichaRequest> list) throws ParseException { // @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<ACheckQuatzZichaRequest> list = JSON.parseArray(dataList, ACheckQuatzZichaRequest.class);
if (CollectionUtil.isEmpty(list)) {
return null;
}
for (ACheckQuatzZichaRequest a : list) { for (ACheckQuatzZichaRequest a : list) {
String rwzqUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); String rwzqUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
String zcrwUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase(); String zcrwUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();

@ -43,3 +43,9 @@ zcUrl: http://localhost:9028/mudu/quatz/zctp
api: http://221.229.220.83:8007/api/ api: http://221.229.220.83:8007/api/
#获取工单信息
imUrl: http://localhost:9028/mudu/quatz/get
#获取自查信息
zcXxUrl: http://localhost:9028/mudu/quatz/zicha

@ -42,4 +42,8 @@ zcUrl: http://localhost:9028/mudu/quatz/zctp
#图片路径 #图片路径
api: http://221.229.220.83:8007/api/ api: http://221.229.220.83:8007/api/
#获取工单信息
imUrl: http://localhost:9028/mudu/quatz/get
#获取自查信息
zcXxUrl: http://localhost:9028/mudu/quatz/zicha
Loading…
Cancel
Save