|
@@ -1,7 +1,17 @@
|
|
package com.yonge.cooleshow.portal.controller.open;
|
|
package com.yonge.cooleshow.portal.controller.open;
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
|
+import com.baomidou.mybatisplus.extension.api.R;
|
|
|
|
+import com.baomidou.mybatisplus.extension.enums.ApiErrorCode;
|
|
import com.ym.mec.common.controller.BaseController;
|
|
import com.ym.mec.common.controller.BaseController;
|
|
|
|
+import com.yonge.cooleshow.mall.common.api.CommonPage;
|
|
import com.yonge.cooleshow.mall.common.api.CommonResult;
|
|
import com.yonge.cooleshow.mall.common.api.CommonResult;
|
|
|
|
+import com.yonge.cooleshow.mbg.model.PmsProduct;
|
|
|
|
+import com.yonge.cooleshow.portal.domain.OmsOrderDetail;
|
|
|
|
+import com.yonge.cooleshow.portal.domain.PmsPortalProductDetail;
|
|
|
|
+import com.yonge.cooleshow.portal.dto.ProductSearch;
|
|
|
|
+import com.yonge.cooleshow.portal.dto.ProductSearchConditionVo;
|
|
import com.yonge.cooleshow.portal.dto.StockOperateModel;
|
|
import com.yonge.cooleshow.portal.dto.StockOperateModel;
|
|
import com.yonge.cooleshow.portal.service.OmsPortalOrderService;
|
|
import com.yonge.cooleshow.portal.service.OmsPortalOrderService;
|
|
import com.yonge.cooleshow.portal.service.PmsPortalProductService;
|
|
import com.yonge.cooleshow.portal.service.PmsPortalProductService;
|
|
@@ -10,9 +20,12 @@ import io.swagger.annotations.ApiOperation;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.http.MediaType;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequestMapping("/open")
|
|
@RequestMapping("/open")
|
|
@@ -26,26 +39,6 @@ public class OpenShareController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private OmsPortalOrderService portalOrderService;
|
|
private OmsPortalOrderService portalOrderService;
|
|
|
|
|
|
-
|
|
|
|
- // @ApiOperation(value = "老师商品分享分润")
|
|
|
|
- // @PostMapping(value="/productProfit")
|
|
|
|
- // @ResponseBody
|
|
|
|
- // public CommonResult<ShareProductVo> shareProductProfit(@RequestBody ShareProfitParam param) {
|
|
|
|
- // SysUser sysUser = sysUserFeignService.queryUserById(param.getUserId());
|
|
|
|
- // if (sysUser == null || sysUser.getId() == null) {
|
|
|
|
- // return CommonResult.failed("用户信息获取失败");
|
|
|
|
- // }
|
|
|
|
- // HttpResponseResult<String> client = sysUserFeignService.client();
|
|
|
|
- // if (client.getStatus()) {
|
|
|
|
- // if (!StringUtil.isEmpty(client.getData()) && "teacher".equals(client.getData())) {
|
|
|
|
- // return CommonResult.success(portalProductService.shareProductProfit(sysUser, param.getBizId()));
|
|
|
|
- // }
|
|
|
|
- // } else {
|
|
|
|
- // return CommonResult.success(portalProductService.shareProductProfit(sysUser, param.getBizId()));
|
|
|
|
- // }
|
|
|
|
- // return CommonResult.failed("分享功能暂未开放");
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
@ApiOperation(value = "同步库存")
|
|
@ApiOperation(value = "同步库存")
|
|
@PostMapping(value="/updateStock/{stockType}")
|
|
@PostMapping(value="/updateStock/{stockType}")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@@ -55,5 +48,84 @@ public class OpenShareController extends BaseController {
|
|
return CommonResult.success("");
|
|
return CommonResult.success("");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "综合搜索、筛选、排序")
|
|
|
|
+ @RequestMapping(value = "/product/search", method = RequestMethod.POST)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public CommonResult<CommonPage<PmsProduct>> search(@RequestBody ProductSearch search) {
|
|
|
|
+ List<PmsProduct> productList = portalProductService.search(search.getKeyword(),search.getBrandId(),search.getProductCategoryId(),
|
|
|
|
+ search.getProductAttributeCategoryId(), search.getPageNum(), search.getPageSize(), search.getSort());
|
|
|
|
+ return CommonResult.success(CommonPage.restPage(productList));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取商品列表下拉条件")
|
|
|
|
+ @RequestMapping(value = "/search/condition", method = RequestMethod.GET)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public CommonResult<ProductSearchConditionVo> searchCondition() {
|
|
|
|
+ ProductSearchConditionVo list = portalProductService.searchCondition();
|
|
|
|
+ return CommonResult.success(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("获取前台商品详情")
|
|
|
|
+ @RequestMapping(value = "/product/detail/{id}", method = RequestMethod.GET)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public CommonResult<PmsPortalProductDetail> detail(@PathVariable Long id) {
|
|
|
|
+ PmsPortalProductDetail productDetail = portalProductService.detail(id);
|
|
|
|
+ return CommonResult.success(productDetail);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping(value = "/product/queryNameMap", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
+ public CommonResult<Map<Long,String>> queryNameMap(@RequestBody List<Long> goodsIds) {
|
|
|
|
+ return CommonResult.success(portalProductService.queryNameMap(goodsIds));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 商品库存查询
|
|
|
|
+ * @param goodsSkuId 商品存储Id
|
|
|
|
+ * @return String
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/product/stocks/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
+ public R<Integer> productStocks(@PathVariable(name = "id") Long goodsSkuId) {
|
|
|
|
+ log.info("商品库存查询 skuId:{}",goodsSkuId);
|
|
|
|
+ return R.ok(portalProductService.getStockBySkuId(goodsSkuId));
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询商品订单状态
|
|
|
|
+ * @param orderNo 订单编号
|
|
|
|
+ * @return String
|
|
|
|
+ */
|
|
|
|
+ @GetMapping(value = "/product/orderStatus/{id}", consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
|
+ public R<Boolean> productOrderStatus(@PathVariable(name = "id") String orderNo){
|
|
|
|
+ log.info("查询商品订单状态:{}",orderNo);
|
|
|
|
+ OmsOrderDetail detail = portalOrderService.detail(orderNo);
|
|
|
|
+
|
|
|
|
+ return R.restResult(detail.getStatus().equals(1), ApiErrorCode.SUCCESS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value = "快递信息回调")
|
|
|
|
+ @PostMapping(value="/courierCallback", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public Object courierCallback( String param) {
|
|
|
|
+ log.info("快递信息回调:{}",param);
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(param);
|
|
|
|
+ String data = jsonObject.getString("lastResult");
|
|
|
|
+ CourierInfo courierInfos = courierService.getCourierInfos(data);
|
|
|
|
+
|
|
|
|
+ // 保存快递信息
|
|
|
|
+ orderCourierService.updateCourierInfo(courierInfos);
|
|
|
|
+ Map<String,Object> result = new HashMap<>();
|
|
|
|
+ result.put("result",true);
|
|
|
|
+ result.put("returnCode","200");
|
|
|
|
+ result.put("message","成功");
|
|
|
|
+
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
}
|
|
}
|