FinanceController.java 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.uas.platform.home.controller;
  2. import com.uas.platform.home.core.support.SystemSession;
  3. import com.uas.platform.home.core.util.HttpUtil;
  4. import com.uas.platform.home.model.HttpAddress;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RestController;
  8. import java.util.Map;
  9. /**
  10. * created by shicr on 2017/11/23
  11. **/
  12. @RestController
  13. @RequestMapping("/finance")
  14. public class FinanceController {
  15. @Autowired
  16. private HttpAddress httpAddress;
  17. @RequestMapping(value = "/loan")
  18. public String loan(String jsonStr) {
  19. String url = httpAddress.getLoanAddress();
  20. if (null != SystemSession.getUser() && null != SystemSession.getUser().getDialectUID()) {
  21. url = url + "?UID=" + Long.parseLong(SystemSession.getUser().getDialectUID());
  22. }
  23. try {
  24. HttpUtil.Response response = HttpUtil.doPost(url + "?UID=" + "", jsonStr, 5000);
  25. if(200 == response.getStatusCode())
  26. return "success";
  27. } catch (Exception e) {
  28. e.printStackTrace();
  29. }
  30. return "申请失败";
  31. }
  32. }