提交实物代码

new-dev
袁野 2 years ago
parent 8825ff18c9
commit 4fe20c8f83
  1. 44
      hai-bweb/src/main/java/com/bweb/controller/CommonController.java
  2. 32
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java
  3. 1
      hai-bweb/src/main/java/com/bweb/controller/HighAgentController.java
  4. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  5. 1
      hai-bweb/src/main/java/com/bweb/controller/SecUserController.java
  6. 15
      hai-cweb/src/main/java/com/cweb/controller/CommonController.java
  7. 21
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  8. 33
      hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java
  9. 36
      hai-order/src/main/java/com/web/controller/OrderController.java
  10. 6
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  11. 2
      hai-order/src/main/java/com/web/controller/OrderRefundController.java
  12. 198
      hai-order/src/main/java/com/web/controller/business/GoodsOrderController.java
  13. 82
      hai-order/src/main/java/com/web/controller/business/OrderMobileRechargeController.java
  14. 8
      hai-order/src/main/java/com/web/controller/business/OrderThirdPartyController.java
  15. 7
      hai-order/src/main/java/com/web/rocketmq/consumer/OrderRefundSuccessConsumer.java
  16. 5
      hai-schedule/src/main/java/com/hai/schedule/HighRechargeOrderSchedule.java
  17. 2
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  18. 14
      hai-service/src/main/java/com/hai/entity/BsProductConfig.java
  19. 4
      hai-service/src/main/java/com/hai/entity/GoodsDetail.java
  20. 4
      hai-service/src/main/java/com/hai/entity/GoodsOrder.java
  21. 2
      hai-service/src/main/java/com/hai/entity/HighGoldRec.java
  22. 3
      hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java
  23. 1
      hai-service/src/main/java/com/hai/enum_type/ApproveType.java
  24. 1
      hai-service/src/main/java/com/hai/enum_type/DiscountUseScope.java
  25. 10
      hai-service/src/main/java/com/hai/goods/service/GoodsLogisticsService.java
  26. 88
      hai-service/src/main/java/com/hai/goods/service/GoodsOrderExtService.java
  27. 10
      hai-service/src/main/java/com/hai/goods/service/GoodsSkuService.java
  28. 5
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java
  29. 48
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsLogisticsServiceImpl.java
  30. 72
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsOrderServiceImpl.java
  31. 46
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsSkuServiceImpl.java
  32. 28
      hai-service/src/main/java/com/hai/model/GoodsOrderModel.java
  33. 2
      hai-service/src/main/java/com/hai/order/model/CreateOrderModel.java
  34. 19
      hai-service/src/main/java/com/hai/order/model/GoodsOrderExtModel.java
  35. 3
      hai-service/src/main/java/com/hai/order/service/OrderCancelHandleService.java
  36. 10
      hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java
  37. 10
      hai-service/src/main/java/com/hai/order/service/OrderRefundHandleService.java
  38. 12
      hai-service/src/main/java/com/hai/order/service/impl/OrderCancelHandleServiceImpl.java
  39. 69
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  40. 20
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  41. 29
      hai-service/src/main/java/com/hai/order/service/impl/OrderRefundHandleServiceImpl.java
  42. 82
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  43. 3
      hai-service/src/main/java/com/hai/order/type/OrderProductType.java
  44. 11
      hai-service/src/main/java/com/hai/service/BsOrderRebateService.java
  45. 10
      hai-service/src/main/java/com/hai/service/CommonService.java
  46. 2
      hai-service/src/main/java/com/hai/service/OutRechargeOrderService.java
  47. 1
      hai-service/src/main/java/com/hai/service/impl/BsDistributionUserRelServiceImpl.java
  48. 99
      hai-service/src/main/java/com/hai/service/impl/BsOrderRebateServiceImpl.java
  49. 6
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  50. 3
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  51. 1
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  52. 43
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  53. 5
      hai-service/src/main/resources/dev/commonConfig.properties
  54. 1
      v1/src/main/java/com/v1/config/AuthConfig.java
  55. 261
      v1/src/main/java/com/v1/controller/WxMsgController.java
  56. 2
      v1/src/main/java/com/v1/controller/business/ApiMerchantsController.java
  57. 16
      v1/src/main/java/com/v1/controller/business/GzSinopecController.java
  58. 110
      v1/src/main/java/com/v1/controller/business/OrderRebateController.java

