提交代码修改

dev-discount
袁野 2 years ago
parent fe34f21da6
commit 31e7934870
  1. 1
      hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java
  2. 27
      hai-cweb/src/main/java/com/cweb/controller/HighOrderController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  4. 16
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  5. 4
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  6. 4
      hai-service/src/main/java/com/hai/entity/HighCoupon.java
  7. 21
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  8. 1
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  9. 74
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java

@ -270,6 +270,7 @@ public class HighCouponController {
coupon.setSalesPrice(highCoupon.getSalesPrice()); coupon.setSalesPrice(highCoupon.getSalesPrice());
coupon.setDiscountPrice(highCoupon.getDiscountPrice()); coupon.setDiscountPrice(highCoupon.getDiscountPrice());
coupon.setIsPresent(highCoupon.getIsPresent()); coupon.setIsPresent(highCoupon.getIsPresent());
coupon.setBuyPoints(highCoupon.getBuyPoints());
coupon.setOperatorId(userInfoModel.getSecUser().getId()); coupon.setOperatorId(userInfoModel.getSecUser().getId());
coupon.setGoodsTypeId(highCoupon.getGoodsTypeId()); coupon.setGoodsTypeId(highCoupon.getGoodsTypeId());
coupon.setBrandId(highCoupon.getBrandId()); coupon.setBrandId(highCoupon.getBrandId());

@ -134,6 +134,10 @@ public class HighOrderController {
} }
} }
// 定义当前卡券是否可以直冲积分
boolean buyPoints = false;
BigDecimal totalPrice = new BigDecimal("0"); BigDecimal totalPrice = new BigDecimal("0");
BigDecimal totalActualPrice = new BigDecimal("0"); BigDecimal totalActualPrice = new BigDecimal("0");
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) { for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
@ -202,6 +206,11 @@ public class HighOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "系统维护中"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "系统维护中");
} }
} }
if (coupon.getBuyPoints()) {
buyPoints = true;
}
childOrder.setGoodsActualPrice(childOrder.getGoodsPrice()); childOrder.setGoodsActualPrice(childOrder.getGoodsPrice());
childOrder.setGoodsName(coupon.getCouponName()); childOrder.setGoodsName(coupon.getCouponName());
childOrder.setGoodsImg(coupon.getCouponImg()); childOrder.setGoodsImg(coupon.getCouponImg());
@ -399,9 +408,25 @@ public class HighOrderController {
totalPrice = totalPrice.add(childOrder.getTotalPrice()); totalPrice = totalPrice.add(childOrder.getTotalPrice());
totalActualPrice = totalActualPrice.add(childOrder.getGoodsActualPrice()); totalActualPrice = totalActualPrice.add(childOrder.getGoodsActualPrice());
} }
// 积分抵扣金额
BigDecimal integralDeductionPrice = new BigDecimal(0);
if (buyPoints && highOrder.getPayGold() != null) {
integralDeductionPrice = new BigDecimal(highOrder.getPayGold()).divide(new BigDecimal(100));
highUserService.goldHandle(userInfoModel.getHighUser().getId(), highOrder.getPayGold(), 2, 2, highOrder.getId());
BigDecimal payGold = new BigDecimal(highOrder.getPayGold());
if (payGold.compareTo(totalActualPrice.subtract(integralDeductionPrice)) < 0) {
highOrder.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
highOrder.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币
}
}
highOrder.setMerchId(request.getHeader("mchId")); highOrder.setMerchId(request.getHeader("mchId"));
highOrder.setTotalPrice(totalPrice); highOrder.setTotalPrice(totalPrice);
highOrder.setPayPrice(totalActualPrice); highOrder.setPayPrice(totalActualPrice.subtract(integralDeductionPrice));
highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(totalActualPrice)); highOrder.setDeductionPrice(highOrder.getTotalPrice().subtract(totalActualPrice));
// 是否使用了优惠券 // 是否使用了优惠券

File diff suppressed because one or more lines are too long

