Compare commits
No commits in common. "32c8637573f4478c5d71c3fd1c3f052d4bb8eb99" and "776c8a8be32050412db7aaef08b522913b44c8e1" have entirely different histories.
32c8637573
...
776c8a8be3
|
|
@ -166,7 +166,7 @@ public class ProductBaseController extends ControllerBase{
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("/publishHonor")
|
@PostMapping("/publishHonor")
|
||||||
public ApiResult<Void> publishHonor(@Valid @RequestBody BatchPublishRequest request) {
|
public ApiResult<Void> publishHonor(@Valid @RequestBody ProductPublishRequest request){
|
||||||
productHonorService.publish(request);
|
productHonorService.publish(request);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -233,7 +233,7 @@ public class ProductBaseController extends ControllerBase{
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("/publishCase")
|
@PostMapping("/publishCase")
|
||||||
public ApiResult<Void> publishCase(@Valid @RequestBody BatchPublishRequest request) {
|
public ApiResult<Void> publishCase(@Valid @RequestBody ProductPublishRequest request){
|
||||||
productCaseService.publish(request);
|
productCaseService.publish(request);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@ public class ProductModelController extends ControllerBase{
|
||||||
@Resource
|
@Resource
|
||||||
private IProductModelParamsItemService productModelParamsItemService;
|
private IProductModelParamsItemService productModelParamsItemService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private IProductModelImageService productModelImageService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IProductModelVideoService productModelVideoService;
|
private IProductModelVideoService productModelVideoService;
|
||||||
|
|
||||||
|
|
@ -845,7 +848,7 @@ public class ProductModelController extends ControllerBase{
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("/publishVideo")
|
@PostMapping("/publishVideo")
|
||||||
public ApiResult<Void> publishVideo(@Valid @RequestBody BatchPublishRequest request) {
|
public ApiResult<Void> publishVideo(@Valid @RequestBody ProductPublishRequest request){
|
||||||
productModelVideoService.publish(request);
|
productModelVideoService.publish(request);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
@ -931,7 +934,7 @@ public class ProductModelController extends ControllerBase{
|
||||||
* @param request 请求参数
|
* @param request 请求参数
|
||||||
*/
|
*/
|
||||||
@PostMapping("/publishFile")
|
@PostMapping("/publishFile")
|
||||||
public ApiResult<Void> publishFile(@Valid @RequestBody BatchPublishRequest request) {
|
public ApiResult<Void> publishFile(@Valid @RequestBody ProductModelPublishRequest request) {
|
||||||
productModelFileService.publish(request);
|
productModelFileService.publish(request);
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
package com.nflg.mobilebroken.common.pojo.request;
|
package com.nflg.mobilebroken.common.pojo.request;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
import javax.validation.constraints.NotEmpty;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
public class ProductModelPublishRequest {
|
||||||
public class BatchPublishRequest {
|
|
||||||
|
|
||||||
@NotEmpty
|
@NotEmpty
|
||||||
private List<Integer> ids;
|
private List<Integer> ids;
|
||||||
|
|
@ -34,7 +34,7 @@ public interface IProductCaseService extends IService<ProductCase> {
|
||||||
|
|
||||||
void delete(@Valid BatchDeleteRequest request);
|
void delete(@Valid BatchDeleteRequest request);
|
||||||
|
|
||||||
void publish(@Valid BatchPublishRequest request);
|
void publish(@Valid ProductPublishRequest request);
|
||||||
|
|
||||||
ProductCaseInfoVO getInfo(@Valid @NotNull Integer caseId);
|
ProductCaseInfoVO getInfo(@Valid @NotNull Integer caseId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public interface IProductHonorService extends IService<ProductHonor> {
|
||||||
|
|
||||||
List<ProductHonorVO> get(String language);
|
List<ProductHonorVO> get(String language);
|
||||||
|
|
||||||
void publish(@Valid BatchPublishRequest request);
|
void publish(@Valid ProductPublishRequest request);
|
||||||
|
|
||||||
void delete(@Valid BatchDeleteRequest request);
|
void delete(@Valid BatchDeleteRequest request);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public interface IProductModelFileService extends IService<ProductModelFile> {
|
||||||
|
|
||||||
void delete(@Valid BatchDeleteRequest request);
|
void delete(@Valid BatchDeleteRequest request);
|
||||||
|
|
||||||
void publish(@Valid BatchPublishRequest request);
|
void publish(@Valid ProductModelPublishRequest request);
|
||||||
|
|
||||||
IPage<ProductModelFile> getList(@Valid ProductModelImageSearchRequest request);
|
IPage<ProductModelFile> getList(@Valid ProductModelImageSearchRequest request);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public interface IProductModelImageService extends IService<ProductModelImage> {
|
||||||
|
|
||||||
void delete(@Valid BatchDeleteRequest request);
|
void delete(@Valid BatchDeleteRequest request);
|
||||||
|
|
||||||
void publish(@Valid BatchPublishRequest request);
|
void publish(@Valid ProductPublishRequest request);
|
||||||
|
|
||||||
IPage<ProductModelImage> getList(@Valid ProductModelImageSearchRequest request);
|
IPage<ProductModelImage> getList(@Valid ProductModelImageSearchRequest request);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ public interface IProductModelVideoService extends IService<ProductModelVideo> {
|
||||||
|
|
||||||
void delete(@Valid BatchDeleteRequest request);
|
void delete(@Valid BatchDeleteRequest request);
|
||||||
|
|
||||||
void publish(@Valid BatchPublishRequest request);
|
void publish(@Valid ProductPublishRequest request);
|
||||||
|
|
||||||
IPage<ProductModelVideo> getList(@Valid ProductModelImageSearchRequest request);
|
IPage<ProductModelVideo> getList(@Valid ProductModelImageSearchRequest request);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
|
@ -29,7 +27,6 @@ import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -57,8 +54,8 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
|
||||||
.setCreateTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
save(entity);
|
save(entity);
|
||||||
if (request.getPublish()) {
|
if (request.getPublish()) {
|
||||||
publish(new BatchPublishRequest()
|
publish(new ProductPublishRequest()
|
||||||
.setIds(List.of(entity.getId()))
|
.setId(entity.getId())
|
||||||
.setState(PublishState.Published.getState()));
|
.setState(PublishState.Published.getState()));
|
||||||
}
|
}
|
||||||
productCaseInfoService.add(entity.getId(), request.getItems());
|
productCaseInfoService.add(entity.getId(), request.getItems());
|
||||||
|
|
@ -82,8 +79,8 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
|
||||||
info.setUpdateTime(LocalDateTime.now());
|
info.setUpdateTime(LocalDateTime.now());
|
||||||
updateById(info);
|
updateById(info);
|
||||||
if (request.getPublish()) {
|
if (request.getPublish()) {
|
||||||
publish(new BatchPublishRequest()
|
publish(new ProductPublishRequest()
|
||||||
.setIds(List.of(info.getId()))
|
.setId(info.getId())
|
||||||
.setState(PublishState.Published.getState()));
|
.setState(PublishState.Published.getState()));
|
||||||
}
|
}
|
||||||
productCaseInfoService.update(request.getItems());
|
productCaseInfoService.update(request.getItems());
|
||||||
|
|
@ -148,22 +145,14 @@ public class ProductCaseServiceImpl extends ServiceImpl<ProductCaseMapper, Produ
|
||||||
productCaseInfoService.delete(request.getIds());
|
productCaseInfoService.delete(request.getIds());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(ProductPublishRequest request) {
|
||||||
List<ProductCase> list = listByIds(request.getIds());
|
ProductCase info = getById(request.getId());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductCase::getTitle).collect(Collectors.toList());
|
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
VUtils.trueThrowBusinessError(Objects.equals(info.getState(), request.getState()))
|
||||||
.throwMessage("以下案例不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
.throwMessage("请勿重复操作");
|
||||||
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());
|
VUtils.trueThrowBusinessError(!info.getEnable()).throwMessage("不能发布已禁用的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下案例被禁用不能发布:" + StrUtil.join(",", names));
|
|
||||||
}
|
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void publish(ProductCase info, Integer state) {
|
|
||||||
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());
|
||||||
info.setPublishTime(LocalDateTime.now());
|
info.setPublishTime(LocalDateTime.now());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
@ -24,7 +23,6 @@ import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -57,8 +55,8 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
|
||||||
.setCreateTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
save(productHonor);
|
save(productHonor);
|
||||||
if (request.getPublish()) {
|
if (request.getPublish()) {
|
||||||
publish(new BatchPublishRequest()
|
publish(new ProductPublishRequest()
|
||||||
.setIds(List.of(productHonor.getId()))
|
.setId(productHonor.getId())
|
||||||
.setState(PublishState.Published.getState()));
|
.setState(PublishState.Published.getState()));
|
||||||
}
|
}
|
||||||
productHonorInfoService.add(productHonor.getId(), request.getItems());
|
productHonorInfoService.add(productHonor.getId(), request.getItems());
|
||||||
|
|
@ -88,8 +86,8 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
|
||||||
.eq(ProductHonor::getId, request.getId())
|
.eq(ProductHonor::getId, request.getId())
|
||||||
.update();
|
.update();
|
||||||
if (request.getPublish()) {
|
if (request.getPublish()) {
|
||||||
publish(new BatchPublishRequest()
|
publish(new ProductPublishRequest()
|
||||||
.setIds(List.of(request.getId()))
|
.setId(request.getId())
|
||||||
.setState(PublishState.Published.getState()));
|
.setState(PublishState.Published.getState()));
|
||||||
}
|
}
|
||||||
productHonorInfoService.update(request.getItems());
|
productHonorInfoService.update(request.getItems());
|
||||||
|
|
@ -107,22 +105,14 @@ public class ProductHonorServiceImpl extends ServiceImpl<ProductHonorMapper, Pro
|
||||||
return baseMapper.get(language);
|
return baseMapper.get(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(ProductPublishRequest request) {
|
||||||
List<ProductHonor> list = listByIds(request.getIds());
|
ProductHonor info = getById(request.getId());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductHonor::getTitle).collect(Collectors.toList());
|
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
VUtils.trueThrowBusinessError(Objects.equals(info.getState(), request.getState()))
|
||||||
.throwMessage("以下荣誉不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
.throwMessage("请勿重复操作");
|
||||||
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());
|
VUtils.trueThrowBusinessError(!info.getEnable()).throwMessage("不能发布已禁用的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下荣誉被禁用不能发布:" + StrUtil.join(",", names));
|
|
||||||
}
|
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void publish(ProductHonor info, Integer state) {
|
|
||||||
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());
|
||||||
info.setPublishTime(LocalDateTime.now());
|
info.setPublishTime(LocalDateTime.now());
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ public class ProductModelFileServiceImpl extends ServiceImpl<ProductModelFileMap
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(ProductModelPublishRequest request) {
|
||||||
List<ProductModelFile> datas = listByIds(request.getIds());
|
List<ProductModelFile> datas = listByIds(request.getIds());
|
||||||
datas.removeIf(item -> !item.getEnable());
|
datas.removeIf(item -> !item.getEnable());
|
||||||
datas.forEach(info -> {
|
datas.forEach(info -> {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
@ -26,7 +25,6 @@ import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -91,20 +89,12 @@ public class ProductModelImageServiceImpl extends ServiceImpl<ProductModelImageM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(ProductPublishRequest request) {
|
||||||
List<ProductModelImage> list = listByIds(request.getIds());
|
ProductModelImage info = getById(request.getId());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductModelImage::getName).collect(Collectors.toList());
|
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
VUtils.trueThrowBusinessError(Objects.equals(info.getState(), request.getState()))
|
||||||
.throwMessage("以下图片不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
.throwMessage("请勿重复操作");
|
||||||
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());
|
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下图片被禁用不能发布:" + StrUtil.join(",", names));
|
|
||||||
}
|
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void publish(ProductModelImage info, Integer state) {
|
|
||||||
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());
|
||||||
info.setPublishBy(AdminUserUtil.getUserName());
|
info.setPublishBy(AdminUserUtil.getUserName());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.nflg.mobilebroken.repository.service.impl;
|
package com.nflg.mobilebroken.repository.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
|
@ -26,7 +25,6 @@ import javax.annotation.Resource;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -112,20 +110,13 @@ public class ProductModelVideoServiceImpl extends ServiceImpl<ProductModelVideoM
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void publish(BatchPublishRequest request) {
|
public void publish(ProductPublishRequest request) {
|
||||||
List<ProductModelVideo> list = listByIds(request.getIds());
|
ProductModelVideo info = getById(request.getId());
|
||||||
List<String> names = list.stream().filter(ph -> Objects.equals(ph.getState(), request.getState())).map(ProductModelVideo::getName).collect(Collectors.toList());
|
VUtils.trueThrowBusinessError(Objects.isNull(info)).throwMessage("无效的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names))
|
VUtils.trueThrowBusinessError(Objects.equals(info.getState(), request.getState()))
|
||||||
.throwMessage("以下视频不需要设置为" + PublishState.findByValue(request.getState()).getDescription() + ":" + StrUtil.join(",", names));
|
.throwMessage("请勿重复操作");
|
||||||
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());
|
VUtils.trueThrowBusinessError(!info.getEnable()).throwMessage("不能发布已禁用的数据");
|
||||||
VUtils.trueThrowBusinessError(CollectionUtil.isNotEmpty(names)).throwMessage("以下视频被禁用不能发布:" + StrUtil.join(",", names));
|
|
||||||
}
|
|
||||||
list.forEach(it -> publish(it, request.getState()));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void publish(ProductModelVideo info, Integer state) {
|
|
||||||
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());
|
||||||
info.setPublishTime(LocalDateTime.now());
|
info.setPublishTime(LocalDateTime.now());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue