Merge remote-tracking branch 'origin/master'
commit
c933eb9b29
@ -0,0 +1,14 @@
|
||||
package com.ms.api.dto.move;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* 获取添加铺货单参数
|
||||
*/
|
||||
@Data
|
||||
public class AddMoveProductItemRequestDTO {
|
||||
/**
|
||||
* 商品ID
|
||||
*/
|
||||
private String productId;
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.ms.api.dto.move;
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* 删除铺货单参数
|
||||
*/
|
||||
@Data
|
||||
public class DeleteMoveProductItemRequestDTO {
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String id;
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package com.ms.api.dto.move;
|
||||
|
||||
import com.ms.api.common.PageOption;
|
||||
import lombok.Data;
|
||||
@Data
|
||||
public class SearchMoveProductItemRequestDTO extends PageOption {
|
||||
private Long shopId;
|
||||
}
|
@ -1,4 +1,68 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
public class AddMoveProductItemService {
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.common.Ret;
|
||||
import com.ms.api.common.SPIBaseService;
|
||||
import com.ms.api.dto.auth.MemberAuthCallBackRequestDTO;
|
||||
import com.ms.api.dto.move.AddMoveProductItemRequestDTO;
|
||||
import com.ms.api.service.MicroMoveProductItemService;
|
||||
import com.ms.api.service.Shop1688DsAuthService;
|
||||
import com.ms.api.tool.CommonTool;
|
||||
import com.ms.api.tool.DsJsonRequestTemplate;
|
||||
import com.ms.dal.entity.MicroMoveProductItem;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 添加铺货单
|
||||
*
|
||||
*/
|
||||
|
||||
@ExtensionService("memberAuthCallBack")
|
||||
@Slf4j
|
||||
public class AddMoveProductItemService extends SPIBaseService implements ExtensionServiceHandler<AddMoveProductItemRequestDTO, Ret> {
|
||||
@Autowired
|
||||
private MicroMoveProductItemService microMoveProductItemService;
|
||||
@Autowired
|
||||
private DsJsonRequestTemplate dsJsonRequestTemplate;
|
||||
@Override
|
||||
public BaseResponse<Ret> handle(BaseRequest<AddMoveProductItemRequestDTO> req) {
|
||||
initHandle(req);
|
||||
getAuthCode();
|
||||
|
||||
AddMoveProductItemRequestDTO fields = req.getData();
|
||||
MicroMoveProductItem microMoveProductItem = new MicroMoveProductItem();
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("productId",fields.getProductId());
|
||||
params.put("authCode",authCode);
|
||||
String res = null;
|
||||
JSONObject resObj = null;
|
||||
try {
|
||||
res = dsJsonRequestTemplate.execute("/micro_move/get_product_info", params);
|
||||
resObj = JSON.parseObject(res);
|
||||
JSONObject productInfo = resObj.getJSONObject("productInfo");
|
||||
microMoveProductItem.setProductId(Long.valueOf(fields.getProductId()));
|
||||
microMoveProductItem.setProductImgUrls(productInfo.getJSONArray("productImgUrls").toJSONString());
|
||||
microMoveProductItem.setSkuMap(productInfo.getJSONObject("skuMap").toJSONString());
|
||||
microMoveProductItem.setShopId(shopId);
|
||||
microMoveProductItem.setTitle(productInfo.getString("title"));
|
||||
microMoveProductItemService.insert(microMoveProductItem);
|
||||
|
||||
log.info(res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
// ----结果返回----
|
||||
return R.ok(Ret.success());
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,37 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
public class DeleteProductItemService {
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.common.Ret;
|
||||
import com.ms.api.common.SPIBaseService;
|
||||
import com.ms.api.dto.move.AddMoveProductItemRequestDTO;
|
||||
import com.ms.api.dto.move.DeleteMoveProductItemRequestDTO;
|
||||
import com.ms.api.service.MicroMoveProductItemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 删除铺货单
|
||||
*
|
||||
*/
|
||||
@ExtensionService("deleteProductItem")
|
||||
@Slf4j
|
||||
public class DeleteProductItemService extends SPIBaseService implements ExtensionServiceHandler<DeleteMoveProductItemRequestDTO, Ret> {
|
||||
@Autowired
|
||||
private MicroMoveProductItemService microMoveProductItemService;
|
||||
@Override
|
||||
public BaseResponse<Ret> handle(BaseRequest<DeleteMoveProductItemRequestDTO> req) {
|
||||
DeleteMoveProductItemRequestDTO fields = req.getData();
|
||||
int count = microMoveProductItemService.deleteByPrimaryKey(Long.valueOf(fields.getId()));
|
||||
if (count > 0) {
|
||||
// ----结果返回----
|
||||
return R.ok(Ret.success());
|
||||
} else {
|
||||
// ----结果返回----
|
||||
return R.ok(Ret.fail("删除失败"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,39 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.common.Ret;
|
||||
import com.ms.api.common.SPIBaseService;
|
||||
import com.ms.api.dto.move.AddMoveProductItemRequestDTO;
|
||||
import com.ms.api.dto.move.SearchMoveProductItemRequestDTO;
|
||||
import com.ms.api.service.MicroMoveProductItemService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 获取铺货单数量
|
||||
*/
|
||||
|
||||
@ExtensionService("getMoveProductItemCount")
|
||||
@Slf4j
|
||||
public class GetMoveProductItemCountService extends SPIBaseService implements ExtensionServiceHandler<SearchMoveProductItemRequestDTO, Ret> {
|
||||
@Autowired
|
||||
private MicroMoveProductItemService microMoveProductItemService;
|
||||
@Override
|
||||
public BaseResponse<Ret> handle(BaseRequest<SearchMoveProductItemRequestDTO> req) {
|
||||
initHandle(req);
|
||||
|
||||
int count = microMoveProductItemService.getMoveProductItemCount(shopId);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("count", count);
|
||||
// ----结果返回----
|
||||
return R.ok(Ret.success(result));
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.common.Pager;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.common.Ret;
|
||||
import com.ms.api.common.SPIBaseService;
|
||||
import com.ms.api.dto.move.SearchMoveProductItemRequestDTO;
|
||||
import com.ms.api.service.MicroMoveProductItemService;
|
||||
import com.ms.dal.entity.MicroMoveProductItem;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 获取铺货单列表
|
||||
*/
|
||||
@ExtensionService("getMoveProductItemList")
|
||||
@Slf4j
|
||||
public class GetMoveProductItemListService extends SPIBaseService implements ExtensionServiceHandler<SearchMoveProductItemRequestDTO, Ret> {
|
||||
@Autowired
|
||||
private MicroMoveProductItemService microMoveProductItemService;
|
||||
public BaseResponse<Ret> handle(BaseRequest<SearchMoveProductItemRequestDTO> req) {
|
||||
SearchMoveProductItemRequestDTO requestDTO = req.getData();
|
||||
|
||||
// 查询出micro_move_product_item中的相关数据列表
|
||||
SearchMoveProductItemRequestDTO condition = new SearchMoveProductItemRequestDTO();
|
||||
condition.setShopId(shopId);
|
||||
condition.setPage(requestDTO.getPage());
|
||||
condition.setPageSize(requestDTO.getPageSize());
|
||||
Pager<MicroMoveProductItem> productToDsItemPager = microMoveProductItemService.getMoveProductItemList(condition);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", productToDsItemPager.getData());
|
||||
result.put("total", productToDsItemPager.getTotal());
|
||||
result.put("page", productToDsItemPager.getPage());
|
||||
result.put("pageSize", productToDsItemPager.getPageSize());
|
||||
// ----结果返回----
|
||||
return R.ok(Ret.success(result));
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
public class getMoceProductItemCountService {
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
package com.ms.api.spi.move;
|
||||
|
||||
public class getMoveProductItemService {
|
||||
}
|
Loading…
Reference in New Issue