|
@@ -68,6 +68,9 @@ public class ElectronicMembershipCardController {
|
|
|
private SysDictDataService sysDictDataService;
|
|
|
@Resource
|
|
|
private AppUserInfoService appUserInfoService;
|
|
|
+ @Resource
|
|
|
+ private CouponService couponService;
|
|
|
+
|
|
|
@Value("${yijia.path.global-prefix}")
|
|
|
private String globalPrefix;
|
|
|
|
|
@@ -319,7 +322,7 @@ public class ElectronicMembershipCardController {
|
|
|
@RequestMapping(value = "/dzkPaySet", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
@Transactional
|
|
|
- public String dzkPaySet(@RequestParam String ordNo) throws ParseException {
|
|
|
+ public String dzkPaySet(@RequestParam String ordNo, Integer id) throws ParseException {
|
|
|
Gson gson =new Gson();
|
|
|
ResultData resultData =null;
|
|
|
if(ordNo !=null){
|
|
@@ -415,6 +418,58 @@ public class ElectronicMembershipCardController {
|
|
|
payOrder.setAmt(Double.valueOf(dzkAmt));
|
|
|
payOrder.setWxAmt(Double.valueOf("0"));
|
|
|
payOrder.setDzkAmt(Double.valueOf(dzkAmt));
|
|
|
+
|
|
|
+ BigDecimal amtNew = new BigDecimal(dzkAmt);
|
|
|
+ BigDecimal discountAmtNew = new BigDecimal(discountAmt);
|
|
|
+ //获取该优惠券
|
|
|
+ if(id !=null){
|
|
|
+ UserCoupon userCoupon = new UserCoupon();
|
|
|
+ userCoupon.setId(id);
|
|
|
+ UserCoupon ucResult = couponService.selectUserCouponInfo(userCoupon);
|
|
|
+ if(ucResult !=null){
|
|
|
+ payOrder.setDiscountCoupon(ucResult.getId().toString());
|
|
|
+ BigDecimal couponAmt = ucResult.getCouponAmt();
|
|
|
+ String couponType = ucResult.getCouponType();
|
|
|
+ if(ucResult.getIsCardFlag() !=null && ucResult.getIsCardFlag().equals("1")){
|
|
|
+ switch (couponType){
|
|
|
+ case "1":
|
|
|
+ amtNew = new BigDecimal(dzkAmt).subtract(couponAmt);
|
|
|
+ payOrder.setAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ discountAmtNew = discountAmtNew.add(couponAmt);
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ amtNew = new BigDecimal(dzkAmt).multiply(couponAmt).divide(new BigDecimal("100"));
|
|
|
+ payOrder.setAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ BigDecimal subtract1 = new BigDecimal(dzkAmt).subtract(amtNew);
|
|
|
+ discountAmtNew =subtract1.add(new BigDecimal(discountAmt));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ //表示不共享
|
|
|
+ switch (couponType){
|
|
|
+ case "1":
|
|
|
+ amtNew = new BigDecimal(receivableAmt).subtract(couponAmt);
|
|
|
+ payOrder.setAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(couponAmt.toString()));
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ amtNew = new BigDecimal(receivableAmt).multiply(couponAmt).divide(new BigDecimal("100"));
|
|
|
+ payOrder.setAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ payOrder.setDzkAmt(Double.valueOf(amtNew.toString()));
|
|
|
+ discountAmtNew = new BigDecimal(receivableAmt).subtract(amtNew);
|
|
|
+ payOrder.setDiscountAmt(Double.valueOf(discountAmtNew.toString()));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//payOrder.setTransactionId(ordNo);
|
|
|
//BigDecimal discountAmt = new BigDecimal(receivableAmt).subtract(new BigDecimal(dzkAmt));
|
|
|
//payOrder.setDiscountAmt(Double.valueOf(discountAmt));
|