@ -254,6 +254,22 @@ public class WechatController {
// 根据手机号查询用户 // 根据手机号查询用户
HighUser user = highUserService.findByPhone(phone); HighUser user = highUserService.findByPhone(phone);
if (user == null) {
user = new HighUser();
user.setName("用户" + IDGenerator.nextId(5));
user.setPhone(phone);
user.setRegTime(new Date());
user.setGold(0);
user.setStatus(1);
// 用户信息完整状态
// 0:完整
// 1:需要填写用户信息
// 2:需要填写手机号
user.setInfoCompleteStatus(1);
highUserService.insertUser(user);
}
// 获取手机号验证码 // 获取手机号验证码
String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone); String phoneSmsCode = (String) redisUtil.get("SMS_"+ phone);

@ -152,10 +152,10 @@ public class OrderController {
// 商品类型 1:卡卷 2:金币充值 3:加油站 // 商品类型 1:卡卷 2:金币充值 3:加油站
for (HighChildOrder childOrder : order.getHighChildOrderList()) { for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) { if (!childOrder.getGiveawayType() && childOrder.getGoodsType() == 1) {
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId()); HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId());
// 支付类型:1.微信支付 2.金币支付 // 支付类型:1.微信支付 2.金币支付
if (coupon.getPayType() != 1) { if (coupon.getPayType() != 1 && !coupon.getBuyPoints()) {
log.error("OrderController --> orderToPay() ERROR", "只支持微信支持"); log.error("OrderController --> orderToPay() ERROR", "只支持微信支持");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付");
} }

@ -1,5 +1,7 @@
package com.hai.entity; package com.hai.entity;
import com.hai.model.HighCouponModel;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -13,7 +15,7 @@ import java.util.Date;
* 代码由工具生成 * 代码由工具生成
* *
**/ **/
public class HighCoupon implements Serializable { public class HighCoupon extends HighCouponModel implements Serializable {
/** /**
* 主键 * 主键
*/ */

@ -232,6 +232,11 @@ public class HighOrder implements Serializable {
private String gasStaffCode; private String gasStaffCode;
/**
* 是否自动充值积分 0 1
*/
private Boolean buyPoints;
public String getGasStaffCode() { public String getGasStaffCode() {
return gasStaffCode; return gasStaffCode;
} }
@ -618,6 +623,22 @@ public class HighOrder implements Serializable {
this.ext3 = ext3; this.ext3 = ext3;
} }
public Boolean getTyAgent() {
return isTyAgent;
}
public void setTyAgent(Boolean tyAgent) {
isTyAgent = tyAgent;
}
public Boolean getBuyPoints() {
return buyPoints;
}
public void setBuyPoints(Boolean buyPoints) {
this.buyPoints = buyPoints;
}
@Override @Override
public boolean equals(Object that) { public boolean equals(Object that) {
if (this == that) { if (this == that) {

@ -1231,6 +1231,7 @@ public class HighOrderServiceImpl implements HighOrderService {
order.setHighChildOrderList(getChildOrderByOrder(order.getId())); order.setHighChildOrderList(getChildOrderByOrder(order.getId()));
} }
} }
return list; return list;
} }

@ -157,7 +157,7 @@ public class GoodsOrderServiceImpl implements PayService {
HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId()); HighCoupon coupon = highCouponService.getCouponById(highChildOrder.getGoodsId());
// 是否预约 // 是否预约
if (coupon.getReserveStatus() == true) { if (coupon.getReserveStatus()) {
HighOrderPre orderPre = new HighOrderPre(); HighOrderPre orderPre = new HighOrderPre();
orderPre.setCompanyId(coupon.getCompanyId()); orderPre.setCompanyId(coupon.getCompanyId());
orderPre.setMerchantId(coupon.getMerchantId()); orderPre.setMerchantId(coupon.getMerchantId());
@ -180,55 +180,55 @@ public class GoodsOrderServiceImpl implements PayService {
// 贵州中石化 // 贵州中石化
if (coupon.getCouponSource() == 4) { if (coupon.getCouponSource() == 4) {
// 获取token // 获取token
String token = huiLianTongConfig.getToken(); // String token = huiLianTongConfig.getToken();
Map<String,Object> push = new HashMap<>(); Map<String,Object> push = new HashMap<>();
push.put("token", token); // push.put("token", token);
push.put("couTypeCode", coupon.getCouponKey()); push.put("couTypeCode", coupon.getCouponKey());
push.put("distCouCount", highChildOrder.getSaleCount()); push.put("distCouCount", highChildOrder.getSaleCount());
push.put("userPhone", highUser.getPhone()); push.put("userPhone", highUser.getPhone());
push.put("thirdUserId", highUser.getUnionId()); push.put("thirdUserId", highUser.getUnionId());
// 推送给高速 // // 推送给高速
JSONObject returnParam = HuiLianTongConfig.couJointDist(token, order.getOrderNo(),coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId()); // JSONObject returnParam = HuiLianTongConfig.couJointDist(token, order.getOrderNo(),coupon.getCouponKey(), highChildOrder.getSaleCount(), highUser.getPhone(), highUser.getUnionId());
if (returnParam != null && returnParam.getString("result").equals("success")) { // if (returnParam != null && returnParam.getString("result").equals("success")) {
JSONArray dataArray = returnParam.getJSONArray("data"); // JSONArray dataArray = returnParam.getJSONArray("data");
for (Object data : dataArray) { // for (Object data : dataArray) {
JSONObject dataObject = (JSONObject) data; // JSONObject dataObject = (JSONObject) data;
HighCouponCodeOther couponCodeOther = new HighCouponCodeOther(); // HighCouponCodeOther couponCodeOther = new HighCouponCodeOther();
couponCodeOther.setType(1); // couponCodeOther.setType(1);
couponCodeOther.setOrderId(order.getId()); // couponCodeOther.setOrderId(order.getId());
couponCodeOther.setChildOrderId(highChildOrder.getId()); // couponCodeOther.setChildOrderId(highChildOrder.getId());
couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode")); // couponCodeOther.setCouTypeCode(dataObject.getString("couTypeCode"));
couponCodeOther.setCouNo(dataObject.getString("couNo")); // couponCodeOther.setCouNo(dataObject.getString("couNo"));
couponCodeOther.setStatus(20); // couponCodeOther.setStatus(20);
couponCodeOther.setCreateTime(new Date()); // couponCodeOther.setCreateTime(new Date());
couponCodeOther.setActiveTime(dataObject.getDate("activeTime")); // couponCodeOther.setActiveTime(dataObject.getDate("activeTime"));
couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate")); // couponCodeOther.setValidStartDate(dataObject.getDate("validStartDate"));
couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate")); // couponCodeOther.setValidEndDate(dataObject.getDate("validEndDate"));
highCouponCodeOtherMapper.insert(couponCodeOther); // highCouponCodeOtherMapper.insert(couponCodeOther);
//
// 卡卷关联用户 // // 卡卷关联用户
HighUserCoupon highUserCoupon = new HighUserCoupon(); // HighUserCoupon highUserCoupon = new HighUserCoupon();
highUserCoupon.setMerchantId(coupon.getMerchantId()); // highUserCoupon.setMerchantId(coupon.getMerchantId());
highUserCoupon.setCouponId(coupon.getId()); // highUserCoupon.setCouponId(coupon.getId());
highUserCoupon.setUserId(order.getMemId()); // highUserCoupon.setUserId(order.getMemId());
highUserCoupon.setCreateTime(new Date()); // highUserCoupon.setCreateTime(new Date());
highUserCoupon.setQrCodeImg(dataObject.getString("couNo")); // highUserCoupon.setQrCodeImg(dataObject.getString("couNo"));
highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate")); // highUserCoupon.setUseEndTime(dataObject.getDate("validEndDate"));
highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用 // highUserCoupon.setStatus(1); // 状态 0:已过期 1:未使用 2:已使用
highUserCouponMapper.insert(highUserCoupon); // highUserCouponMapper.insert(highUserCoupon);
} // }
} // }
// 推送记录 // 推送记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type6.getType()); highGasOrderPush.setType(OrderPushType.type6.getType());
highGasOrderPush.setOrderNo(order.getOrderNo()); highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date()); highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setCode(returnParam.getString("result")); // highGasOrderPush.setCode(returnParam.getString("result"));
highGasOrderPush.setRequestContent(JSONObject.toJSONString(push)); // highGasOrderPush.setRequestContent(JSONObject.toJSONString(push));
highGasOrderPush.setReturnContent(returnParam.toJSONString()); // highGasOrderPush.setReturnContent(returnParam.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush); highGasOrderPushMapper.insert(highGasOrderPush);
} else { } else {

Loading…
Cancel
Save