feat: bug-332 荣誉发布、视频、图片、资料的发布需要可以批量发布的功能
This commit is contained in:
parent
fa853a2eb6
commit
6ca0d589e4
|
|
@ -152,17 +152,15 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(BatchPublishRequest request) {
|
||||||
List<ProductCase> list = listByIds(request.getIds());
|
List<ProductCase> list = listByIds(request.getIds());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductCase::getTitle).collect(Collectors.toList());
|
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
|
||||||
.throwMessage("以下案例不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
|
||||||
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
||||||
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductCase::getTitle).collect(Collectors.toList());
|
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductCase::getTitle).collect(Collectors.toList());
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下案例被禁用不能发布:" + StrUtil.join(",", names));
|
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下案例被禁用不能发布:" + StrUtil.join(",", names));
|
||||||
}
|
}
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
list.forEach(it -> publish(it, request.getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish(ProductCase info, Integer state) {
|
private void publish(ProductCase info, Integer state) {
|
||||||
|
if (Objects.equals(state, info.getState())) return;
|
||||||
if (Objects.equals(state, PublishState.Published.getState())) {
|
if (Objects.equals(state, PublishState.Published.getState())) {
|
||||||
info.setState(PublishState.Published.getState());
|
info.setState(PublishState.Published.getState());
|
||||||
info.setPublishBy(AdminUserUtil.getUserName());
|
info.setPublishBy(AdminUserUtil.getUserName());
|
||||||
|
|
|
||||||
|
|
@ -111,17 +111,15 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(BatchPublishRequest request) {
|
||||||
List<ProductHonor> list = listByIds(request.getIds());
|
List<ProductHonor> list = listByIds(request.getIds());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductHonor::getTitle).collect(Collectors.toList());
|
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
|
||||||
.throwMessage("以下荣誉不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
|
||||||
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
||||||
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductHonor::getTitle).collect(Collectors.toList());
|
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductHonor::getTitle).collect(Collectors.toList());
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下荣誉被禁用不能发布:" + StrUtil.join(",", names));
|
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下荣誉被禁用不能发布:" + StrUtil.join(",", names));
|
||||||
}
|
}
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
list.forEach(it -> publish(it, request.getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish(ProductHonor info, Integer state) {
|
private void publish(ProductHonor info, Integer state) {
|
||||||
|
if (Objects.equals(state, info.getState())) return;
|
||||||
if (Objects.equals(state, PublishState.Published.getState())) {
|
if (Objects.equals(state, PublishState.Published.getState())) {
|
||||||
info.setState(PublishState.Published.getState());
|
info.setState(PublishState.Published.getState());
|
||||||
info.setPublishBy(AdminUserUtil.getUserName());
|
info.setPublishBy(AdminUserUtil.getUserName());
|
||||||
|
|
|
||||||
|
|
@ -93,17 +93,15 @@ public class ProductModelImageServiceImpl extends ServiceImpl<ProductModelImageM
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(BatchPublishRequest request) {
|
||||||
List<ProductModelImage> list = listByIds(request.getIds());
|
List<ProductModelImage> list = listByIds(request.getIds());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductModelImage::getName).collect(Collectors.toList());
|
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
|
||||||
.throwMessage("以下图片不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
|
||||||
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
||||||
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelImage::getName).collect(Collectors.toList());
|
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelImage::getName).collect(Collectors.toList());
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下图片被禁用不能发布:" + StrUtil.join(",", names));
|
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下图片被禁用不能发布:" + StrUtil.join(",", names));
|
||||||
}
|
}
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
list.forEach(it -> publish(it, request.getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish(ProductModelImage info, Integer state) {
|
private void publish(ProductModelImage info, Integer state) {
|
||||||
|
if (Objects.equals(state, info.getState())) return;
|
||||||
if (Objects.equals(state, PublishState.Published.getState())) {
|
if (Objects.equals(state, PublishState.Published.getState())) {
|
||||||
VUtils.trueThrowBusinessError(!info.getEnable()).throwMessage("不能发布已禁用的数据");
|
VUtils.trueThrowBusinessError(!info.getEnable()).throwMessage("不能发布已禁用的数据");
|
||||||
info.setState(PublishState.Published.getState());
|
info.setState(PublishState.Published.getState());
|
||||||
|
|
|
||||||
|
|
@ -114,17 +114,15 @@ public class ProductModelVideoServiceImpl extends ServiceImpl<ProductModelVideoM
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(BatchPublishRequest request) {
|
||||||
List<ProductModelVideo> list = listByIds(request.getIds());
|
List<ProductModelVideo> list = listByIds(request.getIds());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductModelVideo::getName).collect(Collectors.toList());
|
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
|
||||||
.throwMessage("以下视频不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
|
||||||
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
if (Objects.equals(request.getState(), PublishState.Published.getState())) {
|
||||||
names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelVideo::getName).collect(Collectors.toList());
|
List<String> names = list.stream().filter(ph -> !ph.getEnable()).map(ProductModelVideo::getName).collect(Collectors.toList());
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下视频被禁用不能发布:" + StrUtil.join(",", names));
|
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下视频被禁用不能发布:" + StrUtil.join(",", names));
|
||||||
}
|
}
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
list.forEach(it -> publish(it, request.getState()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void publish(ProductModelVideo info, Integer state) {
|
private void publish(ProductModelVideo info, Integer state) {
|
||||||
|
if (Objects.equals(state, info.getState())) return;
|
||||||
if (Objects.equals(state, PublishState.Published.getState())) {
|
if (Objects.equals(state, PublishState.Published.getState())) {
|
||||||
info.setState(PublishState.Published.getState());
|
info.setState(PublishState.Published.getState());
|
||||||
info.setPublishBy(AdminUserUtil.getUserName());
|
info.setPublishBy(AdminUserUtil.getUserName());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue