收银后台跟进1.9
This commit is contained in:
parent
8f849b20a6
commit
acffdcac01
|
|
@ -0,0 +1,24 @@
|
|||
package me.zhengjie.exception;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
*/
|
||||
@Getter
|
||||
public class NewBadRequestException extends RuntimeException{
|
||||
private Integer status = OK.value();
|
||||
|
||||
public NewBadRequestException(String msg){
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public NewBadRequestException(HttpStatus status, String msg){
|
||||
super(msg);
|
||||
this.status = status.value();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package me.zhengjie.utils;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* 线程相关
|
||||
*/
|
||||
public class Threads {
|
||||
/**
|
||||
* 并行执行
|
||||
* @param cfs
|
||||
*/
|
||||
public static void call(CompletableFuture<?>... cfs){
|
||||
CompletableFuture.allOf(cfs);
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ package me.zhengjie.modules.productInfo.product.rest;
|
|||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.productInfo.product.domain.TbProduct;
|
||||
import me.zhengjie.modules.productInfo.product.domain.TbProductVo;
|
||||
import me.zhengjie.modules.productInfo.product.service.TbProductService;
|
||||
import me.zhengjie.modules.productInfo.product.service.dto.TbProductQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -59,6 +60,16 @@ public class TbProductController {
|
|||
return new ResponseEntity<>(tbProductService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/{product}")
|
||||
@Log("查询/product")
|
||||
@ApiOperation("查询/product")
|
||||
@PreAuthorize("@el.check('tbProduct:list')")
|
||||
public Object queryTbProductInfo(@PathVariable("product") Integer product)throws Exception{
|
||||
return tbProductService.findByProductId(product);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Log("新增/product")
|
||||
@ApiOperation("新增/product")
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
package me.zhengjie.modules.productInfo.product.service;
|
||||
|
||||
import me.zhengjie.modules.productInfo.product.domain.TbProduct;
|
||||
import me.zhengjie.modules.productInfo.product.domain.TbProductVo;
|
||||
import me.zhengjie.modules.productInfo.product.service.dto.TbProductDto;
|
||||
import me.zhengjie.modules.productInfo.product.service.dto.TbProductQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
|
@ -54,6 +55,8 @@ public interface TbProductService {
|
|||
*/
|
||||
TbProductDto findById(Integer id);
|
||||
|
||||
TbProductVo findByProductId(Integer id)throws Exception;
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
|
|
|
|||
|
|
@ -26,21 +26,19 @@ import me.zhengjie.modules.productInfo.productSpec.domain.TbProductSpec;
|
|||
import me.zhengjie.modules.productInfo.productSpec.repository.TbProductSpecRepository;
|
||||
import me.zhengjie.modules.productInfo.productSku.domain.TbProductSku;
|
||||
import me.zhengjie.modules.productInfo.productSku.repository.TbProductSkuRepository;
|
||||
import me.zhengjie.modules.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopUnit.repository.TbShopUnitRepository;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.repository.TbShopUnitRepository;
|
||||
import me.zhengjie.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -131,6 +129,34 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
return PageUtil.toPage(tbProductVoList,tbProductVoList.size());
|
||||
}
|
||||
|
||||
@Override
|
||||
public TbProductVo findByProductId(Integer id) throws Exception{
|
||||
TbProduct tbProduct = tbProductRepository.findById(id).orElseGet(TbProduct::new);
|
||||
|
||||
//单位
|
||||
CompletableFuture<TbShopUnit> tbShopUnits = CompletableFuture.supplyAsync(() ->
|
||||
tbShopUnitRepository.searchUnit(Integer.valueOf(tbProduct.getUnitId())));
|
||||
//sku
|
||||
CompletableFuture<List<TbProductSku>> tbProductSkus = CompletableFuture.supplyAsync(() ->
|
||||
tbProductSkuRepository.searchSku(tbProduct.getId().toString()));
|
||||
//商品规格
|
||||
CompletableFuture<TbProductSpec> tbProductSpec = CompletableFuture.supplyAsync(() ->
|
||||
tbProductSpecRepository.searchSpec(tbProduct.getSpecId()));
|
||||
|
||||
Threads.call(tbShopUnits,tbProductSkus,tbProductSpec);
|
||||
//组装
|
||||
TbProductVo tbProductVo = new TbProductVo();
|
||||
BeanUtils.copyProperties(tbProduct, tbProductVo);
|
||||
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put(tbProductSpec.get().getName(),tbProductSpec.get().getSpecList());
|
||||
tbProductVo.setUnitName(tbShopUnits.get().getName());
|
||||
tbProductVo.setSkuList(tbProductSkus.get());
|
||||
tbProductVo.setSpecsInfo(map);
|
||||
return tbProductVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbProductDto> queryAll(TbProductQueryCriteria criteria){
|
||||
return tbProductMapper.toDto(tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
|
|
@ -144,6 +170,7 @@ public class TbProductServiceImpl implements TbProductService {
|
|||
return tbProductMapper.toDto(tbProduct);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbProductDto create(TbProduct resources) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_shop_category")
|
||||
public class TbShopCategory implements Serializable {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "自增id")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`name`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "分类名称")
|
||||
private String name;
|
||||
|
||||
@Column(name = "`short_name`")
|
||||
@ApiModelProperty(value = "简称")
|
||||
private String shortName;
|
||||
|
||||
@Column(name = "`tree`")
|
||||
@ApiModelProperty(value = "分类层级")
|
||||
private String tree;
|
||||
|
||||
@Column(name = "`pid`")
|
||||
@ApiModelProperty(value = "上级分类id-为0则表示是顶级")
|
||||
private String pid;
|
||||
|
||||
@Column(name = "`pic`")
|
||||
@ApiModelProperty(value = "图标")
|
||||
private String pic;
|
||||
|
||||
@Column(name = "`merchant_id`")
|
||||
@ApiModelProperty(value = "商户Id")
|
||||
private String merchantId;
|
||||
|
||||
@Column(name = "`shop_id`",nullable = false)
|
||||
@NotBlank
|
||||
@ApiModelProperty(value = "店铺Id")
|
||||
private String shopId;
|
||||
|
||||
@Column(name = "`style`")
|
||||
@ApiModelProperty(value = "颜色格式标识")
|
||||
private String style;
|
||||
|
||||
@Column(name = "`is_show`",nullable = false)
|
||||
@NotNull
|
||||
@ApiModelProperty(value = "是否显示:1显示 0不显示")
|
||||
private Integer isShow;
|
||||
|
||||
@Column(name = "`detail`")
|
||||
@ApiModelProperty(value = "分类描述")
|
||||
private String detail;
|
||||
|
||||
@Column(name = "`sort`")
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@Column(name = "`key_word`")
|
||||
@ApiModelProperty(value = "关键词")
|
||||
private String keyWord;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
public void copy(TbShopCategory source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.repository;
|
||||
|
||||
import me.zhengjie.modules.productInfo.productCategory.domain.TbShopCategory;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
public interface TbShopCategoryRepository extends JpaRepository<TbShopCategory, Integer>, JpaSpecificationExecutor<TbShopCategory> {
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.productInfo.productCategory.domain.TbShopCategory;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.TbShopCategoryService;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.dto.TbShopCategoryQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "product/category管理")
|
||||
@RequestMapping("/api/tbShopCategory")
|
||||
public class TbShopCategoryController {
|
||||
|
||||
private final TbShopCategoryService tbShopCategoryService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbShopCategory:list')")
|
||||
public void exportTbShopCategory(HttpServletResponse response, TbShopCategoryQueryCriteria criteria) throws IOException {
|
||||
tbShopCategoryService.download(tbShopCategoryService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询product/category")
|
||||
@ApiOperation("查询product/category")
|
||||
@PreAuthorize("@el.check('tbShopCategory:list')")
|
||||
public ResponseEntity<Object> queryTbShopCategory(TbShopCategoryQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbShopCategoryService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增product/category")
|
||||
@ApiOperation("新增product/category")
|
||||
@PreAuthorize("@el.check('tbShopCategory:add')")
|
||||
public ResponseEntity<Object> createTbShopCategory(@Validated @RequestBody TbShopCategory resources){
|
||||
return new ResponseEntity<>(tbShopCategoryService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改product/category")
|
||||
@ApiOperation("修改product/category")
|
||||
@PreAuthorize("@el.check('tbShopCategory:edit')")
|
||||
public ResponseEntity<Object> updateTbShopCategory(@Validated @RequestBody TbShopCategory resources){
|
||||
tbShopCategoryService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除product/category")
|
||||
@ApiOperation("删除product/category")
|
||||
@PreAuthorize("@el.check('tbShopCategory:del')")
|
||||
public ResponseEntity<Object> deleteTbShopCategory(@RequestBody Integer[] ids) {
|
||||
tbShopCategoryService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.service;
|
||||
|
||||
import me.zhengjie.modules.productInfo.productCategory.domain.TbShopCategory;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.dto.TbShopCategoryDto;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.dto.TbShopCategoryQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
public interface TbShopCategoryService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbShopCategoryQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbShopCategoryDto>
|
||||
*/
|
||||
List<TbShopCategoryDto> queryAll(TbShopCategoryQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbShopCategoryDto
|
||||
*/
|
||||
TbShopCategoryDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbShopCategoryDto
|
||||
*/
|
||||
TbShopCategoryDto create(TbShopCategory resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbShopCategory resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbShopCategoryDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Data
|
||||
public class TbShopCategoryDto implements Serializable {
|
||||
|
||||
/** 自增id */
|
||||
private Integer id;
|
||||
|
||||
/** 分类名称 */
|
||||
private String name;
|
||||
|
||||
/** 简称 */
|
||||
private String shortName;
|
||||
|
||||
/** 分类层级 */
|
||||
private String tree;
|
||||
|
||||
/** 上级分类id-为0则表示是顶级 */
|
||||
private String pid;
|
||||
|
||||
/** 图标 */
|
||||
private String pic;
|
||||
|
||||
/** 商户Id */
|
||||
private String merchantId;
|
||||
|
||||
/** 店铺Id */
|
||||
private String shopId;
|
||||
|
||||
/** 颜色格式标识 */
|
||||
private String style;
|
||||
|
||||
/** 是否显示:1显示 0不显示 */
|
||||
private Integer isShow;
|
||||
|
||||
/** 分类描述 */
|
||||
private String detail;
|
||||
|
||||
/** 排序 */
|
||||
private Integer sort;
|
||||
|
||||
/** 关键词 */
|
||||
private String keyWord;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Data
|
||||
public class TbShopCategoryQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer id;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String shortName;
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private String shopId;
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.service.impl;
|
||||
|
||||
import me.zhengjie.modules.productInfo.productCategory.domain.TbShopCategory;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.productInfo.productCategory.repository.TbShopCategoryRepository;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.TbShopCategoryService;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.dto.TbShopCategoryDto;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.dto.TbShopCategoryQueryCriteria;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.mapstruct.TbShopCategoryMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbShopCategoryServiceImpl implements TbShopCategoryService {
|
||||
|
||||
private final TbShopCategoryRepository tbShopCategoryRepository;
|
||||
private final TbShopCategoryMapper tbShopCategoryMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbShopCategoryQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbShopCategory> page = tbShopCategoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbShopCategoryMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbShopCategoryDto> queryAll(TbShopCategoryQueryCriteria criteria){
|
||||
return tbShopCategoryMapper.toDto(tbShopCategoryRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbShopCategoryDto findById(Integer id) {
|
||||
TbShopCategory tbShopCategory = tbShopCategoryRepository.findById(id).orElseGet(TbShopCategory::new);
|
||||
ValidationUtil.isNull(tbShopCategory.getId(),"TbShopCategory","id",id);
|
||||
return tbShopCategoryMapper.toDto(tbShopCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbShopCategoryDto create(TbShopCategory resources) {
|
||||
return tbShopCategoryMapper.toDto(tbShopCategoryRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbShopCategory resources) {
|
||||
TbShopCategory tbShopCategory = tbShopCategoryRepository.findById(resources.getId()).orElseGet(TbShopCategory::new);
|
||||
ValidationUtil.isNull( tbShopCategory.getId(),"TbShopCategory","id",resources.getId());
|
||||
tbShopCategory.copy(resources);
|
||||
tbShopCategoryRepository.save(tbShopCategory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbShopCategoryRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbShopCategoryDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbShopCategoryDto tbShopCategory : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("分类名称", tbShopCategory.getName());
|
||||
map.put("简称", tbShopCategory.getShortName());
|
||||
map.put("分类层级", tbShopCategory.getTree());
|
||||
map.put("上级分类id-为0则表示是顶级", tbShopCategory.getPid());
|
||||
map.put("图标", tbShopCategory.getPic());
|
||||
map.put("商户Id", tbShopCategory.getMerchantId());
|
||||
map.put("店铺Id", tbShopCategory.getShopId());
|
||||
map.put("颜色格式标识", tbShopCategory.getStyle());
|
||||
map.put("是否显示:1显示 0不显示", tbShopCategory.getIsShow());
|
||||
map.put("分类描述", tbShopCategory.getDetail());
|
||||
map.put("排序", tbShopCategory.getSort());
|
||||
map.put("关键词", tbShopCategory.getKeyWord());
|
||||
map.put(" createdAt", tbShopCategory.getCreatedAt());
|
||||
map.put(" updatedAt", tbShopCategory.getUpdatedAt());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.productInfo.productCategory.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.productInfo.productCategory.domain.TbShopCategory;
|
||||
import me.zhengjie.modules.productInfo.productCategory.service.dto.TbShopCategoryDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbShopCategoryMapper extends BaseMapper<TbShopCategoryDto, TbShopCategory> {
|
||||
|
||||
}
|
||||
|
|
@ -33,4 +33,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
|||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId IN :productId")
|
||||
List<TbProductSku> searchSku(@Param("productId")List<String> productId);
|
||||
|
||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId")
|
||||
List<TbProductSku> searchSku(@Param("productId")String productId);
|
||||
|
||||
}
|
||||
|
|
@ -32,4 +32,7 @@ public interface TbProductSpecRepository extends JpaRepository<TbProductSpec, In
|
|||
|
||||
@Query("SELECT spec FROM TbProductSpec spec WHERE spec.id IN :ids")
|
||||
List<TbProductSpec> searchSpec(@Param("ids")List<Integer> ids);
|
||||
|
||||
@Query("SELECT spec FROM TbProductSpec spec WHERE spec.id = :ids")
|
||||
TbProductSpec searchSpec(@Param("ids")Integer ids);
|
||||
}
|
||||
|
|
@ -34,8 +34,8 @@ import me.zhengjie.modules.security.security.TokenProvider;
|
|||
import me.zhengjie.modules.security.service.dto.AuthUserDto;
|
||||
import me.zhengjie.modules.security.service.dto.JwtUserDto;
|
||||
import me.zhengjie.modules.security.service.OnlineUserService;
|
||||
import me.zhengjie.modules.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shop.repository.TbShopInfoRepository;
|
||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shopInfo.shop.repository.TbShopInfoRepository;
|
||||
import me.zhengjie.utils.RsaUtils;
|
||||
import me.zhengjie.utils.RedisUtils;
|
||||
import me.zhengjie.utils.SecurityUtils;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.domain;
|
||||
package me.zhengjie.modules.shopInfo.shop.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.repository;
|
||||
package me.zhengjie.modules.shopInfo.shop.repository;
|
||||
|
||||
import me.zhengjie.modules.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
|
@ -13,12 +13,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.rest;
|
||||
package me.zhengjie.modules.shopInfo.shop.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shop.service.TbShopInfoService;
|
||||
import me.zhengjie.modules.shop.service.dto.TbShopInfoQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.TbShopInfoService;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.service;
|
||||
package me.zhengjie.modules.shopInfo.shop.service;
|
||||
|
||||
import me.zhengjie.modules.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shop.service.dto.TbShopInfoDto;
|
||||
import me.zhengjie.modules.shop.service.dto.TbShopInfoQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoDto;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shop.service.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shop.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
|
@ -13,17 +13,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.service.impl;
|
||||
package me.zhengjie.modules.shopInfo.shop.service.impl;
|
||||
|
||||
import me.zhengjie.modules.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.shop.repository.TbShopInfoRepository;
|
||||
import me.zhengjie.modules.shop.service.TbShopInfoService;
|
||||
import me.zhengjie.modules.shop.service.dto.TbShopInfoDto;
|
||||
import me.zhengjie.modules.shop.service.dto.TbShopInfoQueryCriteria;
|
||||
import me.zhengjie.modules.shop.service.mapstruct.TbShopInfoMapper;
|
||||
import me.zhengjie.modules.shopInfo.shop.repository.TbShopInfoRepository;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.TbShopInfoService;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoDto;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.mapstruct.TbShopInfoMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shop.service.mapstruct;
|
||||
package me.zhengjie.modules.shopInfo.shop.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shop.service.dto.TbShopInfoDto;
|
||||
import me.zhengjie.modules.shopInfo.shop.domain.TbShopInfo;
|
||||
import me.zhengjie.modules.shopInfo.shop.service.dto.TbShopInfoDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
|
|
@ -13,14 +13,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.domain;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.repository;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.repository;
|
||||
|
||||
import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.domain.TbShopCurrency;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
|
@ -13,12 +13,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.rest;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopCurrency.service.TbShopCurrencyService;
|
||||
import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.TbShopCurrencyService;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.dto.TbShopCurrencyQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.service;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.service;
|
||||
|
||||
import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyDto;
|
||||
import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.dto.TbShopCurrencyDto;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.dto.TbShopCurrencyQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
|
@ -13,17 +13,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.service.impl;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.service.impl;
|
||||
|
||||
import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.shopCurrency.repository.TbShopCurrencyRepository;
|
||||
import me.zhengjie.modules.shopCurrency.service.TbShopCurrencyService;
|
||||
import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyDto;
|
||||
import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyQueryCriteria;
|
||||
import me.zhengjie.modules.shopCurrency.service.mapstruct.TbShopCurrencyMapper;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.repository.TbShopCurrencyRepository;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.TbShopCurrencyService;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.dto.TbShopCurrencyDto;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.dto.TbShopCurrencyQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.mapstruct.TbShopCurrencyMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopCurrency.service.mapstruct;
|
||||
package me.zhengjie.modules.shopInfo.shopCurrency.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopCurrency.service.dto.TbShopCurrencyDto;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.domain.TbShopCurrency;
|
||||
import me.zhengjie.modules.shopInfo.shopCurrency.service.dto.TbShopCurrencyDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Entity
|
||||
@Data
|
||||
@Table(name="tb_receipt_sales")
|
||||
public class TbReceiptSales implements Serializable {
|
||||
|
||||
@Id
|
||||
@Column(name = "`id`")
|
||||
@ApiModelProperty(value = "shopId")
|
||||
private Integer id;
|
||||
|
||||
@Column(name = "`title`")
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
@Column(name = "`logo`")
|
||||
@ApiModelProperty(value = "是否显示公司Logo")
|
||||
private String logo;
|
||||
|
||||
@Column(name = "`show_contact_info`")
|
||||
@ApiModelProperty(value = "打印联系电话等信息")
|
||||
private Integer showContactInfo;
|
||||
|
||||
@Column(name = "`show_member`")
|
||||
@ApiModelProperty(value = "打印会员开关 0?1")
|
||||
private Integer showMember;
|
||||
|
||||
@Column(name = "`show_member_code`")
|
||||
@ApiModelProperty(value = "打印会员编号开关")
|
||||
private Integer showMemberCode;
|
||||
|
||||
@Column(name = "`show_member_score`")
|
||||
@ApiModelProperty(value = "打印会员积分")
|
||||
private Integer showMemberScore;
|
||||
|
||||
@Column(name = "`show_member_wallet`")
|
||||
@ApiModelProperty(value = "打印会员余额开关 0?1")
|
||||
private Integer showMemberWallet;
|
||||
|
||||
@Column(name = "`footer_remark`")
|
||||
@ApiModelProperty(value = "店铺Id")
|
||||
private String footerRemark;
|
||||
|
||||
@Column(name = "`show_cash_charge`")
|
||||
@ApiModelProperty(value = "打印找零")
|
||||
private Integer showCashCharge;
|
||||
|
||||
@Column(name = "`show_serial_no`")
|
||||
@ApiModelProperty(value = "流水号")
|
||||
private Integer showSerialNo;
|
||||
|
||||
@Column(name = "`big_serial_no`")
|
||||
@ApiModelProperty(value = "用大号字打印流水号 在showSerialNo可用前提下")
|
||||
private Integer bigSerialNo;
|
||||
|
||||
@Column(name = "`header_text`")
|
||||
@ApiModelProperty(value = "头部文字")
|
||||
private String headerText;
|
||||
|
||||
@Column(name = "`header_text_align`")
|
||||
@ApiModelProperty(value = "文字 对齐方式")
|
||||
private String headerTextAlign;
|
||||
|
||||
@Column(name = "`footer_text`")
|
||||
@ApiModelProperty(value = "尾部文字")
|
||||
private String footerText;
|
||||
|
||||
@Column(name = "`footer_text_align`")
|
||||
@ApiModelProperty(value = "文字 对齐方式")
|
||||
private String footerTextAlign;
|
||||
|
||||
@Column(name = "`footer_image`")
|
||||
@ApiModelProperty(value = "尾部图像")
|
||||
private String footerImage;
|
||||
|
||||
@Column(name = "`pre_print`")
|
||||
@ApiModelProperty(value = "预打印,YES开启 NO不开启")
|
||||
private String prePrint;
|
||||
|
||||
@Column(name = "`created_at`")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Long createdAt;
|
||||
|
||||
@Column(name = "`updated_at`")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Long updatedAt;
|
||||
|
||||
public void copy(TbReceiptSales source){
|
||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.repository;
|
||||
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.domain.TbReceiptSales;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
public interface TbReceiptSalesRepository extends JpaRepository<TbReceiptSales, Integer>, JpaSpecificationExecutor<TbReceiptSales> {
|
||||
}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.domain.TbReceiptSales;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto.TbReceiptSalesQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.TbReceiptSalesService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "/shop/receiptSales管理")
|
||||
@RequestMapping("/api/tbReceiptSales")
|
||||
public class TbReceiptSalesController {
|
||||
|
||||
private final TbReceiptSalesService tbReceiptSalesService;
|
||||
|
||||
@Log("导出数据")
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('tbReceiptSales:list')")
|
||||
public void exportTbReceiptSales(HttpServletResponse response, TbReceiptSalesQueryCriteria criteria) throws IOException {
|
||||
tbReceiptSalesService.download(tbReceiptSalesService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@Log("查询/shop/receiptSales")
|
||||
@ApiOperation("查询/shop/receiptSales")
|
||||
@PreAuthorize("@el.check('tbReceiptSales:list')")
|
||||
public ResponseEntity<Object> queryTbReceiptSales(TbReceiptSalesQueryCriteria criteria, Pageable pageable){
|
||||
return new ResponseEntity<>(tbReceiptSalesService.queryAll(criteria,pageable),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/{shopId}")
|
||||
@Log("查询/shop/receiptSales")
|
||||
@ApiOperation("查询/shop/receiptSales")
|
||||
@PreAuthorize("@el.check('tbReceiptSales:info')")
|
||||
public Object queryTbReceiptSalesInfo(@PathVariable("shopId")Integer shopId){
|
||||
return tbReceiptSalesService.findById(shopId);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping
|
||||
@Log("新增/shop/receiptSales")
|
||||
@ApiOperation("新增/shop/receiptSales")
|
||||
@PreAuthorize("@el.check('tbReceiptSales:add')")
|
||||
public ResponseEntity<Object> createTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){
|
||||
return new ResponseEntity<>(tbReceiptSalesService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改/shop/receiptSales")
|
||||
@ApiOperation("修改/shop/receiptSales")
|
||||
@PreAuthorize("@el.check('tbReceiptSales:edit')")
|
||||
public ResponseEntity<Object> updateTbReceiptSales(@Validated @RequestBody TbReceiptSales resources){
|
||||
tbReceiptSalesService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Log("删除/shop/receiptSales")
|
||||
@ApiOperation("删除/shop/receiptSales")
|
||||
@PreAuthorize("@el.check('tbReceiptSales:del')")
|
||||
public ResponseEntity<Object> deleteTbReceiptSales(@RequestBody Integer[] ids) {
|
||||
tbReceiptSalesService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.service;
|
||||
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.domain.TbReceiptSales;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto.TbReceiptSalesDto;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto.TbReceiptSalesQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务接口
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
public interface TbReceiptSalesService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
* @param criteria 条件
|
||||
* @param pageable 分页参数
|
||||
* @return Map<String,Object>
|
||||
*/
|
||||
Map<String,Object> queryAll(TbReceiptSalesQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
* @param criteria 条件参数
|
||||
* @return List<TbReceiptSalesDto>
|
||||
*/
|
||||
List<TbReceiptSalesDto> queryAll(TbReceiptSalesQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
* @return TbReceiptSalesDto
|
||||
*/
|
||||
TbReceiptSalesDto findById(Integer id);
|
||||
|
||||
/**
|
||||
* 创建
|
||||
* @param resources /
|
||||
* @return TbReceiptSalesDto
|
||||
*/
|
||||
TbReceiptSalesDto create(TbReceiptSales resources);
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbReceiptSales resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Integer[] ids);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
* @param response /
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbReceiptSalesDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description /
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Data
|
||||
public class TbReceiptSalesDto implements Serializable {
|
||||
|
||||
/** shopId */
|
||||
private Integer id;
|
||||
|
||||
/** 标题 */
|
||||
private String title;
|
||||
|
||||
/** 是否显示公司Logo */
|
||||
private String logo;
|
||||
|
||||
/** 打印联系电话等信息 */
|
||||
private Integer showContactInfo;
|
||||
|
||||
/** 打印会员开关 0?1 */
|
||||
private Integer showMember;
|
||||
|
||||
/** 打印会员编号开关 */
|
||||
private Integer showMemberCode;
|
||||
|
||||
/** 打印会员积分 */
|
||||
private Integer showMemberScore;
|
||||
|
||||
/** 打印会员余额开关 0?1 */
|
||||
private Integer showMemberWallet;
|
||||
|
||||
/** 店铺Id */
|
||||
private String footerRemark;
|
||||
|
||||
/** 打印找零 */
|
||||
private Integer showCashCharge;
|
||||
|
||||
/** 流水号 */
|
||||
private Integer showSerialNo;
|
||||
|
||||
/** 用大号字打印流水号 在showSerialNo可用前提下 */
|
||||
private Integer bigSerialNo;
|
||||
|
||||
/** 头部文字 */
|
||||
private String headerText;
|
||||
|
||||
/** 文字 对齐方式 */
|
||||
private String headerTextAlign;
|
||||
|
||||
/** 尾部文字 */
|
||||
private String footerText;
|
||||
|
||||
/** 文字 对齐方式 */
|
||||
private String footerTextAlign;
|
||||
|
||||
/** 尾部图像 */
|
||||
private String footerImage;
|
||||
|
||||
/** 预打印,YES开启 NO不开启 */
|
||||
private String prePrint;
|
||||
|
||||
private Long createdAt;
|
||||
|
||||
private Long updatedAt;
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
import me.zhengjie.annotation.Query;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Data
|
||||
public class TbReceiptSalesQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
private Integer id;
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.service.impl;
|
||||
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.domain.TbReceiptSales;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.mapstruct.TbReceiptSalesMapper;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.repository.TbReceiptSalesRepository;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.TbReceiptSalesService;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto.TbReceiptSalesDto;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto.TbReceiptSalesQueryCriteria;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @description 服务实现
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbReceiptSalesServiceImpl implements TbReceiptSalesService {
|
||||
|
||||
private final TbReceiptSalesRepository tbReceiptSalesRepository;
|
||||
private final TbReceiptSalesMapper tbReceiptSalesMapper;
|
||||
|
||||
@Override
|
||||
public Map<String,Object> queryAll(TbReceiptSalesQueryCriteria criteria, Pageable pageable){
|
||||
Page<TbReceiptSales> page = tbReceiptSalesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
|
||||
return PageUtil.toPage(page.map(tbReceiptSalesMapper::toDto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbReceiptSalesDto> queryAll(TbReceiptSalesQueryCriteria criteria){
|
||||
return tbReceiptSalesMapper.toDto(tbReceiptSalesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbReceiptSalesDto findById(Integer id) {
|
||||
TbReceiptSales tbReceiptSales = tbReceiptSalesRepository.findById(id).orElseGet(TbReceiptSales::new);
|
||||
ValidationUtil.isNull(tbReceiptSales.getId(),"TbReceiptSales","id",id);
|
||||
return tbReceiptSalesMapper.toDto(tbReceiptSales);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbReceiptSalesDto create(TbReceiptSales resources) {
|
||||
return tbReceiptSalesMapper.toDto(tbReceiptSalesRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbReceiptSales resources) {
|
||||
TbReceiptSales tbReceiptSales = tbReceiptSalesRepository.findById(resources.getId()).orElseGet(TbReceiptSales::new);
|
||||
ValidationUtil.isNull( tbReceiptSales.getId(),"TbReceiptSales","id",resources.getId());
|
||||
tbReceiptSales.copy(resources);
|
||||
tbReceiptSalesRepository.save(tbReceiptSales);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAll(Integer[] ids) {
|
||||
for (Integer id : ids) {
|
||||
tbReceiptSalesRepository.deleteById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void download(List<TbReceiptSalesDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (TbReceiptSalesDto tbReceiptSales : all) {
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("标题", tbReceiptSales.getTitle());
|
||||
map.put("是否显示公司Logo", tbReceiptSales.getLogo());
|
||||
map.put("打印联系电话等信息", tbReceiptSales.getShowContactInfo());
|
||||
map.put("打印会员开关 0?1", tbReceiptSales.getShowMember());
|
||||
map.put("打印会员编号开关", tbReceiptSales.getShowMemberCode());
|
||||
map.put("打印会员积分", tbReceiptSales.getShowMemberScore());
|
||||
map.put("打印会员余额开关 0?1", tbReceiptSales.getShowMemberWallet());
|
||||
map.put("店铺Id", tbReceiptSales.getFooterRemark());
|
||||
map.put("打印找零", tbReceiptSales.getShowCashCharge());
|
||||
map.put("流水号", tbReceiptSales.getShowSerialNo());
|
||||
map.put("用大号字打印流水号 在showSerialNo可用前提下", tbReceiptSales.getBigSerialNo());
|
||||
map.put("头部文字", tbReceiptSales.getHeaderText());
|
||||
map.put("文字 对齐方式", tbReceiptSales.getHeaderTextAlign());
|
||||
map.put("尾部文字", tbReceiptSales.getFooterText());
|
||||
map.put("文字 对齐方式", tbReceiptSales.getFooterTextAlign());
|
||||
map.put("尾部图像", tbReceiptSales.getFooterImage());
|
||||
map.put("预打印,YES开启 NO不开启", tbReceiptSales.getPrePrint());
|
||||
map.put(" createdAt", tbReceiptSales.getCreatedAt());
|
||||
map.put(" updatedAt", tbReceiptSales.getUpdatedAt());
|
||||
list.add(map);
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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 me.zhengjie.modules.shopInfo.shopReceiptSales.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.domain.TbReceiptSales;
|
||||
import me.zhengjie.modules.shopInfo.shopReceiptSales.service.dto.TbReceiptSalesDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
* @date 2024-01-08
|
||||
**/
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface TbReceiptSalesMapper extends BaseMapper<TbReceiptSalesDto, TbReceiptSales> {
|
||||
|
||||
}
|
||||
|
|
@ -13,14 +13,13 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.domain;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
|
|
@ -13,14 +13,17 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.repository;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.repository;
|
||||
|
||||
import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.domain.TbShopCashSpread;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
|
|
@ -29,4 +32,12 @@ import org.springframework.data.jpa.repository.Query;
|
|||
public interface TbShopCashSpreadRepository extends JpaRepository<TbShopCashSpread, String>, JpaSpecificationExecutor<TbShopCashSpread> {
|
||||
@Query("select spread from TbShopCashSpread spread where spread.id = :shopId")
|
||||
TbShopCashSpread findByShopId(@Param("shopId")Integer shopId);
|
||||
|
||||
@Modifying
|
||||
@Transactional
|
||||
@Query("update TbShopCashSpread spread set spread.screenConfig = :screenConfig, spread.updatedAt = :updatedTime where spread.id = :shopId")
|
||||
Integer updateConfig(@Param("shopId")Integer shopId, @Param("screenConfig")String screenConfig,
|
||||
@Param("updatedTime")Long updatedTime);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -13,12 +13,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.rest;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopSpread.service.TbShopCashSpreadService;
|
||||
import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.TbShopCashSpreadService;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.dto.TbShopCashSpreadQueryCriteria;
|
||||
import me.zhengjie.utils.StringUtils;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
|
@ -29,7 +29,6 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
|
|
@ -82,8 +81,13 @@ public class TbShopCashSpreadController {
|
|||
@ApiOperation("修改/shop/spread")
|
||||
@PreAuthorize("@el.check('tbShopCashSpread:edit')")
|
||||
public ResponseEntity<Object> updateTbShopCashSpread(@Validated @RequestBody TbShopCashSpread resources){
|
||||
tbShopCashSpreadService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
Integer update = tbShopCashSpreadService.update(resources);
|
||||
if (update>0){
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
|
||||
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.service;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.service;
|
||||
|
||||
import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadDto;
|
||||
import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.dto.TbShopCashSpreadDto;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.dto.TbShopCashSpreadQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -66,7 +66,7 @@ public interface TbShopCashSpreadService {
|
|||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbShopCashSpread resources);
|
||||
Integer update(TbShopCashSpread resources);
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package me.zhengjie.modules.shopSpread.service.TbShopCashVo;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.service.TbShopCashVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
|
@ -13,24 +13,25 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.service.impl;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.service.impl;
|
||||
|
||||
import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.TbShopCashSpreadService;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.dto.TbShopCashSpreadDto;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.mapstruct.TbShopCashSpreadMapper;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.shopSpread.repository.TbShopCashSpreadRepository;
|
||||
import me.zhengjie.modules.shopSpread.service.TbShopCashSpreadService;
|
||||
import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadDto;
|
||||
import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadQueryCriteria;
|
||||
import me.zhengjie.modules.shopSpread.service.mapstruct.TbShopCashSpreadMapper;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.repository.TbShopCashSpreadRepository;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.dto.TbShopCashSpreadQueryCriteria;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
|
|
@ -84,11 +85,8 @@ public class TbShopCashSpreadServiceImpl implements TbShopCashSpreadService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbShopCashSpread resources) {
|
||||
// TbShopCashSpread tbShopCashSpread = tbShopCashSpreadRepository.findById(resources.getId()).orElseGet(TbShopCashSpread::new);
|
||||
// ValidationUtil.isNull( tbShopCashSpread.getId(),"TbShopCashSpread","id",resources.getId());
|
||||
// tbShopCashSpread.copy(resources);
|
||||
// tbShopCashSpreadRepository.save(tbShopCashSpread);
|
||||
public Integer update(TbShopCashSpread resources) {
|
||||
return tbShopCashSpreadRepository.updateConfig(resources.getId(), resources.getScreenConfig().trim(), Instant.now().toEpochMilli());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopSpread.service.mapstruct;
|
||||
package me.zhengjie.modules.shopInfo.shopSpread.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopSpread.service.dto.TbShopCashSpreadDto;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.domain.TbShopCashSpread;
|
||||
import me.zhengjie.modules.shopInfo.shopSpread.service.dto.TbShopCashSpreadDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.domain;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
|
|
@ -13,9 +13,9 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.repository;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.repository;
|
||||
|
||||
import me.zhengjie.modules.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.domain.TbShopUnit;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
|
@ -31,4 +31,10 @@ import java.util.List;
|
|||
public interface TbShopUnitRepository extends JpaRepository<TbShopUnit, Integer>, JpaSpecificationExecutor<TbShopUnit> {
|
||||
@Query("SELECT unit FROM TbShopUnit unit WHERE unit.id IN :ids")
|
||||
List<TbShopUnit> searchUnit(@Param("ids")List<Integer> ids);
|
||||
|
||||
@Query("SELECT unit FROM TbShopUnit unit WHERE unit.id = :ids")
|
||||
TbShopUnit searchUnit(@Param("ids")Integer ids);
|
||||
|
||||
@Query("SELECT unit from TbShopUnit unit where unit.name = :name and unit.shopId = :shopId")
|
||||
TbShopUnit findName(@Param("name")String name,@Param("shopId")String shopId);
|
||||
}
|
||||
|
|
@ -13,12 +13,12 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.rest;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.rest;
|
||||
|
||||
import me.zhengjie.annotation.Log;
|
||||
import me.zhengjie.modules.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopUnit.service.TbShopUnitService;
|
||||
import me.zhengjie.modules.shopUnit.service.dto.TbShopUnitQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.TbShopUnitService;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.dto.TbShopUnitQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
|
@ -63,7 +63,7 @@ public class TbShopUnitController {
|
|||
@Log("新增/shop/unit")
|
||||
@ApiOperation("新增/shop/unit")
|
||||
@PreAuthorize("@el.check('tbShopUnit:add')")
|
||||
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources){
|
||||
public ResponseEntity<Object> createTbShopUnit(@Validated @RequestBody TbShopUnit resources)throws Exception{
|
||||
return new ResponseEntity<>(tbShopUnitService.create(resources),HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ public class TbShopUnitController {
|
|||
@Log("修改/shop/unit")
|
||||
@ApiOperation("修改/shop/unit")
|
||||
@PreAuthorize("@el.check('tbShopUnit:edit')")
|
||||
public ResponseEntity<Object> updateTbShopUnit(@Validated @RequestBody TbShopUnit resources){
|
||||
public ResponseEntity<Object> updateTbShopUnit(@Validated @RequestBody TbShopUnit resources)throws Exception{
|
||||
tbShopUnitService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.service;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.service;
|
||||
|
||||
import me.zhengjie.modules.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopUnit.service.dto.TbShopUnitDto;
|
||||
import me.zhengjie.modules.shopUnit.service.dto.TbShopUnitQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.dto.TbShopUnitDto;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.dto.TbShopUnitQueryCriteria;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -59,13 +59,13 @@ public interface TbShopUnitService {
|
|||
* @param resources /
|
||||
* @return TbShopUnitDto
|
||||
*/
|
||||
TbShopUnitDto create(TbShopUnit resources);
|
||||
TbShopUnitDto create(TbShopUnit resources)throws Exception;
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
* @param resources /
|
||||
*/
|
||||
void update(TbShopUnit resources);
|
||||
void update(TbShopUnit resources)throws Exception;
|
||||
|
||||
/**
|
||||
* 多选删除
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.service.dto;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.List;
|
||||
|
|
@ -13,23 +13,28 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.service.impl;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.service.impl;
|
||||
|
||||
import me.zhengjie.modules.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.exception.BadRequestException;
|
||||
import me.zhengjie.exception.NewBadRequestException;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.utils.ValidationUtil;
|
||||
import me.zhengjie.utils.FileUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import me.zhengjie.modules.shopUnit.repository.TbShopUnitRepository;
|
||||
import me.zhengjie.modules.shopUnit.service.TbShopUnitService;
|
||||
import me.zhengjie.modules.shopUnit.service.dto.TbShopUnitDto;
|
||||
import me.zhengjie.modules.shopUnit.service.dto.TbShopUnitQueryCriteria;
|
||||
import me.zhengjie.modules.shopUnit.service.mapstruct.TbShopUnitMapper;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.repository.TbShopUnitRepository;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.TbShopUnitService;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.dto.TbShopUnitDto;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.dto.TbShopUnitQueryCriteria;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.mapstruct.TbShopUnitMapper;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import me.zhengjie.utils.PageUtil;
|
||||
import me.zhengjie.utils.QueryHelp;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
|
|
@ -71,14 +76,29 @@ public class TbShopUnitServiceImpl implements TbShopUnitService {
|
|||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TbShopUnitDto create(TbShopUnit resources) {
|
||||
public TbShopUnitDto create(TbShopUnit resources)throws Exception{
|
||||
|
||||
TbShopUnit name = tbShopUnitRepository.findName(resources.getName(), resources.getShopId());
|
||||
if (name != null){
|
||||
throw new NewBadRequestException(HttpStatus.OK,"单位名称重复");
|
||||
}
|
||||
resources.setDecimalsDigits(0);
|
||||
resources.setUnitType("number");
|
||||
resources.setIsSystem(0);
|
||||
resources.setStatus(1);
|
||||
resources.setCreatedAt(Instant.now().toEpochMilli());
|
||||
resources.setUpdatedAt(Instant.now().toEpochMilli());
|
||||
return tbShopUnitMapper.toDto(tbShopUnitRepository.save(resources));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(TbShopUnit resources) {
|
||||
public void update(TbShopUnit resources) throws Exception{
|
||||
TbShopUnit tbShopUnit = tbShopUnitRepository.findById(resources.getId()).orElseGet(TbShopUnit::new);
|
||||
TbShopUnit name = tbShopUnitRepository.findName(resources.getName(), resources.getShopId());
|
||||
if (name != null){
|
||||
throw new NewBadRequestException(HttpStatus.OK,"单位名称重复");
|
||||
}
|
||||
ValidationUtil.isNull( tbShopUnit.getId(),"TbShopUnit","id",resources.getId());
|
||||
tbShopUnit.copy(resources);
|
||||
tbShopUnitRepository.save(tbShopUnit);
|
||||
|
|
@ -13,11 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package me.zhengjie.modules.shopUnit.service.mapstruct;
|
||||
package me.zhengjie.modules.shopInfo.shopUnit.service.mapstruct;
|
||||
|
||||
import me.zhengjie.base.BaseMapper;
|
||||
import me.zhengjie.modules.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopUnit.service.dto.TbShopUnitDto;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.domain.TbShopUnit;
|
||||
import me.zhengjie.modules.shopInfo.shopUnit.service.dto.TbShopUnitDto;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
|
|
@ -24,6 +24,7 @@ spring:
|
|||
properties:
|
||||
hibernate:
|
||||
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
|
||||
show_sql: true
|
||||
|
||||
redis:
|
||||
#数据库索引
|
||||
|
|
|
|||
Loading…
Reference in New Issue