parent
a0e93c1715
commit
717cbdcb0c
@ -1,99 +0,0 @@ |
|||||||
package com.web.rocketmq.consumer; |
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject; |
|
||||||
import com.hai.common.exception.ErrorCode; |
|
||||||
import com.hai.common.exception.ErrorHelp; |
|
||||||
import com.hai.common.exception.SysCode; |
|
||||||
import com.hai.config.CommonSysConst; |
|
||||||
import com.hai.config.RechargeConfig; |
|
||||||
import com.hai.entity.OutRechargeChildOrder; |
|
||||||
import com.hai.entity.OutRechargeOrder; |
|
||||||
import com.hai.service.OutRechargeChildOrderService; |
|
||||||
import com.hai.service.OutRechargeOrderService; |
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; |
|
||||||
import org.apache.rocketmq.spring.core.RocketMQListener; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import javax.annotation.Resource; |
|
||||||
import java.util.Date; |
|
||||||
|
|
||||||
@Component |
|
||||||
@Slf4j |
|
||||||
@RocketMQMessageListener(consumerGroup = "order-mobile-recharge-group", topic = "order-topic",selectorExpression = "mobile-recharge") |
|
||||||
public class OrderMobileRechargeConsumer implements RocketMQListener<OutRechargeChildOrder> { |
|
||||||
|
|
||||||
@Resource |
|
||||||
private OutRechargeOrderService outRechargeOrderService; |
|
||||||
|
|
||||||
@Resource |
|
||||||
private OutRechargeChildOrderService outRechargeChildOrderService; |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onMessage(OutRechargeChildOrder childOrder) { |
|
||||||
|
|
||||||
JSONObject object = new JSONObject(); |
|
||||||
|
|
||||||
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(childOrder.getParentOrderId()); |
|
||||||
|
|
||||||
object.put("rechargePrice" , outRechargeOrder.getRechargePrice()); |
|
||||||
object.put("rechargeMobile" , outRechargeOrder.getRechargeContent()); |
|
||||||
object.put("productId" , outRechargeOrder.getGoodsId()); |
|
||||||
object.put("parentOrderId" , outRechargeOrder.getId()); |
|
||||||
|
|
||||||
// -1 取消,0充值中 ,1充值成功,2充值失败,3部分成功
|
|
||||||
Integer status = outRechargeOrderService.getRechargeOrderLegality(childOrder); |
|
||||||
|
|
||||||
if (status == 2 || status == -1) { |
|
||||||
// 补充下单参数
|
|
||||||
object = outRechargeOrderService.prepaidRechargeOrderHandle(object); |
|
||||||
|
|
||||||
// 尖椒充值
|
|
||||||
if (object.getInteger("rechargePlatform") == 1) { |
|
||||||
object.put("out_order_id", childOrder.getOrderNo()); |
|
||||||
object.put("amount", object.getBigDecimal("rechargePrice")); |
|
||||||
object.put("mobile", object.getString("rechargeMobile")); |
|
||||||
object.put("notifyUrl", CommonSysConst.getSysConfig().getJjNotifyUrl()); |
|
||||||
JSONObject returnObject = RechargeConfig.rechargeOrderByJj(object); |
|
||||||
childOrder.setExt1(returnObject.toJSONString()); |
|
||||||
} |
|
||||||
|
|
||||||
// 龙阅
|
|
||||||
if (object.getInteger("rechargePlatform") == 2) { |
|
||||||
|
|
||||||
if (object.getString("code") == null) { |
|
||||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
||||||
} |
|
||||||
|
|
||||||
object.put("out_trade_num", childOrder.getOrderNo()); |
|
||||||
object.put("product_id", object.getString("code")); |
|
||||||
object.put("mobile", object.getString("rechargeMobile")); |
|
||||||
object.put("notifyUrl", CommonSysConst.getSysConfig().getLyNotifyUrl()); |
|
||||||
JSONObject returnObject = RechargeConfig.rechargeOrderByLy(object); |
|
||||||
childOrder.setExt1(returnObject.toJSONString()); |
|
||||||
} |
|
||||||
|
|
||||||
// 畅停充值
|
|
||||||
if (object.getInteger("rechargePlatform") == 4) { |
|
||||||
|
|
||||||
if (object.getString("code") == null) { |
|
||||||
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
||||||
} |
|
||||||
|
|
||||||
object.put("orderid", childOrder.getOrderNo()); |
|
||||||
object.put("product_id", object.getString("code")); |
|
||||||
object.put("phone", object.getString("rechargeMobile")); |
|
||||||
object.put("price", object.getBigDecimal("rechargePrice")); |
|
||||||
JSONObject returnObject = RechargeConfig.rechargeOrderByHg(object); |
|
||||||
childOrder.setExt1(returnObject.toJSONString()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
System.out.println("消费内容:" + childOrder); |
|
||||||
|
|
||||||
childOrder.setUpdateTime(new Date()); |
|
||||||
outRechargeChildOrderService.updateOrder(childOrder); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,14 @@ |
|||||||
|
package com.hai.mobile.service; |
||||||
|
|
||||||
|
/** |
||||||
|
* @serviceName MobileHandleService.java |
||||||
|
* @author Sum1Dream |
||||||
|
* @version 1.0.0 |
||||||
|
* @Description // 话费业务处理
|
||||||
|
* @createTime 11:09 2023/5/17 |
||||||
|
**/ |
||||||
|
public interface MobileHandleService { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
package com.hai.mobile.service.impl; |
||||||
|
|
||||||
|
import com.hai.mobile.service.MobileHandleService; |
||||||
|
|
||||||
|
public class MobileHandleServiceImpl implements MobileHandleService { |
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package com.hai.order.model; |
||||||
|
|
||||||
|
import com.hai.entity.HighChildOrder; |
||||||
|
|
||||||
|
public class GoodsChildOrderExtModel extends HighChildOrder { |
||||||
|
|
||||||
|
/** |
||||||
|
* 1:待发货 2:已发货 3:配送中 4:已送达 5:已取消 6:退货中 7:已退货 8:待支付 0:删除'; |
||||||
|
*/ |
||||||
|
private String logisticsStatus; |
||||||
|
|
||||||
|
public String getLogisticsStatus() { |
||||||
|
return logisticsStatus; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLogisticsStatus(String logisticsStatus) { |
||||||
|
this.logisticsStatus = logisticsStatus; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue