From c1f351cd639f3c77893dcb33da63a2324aa00759 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Mon, 13 May 2019 17:46:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[=E5=BA=93=E5=AD=98=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]:=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/service/impl/WxCouponServiceImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index db1851910..de1da389d 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -491,29 +491,29 @@ public class WxCouponServiceImpl implements WxCouponService { WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); if(wxCoupon.getInventory() < wxCoupon.getRemainInventory()) { // 总库存数要大于等于可用库存数 - return new ResultData(ErrorCode.COUPON_STOCK_ERR); + return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); } if(wxCoupon.getInventory() <= oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 - return new ResultData(ErrorCode.COUPON_STOCK_ERR); + return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于已售卖数"); } if(wxCoupon.getInventory()-wxCoupon.getRemainInventory() != oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { // 已售卖数不变 - return new ResultData(ErrorCode.COUPON_STOCK_ERR); + return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "已售卖数不变"); } if(wxCoupon.getValidType() != oldCoupon.getValidType()) { // 券有效期类型不能改变 - return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); + return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期类型不能改变"); } if(oldCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { if(wxCoupon.getValidEndDate().before(oldCoupon.getValidEndDate())) { // 券有效期只可增加 - return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR); + return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期只可增加"); } } else { if(wxCoupon.getValidDays() Date: Mon, 13 May 2019 17:49:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[=E5=BA=93=E5=AD=98=E4=BF=AE=E6=94=B9][?= =?UTF-8?q?=E6=96=B0=E5=A2=9E]:=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxCouponServiceImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index de1da389d..cc79a82aa 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -489,30 +489,45 @@ public class WxCouponServiceImpl implements WxCouponService { // 3. check 新的有效期是否合适 // 4. 更新库存及有效期 WxCoupon oldCoupon = wxCouponMapper.selectByPrimaryKey(wxCoupon.getId()); + if(oldCoupon == null) { + logger.error(ErrorCode.COUPON_IS_EMPTY.getMessage()); + return new ResultData(ErrorCode.COUPON_IS_EMPTY); + } + if(wxCoupon.getInventory() < wxCoupon.getRemainInventory()) { + // 总库存数要大于等于可用库存数 + logger.error("总库存数要大于等于可用库存数"); + return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); + } if(wxCoupon.getInventory() < wxCoupon.getRemainInventory()) { // 总库存数要大于等于可用库存数 + logger.error("总库存数要大于等于可用库存数"); return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于等于可用库存数"); } if(wxCoupon.getInventory() <= oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { // 库存可增, 可减, 但是要保证,总库存数要大于已售卖数 + logger.error("总库存数要大于等于可用库存数"); return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "总库存数要大于已售卖数"); } if(wxCoupon.getInventory()-wxCoupon.getRemainInventory() != oldCoupon.getInventory() - oldCoupon.getRemainInventory()) { // 已售卖数不变 + logger.error("已售卖数不变"); return new ResultData(ErrorCode.COUPON_STOCK_ERR.getCode(), "已售卖数不变"); } if(wxCoupon.getValidType() != oldCoupon.getValidType()) { // 券有效期类型不能改变 + logger.error("券有效期类型不能改变"); return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期类型不能改变"); } if(oldCoupon.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())) { if(wxCoupon.getValidEndDate().before(oldCoupon.getValidEndDate())) { // 券有效期只可增加 + logger.error("券有效期只可增加"); return new ResultData(ErrorCode.COUPON_VALID_DATE_ERR.getCode(), "券有效期只可增加"); } } else { if(wxCoupon.getValidDays() Date: Mon, 13 May 2019 21:00:02 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[etcp][=E4=BF=AE=E6=94=B9]:getParkStatus?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/iformall/utils/ETCPUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mallinkService/src/main/java/com/iformall/utils/ETCPUtil.java b/mallinkService/src/main/java/com/iformall/utils/ETCPUtil.java index a6a3c52a4..956883564 100755 --- a/mallinkService/src/main/java/com/iformall/utils/ETCPUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/ETCPUtil.java @@ -702,7 +702,10 @@ public class ETCPUtil { String respStr = doPost(baseUrl + parkingStatusUrl.replaceAll("\\{version}", version), data, sign, timeStamp, merchantNo); - if(respStr.startsWith("")) { + if(respStr == null) { + throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); + } + if(respStr.startsWith("")){ throw new MallinkException(ErrorCode.ETCP_CMD_FAIL); } return respStr;