记得上下班打卡 | git大法好,push需谨慎

Commit df1f0b38 authored by 胡佳晨's avatar 胡佳晨

提交券

parent 6a29283f
......@@ -16,7 +16,7 @@ liquidnet:
pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level: debug
mysql:
database-name: dev_ln_scene
database-name: test_ln_scene
mongodb:
sslEnabled: false
database: dev_ln_scene
\ No newline at end of file
database: test_ln_scene
\ No newline at end of file
......@@ -127,7 +127,27 @@ public class GoblinCouponImpl implements GoblinCouponService {
for (GoblinUserCouponVo vo : voList) {
//判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
if (vo.getUseScope().equals("0")) {
BigDecimal tempPrice = BigDecimal.ZERO;
if (vo.getType().equals("1")) {//代金券
tempPrice = vo.getValFace();
} else if (vo.getType().equals("2")) {//折扣
tempPrice = totalPrice.multiply(vo.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP);
if (tempPrice.compareTo(vo.getDeduction()) > 0) {
tempPrice = vo.getDeduction();
}
} else if (vo.getType().equals("3") && vo.getTriggers().compareTo(totalPrice) <= 0) {//满减
tempPrice = vo.getValMinus();
}
if (maxPrice.compareTo(tempPrice) < 0) {
maxPrice = tempPrice;
returnVo = vo;
}
} else {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
if (spuId == null) {
continue;
}
//判断是否在可用商品内
for (String item : spuIds) {
List<String> spuList = Arrays.asList(spuId.split(","));
......@@ -151,6 +171,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
}
}
}
}
return returnVo;
}
......@@ -160,8 +181,14 @@ public class GoblinCouponImpl implements GoblinCouponService {
List<GoblinUserCouponVo> returnList = ObjectUtil.getGoblinUserCouponVo();
for (GoblinUserCouponVo vo : voList) {
//判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) >= 0) {
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
if (vo.getUseScope().equals("0")) {
returnList.add(vo);
} else {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
if (spuId == null) {
break;
}
//判断是否在可用商品内
for (String item : spuIds) {
List<String> spuList = Arrays.asList(spuId.split(","));
......@@ -172,6 +199,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
}
}
}
}
returnList.sort(Comparator.comparing(GoblinUserCouponVo::getState));
return returnList;
}
......@@ -186,7 +214,32 @@ public class GoblinCouponImpl implements GoblinCouponService {
if (vo.getUcouponId().equals(ucouponId)) {
//判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
if (vo.getUseScope().equals("0")) {
if (vo.getType().equals("1")) {//代金券
returnVo.setValue(vo.getValFace());
returnVo.setCouType(vo.getType());
} else if (vo.getType().equals("2")) {//折扣
BigDecimal tempPrice = totalPrice.multiply(vo.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP);
if (tempPrice.compareTo(vo.getDeduction()) > 0) {
tempPrice = vo.getDeduction();
}
returnVo.setValue(tempPrice);
returnVo.setCouType(vo.getType());
} else if (vo.getType().equals("3") && vo.getTriggers().compareTo(totalPrice) <= 0) {//满减
returnVo.setValue(vo.getValMinus());
returnVo.setCouType(vo.getType());
}
vo.setState(5);
vo.setUsedFor(content);
goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now()));
break;
} else {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
if (spuId == null) {
continue;
}
//判断是否在可用商品内
for (String item : spuIds) {
List<String> spuList = Arrays.asList(spuId.split(","));
......@@ -210,6 +263,7 @@ public class GoblinCouponImpl implements GoblinCouponService {
goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo);
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now()));
}
break;
}
}
......
......@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) {
spuIds = spuIds.concat(item.getSpuId().split(pre)[0]+",");
spuIds = spuIds.concat(item.getSpuId().split(pre)[0] + ",");
} else {
spuIds = spuIds.concat(item.getSpuId()+",");
spuIds = spuIds.concat(item.getSpuId() + ",");
}
}
if (tempCouponVo != null) {
......@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
}
}
} else {
HashMap<String, Object> hashMap = orderUtils.useCoupon(platVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds,uid);
HashMap<String, Object> hashMap = orderUtils.useCoupon(platVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid);
voucherPrice = (BigDecimal) hashMap.get("voucher");
Integer typeVoucher = (Integer) hashMap.get("type");
if (typeVoucher.equals(-1)) {
......@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) {
spuIds = spuIds.concat( item.getSpuId().split(pre)[0]+",");
spuIds = spuIds.concat(item.getSpuId().split(pre)[0] + ",");
} else {
spuIds = spuIds.concat( item.getSpuId()+",");
spuIds = spuIds.concat(item.getSpuId() + ",");
}
}
GoblinUseResultVo storeCouponVo = goblinCouponService.useCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid);
......@@ -857,6 +857,18 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderVo.setPriceRefund(orderVo.getPriceRefund().add(price));
if (orderVo.getPriceRefund().compareTo(orderVo.getPriceActual()) >= 0) {
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_6.getValue());
if (!(orderVo.getUcouponId() == null || orderVo.getUcouponId().equals(""))) {
orderUtils.backCoupon(orderVo.getUcouponId(), orderVo.getUserId());
}
if (!(orderVo.getStoreCouponId() == null || orderVo.getStoreCouponId().equals(""))) {
List<BackCouponParam> params = ObjectUtil.getBackCouponParam();
BackCouponParam backCouponParam = BackCouponParam.getNew();
backCouponParam.setuCouponIds(orderVo.getStoreCouponId());
backCouponParam.setUid(orderVo.getUserId());
params.add(backCouponParam);
goblinCouponService.backCoupon(params);
}
}
backOrderVo.setStatus(GoblinStatusConst.Status.ORDER_BACK_STATUS_2.getValue());
backOrderVo.setRefundAt(nowStr);
......@@ -914,8 +926,8 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
} else if (0 == status) {
}
return "success";
}
return"success";
}
@Override
public ResponseDto<List<GoblinMailVo>> getMail(String orderId, String mailId) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment