FinanceController.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package com.uas.platform.home.controller;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.uas.platform.home.core.support.SystemSession;
  5. import com.uas.platform.home.model.HttpAddress;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import org.springframework.web.servlet.ModelAndView;
  10. /**
  11. * created by shicr on 2017/11/23
  12. **/
  13. @RestController
  14. @RequestMapping("/finance")
  15. public class FinanceController {
  16. @Autowired
  17. private HttpAddress httpAddress;
  18. @RequestMapping
  19. public ModelAndView getFinancePage(){
  20. return new ModelAndView("finance");
  21. }
  22. @RequestMapping(value = "/loan")
  23. public String loan(String jsonStr) {
  24. JSONObject jsonObject = JSON.parseObject(jsonStr);
  25. String url = httpAddress.getLoanAddress();
  26. if (null != SystemSession.getUser() && null != SystemSession.getUser().getDialectUID()) {
  27. jsonObject.putAll(JSON.parseObject(JSON.toJSONString(SystemSession.getUser())));
  28. url = url + "?UID=" + Long.parseLong(SystemSession.getUser().getDialectUID());
  29. }
  30. com.uas.sso.common.util.HttpUtil.ResponseWrap res = null;
  31. try {
  32. res = com.uas.sso.common.util.HttpUtil.doPost(url, jsonObject);
  33. if(res.isSuccess()) {
  34. return "申请成功";
  35. }
  36. } catch (Exception e) {
  37. e.printStackTrace();
  38. }
  39. return "申请失败";
  40. }
  41. }