修改汇联通distributorId 原参数aNId4A3X修改为orjuOND7

cpupon-dev
袁野 3 weeks ago
parent e4154b53cb
commit 8e20bb270d
  1. 88
      bweb/src/main/java/com/bweb/controller/TestController.java
  2. 42
      bweb/src/main/java/com/bweb/controller/discount/DiscountPackageController.java
  3. 20
      bweb/src/main/java/com/bweb/controller/goods/GoodPresentController.java
  4. 28
      bweb/src/main/java/com/bweb/controller/goods/GoodsController.java
  5. 41
      cweb/src/main/java/com/cweb/controller/cms/CmsContentController.java
  6. 54
      cweb/src/main/java/com/cweb/controller/goods/DeliveryAddressController.java
  7. 87
      cweb/src/main/java/com/cweb/controller/goods/GoodsController.java
  8. 78
      order/src/main/java/com/order/controller/OrderController.java
  9. 2
      order/src/main/java/com/order/controller/notify/MeiTuanController.java
  10. 22
      schedule/src/main/java/com/hfkj/schedule/JdGoodsSchedule.java
  11. 61
      service/src/main/java/com/hfkj/dao/GoodsMsgMapperExt.java
  12. 11
      service/src/main/java/com/hfkj/dao/GoodsSpecsMapperExt.java
  13. 39
      service/src/main/java/com/hfkj/haioil/HaiOilService.java
  14. 1
      service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java
  15. 24
      service/src/main/java/com/hfkj/jd/JdPostService.java
  16. 3
      service/src/main/java/com/hfkj/model/CmsContentModel.java
  17. 12
      service/src/main/java/com/hfkj/model/goods/JdGoodsModel.java
  18. 2
      service/src/main/java/com/hfkj/model/order/OrderChildModel.java
  19. 2
      service/src/main/java/com/hfkj/service/discount/CouponDiscountPackageService.java
  20. 9
      service/src/main/java/com/hfkj/service/goods/GoodPresentService.java
  21. 2
      service/src/main/java/com/hfkj/service/goods/GoodsMsgService.java
  22. 2
      service/src/main/java/com/hfkj/service/goods/GoodsSpecsService.java
  23. 32
      service/src/main/java/com/hfkj/service/goods/impl/GoodPresentServiceImpl.java
  24. 2
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java
  25. 4
      service/src/main/java/com/hfkj/service/goods/impl/GoodsSpecsServiceImpl.java
  26. 7
      service/src/main/java/com/hfkj/service/goods/impl/GoodsTypeServiceImpl.java
  27. 1
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java
  28. 7
      service/src/main/java/com/hfkj/service/order/OrderPaySuccessService.java
  29. 51
      service/src/main/java/com/hfkj/service/order/impl/BsOrderServiceImpl.java

@ -1,4 +1,5 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
@ -17,6 +18,7 @@ import com.hfkj.service.card.BsUserCardService;
import com.hfkj.service.coupon.channel.YouTuCouponService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.BsOrderStarbucksService;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.goods.impl.BsOrderStarbucksServiceImpl;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
@ -56,7 +58,8 @@ public class TestController {
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private GoodsSpecsService goodsSpecsService;
@Resource
private JdService jdService;
@ -81,6 +84,8 @@ public class TestController {
@Resource
private BsOrderStarbucksServiceImpl bsOrderStarbucksService;
@Resource
private GoodsUserAddressService deliveryAddressService;
@RequestMapping(value="/thirdPayResult",method = RequestMethod.GET)
@ -238,6 +243,29 @@ public class TestController {
}
}
@RequestMapping(value="/querySkuFreight",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "querySkuFreight")
public ResponseData querySkuFreight() {
try {
List<com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq> skuInfoList = new ArrayList<>();
com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq skuInfo = new com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq();
skuInfo.setSkuId(627345);
skuInfo.setSkuNum(1);
skuInfoList.add(skuInfo);
return ResponseMsgUtil.success( JdPostService.querySkuFreight(jdService.getToken() , skuInfoList , 24L ,2144L , 21037L , 58300L));
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/skuList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "skuList")
@ -562,4 +590,62 @@ public class TestController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/querySkuFreight",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询运费")
public ResponseData querySkuFreight(@RequestBody JSONObject body) {
try {
if (body == null ||
body.getJSONArray("skuInfoList") == null
|| body.getLong("addressId") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONArray array = body.getJSONArray("skuInfoList");
GoodsUserAddress userAddress = goodsUserAddressService.queryDetail(body.getLong("addressId"));
if (userAddress.getProvinceId() == null) {
VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , userAddress.getRegionName() + userAddress.getAddress());
if (response != null && response.getOpenRpcResult().getSuccess()) {
userAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId());
userAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName());
userAddress.setCityId(response.getOpenRpcResult().getResult().getCityId());
userAddress.setCityName(response.getOpenRpcResult().getResult().getCityName());
userAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId());
userAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName());
userAddress.setTownId(response.getOpenRpcResult().getResult().getTownId());
userAddress.setTownName(response.getOpenRpcResult().getResult().getTownName());
userAddress.setUpdateTime(new Date());
deliveryAddressService.update(userAddress);
}
}
List<com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq> skuInfoList = new ArrayList<>();
com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq skuInfo = new com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq();
for(Object object : array) {
JSONObject json = (JSONObject)object;
GoodsSpecs specs = goodsSpecsService.queryDetail(json.getLong("specsId"));
if (specs.getThirdId() != null) {
skuInfo.setSkuId(Long.parseLong(specs.getThirdId()));
skuInfo.setSkuNum(json.getInteger("num"));
skuInfoList.add(skuInfo);
}
}
if (skuInfoList.isEmpty()) {
JSONObject object = new JSONObject();
object.put("totalFreight" , 0);
return ResponseMsgUtil.success(object);
}
return ResponseMsgUtil.success(JdPostService.querySkuFreight(jdService.getToken() , skuInfoList , userAddress.getProvinceId() ,userAddress.getCityId() , userAddress.getCountyId() , userAddress.getTownId()).getOpenRpcResult().getResult());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,5 +1,6 @@
package com.bweb.controller.discount;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -11,6 +12,7 @@ import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.OrderUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.entity.*;
import com.hfkj.haioil.HaiOilService;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.discount.CouponDiscountPackageService;
@ -25,9 +27,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Controller
@RequestMapping(value="/discountPackage")
@ -73,6 +73,42 @@ public class DiscountPackageController {
}
@RequestMapping(value = "/discountPackageList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包列表")
public ResponseData discountPackageList(
@RequestParam(name = "type", required = false) Integer type) {
try {
Map<String,Object> map = new HashMap<>();
if (type == 1) {
return ResponseMsgUtil.success(couponDiscountPackageService.getList(map));
} else {
List<CouponDiscountPackage> list = new ArrayList<>();
JSONObject object = HaiOilService.queryPkList(map).getJSONObject("return_data");
JSONArray array = object.getJSONArray("dataList");
for (Object obj : array) {
JSONObject jsonObject = (JSONObject)obj;
CouponDiscountPackage couponDiscountPackage = new CouponDiscountPackage();
couponDiscountPackage.setKey(jsonObject.getString("discountPkNo"));
couponDiscountPackage.setTitle(jsonObject.getString("discountPkName"));
list.add(couponDiscountPackage);
}
return ResponseMsgUtil.success(list);
}
} catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getDiscountPackageRecordList", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取优惠券包记录列表")

