|
@@ -24,10 +24,12 @@ import com.miaxis.framework.web.service.TokenService;
|
|
|
import com.miaxis.system.service.ISysConfigService;
|
|
|
import com.miaxis.user.service.IUserInfoService;
|
|
|
import com.miaxis.wx.domain.WxExtract;
|
|
|
+import com.miaxis.wx.domain.WxExtractBank;
|
|
|
import com.miaxis.wx.domain.WxOrder;
|
|
|
import com.miaxis.wx.dto.QuerySchoolOrderListDTO;
|
|
|
import com.miaxis.wx.dto.WxExtractBankDTO;
|
|
|
import com.miaxis.wx.mapper.WxOrderMapper;
|
|
|
+import com.miaxis.wx.service.IWxExtractBankService;
|
|
|
import com.miaxis.wx.service.IWxExtractService;
|
|
|
import com.miaxis.wx.service.IWxGzhService;
|
|
|
import com.miaxis.wx.service.IWxOrderService;
|
|
@@ -38,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
@@ -88,6 +91,9 @@ public class WxOrderServiceImpl extends ServiceImpl<WxOrderMapper, WxOrder> impl
|
|
|
@Autowired
|
|
|
private IWxExtensionIncomeService wxExtensionIncomeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IWxExtractBankService wxExtractBankService;
|
|
|
+
|
|
|
@Value("${app.appid}")
|
|
|
private String appid;
|
|
|
|
|
@@ -164,6 +170,9 @@ public class WxOrderServiceImpl extends ServiceImpl<WxOrderMapper, WxOrder> impl
|
|
|
public String wxwithbankdrawal(WxExtractBankDTO dto) throws Exception {
|
|
|
UserInfo student = SecurityUtils.getLoginUser().getStudent();
|
|
|
UserInfo dbUserInfo = userInfoService.getById(student.getId());
|
|
|
+ if (dbUserInfo.getSaleType()!= 2 && dbUserInfo.getSaleType()!= 3){
|
|
|
+ throw new CustomException("该用户类型不支持银行卡提现");
|
|
|
+ }
|
|
|
if (dbUserInfo.getProfitPrice() < dto.getAmount()){
|
|
|
throw new CustomException("提现金额不能大于可提现金额");
|
|
|
}
|
|
@@ -176,13 +185,13 @@ public class WxOrderServiceImpl extends ServiceImpl<WxOrderMapper, WxOrder> impl
|
|
|
sortMap.put("desc","用户银行卡提现");
|
|
|
|
|
|
|
|
|
- String rsa ="RSA/ECB/OAEPWITHSHA-1ANDMGF1PADDING";
|
|
|
+
|
|
|
|
|
|
// 进行签名服务
|
|
|
|
|
|
sortMap.put("enc_true_name",rsaUtils.encryptData(dto.getEncTrueName()) );
|
|
|
sortMap.put("enc_bank_no",rsaUtils.encryptData(dto.getEncBankNo()));
|
|
|
- sortMap.put("bank_code",dto.getBankCode());
|
|
|
+ sortMap.put("bank_code",dto.getBankCode().toString());
|
|
|
|
|
|
|
|
|
WXPayConfig config = new WxPayConfigImpl();
|
|
@@ -205,6 +214,18 @@ public class WxOrderServiceImpl extends ServiceImpl<WxOrderMapper, WxOrder> impl
|
|
|
wxExtract.setStatus("1");
|
|
|
wxExtractService.save(wxExtract);
|
|
|
|
|
|
+ //如果此卡之前未存储,则加入到银行卡列表
|
|
|
+ List<WxExtractBank> bankList = wxExtractBankService.list(new QueryWrapper<WxExtractBank>().eq("enc_bank_no", dto.getEncBankNo()));
|
|
|
+ if (CollectionUtils.isEmpty(bankList)){
|
|
|
+ WxExtractBank wxExtractBank = new WxExtractBank();
|
|
|
+ wxExtractBank.setBankCode(dto.getBankCode());
|
|
|
+ wxExtractBank.setEncBankNo(dto.getEncBankNo());
|
|
|
+ wxExtractBank.setEncTrueName(dto.getEncTrueName());
|
|
|
+ wxExtractBank.setOpenid(SecurityUtils.getLoginUser().getStudent().getOpenid());
|
|
|
+ wxExtractBankService.save(wxExtractBank);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
//更新余额
|
|
|
dbUserInfo.setProfitPrice(dbUserInfo.getProfitPrice()-dto.getAmount());
|
|
|
userInfoService.updateById(dbUserInfo);
|