| | |
| | | package com.nq.service.impl; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.dao.SitePayMapper; |
| | | import com.nq.dao.UserRechargeMapper; |
| | | import com.nq.enums.EStockType; |
| | | import com.nq.pojo.SitePay; |
| | | import com.nq.pojo.UserRecharge; |
| | | import com.nq.service.ISitePayService; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | @Resource |
| | | SitePayMapper sitePayMapper; |
| | | |
| | | @Resource |
| | | UserRechargeMapper userRechargeMapper; |
| | | |
| | | public ServerResponse add(SitePay sitePay) { |
| | | if (sitePay.getExchangeRate() <= 0) { |
| | | return ServerResponse.createByErrorMsg("汇率不能小于0"); |
| | | if (StringUtils.isBlank(sitePay.getChannelType()) || |
| | | StringUtils.isBlank(sitePay.getChannelName()) || |
| | | StringUtils.isBlank(sitePay.getChannelAccount()) || sitePay |
| | | |
| | | .getChannelMinLimit() == null || sitePay |
| | | .getChannelMaxLimit() == null || sitePay |
| | | .getIsShow() == null || sitePay |
| | | .getIsLock() == null) { |
| | | return ServerResponse.createByErrorMsg("参数不能为空"); |
| | | } |
| | | |
| | | |
| | |
| | | if (dbSitePay != null) { |
| | | return ServerResponse.createByErrorMsg("支付类型已存在"); |
| | | } |
| | | sitePay.setAssetsType(EStockType.IN.getCode()); |
| | | |
| | | int insertCount = this.sitePayMapper.insert(sitePay); |
| | | if (insertCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("添加成功"); |
| | |
| | | } |
| | | |
| | | |
| | | public ServerResponse getPayInfo(Integer type) { |
| | | List<SitePay> sitePays = this.sitePayMapper.selectList(new LambdaQueryWrapper<SitePay>().eq(SitePay::getIsShow,0) |
| | | .eq(SitePay::getCType,type)); |
| | | public ServerResponse getPayInfo() { |
| | | List<SitePay> sitePays = this.sitePayMapper.getPayInfo(); |
| | | return ServerResponse.createBySuccess(sitePays); |
| | | } |
| | | |
| | | |
| | | public ServerResponse getPayInfoById(Integer payId) { |
| | | return ServerResponse.createBySuccess(this.sitePayMapper.selectByPrimaryKey(payId)); |
| | | } |
| | | |
| | | @Override |
| | | public ServerResponse listByPayType(Integer id) { |
| | | List<SitePay> payList = new ArrayList<>(); |
| | | if (id==null||id<1){ |
| | | return ServerResponse.createByErrorMsg("param is null"); |
| | | } |
| | | UserRecharge userRecharge = userRechargeMapper.selectById(id); |
| | | Integer payType = userRecharge.getPayType(); |
| | | if (payType!=null){ |
| | | if (payType==1){ |
| | | payList = sitePayMapper.listByPayType(0); |
| | | } else if (payType==2) { |
| | | payList = sitePayMapper.listByPayType(1); |
| | | } |
| | | }else { |
| | | payList = sitePayMapper.listByAdmin(null); |
| | | } |
| | | return ServerResponse.createBySuccess(payList); |
| | | } |
| | | } |