@ -1,5 +1,6 @@
package com.bweb.controller.goods;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hfkj.common.exception.ErrorCode;
@ -12,6 +13,7 @@ import com.hfkj.entity.CouponDiscountPackage;
import com.hfkj.entity.GoodPresent;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsType;
import com.hfkj.haioil.HaiOilService;
import com.hfkj.model.ResponseData;
import com.hfkj.model.SecUserSessionObject;
import com.hfkj.service.discount.CouponDiscountPackageService;
@ -67,16 +69,24 @@ public class GoodPresentController {
|| body.getSpecsId() == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
CouponDiscountPackage discountPackage = discountPackageService.findDiscountPackageByKey(body.getKey());
if (discountPackage == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券包不存在");
CouponDiscountPackage discountPackage = new CouponDiscountPackage();
if (body.getType() == 1) {
discountPackage = discountPackageService.findDiscountPackageByKey(body.getKey());
if (discountPackage == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "优惠券包不存在");
}
body.setName(discountPackage.getTitle());
} else {
Map<String , Object> map = new HashMap<>();
map.put("discountPkNo" , body.getKey());
JSONObject jsonObject = HaiOilService.queryPkDetail(map);
body.setName(jsonObject.getJSONObject("return_data").getString("discountPkName"));
}
body.setCreateTime(new Date());
body.setUpdateTime(new Date());
body.setStatus(1);
body.setName(discountPackage.getTitle());
goodPresentService.create(body);
return ResponseMsgUtil.success("操作成功");

@ -349,7 +349,7 @@ public class GoodsController {
@RequestMapping(value="/getGoodsSpecsList",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品规格列表")
public ResponseData getGoodsSpecsList(@RequestParam(value = "id" , required = false) Long id) {
public ResponseData getGoodsSpecsList(@RequestParam(value = "id" , required = true) Long id) {
try {
Map<String , Object> map = new HashMap<>();
@ -359,6 +359,7 @@ public class GoodsController {
List<GoodsModelSpecs> goodsModelSpecs = new ArrayList<>();
for (GoodsSpecs goodsSpec : goodsSpecs) {
GoodsModelSpecs goodsModelSpec = new GoodsModelSpecs();
BeanUtils.copyProperties(goodsSpec, goodsModelSpec);
@ -385,30 +386,11 @@ public class GoodsController {
@RequestMapping(value="/getGoodsSpecsListAll",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品规格列表")
public ResponseData getGoodsSpecsListAll() {
public ResponseData getGoodsSpecsListAll(@RequestParam(value = "name" , required = false) String name) {
try {
Map<String , Object> map = new HashMap<>();
map.put("status" , 1);
List<GoodsMsg> goodsMsgList = goodsMsgService.getList(new HashMap<>());
List<GoodsModelSpecs> goodsModelSpecs = new ArrayList<>();
for (GoodsMsg goodsMsg : goodsMsgList) {
Map<String , Object> mapGoods = new HashMap<>();
mapGoods.put("goodsId" , goodsMsg.getId());
List<GoodsSpecs> goodsSpecs = goodsSpecsService.getList(mapGoods);
for (GoodsSpecs goodsSpec : goodsSpecs) {
GoodsModelSpecs goodsModelSpec = new GoodsModelSpecs();
BeanUtils.copyProperties(goodsSpec, goodsModelSpec);
goodsModelSpec.setGoodsName(goodsMsg.getTitle());
goodsModelSpec.setSpecsId(goodsSpec.getId());
goodsModelSpecs.add(goodsModelSpec);
}
}
return ResponseMsgUtil.success(goodsModelSpecs);
map.put("name" , name);
return ResponseMsgUtil.success(goodsSpecsService.getGoodsSpecsCrest(map));
} catch (Exception e) {
log.error("error!",e);

@ -7,6 +7,7 @@ import com.hfkj.entity.GoodsSpecs;
import com.hfkj.model.CmsContentModel;
import com.hfkj.model.ResponseData;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.model.goods.JdGoodsModel;
import com.hfkj.service.cms.CmsContentService;
import com.hfkj.service.goods.GoodsMsgService;
import com.hfkj.service.goods.GoodsSpecsService;
@ -64,54 +65,32 @@ public class CmsContentController {
List<CmsContentModel> cmsContents = new ArrayList<>();
for (CmsContent cmsContent : list) {
List<GoodsModel> goodsModels = new ArrayList<>();
List<JdGoodsModel> goodsModels = new ArrayList<>();
if (cmsContent.getShowType() != null) {
Map<String , Object> goodsMap = new HashMap<>();
goodsMap.put("status" , 1);
goodsMap.put("showType" , 1);
List<GoodsMsg> goodsMsgs = new ArrayList<>();
List<JdGoodsModel> goodsMsgs = new ArrayList<>();
if (cmsContent.getShowType() == 1) {
goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getListCrest(goodsMap).stream().limit(2).collect(Collectors.toList());
goodsMap.put("limit" , 2);
goodsMsgs = goodsMsgService.getListCrest(goodsMap);
}
if (cmsContent.getShowType() == 2) {
goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getListCrest(goodsMap).stream().limit(4).collect(Collectors.toList());
goodsMap.put("limit" , 4);
goodsMsgs = goodsMsgService.getListCrest(goodsMap);
}
if (cmsContent.getShowType() == 3) {
goodsMap.put("goodsType", cmsContent.getShowDataId());
goodsMsgs = goodsMsgService.getListCrest(goodsMap).stream().limit(10).collect(Collectors.toList());
goodsMap.put("limit" , 10);
goodsMsgs = goodsMsgService.getListCrest(goodsMap);
}
for (GoodsMsg goodsMsg : goodsMsgs) {
GoodsModel goodsModel = new GoodsModel();
Map<String , Object> specMap = new HashMap<>();
specMap.put("goodsId", goodsMsg.getId());
List<GoodsSpecs> goodsSpecs = goodsSpecsService.getList(specMap);
if (!goodsSpecs.isEmpty()) {
BigDecimal minPrice = goodsSpecs.get(0).getSalePrice();
BigDecimal minOriginalPrice = goodsSpecs.get(0).getOriginalPrice();
for (GoodsSpecs specs : goodsSpecs) {
if (specs.getSalePrice().compareTo(minPrice) < 0) {
minPrice = specs.getSalePrice();
minOriginalPrice = specs.getOriginalPrice();
}
}
BeanUtils.copyProperties(goodsMsg, goodsModel);
goodsModel.setOriginalPrice(minOriginalPrice);
goodsModel.setPrice(minPrice);
goodsModels.add(goodsModel);
}
}
goodsModels.addAll(goodsMsgs);
}
CmsContentModel cmsContentModel = new CmsContentModel();

@ -93,19 +93,19 @@ public class DeliveryAddressController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
// VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , deliveryAddress.getRegionName() + deliveryAddress.getAddress());
//
//
//
// // 判断response是否为空,并且response的OpenRpcResult的success属性是否为true
// if (response != null && response.getOpenRpcResult().getSuccess()) {
// deliveryAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId());
// deliveryAddress.setCityId(response.getOpenRpcResult().getResult().getCityId());
// deliveryAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId());
// deliveryAddress.setTownId(response.getOpenRpcResult().getResult().getTownId());
// } else {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage());
// }
VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , deliveryAddress.getRegionName() + deliveryAddress.getAddress());
// 判断response是否为空,并且response的OpenRpcResult的success属性是否为true
if (response != null && response.getOpenRpcResult().getSuccess()) {
deliveryAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId());
deliveryAddress.setCityId(response.getOpenRpcResult().getResult().getCityId());
deliveryAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId());
deliveryAddress.setTownId(response.getOpenRpcResult().getResult().getTownId());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage());
}
deliveryAddress.setUserId(userSession.getUser().getId());
@ -154,20 +154,20 @@ public class DeliveryAddressController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "当前收货地址异常!");
}
// VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , deliveryAddress.getRegionName() + deliveryAddress.getAddress());
//
// if (response != null && response.getOpenRpcResult().getSuccess()) {
// deliveryAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId());
// deliveryAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName());
// deliveryAddress.setCityId(response.getOpenRpcResult().getResult().getCityId());
// deliveryAddress.setCityName(response.getOpenRpcResult().getResult().getCityName());
// deliveryAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId());
// deliveryAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName());
// deliveryAddress.setTownId(response.getOpenRpcResult().getResult().getTownId());
// deliveryAddress.setTownName(response.getOpenRpcResult().getResult().getTownName());
// } else {
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage());
// }
VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , deliveryAddress.getRegionName() + deliveryAddress.getAddress());
if (response != null && response.getOpenRpcResult().getSuccess()) {
deliveryAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId());
deliveryAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName());
deliveryAddress.setCityId(response.getOpenRpcResult().getResult().getCityId());
deliveryAddress.setCityName(response.getOpenRpcResult().getResult().getCityName());
deliveryAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId());
deliveryAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName());
deliveryAddress.setTownId(response.getOpenRpcResult().getResult().getTownId());
deliveryAddress.setTownName(response.getOpenRpcResult().getResult().getTownName());
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage());
}
deliveryAddress.setUserId(userSession.getUser().getId());
deliveryAddress.setStatus(1);

@ -17,6 +17,7 @@ import com.hfkj.model.SecUserSessionObject;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.model.goods.GoodsModelSpecs;
import com.hfkj.model.goods.GoodsTypeModel;
import com.hfkj.model.goods.JdGoodsModel;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.goods.*;
import com.hfkj.sysenum.SecUserObjectTypeEnum;
@ -66,11 +67,12 @@ public class GoodsController {
@RequestMapping(value="/getListGoodsType",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "查询商品分类列表")
public ResponseData getListGoodsType() {
public ResponseData getListGoodsType(@RequestParam(value = "type" , required = false) Integer type) {
try {
Map<String ,Object> map = new HashMap<>();
map.put("status" , 1);
map.put("type" , type);
List<GoodsType> list = goodsTypeService.getList(map);
List<GoodsTypeModel> goodsTypeModels = goodsTypeService.getGoodsTypeModelList(list);
@ -131,82 +133,35 @@ public class GoodsController {
map.put("title", title);
map.put("goodsType", goodsType);
map.put("showType", showType);
map.put("price", price);
map.put("goodsTypeParent", goodsTypeParent);
map.put("goodsBrand", goodsBrand);
map.put("saleNum", saleNum);
map.put("limit", limit);
if (limit == null && title == null && goodsType == null && goodsTypeParent == null && goodsBrand == null) {
map.put("limit", 500);
} else {
map.put("limit", limit);
}
map.put("time", time);
map.put("status", 1);
List<GoodsMsg> list = goodsMsgService.getListCrest(map);
List<GoodsSpecs> specsList = goodsSpecsService.getGoodsSpecsCrest();
List<GoodsModel> goodsModels = new ArrayList<>();
// 查询优惠券可以用规格
Map<String, Object> mapSpecs = new HashMap<>();
mapSpecs.put("discountId", discountId);
// 查询规格可用优惠券
List<CouponDiscountGoodsRel> couponDiscountGoodsRel = couponDiscountService.getListGoodsRel(mapSpecs);
for (GoodsMsg goodsMsg : list) {
GoodsModel goodsModel = new GoodsModel();
List<GoodsSpecs> goodsSpecs = specsList.stream().filter(s -> s.getGoodsId().equals(goodsMsg.getId())).collect(Collectors.toList());
if (!goodsSpecs.isEmpty()) {
BigDecimal minPrice = goodsSpecs.get(0).getSalePrice();
BigDecimal minOriginalPrice = goodsSpecs.get(0).getOriginalPrice();
if (discountId != null) {
// 查询优惠券可以用规格
for (GoodsSpecs specs : goodsSpecs) {
if (specs.getSalePrice().compareTo(minPrice) < 0) {
minPrice = specs.getSalePrice();
minOriginalPrice = specs.getOriginalPrice();
}
Map<String, Object> mapSpecs = new HashMap<>();
mapSpecs.put("discountId", discountId);
if (discountId != null) {
CouponDiscountGoodsRel discountGoodsRel = couponDiscountGoodsRel.stream().filter(s -> s.getSpecsId().equals(specs.getId())).findFirst().orElse(null);
if (discountGoodsRel == null) {
specs.setExt1("0");
} else {
specs.setExt1("1");
}
}
}
if (discountId != null) {
// todo 删除没有绑定优惠券的
goodsSpecs = goodsSpecs.stream().filter(s-> !s.getExt1().equals("0")).collect(Collectors.toList());
}
if (goodsSpecs.isEmpty()) {
continue;
}
BeanUtils.copyProperties(goodsMsg, goodsModel);
goodsModel.setOriginalPrice(minOriginalPrice);
goodsModel.setPrice(minPrice);
goodsModels.add(goodsModel);
}
// 查询规格可用优惠券
List<CouponDiscountGoodsRel> couponDiscountGoodsRel = couponDiscountService.getListGoodsRel(mapSpecs);
List<Long> sp = couponDiscountGoodsRel.stream().map(CouponDiscountGoodsRel::getSpecsId).collect(Collectors.toList());
map.put("specsId", sp);
}
if (price != null) {
if (price == 1) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice)).collect(Collectors.toList());
}
if (price == 2) {
goodsModels = goodsModels.stream().sorted(Comparator.comparing(GoodsModel::getPrice).reversed()).collect(Collectors.toList());
}
}
List<JdGoodsModel> list = goodsMsgService.getListCrest(map);
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, goodsModels.size(), pageSize, new PageInfo<>(goodsModels)));
return ResponseMsgUtil.success(PageUtil.initPageInfoObj(pageNum, list.size(), pageSize, new PageInfo<>(list)));
} catch (Exception e) {
log.error("GoodsDetailController --> getListUser() error!", e);

@ -1,5 +1,6 @@
package com.order.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -11,22 +12,23 @@ import com.hfkj.common.utils.PageUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.common.utils.SignatureUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrder;
import com.hfkj.entity.BsOrderChild;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsSpecs;
import com.hfkj.entity.*;
import com.hfkj.haioil.HaiOilService;
import com.hfkj.jd.JdPostService;
import com.hfkj.jd.JdService;
import com.hfkj.model.ResponseData;
import com.hfkj.model.UserSessionObject;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.impl.BsOrderChildServiceImpl;
import com.hfkj.service.pay.HuiPayService;
import com.hfkj.sysenum.UserStatusEnum;
import com.hfkj.sysenum.order.*;
import com.jd.open.api.sdk.response.vopdz.VopAddressConvertFourAreaByDetailStrResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -62,7 +64,12 @@ public class OrderController {
private GoodsSpecsService goodsSpecsService;
@Resource
private BsOrderGoodsService orderGoodsService;
@Resource
private JdService jdService;
@Resource
private GoodsUserAddressService goodsUserAddressService;
@Resource
private GoodsUserAddressService deliveryAddressService;
@RequestMapping(value="/create",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建订单")
@ -340,4 +347,65 @@ public class OrderController {
}
}
@RequestMapping(value="/querySkuFreight",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "查询运费")
public ResponseData querySkuFreight(@RequestBody JSONObject body) {
try {
if (body == null ||
body.getJSONArray("skuInfoList") == null
|| body.getLong("addressId") == null
) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONArray array = body.getJSONArray("skuInfoList");
GoodsUserAddress userAddress = goodsUserAddressService.queryDetail(body.getLong("addressId"));
if (userAddress.getProvinceId() == null) {
VopAddressConvertFourAreaByDetailStrResponse response = JdPostService.convertFourAreaByDetailStr(jdService.getToken() , userAddress.getRegionName() + userAddress.getAddress());
if (response != null && response.getOpenRpcResult().getSuccess()) {
userAddress.setProvinceId(response.getOpenRpcResult().getResult().getProvinceId());
userAddress.setProvinceName(response.getOpenRpcResult().getResult().getProvinceName());
userAddress.setCityId(response.getOpenRpcResult().getResult().getCityId());
userAddress.setCityName(response.getOpenRpcResult().getResult().getCityName());
userAddress.setCountyId(response.getOpenRpcResult().getResult().getCountyId());
userAddress.setCountyName(response.getOpenRpcResult().getResult().getCountyName());
userAddress.setTownId(response.getOpenRpcResult().getResult().getTownId());
userAddress.setTownName(response.getOpenRpcResult().getResult().getTownName());
userAddress.setUpdateTime(new Date());
deliveryAddressService.update(userAddress);
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, response.getOpenRpcResult().getResultMessage());
}
}
List<com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq> skuInfoList = new ArrayList<>();
com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq skuInfo = new com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq();
for(Object object : array) {
JSONObject json = (JSONObject)object;
GoodsSpecs specs = goodsSpecsService.queryDetail(json.getLong("specsId"));
if (specs.getThirdId() != null) {
skuInfo.setSkuId(Long.parseLong(specs.getThirdId()));
skuInfo.setSkuNum(json.getInteger("num"));
skuInfoList.add(skuInfo);
}
}
if (skuInfoList.isEmpty()) {
JSONObject object = new JSONObject();
object.put("totalFreight" , 0);
return ResponseMsgUtil.success(object);
}
return ResponseMsgUtil.success(JdPostService.querySkuFreight(jdService.getToken() , skuInfoList , userAddress.getProvinceId() ,userAddress.getCityId() , userAddress.getCountyId() , userAddress.getTownId()).getOpenRpcResult().getResult());
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -255,7 +255,7 @@ public class MeiTuanController {
}
@RequestMapping(value = "/orderPush", method = RequestMethod.POST)
@RequestMapping(value = "/order", method = RequestMethod.POST)
@ApiOperation(value = "订单状态变更回调")
@ResponseBody
public Object orderPush(

@ -38,16 +38,16 @@ public class JdGoodsSchedule {
@Resource
private JdService jdService;
// //每10分钟执行一次
// @Scheduled(cron = "0 0/10 * * * ?")
// public void etcCarMsg() {
// try {
//
// jdService.deleteMsg();
//
// } catch (Exception e) {
// log.error("HighUserController --> findByUserId() error!", e);
// }
// }
//每10分钟执行一次
@Scheduled(cron = "0 0/10 * * * ?")
public void etcCarMsg() {
try {
jdService.deleteMsg();
} catch (Exception e) {
log.error("HighUserController --> findByUserId() error!", e);
}
}
}

@ -38,26 +38,55 @@ public interface GoodsMsgMapperExt {
"</script>")
List<JdGoodsModel> getJdGoodsList(@Param("param") Map<String,Object> param);
// @Select("<script>" +
// " SELECT" +
// " id ," +
// " title as title," +
// " list_img as listImg," +
// " third_id as thirdId," +
// " sale_num as saleNum" +
// " FROM" +
// " goods_msg where status = 1" +
// " <if test='param.goodsTypeParent != null'> and goods_type_parent = #{param.goodsTypeParent} </if>" +
// " <if test='param.title != null'> and title like concat('%',#{param.title},'%') </if>" +
// " <if test='param.goodsType != null'> and goods_type = #{param.goodsType} </if>" +
// " <if test='param.showType != null'> and show_type = #{param.showType} </if>" +
// " <if test='param.goodsBrand != null'> and goods_brand = #{param.goodsBrand} </if>" +
// " <if test='param.time != 1'>ORDER BY update_time desc</if>" +
// " <if test='param.time == 1'>ORDER BY create_time desc</if>" +
// " <if test='param.saleNum == 2'>, sale_num desc</if>" +
// " <if test='param.limit != null'>limit #{param.limit}</if>" +
// "</script>")
// List<GoodsMsg> getGoodsListCrest(@Param("param") Map<String,Object> param);
@Select("<script>" +
" SELECT" +
" id ," +
" title as title," +
" title as title," +
" list_img as listImg," +
" third_id as thirdId," +
" sale_num as saleNum" +
" a.goods_type_parent_name as goodsTypeParentName," +
" a.goods_type_name as goodsTypeName," +
" a.goods_brand_name as goodsBrandName," +
" a.id as id," +
" a.title as title," +
" a.list_img as listImg," +
" b.sale_price as salePrice, " +
" b.sale_price as price, " +
" b.third_price as thirdPrice," +
" b.original_price as originalPrice," +
" a.third_id as thirdId," +
" b.id as specsId" +
" FROM" +
" goods_msg where status = 1 and third_id is null " +
" <if test='param.goodsTypeParent != null'> and goods_type_parent = #{param.goodsTypeParent} </if>" +
" <if test='param.title != null'> and title like concat('%',#{param.title},'%') </if>" +
" <if test='param.goodsType != null'> and goods_type = #{param.goodsType} </if>" +
" <if test='param.showType != null'> and show_type = #{param.showType} </if>" +
" <if test='param.goodsBrand != null'> and goods_brand = #{param.goodsBrand} </if>" +
" <if test='param.time != 1'>ORDER BY update_time desc</if>" +
" <if test='param.time == 1'>ORDER BY create_time desc</if>" +
" <if test='param.saleNum == 2'>, sale_num desc</if>" +
" goods_msg a join goods_specs b on a.id = b.goods_id where a.status = 1" +
" <if test='param.goodsTypeParent != null'> and a.goods_type_parent = #{param.goodsTypeParent} </if>" +
" <if test='param.title != null'> and a.title like concat('%',#{param.title},'%') </if>" +
" <if test='param.goodsType != null'> and a.goods_type = #{param.goodsType} </if>" +
" <if test='param.specsId != null'> and b.id in <foreach collection='param.specsId' item='item' index='index' open='(' separator=',' close=')'>#{item}</foreach> </if>" +
" <if test='param.goodsBrand != null'> and a.goods_brand = #{param.goodsBrand} </if>" +
" <if test='param.time != 1'>ORDER BY a.update_time desc</if>" +
" <if test='param.time == 1'>ORDER BY a.create_time desc</if>" +
" <if test='param.price == 1'>b.sale_price asc</if>" +
" <if test='param.price == 2'> b.sale_price desc</if>" +
" <if test='param.saleNum == 2'>, a.sale_num desc</if>" +
" <if test='param.limit != null'>limit #{param.limit}</if>" +
"</script>")
List<GoodsMsg> getGoodsListCrest(@Param("param") Map<String,Object> param);
List<JdGoodsModel> getGoodsListCrest(@Param("param") Map<String,Object> param);
}

@ -1,10 +1,8 @@
package com.hfkj.dao;
import com.hfkj.entity.GoodsMsg;
import com.hfkj.entity.GoodsSpecs;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@ -18,11 +16,12 @@ public interface GoodsSpecsMapperExt {
@Select("<script>" +
" SELECT" +
" id as id ," +
" goods_id as goodsId ," +
" sale_price as salePrice," +
" original_price as originalPrice" +
" name as name ," +
" sale_price as salePrice" +
" FROM" +
" goods_specs where status = 1 " +
" <if test='param.name != null'> and name like concat('%',#{param.name},'%') </if>" +
"limit 2000 " +
"</script>")
List<GoodsSpecs> getGoodsSpecsCrest();
List<GoodsSpecs> getGoodsSpecsCrest(@Param("param") Map<String,Object> param);
}

@ -39,6 +39,45 @@ public class HaiOilService {
}
/**
* @MethodName queryListByPk
* @Description: 查询优惠券包列表
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/9/9 下午3:00
*/
public static JSONObject queryPkList(Map<String , Object> map) throws Exception {
JSONObject object = request("/openapi/discount/queryPkList" , map);
if (Objects.equals(object.getString("return_code"), "000000")) {
return object;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
}
/**
* @MethodName queryPkDetail
* @Description: 查询优惠券包详情
* @param map
* @return: com.alibaba.fastjson.JSONObject
* @Author: Sum1Dream
* @Date: 2024/9/9 下午3:00
*/
public static JSONObject queryPkDetail(Map<String , Object> map) throws Exception {
JSONObject object = request("/openapi/discount/queryPkDetail" , map);
if (Objects.equals(object.getString("return_code"), "000000")) {
return object;
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请求失败!");
}
}
/**
* @MethodName queryListByPhone

@ -95,6 +95,7 @@ public class JdServiceImpl implements JdService {
if (token == null) {
// 请求回调 会在回调存入参数
JdPostService.getAccessToken();
getToken();
}
return token.toString();
}

@ -8,6 +8,8 @@ import com.hfkj.entity.GoodsUserAddress;
import com.jd.open.api.sdk.DefaultJdClient;
import com.jd.open.api.sdk.JdClient;
import com.jd.open.api.sdk.domain.vopdd.OperaOrderOpenProvider.request.submitOrder.*;
import com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.AreaBaseInfoOpenReq;
import com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.FreightQueryOpenReq;
import com.jd.open.api.sdk.domain.vopkc.SkuInfoGoodsProvider.request.getNewStockById.AreaBaseInfoGoodsReq;
import com.jd.open.api.sdk.domain.vopkc.SkuInfoGoodsProvider.request.getNewStockById.GetStockByIdGoodsReq;
import com.jd.open.api.sdk.domain.vopkc.SkuInfoGoodsProvider.request.getNewStockById.SkuNumBaseGoodsReq;
@ -21,10 +23,7 @@ import com.jd.open.api.sdk.request.vopsh.VopAfsCreateAfsApplyRequest;
import com.jd.open.api.sdk.request.vopsp.*;
import com.jd.open.api.sdk.request.vopxx.VopMessageDeleteClientMsgByIdListRequest;
import com.jd.open.api.sdk.request.vopxx.VopMessageQueryTransByVopNormalRequest;
import com.jd.open.api.sdk.response.vopdd.VopOrderConfirmOrderResponse;
import com.jd.open.api.sdk.response.vopdd.VopOrderQueryDeliveryInfoResponse;
import com.jd.open.api.sdk.response.vopdd.VopOrderQueryOrderDetailResponse;
import com.jd.open.api.sdk.response.vopdd.VopOrderSubmitOrderResponse;
import com.jd.open.api.sdk.response.vopdd.*;
import com.jd.open.api.sdk.response.vopdz.VopAddressConvertFourAreaByDetailStrResponse;
import com.jd.open.api.sdk.response.vopdz.VopAddressQueryJdAreaIdListResponse;
import com.jd.open.api.sdk.response.vopdz.VopAddressVerifyAreaFourIdOpenReqResponse;
@ -192,6 +191,23 @@ public class JdPostService {
return client.execute(request);
}
// 查询商品运费
public static VopOrderQuerySkuFreightResponse querySkuFreight(String token , List<com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq> skuInfoList , Long provinceId , Long cityId , Long countyId , Long townId) throws Exception {
JdClient client=new DefaultJdClient(SERVER_URL,token,CommonSysConst.getSysConfig().getJDAppKey(),CommonSysConst.getSysConfig().getJDAppSecret());
VopOrderQuerySkuFreightRequest request=new VopOrderQuerySkuFreightRequest();
FreightQueryOpenReq freightQueryOpenReq=new FreightQueryOpenReq();
freightQueryOpenReq.setPaymentType(4);
freightQueryOpenReq.setSkuInfoList(skuInfoList);
AreaBaseInfoOpenReq areaBaseInfoOpenReq = new AreaBaseInfoOpenReq();
areaBaseInfoOpenReq.setProvinceId(provinceId);
areaBaseInfoOpenReq.setCityId(cityId);
areaBaseInfoOpenReq.setCountyId(countyId);
areaBaseInfoOpenReq.setTownId(townId);
freightQueryOpenReq.setAreaInfo(areaBaseInfoOpenReq);
request.setFreightQueryOpenReq(freightQueryOpenReq);
return client.execute(request);
}
// 提交预占订单服务
public static VopOrderSubmitOrderResponse submitOrder(String token , GoodsUserAddress address , String orderNo , Integer skuNum , Long skuId) throws Exception {
// 创建京东客户端

@ -2,6 +2,7 @@ package com.hfkj.model;
import com.hfkj.entity.CmsContent;
import com.hfkj.model.goods.GoodsModel;
import com.hfkj.model.goods.JdGoodsModel;
import lombok.Data;
import java.util.List;
@ -9,5 +10,5 @@ import java.util.List;
@Data
public class CmsContentModel extends CmsContent {
List<GoodsModel> goodsMsgList;
List<JdGoodsModel> goodsMsgList;
}

@ -15,6 +15,10 @@ import java.math.BigDecimal;
@Data
public class JdGoodsModel {
@ColumnWidth(50)
@ExcelProperty("编码")
public String id;
@ColumnWidth(50)
@ExcelProperty("一级分类")
public String goodsTypeParentName;
@ -39,6 +43,10 @@ public class JdGoodsModel {
@ExcelProperty("售卖价格")
public BigDecimal salePrice;
@ColumnWidth(15)
@ExcelProperty("售卖价格")
public BigDecimal price;
@ColumnWidth(20)
@ExcelProperty("京东价")
public BigDecimal thirdPrice;
@ -51,6 +59,10 @@ public class JdGoodsModel {
@ExcelProperty({"sku编码"})
public String thirdId;
@ColumnWidth(20)
@ExcelProperty({"规格编码"})
public String specsId;
@ColumnWidth(20)
@ExcelProperty({"销量"})
public String saleNum;

@ -18,4 +18,6 @@ public class OrderChildModel extends BsOrderChild {
*/
private Object business;
private Long addressId;
}

@ -1,5 +1,6 @@
package com.hfkj.service.discount;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.entity.CouponDiscount;
import com.hfkj.entity.CouponDiscountPackage;
import com.hfkj.entity.CouponDiscountPackageDetails;
@ -70,6 +71,7 @@ public interface CouponDiscountPackageService {
*/
List<CouponDiscountPackage> getList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name getListRecordByMap

@ -56,4 +56,13 @@ public interface GoodPresentService {
* @Date: 2024/12/18 下午3:42
*/
void delete(Long id , Boolean fullDelete);
/**
* @MethodName PresentDiscountPackage
* @Description:
* @param specsId
* @Author: Sum1Dream
* @Date: 2024/12/30 下午3:47
*/
void presentDiscountPackage(Long specsId, String phone) throws Exception;
}

@ -87,7 +87,7 @@ public interface GoodsMsgService {
* @Author: Sum1Dream
* @Date: 2024/11/26 上午10:49
*/
List<GoodsMsg> getListCrest(Map<String , Object> map);
List<JdGoodsModel> getListCrest(Map<String , Object> map);
List<JdGoodsModel> getJdGoodsList(Map<String,Object> param);

@ -87,7 +87,7 @@ public interface GoodsSpecsService {
List<GoodsSpecs> getList(Map<String , Object> map);
List<GoodsSpecs> getGoodsSpecsCrest();
List<GoodsSpecs> getGoodsSpecsCrest(Map<String , Object> map);
/**
* @Author Sum1Dream

@ -1,19 +1,19 @@
package com.hfkj.service.goods.impl;
import com.hfkj.dao.GoodPresentMapper;
import com.hfkj.entity.CouponDiscountPackage;
import com.hfkj.entity.GoodPresent;
import com.hfkj.entity.GoodPresentExample;
import com.hfkj.entity.GoodsBrand;
import com.hfkj.haioil.HaiOilService;
import com.hfkj.service.discount.CouponDiscountPackageService;
import com.hfkj.service.goods.GoodPresentService;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
@Service("goodPresentService")
public class GoodPresentServiceImpl implements GoodPresentService {
@ -21,6 +21,9 @@ public class GoodPresentServiceImpl implements GoodPresentService {
@Resource
private GoodPresentMapper goodPresentMapper;
@Resource
private CouponDiscountPackageService couponDiscountPackageService;
@Override
public void create(GoodPresent goodPresent) {
goodPresentMapper.insert(goodPresent);
@ -44,6 +47,7 @@ public class GoodPresentServiceImpl implements GoodPresentService {
if (MapUtils.getLong(map, "specsId") != null) {
criteria.andSpecsIdEqualTo(MapUtils.getLong(map, "specsId"));
}
criteria.andStatusNotEqualTo(0);
return goodPresentMapper.selectByExample(example);
}
@ -59,4 +63,24 @@ public class GoodPresentServiceImpl implements GoodPresentService {
update(goodPresent);
}
}
@Override
public void presentDiscountPackage(Long specsId , String phone) throws Exception {
Map<String , Object> map = new HashMap<>();
map.put("specsId",specsId);
List<GoodPresent> list = getList(map);
for (GoodPresent goodPresent : list) {
if (goodPresent.getType() == 1) {
CouponDiscountPackage discountPackage = couponDiscountPackageService.findDiscountPackageByKey(goodPresent.getKey());
couponDiscountPackageService.giveDiscountPackage(discountPackage.getId().intValue() , phone);
} else {
map.put("discountPkNo" , goodPresent.getKey());
map.put("number" , 1);
map.put("phone" , phone);
HaiOilService.pushPk(map);
}
}
}
}

@ -145,7 +145,7 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
}
@Override
public List<GoodsMsg> getListCrest(Map<String, Object> map) {
public List<JdGoodsModel> getListCrest(Map<String, Object> map) {
return goodsMsgMapper.getGoodsListCrest(map);
}

@ -112,8 +112,8 @@ public class GoodsSpecsServiceImpl implements GoodsSpecsService {
@Override
public List<GoodsSpecs> getGoodsSpecsCrest() {
return goodsSpecsMapper.getGoodsSpecsCrest();
public List<GoodsSpecs> getGoodsSpecsCrest(Map<String , Object> map) {
return goodsSpecsMapper.getGoodsSpecsCrest(map);
}
@Override

@ -92,7 +92,7 @@ public class GoodsTypeServiceImpl implements GoodsTypeService {
public List<GoodsType> getList(Map<String, Object> map) {
GoodsTypeExample example = new GoodsTypeExample();
GoodsTypeExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0);
GoodsTypeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getLong(map, "parentId") != null) {
criteria.andParentIdEqualTo(MapUtils.getLong(map, "parentId"));
@ -103,6 +103,11 @@ public class GoodsTypeServiceImpl implements GoodsTypeService {
if (MapUtils.getInteger(map, "businessType") != null) {
criteria.andBusinessTypeEqualTo(MapUtils.getInteger(map, "businessType"));
}
if (MapUtils.getInteger(map, "type") != null) {
if (MapUtils.getInteger(map, "type") == 2) {
criteria.andOpIdIsNull();
}
}
if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status"));
} else {

@ -322,6 +322,7 @@ public class OrderCreateService {
}
orderChild.setBusiness(jsonObject);
orderChild.setAddressId(address.getId());
return orderChild;
}

@ -72,6 +72,8 @@ public class OrderPaySuccessService {
private BsOrderMemberService bsOrderMemberService;
@Resource
private JdService jdService;
@Resource
private GoodPresentService goodPresentService;
/**
* 订单业务处理
* @param order
@ -297,8 +299,9 @@ public class OrderPaySuccessService {
if (goodsOrder.getThirdOrderNo() != null) {
jdService.confirmOrder(goodsOrder);
}
if (childOrder.getProductSpecId() != null) {
goodPresentService.presentDiscountPackage(childOrder.getProductSpecId() , order.getUserPhone());
}
goodsMsgService.editSaleNum(goodsOrder.getGoodsId() , goodsOrder.getGoodsCount() , 1);
goodsOrder.setTotalPrice(childOrder.getProductTotalPrice());

@ -11,6 +11,7 @@ import com.hfkj.common.utils.RandomUtils;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.dao.BsOrderMapper;
import com.hfkj.entity.*;
import com.hfkj.jd.JdPostService;
import com.hfkj.jd.JdService;
import com.hfkj.model.order.OrderChildModel;
import com.hfkj.model.order.OrderModel;
@ -20,6 +21,8 @@ import com.hfkj.service.BsProductConfigService;
import com.hfkj.service.discount.CouponDiscountService;
import com.hfkj.service.discount.CouponDiscountUserRelService;
import com.hfkj.service.goods.BsOrderCinemaService;
import com.hfkj.service.goods.GoodsSpecsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.order.*;
import com.hfkj.service.user.UserIntegralService;
import com.hfkj.sysenum.UserIntegralRecordOpUserTypeEnum;
@ -28,6 +31,9 @@ import com.hfkj.sysenum.order.OrderChildProductTypeEnum;
import com.hfkj.sysenum.order.OrderChildStatusEnum;
import com.hfkj.sysenum.order.OrderPayChannelEnum;
import com.hfkj.sysenum.order.OrderStatusEnum;
import com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.request.querySkuFreight.SkuInfoOrderOpenReq;
import com.jd.open.api.sdk.domain.vopdd.QueryOrderOpenProvider.response.querySkuFreight.FreightQueryOpenResp;
import com.jd.open.api.sdk.response.vopdd.VopOrderQuerySkuFreightResponse;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
@ -91,7 +97,10 @@ public class BsOrderServiceImpl implements BsOrderService {
private BsProductConfigService productConfigService;
@Resource
private JdService jdService;
@Resource
private GoodsSpecsService goodsSpecsService;
@Resource
private GoodsUserAddressService goodsUserAddressService;
@Override
public BsOrder editData(BsOrder order) {
@ -129,11 +138,17 @@ public class BsOrderServiceImpl implements BsOrderService {
order.setOrderNo(DateUtil.date2String(new Date(), "yyMMddHHmmss") + RandomUtils.number(6, false));
editData(order);
Long addressId = null;
// 订单总金额
BigDecimal totalPrice = new BigDecimal("0");
// 商品总金额
BigDecimal productTotalPrice = new BigDecimal("0");
// 创建京东产品物流
List<SkuInfoOrderOpenReq> skuInfoList = new ArrayList<>();
SkuInfoOrderOpenReq skuInfo = new SkuInfoOrderOpenReq();
/************** 处理业务 ***************/
for (OrderChildModel child : order.getOrderChildList()) {
child.setOrderNo(order.getOrderNo());
@ -142,6 +157,14 @@ public class BsOrderServiceImpl implements BsOrderService {
// 提交订单前实物商品处理
if (child.getProductType().equals(OrderChildProductTypeEnum.type1.getCode())) {
child = orderCreateService.goods(order, child);
addressId = child.getAddressId();
// 查询规格
GoodsSpecs specs = goodsSpecsService.queryDetail(child.getProductSpecId());
if (specs.getThirdId() != null) {
skuInfo.setSkuId(Long.parseLong(specs.getThirdId()));
skuInfo.setSkuNum(child.getProductCount());
skuInfoList.add(skuInfo);
}
// todo 1.0阶段暂时需要返回收货地址使用
order.setBusiness(child.getBusiness());
} else if (child.getProductType().equals(OrderChildProductTypeEnum.type2.getCode())) {
@ -223,6 +246,17 @@ public class BsOrderServiceImpl implements BsOrderService {
order.setOrderStatus(order.getPayRealPrice().compareTo(new BigDecimal("0")) == 0?OrderStatusEnum.status2.getCode():OrderStatusEnum.status1.getCode());
BigDecimal totalChildDiscountPrice = new BigDecimal("0");
Long totalIntegralDiscountPrice = 0L;
// 计算运费
if (!skuInfoList.isEmpty()) {
FreightQueryOpenResp resp = queryFreight(skuInfoList , addressId);
if (resp != null ) {
order.setFreightPrice(resp.getTotalFreight());
order.setPayRealPrice(order.getPayRealPrice().add(resp.getTotalFreight()));
}
}
// 订单入库前处理
for (int i = 0; i < order.getOrderChildList().size();i++) {
OrderChildModel childOrder = order.getOrderChildList().get(i);
@ -684,4 +718,19 @@ public class BsOrderServiceImpl implements BsOrderService {
}
}
private FreightQueryOpenResp queryFreight(List<SkuInfoOrderOpenReq> skuInfoList , Long addressId) throws Exception {
GoodsUserAddress userAddress = goodsUserAddressService.queryDetail(addressId);
if (userAddress.getProvinceId() != null) {
VopOrderQuerySkuFreightResponse freightResponse = JdPostService.querySkuFreight(jdService.getToken() , skuInfoList , userAddress.getProvinceId() ,userAddress.getCityId() , userAddress.getCountyId() , userAddress.getTownId());
if (freightResponse != null && !freightResponse.getOpenRpcResult().getSuccess()) {
return null;
}
return freightResponse.getOpenRpcResult().getResult();
}
return null;
}
}

Loading…
Cancel
Save