@ -9,17 +9,18 @@ import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.XmlUtil ;
import com.hai.common.pay.util.sdk.WXPayConstants ;
import com.hai.common.security.AESEncodeUtil ;
import com.hai.common.utils.* ;
import com.hai.common.utils.DateUtil ;
import com.hai.common.utils.HttpsUtils ;
import com.hai.common.utils.IDGenerator ;
import com.hai.common.utils.WxUtils ;
import com.hai.config.* ;
import com.hai.dao.* ;
import com.hai.entity.* ;
import com.hai.entity.OutRechargeOrder ;
import com.hai.enum_type.* ;
import com.hai.model.* ;
import com.hai.msg.entity.MsgTopic ;
import com.hai.service.* ;
import com.hai.service.pay.impl.GoodsOrderServiceImpl ;
import io.netty.handler.ipfilter.UniqueIpFilter ;
import org.apache.commons.collections4.MapUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.apache.http.HttpEntity ;
@ -28,7 +29,6 @@ import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity ;
import org.apache.http.impl.client.CloseableHttpClient ;
import org.apache.http.util.EntityUtils ;
import org.eclipse.paho.client.mqttv3.MqttClient ;
import org.springframework.data.redis.core.RedisTemplate ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Isolation ;
@ -38,7 +38,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource ;
import java.math.BigDecimal ;
import java.math.RoundingMode ;
import java.time.OffsetDateTime ;
import java.util.* ;
/ * *
@ -273,7 +272,9 @@ public class HighOrderServiceImpl implements HighOrderService {
// 金币 1:100
Integer goldNum = new BigDecimal ( highOrder . getPayPrice ( ) . toString ( ) ) . multiply ( new BigDecimal ( "100" ) ) . intValue ( ) ;
highUserService . goldHandle ( userId , goldNum , 2 , 2 , highOrder . getId ( ) ) ;
String remark = "订单" + highOrder . getOrderNo ( ) + "下单,使用积分:" + goldNum ;
highUserService . goldHandle ( userId , goldNum , 2 , 2 , highOrder . getId ( ) , remark ) ;
highOrder . setPayTime ( new Date ( ) ) ; // 支付时间
highOrder . setPayModel ( 1 ) ; // 支付模式:1 金币,2 第三方平台,3 混合
@ -972,7 +973,8 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder . setChildOrdeStatus ( 3 ) ; // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
// 金币 1:100
Integer goldNum = new BigDecimal ( highChildOrder . getTotalPrice ( ) . toString ( ) ) . multiply ( new BigDecimal ( "100" ) ) . intValue ( ) ;
highUserService . goldHandle ( highChildOrder . getGoodsId ( ) , goldNum , 1 , 1 , highChildOrder . getId ( ) ) ;
String remark = "订单" + order . getOrderNo ( ) + "积分充值积分:" + goldNum ;
highUserService . goldHandle ( highChildOrder . getGoodsId ( ) , goldNum , 1 , 1 , highChildOrder . getId ( ) , remark ) ;
}
if ( highChildOrder . getGoodsType ( ) = = 3 ) {
@ -1462,7 +1464,8 @@ public class HighOrderServiceImpl implements HighOrderService {
if ( order . getPayGold ( ) ! = null ) {
// 积分返回
highUserService . goldHandle ( order . getMemId ( ) , order . getPayGold ( ) , 1 , 3 , order . getId ( ) ) ;
String remark = "订单" + order . getOrderNo ( ) + "取消,退还积分:" + order . getPayGold ( ) ;
highUserService . goldHandle ( order . getMemId ( ) , order . getPayGold ( ) , 1 , 3 , order . getId ( ) , remark ) ;
}
updateOrder ( order ) ;
@ -2187,7 +2190,9 @@ public class HighOrderServiceImpl implements HighOrderService {
if ( integralPrice . compareTo ( new BigDecimal ( 0 ) ) > 0 ) {
highOrder . setPayPrice ( highOrder . getPayPrice ( ) . subtract ( integralPrice ) ) ;
highUserService . goldHandle ( highOrder . getMemId ( ) , object . getInteger ( "integralNum" ) , 2 , 2 , highOrder . getId ( ) ) ;
String remark = "订单" + highOrder . getOrderNo ( ) + "下单,使用积分:" + object . getInteger ( "integralNum" ) ;
highUserService . goldHandle ( highOrder . getMemId ( ) , object . getInteger ( "integralNum" ) , 2 , 2 , highOrder . getId ( ) , remark ) ;
}
// 判断积分支付是否扣完金额
@ -2348,18 +2353,7 @@ public class HighOrderServiceImpl implements HighOrderService {
}
// 退还积分
if ( order . getPayGold ( ) ! = null ) {
highUserService . goldHandle ( order . getMemId ( ) , order . getPayGold ( ) , 1 , 3 , order . getId ( ) ) ;
if ( order . getPayRealPrice ( ) . compareTo ( new BigDecimal ( 0 ) ) = = 0 ) {
order . setOrderStatus ( 4 ) ;
order . setRefundTime ( new Date ( ) ) ;
for ( HighChildOrder childOrder : order . getHighChildOrderList ( ) ) {
childOrder . setChildOrdeStatus ( 4 ) ;
}
updateOrder ( order ) ;
}
}
// 微信退款
if ( order . getPayType ( ) = = 2 ) {
Map < String , String > param = new HashMap < > ( ) ;
@ -2488,7 +2482,19 @@ public class HighOrderServiceImpl implements HighOrderService {
}
updateOrder ( order ) ;
}
// 退还积分
if ( order . getPayGold ( ) ! = null ) {
String remark = "订单" + order . getOrderNo ( ) + "退款,退还积分:" + order . getPayGold ( ) ;
highUserService . goldHandle ( order . getMemId ( ) , order . getPayGold ( ) , 1 , 3 , order . getId ( ) , remark ) ;
if ( order . getPayRealPrice ( ) . compareTo ( new BigDecimal ( 0 ) ) = = 0 ) {
order . setOrderStatus ( 4 ) ;
order . setRefundTime ( new Date ( ) ) ;
for ( HighChildOrder childOrder : order . getHighChildOrderList ( ) ) {
childOrder . setChildOrdeStatus ( 4 ) ;
}
updateOrder ( order ) ;
}
}
if ( order . getMemDiscountId ( ) ! = null ) {
HighDiscountUserRel rel = highDiscountUserRelService . getRelById ( order . getMemDiscountId ( ) ) ;
@ -2562,7 +2568,8 @@ public class HighOrderServiceImpl implements HighOrderService {
if ( order . getPayGold ( ) ! = null ) {
// 积分返回
highUserService . goldHandle ( order . getMemId ( ) , order . getPayGold ( ) , 1 , 3 , order . getId ( ) ) ;
String remark = "订单" + order . getOrderNo ( ) + "取消,退还积分:" + order . getPayGold ( ) ;
highUserService . goldHandle ( order . getMemId ( ) , order . getPayGold ( ) , 1 , 3 , order . getId ( ) , remark ) ;
}
updateOrder ( order ) ;
@ -2596,4 +2603,53 @@ public class HighOrderServiceImpl implements HighOrderService {
public List < SelfOilStationModel > getSelfOilStationOrderList ( String goodsId ) {
return highOrderMapper . getSelfOilStationOrderList ( goodsId ) ;
}
@Override
public List < HighOrder > integralRebateOrder ( ) {
return highOrderMapper . integralRebateOrder ( ) ;
}
@Override
public JSONObject orderSource ( Integer goodsType , Long goodsId , String orderNo , Long companyId ) {
JSONObject object = new JSONObject ( ) ;
if ( goodsType = = 1 ) {
HighCoupon coupon = highCouponService . getCouponById ( goodsId ) ;
object . put ( "type" , 1 ) ;
object . put ( "productId" , coupon . getCouponSource ( ) ) ;
object . put ( "companyId" , coupon . getCompanyId ( ) ) ;
object . put ( "remark" , "卡券订单" + orderNo + "积分返利:" ) ;
}
if ( goodsType = = 3 ) {
HighMerchantStore merchantStore = highMerchantStoreService . getMerchantStoreById ( goodsId ) ;
object . put ( "type" , 2 ) ;
object . put ( "productId" , 1 ) ;
object . put ( "companyId" , merchantStore . getCompanyId ( ) ) ;
object . put ( "remark" , "在线加油订单" + orderNo + "积分返利:" ) ;
}
if ( goodsType = = 4 ) {
object . put ( "type" , 4 ) ;
object . put ( "productId" , 2 ) ;
object . put ( "companyId" , companyId ) ;
object . put ( "remark" , "肯德基订单" + orderNo + "积分返利:" ) ;
}
if ( goodsType = = 9 ) {
object . put ( "type" , 4 ) ;
object . put ( "productId" , 1 ) ;
object . put ( "companyId" , companyId ) ;
object . put ( "remark" , "星巴克订单" + orderNo + "积分返利:" ) ;
}
if ( goodsType = = 10 ) {
object . put ( "type" , 4 ) ;
object . put ( "productId" , 3 ) ;
object . put ( "companyId" , companyId ) ;
object . put ( "remark" , "会员充值订单" + orderNo + "积分返利:" ) ;
}
return object ;
}
}