启动报错

This commit is contained in:
fengtianyangyang
2022-08-09 20:26:40 +08:00
parent 26dd8ed13a
commit 05f29a264e
15 changed files with 117 additions and 277 deletions

View File

@@ -178,107 +178,4 @@ public class GoodsStoreController {
return ResultUtil.success();
}
@ApiOperation(value = "新增商品(minShengLotteryRecordService商品迁移")
@PostMapping(value = "/fuluCreate")
public ResultMessage<GoodsOperationDTO> fuluSave() throws Exception {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
GoodsOperationFuLuDTO goodsOperationDTO = new GoodsOperationFuLuDTO();
FuLuConfigureDTO fuLuConfigureDTO = storeDetailService.getFuLuConfigureDTO();
//获取并解析福禄商品数据
Map maps = (Map) JSON.parse(Test.getGoodsInfoList(fuLuConfigureDTO));
if (!maps.get("code").toString().equals("0")) {
return ResultUtil.error(201, "商品不存在或配置参数错误");
}
int i = 0;
List<Map<String, String>> listObjectSec = JSONArray.parseObject(maps.get("result").toString(), List.class);
for (Map<String, String> mapList : listObjectSec) {
if (listObjectSec.size() <= 0) {
break;
}
for (Map.Entry entry : mapList.entrySet()) {
if (entry.getKey().equals("product_id")) {
Map map1 = (Map) JSON.parse(Test.productInfoGetTest(fuLuConfigureDTO, entry.getValue().toString()).get("result").toString());
if (map1.get("product_type").toString().equals("直充")) {
goodsOperationDTO.setCategoryPath("1496301573515636737");//分类path
} else if (map1.get("product_type").toString().equals("卡密")) {
goodsOperationDTO.setCategoryPath("1496301573515636737");//分类path
} else {
//不是直充也不是卡密需要修改代码
continue;
}
List<Goods> goodsList = goodsService.list(
new LambdaQueryWrapper<Goods>()
.eq(Goods::getStoreId, storeId)
.eq(Goods::getSn, map1.get("product_id").toString())
.eq(Goods::getDeleteFlag, false)
);
goodsOperationDTO.setStoreCategoryPath("");//店铺分类id
goodsOperationDTO.setBrandId("1496301301183672321");//品牌ID
goodsOperationDTO.setGoodsName(map1.get("product_name").toString());//商品名称
goodsOperationDTO.setSn(map1.get("product_id").toString());//商品编号
goodsOperationDTO.setPrice(Double.valueOf(map1.get("purchase_price").toString()));//商品价格
goodsOperationDTO.setCost(Double.valueOf(map1.get("purchase_price").toString()));//市场价格
goodsOperationDTO.setWeight(Double.valueOf("0"));//重量
goodsOperationDTO.setIntro(map1.get("product_name").toString());//详情
goodsOperationDTO.setMobileIntro(map1.get("product_name").toString());//移动端详情
goodsOperationDTO.setQuantity(99999999);//库存
goodsOperationDTO.setRelease(true);//是否立即发布
goodsOperationDTO.setRecommend(true);//是否是推荐商品
goodsOperationDTO.setGoodsParamsDTOList(new ArrayList<>());//商品参数
List<String> goodsGalleryList = new ArrayList<>();
if (map1.containsKey("four_category_icon") && map1.get("four_category_icon") != null) {
goodsGalleryList.add(map1.get("four_category_icon").toString());
}
goodsOperationDTO.setGoodsGalleryList(goodsGalleryList);
goodsOperationDTO.setTemplateId("0");//运费模板id,不需要运费模板时值是0
goodsOperationDTO.setSellingPoint(map1.get("product_name").toString());
goodsOperationDTO.setSalesModel("RETAIL");//销售模式
// goodsOperationDTO.setHaveSpec();//是否有规格
goodsOperationDTO.setGoodsUnit("");//销售模式1471044596808024065
goodsOperationDTO.setInfo(map1.get("product_name").toString());//商品描述
goodsOperationDTO.setGoodsType("VIRTUAL_GOODS");//商品类型
// goodsOperationDTO.setGoodsVideo();//商品视频
List<Map<String, Object>> mapArrayList = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
map.put("sn", goodsOperationDTO.getSn());
map.put("price", goodsOperationDTO.getPrice());
map.put("cost", goodsOperationDTO.getCost());
map.put("weight", goodsOperationDTO.getWeight());
map.put("quantity", goodsOperationDTO.getQuantity());
map.put("category_path", "1496301573515636737");
if (map1.containsKey("four_category_icon") && map1.get("four_category_icon") != null) {
List<Map<String, String>> images = new ArrayList<>();
Map<String, String> map2 = new HashMap<>();
map2.put("url", map1.get("four_category_icon").toString());
images.add(map2);
map.put("images", images);
}
mapArrayList.add(map);
goodsOperationDTO.setSkuList(mapArrayList);//sku列表
if (goodsList.size() > 0) {
goodsService.fuLuEditGoods(goodsOperationDTO, goodsList.get(0).getId());
} else {
goodsService.fuLuAddGoods(goodsOperationDTO);
}
i += 1;
break;
}
if (i == 1) {
break;
}
}
}
return ResultUtil.success();
}
}