Merge branch 'ww' into test
This commit is contained in:
commit
b20996355c
|
|
@ -66,9 +66,8 @@ public class TbProskuConController {
|
|||
tbProskuConService.upV2(resources);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
} catch (BadRequestException be) {
|
||||
throw new Exception(be.getMessage());
|
||||
throw new BadRequestException(be.getMessage());
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
throw new Exception(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -198,29 +198,28 @@ public class TbProskuConServiceImpl implements TbProskuConService {
|
|||
}
|
||||
TbProductSku sku = null;
|
||||
if (resource.getProductSkuId() != 0) {
|
||||
sku = tbProductSkuRepository.findById(resource.getProductSkuId()).orElseGet(TbProductSku::new);
|
||||
sku = tbProductSkuRepository.findById(resource.getProductSkuId()).orElseGet(TbProductSku::new);
|
||||
if (ObjectUtil.isNull(sku) || ObjectUtil.isNull(sku.getId())) {
|
||||
throw new BadRequestException("规格信息不存在");
|
||||
}
|
||||
}
|
||||
TbProskuCon tbConsInfo1 = new TbProskuCon();
|
||||
if (resource.getId() == null) {
|
||||
int count = tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConInfoId(), resource.getProductSkuId(), resource.getShopId(), resource.getProductId());
|
||||
if (count <= 0) {
|
||||
BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
newCons.add(tbConsInfo1);
|
||||
} else {
|
||||
StringBuilder strResult = new StringBuilder(product.getName());
|
||||
if (sku != null) {
|
||||
strResult.append(" 规格" + sku.getSpecSnap());
|
||||
}
|
||||
strResult.append("与耗材 " + tbConsInfo.getConName() + " 的对应关系已存在");
|
||||
throw new BadRequestException(product.getName().concat("对应的").concat(Objects.nonNull(sku.getSpecSnap())?sku.getSpecSnap():"").concat("规格已存在"));
|
||||
}
|
||||
}else {
|
||||
BeanUtil.copyProperties(resource,tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
|
||||
int count = tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConInfoId(), resource.getProductSkuId(), resource.getShopId(), resource.getProductId());
|
||||
if (count <= 0) {
|
||||
BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
newCons.add(tbConsInfo1);
|
||||
} else {
|
||||
StringBuilder strResult = new StringBuilder(product.getName());
|
||||
if (sku != null) {
|
||||
strResult.append(" 规格" + sku.getSpecSnap());
|
||||
}
|
||||
strResult.append("与耗材 " + tbConsInfo.getConName() + " 的对应关系已存在");
|
||||
throw new BadRequestException(strResult.toString());
|
||||
}
|
||||
BeanUtil.copyProperties(resource, tbConsInfo1, CopyOptions.create().setIgnoreNullValue(true));
|
||||
newCons.add(tbConsInfo1);
|
||||
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(newCons)) {
|
||||
tbProskuConRepository.saveAll(newCons);
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class TbProductController {
|
|||
return new ResponseEntity<>(tbProductService.queryAll(criteria, false),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/list/v2")
|
||||
@PostMapping("/list/v2")
|
||||
@ApiOperation("查询商品列表 新")
|
||||
public ResponseEntity<Object> queryTbProductV2(TbProductQueryV2Criteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbProductService.queryAllV2(criteria,pageable),HttpStatus.OK);
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package cn.ysk.cashier.dto.product;
|
|||
|
||||
import cn.ysk.cashier.dto.BaseQueryDto;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -20,4 +21,11 @@ public class TbProductStockCountQueryCriteria extends BaseQueryDto {
|
|||
private Integer page = 0;
|
||||
|
||||
private Integer size = 10;
|
||||
|
||||
public String getProductName() {
|
||||
if(StringUtils.isNotBlank(productName)){
|
||||
return productName;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue