袁野 2 years ago
commit 40da39a651
  1. 15
      hai-bweb/src/main/java/com/bweb/controller/ApiProductController.java
  2. 225
      hai-bweb/src/main/java/com/bweb/controller/BsProductConfigController.java
  3. 2
      hai-bweb/src/main/java/com/bweb/controller/HighTestController.java
  4. 9
      hai-cweb/src/main/java/com/cweb/config/SysConfig.java
  5. 281
      hai-cweb/src/main/java/com/cweb/controller/HighThirdPartyController.java
  6. 1
      hai-cweb/src/main/resources/dev/config.properties
  7. 1
      hai-cweb/src/main/resources/prod-9401/config.properties
  8. 1
      hai-cweb/src/main/resources/prod/config.properties
  9. 1
      hai-schedule/src/main/java/com/hai/schedule/HighOrderSchedule.java
  10. 1
      hai-service/src/main/java/com/hai/common/exception/ErrorCode.java
  11. 10
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  12. 168
      hai-service/src/main/java/com/hai/config/QianZhuConfig.java
  13. 25
      hai-service/src/main/java/com/hai/dao/ApiProductConfigMapperExt.java
  14. 13
      hai-service/src/main/java/com/hai/dao/ApiStarbucksProductsMapperExt.java
  15. 2
      hai-service/src/main/java/com/hai/entity/BsProductPayType.java
  16. 48
      hai-service/src/main/java/com/hai/enum_type/ProductImgEnum.java
  17. 11
      hai-service/src/main/java/com/hai/model/ApiProductConfigModel.java
  18. 41
      hai-service/src/main/java/com/hai/model/ApiStarbucksProductsModel.java
  19. 63
      hai-service/src/main/java/com/hai/model/BsProductConfigModel.java
  20. 11
      hai-service/src/main/java/com/hai/service/ApiOpenService.java
  21. 161
      hai-service/src/main/java/com/hai/service/ApiProductService.java
  22. 11
      hai-service/src/main/java/com/hai/service/HighOrderService.java
  23. 14
      hai-service/src/main/java/com/hai/service/impl/ApiOpenServiceImpl.java
  24. 256
      hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java
  25. 6
      hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java
  26. 19
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  27. 2
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  28. 3
      hai-service/src/main/java/com/hai/service/impl/OutRechargePriceServiceImpl.java
  29. 1
      hai-service/src/main/resources/dev/commonConfig.properties
  30. 1
      hai-service/src/main/resources/prod-9401/commonConfig.properties
  31. 1
      hai-service/src/main/resources/prod/commonConfig.properties
  32. 1
      v1/src/main/java/com/v1/config/AuthConfig.java
  33. 2
      v1/src/main/java/com/v1/controller/RechargeProductController.java
  34. 239
      v1/src/main/java/com/v1/controller/ThirdPartyController.java
  35. 14
      v1/src/main/resources/dev/application.yml
  36. 14
      v1/src/main/resources/pre/application.yml
  37. 14
      v1/src/main/resources/prod/application.yml

@ -334,4 +334,19 @@ public class ApiProductController {
} }
} }
@RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询星巴克产品")
public ResponseData getStarbucksProducts() {
try {
return ResponseMsgUtil.success(apiProductService.getStarbucksProducts(new HashMap<>()));
} catch (Exception e) {
log.error("ApiMerchantsController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -0,0 +1,225 @@
package com.bweb.controller;
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.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.PageUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.ApiProduct;
import com.hai.entity.ApiStarbucksProducts;
import com.hai.entity.BsProductConfig;
import com.hai.entity.OutRechargePrice;
import com.hai.model.BsProductConfigModel;
import com.hai.model.OutRechargePriceModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.ApiProductService;
import com.hai.service.BsConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping(value = "/bsProductConfig")
@Api(value = "api产品")
public class BsProductConfigController {
Logger log = LoggerFactory.getLogger(BsProductConfigController.class);
@Resource
private ApiProductService apiProductService;
@Resource
private BsConfigService bsConfigService;
@Autowired
private UserCenter userCenter;
@RequestMapping(value = "/getProductConfig", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询配置产品")
public ResponseData getProductConfig(@RequestParam(value = "productName", required = false) String productName,
@RequestParam(value = "productType", required = false) Integer productType,
@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("companyId", String.valueOf(userInfoModel.getBsCompany().getId()));
map.put("productName", productName);
map.put("productType", productType);
List<BsProductConfig> productConfigs = apiProductService.getProductConfig(map);
Map<String, Object> listMap;
List<BsProductConfigModel> productConfigModels = new ArrayList<>();
for (BsProductConfig list : productConfigs) {
BsProductConfigModel bsProductConfigModel = new BsProductConfigModel();
listMap = new HashMap<>();
listMap.put("returnType", 2);
listMap.put("productType", "5");
listMap.put("sourceId", list.getId());
BeanUtils.copyProperties(list, bsProductConfigModel);
bsProductConfigModel.setIntegralDiscount(bsConfigService.getProductDiscountByMap(listMap).getDiscount());
bsProductConfigModel.setProductPayTypeString(bsConfigService.getProductPayTypeByMap(listMap));
bsProductConfigModel.setProductPlatformString(bsConfigService.getProductPlatformByMap(listMap));
productConfigModels.add(bsProductConfigModel);
}
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum,productConfigModels.size(),pageSize,new PageInfo<>(productConfigModels)));
} catch (Exception e) {
log.error("OutRechargePriceController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/productConfig", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增产品配置")
public ResponseData productConfig(@RequestBody JSONObject object, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (object == null ||
object.getJSONArray("productIds") == null ||
object.getBigDecimal("discount") == null ||
object.getInteger("productType") == null ||
object.getJSONArray("productPlatform") == null ||
object.getJSONArray("payType") == null
) {
log.error("OutRechargePriceController -> productConfig() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
object.put("operatorId", userInfoModel.getSecUser().getId());
object.put("operatorName", userInfoModel.getSecUser().getLoginName());
object.put("companyId", userInfoModel.getBsCompany().getId());
apiProductService.ProductConfig(object);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("OutRechargePriceController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/updateProductConfig", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "编辑产品配置")
public ResponseData updateProductConfig(@RequestBody JSONObject object, HttpServletRequest request) {
try {
SessionObject sessionObject = userCenter.getSessionObject(request);
UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject();
if (object == null ||
object.getLong("id") == null ||
object.getJSONArray("productIds") == null ||
object.getBigDecimal("discount") == null ||
object.getInteger("productType") == null ||
object.getJSONArray("productPlatform") == null ||
object.getJSONArray("payType") == null
) {
log.error("OutRechargePriceController -> productConfig() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
object.put("operatorId", userInfoModel.getSecUser().getId());
object.put("operatorName", userInfoModel.getSecUser().getLoginName());
object.put("companyId", userInfoModel.getBsCompany().getId());
apiProductService.updateProductConfig(object);
return ResponseMsgUtil.success("新增成功");
} catch (Exception e) {
log.error("OutRechargePriceController --> insertPrice() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findProductConfig", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情")
public ResponseData findProductConfig(@RequestParam(value = "id", required = true) Long id) {
try {
BsProductConfig bsProductConfig = apiProductService.findProductConfig(id);
BsProductConfigModel bsProductConfigModel = new BsProductConfigModel();
BeanUtils.copyProperties(bsProductConfig, bsProductConfigModel);
Map<String, Object> listMap = new HashMap<>();
listMap.put("productType", "5");
listMap.put("returnType", 1);
listMap.put("sourceId", bsProductConfig.getId());
listMap.put("platformId", null);
bsProductConfigModel.setIntegralDiscount(bsConfigService.getProductDiscountByMap(listMap).getDiscount());
bsProductConfigModel.setProductPayTypeString(bsConfigService.getProductPayTypeByMap(listMap));
bsProductConfigModel.setProductPlatformString(bsConfigService.getProductPlatformByMap(listMap));
return ResponseMsgUtil.success(bsProductConfigModel);
} catch (Exception e) {
log.error("OutRechargePriceController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findStarbucksProducts", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情产品详情")
public ResponseData findStarbucksProducts(@RequestParam(value = "id", required = true) Long id) {
try {
BsProductConfig bsProductConfig = apiProductService.findProductConfig(id);
ApiStarbucksProducts apiStarbucksProducts = apiProductService.findStarbucksProducts(bsProductConfig.getProductId());
apiStarbucksProducts.setSalesVentiPrice(apiStarbucksProducts.getMarketVentiPrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100)));
apiStarbucksProducts.setSalesTallPrice(apiStarbucksProducts.getMarketTallPrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100)));
apiStarbucksProducts.setSalesGrandePrice(apiStarbucksProducts.getMarketGrandePrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100)));
return ResponseMsgUtil.success(apiStarbucksProducts);
} catch (Exception e) {
log.error("OutRechargePriceController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

File diff suppressed because one or more lines are too long

@ -25,6 +25,7 @@ public class SysConfig {
private String wxUnifiedOrderUrl; private String wxUnifiedOrderUrl;
private String couponCodePath; private String couponCodePath;
private String notifyUrl; private String notifyUrl;
private String imgUrl;
private String qzNotifyUrl; private String qzNotifyUrl;
private String wxGzSubAppId; private String wxGzSubAppId;
@ -168,4 +169,12 @@ public class SysConfig {
public void setWxGzSubMchId(String wxGzSubMchId) { public void setWxGzSubMchId(String wxGzSubMchId) {
this.wxGzSubMchId = wxGzSubMchId; this.wxGzSubMchId = wxGzSubMchId;
} }
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
} }

@ -0,0 +1,281 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConfig;
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.security.SessionObject;
import com.hai.common.security.UserCenter;
import com.hai.common.utils.CoordCommonUtil;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig;
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.service.ApiProductService;
import com.hai.service.BsConfigService;
import com.hai.service.HighOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.w3c.dom.ls.LSException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Controller
@RequestMapping(value = "/highThirdParty")
@Api(value = "订单接口")
public class HighThirdPartyController {
private static Logger log = LoggerFactory.getLogger(HighThirdPartyController.class);
@Resource
private ApiProductService apiProductService;
@Resource
private BsConfigService bsConfigService;
@Resource
private HighOrderService highOrderService;
@Autowired
private UserCenter userCenter;
@RequestMapping(value = "/getAllCity", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询所有城市")
public ResponseData getAllCity(@RequestParam(name = "cityName", required = false) String cityName) {
try {
return ResponseMsgUtil.success(apiProductService.getAllCity(cityName));
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询星巴克商品")
public ResponseData getStarbucksProducts(@RequestParam(name = "name", required = false) String name) {
try {
List<String> CategoryNameList = apiProductService.getCategoryName();
List<ApiStarbucksProducts> starbucksProductsList = new ArrayList<>();
int i = 9999;
for (String s : CategoryNameList) {
i++;
ApiStarbucksProducts starbucksProducts = new ApiStarbucksProducts();
Map<String, Object> map = new HashMap<>();
map.put("name" , name);
map.put("categoryName" , s);
List<ApiStarbucksProducts> list = apiProductService.getStarbucksProducts(map);
for (ApiStarbucksProducts apiStarbucksProducts : list) {
apiStarbucksProducts.setExt1(String.valueOf(i));
starbucksProductsList.add(apiStarbucksProducts);
}
starbucksProducts.setName(s);
starbucksProducts.setExt2(SysConst.getSysConfig().getImgUrl() + ProductImgEnum.getNameByImgUrl(s));
starbucksProducts.setId((long) i);
starbucksProductsList.add(starbucksProducts);
}
return ResponseMsgUtil.success(starbucksProductsList);
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getStarbucksStore", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询星巴克门店")
public ResponseData getStarbucksStore(@RequestParam(name = "lat", required = true) String lat,
@RequestParam(name = "lon", required = true) String lon) {
try {
JSONObject jsonObject = QianZhuConfig.getStarbucksStore(lat , lon);
if (jsonObject.getBoolean("success")) {
return ResponseMsgUtil.success(jsonObject.getJSONArray("data"));
} else {
log.error("getRechargeProduct error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getString("message"));
}
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/findStarbucksProducts", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "根据id查询详情产品详情")
public ResponseData findStarbucksProducts(@RequestParam(value = "id", required = true) Long id) {
try {
BsProductConfig bsProductConfig = apiProductService.findProductConfigByGoodsId(id);
if (bsProductConfig == null) {
log.error("findStarbucksProducts error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , "未查询到当前商品");
}
ApiStarbucksProducts apiStarbucksProducts = apiProductService.findStarbucksProducts(bsProductConfig.getProductId());
apiStarbucksProducts.setSalesVentiPrice(apiStarbucksProducts.getMarketVentiPrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100)));
apiStarbucksProducts.setSalesTallPrice(apiStarbucksProducts.getMarketTallPrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100)));
apiStarbucksProducts.setSalesGrandePrice(apiStarbucksProducts.getMarketGrandePrice().multiply(bsProductConfig.getDiscount()).divide(new BigDecimal(100)));
ApiStarbucksProductsModel starbucksProductsModel = new ApiStarbucksProductsModel();
BeanUtils.copyProperties(apiStarbucksProducts, starbucksProductsModel);
Map<String, Object> listMap = new HashMap<>();
listMap.put("productType", "5");
listMap.put("returnType", 1);
listMap.put("sourceId", bsProductConfig.getId());
listMap.put("platformId", null);
starbucksProductsModel.setIntegralDiscount(bsConfigService.getProductDiscountByMap(listMap).getDiscount());
starbucksProductsModel.setProductPayTypeString(bsConfigService.getProductPayTypeByMap(listMap));
starbucksProductsModel.setProductPlatformString(bsConfigService.getProductPlatformByMap(listMap));
return ResponseMsgUtil.success(starbucksProductsModel);
} catch (Exception e) {
log.error("OutRechargePriceController --> findById() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/addOrder", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "增加订单")
public ResponseData addOrder(@RequestBody JSONObject object, HttpServletRequest request) {
try {
// 用户
SessionObject sessionObject = userCenter.getSessionObject(request);
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
if (StringUtils.isBlank(object.getString("customerMobile")) ||
StringUtils.isBlank(object.getString("regionId")) ||
StringUtils.isBlank(object.getString("productType")) ||
object.getJSONArray("orderItems") == null
) {
log.error("addOrder error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
object.put("userId", userInfoModel.getHighUser().getId());
highOrderService.insertThirdProduct(object);
return ResponseMsgUtil.success("下单成功");
} catch (Exception e) {
log.error("HighOrderController -> addOrder() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getKfcStoresList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询肯德基门店")
public ResponseData getKfcStoresList(@RequestParam(name = "storeName", required = false) String storeName,
@RequestParam(name = "cityCode", required = true) String cityCode,
@RequestParam(name = "lat", required = true) String lat,
@RequestParam(name = "lon", required = true) String lon) {
try {
Map<String, Object> map = new HashMap<>();
map.put("storeName" , storeName);
map.put("cityCode" , cityCode);
List<ApiKfcStores> list = apiProductService.getKfcStoresList(map);
if (StringUtils.isNotBlank(lat)){
for (ApiKfcStores stores : list) {
double distance = CoordCommonUtil.getDistance(Double.valueOf(stores.getLat()), Double.valueOf(stores.getLon()), Double.valueOf(lat), Double.valueOf(lon));
stores.setDistance(String.valueOf(Math.round(distance/100d)/10d));
}
}
return ResponseMsgUtil.success(list.stream().sorted(Comparator.comparing(ApiKfcStores::getDistance)).collect(Collectors.toList()));
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/listByStoreCode", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询肯德基门店菜单")
public ResponseData listByStoreCode(@RequestParam(name = "storeCode", required = false) String storeCode) {
try {
JSONObject jsonObject = QianZhuConfig.listByStoreCode(storeCode);
JSONArray array = jsonObject.getJSONArray("data");
Map<String, Object> listMap = new HashMap<>();
listMap.put("productType", "2");
listMap.put("companyId", 2);
List<BsProductConfig> productConfigs = apiProductService.getProductConfig(listMap);
for (Object data : array) {
JSONObject dataObject = (JSONObject) data;
if (dataObject.getJSONArray("products") != null) {
for (Object products : dataObject.getJSONArray("products")) {
JSONObject productsObject = (JSONObject) products;
BigDecimal productsPrice = productsObject.getBigDecimal("price");
productsObject.put("salePrice" , productsPrice.add(productsPrice.multiply(productConfigs.get(0).getDiscount()).divide(new BigDecimal(100))));
if (productsObject.getJSONArray("specGroups") != null) {
for (Object specGroups : productsObject.getJSONArray("specGroups")) {
JSONObject specGroupsObject = (JSONObject) specGroups;
BigDecimal specGroupsPrice = specGroupsObject.getBigDecimal("price");
specGroupsObject.put("salePrice" , specGroupsPrice.add(specGroupsPrice.multiply(productConfigs.get(0).getDiscount()).divide(new BigDecimal(100))));
}
}
}
}
}
if (jsonObject.getBoolean("success")) {
return ResponseMsgUtil.success(array);
} else {
log.error("getRechargeProduct error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getString("message"));
}
} catch (Exception e) {
log.error("HighUserCardController --> oilCardRefund() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -18,6 +18,7 @@ wxGzSubMchId=1619676214
HDAppId = 1614670195 HDAppId = 1614670195
notifyUrl=https://hsgcs.dctpay.com/crest/wechatpay/notify notifyUrl=https://hsgcs.dctpay.com/crest/wechatpay/notify
imgUrl=https://hsgcs.dctpay.com/filesystem/
fileUrl=/home/project/hsg/filesystem fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath cmsPath=/home/project/hsg/filesystem/cmsPath

@ -16,6 +16,7 @@ wxGzSubMchId=1619676214
notifyUrl=https://hsg.dctpay.com/crest/wechatpay/notify notifyUrl=https://hsg.dctpay.com/crest/wechatpay/notify
imgUrl=https://hsg.dctpay.com/filesystem/
fileUrl=/home/project/hsg/filesystem fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath cmsPath=/home/project/hsg/filesystem/cmsPath

@ -18,6 +18,7 @@ wxGzSubMchId=1619676214
HDAppId = 1614670195 HDAppId = 1614670195
notifyUrl=https://hsg.dctpay.com/crest/wechatpay/notify notifyUrl=https://hsg.dctpay.com/crest/wechatpay/notify
imgUrl=https://hsg.dctpay.com/filesystem/
fileUrl=/home/project/hsg/filesystem fileUrl=/home/project/hsg/filesystem
cmsPath=/home/project/hsg/filesystem/cmsPath cmsPath=/home/project/hsg/filesystem/cmsPath

@ -99,7 +99,6 @@ public class HighOrderSchedule {
map.put("rechargeStatus" , String.valueOf(204)); map.put("rechargeStatus" , String.valueOf(204));
List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map); List<OutRechargeOrder> orderList = outRechargeOrderService.getListRechargeOrder(map);
System.out.println("订单数量------------------------------------------------------------------------------" + orderList.size());
if (orderList.size() > 0) { if (orderList.size() > 0) {
for (OutRechargeOrder order : orderList) { for (OutRechargeOrder order : orderList) {
try { try {

@ -135,6 +135,7 @@ public enum ErrorCode {
ORDER_ALREADY_EXISTS("6007","订单已存在"), ORDER_ALREADY_EXISTS("6007","订单已存在"),
IP_ERROR("6008","IP不在白名单"), IP_ERROR("6008","IP不在白名单"),
PRODUCT_ERROR("6009","商品错误"), PRODUCT_ERROR("6009","商品错误"),
MERCHANT_NOT_AUTHORIZED("6010","商户无权限"),
MSG_EVENT_NULL("2999","消息类型为空"), MSG_EVENT_NULL("2999","消息类型为空"),
USE_VISIT_ILLEGAL("4001","用户身份错误"), USE_VISIT_ILLEGAL("4001","用户身份错误"),

@ -26,6 +26,7 @@ public class CommonSysConfig {
private String qinzhuUrl; private String qinzhuUrl;
private String qinzhuHtmlUrl; private String qinzhuHtmlUrl;
private String qianzhuH5url;
private String qinzhuMobileUrl; // 话费充值地址 private String qinzhuMobileUrl; // 话费充值地址
private String qinzhuPlatformId; private String qinzhuPlatformId;
private String qinzhuSecret; private String qinzhuSecret;
@ -176,6 +177,15 @@ public class CommonSysConfig {
this.tuanYouGasolineAccount = tuanYouGasolineAccount; this.tuanYouGasolineAccount = tuanYouGasolineAccount;
} }
public String getQianzhuH5url() {
return qianzhuH5url;
}
public void setQianzhuH5url(String qianzhuH5url) {
this.qianzhuH5url = qianzhuH5url;
}
public String getQinzhuUrl() { public String getQinzhuUrl() {
return qinzhuUrl; return qinzhuUrl;
} }

@ -9,6 +9,7 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -177,6 +178,71 @@ public class QianZhuConfig {
return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map)); return HttpsUtils.doPost("https://nf.qianzhu8.com/gateway", JSON.toJSONString(map));
} }
/**
* @Author Sum1Dream
* @name getAllCities.java
* @Description // 查询所有城市
* @Date 15:45 2022/6/28
* @Param []
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getAllCities() throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
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/v2/cities/listAll", JSONObject.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name getStarbucksStore.java
* @Description // 查询星巴克门店
* @Date 15:45 2022/6/28
* @Param []
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getStarbucksStore(String lat , String lon) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("lon", lon);
contentMap.put("lat", lat);
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("timestamp", new Date().getTime());
map.put("action", "starbucksStores.listByLonAndLat");
map.put("content", JSON.toJSONString(contentMap));
map.put("version", "1.0");
map.put("traceId", WxUtils.makeNonStr());
map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSONObject.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name getStarbucksProducts.java
* @Description // 查询星巴克商品
* @Date 11:16 2022/6/29
* @Param [java.lang.Integer, java.lang.Integer]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getStarbucksProducts(Integer pageIndex , Integer pageSize) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("pageIndex", pageIndex);
contentMap.put("pageSize", pageSize);
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("timestamp", new Date().getTime());
map.put("action", "starbucksProducts.pagedQuery");
map.put("content", JSON.toJSONString(contentMap));
map.put("version", "1.0");
map.put("traceId", WxUtils.makeNonStr());
map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSONObject.toJSONString(map));
}
/** /**
* 生成签名 * 生成签名
* @param data 数据 * @param data 数据
@ -201,4 +267,106 @@ public class QianZhuConfig {
sb.append(key); sb.append(key);
return sb.toString(); return sb.toString();
} }
/**
* @Author Sum1Dream
* @name getKfcStore.java
* @Description // 查询KFC门店
* @Date 11:16 2022/6/29
* @Param [java.lang.Integer, java.lang.Integer]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject getKfcStore() throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
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/v2/kfcStores/listAll", JSONObject.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name getKfcStore.java
* @Description // 查询KFC门店菜单
* @Date 11:16 2022/6/29
* @Param [java.lang.Integer, java.lang.Integer]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject listByStoreCode(String storeCode) throws Exception {
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("storeCode", storeCode);
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/v1/kfcMenus/listByStoreCode", JSONObject.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name starbucksOrders.java
* @Description // 星巴克下单
* @Date 17:01 2022/7/4
* @Param [java.lang.String, java.lang.String, java.lang.String, java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject starbucksOrders( String platformUniqueId ,String storeCode , String orderItems , String customerMobile) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("storeCode", storeCode);
contentMap.put("orderItems", orderItems);
contentMap.put("customerMobile", customerMobile);
contentMap.put("platformUniqueId", platformUniqueId);
Map<String,Object> map = new HashMap<>();
map.put("platformId", CommonSysConst.getSysConfig().getQinzhuPlatformId());
map.put("action", "starbucksOrders.createOrderV2");
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));
}
/**
* @Author Sum1Dream
* @name starbucksOrdersPay.java
* @Description // 星巴克支付
* @Date 17:03 2022/7/4
* @Param [java.lang.String]
* @return com.alibaba.fastjson.JSONObject
*/
public static JSONObject starbucksOrdersPay(String orderNo) throws Exception {
Map<String,Object> contentMap = new LinkedHashMap<>();
contentMap.put("orderNo", orderNo);
Map<String,Object> map = new HashMap<>();
map.put("platformId", "10458");
map.put("action", "starbucksOrders.pay");
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(generateSignature(map,"nnl3gg4ss0pka11t").getBytes()).toLowerCase());
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSON.toJSONString(map));
}
/**
* @Author Sum1Dream
* @name createKfcOrder.java
* @Description // 创建kfc订单
* @Date 17:35 2022/7/4
* @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 {
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("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));
}
} }

@ -16,31 +16,20 @@ public interface ApiProductConfigMapperExt {
@Select(value = { @Select(value = {
"<script>", "<script>",
" select ap.* , discount_price , apc.id as api_config_product_id , discount , apc.status as config_status from api_product ap join api_product_config apc on ap.id = apc.product_id where apc.status != 100", " select ap.recharge_type as rechargeType , phone_recharge_type as phoneRechargeType , operator_type as operatorType , recharge_price as rechargePrice , discount_price , apc.id as api_config_product_id , discount , apc.status as configStatus from api_product ap join api_product_config apc on ap.id = apc.product_id where apc.status != 100",
" and merchants_id = #{merchantsId} " + " and merchants_id = #{merchantsId} " +
"</script>" "</script>"
}) })
@Results({ @Results({
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="rechargeType", property="rechargeType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.INTEGER), @Result(column="phoneRechargeType", property="phoneRechargeType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_platform", property="rechargePlatform", jdbcType=JdbcType.VARCHAR), @Result(column="operatorType", property="operatorType", jdbcType=JdbcType.INTEGER),
@Result(column="phone_recharge_type", property="phoneRechargeType", jdbcType=JdbcType.INTEGER), @Result(column="rechargePrice", property="rechargePrice", jdbcType=JdbcType.DECIMAL),
@Result(column="operator_type", property="operatorType", jdbcType=JdbcType.INTEGER),
@Result(column="recharge_price", property="rechargePrice", jdbcType=JdbcType.DECIMAL),
@Result(column="product_id", property="productId", jdbcType=JdbcType.BIGINT),
@Result(column="api_config_product_id", property="apiConfigProductId", jdbcType=JdbcType.BIGINT), @Result(column="api_config_product_id", property="apiConfigProductId", jdbcType=JdbcType.BIGINT),
@Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER),
@Result(column="discount", property="discount", jdbcType=JdbcType.DECIMAL), @Result(column="discount", property="discount", jdbcType=JdbcType.DECIMAL),
@Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL), @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
@Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT), @Result(column="configStatus", property="configStatus", jdbcType=JdbcType.INTEGER),
@Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="config_status", property="configStatus", jdbcType=JdbcType.INTEGER),
@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<ApiProductConfigModel> getListMerchProduct(Long merchantsId); List<ApiProductConfigModel> getListMerchProduct(Long merchantsId);

@ -1,7 +1,20 @@
package com.hai.dao; package com.hai.dao;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/** /**
* mapper扩展类 * mapper扩展类
*/ */
public interface ApiStarbucksProductsMapperExt { public interface ApiStarbucksProductsMapperExt {
@Select(value = {
"<script>",
" select category_name from api_starbucks_products group by category_name ORDER BY create_time asc ;",
"</script>"
})
List<String> getCategoryName();
} }

@ -19,7 +19,7 @@ public class BsProductPayType implements Serializable {
private Long id; private Long id;
/** /**
* 1:卡券 2:团油 3话费 4:优惠券包 * 1:卡券 2:团油 3话费 4:优惠券包 5:星巴克
*/ */
private Integer productType; private Integer productType;

@ -0,0 +1,48 @@
package com.hai.enum_type;
import java.util.Objects;
/**
* 产品图片
* @author hurui
*/
public enum ProductImgEnum {
name0("product/茶瓦纳.png", "茶瓦纳"),
name1("product/冷萃咖啡.png", "冷萃咖啡"),
name2("product/浓缩咖啡.png", "浓缩咖啡"),
name3("product/其他.png", "其他"),
name4("product/星冰乐.png", "星冰乐"),
;
private String name;
private String imgUrl;
public static String getNameByImgUrl(String name) {
for (ProductImgEnum ele : values()) {
if(Objects.equals(name,ele.getName())) return ele.getImgUrl();
}
return null;
}
ProductImgEnum(String imgUrl, String name) {
this.imgUrl = imgUrl;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
}

@ -42,6 +42,17 @@ public class ApiProductConfigModel {
*/ */
private Long apiConfigProductId; private Long apiConfigProductId;
private Integer configStatus;
public Integer getConfigStatus() {
return configStatus;
}
public void setConfigStatus(Integer configStatus) {
this.configStatus = configStatus;
}
public Integer getRechargeType() { public Integer getRechargeType() {
return rechargeType; return rechargeType;
} }

@ -0,0 +1,41 @@
package com.hai.model;
import com.hai.entity.ApiStarbucksProducts;
import java.math.BigDecimal;
public class ApiStarbucksProductsModel extends ApiStarbucksProducts {
// 抵扣比例
private BigDecimal integralDiscount;
// 产品展示平台
private String productPlatformString;
// 产品支付方式
private String productPayTypeString;
public BigDecimal getIntegralDiscount() {
return integralDiscount;
}
public void setIntegralDiscount(BigDecimal integralDiscount) {
this.integralDiscount = integralDiscount;
}
public String getProductPlatformString() {
return productPlatformString;
}
public void setProductPlatformString(String productPlatformString) {
this.productPlatformString = productPlatformString;
}
public String getProductPayTypeString() {
return productPayTypeString;
}
public void setProductPayTypeString(String productPayTypeString) {
this.productPayTypeString = productPayTypeString;
}
}

@ -0,0 +1,63 @@
package com.hai.model;
import com.hai.entity.BsProductConfig;
import java.math.BigDecimal;
public class BsProductConfigModel extends BsProductConfig {
// 抵扣比例
private BigDecimal integralDiscount;
// 产品展示平台
private String productPlatformString;
// 产品支付方式
private String productPayTypeString;
//最低产品销售价格
private BigDecimal minProductSalePrice;
//最低产品市场价格
private BigDecimal minProductMarketPrice;
public BigDecimal getIntegralDiscount() {
return integralDiscount;
}
public void setIntegralDiscount(BigDecimal integralDiscount) {
this.integralDiscount = integralDiscount;
}
public String getProductPlatformString() {
return productPlatformString;
}
public void setProductPlatformString(String productPlatformString) {
this.productPlatformString = productPlatformString;
}
public String getProductPayTypeString() {
return productPayTypeString;
}
public void setProductPayTypeString(String productPayTypeString) {
this.productPayTypeString = productPayTypeString;
}
public BigDecimal getMinProductSalePrice() {
return minProductSalePrice;
}
public void setMinProductSalePrice(BigDecimal minProductSalePrice) {
this.minProductSalePrice = minProductSalePrice;
}
public BigDecimal getMinProductMarketPrice() {
return minProductMarketPrice;
}
public void setMinProductMarketPrice(BigDecimal minProductMarketPrice) {
this.minProductMarketPrice = minProductMarketPrice;
}
}

@ -1,6 +1,7 @@
package com.hai.service; package com.hai.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiCity;
import com.hai.entity.ApiMerchants; import com.hai.entity.ApiMerchants;
import com.hai.entity.ApiProduct; import com.hai.entity.ApiProduct;
import com.hai.entity.ApiProductConfig; import com.hai.entity.ApiProductConfig;
@ -24,14 +25,4 @@ public interface ApiOpenService {
*/ */
void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception; void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception;
/**
* @Author Sum1Dream
* @name getAllCities.java
* @Description // 获取大陆所有城市
* @Date 10:16 2022/6/27
* @Param []
* @return com.alibaba.fastjson.JSONObject
*/
JSONObject getAllCities();
} }

@ -1,10 +1,11 @@
package com.hai.service; package com.hai.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiProduct; import com.hai.entity.*;
import com.hai.entity.ApiProductConfig; import com.hai.model.BsProductConfigModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import java.util.Calendar;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -96,4 +97,160 @@ public interface ApiProductService {
* @return com.hai.entity.ApiProductConfig * @return com.hai.entity.ApiProductConfig
*/ */
ApiProductConfig findMchProduct(Map<String , Object> map); ApiProductConfig findMchProduct(Map<String , Object> map);
/**
* @Author Sum1Dream
* @name updateStarbucksProducts.java
* @Description // 更新星巴克产品
* @Date 16:38 2022/6/29
* @Param [com.hai.entity.ApiStarbucksProducts]
* @return void
*/
void updateStarbucksProducts(ApiStarbucksProducts starbucksProducts);
/**
* @Author Sum1Dream
* @name insertStarbucksProducts.java
* @Description // 插入星巴克产品
* @Date 16:38 2022/6/29
* @Param [com.hai.entity.ApiStarbucksProducts]
* @return void
*/
void insertStarbucksProducts(ApiStarbucksProducts starbucksProducts);
/**
* @Author Sum1Dream
* @name findStarbucksProductsByGoodsId.java
* @Description // 更新商品id 查询商品
* @Date 16:56 2022/6/29
* @Param [java.lang.Long]
* @return com.hai.entity.ApiStarbucksProducts
*/
ApiStarbucksProducts findStarbucksProductsByGoodsId(Long goodsId);
/**
* @Author Sum1Dream
* @name findStarbucksProducts.java
* @Description // 查询星巴克商品
* @Date 15:50 2018/6/30
* @Param [java.lang.Long]
* @return com.hai.entity.ApiStarbucksProducts
*/
ApiStarbucksProducts findStarbucksProducts(Long id);
/**
* @Author Sum1Dream
* @name findStarbucksProducts.java
* @Description // 查询星巴克商品
* @Date 15:50 2018/6/30
* @Param [java.lang.Long]
* @return com.hai.entity.ApiStarbucksProducts
*/
List<ApiStarbucksProducts> findStarbucksByCategoryName(String categoryName);
void ProductConfig(JSONObject object);
void updateProductConfig(JSONObject object);
/**
* @Author Sum1Dream
* @name getProductConfig.java
* @Description // 查询星巴克产品
* @Date 13:47 2022/6/30
* @Param []
* @return java.util.List<com.hai.entity.BsProductConfig>
*/
List<ApiStarbucksProducts> getStarbucksProducts(Map<String, Object> map);
/**
* @Author Sum1Dream
* @name getProductConfig.java
* @Description // 查询配置产品
* @Date 15:41 2022/6/30
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.model.BsProductConfigModel>
*/
List<BsProductConfigModel> getProductConfigModel(Map<String , Object> map);
/**
* @Author Sum1Dream
* @name getProductConfig.java
* @Description // 查询产品配置
* @Date 16:16 2022/6/30
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.BsProductConfig>
*/
List<BsProductConfig> getProductConfig(Map<String , Object> map);
/**
* @Author Sum1Dream
* @name findProductConfig.java
* @Description // 根据id查询配置产品
* @Date 17:28 2022/6/30
* @Param [java.lang.Long]
* @return com.hai.entity.BsProductConfig
*/
BsProductConfig findProductConfig(Long id);
BsProductConfig findProductConfigByGoodsId(Long productId);
/**
* @Author Sum1Dream
* @name getCategoryName.java
* @Description // 查询商品分类
* @Date 10:55 2022/7/1
* @Param []
* @return java.util.List<java.lang.String>
*/
List<String> getCategoryName();
/**
* @Author Sum1Dream
* @name getAllCity.java
* @Description // 查询所有城市
* @Date 10:06 2022/7/4
* @Param []
* @return
*/
List<ApiCity> getAllCity(String cityName);
/**
* @Author Sum1Dream
* @name insertKfcStore.java
* @Description // 插入kfc门店
* @Date 10:32 2022/7/4
* @Param [com.hai.entity.ApiKfcStores]
* @return void
*/
void insertKfcStore(ApiKfcStores apiKfcStores);
/**
* @Author Sum1Dream
* @name updateKfcStore.java
* @Description // 更新肯德基门店
* @Date 10:32 2022/7/4
* @Param [com.hai.entity.ApiKfcStores]
* @return void
*/
void updateKfcStore(ApiKfcStores apiKfcStores);
/**
* @Author Sum1Dream
* @name findKfcStores.java
* @Description // 查询肯德基门店
* @Date 10:33 2022/7/4
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return com.hai.entity.ApiKfcStores
*/
ApiKfcStores findKfcStores(Map<String, Object> map);
/**
* @Author Sum1Dream
* @name getKfcStoresList.java
* @Description // 查询肯德基门店列表
* @Date 10:34 2022/7/4
* @Param [java.util.Map<java.lang.String,java.lang.Object>]
* @return java.util.List<com.hai.entity.ApiKfcStores>
*/
List<ApiKfcStores> getKfcStoresList(Map<String, Object> map);
} }

@ -1,5 +1,6 @@
package com.hai.service; package com.hai.service;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.HighChildOrder; import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder; import com.hai.entity.HighOrder;
import com.hai.model.*; import com.hai.model.*;
@ -433,4 +434,14 @@ public interface HighOrderService {
* @param gasId * @param gasId
*/ */
void printGasOrder(Long gasId, HighOrder order); void printGasOrder(Long gasId, HighOrder order);
/**
* @Author Sum1Dream
* @name insertThirdProduct.java
* @Description // 第三方产品下单
* @Date 09:45 2022/7/4
* @Param [com.alibaba.fastjson.JSONObject]
* @return void
*/
void insertThirdProduct(JSONObject object);
} }

@ -8,9 +8,12 @@ import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.IDGenerator; import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.MD5Util;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig;
import com.hai.config.RechargeConfig; import com.hai.config.RechargeConfig;
import com.hai.dao.ApiAmountRecordMapper; import com.hai.dao.ApiAmountRecordMapper;
import com.hai.dao.ApiCityMapper;
import com.hai.dao.OutRechargeOrderMapper; import com.hai.dao.OutRechargeOrderMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.OperatorEnum; import com.hai.enum_type.OperatorEnum;
@ -56,6 +59,9 @@ public class ApiOpenServiceImpl implements ApiOpenService {
@Resource @Resource
private OutRechargeOrderService outRechargeOrderService; private OutRechargeOrderService outRechargeOrderService;
@Resource
private ApiCityMapper apiCityMapper;
@Override @Override
@Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW) @Transactional(rollbackFor=Exception.class,isolation = Isolation.SERIALIZABLE,propagation= Propagation.REQUIRES_NEW)
public void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception { public void createOrder(JSONObject object , ApiMerchants apiMerchants , ApiProductConfig productConfig) throws Exception {
@ -271,12 +277,4 @@ public class ApiOpenServiceImpl implements ApiOpenService {
} }
@Override
public JSONObject getAllCities() {
JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v2/cities/listAll", "");
if (object != null && !object.getBoolean("success")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQUEST_ERROR);
}
return object;
}
} }

@ -3,9 +3,9 @@ package com.hai.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.dao.ApiProductConfigMapper; import com.hai.dao.*;
import com.hai.dao.ApiProductMapper;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.model.BsProductConfigModel;
import com.hai.model.UserInfoModel; import com.hai.model.UserInfoModel;
import com.hai.service.ApiProductService; import com.hai.service.ApiProductService;
import com.hai.service.CommonService; import com.hai.service.CommonService;
@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -36,6 +37,18 @@ public class ApiProductServiceImpl implements ApiProductService {
@Resource @Resource
private ApiProductConfigMapper apiProductConfigMapper; private ApiProductConfigMapper apiProductConfigMapper;
@Resource
private ApiStarbucksProductsMapper apiStarbucksProductsMapper;
@Resource
private BsProductConfigMapper productConfigMapper;
@Resource
private ApiCityMapper apiCityMapper;
@Resource
private ApiKfcStoresMapper apiKfcStoresMapper;
@Override @Override
public void insertApiProduct(JSONObject object) { public void insertApiProduct(JSONObject object) {
// 转换金额数组 // 转换金额数组
@ -163,4 +176,243 @@ public class ApiProductServiceImpl implements ApiProductService {
} }
} }
@Override
public void updateStarbucksProducts(ApiStarbucksProducts starbucksProducts) {
apiStarbucksProductsMapper.updateByPrimaryKey(starbucksProducts);
}
@Override
public void insertStarbucksProducts(ApiStarbucksProducts starbucksProducts) {
apiStarbucksProductsMapper.insert(starbucksProducts);
}
@Override
public ApiStarbucksProducts findStarbucksProductsByGoodsId(Long goodsId) {
ApiStarbucksProductsExample example = new ApiStarbucksProductsExample();
example.createCriteria().andGoodsIdEqualTo(goodsId);
List<ApiStarbucksProducts> list = apiStarbucksProductsMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@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);
}
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void updateProductConfig(JSONObject object) {
BsProductConfig productConfig = productConfigMapper.selectByPrimaryKey(object.getLong("id"));
ApiStarbucksProducts starbucksProducts = findStarbucksProducts(productConfig.getProductId());
productConfig.setProductId(starbucksProducts.getId());
productConfig.setCompanyId(object.getLong("companyId"));
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.updateByPrimaryKey(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
public ApiStarbucksProducts findStarbucksProducts(Long id) {
return apiStarbucksProductsMapper.selectByPrimaryKey(id);
}
@Override
public List<ApiStarbucksProducts> getStarbucksProducts(Map<String, Object> map) {
ApiStarbucksProductsExample example = new ApiStarbucksProductsExample();
ApiStarbucksProductsExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "name") != null) {
criteria.andNameLike("%" + MapUtils.getString(map, "name") + "%");
}
if (MapUtils.getString(map, "categoryName") != null) {
criteria.andCategoryNameEqualTo(MapUtils.getString(map, "categoryName"));
}
return apiStarbucksProductsMapper.selectByExample(example);
}
@Override
public List<ApiStarbucksProducts> findStarbucksByCategoryName(String categoryName) {
ApiStarbucksProductsExample example = new ApiStarbucksProductsExample();
example.createCriteria().andCategoryNameEqualTo(categoryName);
return apiStarbucksProductsMapper.selectByExample(example);
}
@Override
public List<BsProductConfigModel> getProductConfigModel(Map<String, Object> map) {
return null;
}
@Override
public List<BsProductConfig> getProductConfig(Map<String, Object> map) {
BsProductConfigExample example = new BsProductConfigExample();
BsProductConfigExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId"));
}
if (MapUtils.getInteger(map, "productType") != null) {
criteria.andProductTypeEqualTo(MapUtils.getInteger(map, "productType"));
}
if (MapUtils.getString(map, "productName") != null) {
criteria.andProductNameEqualTo(MapUtils.getString(map, "productName"));
}
return productConfigMapper.selectByExample(example);
}
@Override
public BsProductConfig findProductConfig(Long id) {
return productConfigMapper.selectByPrimaryKey(id);
}
@Override
public BsProductConfig findProductConfigByGoodsId(Long productId) {
BsProductConfigExample example = new BsProductConfigExample();
example.createCriteria().andProductIdEqualTo(productId);
if (productConfigMapper.selectByExample(example).size() != 0) {
return productConfigMapper.selectByExample(example).get(0);
}
return null;
}
@Override
public List<String> getCategoryName() {
return apiStarbucksProductsMapper.getCategoryName();
}
@Override
public List<ApiCity> getAllCity(String cityName) {
ApiCityExample example = new ApiCityExample();
if (StringUtils.isNotBlank(cityName)) {
example.createCriteria().andCityNameLike("%" + cityName + "%");
}
return apiCityMapper.selectByExample(example);
}
@Override
public void insertKfcStore(ApiKfcStores apiKfcStores) {
apiKfcStoresMapper.insert(apiKfcStores);
}
@Override
public void updateKfcStore(ApiKfcStores apiKfcStores) {
apiKfcStoresMapper.updateByPrimaryKeySelective(apiKfcStores);
}
@Override
public ApiKfcStores findKfcStores(Map<String, Object> map) {
ApiKfcStoresExample example = new ApiKfcStoresExample();
ApiKfcStoresExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(MapUtils.getString(map , "storeCode"))) {
criteria.andStoreCodeEqualTo(MapUtils.getString(map , "storeCode"));
}
List<ApiKfcStores> apiKfcStores = apiKfcStoresMapper.selectByExample(example);
if (apiKfcStores.size() > 0) {
apiKfcStores.get(0);
}
return null;
}
@Override
public List<ApiKfcStores> getKfcStoresList(Map<String, Object> map) {
ApiKfcStoresExample example = new ApiKfcStoresExample();
ApiKfcStoresExample.Criteria criteria = example.createCriteria();
if (StringUtils.isNotBlank(MapUtils.getString(map , "storeName"))) {
criteria.andStoreNameLike("%" + MapUtils.getString(map , "storeName") + "%");
}
if (StringUtils.isNotBlank(MapUtils.getString(map , "storeCode"))) {
criteria.andStoreCodeEqualTo(MapUtils.getString(map , "storeCode"));
}
if (StringUtils.isNotBlank(MapUtils.getString(map , "cityCode"))) {
criteria.andCityCodeEqualTo(MapUtils.getString(map , "cityCode"));
}
return apiKfcStoresMapper.selectByExample(example);
}
} }

@ -561,7 +561,7 @@ public class CommonServiceImpl implements CommonService {
productPayType.setPayTypeId(Integer.valueOf(String.valueOf(payType))); productPayType.setPayTypeId(Integer.valueOf(String.valueOf(payType)));
productPayType.setPayTypeLogo(dictionary.getExt1()); productPayType.setPayTypeLogo(dictionary.getExt1());
productPayType.setPayTypeName(dictionary.getCodeName()); productPayType.setPayTypeName(dictionary.getCodeName());
productPayType.setProductType(3); productPayType.setProductType(object.getInteger("productType"));
productPayType.setOperatorId(object.getLong("operatorId")); productPayType.setOperatorId(object.getLong("operatorId"));
productPayType.setOperatorName(object.getString("operatorName")); productPayType.setOperatorName(object.getString("operatorName"));
productPayType.setSourceId(object.getLong("sourceId")); productPayType.setSourceId(object.getLong("sourceId"));
@ -579,7 +579,7 @@ public class CommonServiceImpl implements CommonService {
// 配置积分折扣比例 // 配置积分折扣比例
productDiscount = new BsProductDiscount(); productDiscount = new BsProductDiscount();
productDiscount.setDiscount(object.getBigDecimal("integralDiscount")); productDiscount.setDiscount(object.getBigDecimal("integralDiscount"));
productDiscount.setProductType(3); productDiscount.setProductType(object.getInteger("productType"));
productDiscount.setCreateTime(new Date()); productDiscount.setCreateTime(new Date());
productDiscount.setUpdateTime(new Date()); productDiscount.setUpdateTime(new Date());
productDiscount.setOperatorId(object.getLong("operatorId")); productDiscount.setOperatorId(object.getLong("operatorId"));
@ -601,7 +601,7 @@ public class CommonServiceImpl implements CommonService {
for (Object platform : productPlatformArray) { for (Object platform : productPlatformArray) {
productPlatform = new BsProductPlatform(); productPlatform = new BsProductPlatform();
SecDictionary dictionary = mappingSysCode("SHOW_PLATFORM", String.valueOf(platform)); SecDictionary dictionary = mappingSysCode("SHOW_PLATFORM", String.valueOf(platform));
productPlatform.setProductType(3); productPlatform.setProductType(object.getInteger("productType"));
productPlatform.setPlatformId(Integer.valueOf(String.valueOf(platform))); productPlatform.setPlatformId(Integer.valueOf(String.valueOf(platform)));
productPlatform.setPlatformName(dictionary.getCodeName()); productPlatform.setPlatformName(dictionary.getCodeName());
productPlatform.setCreateTime(new Date()); productPlatform.setCreateTime(new Date());

@ -127,6 +127,9 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource @Resource
private BaiduVoiceService baiduVoiceService; private BaiduVoiceService baiduVoiceService;
@Resource
private BsConfigService bsConfigService;
@Override @Override
@Transactional( @Transactional(
isolation = Isolation.SERIALIZABLE, isolation = Isolation.SERIALIZABLE,
@ -1760,5 +1763,21 @@ public class HighOrderServiceImpl implements HighOrderService {
} }
} }
@Override
@Transactional(
isolation = Isolation.SERIALIZABLE,
propagation = Propagation.REQUIRES_NEW)
public void insertThirdProduct(JSONObject object) {
HighUser user = highUserService.findByUserId(object.getLong("userId"));
// 查询积分抵扣比例
Map<String, Object> listMap = new HashMap<>();
listMap.put("productType", "5");
listMap.put("returnType", 1);
listMap.put("sourceId", 100001);
// 查询产品积分抵扣比例
BsProductDiscount bsProductDiscount = bsConfigService.getProductDiscountByMap(listMap);
}
} }

@ -174,9 +174,9 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
OutRechargeOrder outRechargeOrder = new OutRechargeOrder(); OutRechargeOrder outRechargeOrder = new OutRechargeOrder();
HighUser user = highUserService.findByUserId(object.getLong("userId")); HighUser user = highUserService.findByUserId(object.getLong("userId"));
// 产品id // 产品id
Long goodsId = object.getLong("goodsId"); Long goodsId = object.getLong("goodsId");

@ -142,6 +142,7 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
postObject.put("operatorId", object.getLong("operatorId")); postObject.put("operatorId", object.getLong("operatorId"));
postObject.put("operatorName", object.getString("operatorName")); postObject.put("operatorName", object.getString("operatorName"));
postObject.put("sourceId", outRechargePrice.getId()); postObject.put("sourceId", outRechargePrice.getId());
postObject.put("productType", 3);
// 配置支付方式 // 配置支付方式
commonService.configPayType(postObject); commonService.configPayType(postObject);
@ -176,7 +177,7 @@ public class OutRechargePriceServiceImpl implements OutRechargePriceService {
postObject.put("operatorId", object.getLong("operatorId")); postObject.put("operatorId", object.getLong("operatorId"));
postObject.put("operatorName", object.getString("operatorName")); postObject.put("operatorName", object.getString("operatorName"));
postObject.put("sourceId", outRechargePrice.getId()); postObject.put("sourceId", outRechargePrice.getId());
postObject.put("productType", 3);
// 配置支付方式 // 配置支付方式
commonService.configPayType(postObject); commonService.configPayType(postObject);
// 配置积分折扣比例 // 配置积分折扣比例

@ -15,6 +15,7 @@ shellPlatMerchantKey=123
# ???? # ????
qinzhuUrl=https://live-test.qianzhu8.com qinzhuUrl=https://live-test.qianzhu8.com
qinzhuHtmlUrl=https://m-test.qianzhu8.com qinzhuHtmlUrl=https://m-test.qianzhu8.com
qianzhuH5url=https://nf-test.qianzhu8.com/gateway
qinzhuPlatformId=10376 qinzhuPlatformId=10376
qinzhuSecret=ktxb49sh2jfhgn8g qinzhuSecret=ktxb49sh2jfhgn8g
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify

@ -12,6 +12,7 @@ tuanYouGasolineAccount=9hp52qf04400
qinzhuUrl=https://live.qianzhu8.com qinzhuUrl=https://live.qianzhu8.com
qinzhuHtmlUrl=https://qz.dctpay.com qinzhuHtmlUrl=https://qz.dctpay.com
qianzhuH5url=https://nf.qianzhu8.com/gateway
qinzhuPlatformId=10458 qinzhuPlatformId=10458
qinzhuSecret=nnl3gg4ss0pka11t qinzhuSecret=nnl3gg4ss0pka11t
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify

@ -12,6 +12,7 @@ tuanYouGasolineAccount=9hp52qf04400
qinzhuUrl=https://live.qianzhu8.com qinzhuUrl=https://live.qianzhu8.com
qinzhuHtmlUrl=https://qz.dctpay.com qinzhuHtmlUrl=https://qz.dctpay.com
qianzhuH5url=https://nf.qianzhu8.com/gateway
qinzhuPlatformId=10458 qinzhuPlatformId=10458
qinzhuSecret=nnl3gg4ss0pka11t qinzhuSecret=nnl3gg4ss0pka11t
qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify qianzhuOrderNotify=https://hsg.dctpay.com/crest/qianzhu/orderNotify

@ -92,6 +92,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/websocket/*") .excludePathPatterns("/websocket/*")
.excludePathPatterns("/rechargeProduct/*") .excludePathPatterns("/rechargeProduct/*")
.excludePathPatterns("/gzSinopec/*") .excludePathPatterns("/gzSinopec/*")
.excludePathPatterns("/thirdParty/*")
; ;
} }

@ -35,7 +35,7 @@ import java.util.Map;
@Api(value = "充值产品接口") @Api(value = "充值产品接口")
public class RechargeProductController { public class RechargeProductController {
private static Logger log = LoggerFactory.getLogger(GzSinopecController.class); private static Logger log = LoggerFactory.getLogger(RechargeProductController.class);
@Resource @Resource
private ApiMerchantsService apiMerchantsService; private ApiMerchantsService apiMerchantsService;

@ -0,0 +1,239 @@
package com.v1.controller;
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.config.QianZhuConfig;
import com.hai.entity.ApiMerchants;
import com.hai.model.ResponseData;
import com.hai.service.*;
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.HashMap;
import java.util.Map;
/**
* @serviceName ThirdPartyController.java
* @author Sum1Dream
* @version 1.0.0
* @Description // 第三方产品接口
* @createTime 14:48 2022/6/28
**/
@Controller
@RequestMapping(value = "/thirdParty")
@Api(value = "第三方产品接口")
public class ThirdPartyController {
private static Logger log = LoggerFactory.getLogger(ThirdPartyController.class);
@Resource
private ApiMerchantsService apiMerchantsService;
@Resource
private SecConfigService secConfigService;
@RequestMapping(value = "/getAllCities", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询所有城市")
public ResponseData getAllCities(@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 (!secConfigService.isConfig("IP_WHITE" , 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);
}
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前商户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前商户无权限查询!");
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
JSONObject jsonObject = QianZhuConfig.getAllCities();
return ResponseMsgUtil.success(jsonObject.getString("data"));
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getStarbucksStore", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询星巴克门店")
public ResponseData getStarbucksStore(@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 (!secConfigService.isConfig("IP_WHITE" , 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("lat")) ||
StringUtils.isBlank(object.getString("lon")) ||
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);
}
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前商户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前商户无权限查询!");
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
map.put("lat" , object.getString("lat"));
map.put("lon" , object.getString("lon"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
JSONObject jsonObject = QianZhuConfig.getStarbucksStore(object.getString("lat") , object.getString("lon"));
if (jsonObject.getBoolean("success")) {
return ResponseMsgUtil.success(jsonObject.getString("data"));
} else {
log.error("getRechargeProduct error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getString("message"));
}
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getStarbucksProducts", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询星巴克商品")
public ResponseData getStarbucksProducts(@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 (!secConfigService.isConfig("IP_WHITE" , 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("pageIndex")) ||
StringUtils.isBlank(object.getString("pageSize")) ||
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);
}
if (!secConfigService.isConfig("KFC_CONFIG" , object.getString("merchId"))) {
log.error("getAllCities error!", "当前商户无权限查询!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOT_AUTHORIZED, "当前商户无权限查询!");
}
Map<String , Object> map = new HashMap<>();
map.put("apiKey" , object.getString("apiKey"));
map.put("merchId" , object.getString("merchId"));
map.put("pageSize" , object.getString("pageSize"));
map.put("pageIndex" , object.getString("pageIndex"));
if (!secConfigService.isSignVerify(map , object.getString("sign"))) {
log.error("getRechargeProduct error!", "签名校验失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.SIGN_VERIFY);
}
JSONObject jsonObject = QianZhuConfig.getStarbucksProducts(object.getInteger("pageIndex") , object.getInteger("pageSize"));
if (jsonObject.getBoolean("success")) {
return ResponseMsgUtil.success(jsonObject.getString("data"));
} else {
log.error("getRechargeProduct error!", "查询失败!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR , jsonObject.getString("message"));
}
} catch (Exception e) {
log.error("HighOpenApiController --> getRechargeProduct() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -39,6 +39,20 @@ spring:
max-wait: -1 max-wait: -1
max-idle: 10 max-idle: 10
min-idle: 0 min-idle: 0
#MQTT配置信息
mqtt:
#MQTT服务地址
url: ws://139.159.177.244:8083/mqtt
#用户名
username: printer_provider
#密码
password: 123654
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#配置日期返回至前台为时间戳 #配置日期返回至前台为时间戳
jackson: jackson:
serialization: serialization:

@ -39,6 +39,20 @@ spring:
max-wait: -1 max-wait: -1
max-idle: 10 max-idle: 10
min-idle: 0 min-idle: 0
#MQTT配置信息
mqtt:
#MQTT服务地址
url: ws://139.159.177.244:8083/mqtt
#用户名
username: printer_provider
#密码
password: 123654
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#配置日期返回至前台为时间戳 #配置日期返回至前台为时间戳
jackson: jackson:
serialization: serialization:

@ -39,6 +39,20 @@ spring:
max-wait: -1 max-wait: -1
max-idle: 10 max-idle: 10
min-idle: 0 min-idle: 0
#MQTT配置信息
mqtt:
#MQTT服务地址
url: ws://122.9.135.148:8083/mqtt
#用户名
username: printer_provider
#密码
password: abcd123!
#客户端id(不能重复)
# client:
# id: provider-id
#MQTT默认的消息推送主题,实际可在调用接口是指定
# default:
# topic: topic
#thymelea模板配置 #thymelea模板配置
thymeleaf: thymeleaf:
prefix: classpath:/templates/ prefix: classpath:/templates/

Loading…
Cancel
Save