| | |
| | | package com.nq.controller.protol; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.crypto.Mode; |
| | | import cn.hutool.crypto.Padding; |
| | | import com.google.common.collect.Maps; |
| | | import com.google.gson.Gson; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.enums.EStockType; |
| | | import com.nq.pojo.*; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | import com.nq.utils.translate.GoogleTranslateUtil; |
| | | import com.nq.utils.SymmetricCryptoUtil; |
| | | import com.nq.vo.stock.UserStockSubscribeAddIn; |
| | | import org.apache.ibatis.annotations.Property; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Controller |
| | |
| | | IFileUploadService iFileUploadService; |
| | | |
| | | @Autowired |
| | | IUserIndexPositionService iUserIndexPositionService; |
| | | |
| | | @Autowired |
| | | IUserFuturesPositionService iUserFuturesPositionService; |
| | | |
| | | @Autowired |
| | | IUserStockSubscribeService iUserStockSubscribeService; |
| | | @Autowired |
| | | IStockSubscribeService iStockSubscribeService; |
| | |
| | | |
| | | @Autowired |
| | | IRateServices rateServices; |
| | | |
| | | @Autowired |
| | | IUserRechargeService iUserRechargeService; |
| | | |
| | | @Autowired |
| | | PayServiceImpl payService; |
| | |
| | | //一键用户平仓操作 |
| | | @RequestMapping({"allsell.do"}) |
| | | @ResponseBody |
| | | public ServerResponse allsell(@RequestParam("stockType") String positionSn,HttpServletRequest request) { |
| | | public ServerResponse allsell(HttpServletRequest request) { |
| | | try { |
| | | return this.iUserPositionService.allSell(request,positionSn); |
| | | return this.iUserPositionService.allSell(request); |
| | | } catch (Exception e) { |
| | | return ServerResponse.createByErrorMsg("Sell Fail",request); |
| | | } |
| | |
| | | |
| | | @RequestMapping({"auth.do"}) |
| | | @ResponseBody |
| | | public ServerResponse auth(String realName, String idCard,String vaildNumber ,String img1key, String img2key, String img3key, HttpServletRequest request) { |
| | | return this.iUserService.auth(realName, idCard, vaildNumber,img1key, img2key, img3key, request); |
| | | public ServerResponse auth(String realName, String idCard, Integer realType,String vaildNumber ,String img1key, String img2key, String img3key, HttpServletRequest request) { |
| | | return this.iUserService.auth(realName, idCard, realType, vaildNumber,img1key, img2key, img3key, request); |
| | | } |
| | | |
| | | //图片上传 |
| | |
| | | return ServerResponse.createBySuccess(fileMap); |
| | | } |
| | | return serverResponse; |
| | | } |
| | | |
| | | /** |
| | | * 新股列表 |
| | | * @param pageNum |
| | | * @param pageSize |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @RequestMapping({"getStockSubscribeList.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getStockSubscribeList(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | HttpServletRequest request) { |
| | | return this.iStockSubscribeService.listPageInfo(pageNum, pageSize, request); |
| | | } |
| | | |
| | | |
| | |
| | | /*新股申购-用户新股申购数据*/ |
| | | @RequestMapping({"getOneSubscribeByUserId.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getOneSubscribeByUserId(@RequestParam(value ="type",required = false)String type, HttpServletRequest request) { |
| | | return this.iUserStockSubscribeService.getOneSubscribeByUserId(type,request); |
| | | public ServerResponse getOneSubscribeByUserId(@RequestParam(value ="type",required = false)String type, |
| | | @RequestParam(value ="status",required = false)Integer status, |
| | | HttpServletRequest request) { |
| | | return this.iUserStockSubscribeService.getOneSubscribeByUserId(type, status, request); |
| | | } |
| | | |
| | | /*新股申购-用户新股申购数据分页*/ |
| | | @RequestMapping({"getOneSubscribeByUserIdPage.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getOneSubscribeByUserIdPage(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") int pageSize, |
| | | @RequestParam(value ="type",required = false)String type, |
| | | @RequestParam(value ="status",required = false)Integer status, |
| | | HttpServletRequest request) { |
| | | return this.iUserStockSubscribeService.getOneSubscribeByUserIdPage(pageNum, pageSize, type, status, request); |
| | | } |
| | | |
| | | /*新股申购-用户提交金额*/ |
| | |
| | | @ResponseBody |
| | | public ServerResponse transfer(@RequestParam("fromType") String fromType, @RequestParam("toType") String toType, |
| | | @RequestParam("amt") String amt, HttpServletRequest request) { |
| | | return iUserService.transfer(fromType, toType, amt,request); |
| | | try { |
| | | if (fromType.equals(toType)) { |
| | | return ServerResponse.createByErrorMsg("货币类型不能相同", request); |
| | | } |
| | | return iUserService.transfer(fromType, toType, amt,request); |
| | | } catch (Exception e) { |
| | | return ServerResponse.createByErrorMsg(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | return iApplyLeverServices.applyLever(applyLever,request); |
| | | } |
| | | |
| | | @RequestMapping({"getPassword.do"}) |
| | | @ResponseBody |
| | | public ServerResponse getPassword(HttpServletRequest request) { |
| | | User user = this.iUserService.getCurrentRefreshUser(request); |
| | | if(ObjectUtil.isEmpty(user)){ |
| | | return ServerResponse.createByErrorMsg("获取用信息失败,请重新登录!",request); |
| | | } |
| | | String pwd = SymmetricCryptoUtil.decryptFromString(user.getUserPwd(), Mode.CBC, Padding.ZeroPadding); |
| | | return ServerResponse.createBySuccess(pwd); |
| | | } |
| | | |
| | | /** |
| | | * 充值第三方支付 |
| | | */ |
| | | @RequestMapping({"thirdPartyRecharge.do"}) |
| | | @ResponseBody |
| | | public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,HttpServletRequest request) { |
| | | payLock.lock(); |
| | | public ServerResponse thirdPartyRecharge(@RequestParam("tradeAmoun") String tradeAmoun,@RequestParam("type") Integer type,HttpServletRequest request) { |
| | | return ServerResponse.createByErrorMsg("尊敬的会员您好,充值请联系客服", request); |
| | | /*payLock.lock(); |
| | | try { |
| | | if (payCreated.get()) { |
| | | return ServerResponse.createByErrorMsg("当前充值人数过多,请稍后重试", request); |
| | | } |
| | | if (!isIntegerGreaterThan100(tradeAmoun)) { |
| | | return ServerResponse.createByErrorMsg("请输入整数!",request); |
| | | } |
| | | if(null == type){ |
| | | return ServerResponse.createByErrorMsg("请选择支付通道!",request); |
| | | } |
| | | if(new BigDecimal(tradeAmoun).compareTo(new BigDecimal("1000")) < 0){ |
| | | return ServerResponse.createByErrorMsg("请重新输入,最低充值金额:1000", request); |
| | | } |
| | | |
| | | payCreated.set(true); |
| | | return payService.thirdPartyRecharge(request,tradeAmoun); |
| | | return payService.thirdPartyRecharge(request,tradeAmoun,type); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ServerResponse.createByErrorMsg("获取充值链接异常,请稍后重试", request); |
| | | } finally{ |
| | | payLock.unlock(); |
| | | payCreated.set(false); |
| | | }*/ |
| | | } |
| | | // 判断字符串是否是整数且大于100 |
| | | public static boolean isIntegerGreaterThan100(String str) { |
| | | try { |
| | | int number = Integer.parseInt(str); // 尝试将字符串转换为整数 |
| | | return number > 100; // 判断是否大于100 |
| | | } catch (NumberFormatException e) { |
| | | return false; // 如果转换失败,说明不是整数 |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 充值1异步接收地址 |
| | | */ |
| | | @PostMapping({"rechargeCallback.do"}) |
| | | public void rechargeCallback(PaymentResponse vo, HttpServletResponse response) throws IOException { |
| | | payService.rechargeCallback(vo,response); |
| | | } |
| | | |
| | | /** |
| | | * 充值异步接收地址 |
| | | * 充值2异步接收地址 |
| | | */ |
| | | @RequestMapping({"rechargeCallback.do"}) |
| | | @ResponseBody |
| | | public void rechargeCallback(HttpServletResponse response,RechargeCallbackVo rechargeCallbackVo) throws IOException { |
| | | payService.rechargeCallback(response,rechargeCallbackVo); |
| | | @PostMapping({"rechargeCallbackTwo.do"}) |
| | | public void rechargeCallbackTwo(TransactionStatusVo vo, HttpServletResponse response) throws IOException { |
| | | payService.rechargeCallbackTwo(vo,response); |
| | | } |
| | | } |