|  | @@ -19,6 +19,9 @@ import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  | +import java.util.concurrent.ExecutorService;
 | 
	
		
			
				|  |  | +import java.util.concurrent.Executors;
 | 
	
		
			
				|  |  | +import java.util.concurrent.TimeUnit;
 | 
	
		
			
				|  |  |  import java.util.stream.Collectors;
 | 
	
		
			
				|  |  |  import java.util.stream.IntStream;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -90,6 +93,7 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
 | 
	
		
			
				|  |  |                              .eq(ShopCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  |                      for (ShopCategory shopCategory1 : shopCategory) {
 | 
	
		
			
				|  |  |                          shopCategory1.setName(frontCategory.getName());
 | 
	
		
			
				|  |  | +                        shopCategory1.setNum(frontCategory.getNum());
 | 
	
		
			
				|  |  |                          shopCategoryMapper.updateById(shopCategory1);
 | 
	
		
			
				|  |  |                      }
 | 
	
		
			
				|  |  |                  }
 | 
	
	
		
			
				|  | @@ -111,7 +115,6 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
 | 
	
		
			
				|  |  |       * @return
 | 
	
		
			
				|  |  |       */
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    //添加事务
 | 
	
		
			
				|  |  |      @Transactional(rollbackFor = Exception.class)
 | 
	
		
			
				|  |  |      public void addShopCategory(FrontCategory frontCategory, Long shopId, Long hbShopId) {
 | 
	
		
			
				|  |  |          ShopCategory shopCategoryByCode = shopCategoryMapper.selectOne(new LambdaQueryWrapper<ShopCategory>()
 | 
	
	
		
			
				|  | @@ -134,7 +137,7 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
 | 
	
		
			
				|  |  |                      .eq(ShopCategory::getShopId, shopId)
 | 
	
		
			
				|  |  |                      .eq(ShopCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  |              if (shopCategoryByCode1 == null) {
 | 
	
		
			
				|  |  | -                //不存在父类目添加
 | 
	
		
			
				|  |  | +                //不存在门店分类父类目添加
 | 
	
		
			
				|  |  |                  FrontCategory frontCategoryParent = frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>()
 | 
	
		
			
				|  |  |                          .eq(FrontCategory::getCode, frontCategory.getParentCode())
 | 
	
		
			
				|  |  |                          .eq(FrontCategory::getIsDelete, 0));
 | 
	
	
		
			
				|  | @@ -161,7 +164,8 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public void sync(Long shopId, Long hbShopId) {
 | 
	
		
			
				|  |  |          List<FrontCategory> frontCategoryList = frontCategoryMapper.selectList(new LambdaQueryWrapper<FrontCategory>()
 | 
	
		
			
				|  |  | -        .eq(FrontCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  | +                .eq(FrontCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |          for (FrontCategory frontCategory : frontCategoryList) {
 | 
	
		
			
				|  |  |              addShopCategory(frontCategory, shopId, hbShopId);
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -185,34 +189,16 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
 | 
	
		
			
				|  |  |      public void deleteFrontCategory(JSONObject hbRequest) {
 | 
	
		
			
				|  |  |          JSONObject body = hbRequest.getJSONObject("body");
 | 
	
		
			
				|  |  |          JSONArray codeList = body.getJSONArray("codeList");
 | 
	
		
			
				|  |  | -        for (Object code : codeList) {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            log.info("前台类目删除,body:{}", code.toString());
 | 
	
		
			
				|  |  | -            FrontCategory frontCategory = frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>().eq(FrontCategory::getCode, Long.valueOf(code.toString())));
 | 
	
		
			
				|  |  | +        for (Object codeObject : codeList) {
 | 
	
		
			
				|  |  | +            String code = codeObject.toString();
 | 
	
		
			
				|  |  | +            log.info("前台类目删除,body:{}", code);
 | 
	
		
			
				|  |  | +            FrontCategory frontCategory = frontCategoryMapper.selectOne(new LambdaQueryWrapper<FrontCategory>().eq(FrontCategory::getCode, Long.valueOf(code)));
 | 
	
		
			
				|  |  | +            if(frontCategory == null){
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  |              frontCategory.setIsDelete(1);
 | 
	
		
			
				|  |  |              frontCategoryMapper.updateById(frontCategory);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            ShopCategory shopCategory = shopCategoryMapper.selectOne(new LambdaQueryWrapper<ShopCategory>()
 | 
	
		
			
				|  |  | -                    .eq(ShopCategory::getCode, frontCategory.getCode())
 | 
	
		
			
				|  |  | -                    .eq(ShopCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  | -            shopCategory.setIsDelete(1);
 | 
	
		
			
				|  |  | -            int i = shopCategoryMapper.updateById(shopCategory);
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            if (frontCategory.getLevel() == 1) {
 | 
	
		
			
				|  |  | -                frontCategoryMapper.deleteByParentCode(frontCategory.getCode());
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -            Integer integer = shopCategoryMapper.selectCount(new LambdaQueryWrapper<ShopCategory>()
 | 
	
		
			
				|  |  | -                    .eq(ShopCategory::getParentCode, shopCategory.getParentCode())
 | 
	
		
			
				|  |  | -                    .eq(ShopCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  | -            if (integer == 0) {
 | 
	
		
			
				|  |  | -                ShopCategory shopCategory1 = shopCategoryMapper.selectOne(new LambdaQueryWrapper<ShopCategory>()
 | 
	
		
			
				|  |  | -                        .eq(ShopCategory::getCode, shopCategory.getParentCode())
 | 
	
		
			
				|  |  | -                        .eq(ShopCategory::getIsDelete, 0));
 | 
	
		
			
				|  |  | -                shopCategory1.setIsLeaves(1);
 | 
	
		
			
				|  |  | -                shopCategoryMapper.updateById(shopCategory1);
 | 
	
		
			
				|  |  | -            }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +            shopCategoryMapper.deleteByCode(code);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |