袁野 2 days ago
parent 20af3db305
commit 9ce6183787
  1. 39
      bweb/src/main/java/com/bweb/controller/TestController.java
  2. 5
      cweb/src/main/java/com/cweb/controller/goods/GoodsController.java
  3. 6
      order/src/main/java/com/order/controller/business/BsOrderGoodsController.java
  4. 27
      service/src/main/java/com/hfkj/jd/Impl/JdServiceImpl.java
  5. 9
      service/src/main/java/com/hfkj/jd/JdPostService.java
  6. 11
      service/src/main/java/com/hfkj/jd/JdService.java
  7. 10
      service/src/main/java/com/hfkj/service/goods/GoodsSpecsService.java
  8. 3
      service/src/main/java/com/hfkj/service/goods/impl/GoodsMsgServiceImpl.java
  9. 7
      service/src/main/java/com/hfkj/service/goods/impl/GoodsSpecsServiceImpl.java
  10. 3
      service/src/main/java/com/hfkj/service/order/OrderCreateService.java

@ -7,6 +7,7 @@ import com.hfkj.common.utils.*;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsOrderGoods;
import com.hfkj.entity.GoodsUserAddress;
import com.hfkj.jd.JdPostService;
import com.hfkj.jd.JdService;
import com.hfkj.mer.BsMerPayConfigService;
@ -15,6 +16,7 @@ import com.hfkj.model.ResponseData;
import com.hfkj.service.card.BsUserCardService;
import com.hfkj.service.coupon.channel.YouTuCouponService;
import com.hfkj.service.goods.BsOrderGoodsService;
import com.hfkj.service.goods.GoodsUserAddressService;
import com.hfkj.service.hlt.HuiLianTongUnionCardService;
import com.hfkj.service.order.BsOrderService;
import com.hfkj.service.order.OrderPayService;
@ -52,6 +54,12 @@ public class TestController {
@Resource
private JdService jdService;
@Resource
private BsOrderGoodsService getOrderGoodsService;
@Resource
private GoodsUserAddressService goodsUserAddressService;
@RequestMapping(value="/thirdPayResult",method = RequestMethod.GET)
@ResponseBody
@ -329,4 +337,35 @@ public class TestController {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/getGoodsUpdate",method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "更新商品")
public ResponseData getGoodsUpdate() {
try {
Map<String , Object> map = new HashMap<>();
map.put("status" , 2);
List<BsOrderGoods> orderGoodsList = getOrderGoodsService.getList(map);
List<GoodsUserAddress> userAddresses = goodsUserAddressService.getList(new HashMap<>());
for (BsOrderGoods orderGoods : orderGoodsList) {
GoodsUserAddress address = userAddresses.stream().filter(x -> Objects.equals(x.getId(), orderGoods.getGoodsId())).findFirst().orElse(null);
if (address != null) {
orderGoods.setDeliveryAddress(address.getRegionName() + "-" + address.getAddress() + "-" + address.getConsignee() + "-" + address.getPhone());
getOrderGoodsService.update(orderGoods);
}
}
return ResponseMsgUtil.success("");
} catch (Exception e) {
log.error("error!",e);
return ResponseMsgUtil.exception(e);
}
}
}

@ -186,6 +186,8 @@ public class GoodsController {
GoodsMsg goodsMsg = goodsMsgService.queryDetail(id);
GoodsModel goodsModel = new GoodsModel();
BeanUtils.copyProperties(goodsMsg, goodsModel);
@ -202,6 +204,9 @@ public class GoodsController {
BeanUtils.copyProperties(goodsSpec, goodsModelSpec);
GoodsVpd goodsVpd = goodsVpdService.queryDetailBySpecsId(goodsSpec.getId());
if (goodsVpd != null) {
BeanUtils.copyProperties(goodsVpd, goodsModelSpec);
}
goodsModelSpec.setSpecsId(goodsSpec.getId());

@ -346,16 +346,12 @@ public class BsOrderGoodsController {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
GoodsUserAddress userAddress = addressService.queryDetail(orderGoods.getDeliveryAddressId());
if (userAddress == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "暂无物流信息!");
}
if (orderGoods.getLogisticsNo() == null) {
throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , "待揽收!");
}
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , userAddress.getPhone());
GoodsLogistics logistics = (GoodsLogistics) bsOrderGoodsService.getLogisticsMsg(orderGoods.getLogisticsNo() , orderGoods.getUserPhone());
if (logistics.getLogisticsStatus() != null) {
orderGoods.setLogisticsStatus(logistics.getLogisticsStatus());

@ -17,6 +17,7 @@ import com.jd.open.api.sdk.domain.vopsp.SkuPoolGoodsProvider.response.getSkuPool
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuDetailInfoResponse;
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuImageListResponse;
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuPoolInfoResponse;
import com.jd.open.api.sdk.response.vopsp.VopGoodsGetSkuStateListResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -62,7 +63,6 @@ public class JdServiceImpl implements JdService {
JdPostService.getAccessToken();
getToken();
}
return token.toString();
}
@ -83,7 +83,8 @@ public class JdServiceImpl implements JdService {
List<GoodsType> goodsType = goodsTypeService.getList(new HashMap<>());
List<GoodsBrand> brands = goodsBrandService.getList(new HashMap<>());
Map<String, Object> goodsMap = new HashMap<>();
goodsMap.put("type", 3);
goodsMap.put("type", 1);
goodsMap.put("childType", 1);
List<GoodsMsg> goodsMsgs = goodsMsgService.getList(goodsMap);
List<GoodsSpecs> goodsSpecsList = goodsSpecsService.getList(new HashMap<>());
BsProductConfig productConfig = productConfigService.queryDetail(OrderChildProductTypeEnum.type6.getCode());
@ -289,4 +290,26 @@ public class JdServiceImpl implements JdService {
}
}
}
@Override
public Boolean checkSkuSale(GoodsMsg goodsMsg) throws Exception {
// 查询商品是否下架
VopGoodsGetSkuStateListResponse skuStateListResponse = JdPostService.getSkuState(getToken(), goodsMsg.getThirdId());
if (skuStateListResponse.getOpenRpcResult().getResult().get(0).getSkuState() == 0) {
return true;
}
// 查询规格
GoodsSpecs specs = goodsSpecsService.queryDetailByThirdId(goodsMsg.getThirdId());
// 根据skuId 查询商品详情
VopGoodsGetSkuDetailInfoResponse skuDetail = JdPostService.getSkuDetailInfo(getToken(), Long.valueOf(goodsMsg.getThirdId()));
GetSkuPoolInfoGoodsResp detail = skuDetail.getOpenRpcResult().getResult();
// 根据skuId 查询商品售价
OpenRpcResult priceResponse = JdPostService.getSellPrice(getToken(), String.valueOf(goodsMsg.getThirdId())).getOpenRpcResult();
return null;
}
}

@ -163,6 +163,15 @@ public class JdPostService {
return client.execute(request);
}
// 查询商品上下架状态
public static VopGoodsGetSkuStateListResponse getSkuState(String token , String skuId) throws Exception {
JdClient client=new DefaultJdClient(SERVER_URL,token,CommonSysConst.getSysConfig().getJDAppKey(),CommonSysConst.getSysConfig().getJDAppSecret());
VopGoodsGetSkuStateListRequest request=new VopGoodsGetSkuStateListRequest();
request.setSkuId(skuId);
VopGoodsGetSkuStateListResponse response=client.execute(request);
return client.execute(request);
}
// 校验商品购买区域是否受限
public static VopGoodsCheckAreaLimitListResponse checkAreaLimitList(String token , String skuId , Long provinceId , Long cityId , Long countyId , Long townId) throws Exception {
JdClient client=new DefaultJdClient(SERVER_URL,token,CommonSysConst.getSysConfig().getJDAppKey(),CommonSysConst.getSysConfig().getJDAppSecret());

@ -1,5 +1,7 @@
package com.hfkj.jd;
import com.hfkj.entity.GoodsMsg;
public interface JdService {
/**
@ -22,4 +24,13 @@ public interface JdService {
* @Date: 2024/10/16 下午3:21
*/
void getGoodsJd() throws Exception;
/**
* @MethodName checkSkuSale
* @Description: 校验商品可售性
* @param goodsMsg
* @Author: Sum1Dream
* @Date: 2024/11/22 下午2:01
*/
Boolean checkSkuSale(GoodsMsg goodsMsg) throws Exception;
}

@ -56,6 +56,16 @@ public interface GoodsSpecsService {
GoodsSpecs queryDetailByGoodsId(Long id);
/**
* @MethodName queryDetailByThirdId
* @Description: 根据第三方id查询
* @param thirdId
* @return: com.hfkj.entity.GoodsSpecs
* @Author: Sum1Dream
* @Date: 2024/11/22 下午2:34
*/
GoodsSpecs queryDetailByThirdId(String thirdId);
/**
* @Author Sum1Dream
* @Name queryDetailByMap

@ -98,6 +98,9 @@ public class GoodsMsgServiceImpl implements GoodsMsgService {
if (MapUtils.getInteger(map, "type") != null) {
criteria.andTypeEqualTo(MapUtils.getInteger(map, "type"));
}
if (MapUtils.getInteger(map, "childType") != null) {
criteria.andChildTypeEqualTo(MapUtils.getInteger(map, "childType"));
}
if (MapUtils.getLong(map, "goodsBrand") != null) {
criteria.andGoodsBrandEqualTo(MapUtils.getLong(map, "goodsBrand"));
}

@ -77,6 +77,13 @@ public class GoodsSpecsServiceImpl implements GoodsSpecsService {
return null;
}
@Override
public GoodsSpecs queryDetailByThirdId(String thirdId) {
GoodsSpecsExample goodsSpecsExample = new GoodsSpecsExample();
goodsSpecsExample.createCriteria().andThirdIdEqualTo(thirdId);
return null;
}
@Override
public GoodsSpecs queryDetailByMap(Map<String, Object> map) {
return null;

@ -282,7 +282,6 @@ public class OrderCreateService {
jsonObject.put("goodsJump", goodsJump);
// 创建实物订单
orderGoods.setOrderNo(orderChild.getOrderNo());
orderGoods.setChildOrderNo(orderChild.getChildOrderNo());
orderGoods.setMerId(orderChild.getMerId());
@ -302,7 +301,7 @@ public class OrderCreateService {
orderGoods.setGoodsSpecsOriginalPrice(goodsSpecs.getOriginalPrice());
orderGoods.setGoodsCount(orderChild.getProductCount());
orderGoods.setStatus(orderChild.getStatus());
orderGoods.setDeliveryAddress(address.getAddress());
orderGoods.setDeliveryAddress(address.getRegionName() + "-" + address.getAddress() + "-" + address.getConsignee() + "-" + address.getPhone());
orderGoods.setDeliveryAddressId(address.getId());
orderGoods.setCreateTime(new Date());
orderGoods.setUpdateTime(new Date());

Loading…
Cancel
Save