添加远程调用接口

master
wyb 2 years ago
parent 94a8a89289
commit 8a51795f94

@ -1,7 +1,7 @@
[
{
"method": "WS_RECORD_SUBMIT",
"urls": ["http://127.0.0.1:9312/message/receive/wsRecordSubmit/do22"],
"urls": ["http://127.0.0.1:9313/message/receive/wsRecordSubmit/do"],
"errorResult": "<Response><RetInfo><RetCode>1</RetCode><RetCon>${{xpath:/Request/Msg/INHOSP_NO}}系统错误!</RetCon></RetInfo></Response>",
"messageDataType": 1
}

@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import java.util.Properties;
@ -14,6 +15,7 @@ import java.util.Properties;
@Slf4j
@SpringBootApplication(scanBasePackages ={"com.docus"})
@MapperScan("com.docus.server.**.mapper")
@EnableFeignClients
@EnableAsync
public class AppRunBootstrap {
public static void main(String[] args) {

@ -1,17 +0,0 @@
package com.docus.server.message.api;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.message.api.dto.CompensateTaskDTO;
/**
* @author wyb
*/
public interface CollectTaskService {
/**
*,
* @param dto
* @return
*/
CommonResult<String> compensateTask(CompensateTaskDTO dto);
}

@ -1,37 +0,0 @@
package com.docus.server.message.api.impl;
import cn.hutool.http.HttpUtil;
import com.docus.core.util.Func;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.message.api.CollectTaskService;
import com.docus.server.message.api.dto.CompensateTaskDTO;
import com.docus.server.message.config.UrlConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @author wyb
*/
@Service
public class CollectTaskServiceImpl implements CollectTaskService {
private UrlConfig urlConfig;
@Autowired
public void setUrlConfig(UrlConfig urlConfig) {
this.urlConfig = urlConfig;
}
@Override
public CommonResult<String> compensateTask(CompensateTaskDTO dto) {
String response = HttpUtil.post(urlConfig.getCompensateTaskUrl(), Func.toJson(dto));
CommonResult commonResult = Func.readJson(response, CommonResult.class);
Object data = commonResult.getData();
CommonResult<String> result = new CommonResult<>();
result.setCode(commonResult.getCode());
result.setMsgCode(commonResult.getMsgCode());
result.setMsg(commonResult.getMsg());
result.setData(data==null?null:String.valueOf(data));
return result;
}
}

@ -5,8 +5,8 @@ import com.docus.core.util.Func;
import com.docus.infrastructure.core.exception.BaseException;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.infrastructure.web.api.ResultCode;
import com.docus.server.message.api.CollectTaskService;
import com.docus.server.message.api.dto.CompensateTaskDTO;
import com.docus.server.message.feign.service.CollectTaskService;
import com.docus.server.message.feign.dto.CompensateTasRequest;
import com.docus.server.message.busservice.SdBusinessService;
import com.docus.server.message.config.CollectTaskConfig;
import com.docus.server.message.dto.Message;
@ -88,7 +88,7 @@ public class SdBusinessServiceImpl implements SdBusinessService {
}
private void compensateTask(List<String> patientIds, List<String> collectorIds) {
CompensateTaskDTO dto = new CompensateTaskDTO();
CompensateTasRequest dto = new CompensateTasRequest();
dto.setPatientIds(patientIds);
dto.setCollectorIds(collectorIds);
dto.setPriority(4);

@ -1,4 +1,4 @@
package com.docus.server.message.api.dto;
package com.docus.server.message.feign.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -17,7 +17,7 @@ import java.util.List;
*/
@Data
@ApiModel("任务补偿下发参数")
public class CompensateTaskDTO {
public class CompensateTasRequest {
/**
*
*/

@ -0,0 +1,23 @@
package com.docus.server.message.feign.service;
import com.docus.infrastructure.web.api.CommonResult;
import com.docus.server.message.feign.dto.CompensateTasRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
/**
* @author wyb
*/
@FeignClient(url = "${docus.url.compensate-task-url}",name = "view-collect-task")
public interface CollectTaskService {
/**
*,
* @param dto
* @return
*/
@RequestMapping(value = "api/NoViewCollect/compensateTask",method = RequestMethod.POST)
CommonResult<String> compensateTask(@RequestBody CompensateTasRequest dto);
}

@ -47,7 +47,7 @@ spring:
docus:
url:
# 采集任务补偿地址
compensate-task-url: http://localhost:9295/api/NoViewCollect/compensateTask
compensate-task-url: http://localhost:9295/
# 下载地址
down-url: http://localhost:9291/api/downplatform/report

Loading…
Cancel
Save