package com.lyms.hospital.controller; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import org.apache.commons.lang3.builder.ToStringBuilder; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.lyms.sync.ParamsAdpter; import com.lyms.sync.SyncHandler; import com.lyms.sync.SyncUtils; import com.lyms.sync.channel.ChannelData; import com.lyms.web.controller.BaseController; /** *
  • @ClassName: RouterController *
  • @Description: 远程接口调用数据处理分发 *
  • @author maliang *
  • @date 2017年3月14日 *
  • */ @RestController @RequestMapping("/remote") public class RouterController extends BaseController { @RequestMapping(value = "/sycn", produces = { MediaType.APPLICATION_JSON_VALUE }) public Object remote(HttpServletRequest request) throws ClassNotFoundException, IOException { ChannelData data = SyncUtils.conver(request); System.out.println("接受到数据: " + ToStringBuilder.reflectionToString(data)); Object handResult = SyncHandler.handler(data); if (data.getLoop()) { data = (ChannelData) handResult; } else { data.setData(ParamsAdpter.builder().push(handResult).toJsonString()); } data.setAck(true); return data; } }