Merge branch 'ww' into test
# Conflicts: # eladmin-system/src/main/java/cn/ysk/cashier/service/impl/productimpl/TbProductGroupServiceImpl.java
This commit is contained in:
commit
cd6d6f2e07
|
|
@ -36,12 +36,12 @@ public class TbProductGroupController {
|
||||||
@Resource
|
@Resource
|
||||||
private TbProductService tbProductService;
|
private TbProductService tbProductService;
|
||||||
|
|
||||||
@ApiOperation("导出数据")
|
// @ApiOperation("导出数据")
|
||||||
@GetMapping(value = "/download")
|
// @GetMapping(value = "/download")
|
||||||
@PreAuthorize("@el.check('tbProductGroup:list')")
|
// @PreAuthorize("@el.check('tbProductGroup:list')")
|
||||||
public void exportTbProductGroup(HttpServletResponse response, TbProductGroupQueryCriteria criteria) throws IOException {
|
// public void exportTbProductGroup(HttpServletResponse response, TbProductGroupQueryCriteria criteria) throws IOException {
|
||||||
tbProductGroupService.download(tbProductGroupService.queryAll(criteria), response);
|
// tbProductGroupService.download(tbProductGroupService.queryAll(criteria), response);
|
||||||
}
|
// }
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询product/group")
|
@ApiOperation("查询product/group")
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
package cn.ysk.cashier.dto.product;
|
package cn.ysk.cashier.dto.product;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -60,4 +62,10 @@ public class TbProductGroupDto implements Serializable {
|
||||||
private Long createdAt;
|
private Long createdAt;
|
||||||
|
|
||||||
private Long updatedAt;
|
private Long updatedAt;
|
||||||
|
|
||||||
|
private Integer useTime;
|
||||||
|
|
||||||
|
private String saleStartTime;
|
||||||
|
|
||||||
|
private String saleEndTime;
|
||||||
}
|
}
|
||||||
|
|
@ -1,18 +1,3 @@
|
||||||
/*
|
|
||||||
* Copyright 2019-2020 Zheng Jie
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package cn.ysk.cashier.pojo.product;
|
package cn.ysk.cashier.pojo.product;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -86,6 +71,17 @@ public class TbProductGroup implements Serializable {
|
||||||
@ApiModelProperty(value = "updatedAt")
|
@ApiModelProperty(value = "updatedAt")
|
||||||
private Long updatedAt;
|
private Long updatedAt;
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
@Column(name = "`use_time`",nullable = false)
|
||||||
|
@ApiModelProperty(value = "是否开启时间管控")
|
||||||
|
private Integer useTime = 0;
|
||||||
|
|
||||||
|
@Column(name = "`sale_start_time`")
|
||||||
|
private String saleStartTime;
|
||||||
|
|
||||||
|
@Column(name = "`sale_end_time`")
|
||||||
|
private String saleEndTime;
|
||||||
|
|
||||||
public void copy(TbProductGroup source){
|
public void copy(TbProductGroup source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package cn.ysk.cashier.service.impl.productimpl;
|
package cn.ysk.cashier.service.impl.productimpl;
|
||||||
|
|
||||||
import cn.ysk.cashier.dto.product.TbProductSortCriteria;
|
import cn.ysk.cashier.dto.product.TbProductSortCriteria;
|
||||||
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||||
import cn.ysk.cashier.repository.product.TbProductRepository;
|
import cn.ysk.cashier.repository.product.TbProductRepository;
|
||||||
import cn.ysk.cashier.pojo.product.TbProductGroup;
|
import cn.ysk.cashier.pojo.product.TbProductGroup;
|
||||||
|
|
@ -14,6 +15,7 @@ import cn.ysk.cashier.config.security.service.dto.OnlineUserDto;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.ysk.cashier.service.product.TbProductGroupService;
|
import cn.ysk.cashier.service.product.TbProductGroupService;
|
||||||
import cn.ysk.cashier.mapper.product.TbProductGroupMapper;
|
import cn.ysk.cashier.mapper.product.TbProductGroupMapper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
@ -86,6 +88,10 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TbProductGroupDto create(TbProductGroup resources) {
|
public TbProductGroupDto create(TbProductGroup resources) {
|
||||||
|
if (resources.getUseTime() == 1) {
|
||||||
|
if (StringUtils.isBlank(resources.getSaleStartTime()) || StringUtils.isBlank(resources.getSaleEndTime()))
|
||||||
|
throw new BadRequestException("可售时间不可为空");
|
||||||
|
}
|
||||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
TbProductGroup save = tbProductGroupRepository.save(resources);
|
TbProductGroup save = tbProductGroupRepository.save(resources);
|
||||||
|
|
@ -96,7 +102,10 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void update(TbProductGroup resources) {
|
public void update(TbProductGroup resources) {
|
||||||
|
if (resources.getUseTime() == 1) {
|
||||||
|
if (StringUtils.isBlank(resources.getSaleStartTime()) || StringUtils.isBlank(resources.getSaleEndTime()))
|
||||||
|
throw new BadRequestException("可售时间不可为空");
|
||||||
|
}
|
||||||
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(resources.getId()).orElseGet(TbProductGroup::new);
|
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(resources.getId()).orElseGet(TbProductGroup::new);
|
||||||
// TbProductGroup byName = tbProductGroupRepository.findByName(resources.getName(), resources.getShopId());
|
// TbProductGroup byName = tbProductGroupRepository.findByName(resources.getName(), resources.getShopId());
|
||||||
// if (byName != null){
|
// if (byName != null){
|
||||||
|
|
@ -191,7 +200,7 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Object> updateProductIds(AddProduct addProduct, String userName) {
|
public ResponseEntity<Object> updateProductIds(AddProduct addProduct, String userName) {
|
||||||
OnlineUserDto onlineUser = onlineUserService.getOne(addProduct.getKey());
|
// OnlineUserDto onlineUser = onlineUserService.getOne(addProduct.getKey());
|
||||||
|
|
||||||
if (addProduct.getIds().size()<1){
|
if (addProduct.getIds().size()<1){
|
||||||
return new ResponseEntity<>("错误", HttpStatus.NOT_ACCEPTABLE);
|
return new ResponseEntity<>("错误", HttpStatus.NOT_ACCEPTABLE);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue