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

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

提交券

parent 6a29283f
...@@ -16,7 +16,7 @@ liquidnet: ...@@ -16,7 +16,7 @@ liquidnet:
pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log pattern-rolling-file-name: ${liquidnet.logfile.path}/${liquidnet.logfile.name}-%d{yyyy-MM-dd}.%i.log
level: debug level: debug
mysql: mysql:
database-name: dev_ln_scene database-name: test_ln_scene
mongodb: mongodb:
sslEnabled: false sslEnabled: false
database: dev_ln_scene database: test_ln_scene
\ No newline at end of file \ No newline at end of file
...@@ -127,25 +127,46 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -127,25 +127,46 @@ public class GoblinCouponImpl implements GoblinCouponService {
for (GoblinUserCouponVo vo : voList) { for (GoblinUserCouponVo vo : voList) {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) { if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); if (vo.getUseScope().equals("0")) {
//判断是否在可用商品内 BigDecimal tempPrice = BigDecimal.ZERO;
for (String item : spuIds) { if (vo.getType().equals("1")) {//代金券
List<String> spuList = Arrays.asList(spuId.split(",")); tempPrice = vo.getValFace();
if (spuList.contains(item)) { } else if (vo.getType().equals("2")) {//折扣
BigDecimal tempPrice = BigDecimal.ZERO; tempPrice = totalPrice.multiply(vo.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP);
if (vo.getType().equals("1")) {//代金券 if (tempPrice.compareTo(vo.getDeduction()) > 0) {
tempPrice = vo.getValFace(); tempPrice = vo.getDeduction();
} 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) { } else if (vo.getType().equals("3") && vo.getTriggers().compareTo(totalPrice) <= 0) {//满减
maxPrice = tempPrice; tempPrice = vo.getValMinus();
returnVo = vo; }
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(","));
if (spuList.contains(item)) {
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;
}
} }
} }
} }
...@@ -160,15 +181,22 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -160,15 +181,22 @@ public class GoblinCouponImpl implements GoblinCouponService {
List<GoblinUserCouponVo> returnList = ObjectUtil.getGoblinUserCouponVo(); List<GoblinUserCouponVo> returnList = ObjectUtil.getGoblinUserCouponVo();
for (GoblinUserCouponVo vo : voList) { for (GoblinUserCouponVo vo : voList) {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) >= 0) { if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); if (vo.getUseScope().equals("0")) {
//判断是否在可用商品内 returnList.add(vo);
for (String item : spuIds) { } else {
List<String> spuList = Arrays.asList(spuId.split(",")); List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId());
if (spuList.contains(item)) { if (spuId == null) {
returnList.add(vo);
break; break;
} }
//判断是否在可用商品内
for (String item : spuIds) {
List<String> spuList = Arrays.asList(spuId.split(","));
if (spuList.contains(item)) {
returnList.add(vo);
break;
}
}
} }
} }
} }
...@@ -186,30 +214,56 @@ public class GoblinCouponImpl implements GoblinCouponService { ...@@ -186,30 +214,56 @@ public class GoblinCouponImpl implements GoblinCouponService {
if (vo.getUcouponId().equals(ucouponId)) { if (vo.getUcouponId().equals(ucouponId)) {
//判断券状态 和 触发金额 //判断券状态 和 触发金额
if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) { if (vo.getState().equals(1) && vo.getTriggers().compareTo(totalPrice) <= 0) {
List<String> spuIds = goblinRedisUtils.getStoreCouponSpuIds(vo.getStoreCouponId()); if (vo.getUseScope().equals("0")) {
//判断是否在可用商品内 if (vo.getType().equals("1")) {//代金券
for (String item : spuIds) { returnVo.setValue(vo.getValFace());
List<String> spuList = Arrays.asList(spuId.split(",")); returnVo.setCouType(vo.getType());
if (spuList.contains(item)) { } else if (vo.getType().equals("2")) {//折扣
if (vo.getType().equals("1")) {//代金券 BigDecimal tempPrice = totalPrice.multiply(vo.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP);
returnVo.setValue(vo.getValFace()); if (tempPrice.compareTo(vo.getDeduction()) > 0) {
returnVo.setCouType(vo.getType()); tempPrice = vo.getDeduction();
} else if (vo.getType().equals("2")) {//折扣 }
BigDecimal tempPrice = totalPrice.multiply(vo.getDiscount()).setScale(2, BigDecimal.ROUND_HALF_UP); returnVo.setValue(tempPrice);
if (tempPrice.compareTo(vo.getDeduction()) > 0) { returnVo.setCouType(vo.getType());
tempPrice = vo.getDeduction(); } 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(","));
if (spuList.contains(item)) {
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());
} }
returnVo.setValue(tempPrice); vo.setState(5);
returnVo.setCouType(vo.getType()); vo.setUsedFor(content);
} else if (vo.getType().equals("3") && vo.getTriggers().compareTo(totalPrice) <= 0) {//满减 goblinMongoUtils.changeCouponVos(vo.getUcouponId(), vo);
returnVo.setValue(vo.getValMinus()); queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_STORE.getKey(),
returnVo.setCouType(vo.getType()); SqlMapping.get("goblin_user_coupon.updateState", vo.getState(), vo.getUsedFor(), LocalDateTime.now()));
} }
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; break;
} }
} }
......
...@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -292,9 +292,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) { for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId()); String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) { if (pre != null) {
spuIds = spuIds.concat(item.getSpuId().split(pre)[0]+","); spuIds = spuIds.concat(item.getSpuId().split(pre)[0] + ",");
} else { } else {
spuIds = spuIds.concat(item.getSpuId()+","); spuIds = spuIds.concat(item.getSpuId() + ",");
} }
} }
if (tempCouponVo != null) { if (tempCouponVo != null) {
...@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -305,7 +305,7 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
} }
} }
} else { } 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"); voucherPrice = (BigDecimal) hashMap.get("voucher");
Integer typeVoucher = (Integer) hashMap.get("type"); Integer typeVoucher = (Integer) hashMap.get("type");
if (typeVoucher.equals(-1)) { if (typeVoucher.equals(-1)) {
...@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -322,9 +322,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) { for (GoblinOrderSkuParam item : storeParam.getGoblinOrderSkuParamArrayList()) {
String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId()); String pre = GoblinStatusConst.MarketPreStatus.getPre(item.getSpuId());
if (pre != null) { if (pre != null) {
spuIds = spuIds.concat( item.getSpuId().split(pre)[0]+","); spuIds = spuIds.concat(item.getSpuId().split(pre)[0] + ",");
} else { } else {
spuIds = spuIds.concat( item.getSpuId()+","); spuIds = spuIds.concat(item.getSpuId() + ",");
} }
} }
GoblinUseResultVo storeCouponVo = goblinCouponService.useCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid); GoblinUseResultVo storeCouponVo = goblinCouponService.useCoupon(storeVoucherCode, "购买商品[" + orderCode + "]", storeTotalPrice, spuIds, uid);
...@@ -857,6 +857,18 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -857,6 +857,18 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
orderVo.setPriceRefund(orderVo.getPriceRefund().add(price)); orderVo.setPriceRefund(orderVo.getPriceRefund().add(price));
if (orderVo.getPriceRefund().compareTo(orderVo.getPriceActual()) >= 0) { if (orderVo.getPriceRefund().compareTo(orderVo.getPriceActual()) >= 0) {
orderVo.setStatus(GoblinStatusConst.Status.ORDER_STATUS_6.getValue()); 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.setStatus(GoblinStatusConst.Status.ORDER_BACK_STATUS_2.getValue());
backOrderVo.setRefundAt(nowStr); backOrderVo.setRefundAt(nowStr);
...@@ -913,9 +925,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService { ...@@ -913,9 +925,9 @@ public class GoblinOrderServiceImpl implements IGoblinOrderService {
SqlMapping.gets(sqls, sqlsOrder, sqlsOrderSku, sqlsBackOrder)); SqlMapping.gets(sqls, sqlsOrder, sqlsOrderSku, sqlsBackOrder));
} else if (0 == status) { } else if (0 == status) {
}
return "success";
} }
return"success";
}
@Override @Override
public ResponseDto<List<GoblinMailVo>> getMail(String orderId, String mailId) { 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