Merge branch 'lyf' of https://e.coding.net/g-cphe0354/shouyinjixitong/wx-cashier-service into lyf
This commit is contained in:
commit
e25935624e
|
|
@ -300,7 +300,7 @@ public class PayService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!"unpaid".equals(orderInfo.getStatus())) {
|
if (!"unpaid".equals(orderInfo.getStatus()) && !"paying".equals(orderInfo.getStatus()) ) {
|
||||||
return Result.fail("订单出状态异常");
|
return Result.fail("订单出状态异常");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -313,11 +313,11 @@ public class PayService {
|
||||||
|
|
||||||
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(memberId);
|
TbShopUser user = tbShopUserMapper.selectByPrimaryKey(memberId);
|
||||||
if (ObjectUtil.isEmpty(user) || !"1".equals(user.getIsVip().toString())) {
|
if (ObjectUtil.isEmpty(user) || !"1".equals(user.getIsVip().toString())) {
|
||||||
return Result.fail("用户非会员");
|
return Result.failCode("会员卡余额不足","1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (N.gt(orderInfo.getPayAmount(), user.getAmount())) {
|
if (N.gt(orderInfo.getPayAmount(), user.getAmount())) {
|
||||||
return Result.fail("会员卡余额不足");
|
return Result.failCode("会员卡余额不足","2");
|
||||||
}
|
}
|
||||||
|
|
||||||
user.setAmount(user.getAmount().subtract(orderInfo.getOrderAmount()));
|
user.setAmount(user.getAmount().subtract(orderInfo.getOrderAmount()));
|
||||||
|
|
@ -886,7 +886,10 @@ public class PayService {
|
||||||
|
|
||||||
log.info("发送打印数据");
|
log.info("发送打印数据");
|
||||||
producer.printMechine(orderInfo.getId() + "");
|
producer.printMechine(orderInfo.getId() + "");
|
||||||
|
JSONObject coupons = new JSONObject();
|
||||||
|
coupons.put("type","buy");
|
||||||
|
coupons.put("orderId",orderInfo.getId().toString());
|
||||||
|
producer.printCoupons(coupons.toJSONString());
|
||||||
return "SUCCESS";
|
return "SUCCESS";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,15 @@ public class Result {
|
||||||
dto.setIcon(CodeEnum.FAIL.getIcon());
|
dto.setIcon(CodeEnum.FAIL.getIcon());
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
public static Result failCode(String msg,String data) {
|
||||||
|
Result dto = new Result();
|
||||||
|
dto.setMsg(msg);
|
||||||
|
dto.setEncrypt(false);
|
||||||
|
dto.setCode("1");
|
||||||
|
dto.setData(data);
|
||||||
|
dto.setIcon(CodeEnum.FAIL.getIcon());
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
public static Result failure(IError error) {
|
public static Result failure(IError error) {
|
||||||
Result dto = new Result();
|
Result dto = new Result();
|
||||||
dto.setMsg(error.getErrorMessage());
|
dto.setMsg(error.getErrorMessage());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue