|
|
@@ -116,7 +116,10 @@ public class DistributionCashWithdrawalServiceImpl extends ServiceImpl<Distribut
|
|
|
@Override
|
|
|
public Boolean insertByAddBo(DistributionCashWithdrawalAddBo bo) {
|
|
|
if(Validator.isEmpty(bo.getCash())||(bo.getCash().compareTo(BigDecimal.ZERO) == 0)){
|
|
|
- throw new CustomException("金额需大于0");
|
|
|
+ throw new CustomException("金额需大于1");
|
|
|
+ }
|
|
|
+ if((bo.getCash().compareTo(new BigDecimal(1)) <0)||bo.getCash().compareTo(new BigDecimal(200)) >0){
|
|
|
+ throw new CustomException("金额需大于1小于200");
|
|
|
}
|
|
|
DistributionCashWithdrawal add = BeanUtil.toBean(bo, DistributionCashWithdrawal.class);
|
|
|
DistributionSeller seller = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>()
|
|
|
@@ -304,6 +307,43 @@ public class DistributionCashWithdrawalServiceImpl extends ServiceImpl<Distribut
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean rePayCash(DistributionCheckQueryBo bo) {
|
|
|
+ DistributionCashWithdrawal withdrawal = getOne(new LambdaQueryWrapper<DistributionCashWithdrawal>()
|
|
|
+ .eq(DistributionCashWithdrawal::getCwSn, bo.getCwSn()));
|
|
|
+ if(withdrawal.getCwStatus() != 6){
|
|
|
+ throw new CustomException("非法操作");
|
|
|
+ }
|
|
|
+ DistributionSeller seller = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>()
|
|
|
+ .eq(DistributionSeller::getSellerId, withdrawal.getSellerId()).last("limit 1"));
|
|
|
+ if(Validator.isEmpty(seller)||Validator.isEmpty(seller.getGzhOpenId())){
|
|
|
+ throw new CustomException("非法业务员或不存在openID");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(withdrawal.getCwSn()+nowTime.toString()+"pubilc2022");
|
|
|
+ params.put("stamp", nowTime.toString());
|
|
|
+ params.put("sign", sign);
|
|
|
+ params.put("OpenId", seller.getGzhOpenId());
|
|
|
+ params.put("MchBillno", withdrawal.getCwSn());
|
|
|
+ params.put("Money", withdrawal.getCash().toString());
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.postFormBody(OLD_PAY_HOST, params);
|
|
|
+ log.info("分享红包打款结果"+respone+params.toString(),"");
|
|
|
+ if (!respone.contains("\"Status\":true")) {
|
|
|
+ throw new CustomException("打款请求错误"+respone);
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ throw new CustomException("打款请求错误"+e.getMessage());
|
|
|
+ }
|
|
|
+ withdrawal.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ withdrawal.setCwStatus(5);
|
|
|
+ updateById(withdrawal);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public boolean payCashCallBack(DistributionCashWithdrawalPayBo bo) {
|
|
|
log.info("分享红包打款回调结果"+ JSON.toJSONString(bo),"");
|