|
@@ -92,6 +92,7 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
|
|
|
|
@Override
|
|
|
public Result<Object> add(JSONObject data) throws IOException {
|
|
|
+ String result = "添加完成";
|
|
|
JSONArray list = data.getJSONArray("list");
|
|
|
if (Check.isNull(list) || list.size() == 0) {
|
|
|
return Result.error("缺少参数");
|
|
@@ -107,18 +108,24 @@ public class ProductMaterialServiceImpl extends ServiceImpl<ProductMaterialMappe
|
|
|
String videoUrl = trade.getString("videoUrl");
|
|
|
String signature = trade.getString("signature");
|
|
|
String uploaderId = trade.getString("uploaderId");
|
|
|
+ QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("product_id", entity.getProductId());
|
|
|
+ queryWrapper.eq("trade_name", tradeName).last("limit 1");
|
|
|
+ ProductMaterial one1 = this.getOne(queryWrapper);
|
|
|
+ if (!Check.isNull(one1)) {
|
|
|
+ entity.setStartMonth(one1.getStartMonth());
|
|
|
+ entity.setEndMonth(one1.getEndMonth());
|
|
|
+ result = "";
|
|
|
+ }
|
|
|
int count = 0;
|
|
|
if (Check.isNull(videoUrl)) {
|
|
|
- QueryWrapper<ProductMaterial> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("product_id", entity.getProductId());
|
|
|
- queryWrapper.eq("trade_name", tradeName);
|
|
|
- queryWrapper.isNull("video_url").last("limit 1");
|
|
|
+ queryWrapper.isNull("video_url");
|
|
|
ProductMaterial one = this.getOne(queryWrapper);
|
|
|
if (Check.isNull(one)) {
|
|
|
entity.setTradeName(tradeName);
|
|
|
lists.add(entity);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
if (Check.isNull(signature) && Check.isNull(uploaderId)) {
|
|
|
List<String> urls = Arrays.asList(videoUrl.split(","));
|
|
|
for (String url : urls) {
|