Merge remote-tracking branch 'origin/master'

20230922-ljl-fixBug
daixiaogang 1 year ago
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,6 +1,9 @@
package com.ms.api.service;
import com.ms.api.common.Pager;
import com.ms.api.dto.move.SearchMoveProductItemRequestDTO;
import com.ms.dal.entity.MicroMoveProductItem;
import com.ms.dal.entity.ProductToDsItem;
/**
*
@ -18,4 +21,10 @@ public interface MicroMoveProductItemService {
int updateByPrimaryKeySelective(MicroMoveProductItem record);
int updateByPrimaryKey(MicroMoveProductItem record);
MicroMoveProductItem getDetailByShopId(Long shopId);
Pager<MicroMoveProductItem> getMoveProductItemList(SearchMoveProductItemRequestDTO condition);
int getMoveProductItemCount(Long shopId);
}

@ -1,11 +1,15 @@
package com.ms.api.service.impl;
import com.ms.api.common.Pager;
import com.ms.api.dto.move.SearchMoveProductItemRequestDTO;
import com.ms.api.service.MicroMoveProductItemService;
import com.ms.dal.entity.MicroMoveProductItem;
import com.ms.dal.mapper.MicroMoveProductItemMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
@ -46,6 +50,28 @@ public class MicroMoveProductItemServiceImpl implements MicroMoveProductItemServ
return microMoveProductItemMapper.updateByPrimaryKey(record);
}
@Override
public MicroMoveProductItem getDetailByShopId(Long shopId) {
return microMoveProductItemMapper.getDetailByShopId(shopId);
}
@Override
public Pager<MicroMoveProductItem> getMoveProductItemList(SearchMoveProductItemRequestDTO condition) {
List<MicroMoveProductItem> list = microMoveProductItemMapper.getMoveProductItemList(condition.getShopId(), condition.getPageStart(), condition.getPageSize());
Integer count = microMoveProductItemMapper.getMoveProductItemCount(condition.getShopId());
Pager<MicroMoveProductItem> pager = new Pager<>();
pager.setTotal(count);
pager.setData(list);
pager.setPage(condition.getPage());
pager.setPageSize(condition.getPageSize());
return pager;
}
@Override
public int getMoveProductItemCount(Long shopId) {
return microMoveProductItemMapper.getMoveProductItemCount(shopId);
}
}

@ -32,7 +32,7 @@ import java.util.Objects;
/**
* 1688
*/
@ExtensionService("memberAuthCallBack")
@ExtensionService("addMoveProdectItem")
@Slf4j
public class MemberAuthCallback extends SPIBaseService implements ExtensionServiceHandler<MemberAuthCallBackRequestDTO, Ret> {
@Autowired

@ -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 {
}

@ -68,7 +68,28 @@ public class SearchChooseSourceProductListService extends SPIBaseService impleme
ret.put("total", productToDsItemPager.getTotal());
ret.put("page", productToDsItemPager.getPage());
ret.put("pageSize", productToDsItemPager.getPageSize());
if (productToDsItemPager.getTotal()==0) {
ret = new HashMap();
List<ChooseSourceProductDTO> list = new ArrayList<>();
ChooseSourceProductDTO dto1 = new ChooseSourceProductDTO();
ChooseSourceProductDTO dto2 = new ChooseSourceProductDTO();
dto1.setName("开发商品名字11111");
dto1.setProductId("911111111");
dto1.setPrice(99.99);
dto1.setStatus(0L);
dto1.setImg("https://cbu01.alicdn.com/img/ibank/O1CN01XQ4vkl1V78Qnhpvxl_!!939772605-0-cib.jpg");
dto1.setName("开发商品名字2");
dto2.setProductId("9222222");
dto2.setPrice(81.0);
dto2.setStatus(0L);
dto2.setImg("https://cbu01.alicdn.com/img/ibank/O1CN01XQ4vkl1V78Qnhpvxl_!!939772605-0-cib.jpg");
list.add(dto1);
list.add(dto2);
ret.put("productList", list);
ret.put("total", 2);
ret.put("page", productToDsItemPager.getPage());
ret.put("pageSize", productToDsItemPager.getPageSize());
}
return R.ok(Ret.success(ret));
}
}

@ -59,6 +59,7 @@ if (sourceSellersObject.size() == 0) {
b.put("sellerName", "开发人员的店2");
b.put("sellerIdMd5", "2234567890qwertyuio");
b.put("isEncryptLogisticsOrderSupportDouyin", 0);
sourceSellerList.add(a);
sourceSellerList.add(b);
}
JSONObject retObj = new JSONObject();

@ -3,6 +3,8 @@ package com.ms.dal.mapper;
import com.ms.dal.entity.MicroMoveProductItem;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Entity com.ms.dal.entity.MicroMoveProductItem
*/
@ -21,4 +23,10 @@ public interface MicroMoveProductItemMapper {
int updateByPrimaryKey(MicroMoveProductItem record);
MicroMoveProductItem getDetailByShopId(Long shopId);
List<MicroMoveProductItem> getMoveProductItemList(Long shopId, Integer page, Integer pageSize);
Integer getMoveProductItemCount(Long shopId);
}

@ -25,6 +25,13 @@
where distribution_order_id = #{distributionOrderId,jdbcType=BIGINT}
</select>
<select id="getDetailByShopId" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from micro_move_product_item
where shop_id = #{shopId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from micro_move_product_item
where distribution_order_id = #{distributionOrderId,jdbcType=BIGINT}
@ -88,4 +95,18 @@
sku_map = #{skuMap,jdbcType=VARCHAR}
where distribution_order_id = #{distributionOrderId,jdbcType=BIGINT}
</update>
<select id="getMoveProductItemList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from micro_move_product_item
where shop_id = #{shopId}
order by distribution_order_id desc
limit #{page},#{pageSize}
</select>
<select id="getMoveProductItemCount" resultType="java.lang.Integer">
select COUNT(distribution_order_id)
from micro_move_product_item
where shop_id = #{shopId}
</select>
</mapper>

Loading…
Cancel
Save