| | |
| | | Long tagId; |
| | | // 分类 |
| | | // 一级分类 |
| | | if (!Cools.isEmpty(excel.getPriClass()) && !Cools.isEmpty(excel.getSecClass())) { |
| | | if (!Cools.isEmpty(excel.getPriClass())) { |
| | | Tag priTag = tagService.selectByName(excel.getPriClass(), 2); |
| | | if (priTag == null) { |
| | | Tag top = tagService.getTop(); |
| | |
| | | throw new CoolException("保存一级分类失败"); |
| | | } |
| | | } |
| | | // 二级分类 |
| | | Tag secTag = tagService.selectByName(excel.getSecClass(), 3); |
| | | if (secTag == null) { |
| | | NodeUtils nodeUtils = new NodeUtils(); |
| | | nodeUtils.executePath(priTag.getId()); |
| | | secTag = new Tag( |
| | | null, // 编号 |
| | | excel.getSecClass(), // 名称 |
| | | priTag.getId(), // 父级 |
| | | priTag.getName(), // 父级名称 |
| | | nodeUtils.path.toString(), // 关联路径 |
| | | nodeUtils.pathName.toString(), // 关联路径名 |
| | | 0, // 类型 |
| | | null, // 负责人 |
| | | null, // 图片 |
| | | null, // 简要描述 |
| | | null, // 数量 |
| | | 3, // 等级 |
| | | null, // 排序 |
| | | 1, // 状态 |
| | | now, // 添加时间 |
| | | null, // 添加人员 |
| | | now, // 修改时间 |
| | | null, // 修改人员 |
| | | null // 备注 |
| | | ); |
| | | if (tagMapper.insert(secTag) == 0) { |
| | | throw new CoolException("保存二级分类失败"); |
| | | } |
| | | } |
| | | tagId = secTag.getId(); |
| | | } else { |
| | | // // 二级分类 |
| | | // Tag secTag = tagService.selectByName(excel.getSecClass(), 3); |
| | | // if (secTag == null) { |
| | | // NodeUtils nodeUtils = new NodeUtils(); |
| | | // nodeUtils.executePath(priTag.getId()); |
| | | // secTag = new Tag( |
| | | // null, // 编号 |
| | | // excel.getSecClass(), // 名称 |
| | | // priTag.getId(), // 父级 |
| | | // priTag.getName(), // 父级名称 |
| | | // nodeUtils.path.toString(), // 关联路径 |
| | | // nodeUtils.pathName.toString(), // 关联路径名 |
| | | // 0, // 类型 |
| | | // null, // 负责人 |
| | | // null, // 图片 |
| | | // null, // 简要描述 |
| | | // null, // 数量 |
| | | // 3, // 等级 |
| | | // null, // 排序 |
| | | // 1, // 状态 |
| | | // now, // 添加时间 |
| | | // null, // 添加人员 |
| | | // now, // 修改时间 |
| | | // null, // 修改人员 |
| | | // null // 备注 |
| | | // ); |
| | | // if (tagMapper.insert(secTag) == 0) { |
| | | // throw new CoolException("保存二级分类失败"); |
| | | // } |
| | | // } |
| | | tagId = priTag.getId(); |
| | | } |
| | | |
| | | else { |
| | | tagId = tagService.getTop().getId(); |
| | | } |
| | | // 商品 |