Merge branch '2.0-dev' of http://gitea.dctpay.com/hurui/hai-server into 2.0-dev

new-dev
胡锐 2 years ago
commit a4755cdf6a
  1. 27
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  3. 64
      hai-cweb/src/main/java/com/cweb/controller/CommonController.java
  4. 6
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  5. 24
      hai-order/src/main/java/com/web/controller/OrderController.java
  6. 100
      hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java
  7. 126
      hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java
  8. 99
      hai-order/src/main/java/com/web/rocketmq/consumer/OrderMobileRechargeConsumer.java
  9. 2
      hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java
  10. 2
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  11. 22
      hai-service/src/main/java/com/hai/goods/service/GoodsLogisticsService.java
  12. 56
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsLogisticsServiceImpl.java
  13. 14
      hai-service/src/main/java/com/hai/mobile/service/MobileHandleService.java
  14. 6
      hai-service/src/main/java/com/hai/mobile/service/impl/MobileHandleServiceImpl.java
  15. 37
      hai-service/src/main/java/com/hai/order/model/GoodsChildOrderExtModel.java
  16. 21
      hai-service/src/main/java/com/hai/order/service/OrderService.java
  17. 2
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  18. 78
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  19. 4
      hai-service/src/main/java/com/hai/service/CommonService.java
  20. 2
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  21. 27
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  22. 3
      hai-service/src/main/java/com/hai/service/impl/HighGoldRecServiceImpl.java
  23. 296
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  24. 4
      v1/src/main/java/com/v1/controller/WxMsgController.java
  25. 5
      v1/src/main/java/com/v1/controller/business/OrderRebateController.java

