| | |
| | | package com.nq.controller.echo; |
| | | |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.pojo.User; |
| | | import com.nq.dao.EChoMapper; |
| | | import com.nq.pojo.EChoBean; |
| | | import com.nq.service.IEchoServices; |
| | | import com.nq.service.IUserService; |
| | | import com.nq.utils.translate.GoogleTranslateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | IEchoServices iEchoServices; |
| | | |
| | | @Autowired |
| | | IUserService iUserService; |
| | | EChoMapper eChoMapper; |
| | | |
| | | @PostMapping("queryEcho.do") |
| | | @ResponseBody |
| | |
| | | @PostMapping("buyEcho.do") |
| | | @ResponseBody |
| | | public ServerResponse buyEcho(@RequestParam("eId") String eid, @RequestParam("money") Integer money, HttpServletRequest request) { |
| | | User user = this.iUserService.getCurrentRefreshUser(request); |
| | | if(user == null){ |
| | | return ServerResponse.createByErrorMsg("Please Login"); |
| | | EChoBean eChoBean = eChoMapper.selectById(Integer.parseInt(eid)); |
| | | if (eChoBean == null) { |
| | | return ServerResponse.createByErrorMsg("基金产品不存在",request); |
| | | } else { |
| | | if (null != eChoBean.getBuyLowestNum() && money < eChoBean.getBuyLowestNum()) { |
| | | return ServerResponse.createByErrorMsg("购买失败,最低购买数量:"+eChoBean.getBuyLowestNum(),request); |
| | | } |
| | | } |
| | | if (iEchoServices.buyECho(eid, money,request)) { |
| | | return ServerResponse.createBySuccess("Buy Successed"); |
| | | return ServerResponse.createBySuccess("购买成功",request); |
| | | } else { |
| | | return ServerResponse.createByErrorMsg("Buy Fail"); |
| | | return ServerResponse.createByErrorMsg("购买失败",request); |
| | | } |
| | | } |
| | | |
| | |
| | | @PostMapping("queryOrderEcho.do") |
| | | @ResponseBody |
| | | public ServerResponse queryOrderEcho(HttpServletRequest request) { |
| | | return ServerResponse.createBySuccess(iEchoServices.queryOrderEcho(request)); |
| | | return ServerResponse.createBySuccess(iEchoServices.queryOrderEcho(request)); |
| | | } |
| | | |
| | | |