Authored by Lixiaodi

修改错误

... ... @@ -47,7 +47,7 @@ public class UfoServiceCaller implements ApplicationListener<ContextRefreshedEve
* @param param 方法参数
* @return 返回值
*/
public Object call(String serviceMethod, Object[] param) {
public Object call(String serviceMethod, Object... param) {
logger.info("call ufo service : {}", serviceMethod);
ServiceMethod sm = serviceMap.get(serviceMethod);
if (sm == null) {
... ... @@ -84,15 +84,17 @@ public class UfoServiceCaller implements ApplicationListener<ContextRefreshedEve
Method[] methods = ReflectionUtils.getAllDeclaredMethods(bean.getClass());
for (Method method : methods) {
RequestMapping method_requestMappingAnno = method.getAnnotation(RequestMapping.class);
if (method_requestMappingAnno != null) {
String[] params = method_requestMappingAnno.params();
String tag = "method=";
if (params != null && params.length == 1 && params[1].trim().startsWith(tag)) {
String methodStr = params[1].trim().substring(tag.length());
if (params != null && params.length == 1 && params[0].trim().startsWith(tag)) {
String methodStr = params[0].trim().substring(tag.length());
if (StringUtils.isNotBlank(methodStr)) {
serviceMap.put(methodStr, new ServiceMethod(bean, method));
}
}
}
}
logger.info("Register all ufo service for controller:{} success", bean);
}
}
... ...
... ... @@ -6,14 +6,20 @@ import com.yohoufo.product.response.ProductDetailResp;
import com.yohoufo.product.response.ProductSeriesTemplateResp;
import com.yohoufo.product.response.StorageDataResp;
import com.yohoufo.product.response.StorageLeastPriceResp;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.annotation.IgnoreSession;
import com.yohoufo.common.annotation.IgnoreSignature;
import com.yohoufo.common.caller.UfoServiceCaller;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -22,6 +28,9 @@ public class ProductController {
private final Logger LOG = LoggerFactory.getLogger(ProductController.class);
@Autowired
UfoServiceCaller serviceCaller;
@ApiOperation(name = "ufo.product.data", desc="商品详情")
@IgnoreSignature
@IgnoreSession
... ... @@ -125,6 +134,7 @@ public class ProductController {
@RequestMapping(params = "method=ufo.product.cancelSaleSkup")
public ApiResponse cancelSaleSkup(
@RequestParam(value = "skup", required = false) Integer skup) {
serviceCaller.call("ufo.product.data", 99);
return new ApiResponse(200, "取消卖出成功!", Boolean.TRUE);
}
... ...