袁野 2 years ago
parent 115e7b8b9c
commit ebf60916ec
  1. 166
      hai-bweb/src/main/java/com/bweb/controller/ApiMemberProductController.java
  2. 2
      hai-bweb/src/main/java/com/bweb/controller/BsProductConfigController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighGoodsTypeController.java
  4. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  5. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  6. 142
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  7. 52
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  8. 34
      hai-cweb/src/main/java/com/cweb/controller/pay/UnionPayController.java
  9. 253
      hai-cweb/src/main/java/com/cweb/controller/pay/thirdOrderController.java
  10. 72
      hai-schedule/src/main/java/com/hai/schedule/ApiThirdProductSchedule.java
  11. 315
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  12. 1
      hai-service/src/main/java/com/hai/common/pay/entity/OrderType.java
  13. 27
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  14. 104
      hai-service/src/main/java/com/hai/config/QianZhuConfig.java
  15. 1
      hai-service/src/main/java/com/hai/config/ThirdProductConfig.java
  16. 45
      hai-service/src/main/java/com/hai/dao/HighOrderMapperExt.java
  17. 34
      hai-service/src/main/java/com/hai/entity/HighOrder.java
  18. 49
      hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java
  19. 77
      hai-service/src/main/java/com/hai/model/ThirdPartyModel.java
  20. 57
      hai-service/src/main/java/com/hai/service/ApiMemberProductService.java
  21. 44
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  22. 52
      hai-service/src/main/java/com/hai/service/impl/ApiMemberProductServiceImpl.java
  23. 73
      hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java
  24. 3
      hai-service/src/main/java/com/hai/service/impl/HighGoodsTypeServiceImpl.java
  25. 938
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  26. 1
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  27. 61
      hai-service/src/main/java/com/hai/service/pay/impl/StarbucksOrderServiceImpl.java
  28. 6
      hai-service/src/main/resources/dev/commonConfig.properties
  29. 6
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  30. 4
      hai-service/src/main/resources/prod/commonConfig.properties

