| | |
| | | package com.nq.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.nq.dao.*; |
| | | import com.nq.enums.EStockType; |
| | |
| | | |
| | | import com.nq.common.ServerResponse; |
| | | |
| | | import com.nq.utils.*; |
| | | import com.nq.utils.http.HttpClientUtil; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.nq.utils.timeutil.TimeUtil; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import org.slf4j.Logger; |
| | |
| | | AgentUserMapper agentUserMapper; |
| | | |
| | | @Autowired |
| | | IUserPositionService iUserPositionService; |
| | | |
| | | @Autowired |
| | | IUserBankService iUserBankService; |
| | | |
| | | @Autowired |
| | | ISiteSettingService iSiteSettingService; |
| | | |
| | | @Autowired |
| | | ISiteProductService iSiteProductService; |
| | | |
| | | @Autowired |
| | | UserBankMapper userBankMapper; |
| | |
| | | SiteSettingServiceImpl siteSettingService; |
| | | |
| | | @Autowired |
| | | IStockConfigServices iStockConfigServices; |
| | | |
| | | @Autowired |
| | | UserAssetsMapper userAssetsMapper; |
| | | |
| | | @Resource |
| | | StockTimeSettingMapper stockTimeSettingMapper; |
| | | |
| | | @Autowired |
| | | TransferResponseService transferResponseService; |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ServerResponse outMoney(String amt, String with_Pwd,String accsetType,String bankId,HttpServletRequest request) throws Exception { |
| | | if (StringUtils.isBlank(amt)) { |
| | | return ServerResponse.createByErrorMsg("The parameter cannot be null"); |
| | |
| | | return ServerResponse.createByErrorMsg("最小提现金额:" + siteSetting.getWithMinAmt(),request); |
| | | } |
| | | |
| | | boolean b = getServerResponse(); |
| | | boolean b = getServerResponse(accsetType); |
| | | if (!b) { |
| | | return ServerResponse.createByErrorMsg("提现失败,当前时间已停止提现", request); |
| | | } |
| | |
| | | userWithdraw.setWithStatus(Integer.valueOf(0)); |
| | | BigDecimal withfee = siteSetting.getWithFeePercent().multiply(new BigDecimal(amt)).add(new BigDecimal(siteSetting.getWithFeeSingle().intValue())); |
| | | userWithdraw.setWithFee(withfee); |
| | | userWithdraw.setAccsetType(accsetType); |
| | | int insertCount = this.userWithdrawMapper.insert(userWithdraw); |
| | | if (insertCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("提现成功",request); |
| | |
| | | |
| | | } |
| | | |
| | | private boolean getServerResponse() { |
| | | StockTimeSetting stockTimeSetting = stockTimeSettingMapper.selectOne(new QueryWrapper<StockTimeSetting>().eq("accets_type", EStockType.MX.getCode())); |
| | | private boolean getServerResponse(String accsetType) { |
| | | StockTimeSetting stockTimeSetting = stockTimeSettingMapper.selectOne(new QueryWrapper<StockTimeSetting>().eq("accets_type", accsetType)); |
| | | if (stockTimeSetting == null) { |
| | | return false; |
| | | } |
| | |
| | | User user = this.userMapper.selectById(userWithdraw.getUserId()); |
| | | |
| | | |
| | | UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(EStockType.MX.getCode(), user.getId()); |
| | | UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(EStockType.getDefault().getCode(), user.getId()); |
| | | if (userAssets == null) { |
| | | return ServerResponse.createByErrorMsg("用户资金账户不存在"); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | @Transactional |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public ServerResponse updateState(Integer withId, Integer state, String authMsg, HttpServletRequest request, HttpServletResponse response) throws Exception { |
| | | try { |
| | | UserWithdraw userWithdraw = this.userWithdrawMapper.selectByPrimaryKey(withId); |
| | |
| | | if (user == null) { |
| | | return ServerResponse.createByErrorMsg("用户不存在"); |
| | | } |
| | | UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(EStockType.MX.getCode(), user.getId()); |
| | | UserAssets userAssets = iUserAssetsServices.assetsByTypeAndUserId(EStockType.getDefault().getCode(), user.getId()); |
| | | if (userAssets == null) { |
| | | return ServerResponse.createByErrorMsg("用户资金账户不存在"); |
| | | } |