适配IResult,让ws和被动http自动适配不同返回值

segment2.0
beeajax 2 years ago
parent f5188f5685
commit 898668a70a

@ -1,11 +1,18 @@
package com.docus.server.collect.basic.http; package com.docus.server.collect.basic.http;
import com.docus.infrastructure.web.api.CommonResult; import com.docus.infrastructure.web.api.CommonResult;
import com.docus.log.context.TrackContext;
import com.docus.server.ws.IHttpResult; import com.docus.server.ws.IHttpResult;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map; import java.util.Map;
/**
* httpcontroller
*
* @see com.docus.server.collect.controller.BasicController#insertHttpPassiveBasic(String)
* @see com.docus.server.visitor.VisitorProcessor#doProcess(TrackContext)
*/
@Component("httpBasicResultImpl") @Component("httpBasicResultImpl")
public class HttpBasicResultImpl implements IHttpResult { public class HttpBasicResultImpl implements IHttpResult {

@ -8,6 +8,12 @@ import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/**
* http,
*
* @see IHttpCollector
* @see com.docus.server.collect.job.basic.TBasicHttpCollectJob#getTBasics(Date, Date, long, long)
*/
@Component("httpTBasicCollectorImpl") @Component("httpTBasicCollectorImpl")
public class HttpTBasicCollectorImpl implements IHttpCollector<TBasicDTO> { public class HttpTBasicCollectorImpl implements IHttpCollector<TBasicDTO> {
@Override @Override

@ -1,10 +1,17 @@
package com.docus.server.collect.basic.ws; package com.docus.server.collect.basic.ws;
import com.docus.core.util.DateUtil; import com.docus.core.util.DateUtil;
import com.docus.log.context.TrackContext;
import com.docus.server.record.pojo.dto.TBasicDTO; import com.docus.server.record.pojo.dto.TBasicDTO;
import com.docus.server.ws.convert.IConverter; import com.docus.server.ws.convert.IConverter;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/**
*
*
* @see com.docus.server.ws.impl.BasicServerImpl#setTBasic(String)
* @see com.docus.server.visitor.VisitorProcessor#beforeProcess(TrackContext)
*/
@Component("tBasicConverter") @Component("tBasicConverter")
public class TBasicConverter implements IConverter<TBasicDTO> { public class TBasicConverter implements IConverter<TBasicDTO> {

@ -2,12 +2,19 @@ package com.docus.server.collect.basic.ws;
import com.docus.core.util.DateUtil; import com.docus.core.util.DateUtil;
import com.docus.core.util.Func; import com.docus.core.util.Func;
import com.docus.log.context.TrackContext;
import com.docus.server.ws.IWsResult; import com.docus.server.ws.IWsResult;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Date; import java.util.Date;
import java.util.Map; import java.util.Map;
/**
* webservicecontroller
*
* @see com.docus.server.ws.impl.BasicServerImpl#setTBasic(String)
* @see com.docus.server.visitor.VisitorProcessor#doProcess(TrackContext)
*/
@Component("wsBasicResultImpl") @Component("wsBasicResultImpl")
public class WsBasicResultImpl implements IWsResult { public class WsBasicResultImpl implements IWsResult {

@ -36,8 +36,7 @@ public class VisitorProcessor extends AbstractProcessor {
if (Func.isEmpty(message)) { if (Func.isEmpty(message)) {
throw new RuntimeException("参数为空"); throw new RuntimeException("参数为空");
} }
Object convert = converter.convert(message, context.getMethodName()); String jsonStr = JSON.toJSON(converter.convert(message, context.getMethodName()));
String jsonStr = JSON.toJSON(convert);
Long taskId = messageService.insertTaskOriginalMessage(jsonStr, message, IIntegerEnum.fromDisplay(CollectTypeEnum.class, context.getGroup())); Long taskId = messageService.insertTaskOriginalMessage(jsonStr, message, IIntegerEnum.fromDisplay(CollectTypeEnum.class, context.getGroup()));
Map<String, Object> params = context.getParams(); Map<String, Object> params = context.getParams();
params.put("taskId", taskId); params.put("taskId", taskId);

Loading…
Cancel
Save