@ -1,6 +1,7 @@
package com.bweb.controller.Goods;
import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hai.common.exception.ErrorCode;
@ -12,10 +13,12 @@ import com.hai.common.utils.DateUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.GoodsDetail;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.HighApprove;
import com.hai.entity.HighGoodsType;
import com.hai.enum_type.ApproveType;
import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighApproveService;
@ -54,6 +57,9 @@ public class GoodsDetailController {
@Autowired
private UserCenter userCenter;
@Resource
private GoodsLogisticsService logisticsService;
@RequestMapping(value = "/getListGoodsDetail", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品列表")
@ -162,6 +168,8 @@ public class GoodsDetailController {
goodsDetail.setStatus(goods.getStatus());
goodsDetail.setCreateTime(goods.getCreateTime());
goodsDetail.setOpName(goods.getOpName());
goodsDetail.setOpId(goods.getOpId());
goodsDetail.setUpdateTime(new Date());
goodsDetail.setGoodsTypeName(goodsType.getTitle());
goodsDetail.setCompanyId(userInfoModel.getBsCompany().getId());
@ -280,8 +288,6 @@ public class GoodsDetailController {
goodsDetail.setStatus(goodsDetail.getStatus() == 1 ? 2:3);
goodsDetail.setUpdateTime(new Date());
goodsDetail.setOpId(userInfoModel.getSecUser().getId());
goodsDetail.setOpName(userInfoModel.getSecUser().getLoginName());
goodsDetailService.updateGoodsDetail(goodsDetail);
return ResponseMsgUtil.success("操作成功!");
@ -291,5 +297,22 @@ public class GoodsDetailController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
GoodsLogistics logistics = (GoodsLogistics) logisticsService.getLogisticsMsg(orderId);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -263,7 +263,7 @@ public class CommonController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
}
JSONObject object = commonService.findByLatAndLng(lng, lat).getJSONObject("result").getJSONObject("addressComponent");
JSONObject object = jsonObjectR.getJSONObject("result").getJSONObject("addressComponent");
ApiCity apiCity = commonService.findCityByName(object.getString("city"));
@ -296,6 +296,46 @@ public class CommonController {
}
}
@RequestMapping(value = "/baiduApiMapSearch", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
public ResponseData baiduApiMapSearch(
@RequestParam(name = "lng", required = true) String lng,
@RequestParam(name = "lat", required = true) String lat,
@RequestParam(name = "query", required = false) String query) {
try {
if (query == null) {
JSONObject map = commonService.findByLatAndLng(lng, lat);
if (!map.getString("status").equals("0")) {
log.error("findByLatAndLng error!", "定位错误,请重新定位");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
}
query = map.getJSONObject("result").getString("formatted_address");
}
Map<String , Object> map = new HashMap<>();
map.put("query" , query);
map.put("location", lat+","+lng);
JSONObject jsonObjectR = commonService.baiduApiMapSearch(map);
if (!jsonObjectR.getString("status").equals("0")) {
log.error("findByLatAndLng error!", "定位错误,请重新定位");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "定位错误,请重新定位");
}
return ResponseMsgUtil.success(jsonObjectR.getJSONArray("results"));
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findCompanyByCityName", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
@ -442,4 +482,26 @@ public class CommonController {
}
}
@RequestMapping(value = "/gaoDeApiMapSearch", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取定位信息")
public ResponseData gaoDeApiMapSearch(
@RequestParam(name = "query", required = false) String query) {
try {
Map<String , Object> map = new HashMap<>();
map.put("keywords" , query);
map.put("extensions" , "all");
JSONObject jsonObject = commonService.gaoDeApiMapSearch(map);
return ResponseMsgUtil.success(jsonObject.getJSONArray("tips"));
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -210,10 +210,10 @@ public class GoodsController {
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "num", required = true) String num) {
public ResponseData getLogisticsMsg(@RequestParam(name = "orderId", required = false) Long orderId) {
try {
return ResponseMsgUtil.success(logisticsService.getLogisticsMsg(num));
return ResponseMsgUtil.success(logisticsService.getLogisticsMsg(orderId));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
@ -222,7 +222,5 @@ public class GoodsController {
}
}

@ -11,12 +11,14 @@ import com.hai.common.utils.BaiduUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.goods.service.DeliveryAddressService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.model.GoodsOrderModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.model.GoodsChildOrderExtModel;
import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderChildGoodsType;
@ -37,7 +39,9 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@ -59,6 +63,9 @@ public class OrderController {
@Resource
private DeliveryAddressService deliveryAddressService;
@Resource
private GoodsLogisticsService goodsLogisticsService;
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建订单")
@ -177,6 +184,21 @@ public class OrderController {
HighOrder highOrder = orderService.getOrderDetailByNo(orderNo);
if (highOrder.getProductType() == 12) {
// todo 临时代码
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(childOrder.getId());
if (logistics != null) {
childOrder.setExt6(logistics.getLogisticsStatusDesc());
childOrder.setExt4(logistics.getNumber());
}
}
GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo());
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId());
@ -184,6 +206,8 @@ public class OrderController {
BeanUtils.copyProperties(highOrder , goodsOrderModel);
goodsOrderModel.setGoodsOrder(order);
goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress);
return ResponseMsgUtil.success(goodsOrderModel);
}

@ -11,16 +11,20 @@ import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
import com.hai.entity.*;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.goods.model.GoodsModel;
import com.hai.goods.service.DeliveryAddressService;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.goods.service.GoodsSkuService;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.order.model.ExportOrderMobileModel;
import com.hai.order.model.GoodsChildOrderExtModel;
import com.hai.order.model.GoodsOrderExtModel;
import com.hai.order.service.OrderService;
import com.hai.order.type.OrderPayType;
@ -66,6 +70,12 @@ public class GoodsOrderController {
@Resource
private GoodsLogisticsService goodsLogisticsService;
@Resource
private DeliveryAddressService deliveryAddressService;
@Resource
private RedisUtil redisUtil;
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单列表")
@ -195,4 +205,94 @@ public class GoodsOrderController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getOrderChildList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询子订单列表")
public ResponseData getOrderChildList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "childOrderNo", required = false) String childOrderNo,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "status", required = false) Integer status,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
Map<String,Object> map = new HashMap<>();
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("orderNo", orderNo);
map.put("secUserId", userInfoModel.getSecUser().getId());
map.put("childOrderNo", childOrderNo);
map.put("memPhone", memPhone);
map.put("status", status);
List<HighChildOrder> list = orderService.getChildOrderList(map);
List<GoodsChildOrderExtModel> goodsChildOrderExtModels = new ArrayList<>();
GoodsChildOrderExtModel model;
for (HighChildOrder order : list) {
model = new GoodsChildOrderExtModel();
BeanUtils.copyProperties(order, model);
GoodsLogistics logistics = goodsLogisticsService.findGoodsLogistics(order.getId());
if (logistics != null) {
model.setLogisticsStatus(logistics.getLogisticsStatusDesc());
model.setLogisticsNo(logistics.getNumber());
}
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(order.getOrderNo());
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(goodsOrder.getDeliveryAddressId());
model.setDeliveryAddressMsg(goodsOrder.getDeliveryAddress() + "-" + deliveryAddress.getConsignee() + " " + deliveryAddress.getPhone());
goodsChildOrderExtModels.add(model);
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsChildOrderExtModels.size(), pageSize, new PageInfo<>(goodsChildOrderExtModels)));
} catch (Exception e) {
log.error("OrderCouponController --> getOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/editLogisticsNo", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "录入运单号")
public ResponseData editLogisticsNo(@RequestParam(name = "orderId", required = false) Long orderId,
@RequestParam(name = "logisticsNo", required = false) String logisticsNo
) {
try {
UserInfoModel userInfoModel = userCenter.getSessionModel(UserInfoModel.class);
if (userInfoModel == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(logisticsNo);
jsonObjects.getJSONObject("data").put("orderId" , orderId);
GoodsLogistics logistics = goodsLogisticsService.editLogistics(jsonObjects.getJSONObject("data"));
redisUtil.set("logisticsMsg" + orderId , logistics ,21600);
return ResponseMsgUtil.success("录入成功");
} catch (Exception e) {
log.error("OrderCouponController --> getOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -7,6 +7,7 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighOrder;
import com.hai.entity.OutRechargeChildOrder;
@ -21,6 +22,7 @@ import com.hai.order.service.OrderService;
import com.hai.order.type.OrderPayType;
import com.hai.order.type.OrderStatus;
import com.hai.order.type.RechargePlatformType;
import com.hai.service.HighOrderService;
import com.hai.service.OutRechargeChildOrderService;
import com.hai.service.OutRechargeOrderService;
import com.hai.service.impl.OutRechargeOrderServiceImpl;
@ -29,6 +31,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -38,10 +42,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Controller
@RequestMapping(value = "mobileRecharge")
@ -57,12 +59,19 @@ public class OrderMobileRechargeController {
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargeChildOrderService outRechargeChildOrderService;
private OrderService orderService;
@Resource
private HighOrderService highOrderService;
@Autowired
private RedisTemplate redisTemplate;
@Resource
private OrderService orderService;
private RedisUtil redisUtil;
@Resource
private OutRechargeChildOrderService outRechargeChildOrderService;
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
@ResponseBody
@ -71,6 +80,7 @@ public class OrderMobileRechargeController {
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "memCardNo", required = false) String memCardNo,
@RequestParam(name = "title", required = false) String title,
@RequestParam(name = "exceptionStatus", required = false) Boolean exceptionStatus,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "orderStatus", required = false) Integer orderStatus,
@RequestParam(name = "companyId", required = false) Long companyId,
@ -80,8 +90,8 @@ public class OrderMobileRechargeController {
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE,
@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 = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
@ -99,6 +109,8 @@ public class OrderMobileRechargeController {
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
map.put("exceptionStatus", exceptionStatus);
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("payTimeS", payTimeS);
@ -129,10 +141,12 @@ public class OrderMobileRechargeController {
@ApiOperation(value = "导出话费订单列表")
public ResponseData exportMobilePartyOrderList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "memPhone", required = false) String memPhone,
@RequestParam(name = "serialNumber", required = false) String serialNumber,
@RequestParam(name = "memCardNo", required = false) String memCardNo,
@RequestParam(name = "payType", required = false) Integer payType,
@RequestParam(name = "orderStatus", required = false) Integer orderStatus,
@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "exceptionStatus", required = false) Boolean exceptionStatus,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "title", required = false) String title,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@ -142,6 +156,7 @@ public class OrderMobileRechargeController {
@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 {
@ -159,6 +174,7 @@ public class OrderMobileRechargeController {
}
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("exceptionStatus", exceptionStatus);
map.put("payTimeS", payTimeS);
map.put("payTimeE", payTimeE);
map.put("finishTimeS", finishTimeS);
@ -178,8 +194,20 @@ public class OrderMobileRechargeController {
List<ExportOrderMobileModel> list = new ArrayList<>();
// 配置初始化处理条数
int i = 0;
int percent;
ExportOrderMobileModel model;
for (HighOrder highOrder : order) {
i++;
// 生成百分比
percent = i*100/order.size();
redisUtil.set(serialNumber , percent , 3600);
model = new ExportOrderMobileModel();
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo());
@ -226,6 +254,8 @@ public class OrderMobileRechargeController {
.head(ExportOrderMobileModel.class)
.sheet("话费交易订单")
.doWrite(list);
redisUtil.set(serialNumber + "download" , pathName , 600);
return ResponseMsgUtil.success(pathName);
} catch (Exception e) {
@ -240,7 +270,7 @@ public class OrderMobileRechargeController {
public ResponseData getMobileOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
Map<String, Object> map = new HashMap<>();
map.put("tradeOrder", orderService.getOrderDetailByNo(orderNo));
map.put("tradeOrder", orderService.getOrderDetail(orderNo));
map.put("mobileOrder", outRechargeOrderService.findByOrderNo(orderNo));
return ResponseMsgUtil.success(map);
@ -250,4 +280,82 @@ public class OrderMobileRechargeController {
}
}
@RequestMapping(value="/refundOrder",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单退款")
public ResponseData refundOrder(@RequestParam(name = "orderNo", required = true) String orderNo) {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(orderNo);
String key = "recharge_" + outRechargeOrder.getId();
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, outRechargeOrder.getOrderNo());
if(Boolean.TRUE.equals(lock)) {
// 加锁成功,处理业务
// 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单存在多个充值订单 5:订单充值完成 6:充值订单号未查询到任何充值记录
int orderStatus = outRechargeOrderService.orderWhetherRecharge(outRechargeOrder);
if (orderStatus == 2) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId());
}
if (orderStatus == 6) {
outRechargeOrderService.refundOrder(outRechargeOrder.getId());
}
} else {
// 加锁失败,重试
Thread.sleep(100);
refundOrder(orderNo);
}
HighOrder order = highOrderService.getOrderByOrderNo(orderNo);
order.setExceptionStatus(false);
highOrderService.updateOrder(order);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("OrderExtController -> getGasOrderDetail() error!",e);
return ResponseMsgUtil.exception(e);
} finally {
// 删除key,释放锁
redisTemplate.delete(key);
}
}
@RequestMapping(value="/orderNormal",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "订单修改正常")
public ResponseData orderNormal(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNo(orderNo);
List<OutRechargeChildOrder> rechargeChildOrderList = outRechargeChildOrderService.getListRechargeChildOrderByOrderId(rechargeOrder.getId());
for (OutRechargeChildOrder rechargeChildOrder : rechargeChildOrderList) {
if (rechargeChildOrder.getStatus() == 104) {
rechargeChildOrder.setStatus(102);
}
outRechargeChildOrderService.updateOrder(rechargeChildOrder);
}
HighOrder order = highOrderService.getOrderByOrderNo(orderNo);
order.setExceptionStatus(false);
highOrderService.updateOrder(order);
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("OrderExtController -> getGasOrderDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -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);
}
}
}

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

@ -100,7 +100,7 @@ public class RechargeConfig {
paramMap.put("out_trade_nums" , object.getString("out_trade_nums"));
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/check", paramMap);

@ -55,6 +55,16 @@ public interface GoodsLogisticsService {
*/
GoodsLogistics findGoodsLogisticsById(Long id);
/**
* @Author Sum1Dream
* @Name findGoodsLogisticsById
* @Description // 根据id查询物流信息
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsLogistics
*/
GoodsLogistics findGoodsLogistics(Long orderId);
/**
* @Author Sum1Dream
* @Name findGoodsLogisticsByNum
@ -84,4 +94,16 @@ public interface GoodsLogisticsService {
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(String num);
/**
* @Author Sum1Dream
* @Name getLogisticsMsg
* @Description // 查询物流信息
* @Date 16:19 2023/4/20
* @Param [num]
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(Long orderId);
}

@ -1,6 +1,9 @@
package com.hai.goods.service.impl;
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.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
@ -50,6 +53,22 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
return goodsLogisticsMapper.selectByPrimaryKey(id);
}
@Override
public GoodsLogistics findGoodsLogistics(Long orderId) {
GoodsLogisticsExample example = new GoodsLogisticsExample();
GoodsLogisticsExample.Criteria criteria = example.createCriteria();
criteria.andOrderIdEqualTo(orderId).andStatusEqualTo(1);
List<GoodsLogistics> logistics = goodsLogisticsMapper.selectByExample(example);
if (logistics.size() > 0) {
return logistics.get(0);
}
return null;
}
@Override
public GoodsLogistics findGoodsLogisticsByNum(String num) {
GoodsLogisticsExample example = new GoodsLogisticsExample();
@ -78,6 +97,7 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
}
logistics.setTaskNo(jsonObject.getString("orderNo"));
logistics.setTheLastTime(info.getDate("theLastTime"));
logistics.setTheLastMessage(info.getString("theLastMessage"));
logistics.setTakeTime(info.getString("takeTime"));
@ -87,11 +107,12 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
logistics.setLogisticsStatusDesc(info.getString("logisticsStatusDesc"));
logistics.setLogisticsTraceDetails(info.getString("logisticsTraceDetailList"));
logistics.setStatus(1);
if ( logistics.getId() == null) {
if ( logistics.getId() == null || !Objects.equals(logistics.getOrderId(), jsonObject.getLong("orderId"))) {
logistics.setOrderId(jsonObject.getLong("orderId"));
logistics.setCreateTime(new Date());
insertGoodsLogistics(logistics);
} else {
logistics.setOrderId(jsonObject.getLong("orderId"));
updateGoodsLogistics(logistics);
}
@ -133,4 +154,35 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
return data;
}
}
@Override
public Object getLogisticsMsg(Long orderId) {
Object data = redisUtil.get("logisticsMsg" + orderId);
if (data == null) {
GoodsLogistics goodsLogistics = findGoodsLogistics(orderId);
if (goodsLogistics == null || goodsLogistics.getNumber() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂未发货!");
}
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(goodsLogistics.getNumber());
redisUtil.set("logisticsMsgOl" + orderId , jsonObjects ,21600);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
jsonObjects.getJSONObject("data").put("orderId" , orderId);
GoodsLogistics logistics = editLogistics((JSONObject) jsonObjects.get("data"));
redisUtil.set("logisticsMsg" + orderId , logistics ,21600);
return logistics;
}
return jsonObjects;
} else {
return data;
}
}
}

@ -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,37 @@
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;
private String logisticsNo;
private String deliveryAddressMsg;
public String getDeliveryAddressMsg() {
return deliveryAddressMsg;
}
public void setDeliveryAddressMsg(String deliveryAddressMsg) {
this.deliveryAddressMsg = deliveryAddressMsg;
}
public String getLogisticsNo() {
return logisticsNo;
}
public void setLogisticsNo(String logisticsNo) {
this.logisticsNo = logisticsNo;
}
public String getLogisticsStatus() {
return logisticsStatus;
}
public void setLogisticsStatus(String logisticsStatus) {
this.logisticsStatus = logisticsStatus;
}
}

@ -69,6 +69,17 @@ public interface OrderService {
*/
HighOrder getOrderDetailByNo(String orderNo);
/**
* @Author Sum1Dream
* @Name getOrderDetail
* @Description // 查询线上
* @Date 18:29 2023/5/18
* @Param [orderNo]
* @Return com.hai.entity.HighOrder
*/
HighOrder getOrderDetail(String orderNo);
/**
* 根据子订单号查询子订单信息
* @param childOrderNo
@ -103,4 +114,14 @@ public interface OrderService {
*/
List<HighOrder> phoneErrorOrder();
/**
* @Author Sum1Dream
* @Name getChildOrderList
* @Description // 查询子订单数量
* @Date 15:54 2023/5/16
* @Param [param]
* @Return java.util.List<com.hai.entity.HighChildOrder>
*/
List<HighChildOrder> getChildOrderList(Map<String,Object> param);
}

@ -883,6 +883,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
// 生成充值订单
outRechargeOrder.setUserId(order.getMemId());
outRechargeOrder.setRechargeContent(rechargeContent);
outRechargeOrder.setCompanyId(outRechargePrice.getCompanyId());
@ -929,6 +930,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
childOrder.setGoodsType(OrderChildGoodsType.TYPE11.getNumber());
childOrder.setGoodsId(createOrderChild.getGoodsId());
childOrder.setGoodsName(goods.getName());
childOrder.setSecUserId(goods.getOpId());
childOrder.setSkuId(createOrderChild.getSkuId());
childOrder.setGoodsSpecName(goodsSku.getName());
childOrder.setGoodsPrice(goodsSku.getOriginalPrice());

@ -623,14 +623,6 @@ 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();
@ -764,6 +756,18 @@ public class OrderServiceImpl implements OrderService {
return order;
}
@Override
public HighOrder getOrderDetail(String orderNo) {
HighOrderExample orderExample = new HighOrderExample();
orderExample.createCriteria().andOrderNoEqualTo(orderNo);
List<HighOrder> orderList = orderMapper.selectByExample(orderExample);
if (orderList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的订单号");
}
return orderList.get(0);
}
@Override
public HighChildOrder getChildOrderByNo(String childOrderNo) {
HighChildOrderExample childOrderExample = new HighChildOrderExample();
@ -784,6 +788,10 @@ public class OrderServiceImpl implements OrderService {
criteria.andMemIdEqualTo(MapUtils.getLong(param, "userId"));
}
if (MapUtils.getBoolean(param, "exceptionStatus") != null) {
criteria.andExceptionStatusEqualTo(MapUtils.getBoolean(param, "exceptionStatus"));
}
if (MapUtils.getLong(param, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(param, "companyId"));
}
@ -824,23 +832,26 @@ public class OrderServiceImpl implements OrderService {
}
if (MapUtils.getLong(param, "payTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "payTimeS")));
criteria.andPayTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "payTimeS")));
}
if (MapUtils.getLong(param, "payTimeE") != null) {
criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(param, "payTimeE")));
criteria.andPayTimeLessThan(new Date(MapUtils.getLong(param, "payTimeE")));
}
if (MapUtils.getLong(param, "finishTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "finishTimeS")));
criteria.andFinishTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "finishTimeS")));
}
if (MapUtils.getLong(param, "finishTimeE") != null) {
criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(param, "finishTimeE")));
criteria.andFinishTimeLessThan(new Date(MapUtils.getLong(param, "finishTimeE")));
}
if (StringUtils.isNotBlank(MapUtils.getString(param, "refundTimeS")) && StringUtils.isNotBlank(MapUtils.getString(param, "refundTimeE"))) {
criteria.andRefundTimeBetween(
DateUtil.format(MapUtils.getString(param, "refundTimeS"), "yyyy-MM-dd HH:mm:ss"),
DateUtil.format(MapUtils.getString(param, "refundTimeE"), "yyyy-MM-dd HH:mm:ss"));
if (MapUtils.getLong(param, "refundTimeS") != null) {
criteria.andRefundTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "refundTimeS")));
}
if (MapUtils.getLong(param, "refundTimeE") != null) {
criteria.andRefundTimeLessThan(new Date(MapUtils.getLong(param, "refundTimeE")));
}
example.setOrderByClause("create_time desc");
return orderMapper.selectByExample(example);
@ -861,4 +872,39 @@ public class OrderServiceImpl implements OrderService {
public List<HighOrder> phoneErrorOrder() {
return orderMapper.phoneErrorOrder();
}
@Override
public List<HighChildOrder> getChildOrderList(Map<String, Object> param) {
HighChildOrderExample example = new HighChildOrderExample();
HighChildOrderExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(param, "orderNo") != null) {
criteria.andOrderNoEqualTo(MapUtils.getString(param, "orderNo"));
}
if (MapUtils.getString(param, "childOrderNo") != null) {
criteria.andChildOrderNoEqualTo(MapUtils.getString(param, "childOrderNo"));
}
if (MapUtils.getString(param, "memPhone") != null) {
criteria.andMemPhoneEqualTo(MapUtils.getString(param, "memPhone"));
}
if (MapUtils.getInteger(param, "status") != null) {
criteria.andChildOrderStatusEqualTo(MapUtils.getInteger(param, "status"));
}
if (MapUtils.getLong(param, "createTimeS") != null) {
criteria.andCreateTimeGreaterThanOrEqualTo(new Date(MapUtils.getLong(param, "createTimeS")));
}
if (MapUtils.getLong(param, "createTimeE") != null) {
criteria.andCreateTimeLessThan(new Date(MapUtils.getLong(param, "createTimeE")));
}
if (MapUtils.getLong(param, "secUserId") != null) {
criteria.andSecUserIdEqualTo(MapUtils.getLong(param, "secUserId"));
}
example.setOrderByClause("create_time desc");
return childOrderMapper.selectByExample(example);
}
}

