提交实物代码

new-dev
袁野 2 years ago
parent 9e5cf88db9
commit 19c7504036
  1. 6
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java
  2. 42
      hai-bweb/src/main/java/com/bweb/controller/HighApproveController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/Goods/DeliveryAddressController.java
  5. 4
      hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java
  6. 99
      hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java
  7. 2
      hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java
  8. 2
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  9. 31
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  10. 2
      hai-service/src/main/java/com/hai/enum_type/ApproveType.java
  11. 12
      hai-service/src/main/java/com/hai/goods/model/GoodsModel.java
  12. 3
      hai-service/src/main/java/com/hai/goods/service/GoodsDetailService.java
  13. 10
      hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java
  14. 31
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java
  15. 57
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java
  16. 29
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  17. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  18. 9
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  19. 1
      hai-service/src/main/java/com/hai/order/topic/OrderTopic.java
  20. 7
      hai-service/src/main/java/com/hai/order/utils/OrderUtil.java
  21. 8
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  22. 11
      hai-service/src/main/java/com/hai/service/impl/HighApproveServiceImpl.java
  23. 6
      hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java
  24. 63
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  25. 17
      v1/src/main/java/com/v1/controller/orderController.java

@ -81,7 +81,6 @@ public class GoodsDetailController {
map.put("opId" , userInfoModel.getSecUser().getId());
}
PageHelper.startPage(pageNum,pageSize);
List<GoodsDetail> list = goodsDetailService.getGoodsDetailList(map);
@ -165,9 +164,7 @@ public class GoodsDetailController {
goodsDetail.setCreateTime(goods.getCreateTime());
goodsDetail.setUpdateTime(new Date());
goodsDetail.setGoodsTypeName(goodsType.getTitle());
goodsDetail.setOpId(userInfoModel.getSecUser().getId());
goodsDetail.setOpName(userInfoModel.getSecUser().getLoginName());
goodsDetail.setCompanyId(userInfoModel.getBsCompany().getId());
goodsDetailService.updateGoodsDetail(goodsDetail);
@ -275,6 +272,7 @@ public class GoodsDetailController {
approve.setUpdateTime(new Date());
approve.setSubmitOperatorId(userInfoModel.getSecUser().getId());
approve.setSubmitOperatorName(userInfoModel.getSecUser().getUserName());
approve.setExt1(userInfoModel.getBsCompany().getId().toString());
// 增加审批
highApproveService.insertApprove(approve);

@ -10,8 +10,13 @@ import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsSku;
import com.hai.entity.HighApprove;
import com.hai.enum_type.ApproveType;
import com.hai.goods.model.GoodsModel;
import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsSkuService;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighApproveService;
@ -20,14 +25,17 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -46,12 +54,18 @@ public class HighApproveController {
@Autowired
private UserCenter userCenter;
@Resource
private GoodsSkuService goodsSkuService;
@Resource
private HighApproveService highApproveService;
@Resource
private HighCouponService highCouponService;
@Resource
private GoodsDetailService goodsDetailService;
@RequestMapping(value="/approveProcessed",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "审批")
@ -112,6 +126,26 @@ public class HighApproveController {
if (approve.getObjectType().equals(ApproveType.UP_SHELF_APPROVE.getType())) {
map.put("object", highCouponService.getCouponById(approve.getObjectId()));
}
if (approve.getObjectType().equals(ApproveType.GOODS_UP_SHELF_APPROVE.getType())) {
GoodsDetail goodsDetail = goodsDetailService.findGoodsDetailById(approve.getObjectId());
if (goodsDetail == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关商品信息");
}
GoodsModel goodsModel = new GoodsModel();
BeanUtils.copyProperties(goodsDetail, goodsModel);
goodsModel.setGoodsSkus(goodsSkuService.getGoodsSkuList(goodsDetail.getId()));
map.put("object", goodsModel);
}
return ResponseMsgUtil.success(map);
@ -129,12 +163,18 @@ public class HighApproveController {
@RequestParam(name = "objectId", required = false) Long objectId,
@RequestParam(name = "objectName", required = false) String objectName,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize) {
@RequestParam(name = "pageSize", required = true) Integer pageSize ,HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
Map<String, Object> map = new HashMap<>();
map.put("approveSerialNo", approveSerialNo);
map.put("objectType", objectType);
if (objectType == 4) {
map.put("companyId", userInfoModel.getBsCompany().getId());
}
map.put("objectId", objectId);
map.put("objectName", objectName);

File diff suppressed because one or more lines are too long

@ -139,7 +139,7 @@ public class DeliveryAddressController {
}
if (deliveryAddress.getWhetherDefault()) {
deliveryAddressService.cleanDeliveryAddressDefault(deliveryAddress.getUserId());
deliveryAddressService.cleanDeliveryAddressDefault(userInfoModel.getHighUser().getId());
}
GoodsDeliveryAddress goodsDeliveryAddress = deliveryAddressService.findDeliveryAddressById(deliveryAddress.getId());

@ -139,8 +139,8 @@ public class OrderMobileRechargeController {
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "productType", required = false) Integer productType,
@RequestParam(name = "refundTimeS", required = false) String refundTimeS,
@RequestParam(name = "refundTimeE", required = false) String refundTimeE,
@RequestParam(name = "refundTimeS", required = false) Long refundTimeS,
@RequestParam(name = "refundTimeE", required = false) Long refundTimeE,
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE) {
try {

@ -0,0 +1,99 @@
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);
}
}
}

@ -50,7 +50,7 @@ public class HighRechargeOrderSchedule {
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/120 * * * ?") //每120分钟执行一次
@Scheduled(cron = "0 0/60 * * * ?") //每120分钟执行一次
public void initRechargeOrder() {
log.info("处理话费订单定时任务开始");
Map<String, Object> map = new HashMap<>();

@ -69,7 +69,7 @@ public class RechargeConfig {
paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId());
paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5));
log.info("发起龙阅订单充值=");
log.info("发起龙阅订单充值");
log.info("龙阅订单充值-请求参数: " + JSON.toJSONString(paramMap));
JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap);

@ -3,6 +3,7 @@ package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* high_order
@ -261,8 +262,38 @@ public class HighOrder implements Serializable {
*/
private String ext6;
private String time;
private String goodsTypeName;
public String getGoodsTypeName() {
return goodsTypeName;
}
public void setGoodsTypeName(String goodsTypeName) {
this.goodsTypeName = goodsTypeName;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
private static final long serialVersionUID = 1L;
private List<HighChildOrder> highChildOrderList;
public List<HighChildOrder> getHighChildOrderList() {
return highChildOrderList;
}
public void setHighChildOrderList(List<HighChildOrder> highChildOrderList) {
this.highChildOrderList = highChildOrderList;
}
public Long getId() {
return id;
}

@ -9,7 +9,7 @@ public enum ApproveType {
UP_SHELF_APPROVE(1, "卡卷上架审批"),
COUPON_PRICE_APPROVE(2, "卡卷价格审批"),
COUPON_DISTRIBUTE_APPROVE(3, "卡卷分发审批"),
GOODS_UP_SHELF_APPROVE(4, "卡卷分发审批"),
GOODS_UP_SHELF_APPROVE(4, "实物审批"),
;
private Integer type;

@ -1,9 +1,11 @@
package com.hai.goods.model;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsSku;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
public class GoodsModel extends GoodsDetail {
@ -14,6 +16,8 @@ public class GoodsModel extends GoodsDetail {
private Boolean whetherMultiple;
private List<GoodsSku> goodsSkus;
public BigDecimal getPrice() {
return price;
@ -38,4 +42,12 @@ public class GoodsModel extends GoodsDetail {
public void setWhetherMultiple(Boolean whetherMultiple) {
this.whetherMultiple = whetherMultiple;
}
public List<GoodsSku> getGoodsSkus() {
return goodsSkus;
}
public void setGoodsSkus(List<GoodsSku> goodsSkus) {
this.goodsSkus = goodsSkus;
}
}

@ -3,6 +3,7 @@ package com.hai.goods.service;
import com.hai.entity.ApiMchProduct;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.HighApprove;
import java.util.List;
import java.util.Map;
@ -57,4 +58,6 @@ public interface GoodsDetailService {
*/
GoodsDetail findGoodsDetailById(Long id);
void upShelfApproveResult(HighApprove highApprove);
}

@ -92,4 +92,14 @@ public interface GoodsPresentService {
List<GoodsPresentRecord> getPresentRecord(Map<String , Object> map);
void presentUser(HighOrder order , HighChildOrder highChildOrder);
/**
* @Author Sum1Dream
* @Name preGiveUser
* @Description // 预送用户卡券
* @Date 14:45 2023/5/10
* @Param [order, highChildOrder]
* @Return void
*/
void preGiveUser( HighChildOrder highChildOrder);
}

@ -1,16 +1,17 @@
package com.hai.goods.service.impl;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.dao.GoodsDetailMapper;
import com.hai.dao.GoodsLogisticsMapper;
import com.hai.entity.ApiMerchantsExample;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsDetailExample;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.*;
import com.hai.goods.service.GoodsDetailService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -67,4 +68,26 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
return goodsDetailMapper.selectByPrimaryKey(id);
}
@Override
public void upShelfApproveResult(HighApprove highApprove) {
GoodsDetail goodsDetail = findGoodsDetailById(highApprove.getObjectId());
if (goodsDetail == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息!");
}
if (goodsDetail.getStatus() != 3) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "状态错误!");
}
// 状态: 1:待审批 2:驳回 3:通过
if (highApprove.getStatus() == 2) {
goodsDetail.setStatus(2);
}
if (highApprove.getStatus() == 3) {
goodsDetail.setStatus(1);
}
goodsDetail.setUpdateTime(new Date());
updateGoodsDetail(goodsDetail);
}
}

@ -1,5 +1,6 @@
package com.hai.goods.service.impl;
import com.hai.config.HuiLianTongConfig;
import com.hai.dao.GoodsPresentMapper;
import com.hai.dao.GoodsPresentRecordMapper;
import com.hai.entity.*;
@ -94,7 +95,6 @@ public class GoodsPresentServiceImpl implements GoodsPresentService {
}
@Override
@Async
public void presentUser(HighOrder order, HighChildOrder highChildOrder) {
try {
@ -102,26 +102,36 @@ public class GoodsPresentServiceImpl implements GoodsPresentService {
List<GoodsPresent> goodsPresents = goodsPresentService.getPresentList(highChildOrder.getGoodsId());
if (goodsPresents.size() > 0) {
for (int j = 0; j < highChildOrder.getSaleCount(); j++) {
for (GoodsPresent present : goodsPresents) {
GoodsPresentRecord presentRecord = new GoodsPresentRecord();
presentRecord.setStatus("0");
if (present.getType() == 1) {
for (int i = 0; i < present.getNum(); i++) {
HighCoupon coupon = highCouponService.getCouponById(present.getSourceId());
if (coupon.getCouponSource() == 1 || coupon.getCouponSource() == 2 || coupon.getCouponSource() == 3) {
for (int i = 0; i < present.getNum(); i++) {
for (int j = 0; j < highChildOrder.getSaleCount(); j++) {
// 支付购买卡券
couponCodeService.payCoupon(order,highChildOrder,coupon);
}
}
}
if (coupon.getCouponSource() == 4 || coupon.getCouponSource() == 5) {
for (int i = 0; i < present.getNum(); i++) {
// 支付购买卡券
couponCodeService.payCoupon(order,highChildOrder,coupon);
}
}
}
if (present.getType() == 2) {
highDiscountAgentCodeService.giveDiscount(present.getSourceId() , Long.valueOf(present.getNum()), order.getMemId());
highDiscountAgentCodeService.giveDiscount(present.getSourceId() , ((long) present.getNum() * highChildOrder.getSaleCount()), order.getMemId());
}
presentRecord.setOrderNo(order.getOrderNo());
presentRecord.setOrderId(order.getId());
presentRecord.setChildOrderId(highChildOrder.getOrderId());
presentRecord.setChildOrderId(highChildOrder.getId());
presentRecord.setCreateTime(new Date());
presentRecord.setNum(presentRecord.getNum());
presentRecord.setNum(present.getNum()*highChildOrder.getSaleCount());
presentRecord.setUpdateTime(new Date());
presentRecord.setType(present.getType());
presentRecord.setStatus("1");
@ -133,9 +143,44 @@ public class GoodsPresentServiceImpl implements GoodsPresentService {
goodsPresentService.insertPresentRecord(presentRecord);
}
}
} catch (Exception e) {
}
}
@Override
public void preGiveUser(HighChildOrder childOrder) {
try {
List<GoodsPresent> goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId());
if (goodsPresents.size() > 0) {
for (GoodsPresent present : goodsPresents) {
if (present.getType() == 1) {
HighCoupon coupon = highCouponService.getCouponById(present.getSourceId());
if (coupon.getCouponSource() == 1 || coupon.getCouponSource() == 2 || coupon.getCouponSource() == 3) {
for (int i = 0; i < present.getNum(); i++) {
for (int j = 0; j < childOrder.getSaleCount(); j++) {
highCouponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo());
}
}
}
if (coupon.getCouponSource() == 4) {
HuiLianTongConfig.recharge(childOrder.getChildOrderNo(),
childOrder.getSaleCount()*present.getNum(),
coupon.getCouponKey(),
childOrder.getMemPhone());
}
}
}
}
} catch (Exception e) {
}
}
}

@ -53,14 +53,10 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private CommonService commonService;
@Resource
private BsCompanyService companyService;
@Resource
private OrderService orderService;
@Resource
private BsConfigService bsConfigService;
private BsCompanyService companyService;
@Resource
private SecConfigService secConfigService;
@ -77,8 +73,6 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private HighMerchantStoreService storeService;
@Resource
private GoodsPresentService goodsPresentService;
@Resource
private HighMerchantService merchantService;
@ -138,6 +132,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private GoodsSkuService goodsSkuService;
@Resource
private GoodsPresentService presentService;
@Resource
private ShoppingCartService shoppingCartService;
@ -945,6 +942,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice()));
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
childOrder.setExt5(goods.getOpId().toString());
if (createOrderChild.getShopCartId() != null) {
shoppingCartService.deleteShoppingCart(createOrderChild.getShopCartId());
@ -952,22 +950,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
goodsSkuService.decreaseStockNum(createOrderChild.getSkuId(), createOrderChild.getSaleCount());
// List<GoodsPresent> goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId());
//
//
//// if (goodsPresents.size() > 0) {
//// for (int j = 0; j < childOrder.getSaleCount(); j++) {
//// for (GoodsPresent present : goodsPresents) {
//// if (present.getType() == 1) {
//// for (int i = 0; i < present.getNum(); i++) {
//// couponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo());
//// }
//// }
////
//// }
//// }
//// }
presentService.preGiveUser(childOrder);
return childOrder;
}

@ -496,7 +496,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
* @Param [order]
* @Return void
*/
private void mobileRecharge(HighOrder order) throws Exception {
private void mobileRecharge(HighOrder order) {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(order.getOrderNo());
if (outRechargeOrder.getPayStatus() == null) {
if (order.getProductType().equals(9)) {

@ -305,6 +305,7 @@ public class OrderServiceImpl implements OrderService {
HighChildOrder childOrder = orderCreateHandleService.goods(order , child);
childOrderList.add(childOrder);
order.setProductType(OrderProductType.PRODUCT_TYPE12.getNumber());
order.setSecUserId(childOrder.getId());
if (StringUtils.isBlank(order.getTitle())) {
order.setTitle(childOrder.getGoodsName());
@ -622,6 +623,14 @@ public class OrderServiceImpl implements OrderService {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单无法退款!");
}
// 订单是否异常,订单没异常则需要校验产品业务是否支持退款
if (order.getExceptionStatus().equals(true)
// 产品业务是否支付退款
&& order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单无法退款!");
}
// 退款订单号
String refundOrderNo = OrderUtil.generateRefundOrderNo();

@ -11,6 +11,7 @@ public enum OrderTopic {
ORDER_TOPIC_CANCEL(ORDER_TOPIC.getTopic() + ":cancel", "订单取消"),
ORDER_TOPIC_REFUND_SUCCESS(ORDER_TOPIC.getTopic() + ":refund-success", "订单退款成功业务"),
ORDER_TOPIC_PROFIT_SHARING(ORDER_TOPIC.getTopic() + ":profit-sharing", "订单分账业务"),
MOBILE_TOPIC_PROFIT_RECHARGE(ORDER_TOPIC.getTopic() + ":mobile-recharge", "话费订单充值业务"),
;
private String topic;

@ -51,11 +51,16 @@ public class OrderUtil {
* @return
* @throws Exception
*/
public static String generateOrderNo() throws Exception {
public static String generateOrderNo() {
try {
// 5位随机数 + 1位线程生成数
String randomNum = (new Random().nextInt(8999) + 1000) + IDGenerator.nextId(1);
// 生成订单号
return DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + randomNum;
} catch (Exception e) {
return null;
}
}
/**

@ -144,7 +144,7 @@ public interface OutRechargeOrderService {
* @Param [rechargeOrder]
* @Return void
*/
void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) throws Exception;
void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder);
/**
* @Author Sum1Dream
@ -197,7 +197,7 @@ public interface OutRechargeOrderService {
* @Param [object]
* @Return void
*/
Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) throws Exception;
Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder);
/**
* @Author Sum1Dream
@ -207,7 +207,9 @@ public interface OutRechargeOrderService {
* @Param [childOrder]
* @Return java.lang.Integer 1满足继续充值条件 2订单满足退款条件 3订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成
*/
Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) throws Exception;
Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder);
OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder);
JSONObject prepaidRechargeOrderHandle(JSONObject object);
}

@ -7,6 +7,7 @@ import com.hai.common.exception.SysCode;
import com.hai.dao.HighApproveMapper;
import com.hai.entity.*;
import com.hai.enum_type.ApproveType;
import com.hai.goods.service.GoodsDetailService;
import com.hai.model.HighCouponModel;
import com.hai.service.HighAgentService;
import com.hai.service.HighApproveService;
@ -37,6 +38,9 @@ public class HighApproveServiceImpl implements HighApproveService {
@Resource
private HighCouponService highCouponService;
@Resource
private GoodsDetailService goodsDetailService;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW ,rollbackFor = Exception.class)
@ -82,6 +86,10 @@ public class HighApproveServiceImpl implements HighApproveService {
if (highApprove.getObjectType().equals(ApproveType.COUPON_DISTRIBUTE_APPROVE.getType())) {
highCouponService.distributeApprove(highApprove);
}
if (highApprove.getObjectType().equals(ApproveType.GOODS_UP_SHELF_APPROVE.getType())) {
goodsDetailService.upShelfApproveResult(highApprove);
}
updateApprove(highApprove);
}
@ -102,6 +110,9 @@ public class HighApproveServiceImpl implements HighApproveService {
if (MapUtils.getInteger(map, "objectId") != null) {
criteria.andObjectTypeEqualTo(MapUtils.getInteger(map, "objectId"));
}
if (MapUtils.getInteger(map, "companyId") != null) {
criteria.andExt1EqualTo(MapUtils.getString(map, "companyId"));
}
if (MapUtils.getString(map, "objectName") != null) {
criteria.andObjectNameLike("%" + MapUtils.getString(map, "objectName") + "%");

@ -329,7 +329,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
if (coupon.getCouponSource().equals(4)) {
// 推送给汇联通
JSONObject returnParam = HuiLianTongConfig.costRechargeOrder(childOrder.getChannelOrderNo());
if (returnParam != null && returnParam.getString("respCode").equals("0000")) {
if (returnParam.getString("respCode").equals("0000")) {
// 解密
JSONObject jsonObject = HuiLianTongUnionCardConfig.resolveResponse(returnParam.getString("data"));
JSONArray dataArray = JSONObject.parseObject(jsonObject.getString("data"), JSONArray.class);
@ -362,10 +362,10 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService {
}
} else if (coupon.getCouponSource().equals(5)) {
// 预发码
JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(coupon.getCouponKey(), order.getOrderNo(), childOrder.getSaleCount(), order.getMemPhone());
JSONObject preSendCoupon = ChongQingCNPCService.preSendCoupon(coupon.getCouponKey(), childOrder.getChildOrderNo(), childOrder.getSaleCount(), order.getMemPhone());
if (preSendCoupon.getInteger("status").equals(1)) {
// 给用户发码
JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), order.getOrderNo(), childOrder.getSaleCount(), order.getMemPhone());
JSONObject response = ChongQingCNPCService.sendCNPCTicket(coupon.getCouponKey(), childOrder.getChildOrderNo(), childOrder.getSaleCount(), order.getMemPhone());
JSONObject couponDetail = response.getJSONObject("ticketDetail");
JSONArray codeList = response.getJSONArray("codeList");
for (Object data : codeList) {

@ -17,6 +17,7 @@ import com.hai.entity.*;
import com.hai.enum_type.*;
import com.hai.model.*;
import com.hai.order.service.OrderService;
import com.hai.order.topic.OrderTopic;
import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderRefundOpUserType;
@ -26,6 +27,7 @@ import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +52,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Resource
private OutRechargeOrderMapper outRechargeOrderMapper;
@Resource
private RocketMQTemplate rocketMQTemplate;
@Resource
private OutRechargeOrderMapperExt outRechargeOrderMapperExt;
@ -395,7 +400,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
@Override
public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) throws Exception {
public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) {
JSONObject object = new JSONObject();
object.put("rechargePrice" , outRechargeOrder.getRechargePrice());
@ -427,46 +432,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
childOrder.setUpdateTime(new Date());
childOrder.setCreateTime(new Date());
// 尖椒充值
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());
}
outRechargeChildOrderService.insertOrder(childOrder);
rocketMQTemplate.syncSend(OrderTopic.MOBILE_TOPIC_PROFIT_RECHARGE.getTopic(), childOrder);
}
@Override
@ -483,7 +450,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 加锁成功,处理业务
// 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成
int orderStatus = orderWhetherRecharge(outRechargeOrder);
log.info("处理话费" + outRechargeOrder.getOrderNo() + "订单状态:" + orderStatus);
if (orderStatus == 1) {
getPrepaidRechargeApi(outRechargeOrder);
}
@ -583,8 +550,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
@Override
public Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) throws Exception {
public Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) {
try {
JSONObject object = new JSONObject();
// 龙阅
if (childOrder.getRechargePlatform() == 2) {
@ -644,6 +612,11 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
}
return 99;
}catch (Exception e) {
return null;
}
}
// 获取当前最新的充值平台
@ -664,7 +637,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
* @Param [object]
* @Return com.alibaba.fastjson.JSONObject
*/
private JSONObject prepaidRechargeOrderHandle(JSONObject object) {
@Override
public JSONObject prepaidRechargeOrderHandle(JSONObject object) {
if (object.getLong("productId") == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "产品编码为空");
@ -711,7 +686,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
@Override
public Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) throws Exception {
public Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) {
// 查询子订单
List<OutRechargeChildOrder> childOrderList = outRechargeChildOrderService.getListRechargeChildOrderByOrderId(rechargeOrder.getId());

@ -423,6 +423,23 @@ public class orderController {
}
}
@RequestMapping(value = "/test", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "对外订单退款接口")
public ResponseData test() {
try {
System.out.println("话费请求订单=================================");
Thread.currentThread().sleep(30000);
return ResponseMsgUtil.success("请求成功!");
} catch (Exception e) {
log.error("HighOpenApiController --> createOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

Loading…
Cancel
Save