更新,BUG修改

This commit is contained in:
itheinjury@163.com
2022-03-02 15:17:06 +08:00
parent c62f31c387
commit a52b672e9b
78 changed files with 2499 additions and 178 deletions

View File

@@ -28,7 +28,7 @@ public class StoreApiApplication {
}
public static void main(String[] args) {
System.setProperty("rocketmq.client.logUseSlf4j","true");
System.setProperty("es.set.netty.runtime.available.processors", "false");
SpringApplication.run(StoreApiApplication.class, args);
}

View File

@@ -1,12 +1,14 @@
package cn.lili.controller.goods;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.fulu.core.utils.Test;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
import cn.lili.modules.goods.entity.dto.GoodsOperationFuLuDTO;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
@@ -16,7 +18,10 @@ import cn.lili.modules.goods.entity.vos.StockWarningVO;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.store.entity.dos.StoreDetail;
import cn.lili.modules.store.entity.dto.FuLuConfigureDTO;
import cn.lili.modules.store.service.StoreDetailService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
@@ -27,8 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -171,4 +175,113 @@ 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);
i += 1;
}
mapArrayList.add(map);
goodsOperationDTO.setSkuList(mapArrayList);//sku列表
if (goodsList.size() > 0) {
GoodsOperationDTO goodsOperationDTO1 = new GoodsOperationDTO();
goodsOperationDTO1.setPrice(Double.valueOf(map1.get("purchase_price").toString()));
goodsService.editGoods(goodsOperationDTO1, goodsList.get(0).getId());
}else{
goodsService.fuLuAddGoods(goodsOperationDTO);
}
break;
}
// if (i == 1) {
// break;
// }
}
}
return ResultUtil.success();
}
}

View File

@@ -3,6 +3,7 @@ package cn.lili.controller.settings;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dto.FuLuConfigureDTO;
import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO;
import cn.lili.modules.store.entity.dto.StoreSettingDTO;
import cn.lili.modules.store.entity.vos.StoreVO;
@@ -87,4 +88,19 @@ public class StoreSettingsController {
boolean result = storeDetailService.editStoreAfterSaleAddressDTO(storeAfterSaleAddressDTO);
return ResultUtil.data(result);
}
@ApiOperation(value = "获取商家福禄配置")
@GetMapping("/fuLuConfigure")
public ResultMessage<FuLuConfigureDTO> getFuLuConfigure() {
//获取当前登录商家内容
return ResultUtil.data(storeDetailService.getFuLuConfigureDTO());
}
@ApiOperation(value = "修改商家福禄配置")
@PutMapping("/fuLuConfigure")
public ResultMessage<Object> editFuLuConfigure(@Valid FuLuConfigureDTO fuLuConfigureDTO) {
//修改商家退货收件地址
boolean result = storeDetailService.editFuLuConfigureDTO(fuLuConfigureDTO);
return ResultUtil.data(result);
}
}