| @@ -578,7 +578,7 @@ public class PosServiceImpl implements PosService { | |||||
| } | } | ||||
| // 3. 满减券检查使用金额 | // 3. 满减券检查使用金额 | ||||
| if (couponType.equals(EnumCouponType.COUPON_MANJIAN.getCode())) { | |||||
| if (couponType.equals(EnumCouponType.COUPON_MANJIAN)) { | |||||
| if (promotionCalc.getOrderAmount() < couponOrderCVo.getUsePrice()) { | if (promotionCalc.getOrderAmount() < couponOrderCVo.getUsePrice()) { | ||||
| logger.error(ErrorCode.VERIFY_MANJIAN_USER_PRICE_NOT_TOUCH.getMessage()); | logger.error(ErrorCode.VERIFY_MANJIAN_USER_PRICE_NOT_TOUCH.getMessage()); | ||||
| throw new MallinkException(ErrorCode.VERIFY_MANJIAN_USER_PRICE_NOT_TOUCH); | throw new MallinkException(ErrorCode.VERIFY_MANJIAN_USER_PRICE_NOT_TOUCH); | ||||
| @@ -590,9 +590,20 @@ public class PosServiceImpl implements PosService { | |||||
| retObj.put(WxPayConstant.TITLE, couponOrderCVo.getTitle()); | retObj.put(WxPayConstant.TITLE, couponOrderCVo.getTitle()); | ||||
| retObj.put(WxPayConstant.COUPON_TYPE, couponType.getMessage()); | retObj.put(WxPayConstant.COUPON_TYPE, couponType.getMessage()); | ||||
| retObj.put(WxPayConstant.COVER_IMG, couponOrderCVo.getCoverImg()); | retObj.put(WxPayConstant.COVER_IMG, couponOrderCVo.getCoverImg()); | ||||
| retObj.put(WxPayConstant.PRICE, String.valueOf(couponOrderCVo.getPrice())); | |||||
| retObj.put(WxPayConstant.SALE_PRICE, String.valueOf(couponOrderCVo.getSalePrice())); | |||||
| retObj.put(WxPayConstant.COUPON_DES, String.format("过期时间: %s", mydateFormat.format(couponOrderCVo.getExpiredTime()))); | |||||
| retObj.put(WxPayConstant.PRICE, couponOrderCVo.getPrice()); | |||||
| retObj.put(WxPayConstant.SALE_PRICE, couponOrderCVo.getSalePrice()); | |||||
| if (couponType.equals(EnumCouponType.COUPON_MANJIAN)) { | |||||
| retObj.put(WxPayConstant.USE_PRICE, couponOrderCVo.getSalePrice()); | |||||
| String des = String.format("%s-满%s元可用,可抵%s元, 过期时间: %s", | |||||
| couponType.getMessage(), couponOrderCVo.getUsePriceStr(), couponOrderCVo.getPriceStr(), | |||||
| mydateFormat.format(couponOrderCVo.getExpiredTime())); | |||||
| retObj.put(WxPayConstant.COUPON_DES, des); | |||||
| } else { | |||||
| String des = String.format("%s-可抵%s元, 过期时间: %s", | |||||
| couponType.getMessage(), couponOrderCVo.getPriceStr(), | |||||
| mydateFormat.format(couponOrderCVo.getExpiredTime())); | |||||
| retObj.put(WxPayConstant.COUPON_DES, des); | |||||
| } | |||||
| if (couponSelected) { | if (couponSelected) { | ||||
| retObj.put(WxPayConstant.IS_SELECTED, String.valueOf(EnumPosSelect.SELECTED.getCode())); | retObj.put(WxPayConstant.IS_SELECTED, String.valueOf(EnumPosSelect.SELECTED.getCode())); | ||||
| Integer remainAmount = promotionCalc.getAmountLeftAfterPay() - couponOrderCVo.getPrice(); | Integer remainAmount = promotionCalc.getAmountLeftAfterPay() - couponOrderCVo.getPrice(); | ||||
| @@ -183,9 +183,9 @@ public class PosAppTest { | |||||
| public void checkPayCalcTest() throws Exception { | public void checkPayCalcTest() throws Exception { | ||||
| String memId = "321178010928119808"; | String memId = "321178010928119808"; | ||||
| String phone = "13910154397"; | String phone = "13910154397"; | ||||
| String orderAmount = "2000"; | |||||
| String orderAmountLeft = "2000"; | |||||
| String selCoList = "[]"; | |||||
| String orderAmount = "20000"; | |||||
| String orderAmountLeft = "20000"; | |||||
| String selCoList = "[\"321878185355214848\"]"; | |||||
| String sceneType = String.valueOf(EnumPosSceneType.PAY.getCode()); | String sceneType = String.valueOf(EnumPosSceneType.PAY.getCode()); | ||||
| Map<String, String> reqObj = new HashMap<>(); | Map<String, String> reqObj = new HashMap<>(); | ||||
| reqObj.put(WxPayConstant.NONCE_STR, "1"); | reqObj.put(WxPayConstant.NONCE_STR, "1"); | ||||
| @@ -8,6 +8,7 @@ import lombok.ToString; | |||||
| import javax.persistence.Id; | import javax.persistence.Id; | ||||
| import javax.persistence.Transient; | import javax.persistence.Transient; | ||||
| import java.math.BigDecimal; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.List; | import java.util.List; | ||||
| @@ -82,4 +83,34 @@ public class WxCouponOrderCVo extends WxCouponOrder { | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") | @io.swagger.annotations.ApiModelProperty(value="商户列表",name="merchantVoList") | ||||
| private List<WxMerchantVo> merchantVoList; | private List<WxMerchantVo> merchantVoList; | ||||
| @Transient | |||||
| private String salePriceStr; | |||||
| @Transient | |||||
| private String usePriceStr; | |||||
| @Transient | |||||
| private String priceStr; | |||||
| public String getSalePriceStr() { | |||||
| if(salePrice!=null) { | |||||
| salePriceStr = new BigDecimal(salePrice).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return salePriceStr; | |||||
| } | |||||
| public String getUsePriceStr() { | |||||
| if(usePrice!=null) { | |||||
| usePriceStr = new BigDecimal(usePrice).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return usePriceStr; | |||||
| } | |||||
| public String getPriceStr() { | |||||
| if(price!=null) { | |||||
| priceStr = new BigDecimal(price).divide(new BigDecimal(100)).toString(); | |||||
| } | |||||
| return priceStr; | |||||
| } | |||||
| } | } | ||||
| @@ -49,6 +49,8 @@ public class WxPayConstant { | |||||
| public final static String VALID_START_DATE = "valid_start_date"; | public final static String VALID_START_DATE = "valid_start_date"; | ||||
| public final static String VALID_END_DATE = "valid_end_date"; | public final static String VALID_END_DATE = "valid_end_date"; | ||||
| public final static String PRICE = "price"; | public final static String PRICE = "price"; | ||||
| public final static String SALE_PRICE = "sale_price"; | |||||
| public final static String USE_PRICE = "use_price"; | |||||
| public final static String STATUS = "status"; | public final static String STATUS = "status"; | ||||
| public final static String STATUS_DES = "status_des"; | public final static String STATUS_DES = "status_des"; | ||||
| @@ -98,7 +100,7 @@ public class WxPayConstant { | |||||
| public final static String CREDIT = "credit"; | public final static String CREDIT = "credit"; | ||||
| public final static String REAL_AMOUNT = "real_amount"; | public final static String REAL_AMOUNT = "real_amount"; | ||||
| public final static String SALE_PRICE = "sale_price"; | |||||
| public final static String SALE_FEE = "sale_fee"; | public final static String SALE_FEE = "sale_fee"; | ||||
| public final static String ORG_AMOUNT = "org_amount"; | public final static String ORG_AMOUNT = "org_amount"; | ||||