|
|
@ -19,6 +19,7 @@ import com.cyjd.rights.entity.ConfigEntity; |
|
|
import com.cyjd.rights.enums.AliPayEnum; |
|
|
import com.cyjd.rights.enums.AliPayEnum; |
|
|
import com.cyjd.rights.result.FResult; |
|
|
import com.cyjd.rights.result.FResult; |
|
|
import com.cyjd.rights.utils.OrderUtil; |
|
|
import com.cyjd.rights.utils.OrderUtil; |
|
|
|
|
|
import com.cyjd.rights.utils.PriceUtil; |
|
|
import com.cyjd.rights.vo.AliPayInOrderByAgreementReq; |
|
|
import com.cyjd.rights.vo.AliPayInOrderByAgreementReq; |
|
|
import com.cyjd.rights.vo.AliPayQueryPageSignReq; |
|
|
import com.cyjd.rights.vo.AliPayQueryPageSignReq; |
|
|
import com.cyjd.rights.vo.AliPayTradeQueryReq; |
|
|
import com.cyjd.rights.vo.AliPayTradeQueryReq; |
|
|
@ -33,8 +34,11 @@ import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
import java.math.RoundingMode; |
|
|
import java.time.LocalDateTime; |
|
|
import java.time.LocalDateTime; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
|
|
|
import java.util.concurrent.ThreadLocalRandom; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @author :WXC |
|
|
* @author :WXC |
|
|
@ -95,7 +99,9 @@ public class AliPayController { |
|
|
@ApiOperation(value = "支付宝签约", notes = "前端先调用此接口,由服务端请求支付宝组装scheme地址,之后前端通过该地址唤起支付宝进行签约") |
|
|
@ApiOperation(value = "支付宝签约", notes = "前端先调用此接口,由服务端请求支付宝组装scheme地址,之后前端通过该地址唤起支付宝进行签约") |
|
|
@PostMapping("/signUp") |
|
|
@PostMapping("/signUp") |
|
|
public R signUp(@RequestBody AliPaySignUpDto signUpDto) { |
|
|
public R signUp(@RequestBody AliPaySignUpDto signUpDto) { |
|
|
String price = "19.9"; |
|
|
BigDecimal orderPrice = PriceUtil.getOrderPrice(); |
|
|
|
|
|
String price = orderPrice.toString(); |
|
|
|
|
|
|
|
|
//查询用户31天内是否已经有代扣成功的记录了
|
|
|
//查询用户31天内是否已经有代扣成功的记录了
|
|
|
if (!aliPayOrderService.checkOpen(signUpDto.getMobile())) { |
|
|
if (!aliPayOrderService.checkOpen(signUpDto.getMobile())) { |
|
|
return R.error(ResultCodeEnum.user_month_repeat_open); |
|
|
return R.error(ResultCodeEnum.user_month_repeat_open); |
|
|
@ -332,7 +338,8 @@ public class AliPayController { |
|
|
AliPayInOrderByAgreementReq payInOrderByAgreementReq = new AliPayInOrderByAgreementReq(); |
|
|
AliPayInOrderByAgreementReq payInOrderByAgreementReq = new AliPayInOrderByAgreementReq(); |
|
|
payInOrderByAgreementReq.setAuthCode(agreementNo); |
|
|
payInOrderByAgreementReq.setAuthCode(agreementNo); |
|
|
payInOrderByAgreementReq.setSubject("惠点联合会员"); |
|
|
payInOrderByAgreementReq.setSubject("惠点联合会员"); |
|
|
String price = "19.9"; |
|
|
BigDecimal orderPrice = PriceUtil.getOrderPrice(); |
|
|
|
|
|
String price = orderPrice.toString(); |
|
|
payInOrderByAgreementReq.setTotalAmount(price); |
|
|
payInOrderByAgreementReq.setTotalAmount(price); |
|
|
String outTradeNo = OrderUtil.getOutTradeNo(); |
|
|
String outTradeNo = OrderUtil.getOutTradeNo(); |
|
|
//保存支付的订单号
|
|
|
//保存支付的订单号
|
|
|
@ -534,4 +541,15 @@ public class AliPayController { |
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
BigDecimal bigDecimal = new BigDecimal("19.9"); |
|
|
|
|
|
for (int i = 0; i < 15; i++) { |
|
|
|
|
|
int random = (ThreadLocalRandom.current().nextInt(10)); |
|
|
|
|
|
BigDecimal randomBigDecimal = BigDecimal.valueOf(random); |
|
|
|
|
|
BigDecimal subtract = bigDecimal.subtract(randomBigDecimal.divide(new BigDecimal(100),2, RoundingMode.HALF_UP)); |
|
|
|
|
|
System.out.println(subtract); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|