Merge remote-tracking branch 'origin/dev'
# Conflicts: # eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMShopUserMapper.java # eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbShopUserFlowMapper.java
This commit is contained in:
commit
98e49a8e30
|
|
@ -5,6 +5,7 @@ import cn.ysk.cashier.cons.domain.TbProskuCon;
|
||||||
import cn.ysk.cashier.cons.service.TbProskuConService;
|
import cn.ysk.cashier.cons.service.TbProskuConService;
|
||||||
import cn.ysk.cashier.cons.service.dto.ProskuInfo;
|
import cn.ysk.cashier.cons.service.dto.ProskuInfo;
|
||||||
import cn.ysk.cashier.cons.service.dto.TbProskuConQueryCriteria;
|
import cn.ysk.cashier.cons.service.dto.TbProskuConQueryCriteria;
|
||||||
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
@ -13,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -44,8 +46,14 @@ public class TbProskuConController {
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@Log("新增商品规格耗材信息")
|
@Log("新增商品规格耗材信息")
|
||||||
@ApiOperation("新增商品规格耗材信息")
|
@ApiOperation("新增商品规格耗材信息")
|
||||||
public ResponseEntity<Object> createTbProskuCon(@Validated @RequestBody ProskuInfo resources) throws Exception {
|
public ResponseEntity<Object> createTbProskuCon(@Validated @RequestBody List<ProskuInfo> resources) throws Exception {
|
||||||
return new ResponseEntity<>(tbProskuConService.create(resources),HttpStatus.CREATED);
|
try {
|
||||||
|
return new ResponseEntity<>(tbProskuConService.create(resources),HttpStatus.CREATED);
|
||||||
|
} catch (BadRequestException be) {
|
||||||
|
throw new Exception(be.getMessage());
|
||||||
|
}catch (Exception e){
|
||||||
|
throw new Exception("系统异常");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public interface TbProskuConService {
|
||||||
* @param resources /
|
* @param resources /
|
||||||
* @return TbProskuConDto
|
* @return TbProskuConDto
|
||||||
*/
|
*/
|
||||||
TbProskuConDto create(ProskuInfo resources) throws Exception;
|
TbProskuConDto create(List<ProskuInfo> resources) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑
|
* 编辑
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,19 @@ import cn.ysk.cashier.cons.domain.TbConsSuppFlow;
|
||||||
import cn.ysk.cashier.cons.domain.TbProskuCon;
|
import cn.ysk.cashier.cons.domain.TbProskuCon;
|
||||||
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
import cn.ysk.cashier.cons.repository.TbConsInfoRepository;
|
||||||
import cn.ysk.cashier.cons.service.dto.ProskuInfo;
|
import cn.ysk.cashier.cons.service.dto.ProskuInfo;
|
||||||
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.pojo.product.TbProduct;
|
import cn.ysk.cashier.pojo.product.TbProduct;
|
||||||
import cn.ysk.cashier.pojo.product.TbProductSku;
|
import cn.ysk.cashier.pojo.product.TbProductSku;
|
||||||
import cn.ysk.cashier.repository.product.TbProductRepository;
|
import cn.ysk.cashier.repository.product.TbProductRepository;
|
||||||
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
|
||||||
import cn.ysk.cashier.utils.FileUtil;
|
import cn.ysk.cashier.utils.*;
|
||||||
import cn.ysk.cashier.utils.PageUtil;
|
|
||||||
import cn.ysk.cashier.utils.QueryHelp;
|
|
||||||
import cn.ysk.cashier.utils.ValidationUtil;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import cn.ysk.cashier.cons.repository.TbProskuConRepository;
|
import cn.ysk.cashier.cons.repository.TbProskuConRepository;
|
||||||
import cn.ysk.cashier.cons.service.TbProskuConService;
|
import cn.ysk.cashier.cons.service.TbProskuConService;
|
||||||
import cn.ysk.cashier.cons.service.dto.TbProskuConDto;
|
import cn.ysk.cashier.cons.service.dto.TbProskuConDto;
|
||||||
import cn.ysk.cashier.cons.service.dto.TbProskuConQueryCriteria;
|
import cn.ysk.cashier.cons.service.dto.TbProskuConQueryCriteria;
|
||||||
import cn.ysk.cashier.cons.service.mapstruct.TbProskuConMapper;
|
import cn.ysk.cashier.cons.service.mapstruct.TbProskuConMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
|
@ -38,6 +37,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
public class TbProskuConServiceImpl implements TbProskuConService {
|
public class TbProskuConServiceImpl implements TbProskuConService {
|
||||||
|
|
||||||
private final TbProskuConRepository tbProskuConRepository;
|
private final TbProskuConRepository tbProskuConRepository;
|
||||||
|
|
@ -70,65 +70,85 @@ public class TbProskuConServiceImpl implements TbProskuConService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TbProskuConDto create(ProskuInfo resources) throws Exception {
|
public TbProskuConDto create(List<ProskuInfo> resources) throws BadRequestException,Exception {
|
||||||
|
for (ProskuInfo resource : resources) {
|
||||||
|
TbProduct product= tbProductRepository.getById(resource.getProductId());
|
||||||
|
if(Objects.isNull(product)){
|
||||||
|
throw new BadRequestException("对应的商品信息不存在");
|
||||||
|
}
|
||||||
|
List<TbProskuCon> list=new ArrayList<>();
|
||||||
|
if(product.getIsDistribute().intValue()==1){
|
||||||
|
|
||||||
TbProduct product= tbProductRepository.getById(resources.getProductId());
|
TbConsInfo tbConsInfo= tbConsInfoRepository.findById(resource.getConsInfoId()).orElseGet(TbConsInfo::new);
|
||||||
if(Objects.isNull(product)){
|
|
||||||
throw new Exception("对应的商品信息不存在");
|
|
||||||
}
|
|
||||||
|
|
||||||
TbConsInfo tbConsInfo= tbConsInfoRepository.getById(resources.getConsInfoId());
|
log.info("product.getIsDistribute().intValue():{}", JSONUtil.toJSONString(tbConsInfo));
|
||||||
if(Objects.isNull(tbConsInfo)){
|
if(ObjectUtil.isNull(tbConsInfo)||ObjectUtil.isNull(tbConsInfo.getId())){
|
||||||
throw new Exception("对应的耗材信息不存在");
|
throw new BadRequestException("对应的耗材信息不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TbProskuCon> list=new ArrayList<>();
|
//查询商品对应的所有规格
|
||||||
if(product.getIsDistribute().intValue()==1){
|
List<TbProductSku> skuList= tbProductSkuRepository.searchSku(product.getId().toString());
|
||||||
//查询商品对应的所有规格
|
if(Objects.nonNull(skuList)&&skuList.size()>0){
|
||||||
List<TbProductSku> skuList= tbProductSkuRepository.searchSku(product.getId().toString());
|
for (TbProductSku tbProductSku : skuList) {
|
||||||
if(Objects.nonNull(skuList)&&skuList.size()>0){
|
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConsInfoId(), tbProductSku.getId(), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
||||||
for (TbProductSku tbProductSku : skuList) {
|
if(count<=0){
|
||||||
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resources.getConsInfoId(), tbProductSku.getId(), Integer.valueOf(tbProductSku.getShopId()), Integer.valueOf(tbProductSku.getProductId()));
|
TbProskuCon tbProskuCon=new TbProskuCon();
|
||||||
|
|
||||||
|
tbProskuCon.setShopId(Integer.valueOf(tbProductSku.getShopId()));
|
||||||
|
tbProskuCon.setConInfoId(tbConsInfo.getId());
|
||||||
|
tbProskuCon.setProductId(Integer.valueOf(tbProductSku.getProductId()));
|
||||||
|
tbProskuCon.setProductSkuId(tbProductSku.getId());
|
||||||
|
tbProskuCon.setSurplusStock(resource.getSurplusStock());
|
||||||
|
tbProskuCon.setStatus("1");
|
||||||
|
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
|
list.add(tbProskuCon);
|
||||||
|
}else {
|
||||||
|
throw new BadRequestException(product.getName().concat("对应的耗材信息已存在"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
for (ProskuInfo.SkuInfo skuInfo : resource.getSkuInfos()) {
|
||||||
|
|
||||||
|
|
||||||
|
TbConsInfo tbConsInfo= tbConsInfoRepository.findById(skuInfo.getConInfoId()).orElseGet(TbConsInfo::new);
|
||||||
|
|
||||||
|
log.info("skuInfo:{}", JSONUtil.toJSONString(tbConsInfo));
|
||||||
|
|
||||||
|
if(ObjectUtil.isNull(tbConsInfo)||ObjectUtil.isNull(tbConsInfo.getId())){
|
||||||
|
throw new BadRequestException("对应的耗材信息不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
TbProductSku tbProductSku= tbProductSkuRepository.findById(skuInfo.getSkuId()).orElseGet(TbProductSku::new);
|
||||||
|
if(ObjectUtil.isNull(tbProductSku)||ObjectUtil.isNull(tbProductSku.getId())){
|
||||||
|
throw new BadRequestException("规格信息不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resource.getConsInfoId(), skuInfo.getSkuId(), skuInfo.getShopId(), resource.getProductId());
|
||||||
if(count<=0){
|
if(count<=0){
|
||||||
TbProskuCon tbProskuCon=new TbProskuCon();
|
TbProskuCon tbProskuCon=new TbProskuCon();
|
||||||
|
tbProskuCon.setShopId(Integer.valueOf(skuInfo.getShopId()));
|
||||||
tbProskuCon.setShopId(Integer.valueOf(tbProductSku.getShopId()));
|
tbProskuCon.setConInfoId(tbConsInfo.getId());
|
||||||
tbProskuCon.setConInfoId(resources.getConsInfoId());
|
tbProskuCon.setProductId(resource.getProductId());
|
||||||
tbProskuCon.setProductId(Integer.valueOf(tbProductSku.getProductId()));
|
tbProskuCon.setProductSkuId(skuInfo.getSkuId());
|
||||||
tbProskuCon.setProductSkuId(tbProductSku.getId());
|
tbProskuCon.setSurplusStock(skuInfo.getSurplusStock());
|
||||||
tbProskuCon.setSurplusStock(resources.getSurplusStock());
|
|
||||||
tbProskuCon.setStatus("1");
|
tbProskuCon.setStatus("1");
|
||||||
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
||||||
list.add(tbProskuCon);
|
list.add(tbProskuCon);
|
||||||
}else {
|
}else {
|
||||||
throw new Exception(product.getName().concat("对应的耗材信息已存在"));
|
TbProductSku sku= tbProductSkuRepository.getById(skuInfo.getSkuId());
|
||||||
|
throw new BadRequestException(product.getName().concat("商品对应的").concat(Objects.nonNull(sku.getSpecSnap())?sku.getSpecSnap():"").concat("规格已存在"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
for (ProskuInfo.SkuInfo skuInfo : resources.getSkuInfos()) {
|
|
||||||
int count=tbProskuConRepository.countByConInfoIdAndProductSkuIdAndShopId(resources.getConsInfoId(), skuInfo.getSkuId(), skuInfo.getShopId(), resources.getProductId());
|
|
||||||
if(count<=0){
|
|
||||||
TbProskuCon tbProskuCon=new TbProskuCon();
|
|
||||||
tbProskuCon.setShopId(Integer.valueOf(skuInfo.getShopId()));
|
|
||||||
tbProskuCon.setConInfoId(skuInfo.getConInfoId());
|
|
||||||
tbProskuCon.setProductId(resources.getProductId());
|
|
||||||
tbProskuCon.setProductSkuId(skuInfo.getSkuId());
|
|
||||||
tbProskuCon.setSurplusStock(skuInfo.getSurplusStock());
|
|
||||||
tbProskuCon.setStatus("1");
|
|
||||||
tbProskuCon.setCreateTime(new Timestamp(System.currentTimeMillis()));
|
|
||||||
list.add(tbProskuCon);
|
|
||||||
}else {
|
|
||||||
TbProductSku sku= tbProductSkuRepository.getById(skuInfo.getSkuId());
|
|
||||||
throw new Exception(product.getName().concat("商品对应的").concat(Objects.nonNull(sku.getSpecSnap())?sku.getSpecSnap():"").concat("规格已存在"));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if(Objects.nonNull(list)&&list.size()>0){
|
||||||
|
tbProskuConRepository.saveAll(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
if(Objects.nonNull(list)&&list.size()>0){
|
|
||||||
tbProskuConRepository.saveAll(list);
|
|
||||||
}
|
|
||||||
return new TbProskuConDto();
|
return new TbProskuConDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package cn.ysk.cashier.controller.shop;
|
package cn.ysk.cashier.controller.order;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||||
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||||
|
|
@ -51,27 +51,9 @@ public class TbShopSongOrderController{
|
||||||
@ApiOperation("获取歌曲列表 分页")
|
@ApiOperation("获取歌曲列表 分页")
|
||||||
@AnonymousGetMapping
|
@AnonymousGetMapping
|
||||||
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
|
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
|
||||||
String code = "";
|
return new ResponseEntity<>(tbShopSongOrderService.queryAll(tbShopSongOrder), HttpStatus.OK);
|
||||||
if(redisUtils.hasKey(CacheKey.SONG_URL + tbShopSongOrder.getShopId())){
|
|
||||||
code = (String) redisUtils.get(CacheKey.SONG_URL + tbShopSongOrder.getShopId());
|
|
||||||
}
|
|
||||||
Map<String, Object> stringObjectMap = tbShopSongOrderService.queryAll(tbShopSongOrder);
|
|
||||||
stringObjectMap.put("songUrl",code);
|
|
||||||
return new ResponseEntity<>(stringObjectMap, HttpStatus.OK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("createUrl")
|
|
||||||
@ApiOperation("更新歌手页地址")
|
|
||||||
@AnonymousPostMapping
|
|
||||||
public ResponseEntity<Object> createUrl(String shopId) {
|
|
||||||
String key = RandomStringUtils.randomAlphanumeric(8);
|
|
||||||
redisUtils.set(CacheKey.SONG_URL + shopId, key);
|
|
||||||
redisUtils.set(CacheKey.SONG_URL + key, shopId);
|
|
||||||
return new ResponseEntity<>(key,HttpStatus.OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过主键查询单条数据
|
* 通过主键查询单条数据
|
||||||
*
|
*
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package cn.ysk.cashier.controller.product;
|
package cn.ysk.cashier.controller.product;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
import cn.ysk.cashier.dto.product.TbProductSortCriteria;
|
import cn.ysk.cashier.dto.product.TbProductSortCriteria;
|
||||||
import cn.ysk.cashier.vo.TbProductVo;
|
import cn.ysk.cashier.vo.TbProductVo;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package cn.ysk.cashier.controller.shop;
|
package cn.ysk.cashier.controller.shop;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
|
||||||
import cn.ysk.cashier.annotation.Log;
|
|
||||||
import cn.ysk.cashier.dto.ShopSummaryDto;
|
import cn.ysk.cashier.dto.ShopSummaryDto;
|
||||||
import cn.ysk.cashier.service.SummaryService;
|
import cn.ysk.cashier.service.SummaryService;
|
||||||
import cn.ysk.cashier.vo.TbOrderPayCountVo;
|
import cn.ysk.cashier.vo.TbOrderPayCountVo;
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
package cn.ysk.cashier.controller.shop;
|
package cn.ysk.cashier.controller.shop;
|
||||||
|
|
||||||
import cn.ysk.cashier.annotation.Log;
|
import cn.ysk.cashier.annotation.Log;
|
||||||
|
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.entity.TbShopSong;
|
import cn.ysk.cashier.mybatis.entity.TbShopSong;
|
||||||
import cn.ysk.cashier.mybatis.service.TbShopSongService;
|
import cn.ysk.cashier.mybatis.service.TbShopSongService;
|
||||||
|
import cn.ysk.cashier.utils.CacheKey;
|
||||||
|
import cn.ysk.cashier.utils.RedisUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
@ -16,6 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
|
@ -23,12 +28,33 @@ import java.util.List;
|
||||||
@Api(tags = "歌曲管理")
|
@Api(tags = "歌曲管理")
|
||||||
@RequestMapping("/api/tbShopSong")
|
@RequestMapping("/api/tbShopSong")
|
||||||
public class TbShopSongController {
|
public class TbShopSongController {
|
||||||
|
private final RedisUtils redisUtils;
|
||||||
private final TbShopSongService tbShopSongService;
|
private final TbShopSongService tbShopSongService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询歌曲列表")
|
@ApiOperation("查询歌曲列表")
|
||||||
public ResponseEntity<Object> queryTbShopPurveyor(TbShopSongQueryCriteria criteria){
|
public ResponseEntity<Object> queryTbShopPurveyor(TbShopSongQueryCriteria criteria){
|
||||||
return new ResponseEntity<>(tbShopSongService.queryAll(criteria), HttpStatus.OK);
|
String code = "";
|
||||||
|
if(redisUtils.hasKey(CacheKey.SONG_URL + criteria.getShopId())){
|
||||||
|
code = (String) redisUtils.get(CacheKey.SONG_URL + criteria.getShopId());
|
||||||
|
}else {
|
||||||
|
code = RandomStringUtils.randomAlphanumeric(12);
|
||||||
|
redisUtils.set(CacheKey.SONG_URL + criteria.getShopId(), code);
|
||||||
|
redisUtils.set(CacheKey.SONG_URL + code, criteria.getShopId());
|
||||||
|
}
|
||||||
|
Map<String, Object> stringObjectMap = tbShopSongService.queryAll(criteria);
|
||||||
|
stringObjectMap.put("songUrl",code);
|
||||||
|
return new ResponseEntity<>(stringObjectMap, HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("createUrl")
|
||||||
|
@ApiOperation("更新歌手页地址")
|
||||||
|
@AnonymousPostMapping
|
||||||
|
public ResponseEntity<Object> createUrl(String shopId) {
|
||||||
|
String key = RandomStringUtils.randomAlphanumeric(12);
|
||||||
|
redisUtils.set(CacheKey.SONG_URL + shopId, key);
|
||||||
|
redisUtils.set(CacheKey.SONG_URL + key, shopId);
|
||||||
|
return new ResponseEntity<>(key,HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@ package cn.ysk.cashier.controller.shop;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.ysk.cashier.annotation.AnonymousAccess;
|
import cn.ysk.cashier.annotation.AnonymousAccess;
|
||||||
|
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
|
||||||
|
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
||||||
import cn.ysk.cashier.exception.BadRequestException;
|
import cn.ysk.cashier.exception.BadRequestException;
|
||||||
import cn.ysk.cashier.mybatis.service.TbMShopUserService;
|
import cn.ysk.cashier.mybatis.service.TbMShopUserService;
|
||||||
|
|
@ -20,10 +23,10 @@ import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @author lyf
|
||||||
* @author lyf
|
* @website https://eladmin.vip
|
||||||
* @date 2024-03-01
|
* @date 2024-03-01
|
||||||
**/
|
**/
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Api(tags = "/shop/user管理")
|
@Api(tags = "/shop/user管理")
|
||||||
|
|
@ -41,35 +44,36 @@ public class TbShopUserController {
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
@ApiOperation("查询/shop/user")
|
@ApiOperation("查询/shop/user")
|
||||||
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){
|
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
|
||||||
return new ResponseEntity<>(tbShopUserService.queryAll(criteria,pageable),HttpStatus.OK);
|
return new ResponseEntity<>(tbShopUserService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("queryAllShopUser")
|
@GetMapping("queryAllShopUser")
|
||||||
@ApiOperation("查询商家用户")
|
@ApiOperation("查询商家用户")
|
||||||
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria){
|
@AnonymousGetMapping
|
||||||
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria),HttpStatus.OK);
|
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria) {
|
||||||
|
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("summary")
|
@GetMapping("summary")
|
||||||
@ApiOperation("查询会员概述")
|
@ApiOperation("查询会员概述")
|
||||||
public ResponseEntity<Object> summary(TbShopUserQueryCriteria criteria){
|
public ResponseEntity<Object> summary(TbShopUserQueryCriteria criteria) {
|
||||||
if (StrUtil.isBlank(criteria.getShopId())) {
|
if (StrUtil.isBlank(criteria.getShopId())) {
|
||||||
throw new BadRequestException("店铺id不为空");
|
throw new BadRequestException("店铺id不为空");
|
||||||
}
|
}
|
||||||
return new ResponseEntity<>(tbMShopUserService.summary(criteria),HttpStatus.OK);
|
return new ResponseEntity<>(tbMShopUserService.summary(criteria), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@ApiOperation("新增/shop/user")
|
@ApiOperation("新增/shop/user")
|
||||||
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources){
|
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources) {
|
||||||
return new ResponseEntity<>(tbShopUserService.create(resources),HttpStatus.CREATED);
|
return new ResponseEntity<>(tbShopUserService.create(resources), HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@ApiOperation("修改/shop/user")
|
@ApiOperation("修改/shop/user")
|
||||||
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources){
|
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources) {
|
||||||
tbShopUserService.update(resources);
|
tbShopUserService.update(resources);
|
||||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
@ -80,4 +84,16 @@ public class TbShopUserController {
|
||||||
tbShopUserService.deleteAll(ids);
|
tbShopUserService.deleteAll(ids);
|
||||||
return new ResponseEntity<>(HttpStatus.OK);
|
return new ResponseEntity<>(HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/recharge")
|
||||||
|
@ApiOperation("充值记录")
|
||||||
|
public ResponseEntity<Object> rechargeList(TbShopRechargeListDto criteria, Pageable pageable) {
|
||||||
|
return new ResponseEntity<>(tbShopUserService.rechargeList(criteria, pageable), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/recharge/download")
|
||||||
|
@ApiOperation("导出充值记录")
|
||||||
|
public void rechargeListDownload(HttpServletResponse response, @RequestBody TbShopRechargeListDto criteria) throws IOException {
|
||||||
|
tbShopUserService.rechargeListDownload(response, criteria);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,8 @@ public class TbProductSkuDto implements Serializable {
|
||||||
/** 进货参考价 */
|
/** 进货参考价 */
|
||||||
private BigDecimal guidePrice;
|
private BigDecimal guidePrice;
|
||||||
|
|
||||||
|
private Integer suit;
|
||||||
|
|
||||||
private BigDecimal strategyPrice;
|
private BigDecimal strategyPrice;
|
||||||
|
|
||||||
/** 库存数量 */
|
/** 库存数量 */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package cn.ysk.cashier.dto.shop;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author GYJ
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TbShopRechargeListDto {
|
||||||
|
private String shopId;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date startTime;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date endTime;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package cn.ysk.cashier.dto.shop;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author GYJ
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TbShopRechargeRespDto {
|
||||||
|
private Integer id;
|
||||||
|
private String shopId;
|
||||||
|
private String shopName;
|
||||||
|
private String userId;
|
||||||
|
private String userName;
|
||||||
|
private String userPhone;
|
||||||
|
private Object rechargeAmount;
|
||||||
|
private String rechargeType;
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date rechargeTime;
|
||||||
|
|
||||||
|
public TbShopRechargeRespDto(Integer id, String shopId, String shopName, String userId, String userName, String userPhone,
|
||||||
|
String rechargeAmount, String rechargeType, Date rechargeTime) {
|
||||||
|
this.id = id;
|
||||||
|
this.shopId = shopId;
|
||||||
|
this.shopName = shopName;
|
||||||
|
this.userId = userId;
|
||||||
|
this.userName = userName;
|
||||||
|
this.userPhone = userPhone;
|
||||||
|
this.rechargeAmount = rechargeAmount;
|
||||||
|
this.rechargeType = rechargeType;
|
||||||
|
this.rechargeTime = rechargeTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,16 +5,22 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Table;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author GYJ
|
* @author GYJ
|
||||||
*/
|
*/
|
||||||
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("tb_shop_user_flow")
|
@TableName("tb_shop_user_flow")
|
||||||
|
@Table(name="tb_shop_user_flow")
|
||||||
public class TbShopUserFlow extends Model<TbShopUserFlow> {
|
public class TbShopUserFlow extends Model<TbShopUserFlow> {
|
||||||
|
@Id
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
private Integer shopUserId;
|
private Integer shopUserId;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
package cn.ysk.cashier.mybatis.mapper;
|
package cn.ysk.cashier.mybatis.mapper;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
||||||
import cn.ysk.cashier.vo.ShopUserInfoVo;
|
import cn.ysk.cashier.vo.ShopUserInfoVo;
|
||||||
|
|
@ -17,18 +19,38 @@ public interface ShopUserMapper extends BaseMapper<TbShopUser> {
|
||||||
"FROM tb_shop_user su " +
|
"FROM tb_shop_user su " +
|
||||||
"LEFT JOIN tb_user_info u ON su.user_id = u.id " +
|
"LEFT JOIN tb_user_info u ON su.user_id = u.id " +
|
||||||
"<where> " +
|
"<where> " +
|
||||||
"su.user_id is not null and su.user_id != ''" +
|
|
||||||
"<if test='param.shopId != null and param.shopId != "" and param.shopId != 1'>" +
|
"<if test='param.shopId != null and param.shopId != "" and param.shopId != 1'>" +
|
||||||
"AND su.shop_id = #{param.shopId} " +
|
"AND su.shop_id = #{param.shopId} " +
|
||||||
"</if>" +
|
"</if>" +
|
||||||
"<if test='param.name != null and param.name != ""'>" +
|
"<if test='param.name != null and param.name != ""'>" +
|
||||||
"AND (u.nick_name like concat('%', #{param.name}, '%') or u.telephone like concat('%', #{param.name}, '%'))" +
|
"AND (u.nick_name like concat('%', #{param.name}, '%') or su.name LIKE concat( '%', #{param.name}, '%' ) " +
|
||||||
|
" or u.telephone like concat('%', #{param.name}, '%') or su.telephone like concat('%', #{param.name}, '%'))" +
|
||||||
"</if>" +
|
"</if>" +
|
||||||
"<if test='param.isVip != null and param.isVip != ""'>" +
|
"<if test='isVip != null'>" +
|
||||||
"AND su.is_vip=#{param.isVip}" +
|
"AND su.is_vip=#{isVip}" +
|
||||||
"</if>" +
|
"</if>" +
|
||||||
"</where>" +
|
"</where>" +
|
||||||
"</script>")
|
"</script>")
|
||||||
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Page pageInfo);
|
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Integer isVip, Page pageInfo);
|
||||||
|
|
||||||
|
@Select("<script> " +
|
||||||
|
"select " +
|
||||||
|
"tsuf.id as id, " +
|
||||||
|
"tsu.shop_id as shop_id, " +
|
||||||
|
"tsi.shop_name, " +
|
||||||
|
"tsu.id as user_id, " +
|
||||||
|
"tsu.telephone as user_phone, " +
|
||||||
|
"tsu.`name` as user_name, " +
|
||||||
|
"tsuf.amount as recharge_amount, " +
|
||||||
|
"tsuf.biz_name as recharge_type, " +
|
||||||
|
"tsuf.create_time as recharge_time " +
|
||||||
|
" from tb_shop_user_flow tsuf " +
|
||||||
|
" left join tb_shop_user as tsu on tsuf.shop_user_id = tsu.id " +
|
||||||
|
"left join tb_shop_info as tsi on tsi.id = tsu.shop_id " +
|
||||||
|
"where tsuf.create_time BETWEEN #{param.startTime} and #{param.endTime} and tsuf.biz_code in ('cashMemberIn', 'scanMemberIn', 'scanMemberAwardIn') " +
|
||||||
|
" and tsu.shop_id = #{param.shopId} " +
|
||||||
|
"order by tsuf.create_time desc " +
|
||||||
|
"</script>")
|
||||||
|
IPage<TbShopRechargeRespDto> queryRechargeList(TbShopRechargeListDto param, Page pageInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,19 +16,23 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public interface TbMShopUserMapper extends BaseMapper<TbMShopUser> {
|
public interface TbMShopUserMapper extends BaseMapper<TbMShopUser> {
|
||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"SELECT " +
|
"SELECT \n" +
|
||||||
"COUNT(*) userTotal, " +
|
" COUNT(DISTINCT a.id) AS userTotal, \n" +
|
||||||
"ifnull(SUM( " +
|
" COALESCE(SUM(flow.total_amount), 0) AS chageTotal, \n" +
|
||||||
"IFNULL( b.charge_amount, 0 )), 0) chageTotal, ifnull(SUM( IFNULL( a.amount, 0 )), 0) balanceTotal " +
|
" COALESCE(SUM(a.amount), 0) AS balanceTotal \n" +
|
||||||
"FROM\n" +
|
"FROM \n" +
|
||||||
"tb_shop_user AS a\n" +
|
" tb_shop_user AS a\n" +
|
||||||
"LEFT JOIN tb_user_info AS b ON a.user_id = b.id\n" +
|
" LEFT JOIN (\n" +
|
||||||
"WHERE\n" +
|
" SELECT shop_user_id, SUM(amount) AS total_amount \n" +
|
||||||
" a.shop_id = #{shopId}\n" +
|
" FROM tb_shop_user_flow \n" +
|
||||||
|
" WHERE biz_code IN ('cashMemberIn','scanMemberIn', 'scanMemberAwardIn') \n" +
|
||||||
|
" GROUP BY shop_user_id\n" +
|
||||||
|
" ) AS flow ON flow.shop_user_id = a.id\n" +
|
||||||
|
"WHERE \n" +
|
||||||
|
" a.shop_id = #{shopId} \n" +
|
||||||
"<if test=\"isVip !=null\">\n" +
|
"<if test=\"isVip !=null\">\n" +
|
||||||
" and a.is_vip=#{isVip}\n" +
|
" and a.is_vip=#{isVip}\n" +
|
||||||
"</if>" +
|
"</if>" +
|
||||||
|
|
||||||
"</script>")
|
"</script>")
|
||||||
Map<String, Object> selectUserSummary(@Param("shopId") String shopId, @Param("isVip") Integer isVip);
|
Map<String, Object> selectUserSummary(@Param("shopId") String shopId, @Param("isVip") Integer isVip);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,23 +19,26 @@ public interface TbShopUserFlowMapper extends BaseMapper<TbShopUserFlow> {
|
||||||
* @param shopId 店铺ID
|
* @param shopId 店铺ID
|
||||||
* @param startTime 开始时间
|
* @param startTime 开始时间
|
||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
* @param types 流水类型
|
|
||||||
* @return 用户流水总金额
|
* @return 用户流水总金额
|
||||||
*/
|
*/
|
||||||
@Select("<script>" +
|
@Select("<script>" +
|
||||||
"SELECT IFNULL(SUM(uf.amount), 0) FROM tb_shop_user_flow as uf " +
|
" SELECT \n" +
|
||||||
"JOIN tb_shop_user su ON uf.shop_user_id = su.id " +
|
" COALESCE(SUM(flow.total_amount), 0) AS chageTotal\n" +
|
||||||
"WHERE su.shop_id = #{shopId} " +
|
"FROM \n" +
|
||||||
"AND uf.create_time BETWEEN #{startTime} AND #{endTime} " +
|
" tb_shop_user AS a\n" +
|
||||||
"AND uf.biz_code IN " +
|
" LEFT JOIN (\n" +
|
||||||
"<foreach collection='types' item='type' open='(' separator=',' close=')'> " +
|
" SELECT shop_user_id, SUM(amount) AS total_amount \n" +
|
||||||
"#{type} " +
|
" FROM tb_shop_user_flow \n" +
|
||||||
"</foreach> " +
|
" WHERE biz_code IN ('cashMemberIn','scanMemberIn', 'scanMemberAwardIn') \n" +
|
||||||
|
" AND create_time BETWEEN #{startTime} AND #{endTime} \n" +
|
||||||
|
" GROUP BY shop_user_id\n" +
|
||||||
|
" ) AS flow ON flow.shop_user_id = a.id\n" +
|
||||||
|
"WHERE \n" +
|
||||||
|
" a.shop_id = #{shopId}" +
|
||||||
"</script>")
|
"</script>")
|
||||||
BigDecimal sumUserFlowAmountByConditions(@Param("shopId") Long shopId,
|
BigDecimal sumUserFlowAmountByConditions(@Param("shopId") Long shopId,
|
||||||
@Param("startTime") String startTime,
|
@Param("startTime") String startTime,
|
||||||
@Param("endTime") String endTime,
|
@Param("endTime") String endTime);
|
||||||
@Param("types") List<String> types);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,5 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
|
public interface TbShopUserFlowService extends IService<TbShopUserFlow> {
|
||||||
|
|
||||||
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types);
|
BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper, TbShopUserFlow> implements TbShopUserFlowService {
|
public class TbShopUserFlowServiceImpl extends ServiceImpl<TbShopUserFlowMapper, TbShopUserFlow> implements TbShopUserFlowService {
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime, List<String> types) {
|
public BigDecimal sumUserFlowAmountByConditions(Long shopId, String startTime, String endTime) {
|
||||||
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime, types);
|
return baseMapper.sumUserFlowAmountByConditions(shopId, startTime, endTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,17 @@
|
||||||
/*
|
|
||||||
* 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 cn.hutool.json.JSON;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.bean.copier.CopyOptions;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import cn.hutool.core.bean.copier.CopyOptions;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import javax.validation.constraints.*;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -85,6 +69,9 @@ public class TbProductSku implements Serializable {
|
||||||
@ApiModelProperty(value = "进货参考价")
|
@ApiModelProperty(value = "进货参考价")
|
||||||
private BigDecimal guidePrice;
|
private BigDecimal guidePrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "起售数量 默认为1")
|
||||||
|
private Integer suit = 1;
|
||||||
|
|
||||||
@Column(name = "`strategy_price`")
|
@Column(name = "`strategy_price`")
|
||||||
@ApiModelProperty(value = "strategyPrice")
|
@ApiModelProperty(value = "strategyPrice")
|
||||||
private BigDecimal strategyPrice;
|
private BigDecimal strategyPrice;
|
||||||
|
|
@ -132,13 +119,17 @@ public class TbProductSku implements Serializable {
|
||||||
@Column(name = "`updated_at`")
|
@Column(name = "`updated_at`")
|
||||||
@ApiModelProperty(value = "updatedAt")
|
@ApiModelProperty(value = "updatedAt")
|
||||||
private Long updatedAt;
|
private Long updatedAt;
|
||||||
public void copy(TbProductSku source){
|
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
@Column(name = "`is_del`")
|
||||||
}
|
private Integer isDel;
|
||||||
|
|
||||||
@Column(name = "`is_pause_sale`")
|
@Column(name = "`is_pause_sale`")
|
||||||
@ApiModelProperty(value = "是否暂停销售")
|
@ApiModelProperty(value = "是否暂停销售")
|
||||||
private Integer isPauseSale = 0;
|
private Integer isPauseSale = 0;
|
||||||
|
|
||||||
|
public void copy(TbProductSku source){
|
||||||
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ import java.util.List;
|
||||||
**/
|
**/
|
||||||
public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Integer>, JpaSpecificationExecutor<TbProductSku> {
|
public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Integer>, JpaSpecificationExecutor<TbProductSku> {
|
||||||
|
|
||||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId IN :productId")
|
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId IN :productId and sku.isDel=0")
|
||||||
List<TbProductSku> searchSku(@Param("productId")List<String> productId);
|
List<TbProductSku> searchSku(@Param("productId")List<String> productId);
|
||||||
|
|
||||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId")
|
@Query("SELECT sku FROM TbProductSku sku WHERE sku.productId = :productId and sku.isDel=0")
|
||||||
List<TbProductSku> searchSku(@Param("productId")String productId);
|
List<TbProductSku> searchSku(@Param("productId")String productId);
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
|
@ -34,7 +34,12 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
@Query("DELETE FROM TbProductSku sku WHERE sku.productId = :productId")
|
@Query("DELETE FROM TbProductSku sku WHERE sku.productId = :productId")
|
||||||
Integer deleteByProductId(@Param("productId") String productId);
|
Integer deleteByProductId(@Param("productId") String productId);
|
||||||
|
|
||||||
@Query("SELECT sku FROM TbProductSku sku WHERE sku.barCode = :barCode")
|
@Transactional
|
||||||
|
@Modifying
|
||||||
|
@Query("update FROM TbProductSku sku set sku.isDel=1 WHERE sku.id = :skuId")
|
||||||
|
Integer deleteBySkuId(@Param("skuId") String skuId);
|
||||||
|
|
||||||
|
@Query("SELECT sku FROM TbProductSku sku WHERE sku.barCode = :barCode and sku.isDel=0")
|
||||||
TbProductSku searchBarCode(@Param("barCode")String barCode);
|
TbProductSku searchBarCode(@Param("barCode")String barCode);
|
||||||
|
|
||||||
@Query("SELECT new cn.ysk.cashier.vo.StockVo(" +
|
@Query("SELECT new cn.ysk.cashier.vo.StockVo(" +
|
||||||
|
|
@ -47,6 +52,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
"pro.shopId = :shopId " +
|
"pro.shopId = :shopId " +
|
||||||
"AND pro.status = 1 " +
|
"AND pro.status = 1 " +
|
||||||
|
"AND sku.isDel=0 " +
|
||||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||||
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
||||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||||
|
|
@ -65,6 +71,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
"pro.shopId = :shopId " +
|
"pro.shopId = :shopId " +
|
||||||
"AND pro.status = 1 " +
|
"AND pro.status = 1 " +
|
||||||
|
"AND sku.isDel = 0 " +
|
||||||
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
"AND (:categoryId IS NULL OR pro.categoryId = :categoryId) " +
|
||||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||||
|
|
@ -87,6 +94,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
"pro.shopId = :shopId " +
|
"pro.shopId = :shopId " +
|
||||||
"AND pro.status = 1 " +
|
"AND pro.status = 1 " +
|
||||||
|
"AND sku.isDel=0 " +
|
||||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||||
"group by pro.id " +
|
"group by pro.id " +
|
||||||
|
|
@ -104,6 +112,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
"left join TbShopUnit unit on pro.unitId = unit.id " +
|
"left join TbShopUnit unit on pro.unitId = unit.id " +
|
||||||
"where " +
|
"where " +
|
||||||
"sku.productId = :productId " +
|
"sku.productId = :productId " +
|
||||||
|
"AND sku.isDel=0 " +
|
||||||
"order by " +
|
"order by " +
|
||||||
"sku.stockNumber desc "
|
"sku.stockNumber desc "
|
||||||
)
|
)
|
||||||
|
|
@ -119,6 +128,7 @@ public interface TbProductSkuRepository extends JpaRepository<TbProductSku, Inte
|
||||||
"WHERE " +
|
"WHERE " +
|
||||||
"pro.shopId = :shopId " +
|
"pro.shopId = :shopId " +
|
||||||
"AND pro.status = 1 " +
|
"AND pro.status = 1 " +
|
||||||
|
"AND sku.isDel=0 " +
|
||||||
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
"AND (:proName IS NULL OR pro.name LIKE %:proName%) " +
|
||||||
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
"AND (:isStock IS NULL OR pro.isStock = :isStock) " +
|
||||||
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
"AND (:num IS NULL OR sku.stockNumber < :num) " +
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,7 @@
|
||||||
package cn.ysk.cashier.repository.shop;
|
package cn.ysk.cashier.repository.shop;
|
||||||
|
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
||||||
import cn.ysk.cashier.vo.ShopUserInfoVo;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.data.domain.Page;
|
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
|
@ -27,7 +24,6 @@ import org.springframework.data.jpa.repository.Query;
|
||||||
import javax.persistence.Tuple;
|
import javax.persistence.Tuple;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
|
|
@ -48,6 +44,4 @@ public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>
|
||||||
@Query("SELECT user.userId from TbShopUser user where user.shopId = :shopId")
|
@Query("SELECT user.userId from TbShopUser user where user.shopId = :shopId")
|
||||||
List<Integer> getUserIdByShopId(String shopId);
|
List<Integer> getUserIdByShopId(String shopId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -379,8 +379,7 @@ public class SummaryServiceImpl implements SummaryService {
|
||||||
|
|
||||||
BigDecimal recharge = tbShopUserFlowService.sumUserFlowAmountByConditions(Long.valueOf(summaryDto.getShopId()),
|
BigDecimal recharge = tbShopUserFlowService.sumUserFlowAmountByConditions(Long.valueOf(summaryDto.getShopId()),
|
||||||
tbOrderPayCountByDayVo.getTradeDay() + " 00:00:00",
|
tbOrderPayCountByDayVo.getTradeDay() + " 00:00:00",
|
||||||
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59",
|
tbOrderPayCountByDayVo.getTradeDay() + " 23:59:59");
|
||||||
Arrays.asList("cashMemberIn", "scanMemberIn"));
|
|
||||||
tbOrderPayCountByDayVo.setRecharge(recharge);
|
tbOrderPayCountByDayVo.setRecharge(recharge);
|
||||||
|
|
||||||
BigDecimal decimal = tbOrderInfoRepository.queryRefundOrderAmountByTradeDay(summaryDto.getShopId(), tbOrderPayCountByDayVo.getTradeDay());
|
BigDecimal decimal = tbOrderInfoRepository.queryRefundOrderAmountByTradeDay(summaryDto.getShopId(), tbOrderPayCountByDayVo.getTradeDay());
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
detail.setRefundNumber(detail.getNum());
|
detail.setRefundNumber(detail.getNum());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
orderInfoVo.setTableName(tbOrderInfo.getTableName());
|
||||||
orderInfoVo.setDetailList(details);
|
orderInfoVo.setDetailList(details);
|
||||||
BeanUtils.copyProperties(tbOrderInfo, orderInfoVo);
|
BeanUtils.copyProperties(tbOrderInfo, orderInfoVo);
|
||||||
orderInfoVo.setRefundAmount(refundAmount);
|
orderInfoVo.setRefundAmount(refundAmount);
|
||||||
|
|
@ -188,6 +189,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
criteria.setOrderType(null);
|
criteria.setOrderType(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TbOrderInfoDto> dto = tbOrderInfoMapper.toDto(tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
List<TbOrderInfoDto> dto = tbOrderInfoMapper.toDto(tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
|
||||||
for (TbOrderInfoDto tbOrderInfo : dto) {
|
for (TbOrderInfoDto tbOrderInfo : dto) {
|
||||||
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
|
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
|
||||||
|
|
@ -357,6 +359,8 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
@Override
|
@Override
|
||||||
public void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException {
|
public void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException {
|
||||||
List<Map<String, Object>> list = new ArrayList<>();
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
|
||||||
|
all=all.stream().sorted(Comparator.comparing(TbOrderInfoDto::getId).reversed()).collect(Collectors.toList());
|
||||||
for (TbOrderInfoDto tbOrderInfo : all) {
|
for (TbOrderInfoDto tbOrderInfo : all) {
|
||||||
Map<String, Object> map = new LinkedHashMap<>();
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
map.put("订单编号", tbOrderInfo.getOrderNo());
|
map.put("订单编号", tbOrderInfo.getOrderNo());
|
||||||
|
|
|
||||||
|
|
@ -458,24 +458,33 @@ public class TbProductServiceImpl implements TbProductService {
|
||||||
|
|
||||||
//sku
|
//sku
|
||||||
if (resources.getSkuList() != null) {
|
if (resources.getSkuList() != null) {
|
||||||
List<TbProductSku> skuList = new ArrayList<>();
|
// List<TbProductSku> skuList = new ArrayList<>();
|
||||||
for (TbProductSku sku : resources.getSkuList()) {
|
// for (TbProductSku sku : resources.getSkuList()) {
|
||||||
TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
|
// TbProductSku tbProductSku = tbProductSkuRepository.searchBarCode(sku.getBarCode());
|
||||||
if (tbProductSku != null) {
|
// if (tbProductSku != null) {
|
||||||
tbProductSkuRepository.updateByBarCode(sku.getBarCode(), sku.getCostPrice(), sku.getCoverImg(), sku.getFirstShared(), sku.getMemberPrice(),
|
// tbProductSkuRepository.updateByBarCode(sku.getBarCode(), sku.getCostPrice(), sku.getCoverImg(), sku.getFirstShared(), sku.getMemberPrice(),
|
||||||
sku.getOriginPrice(), sku.getSalePrice(), sku.getSpecSnap(), tbProductSku.getId());
|
// sku.getOriginPrice(), sku.getSalePrice(), sku.getSpecSnap(), tbProductSku.getId());
|
||||||
} else {
|
// } else {
|
||||||
if ("sku".equals(save.getTypeEnum())) {
|
// if ("sku".equals(save.getTypeEnum())) {
|
||||||
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
|
// tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
|
||||||
|
// }
|
||||||
|
// sku.setProductId(String.valueOf(save.getId()));
|
||||||
|
// sku.setShopId(save.getShopId());
|
||||||
|
// sku.setCreatedAt(Instant.now().toEpochMilli());
|
||||||
|
// sku.setUpdatedAt(Instant.now().toEpochMilli());
|
||||||
|
// skuList.add(sku);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if ("sku".equals(save.getTypeEnum())) {
|
||||||
|
List<Integer> collect = resources.getSkuList().stream().map(TbProductSku::getId).collect(Collectors.toList());
|
||||||
|
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(resources.getId().toString());
|
||||||
|
for (TbProductSku productSkus : tbProductSkus) {
|
||||||
|
if (!collect.contains(productSkus.getId())) {
|
||||||
|
tbProductSkuRepository.deleteBySkuId(productSkus.getId().toString());
|
||||||
}
|
}
|
||||||
sku.setProductId(String.valueOf(save.getId()));
|
|
||||||
sku.setShopId(save.getShopId());
|
|
||||||
sku.setCreatedAt(Instant.now().toEpochMilli());
|
|
||||||
sku.setUpdatedAt(Instant.now().toEpochMilli());
|
|
||||||
skuList.add(sku);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tbProductSkuRepository.saveAll(skuList);
|
tbProductSkuRepository.saveAll(resources.getSkuList());
|
||||||
}
|
}
|
||||||
//保存到sku_result
|
//保存到sku_result
|
||||||
if ("sku".equals(resources.getTypeEnum())) {
|
if ("sku".equals(resources.getTypeEnum())) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
package cn.ysk.cashier.service.impl.shopimpl;
|
package cn.ysk.cashier.service.impl.shopimpl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUserDto;
|
import cn.ysk.cashier.dto.shop.TbShopUserDto;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
||||||
import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
|
import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
|
||||||
|
|
@ -22,6 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -45,9 +50,22 @@ public class TbShopUserServiceImpl implements TbShopUserService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
|
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
|
||||||
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria,
|
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria, criteria.getIsVip(),
|
||||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
|
||||||
return PageUtil.toPlusPage(iPage.getRecords(),Integer.valueOf(iPage.getTotal()+""));
|
|
||||||
|
for (ShopUserInfoVo shopUserInfoVo : iPage.getRecords()) {
|
||||||
|
if (StrUtil.isBlank(shopUserInfoVo.getNickName())) {
|
||||||
|
tbShopUserRepository.findById(shopUserInfoVo.getId()).ifPresent(tbShopUser -> {
|
||||||
|
shopUserInfoVo.setNickName(tbShopUser.getName());
|
||||||
|
shopUserInfoVo.setBirthDay(tbShopUser.getBirthDay());
|
||||||
|
shopUserInfoVo.setHeadImg(tbShopUser.getHeadImg());
|
||||||
|
shopUserInfoVo.setTelephone(tbShopUser.getTelephone());
|
||||||
|
shopUserInfoVo.setTotalScore(0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return PageUtil.toPlusPage(iPage.getRecords(), Integer.valueOf(iPage.getTotal() + ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -129,4 +147,34 @@ public class TbShopUserServiceImpl implements TbShopUserService {
|
||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<TbShopRechargeRespDto> rechargeList(TbShopRechargeListDto criteria, Pageable pageable) {
|
||||||
|
if (criteria.getStartTime() == null) {
|
||||||
|
criteria.setStartTime(DateUtil.parseDate("2024-01-01 00:00:00"));
|
||||||
|
}
|
||||||
|
if (criteria.getEndTime() == null) {
|
||||||
|
criteria.setEndTime(DateUtil.date(Instant.now()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return shopUserMapper.queryRechargeList(criteria,
|
||||||
|
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageable == null ? 0 : pageable.getPageNumber(), pageable == null ? 1000000 : pageable.getPageSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void rechargeListDownload(HttpServletResponse response, TbShopRechargeListDto criteria) throws IOException {
|
||||||
|
List<Map<String, Object>> list = new ArrayList<>();
|
||||||
|
IPage<TbShopRechargeRespDto> page = rechargeList(criteria, null);
|
||||||
|
for (TbShopRechargeRespDto tbShopRechargeRespDto : page.getRecords()) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<>();
|
||||||
|
map.put("id", tbShopRechargeRespDto.getId());
|
||||||
|
map.put("门店", tbShopRechargeRespDto.getShopName());
|
||||||
|
map.put("用户手机号", tbShopRechargeRespDto.getUserPhone());
|
||||||
|
map.put("用户名", tbShopRechargeRespDto.getUserName());
|
||||||
|
map.put("充值金额", tbShopRechargeRespDto.getRechargeAmount());
|
||||||
|
map.put("充值类型", tbShopRechargeRespDto.getRechargeType());
|
||||||
|
map.put("充值时间", tbShopRechargeRespDto.getRechargeTime());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
FileUtil.downloadExcel(list, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
package cn.ysk.cashier.service.shop;
|
package cn.ysk.cashier.service.shop;
|
||||||
|
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
|
||||||
|
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
|
||||||
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
import cn.ysk.cashier.pojo.shop.TbShopUser;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUserDto;
|
import cn.ysk.cashier.dto.shop.TbShopUserDto;
|
||||||
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -75,4 +79,14 @@ public interface TbShopUserService {
|
||||||
*/
|
*/
|
||||||
void download(List<TbShopUserDto> all, HttpServletResponse response) throws IOException;
|
void download(List<TbShopUserDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值记录
|
||||||
|
* @param criteria 条件
|
||||||
|
* @param pageable 分页参数
|
||||||
|
* @return Map<String,Object>
|
||||||
|
*/
|
||||||
|
IPage<TbShopRechargeRespDto> rechargeList(TbShopRechargeListDto criteria, Pageable pageable);
|
||||||
|
|
||||||
|
void rechargeListDownload(HttpServletResponse response, TbShopRechargeListDto criteria) throws IOException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,8 @@ public class TbOrderInfoVo {
|
||||||
|
|
||||||
private String tableId;
|
private String tableId;
|
||||||
|
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
private BigDecimal smallChange;
|
private BigDecimal smallChange;
|
||||||
|
|
||||||
private String sendType;
|
private String sendType;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue