集成接口发布

@Controller

@RequestMapping(value = "/MyController")

public class MyController {


private static final Logger LOGGER = LogR.getLogger(MyController.class.getName());

/**

  *

  * @param requestParameter 入参是json数组格式的字符串

  * @return

  * @throws JSONException

  */

@ResponseBody

@RequestMapping(value = "/MyMethod",method = RequestMethod.POST)

public MyVo MyMethod(String requsetParameter){

  MyVo myVo = null;

  try {

  //乱码处理

  requsetParameter = new String(requsetParameter.getBytes("iso-8859-1"),"utf-8");

  LOGGER.info(String.format(">>>MyController.saveOrUpdateMethod>>> requsetParameter:%s",requsetParameter));

  //入参判断

  if(StringUtils.isBlank(requsetParameter)){ 

    return new MyVo(MyVo.FAIL,MyVo.NOT_NULL,MyVo.FAIL_CODE);

  }

  myVo = MyService.saveOrUpdateMethod(requsetParameter);

  } catch (Exception e) {

  LOGGER.error(">>>MyService.saveOrUpdateMethod<<<执行异常", e);

  return new MyVo(MyVo.FAIL,MyVo.MSG_FAIL,MyVo.FAIL_CODE);

  }

  return myVo;

}

}

你可能感兴趣的:(集成接口发布)