|
@@ -14,6 +14,7 @@ import com.chelvc.cloud.vehicle.api.util.DateTimeUtils;
|
|
import com.chelvc.cloud.vehicle.server.copier.MerchantCopier;
|
|
import com.chelvc.cloud.vehicle.server.copier.MerchantCopier;
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantMapper;
|
|
import com.chelvc.cloud.vehicle.server.dao.MerchantMapper;
|
|
import com.chelvc.cloud.vehicle.server.dao.RegionMapper;
|
|
import com.chelvc.cloud.vehicle.server.dao.RegionMapper;
|
|
|
|
+import com.chelvc.cloud.vehicle.server.entity.Category;
|
|
import com.chelvc.cloud.vehicle.server.entity.Merchant;
|
|
import com.chelvc.cloud.vehicle.server.entity.Merchant;
|
|
import com.chelvc.cloud.vehicle.server.entity.Region;
|
|
import com.chelvc.cloud.vehicle.server.entity.Region;
|
|
import com.chelvc.cloud.vehicle.server.service.CategoryService;
|
|
import com.chelvc.cloud.vehicle.server.service.CategoryService;
|
|
@@ -34,6 +35,7 @@ import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.apache.dubbo.config.annotation.DubboService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.time.LocalTime;
|
|
import java.time.LocalTime;
|
|
@@ -148,6 +150,23 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
merchant.setSale(0);
|
|
merchant.setSale(0);
|
|
merchant.setStatus(MerchantStatus.ONLINE);
|
|
merchant.setStatus(MerchantStatus.ONLINE);
|
|
this.save(merchant);
|
|
this.save(merchant);
|
|
|
|
+ List<Long> business = param.getAncillaryBusiness();
|
|
|
|
+ if (StringUtils.notEmpty(param.getMainBusiness())){
|
|
|
|
+ business.add(param.getMainBusiness());
|
|
|
|
+ }
|
|
|
|
+// this.categoryService.removeByIds(business);
|
|
|
|
+ List<Category> categories = this.categoryService.getCategories(business);
|
|
|
|
+ if (!CollectionUtils.isEmpty(categories)){
|
|
|
|
+ categories.forEach(item ->{
|
|
|
|
+ item.setSourceId(item.getId());
|
|
|
|
+ item.setId(null);
|
|
|
|
+ item.setMerchantId(merchant.getId());
|
|
|
|
+ item.setType("1");
|
|
|
|
+ item.setParentId(0L);
|
|
|
|
+ this.categoryService.save(item);
|
|
|
|
+ });
|
|
|
|
+ // this.categoryService.saveBatchCategories(categories);
|
|
|
|
+ }
|
|
return merchant.getId();
|
|
return merchant.getId();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -156,6 +175,25 @@ public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> i
|
|
Merchant merchant = AssertUtils.available(this.getById(id), "商家不存在");
|
|
Merchant merchant = AssertUtils.available(this.getById(id), "商家不存在");
|
|
MerchantCopier.INSTANCE.copying(param, merchant);
|
|
MerchantCopier.INSTANCE.copying(param, merchant);
|
|
this.updateById(merchant);
|
|
this.updateById(merchant);
|
|
|
|
+ List<Long> business = param.getAncillaryBusiness();
|
|
|
|
+ if (StringUtils.notEmpty(param.getMainBusiness())){
|
|
|
|
+ business.add(param.getMainBusiness());
|
|
|
|
+ }
|
|
|
|
+// this.categoryService.removeByIds(business);
|
|
|
|
+ this.categoryService.deleteByMerchantId(merchant.getId());
|
|
|
|
+ List<Category> categories = this.categoryService.getCategories(business);
|
|
|
|
+ if (!CollectionUtils.isEmpty(categories)){
|
|
|
|
+ categories.forEach(item ->{
|
|
|
|
+ item.setSourceId(item.getId());
|
|
|
|
+ item.setId(null);
|
|
|
|
+ item.setMerchantId(merchant.getId());
|
|
|
|
+ item.setType("1");
|
|
|
|
+ item.setParentId(0L);
|
|
|
|
+// this.categoryService.save(item);
|
|
|
|
+ });
|
|
|
|
+ this.categoryService.saveBatchCategories(categories);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|