@ -253,6 +253,10 @@ public interface CommonService {
*/
JSONObject findByLatAndLng( String lng , String lat) throws Exception;
JSONObject baiduApiMapSearch(Map<String , Object> map);
JSONObject gaoDeApiMapSearch(Map<String , Object> map);
/**
* @Author Sum1Dream
* @name configPayType.java

@ -205,7 +205,7 @@ public interface OutRechargeOrderService {
* @Description // 订单是否可以充值
* @Date 16:11 2023/3/28
* @Param [childOrder]
* @Return java.lang.Integer 1满足继续充值条件 2订单满足退款条件 3订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成
* @Return java.lang.Integer 1满足继续充值条件 2订单满足退款条件 3订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成 6充值订单号未查询到任何充值记录
*/
Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder);

@ -562,6 +562,33 @@ public class CommonServiceImpl implements CommonService {
}
@Override
public JSONObject baiduApiMapSearch(Map<String, Object> map) {
//申请百度开放平台KEY(ak)
map.put("ak", "SfrwGH7INvjPq7BwCrYrioBQZm9XXxrR");
// 输出Json数据
map.put("output", "json");
// 圆形区域检索半径,单位为米。(增加区域内数据召回权重,如需严格限制召回数据在区域内,请搭配使用radius_limit参数),当半径过大,超过中心点所在城市边界时,会变为城市范围检索,检索范围为中心点所在城市
map.put("radius", "500");
// 检索结果详细程度。取值为1 或空,则返回基本信息;取值为2,返回检索POI详细信息
map.put("scope", "1");
// 是否召回国标行政区划编码,true(召回)、false(不召回)
map.put("extensions_adcode", "true");
// GPS 经纬度类型
map.put("coordtype", "wgs84ll");
return HttpsUtils.doGet("https://api.map.baidu.com/place/v2/search" , map);
}
@Override
public JSONObject gaoDeApiMapSearch(Map<String, Object> map) {
map.put("key" , "b7f6a6c5cd9801a82a0dc827f271a75d");
return HttpsUtils.doGet("https://restapi.amap.com/v3/assistant/inputtips" , map);
}
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void configPayType(JSONObject object) {

@ -59,6 +59,9 @@ public class HighGoldRecServiceImpl implements HighGoldRecService {
if (MapUtils.getLong(map, "resId") != null) {
criteria.andResIdEqualTo(MapUtils.getLong(map, "resId"));
}
if (MapUtils.getString(map, "resOrderNo") != null) {
criteria.andResOrderNoEqualTo(MapUtils.getString(map, "resOrderNo"));
}
if (MapUtils.getLong(map , "createTimeS") != null) {
criteria.andCreateTimeBetween(new Date(MapUtils.getLong(map , "createTimeS")) , new Date(MapUtils.getLong(map , "createTimeE")));

@ -399,42 +399,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
@Override
public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) {
JSONObject object = new JSONObject();
object.put("rechargePrice" , outRechargeOrder.getRechargePrice());
object.put("rechargeMobile" , outRechargeOrder.getRechargeContent());
object.put("productId" , outRechargeOrder.getGoodsId());
object.put("parentOrderId" , outRechargeOrder.getId());
// 判断参数是否为空
if (
object.getBigDecimal("rechargePrice") == null ||
object.getString("rechargeMobile") == null ||
object.getInteger("productId") == null ||
object.getLong("parentOrderId") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 定义子订单对象
OutRechargeChildOrder childOrder = new OutRechargeChildOrder();
// 补充下单参数
object = prepaidRechargeOrderHandle(object);
// 补充子订单参数
childOrder.setParentOrderId(object.getLong("parentOrderId"));
childOrder.setRechargePlatform(object.getInteger("rechargePlatform"));
childOrder.setStatus(102);
childOrder.setOrderNo("CZ" + OrderUtil.generateOrderNo());
childOrder.setUpdateTime(new Date());
childOrder.setCreateTime(new Date());
outRechargeChildOrderService.insertOrder(childOrder);
rocketMQTemplate.syncSend(OrderTopic.MOBILE_TOPIC_PROFIT_RECHARGE.getTopic(), childOrder);
}
@Override
public void prepaidRechargeHandle(OutRechargeOrder outRechargeOrder){
@ -448,7 +413,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if(Boolean.TRUE.equals(lock)) {
// 加锁成功,处理业务
// 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成
// 判断订单是否可以继续充值 1:满足继续充值条件 2:订单满足退款条件 3:订单不可以退款不可以继续充值 4:订单存在多个充值订单 5:订单充值完成 6:充值订单号未查询到任何充值记录
int orderStatus = orderWhetherRecharge(outRechargeOrder);
log.info("处理话费" + outRechargeOrder.getOrderNo() + "订单状态:" + orderStatus);
if (orderStatus == 1) {
@ -460,7 +425,13 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (orderStatus == 4) {
HighOrder highOrder = highOrderService.getOrderByOrderNo(outRechargeOrder.getOrderNo());
highOrder.setExceptionStatus(true);
highOrder.setExceptionContent("话费订单存在多条重复记录");
highOrder.setExceptionContent("订单存在多个充值订单");
highOrderService.updateOrder(highOrder);
}
if (orderStatus == 6) {
HighOrder highOrder = highOrderService.getOrderByOrderNo(outRechargeOrder.getOrderNo());
highOrder.setExceptionStatus(true);
highOrder.setExceptionContent("充值订单号未查询到任何充值记录");
highOrderService.updateOrder(highOrder);
}
if (orderStatus == 5) {
@ -483,6 +454,181 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
// @Override
// public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) {
//
// JSONObject object = new JSONObject();
// object.put("rechargePrice" , outRechargeOrder.getRechargePrice());
// object.put("rechargeMobile" , outRechargeOrder.getRechargeContent());
// object.put("productId" , outRechargeOrder.getGoodsId());
// object.put("parentOrderId" , outRechargeOrder.getId());
//
// // 判断参数是否为空
// if (
// object.getBigDecimal("rechargePrice") == null ||
// object.getString("rechargeMobile") == null ||
// object.getInteger("productId") == null ||
// object.getLong("parentOrderId") == null
// ) {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
// }
//
// // 定义子订单对象
// OutRechargeChildOrder childOrder = new OutRechargeChildOrder();
//
// // 补充下单参数
// object = prepaidRechargeOrderHandle(object);
//
// // 补充子订单参数
// childOrder.setParentOrderId(object.getLong("parentOrderId"));
// childOrder.setRechargePlatform(object.getInteger("rechargePlatform"));
// childOrder.setStatus(102);
// childOrder.setOrderNo("CZ" + OrderUtil.generateOrderNo());
// childOrder.setUpdateTime(new Date());
// childOrder.setCreateTime(new Date());
//
// outRechargeChildOrderService.insertOrder(childOrder);
//
// // -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);
// }
// }
@Override
public void getPrepaidRechargeApi(OutRechargeOrder outRechargeOrder) {
JSONObject object = new JSONObject();
object.put("rechargePrice" , outRechargeOrder.getRechargePrice());
object.put("rechargeMobile" , outRechargeOrder.getRechargeContent());
object.put("productId" , outRechargeOrder.getGoodsId());
object.put("parentOrderId" , outRechargeOrder.getId());
// 判断参数是否为空
if (
object.getBigDecimal("rechargePrice") == null ||
object.getString("rechargeMobile") == null ||
object.getInteger("productId") == null ||
object.getLong("parentOrderId") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 定义子订单对象
OutRechargeChildOrder childOrder = new OutRechargeChildOrder();
// 补充下单参数
object = prepaidRechargeOrderHandle(object);
// 补充子订单参数
childOrder.setParentOrderId(object.getLong("parentOrderId"));
childOrder.setRechargePlatform(object.getInteger("rechargePlatform"));
childOrder.setStatus(102);
childOrder.setOrderNo("CZ" + OrderUtil.generateOrderNo());
childOrder.setUpdateTime(new Date());
childOrder.setCreateTime(new Date());
outRechargeChildOrderService.insertOrder(childOrder);
// 尖椒充值
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.setRechargePlatform(1);
childOrder.setExt1("尖椒" + returnObject.toJSONString());
childOrder.setExt2(object.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.setRechargePlatform(2);
childOrder.setExt1("龙阅充值" + returnObject.toJSONString());
childOrder.setExt2("龙阅请求参数" + object.toJSONString());
childOrder.setExt3("龙阅充值" + 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.setRechargePlatform(4);
childOrder.setExt1("畅停充值" + returnObject.toJSONString());
childOrder.setExt2("畅停请求参数" + object.toJSONString());
childOrder.setExt3("畅停充值" + returnObject.toJSONString());
}
childOrder.setUpdateTime(new Date());
outRechargeChildOrderService.updateOrder(childOrder);
}
@Override
public void completeOrder(Long orderId) {
@ -503,6 +649,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (highOrder != null) {
highOrder.setOrderStatus(OrderStatusEnum.type3.getType());
highOrder.setFinishTime(new Date());
highOrder.setExceptionStatus(false);
highOrder.setExceptionContent(null);
for (HighChildOrder highChildOrder : highOrder.getHighChildOrderList()) {
highChildOrder.setChildOrderStatus(OrderChildStatus.STATUS3.getNumber());
highChildOrder.setFinishTime(new Date());
@ -553,28 +701,28 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
public Integer getRechargeOrderLegality(OutRechargeChildOrder childOrder) {
try {
JSONObject object = new JSONObject();
Integer status = 99;
// 龙阅
if (childOrder.getRechargePlatform() == 2) {
object.put("out_trade_nums" , childOrder.getOrderNo());
JSONObject jsonObject = RechargeConfig.checkOrderByLy(object);
childOrder.setExt3("龙阅查询"+ jsonObject);
JSONArray objectJSONArray = jsonObject.getJSONArray("data");
JSONObject objectData = new JSONObject();
for (Object objects : objectJSONArray) {
objectData = (JSONObject) objects;
}
if (objectData.size() == 0) {
if (jsonObject.getInteger("errno") == 0) {
return 2;
} else {
return 99;
}
} else {
if (objectData.size() > 0) {
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
return objectData.getInteger("state");
status = objectData.getInteger("state");
}
}
@ -583,37 +731,46 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
object.put("orderid" , childOrder.getOrderNo());
JSONObject jsonObject = RechargeConfig.checkOrderByHg(object);
if (jsonObject.getJSONArray("data") == null) {
if (jsonObject.getInteger("code") == 20001) {
return 2;
}
return 99;
} else {
childOrder.setExt3("畅停查询"+ jsonObject);
if (jsonObject.getJSONArray("data") != null) {
JSONArray objectJSONArray = jsonObject.getJSONArray("data");
JSONObject objectData;
for (Object objects : objectJSONArray) {
objectData = (JSONObject) objects;
// 0充值中,1成功,2失败,3已取消,4部分充值,5缓存订单
// -1取消,0充值中 ,1充值成功,2充值失败,3部分成功
if (objectData.getInteger("status") == 0 || objectData.getInteger("status") == 5) {
return 0;
status = 0;
} else if (objectData.getInteger("status") == 1) {
return 1;
status = 1;
} else if (objectData.getInteger("status") == 2) {
return 2;
status = 2;
} else if (objectData.getInteger("status") == 3) {
return -1;
status = -1;
} else if (objectData.getInteger("status") == 4) {
return 3;
status = 3;
}
}
}
}
return 99;
if (status == 1) {
childOrder.setStatus(101);
}
if (status == 2 || status == -1) {
childOrder.setStatus(103);
}
if (status == 99 ) {
childOrder.setStatus(104);
}
childOrder.setUpdateTime(new Date());
outRechargeChildOrderService.updateOrder(childOrder);
return status;
}catch (Exception e) {
return null;
return 99;
}
@ -692,7 +849,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
List<OutRechargeChildOrder> childOrderList = outRechargeChildOrderService.getListRechargeChildOrderByOrderId(rechargeOrder.getId());
if (childOrderList.size() == 0) {
return 4;
return 6;
}
// 充值订单充值时间
@ -732,14 +889,17 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (status == 2 || status == -1) {
// 修改充值订单状态
rechargeChildOrderHandle(childOrders102.get(0) , 103);
// 如果订单记录超过5条退款 反之继续充值
if (childOrderList.size() > 4) {
// 如果订单记录超过2条退款 反之继续充值
if (childOrderList.size() > 1) {
return 2;
} else {
// 如果订单记录超过71小时 反之继续充值
return hours > 71 ? 2 : 1;
}
}
if (status == 99) {
return 6;
}
// 充值订单为充值成功
if (status == 1) {
// 修改充值订单状态
@ -757,8 +917,8 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
if (status == 2 || status == -1) {
// 修改充值订单状态
rechargeChildOrderHandle(childOrderList.get(0) , 103);
// 如果订单记录超过5条退款 反之继续充值
if (childOrderList.size() > 4) {
// 如果订单记录超过2条退款 反之继续充值
if (childOrderList.size() > 1) {
return 2;
} else {
// 如果订单记录超过71小时 反之继续充值
@ -766,17 +926,15 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
}
}
if (status == 99) {
return 6;
}
if (status == 1) {
// 修改充值订单状态
rechargeChildOrderHandle(childOrderList.get(0) , 101);
return 5;
}
} else {
// 如果订单记录超过71小时 反之继续充值
return hours > 71 ? 2 : 1;
}
}
return 3;
}

@ -216,7 +216,7 @@ public class WxMsgController {
linkContent =
"支付分享,享受更高优惠[礼物]\n\n"
+ "<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000013&key=&code="
+ CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000012&key=&code="
+ object.getString("code")
+ "'>分享好友</a>\n\n";
}
@ -339,7 +339,7 @@ public class WxMsgController {
linkContent =
"支付分享,享受更高优惠[礼物]\n\n"
+ "<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000013&key=&code="
+ CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5?accountId=0000012&key=&code="
+ object.getString("code")
+ "'>分享好友</a>\n\n";
}

@ -172,6 +172,7 @@ public class OrderRebateController {
Map<String, Object> mapGold = new HashMap<>();
mapGold.put("goldType", 1);
mapGold.put("resId", object.getLong("orderId"));
mapGold.put("resOrderNo", object.getString("orderNo"));
List<HighGoldRec> goldRecs = highGoldRecService.getGoldRec(mapGold);
@ -296,10 +297,6 @@ public class OrderRebateController {
}
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);

Loading…
Cancel
Save