@ -0,0 +1,166 @@
package com.bweb.controller;
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.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.*;
import com.hai.entity.ApiMemberProduct;
import com.hai.entity.ApiMerchants;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.ApiMemberProductService;
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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/apiMemberProduct")
@Api(value = "api商户")
public class ApiMemberProductController {
Logger log = LoggerFactory.getLogger(ApiMemberProductController.class);
@Resource
private ApiMemberProductService apiMemberProductService;
@Autowired
private UserCenter userCenter;
@Resource
private RedisUtil redisUtil;
@RequestMapping(value = "/getListApiMemberProduct", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询产品列表")
public ResponseData getListApiMemberProduct(
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "typeId", required = false) Integer typeId,
@RequestParam(value = "brandId", required = false) String brandId,
@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize
) {
try {
Map<String, Object> map = new HashMap<>();
map.put("name", name);
map.put("typeId", typeId);
map.put("brandId", brandId);
PageHelper.startPage(pageNum,pageSize);
List<ApiMemberProduct> list = apiMemberProductService.getListApiMemberProduct(map);
return ResponseMsgUtil.success(new PageInfo<>(list));
} catch (Exception e) {
log.error("ApiMerchantsController --> getListUser() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/insertMemberProduct",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增产品")
public ResponseData insertMemberProduct(@RequestBody ApiMemberProduct apiMemberProduct, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighMerchantController -> updateMerchant() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
if (StringUtils.isBlank(apiMemberProduct.getName()) ||
apiMemberProduct.getTypeId() == null ||
StringUtils.isBlank(apiMemberProduct.getProductId()) ||
apiMemberProduct.getBrandId() == null ||
apiMemberProduct.getPrice() == null ) {
log.error("ApiMemberProductController -> insertMemberProduct() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
apiMemberProduct.setCreateTime(new Date());
apiMemberProduct.setUpdateTime(new Date());
apiMemberProduct.setOperatorId(userInfoModel.getSecUser().getId());
apiMemberProduct.setOperatorName(userInfoModel.getSecUser().getUserName());
apiMemberProduct.setStatus(102);
apiMemberProductService.insertApiMemberProduct(apiMemberProduct);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("ApiMerchantsController -> insertMerchant() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/updateMemberProduct",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "修改产品")
public ResponseData updateMemberProduct(@RequestBody ApiMemberProduct apiMemberProduct, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (userInfoModel.getBsCompany() == null) {
log.error("HighMerchantController -> updateMerchant() error!","该主角色没有权限");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, "");
}
if (StringUtils.isBlank(apiMemberProduct.getName()) ||
apiMemberProduct.getId() == null ||
apiMemberProduct.getTypeId() == null ||
StringUtils.isBlank(apiMemberProduct.getProductId()) ||
apiMemberProduct.getBrandId() == null ||
apiMemberProduct.getPrice() == null ) {
log.error("ApiMemberProductController -> insertMemberProduct() error!","参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
apiMemberProduct.setUpdateTime(new Date());
apiMemberProduct.setOperatorId(userInfoModel.getSecUser().getId());
apiMemberProduct.setOperatorName(userInfoModel.getSecUser().getUserName());
apiMemberProduct.setStatus(102);
apiMemberProductService.updateApiMemberProduct(apiMemberProduct);
return ResponseMsgUtil.success("修改成功");
} catch (Exception e) {
log.error("ApiMerchantsController -> insertMerchant() error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findById", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情")
public ResponseData findById(@RequestParam(value = "id", required = true) Long id) {
try {
return ResponseMsgUtil.success(apiMemberProductService.findById(id));
} catch (Exception e) {
log.error("ApiMerchantsController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -110,7 +110,6 @@ public class BsProductConfigController {
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (object == null ||
object.getJSONArray("productIds") == null ||
object.getBigDecimal("discount") == null ||
object.getInteger("productType") == null ||
object.getJSONArray("productPlatform") == null ||
@ -146,7 +145,6 @@ public class BsProductConfigController {
if (object == null ||
object.getLong("id") == null ||
object.getJSONArray("productIds") == null ||
object.getBigDecimal("discount") == null ||
object.getInteger("productType") == null ||
object.getJSONArray("productPlatform") == null ||

@ -52,11 +52,13 @@ public class HighGoodsTypeController {
public ResponseData getListGoodsType(@RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize,
@RequestParam(name = "title", required = false) String title,
@RequestParam(name = "userService", required = false) String userService,
HttpServletRequest request) {
try {
Map<String,String> map = new HashMap<>();
map.put("title", title);
map.put("userService", userService);
PageHelper.startPage(pageNum,pageSize);
return ResponseMsgUtil.success(new PageInfo<>(highGoodsTypeService.getListGoodsType(map)));

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -16,15 +16,13 @@ import com.hai.config.QianZhuConfig;
import com.hai.config.ThirdProductConfig;
import com.hai.entity.*;
import com.hai.enum_type.ProductImgEnum;
import com.hai.model.ApiStarbucksProductsModel;
import com.hai.model.BsProductConfigModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.model.*;
import com.hai.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.spi.CopyOnWrite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
@ -66,9 +64,6 @@ public class HighThirdPartyController {
@Autowired
private UserCenter userCenter;
@Resource
private BsConfigService bsConfigService;
@RequestMapping(value = "/getAllCity", method = RequestMethod.GET)
@ResponseBody
@ -288,8 +283,7 @@ public class HighThirdPartyController {
StringUtils.isBlank(object.getString("regionId")) ||
StringUtils.isBlank(object.getString("storeCode")) ||
object.getInteger("productType") == null ||
object.getInteger("platformId") == null ||
object.getJSONArray("orderItems") == null
object.getInteger("platformId") == null
) {
log.error("addOrder error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
@ -310,4 +304,134 @@ public class HighThirdPartyController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getThirdOrderByOrderId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询第三方订单详情")
public ResponseData getThirdOrderByOrderId(@RequestParam(name = "orderId", required = true) Long orderId) {
try {
HighOrder order = highOrderService.getOrderById(orderId);
JSONObject object;
ThirdPartyModel partyModel = new ThirdPartyModel();
List<Map<String, Object>> list = new ArrayList<>();
// 实际支付金额
BigDecimal orderPayPrice = new BigDecimal(0);
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
object = QianZhuConfig.getKfcOrderByOrderNo(order.getOrderNo());
if (object.getBoolean("success")) {
BeanUtils.copyProperties(order, partyModel);
partyModel.setCode(object.getJSONObject("data").getString("ticket"));
partyModel.setThirdOrderStatus(object.getJSONObject("data").getInteger("status"));
if (object.getJSONObject("data").getString("ticket") != null) {
String[] s = object.getJSONObject("data").getString("ticket").split(",");
for (String s1 : s) {
Map<String , Object> map = new HashMap<>();
String[] childString = s1.split("\\|");
map.put("code" , childString[0]);
map.put("phone" , childString[1]);
list.add(map);
}
partyModel.setList(list);
}
partyModel.setEatType(object.getJSONObject("data").getJSONObject("kfcPlaceOrder").getInteger("eatType"));
partyModel.setKfcOrderMobileRemark(object.getJSONObject("data").getString("kfcOrderMobileRemark"));
} else {
log.error("getThirdOrderByOrderId error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message"));
}
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
// 查询详单订单的实际
JSONObject productDetail = thirdProductConfig.getThirdPartyByDetail(1, 1, order.getCompanyId());
object = QianZhuConfig.starbucksOrderByOrderNo(order.getOrderNo());
if (object.getBoolean("success")) {
BeanUtils.copyProperties(order, partyModel);
partyModel.setCode(object.getJSONObject("data").getString("ticket"));
partyModel.setThirdOrderStatus(object.getJSONObject("data").getInteger("status"));
partyModel.setObject(object.getJSONObject("data"));
// 获取星巴克订单内容
JSONArray starbucksOrder = object.getJSONObject("data").getJSONArray("orderItems");
for (Object starbucksObject : starbucksOrder) {
JSONObject childObject = (JSONObject) starbucksObject;
// 计算利润
BigDecimal profitPrice = childObject.getBigDecimal("unitPrice").multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)));
BigDecimal childPrice = childObject.getBigDecimal("unitPrice").add(profitPrice).setScale(2 , RoundingMode.HALF_UP);
// 计算实际支付金额
orderPayPrice = orderPayPrice.add(childPrice);
childObject.put("unitPrice" , childPrice);
childObject.put("totalPrice" , childPrice.multiply(childObject.getBigDecimal("quantity")));
}
object.getJSONObject("data").put("paymentAmount" , orderPayPrice);
partyModel.setObject(object.getJSONObject("data"));
if (object.getJSONObject("data").getString("code") != null) {
String[] s = object.getJSONObject("data").getString("code").split(",");
for (String s1 : s) {
Map<String , Object> map = new HashMap<>();
String[] childString = s1.split("\\|");
map.put("code" , childString[0]);
map.put("phone" , childString[1]);
list.add(map);
}
partyModel.setList(list);
}
} else {
log.error("getThirdOrderByOrderId error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message"));
}
}
return ResponseMsgUtil.success(partyModel);
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/thirdCancelOrder", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "取消订单")
public ResponseData thirdCancelOrder(@RequestParam(name = "orderId", required = true) Long orderId) {
try {
HighOrder order = highOrderService.getOrderById(orderId);
if (order.getOrderStatus() == 1) {
highOrderService.thirdCancelOrder(orderId);
} else {
log.error("orderToPay error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.STATUS_ERROR, "");
}
return ResponseMsgUtil.success("操作成功");
} catch (Exception e) {
log.error("HighOrderController --> cancelOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -9,6 +9,7 @@ import com.hai.common.exception.SysCode;
import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.WeChatPayReqInfo;
import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.*;
@ -64,6 +65,9 @@ public class CzOrderController {
@Resource
private UnionPayConfig unionPayConfig;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@Resource
private HighUserCardService highUserCardService;
@ -406,19 +410,13 @@ public class CzOrderController {
if (body == null
|| body.getLong("orderId") == null
|| StringUtils.isBlank(body.getString("password"))
|| StringUtils.isBlank(body.getString("cardNo"))
) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo"));
if (userCard == null) {
log.error("hltUnionCardPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
// 订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(body.getLong("orderId"));
@ -433,6 +431,27 @@ public class CzOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
// 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(order.getUserId());
if (userPayPassword == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (StringUtils.isBlank(body.getString("password"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 校验支付密码
if (!AESEncodeUtil.aesEncrypt(body.getString("password")).equals(userPayPassword.getPassword())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, "");
}
// 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo"));
if (userCard == null) {
log.error("hltUnionCardPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
outRechargeOrderService.hltUnionCardPay(userCard, order);
return ResponseMsgUtil.success(outRechargeOrderService.findByOrderId(body.getLong("orderId")));
@ -483,25 +502,6 @@ public class CzOrderController {
}
}
@RequestMapping(value="/apiCallBack",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "apiCallBack")
public String test(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
System.out.println("reqBodyStr");
return "SUCCESS";
} catch (Exception e) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
}
private void apiOrderRecord(OutRechargeOrder rechargeOrder) {
Map<String, Object> orderMap = new HashMap<>();

@ -26,6 +26,7 @@ import com.hai.service.pay.NotifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.io.filefilter.IOFileFilter;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -341,34 +342,17 @@ public class UnionPayController {
}
}
}
if (highChildOrder.getGoodsType() == 7) {
HighDiscountPackageActual actual = discountPackageActualService.getDetailByChildOrderId(highChildOrder.getId());
if (actual != null) {
List<HighDiscountPackageDiscountActual> discountList = discountPackageDiscountActualService.getHighDiscountPackageDiscountActualList(actual.getId());
for (HighDiscountPackageDiscountActual discount : discountList) {
highDiscountUserRelService.receiveDiscount(order.getMemId(), discount.getAgentDiscountCodeId());
}
HighDiscountPackage discountPackage = discountPackageService.findDiscountPackageById(actual.getDiscountPackageId());
HighDiscountPackageRecord record = new HighDiscountPackageRecord();
record.setDiscountPackageId(discountPackage.getId());
record.setDiscountPackageTitle(discountPackage.getTitle());
record.setUsingAttribution(discountPackage.getUsingAttribution());
record.setCompanyId(discountPackage.getCompanyId());
record.setOrderId(order.getId().intValue());
record.setChildOrderId(highChildOrder.getId().intValue());
record.setRecordNo(System.currentTimeMillis()+"");
record.setSalesType(1);
record.setPrice(order.getPayPrice());
record.setUserId(order.getMemId().intValue());
discountPackageRecordService.insertRecord(record);
actual.setAllocationTime(new Date());
actual.setStatus(3); // 状态: 1: 待分配 2:预分配(售卖)3:已分配
discountPackageActualService.updateHighDiscountPackageActual(actual);
}
if (highChildOrder.getGoodsType() == 4 || highChildOrder.getGoodsType() == 9) {
highChildOrder.setChildOrdeStatus(2);
}
}
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
QianZhuConfig.payKfcOrder(order.getOrderNo());
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
}
highOrderService.updateOrder(order);

@ -0,0 +1,253 @@
package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.WechatPayUtil;
import com.hai.common.pay.entity.WeChatPayReqInfo;
import com.hai.common.pay.util.MD5Util;
import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.MathUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig;
import com.hai.config.UnionPayConfig;
import com.hai.entity.*;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserCardService;
import com.hai.service.HighUserPayPasswordService;
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.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ThreadLocalRandom;
@Controller
@RequestMapping(value = "/thirdOrder")
@Api(value = "第三方订单支付接口")
public class thirdOrderController {
private static Logger log = LoggerFactory.getLogger(TuanYouController.class);
@Resource
private UserCenter userCenter;
@Resource
private HighOrderService highOrderService;
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private HighUserCardService highUserCardService;
@Resource
private UnionPayConfig unionPayConfig;
@Resource
private HighUserPayPasswordService highUserPayPasswordService;
@RequestMapping(value="/orderToPayByWx",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "微信订单支付发起支付")
public ResponseData orderToPayByWx(@RequestBody String reqBodyStr) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
Integer openIdType = jsonObject.getInteger("openIdType"); // openId类型 1:小程序 2:公众号
String openId = jsonObject.getString("openId"); // openId
if (orderId == null || StringUtils.isBlank(openId)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
HighOrder order = highOrderService.getOrderById(jsonObject.getLong("orderId"));
if (order == null) {
log.error("orderToPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getOrderStatus() != 1) {
log.error("orderToPayByWx error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
Map<String,Object> map = new HashMap<>();
map.put("orderNo", order.getOrderNo());
map.put("payPrice", order.getPayRealPrice());
if (order.getHighChildOrderList().get(0).getGoodsType() == 4) {
map.put("orderScene", "KFC_ORDER");
} else if (order.getHighChildOrderList().get(0).getGoodsType() == 9) {
map.put("orderScene", "STARBUCKS_ORDER");
}
// 肯德基订单 星巴克订单
map.put("body", "购买第三方产品");
map.put("subject","购买第三方产品");
//微信支付
String nonce_str = MD5Util.MD5Encode(String.valueOf(ThreadLocalRandom.current().nextInt(10000)), "UTF-8");
int total_fee = MathUtils.objectConvertBigDecimal(map.get("payPrice")).multiply(new BigDecimal("100")).intValue();
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo();
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxMchAppId()); //公众号id
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxMchId()); //商户号
if (openIdType != null && openIdType.equals(2)) {
weChatPayReqInfo.setSub_appid("wxa075e8509802f826"); //商户号公众号
} else {
weChatPayReqInfo.setSub_appid(SysConst.getSysConfig().getWxSubAppId());//小程序
}
weChatPayReqInfo.setSub_mch_id("1614670195");
weChatPayReqInfo.setSub_openid(openId);
weChatPayReqInfo.setNonce_str(nonce_str); //随机字符串
weChatPayReqInfo.setBody(map.get("body").toString()); //商品描述
weChatPayReqInfo.setOut_trade_no(map.get("orderNo").toString()); //商户订单号
weChatPayReqInfo.setTotal_fee(total_fee); //总金额
weChatPayReqInfo.setSpbill_create_ip("139.159.177.244"); //终端ip
weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getNotifyUrl()); //通知url
weChatPayReqInfo.setTrade_type("JSAPI"); //交易类型
weChatPayReqInfo.setAttach(map.get("orderScene").toString());
weChatPayReqInfo.setProfit_sharing("N");
//附加数据,区分订单类型
Map<String,String> payMap = new HashMap<>();
payMap.put("app_id", weChatPayReqInfo.getSub_appid());
payMap.put("api_key",SysConst.getSysConfig().getWxApiKey());
payMap.put("unified_order_url",SysConst.getSysConfig().getWxUnifiedOrderUrl());
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap);
return ResponseMsgUtil.success(sortedMap);
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/hltUnionCardPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "工会卡支付")
public ResponseData hltUnionCardPay(@RequestBody JSONObject body, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (body == null
|| body.getLong("orderId") == null
|| StringUtils.isBlank(body.getString("password"))
|| StringUtils.isBlank(body.getString("cardNo"))
) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 查询用户与卡号的关系
HighUserCard userCard = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), body.getString("cardNo"));
if (userCard == null) {
log.error("hltUnionCardPay() ERROR", "未绑定卡号");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未绑定卡号");
}
// 订单
HighOrder order = highOrderService.getOrderById(body.getLong("orderId"));
if (order == null) {
log.error("hltUnionCardPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款
if (order.getOrderStatus() != 1) {
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
// 查询用户支付密码
HighUserPayPassword userPayPassword = highUserPayPasswordService.getDetailByUser(order.getMemId());
if (userPayPassword == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_SET_USER_PAY_PWD, "");
}
if (StringUtils.isBlank(body.getString("password"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_ENTER_USER_PAY_PWD, "");
}
// 校验支付密码
if (!AESEncodeUtil.aesEncrypt(body.getString("password")).equals(userPayPassword.getPassword())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.USER_PAY_PWD_ERROR, "");
}
highOrderService.hltUnionCardPayByThirdProduct(userCard, order.getId());
return ResponseMsgUtil.success(order);
} catch (Exception e) {
log.error("hltUnionCardPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/orderToUnionPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "订单支付发起银联支付")
public ResponseData orderToUnionPay(@RequestBody String reqBodyStr,HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
if (orderId == null) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// 订单
HighOrder order = highOrderService.getOrderById(orderId);
if (order == null) {
log.error("hltUnionCardPay error!", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到订单信息");
}
// 订单状态 : 订单支付状态 : 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getOrderStatus() != 1) {
log.error("hltUnionCardPay error!", "无法支付,订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
}
return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPayRealPrice(), "购买第三方产品", CommonSysConst.getSysConfig().getUnionPayNotifyUrl(), request));
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -0,0 +1,72 @@
package com.hai.schedule;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.config.QianZhuConfig;
import com.hai.entity.ApiStarbucksProducts;
import com.hai.service.ApiProductService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.Scheduled;
import javax.annotation.Resource;
import java.util.Date;
@Configuration
public class ApiThirdProductSchedule {
private static final Logger log = LoggerFactory.getLogger(ApiThirdProductSchedule.class);
@Resource
private ApiProductService apiProductService;
@Scheduled(cron = "0 0 1 * * ?") // 获取星巴克产品 每日凌晨1点执行一次
public void getStarbucksProducts() throws Exception {
JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(1 , 200);
JSONObject object = jsonObject.getJSONObject("data");
JSONArray array = object.getJSONArray("items");
for (Object data : array) {
JSONObject dataObject = (JSONObject) data;
ApiStarbucksProducts starbucksProducts = apiProductService.findStarbucksProductsByGoodsId(dataObject.getLong("id"));
if (dataObject.getInteger("shelfStatus") == 5) {
if (starbucksProducts == null) {
starbucksProducts = new ApiStarbucksProducts();
}
starbucksProducts.setCategoryName(dataObject.getString("categoryName"));
starbucksProducts.setCream(dataObject.getString("cream"));
starbucksProducts.setCupSize(dataObject.getString("cupSize"));
starbucksProducts.setDefaultImage(dataObject.getString("defaultImage"));
starbucksProducts.setDes(dataObject.getString("des"));
starbucksProducts.setEspresso(dataObject.getString("espresso"));
starbucksProducts.setMarketGrandePrice(dataObject.getBigDecimal("marketGrandePrice"));
starbucksProducts.setMarketTallPrice(dataObject.getBigDecimal("marketTallPrice"));
starbucksProducts.setMarketVentiPrice(dataObject.getBigDecimal("marketVentiPrice"));
starbucksProducts.setSalesGrandePrice(dataObject.getBigDecimal("salesGrandePrice"));
starbucksProducts.setSalesTallPrice(dataObject.getBigDecimal("salesTallPrice"));
starbucksProducts.setSalesVentiPrice(dataObject.getBigDecimal("salesVentiPrice"));
starbucksProducts.setMilk(dataObject.getString("milk"));
starbucksProducts.setMilkBubble(dataObject.getString("milkBubble"));
starbucksProducts.setName(dataObject.getString("name"));
starbucksProducts.setTemperature(dataObject.getString("temperature"));
if (starbucksProducts.getId() == null) {
starbucksProducts.setCreateTime(new Date());
starbucksProducts.setOperatorId(9999L);
starbucksProducts.setOperatorName("系统生成");
starbucksProducts.setStatus(100);
starbucksProducts.setGoodsId(dataObject.getLong("id"));
apiProductService.insertStarbucksProducts(starbucksProducts);
} else {
starbucksProducts.setUpdateTime(new Date());
apiProductService.updateStarbucksProducts(starbucksProducts);
}
}
}
}
}

@ -48,7 +48,7 @@ public class HighOrderSchedule {
* @Description 取消订单 15分钟
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
public void cancelOrder() {
List<HighOrder> orderList = highOrderService.getCloseOrder();
if (orderList != null && orderList.size() > 0) {
@ -63,14 +63,14 @@ public class HighOrderSchedule {
}
/**
* @Author Sum1Dream
* @name cancelMobileOrder.java
* @Description // 取消话费订单
* @Date 3:33 下午 2021/12/10
* @Param []
* @return void
*/
@Scheduled(cron="0 0/1 * * * ?") //每15分钟执行一次
* @return void
* @Author Sum1Dream
* @name cancelMobileOrder.java
* @Description // 取消话费订单
* @Date 3:33 下午 2021/12/10
* @Param []
*/
@Scheduled(cron = "0 0/1 * * * ?") //每15分钟执行一次
public void cancelMobileOrder() {
List<OutRechargeOrder> orderList = outRechargeOrderService.getOutRechargeOrderList();
if (orderList != null && orderList.size() > 0) {
@ -85,18 +85,18 @@ public class HighOrderSchedule {
}
/**
* @Author Sum1Dream
* @name cancelOrder.java
* @Description // 定时发起
* @Date 14:18 2022/5/31
* @Param []
* @return void
*/
@Scheduled(cron="0 0/5 * * * ?") //每10分钟执行一次
* @return void
* @Author Sum1Dream
* @name cancelOrder.java
* @Description // 定时发起
* @Date 14:18 2022/5/31
* @Param []
*/
@Scheduled(cron = "0 0/5 * * * ?") //每10分钟执行一次
public void initRechargeOrder() {
Map<String, Object> map = new HashMap<>();
map.put("payStatus" , String.valueOf(102));
map.put("rechargeStatus" , String.valueOf(204));
map.put("payStatus", String.valueOf(102));
map.put("rechargeStatus", String.valueOf(204));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
if (orderList.size() > 0) {
@ -104,8 +104,8 @@ public class HighOrderSchedule {
try {
// 查询充值子订单
Map<String, Object> childOrderMap = new HashMap<>();
childOrderMap.put("parent_order_id" , order.getId());
childOrderMap.put("status" , 102);
childOrderMap.put("parent_order_id", order.getId());
childOrderMap.put("status", 102);
List<OutRechargeChildOrder> childOrderList = rechargeChildOrderService.getListRechargeChildOrder(childOrderMap);
@ -139,7 +139,7 @@ public class HighOrderSchedule {
* @Description 处理话费充值订单
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
public void handleMobileOrder() {
List<HighOrder> orderList = highOrderService.getAlreadyPaidMobileOrder();
if (orderList != null && orderList.size() > 0) {
@ -152,63 +152,7 @@ public class HighOrderSchedule {
JSONObject data = mobileOrderJson.getJSONObject("data");
// 订单状态 0:待付款 5:已支付 10:充值中 15:交易成功 -5:已取消 -10:充值失败
if (data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
if (data.getInteger("status") == -10 || data.getInteger("status") == -5) {
if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(4);
}
highOrder.setOrderStatus(4);
highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(highOrder.getPayRealPrice());
highOrderService.updateOrder(highOrder);
}
} else {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(5);
}
highOrder.setCancelTime(new Date());
highOrder.setOrderStatus(5);
highOrderService.updateOrder(highOrder);
}
}
}
}
} catch (Exception e) {
log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
}
}
}
}
/**
* @Author 胡锐
* @Description 处理话KFC订单
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void handleKfcOrder() {
List<HighOrder> orderList = highOrderService.getAlreadyPaidKfcOrder();
if (orderList != null && orderList.size() > 0) {
for (HighOrder order : orderList) {
try {
HighOrder highOrder = highOrderService.getOrderById(order.getId());
if (highOrder != null) {
JSONObject mobileOrderJson = QianZhuConfig.getKfcOrderByOrderNo(highOrder.getOrderNo());
if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
JSONObject data = mobileOrderJson.getJSONObject("data");
// 订单状态 0:待付款 5:排队中 15:TRAN_SUCCESS:交易成功 -5:已取消
if (data.getInteger("status") == 15) {
if (data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
@ -216,11 +160,10 @@ public class HighOrderSchedule {
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
if (data.getInteger("status") == -5) {
if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
if (data.getInteger("status") == -10 || data.getInteger("status") == -5) {
if (highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
if (orderRefundModel.getResult_code().equals("SUCCESS")) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(4);
}
@ -248,72 +191,202 @@ public class HighOrderSchedule {
}
/**
* @Author 胡锐
* @Description 处理电影票订单
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
public void handleCinemaOrder() {
List<HighOrder> orderList = highOrderService.getAlreadyPaidCinemaOrder();
* @Author Sum1Dream
* @name handleThirdOrder.java
* @Description // 处理第三方订单
* @Date 16:24 2022/7/8
* @Param []
* @return void
*/
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
public void handleThirdOrder() {
List<HighOrder> orderList = highOrderService.getThirdOrder();
// 判断是否存在订单
if (orderList != null && orderList.size() > 0) {
for (HighOrder order : orderList) {
try {
HighOrder highOrder = highOrderService.getOrderById(order.getId());
if (highOrder != null) {
JSONObject mobileOrderJson = QianZhuConfig.getCinemaOrderByOrderNo(highOrder.getOrderNo());
if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
JSONObject data = mobileOrderJson.getJSONObject("data");
// 订单状态 0:待付款 5:待出票 10:已出票 15:交易成功 -5:已取消
if (data.getInteger("status") == 10 || data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
// 肯德基订单
if (highOrder.getHighChildOrderList().get(0).getGoodsType() == 4) {
JSONObject orderObject = QianZhuConfig.getKfcOrderByOrderNo(highOrder.getOrderNo());
if (orderObject != null && orderObject.getBoolean("success")) {
JSONObject data = orderObject.getJSONObject("data");
// 订单状态 0:待付款 5:排队中 15:TRAN_SUCCESS:交易成功 -5:已取消
if (data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(3);
}
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
if (data.getInteger("status") == -5) {
if(highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
if(orderRefundModel.getResult_code().equals("SUCCESS")) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(4);
}
highOrder.setOrderStatus(4);
highOrder.setRefundTime(new Date());
highOrder.setRefundPrice(highOrder.getPayRealPrice());
highOrderService.updateOrder(highOrder);
// 订单失败
if (data.getInteger("status") == -5) {
if (highOrder.getOrderStatus() == 2) {
highOrderService.thirdOrderToRefund(order.getId());
} else {
highOrderService.thirdCancelOrder(order.getId());
}
} else {
}
}
} else if (highOrder.getHighChildOrderList().get(0).getGoodsType() == 9) {
// 星巴克订单
// 根据订单号查询订单详情
JSONObject orderObject = QianZhuConfig.starbucksOrderByOrderNo(highOrder.getOrderNo());
if (orderObject != null && orderObject.getBoolean("success")) {
JSONObject data = orderObject.getJSONObject("data");
// 订单状态 0:待付款 5:已支付 10:出单中 15:出单成功 20:配送中 25:配送完成 -5:已取消 -10:失败
if (data.getInteger("status") == 15) {
for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(5);
childOrder.setChildOrdeStatus(3);
}
highOrder.setCancelTime(new Date());
highOrder.setOrderStatus(5);
highOrder.setOrderStatus(3);
highOrder.setFinishTime(new Date());
highOrderService.updateOrder(highOrder);
}
// 订单失败
if (data.getInteger("status") == -5) {
if (highOrder.getOrderStatus() == 2) {
highOrderService.thirdOrderToRefund(order.getId());
} else {
highOrderService.thirdCancelOrder(order.getId());
}
}
}
}
}
} catch (Exception e) {
log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
log.error("HighOrderSchedule --> handleThirdOrder() error!", e);
}
}
}
}
// /**
// * @Author 胡锐
// * @Description 处理话KFC订单
// * @Date 2021/4/4 22:45
// **/
// @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
// public void handleKfcOrder() {
// List<HighOrder> orderList = highOrderService.getAlreadyPaidKfcOrder();
// if (orderList != null && orderList.size() > 0) {
// for (HighOrder order : orderList) {
// try {
// HighOrder highOrder = highOrderService.getOrderById(order.getId());
// if (highOrder != null) {
// JSONObject mobileOrderJson = QianZhuConfig.getKfcOrderByOrderNo(highOrder.getOrderNo());
// if (mobileOrderJson != null && mobileOrderJson.getBoolean("success")) {
// JSONObject data = mobileOrderJson.getJSONObject("data");
//
// // 订单状态 0:待付款 5:排队中 15:TRAN_SUCCESS:交易成功 -5:已取消
// if (data.getInteger("status") == 15) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(3);
// }
// highOrder.setOrderStatus(3);
// highOrder.setFinishTime(new Date());
// highOrderService.updateOrder(highOrder);
// }
//
// if (data.getInteger("status") == -5) {
// if (highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
// OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
// if (orderRefundModel.getResult_code().equals("SUCCESS")) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(4);
// }
// highOrder.setOrderStatus(4);
// highOrder.setRefundTime(new Date());
// highOrder.setRefundPrice(highOrder.getPayRealPrice());
// highOrderService.updateOrder(highOrder);
// }
// } else {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(5);
// }
// highOrder.setCancelTime(new Date());
// highOrder.setOrderStatus(5);
// highOrderService.updateOrder(highOrder);
// }
// }
// }
// }
// } catch (Exception e) {
// log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
// }
// }
// }
// }
// /**
// * @Author 胡锐
// * @Description 处理电影票订单
// * @Date 2021/4/4 22:45
// **/
// @Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
// public void handleCinemaOrder() {
// List<HighOrder> orderList = highOrderService.getAlreadyPaidCinemaOrder();
// if (orderList != null && orderList.size() > 0) {
// for (HighOrder order : orderList) {
// try {
// HighOrder highOrder = highOrderService.getOrderById(order.getId());
// if (highOrder != null) {
// JSONObject mobileOrderJson = QianZhuConfig.getCinemaOrderByOrderNo(highOrder.getOrderNo());
// if (mobileOrderJson != null && mobileOrderJson.getBoolean("success") == true) {
// JSONObject data = mobileOrderJson.getJSONObject("data");
//
// // 订单状态 0:待付款 5:待出票 10:已出票 15:交易成功 -5:已取消
// if (data.getInteger("status") == 10 || data.getInteger("status") == 15) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(3);
// }
// highOrder.setOrderStatus(3);
// highOrder.setFinishTime(new Date());
// highOrderService.updateOrder(highOrder);
// }
//
// if (data.getInteger("status") == -5) {
// if (highOrder.getPaySerialNo() != null && highOrder.getPayRealPrice() != null) {
// OrderRefundModel orderRefundModel = WxOrderConfig.orderToRefund(highOrder.getPaySerialNo(), highOrder.getPayRealPrice(), highOrder.getPayRealPrice());
// if (orderRefundModel.getResult_code().equals("SUCCESS")) {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(4);
// }
// highOrder.setOrderStatus(4);
// highOrder.setRefundTime(new Date());
// highOrder.setRefundPrice(highOrder.getPayRealPrice());
// highOrderService.updateOrder(highOrder);
// }
// } else {
// for (HighChildOrder childOrder : highOrder.getHighChildOrderList()) {
// childOrder.setChildOrdeStatus(5);
// }
// highOrder.setCancelTime(new Date());
// highOrder.setOrderStatus(5);
// highOrderService.updateOrder(highOrder);
// }
// }
// }
// }
// } catch (Exception e) {
// log.error("HighCouponSchedule --> handleMobileOrder() error!", e);
// }
// }
// }
// }
/**
* @Author 胡锐
* @Description 完成团油订单 超过支付时间24小时订单自动完成
* @Date 2021/4/4 22:45
**/
@Scheduled(cron="0 0/1 * * * ?") //每1分钟执行一次
@Scheduled(cron = "0 0/1 * * * ?") //每1分钟执行一次
public void finishGasOrder() {
List<Map<String, Object>> mapList = highOrderService.getFinishGasOrder();
if (mapList != null && mapList.size() > 0) {
for (Map<String,Object> map : mapList) {
for (Map<String, Object> map : mapList) {
HighOrder order = highOrderService.getOrderById(Long.parseLong(map.get("orderId").toString()));
if (order != null) {
order.setOrderStatus(3);

@ -5,6 +5,7 @@ public enum OrderType {
GOODS_ORDER("GOODS_ORDER", "goodsOrderService", "购买商品"),
RECHARGE_ORDER("RECHARGE_ORDER", "rechargeOrderService", "充值订单"),
KFC_ORDER("KFC", "kfcOrderService", "KFC订单"),
STARBUCKS_ORDER("STARBUCKS", "starbucksOrderService", "星巴克订单"),
CINEMA_ORDER("CINEMA", "cinemaOrderService", "电影票订单"),
MOBILE_ORDER("MOBILE", "mobileOrderService", "话费充值订单"),
TEST("TEST", "testPayService", "支付测试"),

@ -31,6 +31,9 @@ public class CommonSysConfig {
private String qinzhuPlatformId;
private String qinzhuSecret;
private String qianzhuOrderNotify;
private String thirdAppKey;
private String thirdAppSecret;
private String thirdPostUrl;
private String huiliantongUrl;
private String huiliantongAppNo;
@ -521,4 +524,28 @@ public class CommonSysConfig {
public void setLyNotifyUrl(String lyNotifyUrl) {
LyNotifyUrl = lyNotifyUrl;
}
public String getThirdAppKey() {
return thirdAppKey;
}
public void setThirdAppKey(String thirdAppKey) {
this.thirdAppKey = thirdAppKey;
}
public String getThirdAppSecret() {
return thirdAppSecret;
}
public void setThirdAppSecret(String thirdAppSecret) {
this.thirdAppSecret = thirdAppSecret;
}
public String getThirdPostUrl() {
return thirdPostUrl;
}
public void setThirdPostUrl(String thirdPostUrl) {
this.thirdPostUrl = thirdPostUrl;
}
}

@ -132,7 +132,7 @@ public class QianZhuConfig {
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost("https://live.qianzhu8.com/gateway", JSON.toJSONString(map));
}
@ -153,7 +153,7 @@ public class QianZhuConfig {
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map));
}
@ -174,7 +174,7 @@ public class QianZhuConfig {
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map));
}
@ -309,7 +309,7 @@ public class QianZhuConfig {
* @Param [java.lang.String, java.lang.String, java.lang.String, java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject starbucksOrders( Long platformUniqueId ,String storeCode , String orderItems , String customerMobile) throws Exception {
public static JSONObject starbucksOrders( String platformUniqueId ,String storeCode , String orderItems , String customerMobile) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("storeCode", storeCode);
@ -319,11 +319,12 @@ public class QianZhuConfig {
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("action", "starbucksOrders.createOrderV2");
map.put("traceId", WxUtils.makeNonStr());
map.put("version", "1.0");
map.put("content", JSON.toJSONString(contentMap));
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url()+"/openApi/v1/kfcMenus/listByStoreCode", JSONObject.toJSONString(map));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSONObject.toJSONString(map));
}
/**
@ -344,7 +345,7 @@ public class QianZhuConfig {
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSON.toJSONString(map));
}
@ -356,15 +357,16 @@ public class QianZhuConfig {
* @Param [java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject createKfcOrder(Integer eatType , String storeCode , String mobile , String items , String platformUniqueId , String userRemark) throws Exception {
public static JSONObject createKfcOrder(Integer eatType , String storeCode , String mobile , String items , String platformUniqueId) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("eatType", eatType);
map.put("storeCode", storeCode);
map.put("mobile", mobile);
map.put("userRemark", "");
map.put("subPlatformId", "");
map.put("items", items);
map.put("platformUniqueId", platformUniqueId);
map.put("userRemark", userRemark);
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v4/orders/createKfcOrder", JSONObject.toJSONString(map));
@ -388,18 +390,94 @@ public class QianZhuConfig {
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSON.toJSONString(map));
}
public static JSONObject getKfcOrderByOrderNo(Integer eatType , String storeCode , String mobile , String items , String platformUniqueId , String userRemark) throws Exception {
/**
* @Author Sum1Dream
* @name getTokenV2.java
* @Description // 联合登录
* @Date 15:07 2022/7/7
* @Param [java.lang.String, java.lang.String, java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getTokenV2(String platformUniqueId , String nickname , String mobile) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("platformUniqueId", platformUniqueId);
contentMap.put("nickname", nickname);
contentMap.put("mobile", mobile);
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("items", items);
map.put("action", "users.getTokenV2");
map.put("version", "1.0");
map.put("content", JSON.toJSONString(contentMap));
map.put("traceId", WxUtils.makeNonStr());
map.put("timestamp", new Date().getTime());
map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v4/orders/createKfcOrder", JSONObject.toJSONString(map));
map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost("https://live-test.qianzhu8.com/gateway", JSON.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name insertV2.java
* @Description // 第三方充值下单
* @Date 17:38 2022/7/8
* @Param [java.lang.String, java.lang.Integer, java.lang.String, java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject insertV2(String productCode , String orderNo , String chargeAccount) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("AppKey", CommonSysConst.getSysConfig().getThirdAppKey());
map.put("TimesTamp", new Date().getTime());
map.put("ProductCode", productCode);
map.put("BuyCount", 1);
map.put("MOrderID", orderNo);
map.put("ChargeAccount", chargeAccount);
map.put("CustomerIP", "127.0.0.1");
map.put("sign", MD5Util.encode(generateSignatureByThird(map,CommonSysConst.getSysConfig().getThirdAppSecret()).getBytes()));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getThirdPostUrl() + "Order/InsertV2", JSON.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name QueryV2.java
* @Description // 查询第三方订单详情
* @Date 17:37 2022/7/8
* @Param [java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject QueryV2(String orderNo) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("AppKey", CommonSysConst.getSysConfig().getThirdAppKey());
map.put("TimesTamp", new Date().getTime());
map.put("MOrderID", orderNo);
map.put("OrderID", "");
String sb = CommonSysConst.getSysConfig().getThirdAppKey() + new Date().getTime() + orderNo + CommonSysConst.getSysConfig().getThirdAppSecret();
map.put("sign", MD5Util.encode(sb.getBytes()));
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getThirdPostUrl() + "Order/QueryV2", map);
}
/**
* 生成签名
* @param data 数据
* @param key 秘钥app_secret
* @return 加密结果
*/
public static String generateSignatureByThird(final Map<String, Object> data, String key){
Set<String> keySet = data.keySet();
String[] keyArray = keySet.toArray(new String[keySet.size()]);
Arrays.sort(keyArray);
StringBuilder sb = new StringBuilder();
for (String k : keyArray) {
if (k.equals(WXPayConstants.FIELD_SIGN)) {
continue;
}
sb.append(data.get(k));
}
sb.append(key);
return sb.toString();
}
}

@ -71,6 +71,7 @@ public class ThirdProductConfig {
listMap.put("platformId", platformId);
object.put("integralDiscount" , bsConfigService.getProductDiscountByMap(listMap).getDiscount());
object.put("priceDiscount" , productConfig.getDiscount());
object.put("productPayType" , bsConfigService.getProductPayTypeByMap(listMap));
object.put("productPlatform" , bsConfigService.getProductPlatformByMap(listMap));

@ -42,6 +42,51 @@ public interface HighOrderMapperExt {
})
List<HighOrder> getCloseOrder();
@Select({"select distinct * from high_order a left join high_child_order b on a.id = b.order_id where order_status in (1,2) and goods_type in (4,9) group by a.id;"})
@Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
@Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_discount_id", property="memDiscountId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_discount_name", property="memDiscountName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_id", property="memId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_name", property="memName", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_phone", property="memPhone", jdbcType=JdbcType.VARCHAR),
@Result(column="mem_card_id", property="memCardId", jdbcType=JdbcType.BIGINT),
@Result(column="mem_card_type", property="memCardType", jdbcType=JdbcType.INTEGER),
@Result(column="mem_card_no", property="memCardNo", jdbcType=JdbcType.VARCHAR),
@Result(column="pay_model", property="payModel", jdbcType=JdbcType.INTEGER),
@Result(column="pay_type", property="payType", jdbcType=JdbcType.INTEGER),
@Result(column="pay_gold", property="payGold", jdbcType=JdbcType.INTEGER),
@Result(column="pay_price", property="payPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_real_price", property="payRealPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="pay_serial_no", property="paySerialNo", jdbcType=JdbcType.VARCHAR),
@Result(column="deduction_price", property="deductionPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="order_status", property="orderStatus", jdbcType=JdbcType.INTEGER),
@Result(column="total_price", property="totalPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="pay_time", property="payTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_time", property="cancelTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="cancel_remarks", property="cancelRemarks", jdbcType=JdbcType.VARCHAR),
@Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="remarks", property="remarks", jdbcType=JdbcType.VARCHAR),
@Result(column="refund_time", property="refundTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="refund_price", property="refundPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="refund_content", property="refundContent", jdbcType=JdbcType.VARCHAR),
@Result(column="refusal_refund_content", property="refusalRefundContent", jdbcType=JdbcType.VARCHAR),
@Result(column="Identification_code", property="identificationCode", jdbcType=JdbcType.BIGINT),
@Result(column="profit_sharing_status", property="profitSharingStatus", jdbcType=JdbcType.BIT),
@Result(column="profit_sharing_ratio", property="profitSharingRatio", jdbcType=JdbcType.DECIMAL),
@Result(column="account_merchant_num", property="accountMerchantNum", jdbcType=JdbcType.VARCHAR),
@Result(column="print_status", property="printStatus", jdbcType=JdbcType.BIT),
@Result(column="print_num", property="printNum", jdbcType=JdbcType.INTEGER),
@Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
})
List<HighOrder> getThirdOrder();
@Select({
"<script>",
"select",

@ -3,6 +3,7 @@ package com.hai.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* high_order
@ -212,6 +213,37 @@ public class HighOrder implements Serializable {
private String ext3;
private List<HighChildOrder> highChildOrderList;
private HighDiscount highDiscount;
private Boolean isTyAgent;
public List<HighChildOrder> getHighChildOrderList() {
return highChildOrderList;
}
public void setHighChildOrderList(List<HighChildOrder> highChildOrderList) {
this.highChildOrderList = highChildOrderList;
}
public HighDiscount getHighDiscount() {
return highDiscount;
}
public void setHighDiscount(HighDiscount highDiscount) {
this.highDiscount = highDiscount;
}
public Boolean getIsTyAgent() {
return isTyAgent;
}
public void setIsTyAgent(Boolean tyAgent) {
isTyAgent = tyAgent;
}
private static final long serialVersionUID = 1L;
public Long getId() {
@ -707,4 +739,4 @@ public class HighOrder implements Serializable {
sb.append("]");
return sb.toString();
}
}
}

@ -0,0 +1,49 @@
package com.hai.enum_type;
import java.util.Objects;
/**
* @serviceName ApiProductTypeEnum.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 产品类型
* @createTime 17:06 2022/7/8
**/
public enum ApiProductTypeEnum {
type1(1, "星巴克"),
type2(2, "肯德基"),
type3(3, "第三方产品")
;
private Integer type;
private String name;
ApiProductTypeEnum(int type, String name) {
this.type = type;
this.name = name;
}
public static String getNameByType(Integer type) {
for (ApiProductTypeEnum ele : values()) {
if(Objects.equals(type,ele.getType())) return ele.getName();
}
return null;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,77 @@
package com.hai.model;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighOrder;
import java.util.List;
import java.util.Map;
public class ThirdPartyModel extends HighOrder {
// 取餐码
private String code;
// 第三方订单状态
private Integer thirdOrderStatus;
// 就餐方式
private Integer eatType;
// 下单手机备注
private String kfcOrderMobileRemark;
// 取餐码
private List<Map<String, Object>> list;
// 第三方内容
private JSONObject object;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Integer getThirdOrderStatus() {
return thirdOrderStatus;
}
public void setThirdOrderStatus(Integer thirdOrderStatus) {
this.thirdOrderStatus = thirdOrderStatus;
}
public Integer getEatType() {
return eatType;
}
public void setEatType(Integer eatType) {
this.eatType = eatType;
}
public String getKfcOrderMobileRemark() {
return kfcOrderMobileRemark;
}
public void setKfcOrderMobileRemark(String kfcOrderMobileRemark) {
this.kfcOrderMobileRemark = kfcOrderMobileRemark;
}
public List<Map<String, Object>> getList() {
return list;
}
public void setList(List<Map<String, Object>> list) {
this.list = list;
}
public JSONObject getObject() {
return object;
}
public void setObject(JSONObject object) {
this.object = object;
}
}

@ -0,0 +1,57 @@
package com.hai.service;
import com.hai.entity.ApiMemberProduct;
import java.util.List;
import java.util.Map;
/**
* @serviceName ApiMemberProductService.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 会员产品接口
* @createTime 16:12 2022/7/11
**/
public interface ApiMemberProductService {
/**
* @Author Sum1Dream
* @name insertApiMemberProduct.java
* @Description // 新增会员产品
* @Date 14:55 2022/6/7
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void insertApiMemberProduct(ApiMemberProduct ApiMemberProduct);
/**
* @Author Sum1Dream
* @name updateApiMemberProduct.java
* @Description // 修改会员产品
* @Date 14:56 2022/6/7
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void updateApiMemberProduct(ApiMemberProduct ApiMemberProduct);
/**
* @Author Sum1Dream
* @name getListApiMemberProduct.java
* @Description // 查询会员产品
* @Date 14:57 2022/6/7
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.ApiMemberProduct>
*/
List<ApiMemberProduct> getListApiMemberProduct(Map<String, Object> map);
/**
* @Author Sum1Dream
* @name findById.java
* @Description // 根据id 查询会员产品
* @Date 15:24 2022/6/7
* @Param [java.lang.Long]
* @return com.hai.entity.ApiMemberProduct
*/
ApiMemberProduct findById(Long id);
}

@ -3,6 +3,8 @@ package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUserCard;
import com.hai.entity.OutRechargeOrder;
import com.hai.model.*;
import org.apache.ibatis.annotations.Param;
@ -443,5 +445,45 @@ public interface HighOrderService {
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
JSONObject insertThirdProduct(JSONObject object) throws Exception;
HighOrder insertThirdProduct(JSONObject object) throws Exception;
/**
* @Author Sum1Dream
* @name hltUnionCardPay.java
* @Description // 汇联通支付
* @Date 17:21 2022/5/25
* @Param [java.lang.Long, com.hai.entity.OutRechargeOrder]
* @return void
*/
void hltUnionCardPayByThirdProduct(HighUserCard userCard, Long orderId) throws Exception;
/**
* @Author Sum1Dream
* @name getThirdOrder.java
* @Description // 查询第三方为支付已支付订单
* @Date 11:26 2022/7/8
* @Param []
* @return java.util.List<com.hai.entity.HighOrder>
*/
List<HighOrder> getThirdOrder();
/**
* @Author Sum1Dream
* @name orderToRefund.java
* @Description // 第三方订单退款
* @Date 4:44 下午 2022/1/24
* @Param [java.lang.Long]
* @return void
*/
void thirdOrderToRefund(Long orderId) throws Exception;
/**
* @Author Sum1Dream
* @Description //取消订单 Administrator
* @Date 18:37 2021/6/12
* @Param [orderId]
* @return void
**/
void thirdCancelOrder(Long orderId);
}

@ -0,0 +1,52 @@
package com.hai.service.impl;
import com.hai.dao.ApiMemberProductMapper;
import com.hai.entity.ApiMemberProduct;
import com.hai.entity.ApiMemberProductExample;
import com.hai.service.ApiMemberProductService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("apiMemberProductService")
public class ApiMemberProductServiceImpl implements ApiMemberProductService {
@Resource
private ApiMemberProductMapper apiMemberProductMapper;
@Override
public void insertApiMemberProduct(ApiMemberProduct apiMemberProduct) {
apiMemberProductMapper.insert(apiMemberProduct);
}
@Override
public void updateApiMemberProduct(ApiMemberProduct apiMemberProduct) {
apiMemberProductMapper.updateByPrimaryKeySelective(apiMemberProduct);
}
@Override
public List<ApiMemberProduct> getListApiMemberProduct(Map<String, Object> map) {
ApiMemberProductExample example = new ApiMemberProductExample();
ApiMemberProductExample.Criteria criteria = example.createCriteria();
if (MapUtils.getInteger(map , "typeId") != null) {
criteria.andTypeIdEqualTo(MapUtils.getInteger(map , "typeId"));
}
if (MapUtils.getInteger(map , "brandId") != null) {
criteria.andBrandIdEqualTo(MapUtils.getInteger(map , "brandId"));
}
if (MapUtils.getString(map , "name") != null) {
criteria.andNameLike("%" + MapUtils.getString(map , "name") + "%");
}
example.setOrderByClause("brand_id ASC , sort ASC");
return apiMemberProductMapper.selectByExample(example);
}
@Override
public ApiMemberProduct findById(Long id) {
return apiMemberProductMapper.selectByPrimaryKey(id);
}
}

@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.hai.common.security.UserCenter;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.ApiProductTypeEnum;
import com.hai.model.BsProductConfigModel;
import com.hai.model.UserInfoModel;
import com.hai.service.ApiProductService;
@ -205,45 +206,38 @@ public class ApiProductServiceImpl implements ApiProductService {
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void ProductConfig(JSONObject object) {
// 转换产品数组
JSONArray productArray = object.getJSONArray("productIds");
// 产品配置
BsProductConfig productConfig;
for (Object product : productArray) {
ApiStarbucksProducts starbucksProducts = findStarbucksProducts(Long.valueOf(product.toString()));
productConfig = new BsProductConfig();
productConfig.setProductId(Long.valueOf(product.toString()));
productConfig.setCompanyId(object.getLong("companyId"));
productConfig.setCreateTime(new Date());
productConfig.setDiscount(object.getBigDecimal("discount"));
productConfig.setStatus(101);
productConfig.setOperatorId(object.getLong("operatorId"));
productConfig.setOperatorName(object.getString("operatorName"));
productConfig.setUpdateTime(new Date());
productConfig.setProductName(starbucksProducts.getName());
productConfig.setProductType(object.getInteger("productType"));
productConfigMapper.insert(productConfig);
JSONObject postObject = new JSONObject();
postObject.put("payType", object.getJSONArray("payType"));
postObject.put("integralDiscount", object.getBigDecimal("integralDiscount"));
postObject.put("productPlatform", object.getJSONArray("productPlatform"));
postObject.put("operatorId", object.getLong("operatorId"));
postObject.put("operatorName", object.getString("operatorName"));
postObject.put("sourceId", productConfig.getId());
postObject.put("productType", 5);
// 配置支付方式
commonService.configPayType(postObject);
// 配置积分折扣比例
commonService.configIntegralDiscount(postObject);
// 配置展示平台
commonService.configPlatform(postObject);
}
productConfig = new BsProductConfig();
productConfig.setProductId(object.getLong("productType"));
productConfig.setCompanyId(object.getLong("companyId"));
productConfig.setCreateTime(new Date());
productConfig.setDiscount(object.getBigDecimal("discount"));
productConfig.setStatus(101);
productConfig.setOperatorId(object.getLong("operatorId"));
productConfig.setOperatorName(object.getString("operatorName"));
productConfig.setUpdateTime(new Date());
productConfig.setProductName(ApiProductTypeEnum.getNameByType(object.getInteger("productType")));
productConfig.setProductType(object.getInteger("productType"));
productConfigMapper.insert(productConfig);
JSONObject postObject = new JSONObject();
postObject.put("payType", object.getJSONArray("payType"));
postObject.put("integralDiscount", object.getBigDecimal("integralDiscount"));
postObject.put("productPlatform", object.getJSONArray("productPlatform"));
postObject.put("operatorId", object.getLong("operatorId"));
postObject.put("operatorName", object.getString("operatorName"));
postObject.put("sourceId", productConfig.getId());
postObject.put("productType", 5);
// 配置支付方式
commonService.configPayType(postObject);
// 配置积分折扣比例
commonService.configIntegralDiscount(postObject);
// 配置展示平台
commonService.configPlatform(postObject);
}
@Override
@ -251,8 +245,7 @@ public class ApiProductServiceImpl implements ApiProductService {
public void updateProductConfig(JSONObject object) {
BsProductConfig productConfig = productConfigMapper.selectByPrimaryKey(object.getLong("id"));
ApiStarbucksProducts starbucksProducts = findStarbucksProducts(productConfig.getProductId());
productConfig.setProductId(starbucksProducts.getId());
productConfig.setProductId(object.getLong("productType"));
productConfig.setCompanyId(object.getLong("companyId"));
productConfig.setDiscount(object.getBigDecimal("discount"));
productConfig.setStatus(101);
@ -260,7 +253,7 @@ public class ApiProductServiceImpl implements ApiProductService {
productConfig.setOperatorName(object.getString("operatorName"));
productConfig.setUpdateTime(new Date());
productConfig.setProductName(starbucksProducts.getName());
productConfig.setProductName(ApiProductTypeEnum.getNameByType(object.getInteger("productType")));
productConfig.setProductType(object.getInteger("productType"));
productConfigMapper.updateByPrimaryKey(productConfig);

@ -33,6 +33,9 @@ public class HighGoodsTypeServiceImpl implements HighGoodsTypeService {
if (MapUtils.getString(map, "title") != null) {
criteria.andTitleLike("%" + MapUtils.getString(map, "title") + "%");
}
if (MapUtils.getString(map, "userService") != null) {
criteria.andUserServiceEqualTo(MapUtils.getString(map, "userService"));
}
criteria.andStatusEqualTo(1);

@ -596,7 +596,6 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
public void rechargeOrderToRefund(Long orderId) throws Exception {
OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId);
System.out.println("发起退款------------------------------------------------------------------------------" + orderId);
// 101.待支付 102.已支付 100.已完成 104.已取消 105.已退款
if (order.getPayStatus() != 102) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态");

@ -0,0 +1,61 @@
package com.hai.service.pay.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.config.QianZhuConfig;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighOrder;
import com.hai.enum_type.OrderPushType;
import com.hai.service.HighOrderService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
@Service("starbucksOrderService")
public class StarbucksOrderServiceImpl implements PayService {
@Resource
private HighOrderService highOrderService;
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {
return;
}
if (payType.equals("WechatPay")) {
HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no"));
if (order != null && order.getOrderStatus() == 1) {
order.setPaySerialNo(map.get("transaction_id")); // 支付流水号
order.setPayRealPrice(new BigDecimal(map.get("total_fee")).divide(new BigDecimal("100"))); // 实付金额
order.setPayTime(new Date()); // 支付时间
order.setPayModel(2); // 支付模式:1 金币,2 第三方平台,3 混合
order.setPayType(2); // 支付方式: 1:支付宝 2:微信 3:金币
order.setOrderStatus(2); // 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
highOrderService.updateOrder(order);
// 支付给千猪
JSONObject object = QianZhuConfig.starbucksOrdersPay(order.getOrderNo());
// 推送订单记录
HighGasOrderPush highGasOrderPush = new HighGasOrderPush();
highGasOrderPush.setType(OrderPushType.type3.getType());
highGasOrderPush.setOrderNo(order.getOrderNo());
highGasOrderPush.setCreateTime(new Date());
highGasOrderPush.setRequestContent(order.getOrderNo());
highGasOrderPush.setReturnContent(object.toJSONString());
highGasOrderPushMapper.insert(highGasOrderPush);
}
}
}
}

@ -18,7 +18,11 @@ qinzhuHtmlUrl=https://m-test.qianzhu8.com
qianzhuH5url=https://nf-test.qianzhu8.com/gateway
qinzhuPlatformId=10376
qinzhuSecret=ktxb49sh2jfhgn8g
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify
qianzhuOrderNotify=https://hsgcs.dctpay.com/crest/qianzhu/orderNotify
thirdAppKey=211394653
thirdAppSecret=cyQpQKMaGUG186iEZRt1uQ==
thirdPostUrl=http://mbsmemberwebapi.test.onfishes.com/
# ???????
huiliantongUrl=https://gzapitest.deepermobile.com.cn:441

@ -17,6 +17,12 @@ qinzhuPlatformId=10458
qinzhuSecret=nnl3gg4ss0pka11t
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify
thirdAppKey=211394653
thirdAppSecret=cyQpQKMaGUG186iEZRt1uQ==
thirdPostUrl=http://mbsmemberwebapi.test.onfishes.com/
huiliantongUrl=https://gzapi.deepermobile.com.cn
huiliantongAppNo=guizhouhuilt
huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D

@ -17,6 +17,10 @@ qinzhuPlatformId=10458
qinzhuSecret=nnl3gg4ss0pka11t
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify
thirdAppKey=211394653
thirdAppSecret=cyQpQKMaGUG186iEZRt1uQ==
thirdPostUrl=http://mbsmemberwebapi.test.onfishes.com/
huiliantongUrl=https://gzapi.deepermobile.com.cn
huiliantongAppNo=guizhouhuilt
huiliantongAppkey=e0ja2Ex%2BmQ2hIPF6x%2BHA%3D

Loading…
Cancel
Save