@ -390,24 +390,19 @@ public class CommonController {
}
}
@RequestMapping(value = "/getLogisticsMsg", method = RequestMethod.GET)
@RequestMapping(value = "/getRegional", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据快递单号查询物流信息")
public ResponseData getLogisticsMsg(@RequestParam(name = "num", required = true) String num) {
@ApiOperation(value = "获取区域信息")
public ResponseData getRegional() {
try {
Object data = redisUtil.get("logisticsMsg" + num);
if (data == null) {
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(num);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
Object data = redisUtil.get("regionalB");
GoodsLogistics logistics = logisticsService.editLogistics((JSONObject) jsonObjects.get("data"));
redisUtil.set("logisticsMsg" + num , logistics ,21600);
if (data == null) {
return ResponseMsgUtil.success(logistics);
}
List<JSONObject> jsonObjects = commonService.getRegional("key" , "title" , "children");
redisUtil.set("regionalB", jsonObjects);
return ResponseMsgUtil.success(jsonObjects);
@ -417,30 +412,19 @@ public class CommonController {
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getRegional", method = RequestMethod.GET)
@RequestMapping(value = "/getIndustry", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取区域信息")
public ResponseData getRegional() {
@ApiOperation(value = "获取行业信息")
public ResponseData getIndustry() {
try {
Object data = redisUtil.get("regionalB");
if (data == null) {
List<JSONObject> jsonObjects = commonService.getRegional("key" , "title" , "children");
redisUtil.set("regionalB", jsonObjects);
return ResponseMsgUtil.success(jsonObjects);
} else {
return ResponseMsgUtil.success(data);
}
JSONObject object = commonService.getIndustry();
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);

@ -8,13 +8,17 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
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.HighApprove;
import com.hai.entity.HighGoodsType;
import com.hai.enum_type.ApproveType;
import com.hai.goods.service.GoodsDetailService;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.HighApproveService;
import com.hai.service.HighGoodsTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -44,6 +48,9 @@ public class GoodsDetailController {
@Resource
private HighGoodsTypeService highGoodsTypeService;
@Resource
private HighApproveService highApproveService;
@Autowired
private UserCenter userCenter;
@ -55,15 +62,22 @@ public class GoodsDetailController {
@RequestParam(value = "status", required = false) Integer status,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@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("title", title);
map.put("status", status);
if (userInfoModel.getSecUser().getExt3() != null) {
map.put("opId" , userInfoModel.getSecUser().getId());
}
PageHelper.startPage(pageNum,pageSize);
List<GoodsDetail> list = goodsDetailService.getGoodsDetailList(map);
@ -246,7 +260,23 @@ public class GoodsDetailController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前状态错误,无法操作!");
}
goodsDetail.setStatus(goodsDetail.getStatus() == 1 ? 2:1);
if (goodsDetail.getStatus() == 2) {
HighApprove approve = new HighApprove();
approve.setObjectType(ApproveType.GOODS_UP_SHELF_APPROVE.getType());
approve.setObjectId(id);
approve.setObjectName(goodsDetail.getName());
approve.setApproveSerialNo(DateUtil.date2String(new Date(), "yyyyMMddHHmmss"));
approve.setStatus(1);
approve.setCreateTime(new Date());
approve.setUpdateTime(new Date());
approve.setSubmitOperatorId(userInfoModel.getSecUser().getId());
approve.setSubmitOperatorName(userInfoModel.getSecUser().getUserName());
// 增加审批
highApproveService.insertApprove(approve);
}
goodsDetail.setStatus(goodsDetail.getStatus() == 1 ? 2:3);
goodsDetail.setUpdateTime(new Date());
goodsDetail.setOpId(userInfoModel.getSecUser().getId());
goodsDetail.setOpName(userInfoModel.getSecUser().getLoginName());

@ -323,6 +323,7 @@ public class HighAgentController {
map.put("status", Integer.toString(status));
}
if (type != null) {
map.put("type", Integer.toString(type));
}

File diff suppressed because one or more lines are too long

@ -193,6 +193,7 @@ public class SecUserController {
secUser.setAdminFlag(user.getAdminFlag());
secUser.setObjectType(user.getObjectType());
secUser.setObjectId(secUser.getCompanyId());
secUser.setExt3(user.getExt3());
secUser.setStatus(user.getStatus());
secUser.setCreateTime(user.getCreateTime());
secUser.setUpdateTime(new Date());

@ -406,4 +406,19 @@ public class CommonController {
}
}
@RequestMapping(value = "/getIndustry", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取行业信息")
public ResponseData getIndustry() {
try {
JSONObject object = commonService.getIndustry();
return ResponseMsgUtil.success(object.getJSONArray("return_data"));
} catch (Exception e) {
log.error("HighOrderController --> unionStagingPay() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -209,26 +209,7 @@ public class GoodsController {
public ResponseData getLogisticsMsg(@RequestParam(name = "num", required = true) String num) {
try {
Object data = redisUtil.get("logisticsMsg" + num);
if (data == null) {
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(num);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
GoodsLogistics logistics = logisticsService.editLogistics((JSONObject) jsonObjects.get("data"));
redisUtil.set("logisticsMsg" + num , logistics ,21600);
redisUtil.set("logisticsMsgOl" + num , logistics ,21600);
return ResponseMsgUtil.success(logistics);
}
return ResponseMsgUtil.success(jsonObjects);
} else {
return ResponseMsgUtil.success(data);
}
return ResponseMsgUtil.success(logisticsService.getLogisticsMsg(num));
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);

@ -1,5 +1,6 @@
package com.cweb.controller.Goods;
import com.alipay.api.domain.Shop;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -76,6 +77,16 @@ public class ShoppingCartController {
GoodsSku sku = goodsSkuService.findGoodsSkuById(Long.valueOf(shoppingCart.getSku()));
shoppingCartModel.setSkuName(sku.getName());
GoodsDetail goodsDetail = goodsDetailService.findGoodsDetailById(shoppingCart.getGoodsId());
if (goodsDetail.getStatus() != 1) {
shoppingCartModel.setLoseEfficacy(true);
}
if (sku.getStock() < Integer.parseInt(shoppingCart.getNum())) {
shoppingCartModel.setNum(String.valueOf(sku.getStock()));
}
shoppingCartModels.add(shoppingCartModel);
}
@ -117,9 +128,16 @@ public class ShoppingCartController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "添加商品不存在");
}
if (sku.getStock() < Integer.parseInt(shoppingCart.getNum())) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "超过最大库存!");
}
shoppingCart.setUserId(userInfoModel.getHighUser().getId());
shoppingCart.setTitle(goodsDetail.getName());
shoppingCart.setImg(goodsDetail.getListImg());
shoppingCart.setImg(sku.getShowImg());
shoppingCart.setOriginalPrice(sku.getOriginalPrice());
shoppingCart.setLoseEfficacy(false);
shoppingCart.setPrice(sku.getPrice());
shoppingCart.setCreateTime(new Date());
shoppingCart.setUpdateTime(new Date());
@ -190,21 +208,20 @@ public class ShoppingCartController {
GoodsShoppingCart shoppingCart = shoppingCartService.findShoppingCartById(id);
if (shoppingCart == null) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关信息");
}
GoodsSku sku = goodsSkuService.findGoodsSkuById(Long.valueOf(shoppingCart.getSku()));
if (!Objects.equals(userInfoModel.getHighUser().getId(), shoppingCart.getUserId())) {
log.error("GoodsDetailController -> findGoodsDetailById() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户信息错误");
}
if (sku.getStock() < Integer.parseInt(num)) {
log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "超过最大库存!");
}
shoppingCart.setNum(num);
shoppingCart.setUpdateTime(new Date());
shoppingCartService.updateShoppingCart(shoppingCart);
return ResponseMsgUtil.success("增加成功");

@ -7,10 +7,12 @@ 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.BaiduUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.entity.*;
import com.hai.goods.service.DeliveryAddressService;
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;
@ -28,6 +30,7 @@ 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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
@ -50,6 +53,12 @@ public class OrderController {
@Resource
private UserCenter userCenter;
@Resource
private GoodsOrderExtService goodsOrderExtService;
@Resource
private DeliveryAddressService deliveryAddressService;
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建订单")
@ -70,14 +79,13 @@ public class OrderController {
body.setMemName(userModel.getHighUser().getName());
body.setMemPhone(userModel.getHighUser().getPhone());
if (body == null
|| body.getChildOrderList() == null
|| body.getChildOrderList().size() == 0) {
if (body.getChildOrderList() == null || body.getChildOrderList().size() == 0) {
log.error("OrderController -> create() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
for (CreateOrderChildModel childModel : body.getChildOrderList()) {
childModel.setMemId(body.getMemId());
childModel.setMemName(body.getMemName());
childModel.setMemPhone(body.getMemPhone());
@ -166,7 +174,21 @@ public class OrderController {
public ResponseData getDetailByOrderNo(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
return ResponseMsgUtil.success(orderService.getOrderDetailByNo(orderNo));
HighOrder highOrder = orderService.getOrderDetailByNo(orderNo);
if (highOrder.getProductType() == 12) {
GoodsOrder order = goodsOrderExtService.findGoodsOrder(highOrder.getOrderNo());
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(order.getDeliveryAddressId());
GoodsOrderModel goodsOrderModel = new GoodsOrderModel();
BeanUtils.copyProperties(highOrder , goodsOrderModel);
goodsOrderModel.setGoodsOrder(order);
goodsOrderModel.setGoodsDeliveryAddress(deliveryAddress);
return ResponseMsgUtil.success(goodsOrderModel);
}
return ResponseMsgUtil.success(highOrder);
} catch (Exception e) {
log.error("OrderController -> getDetailByOrderNo() error!",e);

@ -256,7 +256,9 @@ public class OrderPayController {
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
} else {
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
}else {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1609882817);
}
@ -282,7 +284,7 @@ public class OrderPayController {
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap);
order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id());
order.setProfitSharingStatus(profitSharing.equals("Y")?true:false);
order.setProfitSharingStatus(profitSharing.equals("Y"));
orderService.updateOrderData(order);
return ResponseMsgUtil.success(sortedMap);

@ -53,8 +53,6 @@ public class OrderRefundController {
@Resource
private UserCenter userCenter;
@Autowired
private RocketMQTemplate rocketMQTemplate;
@RequestMapping(value="/refund",method = RequestMethod.POST)
@ResponseBody

@ -0,0 +1,198 @@
package com.web.controller.business;
import com.alibaba.excel.EasyExcel;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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.DateUtil;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.*;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.goods.model.GoodsModel;
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.GoodsOrderExtModel;
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.OutRechargeChildOrderService;
import com.hai.service.OutRechargeOrderService;
import com.web.config.SysConst;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value = "goodsOrder")
@Api(value = "实物商品业务")
public class GoodsOrderController {
private static Logger log = LoggerFactory.getLogger(OrderMobileRechargeController.class);
@Resource
private UserCenter userCenter;
@Resource
private OrderService orderService;
@Resource
private GoodsOrderExtService goodsOrderExtService;
@Resource
private GoodsLogisticsService goodsLogisticsService;
@RequestMapping(value = "/getOrderList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单列表")
public ResponseData getOrderList(@RequestParam(name = "orderNo", required = false) String orderNo,
@RequestParam(name = "memPhone", required = false) String memPhone,
@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 = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "refundTimeS", required = false) String refundTimeS,
@RequestParam(name = "refundTimeE", required = false) String refundTimeE,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "productType", required = false) Integer productType,
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE,
@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<>();
if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type0.getType())) {
map.put("companyId" , companyId);
} else if (userInfoModel.getSecUser().getObjectType().equals(UserObjectTypeEnum.type1.getType())) {
map.put("companyId", userInfoModel.getBsCompany().getId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, "");
}
map.put("createTimeS", createTimeS);
map.put("createTimeE", createTimeE);
map.put("payTimeS", payTimeS);
map.put("payTimeE", payTimeE);
map.put("finishTimeS", finishTimeS);
map.put("finishTimeE", finishTimeE);
map.put("refundTimeS" , refundTimeS);
map.put("refundTimeE" , refundTimeE);
map.put("orderNo", orderNo);
map.put("memPhone", memPhone);
map.put("memCardNo", memCardNo);
map.put("productType", 12);
map.put("orderStatus", orderStatus);
map.put("payType", payType);
List<HighOrder> list = orderService.getOrderList(map);
List<GoodsOrderExtModel> goodsOrderExtModels = new ArrayList<>();
GoodsOrderExtModel model;
for (HighOrder order : list) {
model = new GoodsOrderExtModel();
BeanUtils.copyProperties(order, model);
model.setLogisticsStatus(goodsOrderExtService.findGoodsOrder(order.getOrderNo()).getStatus());
goodsOrderExtModels.add(model);
}
goodsOrderExtModels = goodsOrderExtModels.stream().sorted(Comparator.comparing(GoodsOrderExtModel::getLogisticsStatus)).collect(Collectors.toList());
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsOrderExtModels.size(), pageSize, new PageInfo<>(goodsOrderExtModels)));
} catch (Exception e) {
log.error("OrderCouponController --> getOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGoodsOrderDetail",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询订单详情")
public ResponseData getMobileOrderDetail(@RequestParam(name = "orderNo", required = true) String orderNo) {
try {
Map<String, Object> map = new HashMap<>();
map.put("tradeOrder", orderService.getOrderDetailByNo(orderNo));
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(orderNo);
map.put("goodsOrder", goodsOrder);
if (goodsOrder.getLogisticsNo() != null) {
GoodsLogistics logistics = (GoodsLogistics) goodsLogisticsService.getLogisticsMsg(goodsOrder.getLogisticsNo());
map.put("logistics", logistics);
JSONArray object = JSONArray.parseArray(logistics.getLogisticsTraceDetails());
map.put("logisticsTraceDetails", object);
}
return ResponseMsgUtil.success(map);
} catch (Exception e) {
log.error("OrderExtController -> getGasOrderDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/updateLogisticsNo",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "更新物流订单号")
public ResponseData updateLogisticsNo(@RequestParam(name = "orderNo", required = true) String orderNo,
@RequestParam(name = "logisticsNo", required = true) String logisticsNo
) {
try {
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(orderNo);
if (goodsOrder == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "信息错误!");
}
goodsOrder.setLogisticsNo(logisticsNo);
goodsOrder.setUpdateTime(new Date());
if (Objects.equals(goodsOrder.getStatus(), "1")) {
goodsOrder.setStatus("2");
}
goodsOrderExtService.updateGoodsOrder(goodsOrder);
return ResponseMsgUtil.success("更新成功!");
} catch (Exception e) {
log.error("OrderExtController -> getGasOrderDetail() error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -15,9 +15,11 @@ import com.hai.enum_type.OrderStatusEnum;
import com.hai.enum_type.UserObjectTypeEnum;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.order.model.ExportOrderMobileModel;
import com.hai.order.model.OrderThirdPartyModel;
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.OutRechargeChildOrderService;
import com.hai.service.OutRechargeOrderService;
@ -78,6 +80,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 = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
HttpServletRequest request) {
@ -99,9 +103,11 @@ public class OrderMobileRechargeController {
map.put("createTimeE", createTimeE);
map.put("payTimeS", payTimeS);
map.put("payTimeE", payTimeE);
map.put("refundTimeS" , refundTimeS);
map.put("refundTimeE" , refundTimeE);
map.put("finishTimeS", finishTimeS);
map.put("title", title);
map.put("finishTimeE", finishTimeE);
map.put("title", title);
map.put("orderNo", orderNo);
map.put("memPhone", memPhone);
map.put("memCardNo", memCardNo);
@ -133,6 +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 = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE) {
try {
@ -155,6 +163,8 @@ public class OrderMobileRechargeController {
map.put("payTimeE", payTimeE);
map.put("finishTimeS", finishTimeS);
map.put("finishTimeE", finishTimeE);
map.put("refundTimeS" , refundTimeS);
map.put("refundTimeE" , refundTimeE);
map.put("title", title);
map.put("orderNo", orderNo);
map.put("memPhone", memPhone);
@ -164,35 +174,45 @@ public class OrderMobileRechargeController {
map.put("payType", payType);
// 查询数据
List<HighOrder> orderList = orderService.getOrderList(map);
List<OrderThirdPartyModel> dataList = new ArrayList<>();
OrderThirdPartyModel model;
for (HighOrder thirdPartyModel : orderList) {
model = new OrderThirdPartyModel();
model.setOrderNo(thirdPartyModel.getOrderNo());
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(thirdPartyModel.getOrderNo());
if (outRechargeOrder.getOutRechargeChildOrders().size() > 0) {
model.setRegOrderNo(outRechargeOrder.getOutRechargeChildOrders().get(0).getOrderNo());
model.setRechargePlatform(RechargePlatformType.getDataByType(outRechargeOrder.getOutRechargeChildOrders().get(0).getRechargePlatform()).getName());
List<HighOrder> order = orderService.getOrderList(map);
List<ExportOrderMobileModel> list = new ArrayList<>();
ExportOrderMobileModel model;
for (HighOrder highOrder : order) {
model = new ExportOrderMobileModel();
OutRechargeOrder rechargeOrder = outRechargeOrderService.findByOrderNoNotChild(highOrder.getOrderNo());
if (rechargeOrder != null) {
OutRechargeChildOrder childOrder = outRechargeOrderService.mobileChildOrderHandle(highOrder,rechargeOrder);
model.setRechargeOrderNo(rechargeOrder.getOrderNo());
if (childOrder != null) {
model.setChildOrderNo(childOrder.getOrderNo());
if (childOrder.getRechargePlatform() != null) {
model.setRechargePlatform(RechargePlatformType.getDataByType(childOrder.getRechargePlatform()).getName());
}
model.setRemark(childOrder.getExt1());
}
}
model.setMemPhone(thirdPartyModel.getMemPhone());
model.setTitle(thirdPartyModel.getTitle());
model.setTotalPrice(thirdPartyModel.getTotalPrice());
model.setTotalDeductionPrice(thirdPartyModel.getTotalDeductionPrice());
model.setDeductionProductPrice(thirdPartyModel.getDeductionProductPrice());
model.setPayablePrice(thirdPartyModel.getPayablePrice());
model.setPayPrice(thirdPartyModel.getPayPrice());
if (thirdPartyModel.getPayType() != null) {
model.setPayType(OrderPayType.getDataByType(thirdPartyModel.getPayType()).getName());
model.setFinishTime(highOrder.getFinishTime());
model.setOrderStatus(OrderStatus.getDataByType(highOrder.getOrderStatus()).getName());
model.setMemPhone(highOrder.getMemPhone());
model.setCreateTime(highOrder.getCreateTime());
model.setTitle(highOrder.getTitle());
model.setPayablePrice(highOrder.getPayablePrice());
model.setRefundTime(highOrder.getRefundTime());
model.setPayPrice(highOrder.getPayPrice());
model.setOrderNo(highOrder.getOrderNo());
model.setMemCardNo(highOrder.getMemCardNo());
if (highOrder.getPayType() != null) {
model.setPayType(OrderPayType.getDataByType(highOrder.getPayType()).getName());
}
model.setOrderStatus(OrderStatusEnum.getNameByType(thirdPartyModel.getOrderStatus()));
model.setCreateTime(thirdPartyModel.getCreateTime());
model.setPayTime(thirdPartyModel.getPayTime());
model.setRefundTime(thirdPartyModel.getRefundTime());
model.setMemCardNo(thirdPartyModel.getMemCardNo());
dataList.add(model);
list.add(model);
}
String fileUrl = SysConst.getSysConfig().getFileUrl() + "temporary/";
@ -203,9 +223,9 @@ public class OrderMobileRechargeController {
}
EasyExcel.write(fileUrl+pathName)
.head(OrderThirdPartyModel.class)
.sheet("交易订单")
.doWrite(dataList);
.head(ExportOrderMobileModel.class)
.sheet("话费交易订单")
.doWrite(list);
return ResponseMsgUtil.success(pathName);
} catch (Exception e) {

@ -65,6 +65,8 @@ public class OrderThirdPartyController {
@RequestParam(name = "companyId", required = false) Long companyId,
@RequestParam(name = "createTimeS", required = false) Long createTimeS,
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "refundTimeS", required = false) String refundTimeS,
@RequestParam(name = "refundTimeE", required = false) String refundTimeE,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "productType", required = false) Integer productType,
@ -93,6 +95,8 @@ public class OrderThirdPartyController {
map.put("payTimeE", payTimeE);
map.put("finishTimeS", finishTimeS);
map.put("finishTimeE", finishTimeE);
map.put("refundTimeS" , refundTimeS);
map.put("refundTimeE" , refundTimeE);
map.put("orderNo", orderNo);
map.put("memPhone", memPhone);
map.put("memCardNo", memCardNo);
@ -139,6 +143,8 @@ public class OrderThirdPartyController {
@RequestParam(name = "createTimeE", required = false) Long createTimeE,
@RequestParam(name = "payTimeS", required = false) Long payTimeS,
@RequestParam(name = "payTimeE", required = false) Long payTimeE,
@RequestParam(name = "refundTimeS", required = false) String refundTimeS,
@RequestParam(name = "refundTimeE", required = false) String refundTimeE,
@RequestParam(name = "productType", required = false) Integer productType,
@RequestParam(name = "finishTimeS", required = false) Long finishTimeS,
@RequestParam(name = "finishTimeE", required = false) Long finishTimeE) {
@ -162,6 +168,8 @@ public class OrderThirdPartyController {
map.put("payTimeE", payTimeE);
map.put("finishTimeS", finishTimeS);
map.put("finishTimeE", finishTimeE);
map.put("refundTimeS" , refundTimeS);
map.put("refundTimeE" , refundTimeE);
map.put("orderNo", orderNo);
map.put("memPhone", memPhone);
map.put("memCardNo", memCardNo);

@ -29,8 +29,6 @@ public class OrderRefundSuccessConsumer implements RocketMQListener<HighOrderRef
@Resource
private OrderService orderService;
@Resource
private OrderRefundService orderRefundService;
@Resource
private OrderRefundHandleService refundHandleService;
@ -38,8 +36,7 @@ public class OrderRefundSuccessConsumer implements RocketMQListener<HighOrderRef
private HighDiscountUserRelService discountUserRelService;
@Resource
private HighDiscountAgentCodeService discountAgentCodeService;
@Resource
private BsMsgService bsMsgService;
@Override
public void onMessage(HighOrderRefund orderRefund) {
@ -95,6 +92,8 @@ public class OrderRefundSuccessConsumer implements RocketMQListener<HighOrderRef
} else if (orderRefund.getGoodsType().equals(OrderChildGoodsType.TYPE10.getNumber())) {
} else if (orderRefund.getGoodsType().equals(OrderChildGoodsType.TYPE11.getNumber())) {
}
}
}

@ -41,11 +41,6 @@ public class HighRechargeOrderSchedule {
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargeChildOrderService rechargeChildOrderService;
@Resource
private OrderService orderService;
/**
* @return void

@ -130,4 +130,6 @@ public class CommonSysConfig {
private String LogisticsAppKey;
private String logisticsAppSecret;
private String payPostUrl;
}

@ -30,7 +30,17 @@ public class BsProductConfig implements Serializable {
private String productName;
/**
* 产品类型 1:星巴克 2肯德基
* 产品类型
* 1星巴克
* 2肯德基
* 3会员充值
* 4积分充值
* 5购买卡券
* 6加油服务
* 7优惠券包
* 8汇联通充值
* 9话费充值
* 10:实物商品
*/
private Integer productType;
@ -271,4 +281,4 @@ public class BsProductConfig implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -64,7 +64,7 @@ public class GoodsDetail implements Serializable {
private String detailImg;
/**
* 商品状态0:删除 1:上线 2:编辑中
* 商品状态0:删除 1:上线 2:编辑中 3:审核中
*/
private Integer status;
@ -334,4 +334,4 @@ public class GoodsDetail implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -65,7 +65,7 @@ public class GoodsOrder implements Serializable {
private String opName;
/**
* 1 正常 2: 删除
* 1:待发货 2:已发货 3配送中 4已送达 5已取消 6退货中 7已退货 8待支付 0:删除';
*/
private String status;
@ -271,4 +271,4 @@ public class GoodsOrder implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -46,7 +46,7 @@ public class HighGoldRec extends HighGoldRecModel implements Serializable {
private Date createTime;
/**
* 来源类型1.充值 2.订单 3退款 4积分返利
* 来源类型1.充值 2.订单 3退款 4积分返利 101:惠支付积分返利 102惠支付门店活动差价返利
*/
private Integer resType;

@ -17,7 +17,8 @@ public enum ApiProductTypeEnum {
type5(5, "卡券"),
type6(6, "在线加油"),
type7(7, "优惠券包 "),
type8(8, "汇联通充值 ")
type8(8, "汇联通充值 "),
type10(10, "实物商品 ")
;
private Integer type;

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

@ -16,6 +16,7 @@ public enum DiscountUseScope {
type6(6 , "会员充值"),
type7(7 , "加油服务"),
type8(8 , "重庆中石油"),
type9(9 , "实物商品"),
;
private Integer type;

@ -74,4 +74,14 @@ public interface GoodsLogisticsService {
* @Return void
*/
GoodsLogistics editLogistics(JSONObject object);
/**
* @Author Sum1Dream
* @Name getLogisticsMsg
* @Description // 查询物流信息
* @Date 16:19 2023/4/20
* @Param [num]
* @Return com.alibaba.fastjson.JSONObject
*/
Object getLogisticsMsg(String num);
}

@ -0,0 +1,88 @@
package com.hai.goods.service;
import com.hai.entity.GoodsOrder;
import java.util.List;
import java.util.Map;
/**
* @serviceName GoodsOrderService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 商品订单业务
* @createTime 17:52 2023/4/18
**/
public interface GoodsOrderExtService {
/**
* @Author Sum1Dream
* @Name insertGoodsOrder
* @Description // 新增
* @Date 15:08 2023/4/11
* @Param [GoodsOrder]
* @Return void
*/
void insertGoodsOrder(GoodsOrder goodsOrder);
/**
* @Author Sum1Dream
* @Name updateGoodsOrder
* @Description // 更新
* @Date 15:14 2023/4/11
* @Param [GoodsOrder]
* @Return void
*/
void updateGoodsOrder(GoodsOrder goodsOrder);
/**
* @Author Sum1Dream
* @Name getGoodsOrderList
* @Description // 查询
* @Date 15:17 2023/4/11
* @Param [map]
* @Return java.util.List<com.hai.entity.GoodsOrder>
*/
List<GoodsOrder> getGoodsOrderList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name findGoodsOrderById
* @Description // 根据id查询详情
* @Date 16:19 2023/4/11
* @Param [id]
* @Return com.hai.entity.GoodsOrder
*/
GoodsOrder findGoodsOrderById(Long id);
/**
* @Author Sum1Dream
* @Name findGoodsOrder
* @Description // 查询详情
* @Date 15:44 2023/4/20
* @Param [orderNo]
* @Return com.hai.entity.GoodsOrder
*/
GoodsOrder findGoodsOrder(String orderNo);
/**
* @Author Sum1Dream
* @Name findGoodsOrderByLogisticsNo
* @Description // 根据运单号查询订单
* @Date 17:20 2023/4/20
* @Param [logisticsNo]
* @Return com.hai.entity.GoodsOrder
*/
GoodsOrder findGoodsOrderByLogisticsNo(String logisticsNo);
/**
* @Author Sum1Dream
* @Name deleteGoodsOrder
* @Description // 删除
* @Date 17:37 2023/4/13
* @Param [id]
* @Return void
*/
void deleteGoodsOrder(Long id);
}

@ -55,5 +55,15 @@ public interface GoodsSkuService {
* @Return com.hai.entity.GoodsSku
*/
GoodsSku findGoodsSkuById(Long id);
/**
* @Author Sum1Dream
* @Name decreaseStockNum
* @Description // 减少库存
* @Date 17:34 2023/4/19
* @Param [skuId, num]
* @Return void
*/
void decreaseStockNum(Long skuId , Integer num);
}

@ -46,11 +46,16 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
if (MapUtils.getLong(map, "goodsType") != null) {
criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType") );
}
if (MapUtils.getLong(map, "opId") != null) {
criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId") );
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status") );
} else {
criteria.andStatusNotEqualTo(0);
}
example.setOrderByClause("create_time desc");
return goodsDetailMapper.selectByExample(example);
}

@ -1,16 +1,22 @@
package com.hai.goods.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.RedisUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonConfig;
import com.hai.dao.GoodsLogisticsMapper;
import com.hai.entity.GoodsLogistics;
import com.hai.entity.GoodsLogisticsExample;
import com.hai.entity.GoodsOrder;
import com.hai.goods.service.GoodsLogisticsService;
import com.hai.goods.service.GoodsOrderExtService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service("goodsLogisticsService")
public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
@ -18,6 +24,12 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
@Resource
private GoodsLogisticsMapper goodsLogisticsMapper;
@Resource
private RedisUtil redisUtil;
@Resource
private GoodsOrderExtService goodsOrderExtService;
@Override
public void insertGoodsLogistics(GoodsLogistics goodsLogistics) {
goodsLogisticsMapper.insert(goodsLogistics);
@ -85,4 +97,40 @@ public class GoodsLogisticsServiceImpl implements GoodsLogisticsService {
return logistics;
}
@Override
public Object getLogisticsMsg(String num) {
Object data = redisUtil.get("logisticsMsg" + num);
if (data == null) {
JSONObject jsonObjects = CommonConfig.getLogisticsMsg(num);
redisUtil.set("logisticsMsgOl" + num , jsonObjects ,21600);
if (jsonObjects.getInteger("code") == 200 && jsonObjects.getBoolean("success")) {
GoodsLogistics logistics = editLogistics((JSONObject) jsonObjects.get("data"));
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrderByLogisticsNo(num);
if (goodsOrder != null) {
goodsOrder.setUpdateTime(new Date());
if (Objects.equals(logistics.getLogisticsStatus(), "TRANSPORT")) {
goodsOrder.setStatus("3");
}
if (Objects.equals(logistics.getLogisticsStatus(), "AGENT_SIGN") || Objects.equals(logistics.getLogisticsStatus(), "SIGN")) {
goodsOrder.setStatus("4");
}
goodsOrderExtService.updateGoodsOrder(goodsOrder);
}
redisUtil.set("logisticsMsg" + num , logistics ,21600);
return logistics;
}
return jsonObjects;
} else {
return data;
}
}
}

@ -0,0 +1,72 @@
package com.hai.goods.service.impl;
import com.hai.dao.GoodsOrderMapper;
import com.hai.entity.GoodsOrder;
import com.hai.entity.GoodsOrderExample;
import com.hai.goods.service.GoodsOrderExtService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("goodsOrderExtService")
public class GoodsOrderServiceImpl implements GoodsOrderExtService {
@Resource
private GoodsOrderMapper goodsOrderMapper;
@Override
public void insertGoodsOrder(GoodsOrder goodsOrder) {
goodsOrderMapper.insert(goodsOrder);
}
@Override
public void updateGoodsOrder(GoodsOrder goodsOrder) {
goodsOrderMapper.updateByPrimaryKey(goodsOrder);
}
@Override
public List<GoodsOrder> getGoodsOrderList(Map<String, Object> map) {
return null;
}
@Override
public GoodsOrder findGoodsOrderById(Long id) {
return null;
}
@Override
public GoodsOrder findGoodsOrder(String orderNo) {
GoodsOrderExample example = new GoodsOrderExample();
example.createCriteria().andStatusNotEqualTo("0").andOrderNoEqualTo(orderNo);
List<GoodsOrder> list = goodsOrderMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public GoodsOrder findGoodsOrderByLogisticsNo(String logisticsNo) {
GoodsOrderExample example = new GoodsOrderExample();
example.createCriteria().andStatusNotEqualTo("0").andLogisticsNoEqualTo(logisticsNo);
List<GoodsOrder> list = goodsOrderMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public void deleteGoodsOrder(Long id) {
}
}

@ -1,11 +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.GoodsSkuMapper;
import com.hai.entity.GoodsDetailExample;
import com.hai.entity.GoodsSku;
import com.hai.entity.GoodsSkuExample;
import com.hai.entity.HighOrder;
import com.hai.goods.service.GoodsSkuService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -18,6 +24,9 @@ public class GoodsSkuServiceImpl implements GoodsSkuService {
@Resource
private GoodsSkuMapper goodsSkuMapper;
@Autowired
private RedisTemplate redisTemplate;
@Override
public void insertGoodsSku(GoodsSku goodsSku) {
goodsSkuMapper.insert(goodsSku);
@ -44,6 +53,9 @@ public class GoodsSkuServiceImpl implements GoodsSkuService {
if (MapUtils.getLong(map, "goodsId") != null) {
criteria.andGoodsIdEqualTo(MapUtils.getLong(map, "goodsId") );
}
if (MapUtils.getLong(map, "id") != null) {
criteria.andIdEqualTo(MapUtils.getLong(map, "id") );
}
return goodsSkuMapper.selectByExample(example);
}
@ -61,4 +73,38 @@ public class GoodsSkuServiceImpl implements GoodsSkuService {
public GoodsSku findGoodsSkuById(Long id) {
return goodsSkuMapper.selectByPrimaryKey(id);
}
@Override
public void decreaseStockNum(Long skuId, Integer num){
String key = "GOODS_STOCK_NUM";
GoodsSku goodsSku = findGoodsSkuById(skuId);
try {
// 分布式锁占坑
Boolean lock = redisTemplate.opsForValue().setIfAbsent(key, skuId);
if(Boolean.TRUE.equals(lock)) {
if (goodsSku.getStock() < num) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, goodsSku.getName() + "库存不足");
}
// 加锁成功,处理业务
goodsSku.setStock(goodsSku.getStock() - num);
updateGoodsSku(goodsSku);
} else {
// 加锁失败,重试
Thread.sleep(100);
decreaseStockNum(skuId , num);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// 删除key,释放锁
redisTemplate.delete(key);
}
}
}

@ -0,0 +1,28 @@
package com.hai.model;
import com.hai.entity.GoodsDeliveryAddress;
import com.hai.entity.GoodsOrder;
import com.hai.entity.HighOrder;
public class GoodsOrderModel extends HighOrder {
GoodsOrder goodsOrder;
GoodsDeliveryAddress goodsDeliveryAddress;
public GoodsOrder getGoodsOrder() {
return goodsOrder;
}
public void setGoodsOrder(GoodsOrder goodsOrder) {
this.goodsOrder = goodsOrder;
}
public GoodsDeliveryAddress getGoodsDeliveryAddress() {
return goodsDeliveryAddress;
}
public void setGoodsDeliveryAddress(GoodsDeliveryAddress goodsDeliveryAddress) {
this.goodsDeliveryAddress = goodsDeliveryAddress;
}
}

@ -65,7 +65,7 @@ public class CreateOrderModel {
private String remarks;
/**
* 收货地址
* 收货地址
*/
private Long deliveryAddressId;

@ -0,0 +1,19 @@
package com.hai.order.model;
import com.hai.entity.HighOrder;
public class GoodsOrderExtModel extends HighOrder {
/**
* 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;
}
}

@ -2,6 +2,7 @@ package com.hai.order.service;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighDiscountUserRel;
import com.hai.entity.HighOrder;
import com.hai.model.ResponseData;
import com.hai.order.model.CreateOrderChildModel;
@ -29,4 +30,6 @@ public interface OrderCancelHandleService {
*/
void oilHandle(HighChildOrder childOrder) ;
void goodsHandle(HighChildOrder childOrder);
}

@ -76,4 +76,14 @@ public interface OrderCreateHandleService {
*/
HighChildOrder mobileRecharge(HighOrder order , JSONObject object) throws Exception;
/**
* @Author Sum1Dream
* @Name goods
* @Description // 实物订单校验
* @Date 17:32 2023/4/18
* @Param [order, createOrderChild]
* @Return com.hai.entity.HighChildOrder
*/
HighChildOrder goods(HighOrder order, CreateOrderChildModel createOrderChild) throws Exception;
}

@ -25,4 +25,14 @@ public interface OrderRefundHandleService {
*/
void oilHandle(HighOrderRefund orderRefund) ;
/**
* @Author Sum1Dream
* @Name goodsHandle
* @Description // 商品操作
* @Date 10:41 2023/4/20
* @Param [orderRefund]
* @Return void
*/
void goodsHandle(HighOrderRefund orderRefund);
}

@ -1,8 +1,10 @@
package com.hai.order.service.impl;
import com.hai.entity.GoodsSku;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighCouponCode;
import com.hai.entity.HighGasOrder;
import com.hai.goods.service.GoodsSkuService;
import com.hai.order.service.OrderCancelHandleService;
import com.hai.order.type.OrderChildStatus;
import com.hai.order.type.OrderOilStatus;
@ -27,6 +29,9 @@ public class OrderCancelHandleServiceImpl implements OrderCancelHandleService {
@Resource
private HighGasOrderService gasOrderService;
@Resource
private GoodsSkuService goodsSkuService;
@Override
public void couponHandle(HighChildOrder childOrder) {
// 解除兑换码与订单的关系
@ -48,4 +53,11 @@ public class OrderCancelHandleServiceImpl implements OrderCancelHandleService {
gasOrderService.updateGasOrder(gasOrder);
}
}
@Override
public void goodsHandle(HighChildOrder childOrder) {
GoodsSku goodsSku = goodsSkuService.findGoodsSkuById(childOrder.getSkuId());
goodsSku.setStock(goodsSku.getStock() + childOrder.getSaleCount());
goodsSkuService.updateGoodsSku(goodsSku);
}
}

@ -7,17 +7,15 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.config.*;
import com.hai.dao.OutRechargeOrderMapper;
import com.hai.entity.*;
import com.hai.enum_type.*;
import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsSkuService;
import com.hai.goods.service.ShoppingCartService;
import com.hai.model.GasPayPriceModel;
import com.hai.model.HighMerchantModel;
import com.hai.model.OutRechargePriceModel;
import com.hai.model.ResponseData;
import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.service.OrderCreateHandleService;
@ -129,6 +127,17 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private GoodsDetailService goodsDetailService;
@Resource
private GoodsSkuService goodsSkuService;
@Resource
private ShoppingCartService shoppingCartService;
@Override
public List<HighChildOrder> couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception {
if (createOrderChild.getSaleCount() != 1) {
@ -891,4 +900,54 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
outRechargeOrderMapper.insert(outRechargeOrder);
return childOrder;
}
@Override
public HighChildOrder goods(HighOrder order, CreateOrderChildModel createOrderChild) throws Exception{
GoodsDetail goods = goodsDetailService.findGoodsDetailById(createOrderChild.getGoodsId());
GoodsSku goodsSku = goodsSkuService.findGoodsSkuById(createOrderChild.getSkuId());
Map<String , Object> map = new HashMap<>();
map.put("goodsId" , createOrderChild.getGoodsId());
map.put("id" , createOrderChild.getSkuId());
List<GoodsSku> goodsSkuList = goodsSkuService.getGoodsSkuList(map);
if (goodsSkuList.size() == 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商品信息错误! ");
}
// 生成交易子订单
HighChildOrder childOrder = new HighChildOrder();
childOrder.setOrderNo(order.getOrderNo());
childOrder.setMemId(order.getMemId());
childOrder.setMemName(order.getMemName());
childOrder.setMemPhone(order.getMemPhone());
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setGoodsType(OrderChildGoodsType.TYPE11.getNumber());
childOrder.setGoodsId(createOrderChild.getGoodsId());
childOrder.setGoodsName(goods.getName());
childOrder.setSkuId(createOrderChild.getSkuId());
childOrder.setGoodsSpecName(goodsSku.getName());
childOrder.setGoodsPrice(goodsSku.getOriginalPrice());
childOrder.setGoodsActualPrice(goodsSku.getPrice());
childOrder.setGoodsImg(goodsSku.getShowImg());
childOrder.setSaleCount(createOrderChild.getSaleCount());
childOrder.setGiveawayType(false);
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber());
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount())));
childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount())));
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice()));
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
if (createOrderChild.getShopCartId() != null) {
shoppingCartService.deleteShoppingCart(createOrderChild.getShopCartId());
}
goodsSkuService.decreaseStockNum(createOrderChild.getSkuId(), createOrderChild.getSaleCount());
return childOrder;
}
}

@ -9,6 +9,7 @@ import com.hai.config.*;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.*;
import com.hai.enum_type.*;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.msg.entity.MsgTopic;
import com.hai.order.service.OrderPaySuccessService;
import com.hai.order.service.OrderService;
@ -76,7 +77,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
private PayloService payloService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
private GoodsOrderExtService goodsOrderExtService;
@Resource
private HighDiscountPackageDiscountActualService discountPackageDiscountActualService;
@ -216,6 +217,8 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE10.getNumber())) {
thirdOrderHandle(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE11.getNumber())) {
goodsRecharge(order);
}
}
}
@ -495,4 +498,19 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
outRechargeOrderService.getPrepaidRechargeApi(outRechargeOrder);
}
/**
* @Author Sum1Dream
* @Name goodsRecharge
* @Description // 实物商品订单操作
* @Date 17:13 2023/4/20
* @Param [order]
* @Return void
*/
private void goodsRecharge(HighOrder order) {
GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(order.getOrderNo());
goodsOrder.setUpdateTime(new Date());
goodsOrder.setStatus("1");
goodsOrderExtService.updateGoodsOrder(goodsOrder);
}
}

@ -6,25 +6,25 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.config.PayloService;
import com.hai.config.ShellGroupService;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrder;
import com.hai.entity.HighMerchantStore;
import com.hai.entity.HighOrderRefund;
import com.hai.entity.*;
import com.hai.enum_type.GasChannel;
import com.hai.enum_type.GasChannelPayPlatformType;
import com.hai.enum_type.MerStoreAmountSourceTypeEnum;
import com.hai.enum_type.MerStoreAmountTypeEnum;
import com.hai.msg.entity.MsgTopic;
import com.hai.order.service.OrderCancelHandleService;
import com.hai.order.service.OrderRefundHandleService;
import com.hai.order.type.OrderOilStatus;
import com.hai.service.HighGasOrderService;
import com.hai.service.HighMerchantStoreService;
import com.hai.service.HighOrderService;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -47,6 +47,13 @@ public class OrderRefundHandleServiceImpl implements OrderRefundHandleService {
@Resource
private PayloService payloService;
@Resource
private HighOrderService highOrderService;
@Resource
private OrderCancelHandleService orderCancelHandleService;
@Override
public void couponHandle(HighOrderRefund orderRefund) {
@ -113,4 +120,18 @@ public class OrderRefundHandleServiceImpl implements OrderRefundHandleService {
}
}
@Override
public void goodsHandle(HighOrderRefund orderRefund) {
HighOrder order = highOrderService.getOrderByOrderNo(orderRefund.getOrderNo());
List<HighChildOrder> childOrderList = order.getHighChildOrderList();
for (HighChildOrder childOrder : childOrderList) {
orderCancelHandleService.goodsHandle(childOrder);
}
}
}

@ -8,11 +8,16 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.DateUtil;
import com.hai.config.ThirdProductConfig;
import com.hai.dao.HighChildOrderMapper;
import com.hai.dao.HighOrderMapper;
import com.hai.entity.*;
import com.hai.enum_type.DiscountUseScope;
import com.hai.goods.service.DeliveryAddressService;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.goods.service.GoodsRegionFreightService;
import com.hai.goods.service.GoodsSkuService;
import com.hai.order.model.CreateOrderChildModel;
import com.hai.order.model.CreateOrderModel;
import com.hai.order.model.RefundPriceModel;
@ -85,6 +90,18 @@ public class OrderServiceImpl implements OrderService {
@Resource
private HighDiscountPackageActualService discountPackageActualService;
@Resource
private DeliveryAddressService deliveryAddressService;
@Resource
private GoodsRegionFreightService goodsRegionFreightService;
@Resource
private GoodsOrderExtService goodsOrderExtService;
@Override
public HighOrder insertOrderData(HighOrder order) {
@ -282,6 +299,21 @@ public class OrderServiceImpl implements OrderService {
}
}
order.setRemarks(object.getString("customerMobile"));
// 实物商品
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE11.getNumber())) {
HighChildOrder childOrder = orderCreateHandleService.goods(order , child);
childOrderList.add(childOrder);
order.setProductType(OrderProductType.PRODUCT_TYPE12.getNumber());
if (StringUtils.isBlank(order.getTitle())) {
order.setTitle(childOrder.getGoodsName());
order.setExt6(childOrder.getGoodsImg());
} else {
order.setTitle(order.getTitle() + "+" +childOrder.getGoodsName());
order.setExt6(order.getExt6() + "," +childOrder.getGoodsImg());
}
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知业务类型");
}
@ -289,11 +321,16 @@ public class OrderServiceImpl implements OrderService {
order.setHighChildOrderList(childOrderList);
/*********** 组装处理子订单 商品业务************/
// 计算订单金额
Map<String, Object> calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList());
order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString()));
order.setPayablePrice(new BigDecimal(calculateOrderPrice.get("payablePrice").toString()));
// 是否使用了优惠券
if (discountUserRel != null) {
order.setMemDiscountId(discountUserRel.getId());
@ -325,6 +362,10 @@ public class OrderServiceImpl implements OrderService {
if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能加油订单中使用");
}
} else if (discountUserRel.getHighDiscount().getUseScope().equals(DiscountUseScope.type9.getType())) {
if (!order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "此优惠券只能是实物订单中使用");
}
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法使用此优惠券");
}
@ -372,6 +413,34 @@ public class OrderServiceImpl implements OrderService {
order.setTotalDeductionPrice(order.getDeductionCouponPrice().add(order.getDeductionProductPrice()));
order.setPayPrice(order.getPayablePrice());
if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) {
GoodsDeliveryAddress deliveryAddress = deliveryAddressService.findDeliveryAddressById(createOrderModel.getDeliveryAddressId());
// 生成实物专属订单实体
GoodsOrder goodsOrder = new GoodsOrder();
JSONObject object = goodsRegionFreightService.getRegionFreight(deliveryAddress.getRegionId());
if (object.getBigDecimal("freePostPrice").compareTo(order.getPayablePrice()) > 0) {
order.setTotalPrice(order.getTotalPrice().add(object.getBigDecimal("freightPrice")));
order.setPayablePrice(order.getPayablePrice().add(object.getBigDecimal("freightPrice")));
order.setPayPrice(order.getPayPrice().add(object.getBigDecimal("freightPrice")));
goodsOrder.setFreightPrice(object.getBigDecimal("freightPrice"));
}
goodsOrder.setStatus("8");
goodsOrder.setOpName("系统生成");
goodsOrder.setUpdateTime(new Date());
goodsOrder.setCreateTime(new Date());
goodsOrder.setDeliveryAddressId(createOrderModel.getDeliveryAddressId());
goodsOrder.setOrderNo(order.getOrderNo());
goodsOrder.setDeliveryAddress(deliveryAddress.getRegionName() + deliveryAddress.getAddress());
goodsOrderExtService.insertGoodsOrder(goodsOrder);
}
// 积分抵扣
if (createOrderModel.getPayGold() != null && createOrderModel.getPayGold() > 0) {
// 查询用户
@ -379,13 +448,13 @@ public class OrderServiceImpl implements OrderService {
if (user == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户信息");
}
if (createOrderModel.getPayGold().compareTo(user.getGold()) == 1) {
if (createOrderModel.getPayGold().compareTo(user.getGold()) > 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "抵扣积分大于用户拥有积分");
}
// 积分转换成金额
BigDecimal goldPrice = new BigDecimal(createOrderModel.getPayGold().toString()).divide(new BigDecimal(100));
// 积分金额大于应付金额
if (goldPrice.compareTo(order.getPayablePrice()) == 1) {
if (goldPrice.compareTo(order.getPayablePrice()) > 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "支付的积分金额大于支付金额");
}
// 支付金额 减去 积分抵扣金额 = 应付金额
@ -517,6 +586,9 @@ public class OrderServiceImpl implements OrderService {
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE3.getNumber())) {
orderCancelHandleService.oilHandle(childOrder);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE11.getNumber())) {
orderCancelHandleService.goodsHandle(childOrder);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE7.getNumber())) {
}
@ -559,6 +631,7 @@ public class OrderServiceImpl implements OrderService {
childOrder.setRefundTime(new Date());
childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber());
}
}
order.setSurplusRefundIntegral(0);
@ -747,6 +820,11 @@ public class OrderServiceImpl implements OrderService {
if (MapUtils.getLong(param, "finishTimeE") != null) {
criteria.andCreateTimeLessThan(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"));
}
example.setOrderByClause("create_time desc");
return orderMapper.selectByExample(example);

@ -20,6 +20,9 @@ public enum OrderProductType {
PRODUCT_TYPE9(9, "话费充值" , "orderLogo/calls.png", "CALLS_CONFIG"),
PRODUCT_TYPE10(10, "电影票" ,"" , ""),
PRODUCT_TYPE11(11, "贵州中石化" , "", "GZ_SINOPEC_CONFIG"),
PRODUCT_TYPE12(12, "实物商品" , "orderLogo/goods.png", "GOODS"),
PRODUCT_TYPE101(101, "惠支付" , "orderLogo/pay.png", "PAY"),
PRODUCT_TYPE102(102, "门店活动" , "orderLogo/store_activity.png", "STORE_ACTIVITY"),
;
private Integer number;

@ -1,5 +1,6 @@
package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.BsOperationLog;
import com.hai.entity.BsOrderRebate;
import com.hai.entity.HighOrder;
@ -65,4 +66,14 @@ public interface BsOrderRebateService {
* @Return void
*/
void insertOrderRebate(HighOrder highOrder);
/**
* @Author Sum1Dream
* @Name insertOrderRebate
* @Description // 插入积分返利记录
* @Date 14:53 2023/4/24
* @Param [object]
* @Return void
*/
void insertOrderRebate(JSONObject object);
}

@ -328,4 +328,14 @@ public interface CommonService {
* @Return java.util.List<com.hai.entity.SecRegion>
*/
List<SecRegion> getSecRegion(Long parentId);
/**
* @Author Sum1Dream
* @Name getIndustry
* @Description // 获取行业数据
* @Date 14:16 2023/4/26
* @Param []
* @Return com.alibaba.fastjson.JSONObject
*/
JSONObject getIndustry();
}

@ -208,4 +208,6 @@ public interface OutRechargeOrderService {
* @Return java.lang.Integer 1满足继续充值条件 2订单满足退款条件 3订单不可以退款不可以继续充值 4:订单异常 5:订单充值完成
*/
Integer orderWhetherRecharge(OutRechargeOrder rechargeOrder) throws Exception;
OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder , OutRechargeOrder outRechargeOrder);
}

@ -113,7 +113,6 @@ public class BsDistributionUserRelServiceImpl implements BsDistributionUserRelSe
}
}
} catch (Exception e) {
e.printStackTrace();
}

@ -1,12 +1,12 @@
package com.hai.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.DateUtil;
import com.hai.dao.BsOrderRebateMapper;
import com.hai.entity.BsIntegralRebate;
import com.hai.entity.BsOrderRebate;
import com.hai.entity.BsOrderRebateExample;
import com.hai.entity.HighOrder;
import com.hai.entity.*;
import com.hai.order.type.OrderProductType;
import com.hai.service.*;
import org.springframework.stereotype.Service;
@ -36,6 +36,9 @@ public class BsOrderRebateServiceImpl implements BsOrderRebateService {
@Resource
private HighUserService highUserService;
@Resource
private HighGoldRecService highGoldRecService;
@Override
public List<BsOrderRebate> getOrderRebateByList(Map<String, Object> map) {
@ -115,4 +118,92 @@ public class BsOrderRebateServiceImpl implements BsOrderRebateService {
}
@Override
public void insertOrderRebate(JSONObject jsonObject) {
if (jsonObject.getInteger("productType") ==null
|| jsonObject.getLong("userId") == null
|| jsonObject.getString("orderNo") == null
|| jsonObject.getLong("orderId") == null
|| jsonObject.getString("title") == null
|| jsonObject.getDate("createTime") == null
|| jsonObject.getBigDecimal("price") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "缺少参数!");
}
HighUser highUser = highUserService.findByUserId(jsonObject.getLong("userId"));
// 计算返利积分数量
// 查询是否配置返利
Map<String, Object> map = new HashMap<>();
map.put("type" , jsonObject.getInteger("productType"));
map.put("companyId" ,2);
BsIntegralRebate bsIntegralRebate = bsIntegralRebateService.findIntegralRebateByMap(map);
// 判断是否配置返利内容
if (bsIntegralRebate != null) {
// 查询是否存在积分记录
Map<String, Object> mapGold = new HashMap<>();
mapGold.put("goldType", 1);
mapGold.put("resType", jsonObject.getInteger("productType"));
mapGold.put("userId", highUser.getId());
mapGold.put("resId", jsonObject.getLong("orderId"));
List<HighGoldRec> goldRecs = highGoldRecService.getGoldRec(mapGold);
// 判断是否重复赠送积分
if (goldRecs.size() > 0) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "重复赠送!");
}
// 判断是否在返利条件
if (DateUtil.isEffectiveDate(jsonObject.getDate("createTime"), bsIntegralRebate.getStartTime() , bsIntegralRebate.getEndTime())) {
// 定义请求对象
JSONObject object = new JSONObject();
// 积分返利积分
BigDecimal integralNum = jsonObject.getBigDecimal("price").multiply(bsIntegralRebate.getPercentage()).setScale( 0, BigDecimal.ROUND_HALF_UP );
if (bsIntegralRebate.getSecondDistribution() !=null || bsIntegralRebate.getFirstDistribution() != null) {
// 1级分销
BigDecimal integralNumFirst = jsonObject.getBigDecimal("price").multiply(bsIntegralRebate.getFirstDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP );
// 2级分销
BigDecimal integralNumSecond = jsonObject.getBigDecimal("price").multiply(bsIntegralRebate.getSecondDistribution()).setScale( 0, BigDecimal.ROUND_HALF_UP );
object.put("integralNumFirst" , integralNumFirst);
object.put("integralNumSecond" , integralNumSecond);
}
// 拼接分销返利对象
object.put("userId" , jsonObject.getLong("userId"));
object.put("orderNo" , jsonObject.getString("orderNo"));
object.put("companyId", 2);
object.put("remark" , OrderProductType.getDataByType(jsonObject.getInteger("productType")).getName() + "下单:"+ jsonObject.getString("title") + "-" + jsonObject.getString("orderNo") + "积分返利:");
object.put("name" , "下单" + OrderProductType.getDataByType(jsonObject.getInteger("productType")).getName() + ":" + jsonObject.getString("title"));
object.put("logoImg" , OrderProductType.getDataByType(jsonObject.getInteger("productType")).getImgUrl());
bsDistributionUserRelService.distributionRebate(object);
highUserService.goldHandle(jsonObject.getLong("userId"), integralNum.intValue(), 1, jsonObject.getInteger("productType"), jsonObject.getLong("orderId"), object.getString("remark") + integralNum);
// 查询积分返利记录
BsOrderRebate orderRebate = new BsOrderRebate();
orderRebate.setOrderId(jsonObject.getLong("orderId"));
orderRebate.setOrderNo(jsonObject.getString("orderNo"));
orderRebate.setCreateTime(new Date());
orderRebate.setUpdateTime(new Date());
orderRebate.setStatus(1);
orderRebate.setIntegralNum(integralNum.intValue());
orderRebate.setUserId(highUser.getId());
orderRebate.setUserName(highUser.getName());
bsOrderRebateMapper.insert(orderRebate);
}
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前未配置积分返利规则!");
}
}
}

@ -9,6 +9,7 @@ import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.HttpsUtils;
import com.hai.config.CommonSysConst;
import com.hai.dao.*;
import com.hai.dao.order.OrderStatisticsMapperExt;
import com.hai.entity.*;
@ -793,4 +794,9 @@ public class CommonServiceImpl implements CommonService {
return regionMapper.selectByExample(example);
}
@Override
public JSONObject getIndustry() {
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getPayPostUrl() + "/common/getIndustry");
}
}

@ -871,9 +871,6 @@ public class HighOrderServiceImpl implements HighOrderService {
DateUtil.format(MapUtils.getString(map, "refundTimeE"), "yyyy-MM-dd HH:mm:ss"));
}
// example.setOrderByClause("create_time desc");
return highOrderMapper.selectByExample(example);
}

@ -198,7 +198,6 @@ public class HighUserServiceImpl implements HighUserService {
user.setUnpaid(highOrderService.countOrderByUserId(userId , 1));
user.setOrderPayNum(highOrderService.countOrderByUserId(userId , 2));
user.setWhetherCheckNum(highOrderService.whetherCheck(userId , 3));
// user.setRechargeOrderNum(outRechargeOrderService.rechargeOrderNum(userId));
user.setUnusedDiscount(highOrderService.countUnusedDiscountByUserId(userId , 1));
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userId));
user.setIsSetHltCard(highUserCardService.isBindHtlCard(userId));

@ -84,6 +84,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private OutRechargeChildOrderService childOrderService;
@Override
public List<OutRechargeOrder> getListRechargeOrder(Map<String, Object> map) {
OutRechargeOrderExample example = new OutRechargeOrderExample();
@ -713,6 +716,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 查询子订单
List<OutRechargeChildOrder> childOrderList = outRechargeChildOrderService.getListRechargeChildOrderByOrderId(rechargeOrder.getId());
if (childOrderList.size() == 0) {
return 4;
}
// 充值订单充值时间
Date rechargeTime = rechargeOrder.getCreateTimed();
@ -813,4 +819,41 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
rechargeChildOrder.setStatus(status);
outRechargeChildOrderService.updateOrder(rechargeChildOrder);
}
@Override
public OutRechargeChildOrder mobileChildOrderHandle(HighOrder highOrder, OutRechargeOrder outRechargeOrder) {
// 组装查询子订单数据
Map<String , Object> childOrderMap101 = new HashMap<>();
childOrderMap101.put("parent_order_id", outRechargeOrder.getId());
childOrderMap101.put("status", "101,102");
// 查询充值订单
List<OutRechargeChildOrder> childOrders = childOrderService.getListRechargeChildOrder(childOrderMap101);
OutRechargeChildOrder childOrder;
// 判读是否存在多个充值中的订单
if (childOrders.size() > 0) {
childOrder = childOrders.get(0);
if (childOrders.size() > 1) {
childOrder.setExt1("当前订单存在多个充值订单");
}
} else {
childOrder = childOrderService.findByOrderId(outRechargeOrder.getId());
if (childOrder != null && highOrder != null && childOrder.getStatus() != null && highOrder.getOrderStatus() != null) {
if (highOrder.getOrderStatus() == 2 && childOrder.getStatus() != 102) {
childOrder.setExt1("主订单充值中,但是充值订单状态不为充值中");
}
if (highOrder.getOrderStatus() == 3 && childOrder.getStatus() != 101) {
childOrder.setExt1("主订单充值成功,但是充值订单状态不为充值成功");
}
if (highOrder.getOrderStatus() == 4 && !(childOrder.getStatus() == 103 || childOrder.getStatus() == 104)) {
childOrder.setExt1("主订单退款,但是充值订单状态不为退款");
}
}
}
return childOrder;
}
}

@ -120,6 +120,9 @@ wxAppSecret=d8d6dcaef77d3b659258a01b5ddba5df
wxH5AppId=wxa075e8509802f826
wxH5AppSecret=0e606fc1378d35e359fcf3f15570b2c5
logisticsAppKey=5d806a99fbcc48e19717beef11fa1700
logisticsAppSecret=5ba7552b194e4147b7db1c34143e3317
#PAY
#payPostUrl=https://gratia-pay.dctpay.com/crest/
payPostUrl=http://localhost:9601//crest/

@ -96,6 +96,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/selfOilStation/*")
.excludePathPatterns("/order/*")
.excludePathPatterns("/wxMsg/*")
.excludePathPatterns("/orderRebate/*")
.excludePathPatterns("/refuelOnline/*")
;
}

@ -126,152 +126,10 @@ public class WxMsgController {
// 二维码参数
String eventKey = map.get("EventKey");
log.info("二维码参数:" + eventKey);
// 判断用户是否是新用户
HighUser user = highUserService.findByOpenIdH5(userOpenId);
String linkContent = "";
String newUserContent = "";
String content = "";
if (eventKey != null && eventKey.length() != 0) {
JSONObject object = weChatQrcodeUtils.paramPars(eventKey);
// type = 1 推广扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type1.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type1.getType())) {
// linkContent = "<a " +
// "data-miniprogram-appid='wx8d49e2f83025229d'" +
// "data-miniprogram-path='/pages/qianZhuPay/union-pay/union-pay" +
// "href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg' " +
// "data-miniprogram-type='text'>打开小程序</a>";
linkContent ="<a data-miniprogram-appid='wx8d49e2f83025229d' data-miniprogram-path='/pages/tabBar/user/user' href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>扫码领取</a>\n\n";
System.out.println(linkContent);
// todo 推广扫码
}
// type = 2 在线加油门店扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type2.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type2.getType())){
// 商户门店
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code"));
linkContent =
"<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey="
+ object.getString("code") + "&staffCode='>欢迎来到" + store.getStoreName()+"</a>"
+ "[哇][哇][哇]\n\n<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=000000&gasKey="
+ object.getString("code")
+ "&staffCode='>点击这里一键加油</a>\n\n";
}
// 3:查看视频教程
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type3.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type3.getType())){
// 重庆
if ( Objects.equals(object.getString("code"), "1")) {
linkContent =
"加油优惠选我们,你的出行不再忧愁\uD83D\uDC97\n\n"
+ "<a href='https://mp.weixin.qq.com/s/Il-r_ZfTZOQDyQWgfnck1A'>查看中石油操作流程</a>\n\n"
+ "走得更远,看得更美的风景,加油添生活![太阳]\n\n"
+ "好车要好油,优惠更加牛![發]\n\n";
}
// 贵州
if (Objects.equals(object.getString("code"), "2")) {
linkContent =
"加满好油,一路畅游!✨✨\n\n"
+ "<a href='https://mp.weixin.qq.com/s/4kj9XV-K_s88uji3ZrXqgg'>查看中石化操作流程</a>\n\n"
+ "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n"
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
}
// 4:支付码牌扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type4.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type4.getType())){
// 支付码码牌上的二维码
if (Objects.equals(object.getString("codeType"), "PAYMENT_CODE")) {
linkContent =
"点击领取优惠券,享受更多优惠[礼物]\n\n"
+ "<a href='" +
"https://hsgcs.dctpay.com"
// CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000014&key=&code="
+ object.getString("code")
+ "'>立即领取优惠券</a>\n\n";
}
// 支付成功生成的二维码
if (Objects.equals(object.getString("codeType"), "PAYMENT_SUCCESS")) {
linkContent =
"支付分享,享受更高优惠[礼物]\n\n"
+ "<a href='"
+ "https://hsgcs.dctpay.com"
// + CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000012&key=&code="
+ object.getString("code")
+ "'>分享好友</a>\n\n";
}
// 扫码分享二维码进入
if (Objects.equals(object.getString("codeType"), "SHARE")) {
linkContent =
"支付分享,享受更高优惠[礼物]\n\n"
+ "<a href='"
+ "https://hsgcs.dctpay.com"
// + CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000012&key=&code="
+ object.getString("code")
+ "'>分享好友</a>\n\n";
}
}
// 5:扫码贵州中石化优惠券二维码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type5.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type5.getType())){
mapQrCode.put("type", object.getString("encryptType"));
// 二维码参数
mapQrCode.put("id", object.getString("code"));
// 商户门店
linkContent =
"山高水远,相伴致远[爱心][爱心]\n\n"
+ "<a href='"
// + "https://hsgcs.dctpay.com"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000011&key=&code="
+ Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapQrCode)))
+ "'>领取中石化加油券</a>\n\n"
+ "您追求实惠的折扣,我们追求高超的品质\uD83D\uDD16\n\n"
+ "迎南来北往宾朋尊驾,[福]\n\n"
+ "送平安顺遂诚意祝福![福]\n\n";
}
// 6:扫码重庆中石油优惠券二维码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type6.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type6.getType())){
mapQrCode.put("type", object.getString("encryptType"));
// 二维码参数
mapQrCode.put("id", object.getString("code"));
log.info("map参数:" + mapQrCode);
// 商户门店
linkContent =
"加好油,添好运,我们更适意[礼物]\n\n"
+ "<a href='"
// + "https://hsgcs.dctpay.com"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000011&key=&code="
+ Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapQrCode)))
+ "'>领取中石油加油券</a>\n\n"
+ "致力于质量与福利,赢得客户心。\n\n"
+ "一路精彩,“油”我相伴!\uD83C\uDF1F\n\n";
}
}
else {
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击查看更多优惠</a>\n\n";
}
System.out.println("===================" + linkContent);
// 判断是否是新用户
// if (user == null) {
// newUserContent = "特意为您奉上" +
// "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>5张优惠券</a>" +
// ",放在您的"+
// "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>优惠券</a>"+
// "里面,记得及时使用哦[爱心][爱心][爱心]\n\n";
// }
log.info("二维码参数:" + eventKey);
@ -289,7 +147,6 @@ public class WxMsgController {
else if ("event".equals(msgType)) {
// 用户关注公众号
if ("subscribe".equals(event)) {
log.info("进入扫码关注流程:" + event);
content =
"您好,感谢关注嗨森逛商城!\n\n" +
linkContent +
@ -299,10 +156,128 @@ public class WxMsgController {
}
// 用户扫码进入公众号
else if ("SCAN".equals(event)) {
if (eventKey != null && eventKey.length() != 0) {
JSONObject object = weChatQrcodeUtils.paramPars(eventKey);
// type = 1 推广扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type1.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type1.getType())) {
linkContent ="<a data-miniprogram-appid='wx8d49e2f83025229d' data-miniprogram-path='/pages/tabBar/user/user' href='https://mp.weixin.qq.com/s/qKUny68yCU4_6jBdNb1OVg'>扫码领取</a>\n\n";
// todo 推广扫码
}
// type = 2 在线加油门店扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type2.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type2.getType())){
// 商户门店
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreByKey(object.getString("code"));
linkContent =
"<a href='"+CommonSysConst.getSysConfig().getHsgDomainName()+"/hsgH5?accountId=000000&gasKey="
+ object.getString("code") + "&staffCode='>欢迎来到" + store.getStoreName()+"</a>"
+ "[哇][哇][哇]\n\n<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=000000&gasKey="
+ object.getString("code")
+ "&staffCode='>点击这里一键加油</a>\n\n";
}
// 3:查看视频教程
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type3.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type3.getType())){
// 重庆
if ( Objects.equals(object.getString("code"), "1")) {
linkContent =
"加油优惠选我们,你的出行不再忧愁\uD83D\uDC97\n\n"
+ "<a href='https://mp.weixin.qq.com/s/Il-r_ZfTZOQDyQWgfnck1A'>查看中石油操作流程</a>\n\n"
+ "走得更远,看得更美的风景,加油添生活![太阳]\n\n"
+ "好车要好油,优惠更加牛![發]\n\n";
}
// 贵州
if (Objects.equals(object.getString("code"), "2")) {
linkContent =
"加满好油,一路畅游!✨✨\n\n"
+ "<a href='https://mp.weixin.qq.com/s/4kj9XV-K_s88uji3ZrXqgg'>查看中石化操作流程</a>\n\n"
+ "用心为您着想,诚意为您服务。\uD83C\uDF39\n\n"
+ "油客来自五湖四海,在这里祝您一路顺风。\n\n";
}
}
// 4:支付码牌扫码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type4.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type4.getType())){
// 支付码码牌上的二维码
if (Objects.equals(object.getString("codeType"), "PAYMENT_CODE")) {
linkContent =
"点击领取优惠券,享受更多优惠[礼物]\n\n"
+ "<a href='" +
"https://hsgcs.dctpay.com" +
CommonSysConst.getSysConfig().getHsgDomainName()
+ object.getString("code")
+ "'>立即领取优惠券</a>\n\n";
}
// 支付成功生成的二维码
if (Objects.equals(object.getString("codeType"), "PAYMENT_SUCCESS")) {
linkContent =
"支付分享,享受更高优惠[礼物]\n\n"
+ "<a href='"
+ "https://hsgcs.dctpay.com"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ object.getString("code")
+ "'>分享好友</a>\n\n";
}
// 扫码分享二维码进入
if (Objects.equals(object.getString("codeType"), "SHARE")) {
linkContent =
"支付分享,享受更高优惠[礼物]\n\n"
+ "<a href='"
+ "https://hsgcs.dctpay.com"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ object.getString("code")
+ "'>分享好友</a>\n\n";
}
}
// 5:扫码贵州中石化优惠券二维码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type5.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type5.getType())){
mapQrCode.put("type", object.getString("encryptType"));
// 二维码参数
mapQrCode.put("id", object.getString("code"));
// 商户门店
linkContent =
"山高水远,相伴致远[爱心][爱心]\n\n"
+ "<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000011&key=&code="
+ Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapQrCode)))
+ "'>领取中石化加油券</a>\n\n"
+ "您追求实惠的折扣,我们追求高超的品质\uD83D\uDD16\n\n"
+ "迎南来北往宾朋尊驾,[福]\n\n"
+ "送平安顺遂诚意祝福![福]\n\n";
}
// 6:扫码重庆中石油优惠券二维码
if (Objects.equals(object.getString("qrscene_type"), WxQrCodeTypeEnum.type6.getType()) || Objects.equals(object.getString("type"), WxQrCodeTypeEnum.type6.getType())){
mapQrCode.put("type", object.getString("encryptType"));
// 二维码参数
mapQrCode.put("id", object.getString("code"));
log.info("map参数:" + mapQrCode);
// 商户门店
linkContent =
"加好油,添好运,我们更适意[礼物]\n\n"
+ "<a href='"
+ CommonSysConst.getSysConfig().getHsgDomainName()
+ "/hsgH5?accountId=0000011&key=&code="
+ Base64Util.encode(AESEncodeUtil.aesEncrypt(JSON.toJSONString(mapQrCode)))
+ "'>领取中石油加油券</a>\n\n"
+ "致力于质量与福利,赢得客户心。\n\n"
+ "一路精彩,“油”我相伴!\uD83C\uDF1F\n\n";
}
}
else {
linkContent = "<a href='" + CommonSysConst.getSysConfig().getHsgDomainName() + "/hsgH5'>点击查看更多优惠</a>\n\n";
}
content = linkContent + "服务热线:400-023-6806";
}else if ("unsubscribe".equals(event)) {
// todo 取消关注 业务处理
}else if ("CLICK".equals(event)) {
content = linkContent + "服务热线:400-023-6806";
}
map.put("content" , content);
String mapToXml = weChatQrcodeUtils.handleEventSubscribe(map);

@ -55,7 +55,7 @@ public class ApiMerchantsController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE" , ip)) {
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}

@ -14,6 +14,7 @@ import com.hai.entity.HighGasOrderPush;
import com.hai.enum_type.OrderPushType;
import com.hai.model.ResponseData;
import com.hai.order.type.OrderProductType;
import com.hai.service.ApiIpAddressService;
import com.hai.service.ApiMerchantsService;
import com.hai.service.SecConfigService;
import com.v1.config.ToolConfig;
@ -41,8 +42,9 @@ public class GzSinopecController {
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
private ApiIpAddressService apiIpAddressService;
@Resource
private SecConfigService secConfigService;
@ -61,9 +63,9 @@ public class GzSinopecController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE", ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
@ -229,9 +231,9 @@ public class GzSinopecController {
ip = request.getHeader("x-forwarded-for");
}
if (!secConfigService.isConfig("IP_WHITE", ip)) {
log.error("getGuizhouSinopec error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "非法ip地址,请联系管理人员!");
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}

@ -0,0 +1,110 @@
package com.v1.controller.business;
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.ResponseMsgUtil;
import com.hai.entity.ApiMerchants;
import com.hai.model.ResponseData;
import com.hai.service.ApiIpAddressService;
import com.hai.service.ApiMerchantsService;
import com.hai.service.BsOrderRebateService;
import com.hai.service.SecConfigService;
import com.hai.service.impl.OutRechargeOrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Controller
@RequestMapping(value = "/orderRebate")
@Api(value = "订单返利")
public class OrderRebateController {
private static final Logger log = LoggerFactory.getLogger(OutRechargeOrderServiceImpl.class);
@Resource
private BsOrderRebateService bsOrderRebateService;
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private SecConfigService secConfigService;
@Resource
private ApiIpAddressService apiIpAddressService;
@RequestMapping(value = "/rebate", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "积分返利")
public ResponseData rebate(@RequestBody JSONObject object , HttpServletRequest request ) {
try {
String ip = "";
// 有的user可能使用代理,为处理用户使用代理的情况,使用x-forwarded-for
if (request.getHeader("x-forwarded-for") == null) {
ip = request.getRemoteAddr();
} else {
ip = request.getHeader("x-forwarded-for");
}
if (!apiIpAddressService.validationIpAddressLegal(object.getString("merchId") , ip)) {
log.error("getRechargeProduct error!", "非法ip地址,请联系管理人员!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.IP_ERROR, "非法ip地址,请联系管理人员!");
}
if (StringUtils.isBlank(object.getString("apiKey")) ||
StringUtils.isBlank(object.getString("merchId")) ||
StringUtils.isBlank(object.getString("sign"))
) {
log.error("getRechargeProduct error!", "请求参数校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR);
}
ApiMerchants apiMerchants = apiMerchantsService.findByMchId(object.getString("merchId"));
if (apiMerchants == null) {
log.error("getRechargeProduct error!", "商户号错误!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_NOT_EXIST);
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
map.put("userId" , object.getString("userId"));
map.put("productType" , object.getInteger("productType"));
map.put("orderNo" , object.getString("orderNo"));
map.put("orderId" , object.getLong("orderId"));
map.put("price" , object.getBigDecimal("price"));
map.put("title" , object.getString("title"));
map.put("createTime" , object.getDate("createTime"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
bsOrderRebateService.insertOrderRebate(object);
return ResponseMsgUtil.success("赠送成功");
} catch (Exception e) {
log.error("HighOrderController --> getBackendToken() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}
Loading…
Cancel
Save