更改目录结构

This commit is contained in:
liuyingfang
2024-03-02 18:31:44 +08:00
parent 8f7acca8e6
commit 0a70a66807
603 changed files with 2256 additions and 6114 deletions

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.BotButtonConfig;
import cn.ysk.cashier.dto.BotButtonConfigDto;
import cn.ysk.cashier.dto.BotButtonConfigQueryCriteria;
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 admin
* @date 2023-10-31
**/
public interface BotButtonConfigService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(BotButtonConfigQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotButtonConfigDto>
*/
List<BotButtonConfigDto> queryAll(BotButtonConfigQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return BotButtonConfigDto
*/
BotButtonConfigDto findById(Integer id);
/**
* 创建
* @param resources /
* @return BotButtonConfigDto
*/
BotButtonConfigDto create(BotButtonConfig resources);
/**
* 编辑
* @param resources /
*/
void update(BotButtonConfig resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<BotButtonConfigDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.BotConfig;
import cn.ysk.cashier.dto.BotConfigDto;
import cn.ysk.cashier.dto.BotConfigQueryCriteria;
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 admin
* @date 2023-10-31
**/
public interface BotConfigService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(BotConfigQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotConfigDto>
*/
List<BotConfigDto> queryAll(BotConfigQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return BotConfigDto
*/
BotConfigDto findById(Integer id);
/**
* 创建
* @param resources /
* @return BotConfigDto
*/
BotConfigDto create(BotConfig resources);
/**
* 编辑
* @param resources /
*/
void update(BotConfig resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<BotConfigDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.BotUserFlow;
import cn.ysk.cashier.dto.BotUserFlowDto;
import cn.ysk.cashier.dto.BotUserFlowQueryCriteria;
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 admin
* @date 2023-10-30
**/
public interface BotUserFlowService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(BotUserFlowQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotUserFlowDto>
*/
List<BotUserFlowDto> queryAll(BotUserFlowQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return BotUserFlowDto
*/
BotUserFlowDto findById(Integer id);
/**
* 创建
* @param resources /
* @return BotUserFlowDto
*/
BotUserFlowDto create(BotUserFlow resources);
/**
* 编辑
* @param resources /
*/
void update(BotUserFlow resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<BotUserFlowDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.BotUser;
import cn.ysk.cashier.dto.BotUserDto;
import cn.ysk.cashier.dto.BotUserQueryCriteria;
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 admin
* @date 2023-10-30
**/
public interface BotUserService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(BotUserQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<BotUserDto>
*/
List<BotUserDto> queryAll(BotUserQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return BotUserDto
*/
BotUserDto findById(Integer id);
/**
* 创建
* @param resources /
* @return BotUserDto
*/
BotUserDto create(BotUser resources);
/**
* 编辑
* @param resources /
*/
void update(BotUser resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<BotUserDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,92 @@
/*
* 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.service;
import cn.ysk.cashier.pojo.product.TbProductStockOperate;
import cn.ysk.cashier.vo.ProductStockOperateVO;
import cn.ysk.cashier.dto.product.OutAndOnDto;
import cn.ysk.cashier.dto.product.TbProductStockOperateDto;
import cn.ysk.cashier.dto.product.TbProductStockOperateQueryCriteria;
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-25
**/
public interface TbProductStockOperateService {
/**
* 查询数据分页
* @param criteria 条件
* @return Map<String,Object>
*/
Map<String,Object> queryAllPage(TbProductStockOperateQueryCriteria criteria);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductStockOperateDto>
*/
List<TbProductStockOperateDto> queryAll(TbProductStockOperateQueryCriteria criteria);
/**
* 作废
*/
void nullify(Integer id);
/**
* 根据ID查询
* @param id ID
* @return TbProductStockOperateDto
*/
ProductStockOperateVO findById(Integer id);
/**
* 创建
* @param resources /
* @return TbProductStockOperateDto
*/
TbProductStockOperateDto create(TbProductStockOperate resources);
OutAndOnDto createOutAndONOperate(OutAndOnDto resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductStockOperate resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductStockOperateDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.TbRenewalsPayLog;
import cn.ysk.cashier.dto.TbRenewalsPayLogDto;
import cn.ysk.cashier.dto.TbRenewalsPayLogQueryCriteria;
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 2023-11-07
**/
public interface TbRenewalsPayLogService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbRenewalsPayLogDto>
*/
List<TbRenewalsPayLogDto> queryAll(TbRenewalsPayLogQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbRenewalsPayLogDto
*/
TbRenewalsPayLogDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbRenewalsPayLogDto
*/
TbRenewalsPayLogDto create(TbRenewalsPayLog resources);
/**
* 编辑
* @param resources /
*/
void update(TbRenewalsPayLog resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbRenewalsPayLogDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.TbShopPayType;
import cn.ysk.cashier.dto.TbShopPayTypeDto;
import cn.ysk.cashier.dto.TbShopPayTypeQueryCriteria;
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 2023-11-03
**/
public interface TbShopPayTypeService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopPayTypeQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopPayTypeDto>
*/
List<TbShopPayTypeDto> queryAll(TbShopPayTypeQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopPayTypeDto
*/
TbShopPayTypeDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopPayTypeDto
*/
TbShopPayTypeDto create(TbShopPayType resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopPayType resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopPayTypeDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service;
import cn.ysk.cashier.pojo.TbUserInfo;
import cn.ysk.cashier.dto.TbUserInfoDto;
import cn.ysk.cashier.dto.TbUserInfoQueryCriteria;
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 2023-11-13
**/
public interface TbUserInfoService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbUserInfoQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbUserInfoDto>
*/
List<TbUserInfoDto> queryAll(TbUserInfoQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbUserInfoDto
*/
TbUserInfoDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbUserInfoDto
*/
TbUserInfoDto create(TbUserInfo resources);
/**
* 编辑
* @param resources /
*/
void update(TbUserInfo resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbUserInfoDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.impl;
import cn.ysk.cashier.pojo.BotButtonConfig;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.BotButtonConfigRepository;
import cn.ysk.cashier.service.BotButtonConfigService;
import cn.ysk.cashier.dto.BotButtonConfigDto;
import cn.ysk.cashier.dto.BotButtonConfigQueryCriteria;
import cn.ysk.cashier.mapper.BotButtonConfigMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 admin
* @date 2023-10-31
**/
@Service
@RequiredArgsConstructor
public class BotButtonConfigServiceImpl implements BotButtonConfigService {
private final BotButtonConfigRepository botButtonConfigRepository;
private final BotButtonConfigMapper botButtonConfigMapper;
@Override
public Map<String,Object> queryAll(BotButtonConfigQueryCriteria criteria, Pageable pageable){
Page<BotButtonConfig> page = botButtonConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botButtonConfigMapper::toDto));
}
@Override
public List<BotButtonConfigDto> queryAll(BotButtonConfigQueryCriteria criteria){
return botButtonConfigMapper.toDto(botButtonConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public BotButtonConfigDto findById(Integer id) {
BotButtonConfig botButtonConfig = botButtonConfigRepository.findById(id).orElseGet(BotButtonConfig::new);
ValidationUtil.isNull(botButtonConfig.getId(),"BotButtonConfig","id",id);
return botButtonConfigMapper.toDto(botButtonConfig);
}
@Override
@Transactional(rollbackFor = Exception.class)
public BotButtonConfigDto create(BotButtonConfig resources) {
return botButtonConfigMapper.toDto(botButtonConfigRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BotButtonConfig resources) {
BotButtonConfig botButtonConfig = botButtonConfigRepository.findById(resources.getId()).orElseGet(BotButtonConfig::new);
ValidationUtil.isNull( botButtonConfig.getId(),"BotButtonConfig","id",resources.getId());
botButtonConfig.copy(resources);
botButtonConfigRepository.save(botButtonConfig);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
botButtonConfigRepository.deleteById(id);
}
}
@Override
public void download(List<BotButtonConfigDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotButtonConfigDto botButtonConfig : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("按钮名称", botButtonConfig.getButtonName());
map.put("按钮值", botButtonConfig.getButtonValue());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,106 @@
/*
* 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.service.impl;
import cn.ysk.cashier.pojo.BotConfig;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.BotConfigRepository;
import cn.ysk.cashier.service.BotConfigService;
import cn.ysk.cashier.dto.BotConfigDto;
import cn.ysk.cashier.dto.BotConfigQueryCriteria;
import cn.ysk.cashier.mapper.BotConfigMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 admin
* @date 2023-10-31
**/
@Service
@RequiredArgsConstructor
public class BotConfigServiceImpl implements BotConfigService {
private final BotConfigRepository botConfigRepository;
private final BotConfigMapper botConfigMapper;
@Override
public Map<String,Object> queryAll(BotConfigQueryCriteria criteria, Pageable pageable){
Page<BotConfig> page = botConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botConfigMapper::toDto));
}
@Override
public List<BotConfigDto> queryAll(BotConfigQueryCriteria criteria){
return botConfigMapper.toDto(botConfigRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public BotConfigDto findById(Integer id) {
BotConfig botConfig = botConfigRepository.findById(id).orElseGet(BotConfig::new);
ValidationUtil.isNull(botConfig.getId(),"BotConfig","id",id);
return botConfigMapper.toDto(botConfig);
}
@Override
@Transactional(rollbackFor = Exception.class)
public BotConfigDto create(BotConfig resources) {
return botConfigMapper.toDto(botConfigRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BotConfig resources) {
BotConfig botConfig = botConfigRepository.findById(resources.getId()).orElseGet(BotConfig::new);
ValidationUtil.isNull( botConfig.getId(),"BotConfig","id",resources.getId());
botConfig.copy(resources);
botConfigRepository.save(botConfig);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
botConfigRepository.deleteById(id);
}
}
@Override
public void download(List<BotConfigDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotConfigDto botConfig : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("元素键值", botConfig.getConfigKey());
map.put("元素值", botConfig.getConfigValue());
map.put("描述", botConfig.getRemark());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,110 @@
/*
* 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.service.impl;
import cn.ysk.cashier.pojo.BotUserFlow;
import cn.ysk.cashier.repository.BotUserFlowRepository;
import cn.ysk.cashier.service.BotUserFlowService;
import cn.ysk.cashier.dto.BotUserFlowDto;
import cn.ysk.cashier.dto.BotUserFlowQueryCriteria;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.mapper.BotUserFlowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 admin
* @date 2023-10-30
**/
@Service
@RequiredArgsConstructor
public class BotUserFlowServiceImpl implements BotUserFlowService {
private final BotUserFlowRepository botUserFlowRepository;
private final BotUserFlowMapper botUserFlowMapper;
@Override
public Map<String,Object> queryAll(BotUserFlowQueryCriteria criteria, Pageable pageable){
Page<BotUserFlow> page = botUserFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botUserFlowMapper::toDto));
}
@Override
public List<BotUserFlowDto> queryAll(BotUserFlowQueryCriteria criteria){
return botUserFlowMapper.toDto(botUserFlowRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public BotUserFlowDto findById(Integer id) {
BotUserFlow botUserFlow = botUserFlowRepository.findById(id).orElseGet(BotUserFlow::new);
ValidationUtil.isNull(botUserFlow.getId(),"BotUserFlow","id",id);
return botUserFlowMapper.toDto(botUserFlow);
}
@Override
@Transactional(rollbackFor = Exception.class)
public BotUserFlowDto create(BotUserFlow resources) {
return botUserFlowMapper.toDto(botUserFlowRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BotUserFlow resources) {
BotUserFlow botUserFlow = botUserFlowRepository.findById(resources.getId()).orElseGet(BotUserFlow::new);
ValidationUtil.isNull( botUserFlow.getId(),"BotUserFlow","id",resources.getId());
botUserFlow.copy(resources);
botUserFlowRepository.save(botUserFlow);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
botUserFlowRepository.deleteById(id);
}
}
@Override
public void download(List<BotUserFlowDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotUserFlowDto botUserFlow : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("电报号", botUserFlow.getUserTelegramId());
map.put("用户名称", botUserFlow.getUserName());
map.put("业务代码", botUserFlow.getBizCode());
map.put("变动金额", botUserFlow.getAmount());
map.put("变动前金额", botUserFlow.getOldBalance());
map.put("变动后金额", botUserFlow.getNewBalance());
map.put("创建时间", botUserFlow.getCreateTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -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 cn.ysk.cashier.service.impl;
import cn.ysk.cashier.pojo.BotUser;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.BotUserRepository;
import cn.ysk.cashier.service.BotUserService;
import cn.ysk.cashier.dto.BotUserDto;
import cn.ysk.cashier.dto.BotUserQueryCriteria;
import cn.ysk.cashier.mapper.BotUserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 admin
* @date 2023-10-30
**/
@Service
@RequiredArgsConstructor
public class BotUserServiceImpl implements BotUserService {
private final BotUserRepository botUserRepository;
private final BotUserMapper botUserMapper;
@Override
public Map<String,Object> queryAll(BotUserQueryCriteria criteria, Pageable pageable){
Page<BotUser> page = botUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(botUserMapper::toDto));
}
@Override
public List<BotUserDto> queryAll(BotUserQueryCriteria criteria){
return botUserMapper.toDto(botUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public BotUserDto findById(Integer id) {
BotUser botUser = botUserRepository.findById(id).orElseGet(BotUser::new);
ValidationUtil.isNull(botUser.getId(),"BotUser","id",id);
return botUserMapper.toDto(botUser);
}
@Override
@Transactional(rollbackFor = Exception.class)
public BotUserDto create(BotUser resources) {
return botUserMapper.toDto(botUserRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(BotUser resources) {
BotUser botUser = botUserRepository.findById(resources.getId()).orElseGet(BotUser::new);
ValidationUtil.isNull( botUser.getId(),"BotUser","id",resources.getId());
botUser.copy(resources);
botUserRepository.save(botUser);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
botUserRepository.deleteById(id);
}
}
@Override
public void download(List<BotUserDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (BotUserDto botUser : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" fatherId", botUser.getFatherId());
map.put("父级电报号", botUser.getFatherTelegramId());
map.put("电报号", botUser.getUserTelegramId());
map.put("用户名称", botUser.getUserName());
map.put("组电报号", botUser.getGroupTelegramId());
map.put("用户代码", botUser.getUserCode());
map.put(" userPayPass", botUser.getUserPayPass());
map.put(" bombStatus", botUser.getBombStatus());
map.put("用户状态", botUser.getBotStatus());
map.put("总充值", botUser.getUsdtRechargeTotal());
map.put("总提现", botUser.getUsdtWithdrawTotal());
map.put("总资金", botUser.getBalance());
map.put("冻结资金", botUser.getFreezeBalance());
map.put("版本号", botUser.getVersion());
map.put("创建时间", botUser.getCreateTime());
map.put("更新时间", botUser.getUpdateTime());
map.put("语言", botUser.getUserLanguage());
map.put("质押资金", botUser.getChipBalance());
map.put("绑定时间", botUser.getFatherBindTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,116 @@
/*
* 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.service.impl;
import cn.ysk.cashier.pojo.TbRenewalsPayLog;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.TbRenewalsPayLogRepository;
import cn.ysk.cashier.service.TbRenewalsPayLogService;
import cn.ysk.cashier.dto.TbRenewalsPayLogDto;
import cn.ysk.cashier.dto.TbRenewalsPayLogQueryCriteria;
import cn.ysk.cashier.mapper.TbRenewalsPayLogMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 2023-11-07
**/
@Service
@RequiredArgsConstructor
public class TbRenewalsPayLogServiceImpl implements TbRenewalsPayLogService {
private final TbRenewalsPayLogRepository tbRenewalsPayLogRepository;
private final TbRenewalsPayLogMapper tbRenewalsPayLogMapper;
@Override
public Map<String,Object> queryAll(TbRenewalsPayLogQueryCriteria criteria, Pageable pageable){
Page<TbRenewalsPayLog> page = tbRenewalsPayLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbRenewalsPayLogMapper::toDto));
}
@Override
public List<TbRenewalsPayLogDto> queryAll(TbRenewalsPayLogQueryCriteria criteria){
return tbRenewalsPayLogMapper.toDto(tbRenewalsPayLogRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbRenewalsPayLogDto findById(Integer id) {
TbRenewalsPayLog tbRenewalsPayLog = tbRenewalsPayLogRepository.findById(id).orElseGet(TbRenewalsPayLog::new);
ValidationUtil.isNull(tbRenewalsPayLog.getId(),"TbRenewalsPayLog","id",id);
return tbRenewalsPayLogMapper.toDto(tbRenewalsPayLog);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbRenewalsPayLogDto create(TbRenewalsPayLog resources) {
return tbRenewalsPayLogMapper.toDto(tbRenewalsPayLogRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbRenewalsPayLog resources) {
TbRenewalsPayLog tbRenewalsPayLog = tbRenewalsPayLogRepository.findById(resources.getId()).orElseGet(TbRenewalsPayLog::new);
ValidationUtil.isNull( tbRenewalsPayLog.getId(),"TbRenewalsPayLog","id",resources.getId());
tbRenewalsPayLog.copy(resources);
tbRenewalsPayLogRepository.save(tbRenewalsPayLog);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbRenewalsPayLogRepository.deleteById(id);
}
}
@Override
public void download(List<TbRenewalsPayLogDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbRenewalsPayLogDto tbRenewalsPayLog : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("支付方式", tbRenewalsPayLog.getPayType());
map.put("店铺Id", tbRenewalsPayLog.getShopId());
map.put("订单Id", tbRenewalsPayLog.getOrderId());
map.put(" openId", tbRenewalsPayLog.getOpenId());
map.put("用户Id", tbRenewalsPayLog.getUserId());
map.put("交易单号(第三方交易单号)", tbRenewalsPayLog.getTransactionId());
map.put("金额", tbRenewalsPayLog.getAmount());
map.put("状态 ", tbRenewalsPayLog.getStatus());
map.put("备注", tbRenewalsPayLog.getRemark());
map.put("用户自定义参数", tbRenewalsPayLog.getAttach());
map.put("到期时间", tbRenewalsPayLog.getExpiredAt());
map.put("创建时间", tbRenewalsPayLog.getCreatedAt());
map.put(" updatedAt", tbRenewalsPayLog.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,140 @@
/*
* 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.service.impl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.enums.PayTypeEnum;
import cn.ysk.cashier.repository.TbShopPayTypeRepository;
import cn.ysk.cashier.dto.TbShopPayTypeDto;
import cn.ysk.cashier.dto.TbShopPayTypeQueryCriteria;
import cn.ysk.cashier.mapper.TbShopPayTypeMapper;
import cn.ysk.cashier.pojo.TbShopPayType;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.service.TbShopPayTypeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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 2023-11-03
**/
@Service
@RequiredArgsConstructor
public class TbShopPayTypeServiceImpl implements TbShopPayTypeService {
private final TbShopPayTypeRepository tbShopPayTypeRepository;
private final TbShopPayTypeMapper tbShopPayTypeMapper;
@Override
public Map<String,Object> queryAll(TbShopPayTypeQueryCriteria criteria, Pageable pageable){
Page<TbShopPayType> page = tbShopPayTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.getContent(),page.getTotalElements());
}
@Override
public List<TbShopPayTypeDto> queryAll(TbShopPayTypeQueryCriteria criteria){
return tbShopPayTypeMapper.toDto(tbShopPayTypeRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopPayTypeDto findById(Integer id) {
TbShopPayType tbShopPayType = tbShopPayTypeRepository.findById(id).orElseGet(TbShopPayType::new);
ValidationUtil.isNull(tbShopPayType.getId(),"TbShopPayType","id",id);
return tbShopPayTypeMapper.toDto(tbShopPayType);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopPayTypeDto create(TbShopPayType resources) {
if (resources.getPayName() == null || "".equals(resources.getPayName())){
throw new BadRequestException("付款方式不能为空");
}
if (resources.getIcon() == null || "".equals(resources.getIcon())){
throw new BadRequestException("支付方式图标不能为空");
}
//类型转换
String nameByType = PayTypeEnum.getNameByType(resources.getPayName());
resources.setPayType(nameByType);
resources.setIsRefundable(0);
resources.setIsShowShortcut(1);
resources.setIsSystem(0);
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
return tbShopPayTypeMapper.toDto(tbShopPayTypeRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopPayType resources) {
if (resources.getPayName() == null || "".equals(resources.getPayName())){
throw new BadRequestException("付款方式不能为空");
}
TbShopPayType tbShopPayType = tbShopPayTypeRepository.findById(resources.getId()).orElseGet(TbShopPayType::new);
//类型转换
String nameByType = PayTypeEnum.getNameByType(resources.getPayName());
resources.setPayType(nameByType);
resources.setUpdatedAt(Instant.now().toEpochMilli());
ValidationUtil.isNull( tbShopPayType.getId(),"TbShopPayType","id",resources.getId());
tbShopPayType.copy(resources);
tbShopPayTypeRepository.save(tbShopPayType);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopPayTypeRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopPayTypeDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopPayTypeDto tbShopPayType : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("支付类型cash,alipay,weixin,deposit,arrears,virtual,member-account", tbShopPayType.getPayType());
map.put("支付类型名称支付类型名称现金支付宝刷卡deposit挂单arrears储值member-account自定义virtual", tbShopPayType.getPayName());
map.put("是否快捷展示1是0否", tbShopPayType.getIsShowShortcut());
map.put("店铺id", tbShopPayType.getShopId());
map.put("0允许退款 1-不允许退款", tbShopPayType.getIsRefundable());
map.put("是否打开钱箱", tbShopPayType.getIsOpenCashDrawer());
map.put("0不是 1是 [系统级支付]", tbShopPayType.getIsSystem());
map.put("0-非虚拟 1虚拟 virtual", tbShopPayType.getIsIdeal());
map.put("0-不显示1显示", tbShopPayType.getIsDisplay());
map.put(" createdAt", tbShopPayType.getCreatedAt());
map.put(" updatedAt", tbShopPayType.getUpdatedAt());
map.put("排序", tbShopPayType.getSorts());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,147 @@
/*
* 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.service.impl;
import cn.ysk.cashier.pojo.TbUserInfo;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.TbUserInfoRepository;
import cn.ysk.cashier.service.TbUserInfoService;
import cn.ysk.cashier.dto.TbUserInfoDto;
import cn.ysk.cashier.dto.TbUserInfoQueryCriteria;
import cn.ysk.cashier.mapper.TbUserInfoMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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 2023-11-13
**/
@Service
@RequiredArgsConstructor
public class TbUserInfoServiceImpl implements TbUserInfoService {
private final TbUserInfoRepository tbUserInfoRepository;
private final TbUserInfoMapper tbUserInfoMapper;
@Override
public Map<String,Object> queryAll(TbUserInfoQueryCriteria criteria, Pageable pageable){
Page<TbUserInfo> page = tbUserInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbUserInfoMapper::toDto));
}
@Override
public List<TbUserInfoDto> queryAll(TbUserInfoQueryCriteria criteria){
return tbUserInfoMapper.toDto(tbUserInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbUserInfoDto findById(Integer id) {
TbUserInfo tbUserInfo = tbUserInfoRepository.findById(id).orElseGet(TbUserInfo::new);
ValidationUtil.isNull(tbUserInfo.getId(),"TbUserInfo","id",id);
return tbUserInfoMapper.toDto(tbUserInfo);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbUserInfoDto create(TbUserInfo resources) {
return tbUserInfoMapper.toDto(tbUserInfoRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbUserInfo resources) {
TbUserInfo tbUserInfo = tbUserInfoRepository.findById(resources.getId()).orElseGet(TbUserInfo::new);
ValidationUtil.isNull( tbUserInfo.getId(),"TbUserInfo","id",resources.getId());
tbUserInfo.copy(resources);
tbUserInfoRepository.save(tbUserInfo);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbUserInfoRepository.deleteById(id);
}
}
@Override
public void download(List<TbUserInfoDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbUserInfoDto tbUserInfo : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("钱包余额", tbUserInfo.getAmount());
map.put("累计充值", tbUserInfo.getChargeAmount());
map.put("授信额度", tbUserInfo.getLineOfCredit());
map.put(" consumeAmount", tbUserInfo.getConsumeAmount());
map.put("消费次数累计", tbUserInfo.getConsumeNumber());
map.put("总积分", tbUserInfo.getTotalScore());
map.put("锁定积分", tbUserInfo.getLockScore());
map.put("会员卡号", tbUserInfo.getCardNo());
map.put("会员密码", tbUserInfo.getCardPassword());
map.put("等级", tbUserInfo.getLevelId());
map.put("用户头像", tbUserInfo.getHeadImg());
map.put("用户昵称", tbUserInfo.getNickName());
map.put("电话号码", tbUserInfo.getTelephone());
map.put("小程序Id", tbUserInfo.getWxMaAppId());
map.put("会员生日", tbUserInfo.getBirthDay());
map.put("0-女 1男", tbUserInfo.getSex());
map.put("小程序的openId", tbUserInfo.getMiniAppOpenId());
map.put("公众号openId", tbUserInfo.getOpenId());
map.put("联合Id", tbUserInfo.getUnionId());
map.put("用户编号", tbUserInfo.getCode());
map.put("用户类型-保留字段", tbUserInfo.getType());
map.put("'DOCTOR'-->医生,'USER'->用户", tbUserInfo.getIdentify());
map.put("1正常", tbUserInfo.getStatus());
map.put("引荐人", tbUserInfo.getParentId());
map.put(" parentLevel", tbUserInfo.getParentLevel());
map.put("上家类开型,店铺-SHOP/ 个人- PERSON", tbUserInfo.getParentType());
map.put("关注进入的活动Id", tbUserInfo.getProjectId());
map.put("商户Id", tbUserInfo.getMerchantId());
map.put("0未认证1认证", tbUserInfo.getIsResource());
map.put("是否在线", tbUserInfo.getIsOnline());
map.put(" isVip", tbUserInfo.getIsVip());
map.put(" vipEffectAt", tbUserInfo.getVipEffectAt());
map.put(" tips", tbUserInfo.getTips());
map.put("用户来源:公众号 WECHAT 小程序 WECHAT-APP 手机注册 TELEPHONE", tbUserInfo.getSourcePath());
map.put("是否推广员 1 是 0不是", tbUserInfo.getIsSalesPerson());
map.put("是否关注公众号", tbUserInfo.getIsAttentionMp());
map.put("城市", tbUserInfo.getCity());
map.put(" searchWord", tbUserInfo.getSearchWord());
map.put("最近登陆时间", tbUserInfo.getLastLogInAt());
map.put(" lastLeaveAt", tbUserInfo.getLastLeaveAt());
map.put(" createdAt", tbUserInfo.getCreatedAt());
map.put(" updatedAt", tbUserInfo.getUpdatedAt());
map.put("绑定时间", tbUserInfo.getBindParentAt());
map.put("上上家", tbUserInfo.getGrandParentId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,130 @@
/*
* 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.service.impl.order;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.order.TbCashierCartRepository;
import cn.ysk.cashier.service.order.TbCashierCartService;
import cn.ysk.cashier.dto.order.TbCashierCartDto;
import cn.ysk.cashier.dto.order.TbCashierCartQueryCriteria;
import cn.ysk.cashier.mapper.order.TbCashierCartMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-03-02
**/
@Service
@RequiredArgsConstructor
public class TbCashierCartServiceImpl implements TbCashierCartService {
private final TbCashierCartRepository tbCashierCartRepository;
private final TbCashierCartMapper tbCashierCartMapper;
@Override
public Map<String,Object> queryAll(TbCashierCartQueryCriteria criteria, Pageable pageable){
Page<TbCashierCart> page = tbCashierCartRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbCashierCartMapper::toDto));
}
@Override
public List<TbCashierCartDto> queryAll(TbCashierCartQueryCriteria criteria){
return tbCashierCartMapper.toDto(tbCashierCartRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbCashierCartDto findById(Integer id) {
TbCashierCart tbCashierCart = tbCashierCartRepository.findById(id).orElseGet(TbCashierCart::new);
ValidationUtil.isNull(tbCashierCart.getId(),"TbCashierCart","id",id);
return tbCashierCartMapper.toDto(tbCashierCart);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbCashierCartDto create(TbCashierCart resources) {
return tbCashierCartMapper.toDto(tbCashierCartRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbCashierCart resources) {
TbCashierCart tbCashierCart = tbCashierCartRepository.findById(resources.getId()).orElseGet(TbCashierCart::new);
ValidationUtil.isNull( tbCashierCart.getId(),"TbCashierCart","id",resources.getId());
tbCashierCart.copy(resources);
tbCashierCartRepository.save(tbCashierCart);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbCashierCartRepository.deleteById(id);
}
}
@Override
public void download(List<TbCashierCartDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbCashierCartDto tbCashierCart : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("主单Id", tbCashierCart.getMasterId());
map.put("本次下单Id", tbCashierCart.getOrderId());
map.put("退单Id", tbCashierCart.getRefOrderId());
map.put("购物车总额", tbCashierCart.getTotalAmount());
map.put("商品Id", tbCashierCart.getProductId());
map.put("商品图片", tbCashierCart.getCoverImg());
map.put("是否sku", tbCashierCart.getIsSku());
map.put("skuId", tbCashierCart.getSkuId());
map.put("商品名", tbCashierCart.getName());
map.put("单价", tbCashierCart.getSalePrice());
map.put("结余数量", tbCashierCart.getNumber());
map.put("总下单数量", tbCashierCart.getTotalNumber());
map.put("退单数量", tbCashierCart.getRefundNumber());
map.put("分类Id", tbCashierCart.getCategoryId());
map.put("'购物车关闭 closed',' 购物车挂起 refund',' 购物车列表生效create',' 购物车完成final'", tbCashierCart.getStatus());
map.put("是否为组合商品 0-单商品 1为组合商品", tbCashierCart.getType());
map.put("商户Id", tbCashierCart.getMerchantId());
map.put("店铺Id", tbCashierCart.getShopId());
map.put(" createdAt", tbCashierCart.getCreatedAt());
map.put(" updatedAt", tbCashierCart.getUpdatedAt());
map.put("用户的openId", tbCashierCart.getUserId());
map.put("台桌id", tbCashierCart.getTableId());
map.put("打包费", tbCashierCart.getPackFee());
map.put(" tradeDay", tbCashierCart.getTradeDay());
map.put(" isPack", tbCashierCart.getIsPack());
map.put(" isGift", tbCashierCart.getIsGift());
map.put(" pendingAt", tbCashierCart.getPendingAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -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 cn.ysk.cashier.service.impl.order;
import cn.ysk.cashier.pojo.order.TbOrderDetail;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.order.TbOrderDetailRepository;
import cn.ysk.cashier.service.order.TbOrderDetailService;
import cn.ysk.cashier.dto.order.TbOrderDetailDto;
import cn.ysk.cashier.dto.order.TbOrderDetailQueryCriteria;
import cn.ysk.cashier.mapper.order.TbOrderDetailMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-03-02
**/
@Service
@RequiredArgsConstructor
public class TbOrderDetailServiceImpl implements TbOrderDetailService {
private final TbOrderDetailRepository tbOrderDetailRepository;
private final TbOrderDetailMapper tbOrderDetailMapper;
@Override
public Map<String,Object> queryAll(TbOrderDetailQueryCriteria criteria, Pageable pageable){
Page<TbOrderDetail> page = tbOrderDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbOrderDetailMapper::toDto));
}
@Override
public List<TbOrderDetailDto> queryAll(TbOrderDetailQueryCriteria criteria){
return tbOrderDetailMapper.toDto(tbOrderDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbOrderDetailDto findById(Integer id) {
TbOrderDetail tbOrderDetail = tbOrderDetailRepository.findById(id).orElseGet(TbOrderDetail::new);
ValidationUtil.isNull(tbOrderDetail.getId(),"TbOrderDetail","id",id);
return tbOrderDetailMapper.toDto(tbOrderDetail);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbOrderDetailDto create(TbOrderDetail resources) {
return tbOrderDetailMapper.toDto(tbOrderDetailRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbOrderDetail resources) {
TbOrderDetail tbOrderDetail = tbOrderDetailRepository.findById(resources.getId()).orElseGet(TbOrderDetail::new);
ValidationUtil.isNull( tbOrderDetail.getId(),"TbOrderDetail","id",resources.getId());
tbOrderDetail.copy(resources);
tbOrderDetailRepository.save(tbOrderDetail);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbOrderDetailRepository.deleteById(id);
}
}
@Override
public void download(List<TbOrderDetailDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbOrderDetailDto tbOrderDetail : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" orderId", tbOrderDetail.getOrderId());
map.put(" shopId", tbOrderDetail.getShopId());
map.put(" productId", tbOrderDetail.getProductId());
map.put(" productSkuId", tbOrderDetail.getProductSkuId());
map.put(" num", tbOrderDetail.getNum());
map.put(" productName", tbOrderDetail.getProductName());
map.put(" productSkuName", tbOrderDetail.getProductSkuName());
map.put(" productImg", tbOrderDetail.getProductImg());
map.put(" createTime", tbOrderDetail.getCreateTime());
map.put(" updateTime", tbOrderDetail.getUpdateTime());
map.put(" price", tbOrderDetail.getPrice());
map.put(" priceAmount", tbOrderDetail.getPriceAmount());
map.put(" status", tbOrderDetail.getStatus());
map.put("打包费", tbOrderDetail.getPackAmount());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,161 @@
/*
* 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.service.impl.order;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.repository.order.TbCashierCartRepository;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.vo.TbOrderInfoVo;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.order.TbOrderInfoRepository;
import cn.ysk.cashier.service.order.TbOrderInfoService;
import cn.ysk.cashier.dto.order.TbOrderInfoDto;
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
import cn.ysk.cashier.mapper.order.TbOrderInfoMapper;
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 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-03-02
**/
@Service
@RequiredArgsConstructor
public class TbOrderInfoServiceImpl implements TbOrderInfoService {
private final TbOrderInfoRepository tbOrderInfoRepository;
private final TbOrderInfoMapper tbOrderInfoMapper;
private final TbCashierCartRepository tbCashierCartRepository;
@Override
public Map<String,Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable){
Page<TbOrderInfo> page = tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<TbOrderInfoVo> orderInfoVoList = new ArrayList<>();
for (TbOrderInfo tbOrderInfo : page.getContent()) {
TbOrderInfoVo orderInfoVo=new TbOrderInfoVo();
List<TbCashierCart> tbCashierCarts = tbCashierCartRepository.searchCartByOrderId(tbOrderInfo.getId());
orderInfoVo.setCartList(tbCashierCarts);
BeanUtils.copyProperties(tbOrderInfo, orderInfoVo);
orderInfoVoList.add(orderInfoVo);
}
return PageUtil.toPage(orderInfoVoList, page.getTotalElements());
}
@Override
public List<TbOrderInfoDto> queryAll(TbOrderInfoQueryCriteria criteria){
return tbOrderInfoMapper.toDto(tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbOrderInfoDto findById(Integer id) {
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(id).orElseGet(TbOrderInfo::new);
ValidationUtil.isNull(tbOrderInfo.getId(),"TbOrderInfo","id",id);
TbOrderInfoDto dto = tbOrderInfoMapper.toDto(tbOrderInfo);
List<TbCashierCart> tbCashierCarts = tbCashierCartRepository.searchCartByOrderId(tbOrderInfo.getId());
dto.setCartList(tbCashierCarts);
return dto;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbOrderInfoDto create(TbOrderInfo resources) {
return tbOrderInfoMapper.toDto(tbOrderInfoRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbOrderInfo resources) {
TbOrderInfo tbOrderInfo = tbOrderInfoRepository.findById(resources.getId()).orElseGet(TbOrderInfo::new);
ValidationUtil.isNull( tbOrderInfo.getId(),"TbOrderInfo","id",resources.getId());
tbOrderInfo.copy(resources);
tbOrderInfoRepository.save(tbOrderInfo);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbOrderInfoRepository.deleteById(id);
}
}
@Override
public void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbOrderInfoDto tbOrderInfo : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("订单编号", tbOrderInfo.getOrderNo());
map.put("商户结算金额", tbOrderInfo.getSettlementAmount());
map.put("包装费", tbOrderInfo.getPackFee());
map.put("订单原金额", tbOrderInfo.getOriginAmount());
map.put("商品售价", tbOrderInfo.getProductAmount());
map.put("最终金额---退单后,金额变动", tbOrderInfo.getAmount());
map.put("退单金额", tbOrderInfo.getRefundAmount());
map.put("支付金额", tbOrderInfo.getPayAmount());
map.put("订单邮递费用", tbOrderInfo.getFreightAmount());
map.put("折扣金额", tbOrderInfo.getDiscountAmount());
map.put("台桌Id", tbOrderInfo.getTableId());
map.put("订单抹零", tbOrderInfo.getSmallChange());
map.put("发货类型", tbOrderInfo.getSendType());
map.put("订单类型-cash收银-miniapp小程序-offline线下", tbOrderInfo.getOrderType());
map.put("订单里面商品的类型", tbOrderInfo.getProductType());
map.put("状态: unpaid 待支付unsend待发货 closed 订单完成 send 已发refunding申请退单refund退单cancelled取消订单merge合台", tbOrderInfo.getStatus());
map.put("orderType为union-minor时parentId生效为其上级合单id", tbOrderInfo.getBillingId());
map.put("对于平台订单,是收款商户Id", tbOrderInfo.getMerchantId());
map.put("店铺Id", tbOrderInfo.getShopId());
map.put("是否vip订单", tbOrderInfo.getIsVip());
map.put("商户会员Id", tbOrderInfo.getMemberId());
map.put("用户Id", tbOrderInfo.getUserId());
map.put("该订单商品赠送的积分", tbOrderInfo.getProductScore());
map.put("抵扣积分", tbOrderInfo.getDeductScore());
map.put("用户使用的卡券", tbOrderInfo.getUserCouponId());
map.put("优惠券抵扣金额", tbOrderInfo.getUserCouponAmount());
map.put("如果为退单时,主单号", tbOrderInfo.getMasterId());
map.put("是否支持退款1支持退单 0不支持退单", tbOrderInfo.getRefundAble());
map.put("支付时间", tbOrderInfo.getPaidTime());
map.put("是否生效,若订单合单之后,则原订单不会生效", tbOrderInfo.getIsEffect());
map.put("是否合台", tbOrderInfo.getIsGroup());
map.put(" updatedAt", tbOrderInfo.getUpdatedAt());
map.put("系统时间", tbOrderInfo.getSystemTime());
map.put(" createdAt", tbOrderInfo.getCreatedAt());
map.put("收银台是否已接单", tbOrderInfo.getIsAccepted());
map.put("支付类型", tbOrderInfo.getPayType());
map.put("订单金额", tbOrderInfo.getOrderAmount());
map.put("折扣比例", tbOrderInfo.getDiscountRatio());
map.put("支付订单号", tbOrderInfo.getPayOrderNo());
map.put(" tradeDay", tbOrderInfo.getTradeDay());
map.put(" source", tbOrderInfo.getSource());
map.put(" remark", tbOrderInfo.getRemark());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,194 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.pojo.product.TbProduct;
import cn.ysk.cashier.repository.product.TbProductRepository;
import cn.ysk.cashier.pojo.product.TbProductGroup;
import cn.ysk.cashier.utils.*;
import cn.ysk.cashier.vo.AddProduct;
import cn.ysk.cashier.repository.product.TbProductGroupRepository;
import cn.ysk.cashier.dto.product.TbProductGroupDto;
import cn.ysk.cashier.dto.product.TbProductGroupQueryCriteria;
import cn.ysk.cashier.config.security.service.OnlineUserService;
import cn.ysk.cashier.config.security.service.dto.OnlineUserDto;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.service.product.TbProductGroupService;
import cn.ysk.cashier.mapper.product.TbProductGroupMapper;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.time.Instant;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.LinkedHashMap;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2023-12-16
**/
@Service
@RequiredArgsConstructor
public class TbProductGroupServiceImpl implements TbProductGroupService {
private final TbProductGroupRepository tbProductGroupRepository;
private final TbProductGroupMapper tbProductGroupMapper;
private final TbProductRepository tbProductRepository;
@Resource
private OnlineUserService onlineUserService;
@Override
public Map<String,Object> queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable){
Page<TbProductGroup> page = tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) ->
QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbProductGroupMapper::toDto));
}
@Override
public List<TbProductGroupDto> queryAll(TbProductGroupQueryCriteria criteria){
return tbProductGroupMapper.toDto(tbProductGroupRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public List<TbProduct> findByIdProduct(Integer productGroup) {
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(productGroup).orElseGet(TbProductGroup::new);
if (tbProductGroup.getProductIds() != null){
List<String> list = ListUtil.stringChangeStringList(tbProductGroup.getProductIds());
List<Integer> intList = new ArrayList<>();
for (String str : list) {
intList.add(Integer.parseInt(str));
}
System.out.println(intList);
return tbProductRepository.findByIds(ListUtil.stringChangeIntegerList(list));
}
return new ArrayList<>();
}
@Override
@Transactional
public TbProductGroupDto findById(Integer id) {
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(id).orElseGet(TbProductGroup::new);
ValidationUtil.isNull(tbProductGroup.getId(),"TbProductGroup","id",id);
return tbProductGroupMapper.toDto(tbProductGroup);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbProductGroupDto create(TbProductGroup resources) {
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
return tbProductGroupMapper.toDto(tbProductGroupRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductGroup resources) {
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(resources.getId()).orElseGet(TbProductGroup::new);
// TbProductGroup byName = tbProductGroupRepository.findByName(resources.getName(), resources.getShopId());
// if (byName != null){
// throw new BadRequestException("名称重复");
// }
tbProductGroup.setUpdatedAt(Instant.now().toEpochMilli());
ValidationUtil.isNull( tbProductGroup.getId(),"TbProductGroup","id",resources.getId());
tbProductGroup.copy(resources);
tbProductGroupRepository.save(tbProductGroup);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbProductGroupRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductGroupDto tbProductGroup : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("分组名称", tbProductGroup.getName());
map.put("商户Id", tbProductGroup.getMerchantId());
map.put("店铺Id", tbProductGroup.getShopId());
map.put("图标", tbProductGroup.getPic());
map.put("是否显示", tbProductGroup.getIsShow());
map.put("分类描述", tbProductGroup.getDetail());
map.put(" style", tbProductGroup.getStyle());
map.put("排序", tbProductGroup.getSort());
map.put("商品列表", tbProductGroup.getProductIds());
map.put(" createdAt", tbProductGroup.getCreatedAt());
map.put(" updatedAt", tbProductGroup.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
public ResponseEntity<Object> updateProductIds(AddProduct addProduct, String userName) {
OnlineUserDto onlineUser = onlineUserService.getOne(addProduct.getKey());
if (addProduct.getIds().size()<1){
return new ResponseEntity<>("错误", HttpStatus.NOT_ACCEPTABLE);
}
TbProductGroupDto productGroup = this.findById(addProduct.getGroupId());
if (productGroup == null){
return new ResponseEntity<>("没有找到改分类", HttpStatus.NOT_ACCEPTABLE);
}
TbProductGroup tbProductGroup = new TbProductGroup();
StringBuilder sb = new StringBuilder();
// //如果没有
if (productGroup.getProductIds() == null || "".equals(productGroup.getProductIds())) {
for (String s : addProduct.getIds()) {
sb.append(s);
sb.append(",");
}
tbProductGroup.setProductIds(sb.toString());
tbProductGroup.setId(addProduct.getGroupId());
this.update(tbProductGroup);
}else {
//如果有
for (String s : addProduct.getIds()) {
sb.append(s);
sb.append(",");
}
sb.append(productGroup.getProductIds());
tbProductGroup.setProductIds(sb.toString());
tbProductGroup.setId(addProduct.getGroupId());
this.update(tbProductGroup);
}
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,392 @@
/*
* 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.service.impl.productimpl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.ysk.cashier.utils.*;
import com.alibaba.fastjson.JSONArray;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.product.TbProduct;
import cn.ysk.cashier.vo.TbProductVo;
import cn.ysk.cashier.repository.product.TbProductRepository;
import cn.ysk.cashier.service.product.TbProductService;
import cn.ysk.cashier.dto.product.TbProductDto;
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
import cn.ysk.cashier.mapper.product.TbProductMapper;
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
import cn.ysk.cashier.repository.product.TbProductSkuResultRepository;
import cn.ysk.cashier.pojo.product.TbProductSpec;
import cn.ysk.cashier.repository.product.TbProductSpecRepository;
import cn.ysk.cashier.pojo.product.TbProductSku;
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
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 java.time.Instant;
import java.util.*;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2023-12-11
**/
@Service
@RequiredArgsConstructor
public class TbProductServiceImpl implements TbProductService {
private final TbProductRepository tbProductRepository;
private final TbProductMapper tbProductMapper;
private final TbProductSkuRepository tbProductSkuRepository;
private final TbShopUnitRepository tbShopUnitRepository;
private final TbProductSpecRepository tbProductSpecRepository;
private final TbProductSkuResultRepository tbProductSkuResultRepository;
@Override
public Map<String,Object> queryAll(TbProductQueryCriteria criteria, Pageable pageable){
//查询商品数据
Page<TbProduct> page = tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<String> productId = new ArrayList<>();
List<Integer> unitId = new ArrayList<>();
List<Integer> specId = new ArrayList<>();
for (TbProduct product : page.getContent()) {
//记录商品id
productId.add(product.getId().toString());
//记录单位id
if (product.getUnitId() != null){
if (!"".equals(product.getUnitId())){
unitId.add(Integer.valueOf(product.getUnitId().trim()));
}
}
//记录规格id
specId.add(product.getSpecId());
}
//sku
List<TbProductSku> tbProductSkus = tbProductSkuRepository.searchSku(productId);
//单位
List<TbShopUnit> tbShopUnits = new ArrayList<>();
if (!unitId.isEmpty()){
tbShopUnits = tbShopUnitRepository.searchUnit(unitId);
}
//商品规格
List<TbProductSpec> tbProductSpecs = new ArrayList<>();
if (!specId.isEmpty()) {
tbProductSpecs = tbProductSpecRepository.searchSpec(specId);
}
//组装
List<TbProductVo> tbProductVoList = new ArrayList<>();
for (TbProduct product : page.getContent()) {
List<TbProductSku> skuList = new ArrayList<>();
TbProductVo tbProductVo = new TbProductVo();
//sku
for (TbProductSku sku : tbProductSkus) {
//sku
if (sku.getProductId().equals(product.getId().toString())){
skuList.add(sku);
}
}
tbProductVo.setSkuList(skuList);
//单位
if (tbShopUnits.isEmpty()){
tbProductVo.setUnitName("");
}else {
for (TbShopUnit tbShopUnit : tbShopUnits) {
if(tbShopUnit.getId().toString().equals(product.getUnitId())){
tbProductVo.setUnitName(tbShopUnit.getName());
}
}
}
//商品规格
if (tbProductSpecs.isEmpty()){
tbProductVo.setSpecsInfo(new HashMap<>());
}else {
for (TbProductSpec spec :tbProductSpecs) {
if (spec.getId().equals(product.getSpecId())){
HashMap<String, String> specsMap = new HashMap<>();
specsMap.put(spec.getName(),spec.getSpecList());
tbProductVo.setSpecsInfo(specsMap);
}
}
}
BeanUtils.copyProperties(product, tbProductVo);
tbProductVoList.add(tbProductVo);
}
System.out.println(tbProductVoList);
return PageUtil.toPage(tbProductVoList,page.getTotalElements());
}
@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();
tbProductVo.setCategoryId(Integer.valueOf(tbProduct.getCategoryId()));
//单位
if (tbProduct.getUnitId() == null){
tbProductVo.setUnitId(null);
tbProductVo.setUnitName(null);
}else {
tbProductVo.setUnitName(tbShopUnits.get().getName());
}
//套餐
if (tbProduct.getGroupSnap() == null){
tbProductVo.setGroupSnap(new JSONArray());
}else {
tbProductVo.setGroupSnap(ListUtil.stringChangeList(tbProduct.getGroupSnap()));
}
BeanUtils.copyProperties(tbProduct, tbProductVo);
HashMap<String, String> map = new HashMap<>();
//商品规格
if (tbProductSpec.get() == null){
tbProductVo.setSpecsInfo(map);
}else {
map.put(tbProductSpec.get().getName(),tbProductSpec.get().getSpecList());
tbProductVo.setSpecsInfo(map);
}
//sku
if (tbProductSkus.get() == null){
tbProductVo.setSkuList(new ArrayList<>());
}else {
tbProductVo.setSkuList(tbProductSkus.get());
}
return tbProductVo;
}
@Override
public List<TbProduct> findByProductList(List<String> productList) {
List<Integer> productListInt = productList.stream()
.map(Integer::parseInt)
.collect(Collectors.toList());
List<TbProduct> byIds = tbProductRepository.findByIds(productListInt);
return byIds;
}
@Override
public List<TbProductDto> queryAll(TbProductQueryCriteria criteria){
return tbProductMapper.toDto(tbProductRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbProductDto findById(Integer id) {
TbProduct tbProduct = tbProductRepository.findById(id).orElseGet(TbProduct::new);
ValidationUtil.isNull(tbProduct.getId(),"TbProduct","id",id);
return tbProductMapper.toDto(tbProduct);
}
@Override
@Transactional(rollbackFor = Exception.class)
public Object create(TbProductVo resources) {
TbProduct product = new TbProduct();
//组装
BeanUtil.copyProperties(resources,product, CopyOptions.create().setIgnoreNullValue(true));
if (resources.getCategoryId() == null){
throw new BadRequestException("必填内容未填写");
}
product.setCategoryId(String.valueOf(resources.getCategoryId()));
product.setIsDel(0);
product.setIsDelete(0);
product.setIsFreeFreight(1);
product.setStatus(1);
product.setCreatedAt(Instant.now().toEpochMilli());
product.setUpdatedAt(Instant.now().toEpochMilli());
if (!resources.getGroupSnap().isEmpty()){
ListUtil.JSONArrayChangeString(resources.getGroupSnap());
}
if (resources.getUnitId() != null){
product.setUnitId(String.valueOf(resources.getUnitId()));
}
//套餐内容
if (!resources.getGroupSnap().isEmpty()){
product.setGroupSnap(ListUtil.JSONArrayChangeString(resources.getGroupSnap()));
}
TbProduct save = tbProductRepository.save(product);
if (save.getId() == null){
throw new BadRequestException("添加商品失败");
}
//sku
if (resources.getSkuList() != null) {
List<TbProductSku> skuList = new ArrayList<>();
for (TbProductSku sku : resources.getSkuList()) {
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);
}
//保存到sku_result
if ("sku".equals(resources.getTypeEnum())){
TbProductSkuResult productSkuResult = new TbProductSkuResult();
productSkuResult.setCreatedAt(Instant.now().toEpochMilli());
productSkuResult.setUpdatedAt(Instant.now().toEpochMilli());
productSkuResult.setTagSnap(resources.getSkuSnap());
productSkuResult.setId(save.getId());
tbProductSkuResultRepository.save(productSkuResult);
}
return resources;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductVo resources) {
TbProduct product = new TbProduct();
//组装
BeanUtils.copyProperties(resources, product);
product.setIsDel(0);
product.setIsDelete(0);
product.setIsFreeFreight(1);
product.setStatus(1);
product.setUpdatedAt(Instant.now().toEpochMilli());
product.setCategoryId(resources.getCategoryId().toString());
if (!resources.getGroupSnap().isEmpty()){
ListUtil.JSONArrayChangeString(resources.getGroupSnap());
}
TbProduct save = tbProductRepository.save(product);
//sku
if (resources.getSkuList() != null) {
if ("sku".equals(save.getTypeEnum())){
tbProductSkuRepository.deleteByProductId(String.valueOf(save.getId()));
}
List<TbProductSku> skuList = new ArrayList<>();
for (TbProductSku sku : resources.getSkuList()) {
sku.setProductId(String.valueOf(save.getId()));
sku.setShopId(save.getShopId());
product.setUpdatedAt(Instant.now().toEpochMilli());
skuList.add(sku);
}
tbProductSkuRepository.saveAll(skuList);
}
// ValidationUtil.isNull( tbProduct.getId(),"TbProduct","id",resources.getId());
// tbProduct.copy(resources);
// tbProductRepository.save(tbProduct);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbProductRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductDto tbProduct : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("商品来源 NORMAL普通商品 --,SCORE积分商品", tbProduct.getSourcePath());
map.put("商户Id", tbProduct.getMerchantId());
map.put("店铺id", tbProduct.getShopId());
map.put("商品名称", tbProduct.getName());
map.put("商品类型(属性):REAL- 实物商品 VIR---虚拟商品", tbProduct.getType());
map.put("包装费", tbProduct.getPackFee());
map.put("商品最低价", tbProduct.getLowPrice());
map.put("单位Id", tbProduct.getUnitId());
map.put("商品封面图", tbProduct.getCoverImg());
map.put(" categoryId", tbProduct.getCategoryId());
map.put("商品规格", tbProduct.getSpecId());
map.put("品牌Id", tbProduct.getBrandId());
map.put("短标题--促销语", tbProduct.getShortTitle());
map.put(" lowMemberPrice", tbProduct.getLowMemberPrice());
map.put("单位镜像", tbProduct.getUnitSnap());
map.put("商品分享图", tbProduct.getShareImg());
map.put("商品图片(第一张为缩略图,其他为详情)", tbProduct.getImages());
map.put("商品视频URL地址", tbProduct.getVideo());
map.put("视频封面图", tbProduct.getVideoCoverImg());
map.put("排序", tbProduct.getSort());
map.put("0-不限购", tbProduct.getLimitNumber());
map.put("商品赚送积分", tbProduct.getProductScore());
map.put("0--待审核 1审核通过 -1审核失败 -2违规下架", tbProduct.getStatus());
map.put("审核失败原因", tbProduct.getFailMsg());
map.put("是否推荐,店铺推荐展示", tbProduct.getIsRecommend());
map.put("是否热销", tbProduct.getIsHot());
map.put("是否新品", tbProduct.getIsNew());
map.put("是否促销1-是0-否", tbProduct.getIsOnSale());
map.put("是否展示0-下架 1上架---废弃", tbProduct.getIsShow());
map.put("商品规格0-单规格 1多规格", tbProduct.getTypeEnum());
map.put("是否独立分销", tbProduct.getIsDistribute());
map.put("是否回收站 0-否1回收站", tbProduct.getIsDel());
map.put("是否开启库存", tbProduct.getIsStock());
map.put("是否暂停销售", tbProduct.getIsPauseSale());
map.put("是否免邮1-是 0-否", tbProduct.getIsFreeFreight());
map.put("邮费模版", tbProduct.getFreightId());
map.put("商品当前生效策略", tbProduct.getStrategyType());
map.put("策略Id", tbProduct.getStrategyId());
map.put("vip专属", tbProduct.getIsVip());
map.put("是否删除", tbProduct.getIsDelete());
map.put("购买须知", tbProduct.getNotice());
map.put(" createdAt", tbProduct.getCreatedAt());
map.put(" updatedAt", tbProduct.getUpdatedAt());
map.put("基础出售数量", tbProduct.getBaseSalesNumber());
map.put("实际销量", tbProduct.getRealSalesNumber());
map.put("合计销量", tbProduct.getSalesNumber());
map.put("点赞次数", tbProduct.getThumbCount());
map.put("收藏次数", tbProduct.getStoreCount());
map.put("支持堂食", tbProduct.getFurnishMeal());
map.put("支持配送", tbProduct.getFurnishExpress());
map.put("支持自提", tbProduct.getFurnishDraw());
map.put("支持虚拟", tbProduct.getFurnishVir());
map.put("是否套餐", tbProduct.getIsCombo());
map.put("套餐内容", tbProduct.getGroupSnap());
map.put(" isShowCash", tbProduct.getIsShowCash());
map.put(" isShowMall", tbProduct.getIsShowMall());
map.put("是否需要审核", tbProduct.getIsNeedExamine());
map.put("线上商城展示状态0待审核 -1 异常 1正常", tbProduct.getShowOnMallStatus());
map.put("提交审核时间", tbProduct.getShowOnMallTime());
map.put("线上商城展示失败原因", tbProduct.getShowOnMallErrorMsg());
map.put("使用标签打印 选择 是 并在 前台>本机设置 勾选打印标签后,收银完成后会自动打印对应数量的标签数", tbProduct.getEnableLabel());
map.put("税率", tbProduct.getTaxConfigId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,108 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.product.TbProductSkuResultRepository;
import cn.ysk.cashier.service.product.TbProductSkuResultService;
import cn.ysk.cashier.dto.product.TbProductSkuResultDto;
import cn.ysk.cashier.dto.product.TbProductSkuResultQueryCriteria;
import cn.ysk.cashier.repository.product.TbProductSkuResultMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-02-08
**/
@Service
@RequiredArgsConstructor
public class TbProductSkuResultServiceImpl implements TbProductSkuResultService {
private final TbProductSkuResultRepository tbProductSkuResultRepository;
private final TbProductSkuResultMapper tbProductSkuResultMapper;
@Override
public Map<String,Object> queryAll(TbProductSkuResultQueryCriteria criteria, Pageable pageable){
Page<TbProductSkuResult> page = tbProductSkuResultRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbProductSkuResultMapper::toDto));
}
@Override
public List<TbProductSkuResultDto> queryAll(TbProductSkuResultQueryCriteria criteria){
return tbProductSkuResultMapper.toDto(tbProductSkuResultRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbProductSkuResultDto findById(Integer id) {
TbProductSkuResult tbProductSkuResult = tbProductSkuResultRepository.findById(id).orElseGet(TbProductSkuResult::new);
ValidationUtil.isNull(tbProductSkuResult.getId(),"TbProductSkuResult","id",id);
return tbProductSkuResultMapper.toDto(tbProductSkuResult);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbProductSkuResultDto create(TbProductSkuResult resources) {
return tbProductSkuResultMapper.toDto(tbProductSkuResultRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductSkuResult resources) {
TbProductSkuResult tbProductSkuResult = tbProductSkuResultRepository.findById(resources.getId()).orElseGet(TbProductSkuResult::new);
ValidationUtil.isNull( tbProductSkuResult.getId(),"TbProductSkuResult","id",resources.getId());
tbProductSkuResult.copy(resources);
tbProductSkuResultRepository.save(tbProductSkuResult);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbProductSkuResultRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductSkuResultDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductSkuResultDto tbProductSkuResult : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("商户Id", tbProductSkuResult.getMerchantId());
map.put("规格id", tbProductSkuResult.getSpecId());
map.put("标签列表,包括名称,显示", tbProductSkuResult.getTagSnap());
map.put(" createdAt", tbProductSkuResult.getCreatedAt());
map.put(" updatedAt", tbProductSkuResult.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,124 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.pojo.product.TbProductSku;
import cn.ysk.cashier.dto.product.TbProductSkuQueryCriteria;
import cn.ysk.cashier.mapper.product.TbProductSkuMapper;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
import cn.ysk.cashier.service.product.TbProductSkuService;
import cn.ysk.cashier.dto.product.TbProductSkuDto;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-03
**/
@Service
@RequiredArgsConstructor
public class TbProductSkuServiceImpl implements TbProductSkuService {
private final TbProductSkuRepository tbProductSkuRepository;
private final TbProductSkuMapper tbProductSkuMapper;
@Override
public Map<String,Object> queryAll(TbProductSkuQueryCriteria criteria, Pageable pageable){
Page<TbProductSku> page = tbProductSkuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbProductSkuMapper::toDto));
}
@Override
public List<TbProductSkuDto> queryAll(TbProductSkuQueryCriteria criteria){
return tbProductSkuMapper.toDto(tbProductSkuRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbProductSkuDto findById(Integer id) {
TbProductSku tbProductSku = tbProductSkuRepository.findById(id).orElseGet(TbProductSku::new);
ValidationUtil.isNull(tbProductSku.getId(),"TbProductSku","id",id);
return tbProductSkuMapper.toDto(tbProductSku);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbProductSkuDto create(TbProductSku resources) {
return tbProductSkuMapper.toDto(tbProductSkuRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductSku resources) {
TbProductSku tbProductSku = tbProductSkuRepository.findById(resources.getId()).orElseGet(TbProductSku::new);
ValidationUtil.isNull( tbProductSku.getId(),"TbProductSku","id",resources.getId());
tbProductSku.copy(resources);
tbProductSkuRepository.save(tbProductSku);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbProductSkuRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductSkuDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductSkuDto tbProductSku : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" shopId", tbProductSku.getShopId());
map.put("条形码", tbProductSku.getBarCode());
map.put("商品Id", tbProductSku.getProductId());
map.put("原价", tbProductSku.getOriginPrice());
map.put("成本价", tbProductSku.getCostPrice());
map.put("会员价", tbProductSku.getMemberPrice());
map.put(" mealPrice", tbProductSku.getMealPrice());
map.put("售价", tbProductSku.getSalePrice());
map.put("进货参考价", tbProductSku.getGuidePrice());
map.put(" strategyPrice", tbProductSku.getStrategyPrice());
map.put("库存数量", tbProductSku.getStockNumber());
map.put("标签镜像", tbProductSku.getSpecSnap());
map.put(" coverImg", tbProductSku.getCoverImg());
map.put("库存警戒线", tbProductSku.getWarnLine());
map.put(" weight", tbProductSku.getWeight());
map.put(" volume", tbProductSku.getVolume());
map.put("销量", tbProductSku.getRealSalesNumber());
map.put("一级分销金额", tbProductSku.getFirstShared());
map.put("二级分销金额", tbProductSku.getSecondShared());
map.put(" createdAt", tbProductSku.getCreatedAt());
map.put(" updatedAt", tbProductSku.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,137 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.product.TbProductSpec;
import cn.ysk.cashier.repository.product.TbProductSpecRepository;
import cn.ysk.cashier.service.product.TbProductSpecService;
import cn.ysk.cashier.utils.*;
import cn.ysk.cashier.vo.TbProductSpecVo;
import cn.ysk.cashier.dto.product.SpecDto;
import cn.ysk.cashier.dto.product.TbProductSpecDto;
import cn.ysk.cashier.dto.product.TbProductSpecQueryCriteria;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.mapper.product.TbProductSpecMapper;
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 java.time.Instant;
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-03
**/
@Service
@RequiredArgsConstructor
public class TbProductSpecServiceImpl implements TbProductSpecService {
private final TbProductSpecRepository tbProductSpecRepository;
private final TbProductSpecMapper tbProductSpecMapper;
@Override
public Map<String,Object> queryAll(TbProductSpecQueryCriteria criteria, Pageable pageable){
Page<TbProductSpec> page = tbProductSpecRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<TbProductSpecVo> specList = new ArrayList<>();
for (TbProductSpec spec :page.getContent()) {
TbProductSpecVo specVo = new TbProductSpecVo();
specVo.setSpecList(ListUtil.stringChangeList(spec.getSpecList()));
BeanUtils.copyProperties(spec, specVo);
specList.add(specVo);
}
return PageUtil.toPage(specList, page.getTotalElements());
}
@Override
public List<TbProductSpecDto> queryAll(TbProductSpecQueryCriteria criteria){
return tbProductSpecMapper.toDto(tbProductSpecRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbProductSpecDto findById(Integer id) {
TbProductSpec tbProductSpec = tbProductSpecRepository.findById(id).orElseGet(TbProductSpec::new);
ValidationUtil.isNull(tbProductSpec.getId(),"TbProductSpec","id",id);
return tbProductSpecMapper.toDto(tbProductSpec);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbProductSpecDto create(SpecDto specDto) {
TbProductSpec allByName = tbProductSpecRepository.findAllByName(specDto.getShopId(), specDto.getName());
if (allByName != null){
throw new BadRequestException("规格名称重复");
}
TbProductSpec tbProductSpec = new TbProductSpec();
tbProductSpec.setName(specDto.getName());
tbProductSpec.setSpecList(specDto.getSpecList().toString().trim());
tbProductSpec.setShopId(specDto.getShopId());
tbProductSpec.setCreatedAt(Instant.now().toEpochMilli());
tbProductSpec.setUpdatedAt(Instant.now().toEpochMilli());
return tbProductSpecMapper.toDto(tbProductSpecRepository.save(tbProductSpec));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductSpec resources) {
TbProductSpec tbProductSpec = tbProductSpecRepository.findById(resources.getId()).orElseGet(TbProductSpec::new);
// TbProductSpec allByName = tbProductSpecRepository.findAllByName(resources.getShopId(), resources.getName());
// if (allByName != null){
// throw new BadRequestException("规格名称重复");
// }
ValidationUtil.isNull(tbProductSpec.getId(),"TbProductSpec","id",resources.getId());
tbProductSpec.copy(resources);
tbProductSpecRepository.save(tbProductSpec);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbProductSpecRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductSpecDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductSpecDto tbProductSpec : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" shopId", tbProductSpec.getShopId());
map.put("商品属性名称", tbProductSpec.getName());
map.put("规格属性", tbProductSpec.getSpecTag());
map.put("属性介绍", tbProductSpec.getSpecTagDetail());
map.put(" specList", tbProductSpec.getSpecList());
map.put("排序", tbProductSpec.getSort());
map.put(" createdAt", tbProductSpec.getCreatedAt());
map.put(" updatedAt", tbProductSpec.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,152 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.product.TbProductStockDetailRepository;
import cn.ysk.cashier.service.product.TbProductStockDetailService;
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
import cn.ysk.cashier.mapper.product.TbProductStockDetailMapper;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.math.BigDecimal;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-01-19
**/
@Service
@RequiredArgsConstructor
public class TbProductStockDetailServiceImpl implements TbProductStockDetailService {
private final TbProductStockDetailRepository tbProductStockDetailRepository;
private final TbProductStockDetailMapper tbProductStockDetailMapper;
@Override
public Map<String,Object> queryAll(TbProductStockDetailQueryCriteria criteria, Pageable pageable){
Page<TbProductStockDetail> page = tbProductStockDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbProductStockDetailMapper::toDto));
}
@Override
public Map<String,Object> queryPage(TbProductStockDetailQueryCriteria criteria){
Sort sort = Sort.by(Sort.Direction.DESC, "id");
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
Page<TbProductStockDetail> page = tbProductStockDetailRepository.findAll((root, criteriaQuery, criteriaBuilder)
-> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbProductStockDetailMapper::toDto));
}
@Override
public List<TbProductStockDetailDto> queryAll(TbProductStockDetailQueryCriteria criteria){
return tbProductStockDetailMapper.toDto(tbProductStockDetailRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbProductStockDetailDto findById(Long id) {
TbProductStockDetail tbProductStockDetail = tbProductStockDetailRepository.findById(id).orElseGet(TbProductStockDetail::new);
ValidationUtil.isNull(tbProductStockDetail.getId(),"TbProductStockDetail","id",id);
return tbProductStockDetailMapper.toDto(tbProductStockDetail);
}
@Override
public HashMap<String, BigDecimal> sumStockNumber(String productId) {
BigDecimal bigDecimal = tbProductStockDetailRepository.sumStockNumber(productId);
HashMap<String, BigDecimal> map = new HashMap<>();
map.put("exchange",bigDecimal);
return map;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbProductStockDetailDto create(TbProductStockDetail resources) {
return tbProductStockDetailMapper.toDto(tbProductStockDetailRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductStockDetail resources) {
TbProductStockDetail tbProductStockDetail = tbProductStockDetailRepository.findById(resources.getId()).orElseGet(TbProductStockDetail::new);
ValidationUtil.isNull( tbProductStockDetail.getId(),"TbProductStockDetail","id",resources.getId());
tbProductStockDetail.copy(resources);
tbProductStockDetailRepository.save(tbProductStockDetail);
}
@Override
public void deleteAll(Long[] ids) {
for (Long id : ids) {
tbProductStockDetailRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductStockDetailDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductStockDetailDto tbProductStockDetail : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("skuId", tbProductStockDetail.getSkuId());
map.put("商品Id", tbProductStockDetail.getProductId());
map.put("商品名称", tbProductStockDetail.getProductName());
map.put("是否开启库存", tbProductStockDetail.getIsStock());
map.put("规格", tbProductStockDetail.getSpecSnap());
map.put("商品单位", tbProductStockDetail.getUnitName());
map.put("店铺Id", tbProductStockDetail.getShopId());
map.put(" recordId", tbProductStockDetail.getRecordId());
map.put("操作批次号", tbProductStockDetail.getBatchNumber());
map.put("库存操作来源:收银端调用 CASHIER 系统后台调用SHOP", tbProductStockDetail.getSourcePath());
map.put("关联订单Id", tbProductStockDetail.getOrderId());
map.put(" 1入库-1出库", tbProductStockDetail.getSubType());
map.put("purchase采购入库 transfer调拔入库 ", tbProductStockDetail.getType());
map.put("上次剩余数量", tbProductStockDetail.getLeftNumber());
map.put("出入库时间", tbProductStockDetail.getStockTime());
map.put("本次操作库存数量", tbProductStockDetail.getStockNumber());
map.put("入库合计成本金额", tbProductStockDetail.getCostAmount());
map.put("出售合计金额", tbProductStockDetail.getSalesAmount());
map.put("操作人", tbProductStockDetail.getOperator());
map.put("备注", tbProductStockDetail.getRemark());
map.put("库存镜像", tbProductStockDetail.getStockSnap());
map.put(" barCode", tbProductStockDetail.getBarCode());
map.put(" coverImg", tbProductStockDetail.getCoverImg());
map.put(" createdAt", tbProductStockDetail.getCreatedAt());
map.put(" updatedAt", tbProductStockDetail.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,290 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.utils.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.product.TbProductSku;
import cn.ysk.cashier.repository.product.TbProductSkuRepository;
import cn.ysk.cashier.service.product.TbProductSkuService;
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
import cn.ysk.cashier.pojo.product.TbProductStockOperate;
import cn.ysk.cashier.vo.ProductStockOperateVO;
import cn.ysk.cashier.dto.product.OutAndOnDto;
import cn.ysk.cashier.dto.product.ProductListDto;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
import cn.ysk.cashier.pojo.shop.TbShopPurveyorTransact;
import cn.ysk.cashier.repository.shop.TbShopPurveyorTransactRepository;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.product.TbProductStockOperateRepository;
import cn.ysk.cashier.service.TbProductStockOperateService;
import cn.ysk.cashier.dto.product.TbProductStockOperateDto;
import cn.ysk.cashier.dto.product.TbProductStockOperateQueryCriteria;
import cn.ysk.cashier.mapper.product.TbProductStockOperateMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.time.Instant;
import java.util.*;
import java.io.IOException;
import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-01-25
**/
@Service
@RequiredArgsConstructor
public class TbProductStockOperateServiceImpl implements TbProductStockOperateService {
private final TbProductStockOperateRepository tbProductStockOperateRepository;
private final TbProductStockOperateMapper tbProductStockOperateMapper;
private final TbShopPurveyorTransactRepository purveyorTransactRepository;
private final TbShopInfoRepository shopInfoRepository;
private final TbProductSkuRepository tbProductSkuRepository;
private final TbProductSkuService productSkuService;
private final EntityManager entityManager;
@Override
public Map<String, Object> queryAllPage(TbProductStockOperateQueryCriteria criteria) {
Sort sort = Sort.by(Sort.Direction.DESC, "id");
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
Page<TbProductStockOperate> page = tbProductStockOperateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<ProductStockOperateVO> stockOperateVOList = new ArrayList<>();
for (TbProductStockOperate stockOperate :page.getContent()) {
ProductStockOperateVO stockOperateVO = new ProductStockOperateVO();
BeanUtils.copyProperties(stockOperate,stockOperateVO);
stockOperateVO.setStockSnap(ListUtil.stringChangeList(stockOperate.getStockSnap()));
stockOperateVO.setOperatorSnap(StringUtils.stringChangeMap(stockOperate.getOperatorSnap()));
stockOperateVOList.add(stockOperateVO);
}
HashMap<String, Object> map = new HashMap<>();
map.put("content",stockOperateVOList);
map.put("totalElements",page.getTotalElements());
return map;
}
@Override
public List<TbProductStockOperateDto> queryAll(TbProductStockOperateQueryCriteria criteria){
return tbProductStockOperateMapper.toDto(tbProductStockOperateRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
public void nullify(Integer id) {
// TbProductStockOperate tbProductStockOperate = tbProductStockOperateRepository.findById(id).orElseGet(TbProductStockOperate::new);
// tbProductStockOperate.setStatus("nullify");
// //作废之后恢复数量
// tbProductStockOperate.get
//
//
// ValidationUtil.isNull( tbProductStockOperate.getId(),"TbProductStockOperate","id",id);
// tbProductStockOperate.copy(resources);
// tbProductStockOperateRepository.save(tbProductStockOperate);
}
@Override
@Transactional
public ProductStockOperateVO findById(Integer id) {
TbProductStockOperate tbProductStockOperate = tbProductStockOperateRepository.findById(id).orElseGet(TbProductStockOperate::new);
ProductStockOperateVO stockOperateVO = new ProductStockOperateVO();
BeanUtils.copyProperties(tbProductStockOperate,stockOperateVO);
stockOperateVO.setStockSnap(ListUtil.stringChangeList(tbProductStockOperate.getStockSnap()));
stockOperateVO.setOperatorSnap(StringUtils.stringChangeMap(tbProductStockOperate.getOperatorSnap()));
ValidationUtil.isNull(tbProductStockOperate.getId(),"TbProductStockOperate","id",id);
return stockOperateVO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbProductStockOperateDto create(TbProductStockOperate resources) {
return tbProductStockOperateMapper.toDto(tbProductStockOperateRepository.save(resources));
}
/**
* 出库
* @param resources
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public OutAndOnDto createOutAndONOperate(OutAndOnDto resources) {
//用户相关
TbShopInfo byId = shopInfoRepository.findById(Integer.valueOf(resources.getShopId())).orElseGet(TbShopInfo::new);
if (byId.getId() == null){
throw new BadRequestException("商户号有误");
}
//增加操作日志
long times = Instant.now().toEpochMilli();
TbProductStockOperate stockOperate = new TbProductStockOperate();
stockOperate.setShopId(resources.getShopId());
stockOperate.setStockSnap(resources.getList().toString());
System.out.println(stockOperate.getStockSnap());
stockOperate.setType(resources.getType());
if ("purchase".equals(resources.getType()) || "purveyor".equals(resources.getType())){
stockOperate.setSubType(1);
}else {
stockOperate.setSubType(-1);
}
Map<String, String> operatorSnapMap = new HashMap<>();
operatorSnapMap.put("name", byId.getShopName());
operatorSnapMap.put("account",byId.getAccount());
stockOperate.setOperatorSnap(JSON.toJSONString(operatorSnapMap));
stockOperate.setBatchNumber(resources.getBatchNumber());
stockOperate.setRemark(resources.getRemark());
stockOperate.setStockTime(times);
stockOperate.setCreatedAt(times);
stockOperate.setUpdatedAt(times);
stockOperate.setStatus("normal");
TbProductStockOperate saveStockOperate = tbProductStockOperateRepository.save(stockOperate);
//帐目往来
if (!"other-out".equals(resources.getType()) || !"purchase".equals(resources.getType())) {
TbShopPurveyorTransact purveyorTransact = new TbShopPurveyorTransact();
purveyorTransact.setShopId(resources.getShopId());
purveyorTransact.setPurveyorName(resources.getPurveyorName());
purveyorTransact.setPurveyorId(resources.getPurveyorId());
purveyorTransact.setRemark(resources.getRemark());
purveyorTransact.setCreatedAt(times);
purveyorTransact.setUpdatedAt(times);
purveyorTransact.setTotalAmount(resources.getTotalAmount());
purveyorTransact.setPaidAmount(resources.getPaidAmount());
purveyorTransact.setWaitAmount(resources.getTotalAmount().subtract(resources.getPaidAmount()));
if (resources.getTotalAmount().compareTo(resources.getPaidAmount())<0){
purveyorTransact.setStatus(1);
}else {
purveyorTransact.setStatus(0);
}
purveyorTransact.setPaidAt(resources.getPaidAt());
purveyorTransact.setType(resources.getType());
purveyorTransactRepository.save(purveyorTransact);
}
//库存记录
if (resources.getList() == null){
throw new BadRequestException("数据有误");
}
for (Object date :resources.getList()) {
//商品详情
ProductListDto productListDto= JSONObject.parseObject(JSONObject.toJSONString(date),ProductListDto.class);
TbProductSku tbProductSku = tbProductSkuRepository.findById(productListDto.getId()).orElseGet(TbProductSku::new);
TbProductStockDetail productStockDetail = new TbProductStockDetail();
productStockDetail.setBatchNumber(resources.getBatchNumber());
productStockDetail.setCreatedAt(times);
productStockDetail.setUpdatedAt(times);
productStockDetail.setIsStock(1);
Integer round = (int) Math.floor(tbProductSku.getStockNumber());
productStockDetail.setLeftNumber(round);
productStockDetail.setProductId(productListDto.getProductId());
productStockDetail.setProductName(productListDto.getName());
productStockDetail.setRecordId(saveStockOperate.getId().toString());
productStockDetail.setShopId(resources.getShopId());
productStockDetail.setSkuId(productListDto.getId().toString());
productStockDetail.setSourcePath("NORMAL");
productListDto.setNumber(productListDto.getNumber() != null? productListDto.getNumber(): 0);
switch (resources.getType()) {
case "sale":
productStockDetail.setStockNumber((double) -productListDto.getNumber());
productStockDetail.setSubType(-1);
break;
case "refund":
productStockDetail.setStockNumber((double) productListDto.getNumber());
productStockDetail.setSubType(1);
break;
case "reject":
productStockDetail.setStockNumber((double) -productListDto.getNumber());
productStockDetail.setSubType(-1);
break;
case "purveyor":
productStockDetail.setStockNumber((double) productListDto.getNumber());
productStockDetail.setSubType(1);
break;
case "purchase":
productStockDetail.setStockNumber((double) productListDto.getNumber());
productStockDetail.setSubType(1);
break;
default:
break;
}
productStockDetail.setType(resources.getType());
productStockDetail.setUnitName(productListDto.getUnitName());
entityManager.persist(productStockDetail);
//sku数量
TbProductSku sku = new TbProductSku();
sku.setId(productListDto.getId());
sku.setStockNumber(tbProductSku.getStockNumber()+productStockDetail.getStockNumber());
productSkuService.update(sku);
}
return resources;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbProductStockOperate resources) {
TbProductStockOperate tbProductStockOperate = tbProductStockOperateRepository.findById(resources.getId()).orElseGet(TbProductStockOperate::new);
ValidationUtil.isNull( tbProductStockOperate.getId(),"TbProductStockOperate","id",resources.getId());
tbProductStockOperate.copy(resources);
tbProductStockOperateRepository.save(tbProductStockOperate);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbProductStockOperateRepository.deleteById(id);
}
}
@Override
public void download(List<TbProductStockOperateDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbProductStockOperateDto tbProductStockOperate : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺Id", tbProductStockOperate.getShopId());
map.put("操作镜像", tbProductStockOperate.getStockSnap());
map.put(" type", tbProductStockOperate.getType());
map.put(" subType", tbProductStockOperate.getSubType());
map.put("批次", tbProductStockOperate.getBatchNumber());
map.put(" remark", tbProductStockOperate.getRemark());
map.put("操作时间", tbProductStockOperate.getStockTime());
map.put("操作人", tbProductStockOperate.getOperatorSnap());
map.put(" createdAt", tbProductStockOperate.getCreatedAt());
map.put(" updatedAt", tbProductStockOperate.getUpdatedAt());
map.put("供应商Id", tbProductStockOperate.getPurveyorId());
map.put("供应商名称", tbProductStockOperate.getPurveyorName());
map.put("nullify作废normal正常", tbProductStockOperate.getStatus());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,174 @@
/*
* 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.service.impl.productimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.product.TbShopCategory;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.product.TbShopCategoryRepository;
import cn.ysk.cashier.service.product.TbShopCategoryService;
import cn.ysk.cashier.dto.product.TbShopCategoryDto;
import cn.ysk.cashier.dto.product.TbShopCategoryQueryCriteria;
import cn.ysk.cashier.mapper.product.TbShopCategoryMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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);
PageRequest.of(0, 10, Sort.by("sort"));
Page<TbShopCategory> page = tbShopCategoryRepository.findAllBy(criteria.getShopId(), pageable);
tbShopCategoryRepository.findAllBy(criteria.getShopId(),pageable);
List<Integer> treeId = new ArrayList<>();
for (TbShopCategory category : page.getContent()) {
Integer ids = category.getId();
treeId.add(ids);
}
//找到子分类
List<TbShopCategory> children = tbShopCategoryRepository.findChildren(treeId);
if (children.isEmpty()){
return PageUtil.toPage(page.map(tbShopCategoryMapper::toDto));
}
List<TbShopCategoryDto> dto = new ArrayList<>();
for (TbShopCategory category : page.getContent()) {
List<TbShopCategory> tbShopCategoryChildren = new ArrayList<>();
for (TbShopCategory tbShopCategory :children) {
if (tbShopCategory.getTree().equals(category.getId())){
tbShopCategoryChildren.add(tbShopCategory);
}
}
TbShopCategoryDto tbShopCategoryDto = new TbShopCategoryDto();
tbShopCategoryDto.setChildrenList(tbShopCategoryChildren);
BeanUtils.copyProperties(category, tbShopCategoryDto);
dto.add(tbShopCategoryDto);
}
return PageUtil.toPage(dto, dto.size());
}
@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 TbShopCategory create(TbShopCategory resources) {
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
TbShopCategoryDto dto = tbShopCategoryMapper.toDto(tbShopCategoryRepository.save(resources));
if (resources.getPid() == null || "".equals(resources.getPid())){
resources.setTree(resources.getId());
}else {
resources.setTree(Integer.valueOf(resources.getPid().trim()));
}
ValidationUtil.isNull( dto.getId(),"TbShopCategory","id",resources.getId());
tbShopCategoryRepository.save(resources);
return tbShopCategoryRepository.save(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopCategory resources) {
TbShopCategory tbShopCategory = tbShopCategoryRepository.findById(resources.getId()).orElseGet(TbShopCategory::new);
if (resources.getName() == null || resources.getShopId() == null){
throw new BadRequestException("必要参数为空");
}
TbShopCategory byName = tbShopCategoryRepository.findByName(resources.getName(), resources.getShopId());
if (byName != null){
throw new BadRequestException("分类名称重复");
}
resources.setUpdatedAt(Instant.now().toEpochMilli());
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);
}
}

View File

@@ -0,0 +1,123 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
import cn.ysk.cashier.service.shop.TbMerchantAccountService;
import cn.ysk.cashier.dto.shop.TbMerchantAccountDto;
import cn.ysk.cashier.dto.shop.TbMerchantAccountQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbMerchantAccountMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-02-08
**/
@Service
@RequiredArgsConstructor
public class TbMerchantAccountServiceImpl implements TbMerchantAccountService {
private final TbMerchantAccountRepository tbMerchantAccountRepository;
private final TbMerchantAccountMapper tbMerchantAccountMapper;
@Override
public Map<String,Object> queryAll(TbMerchantAccountQueryCriteria criteria, Pageable pageable){
Page<TbMerchantAccount> page = tbMerchantAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbMerchantAccountMapper::toDto));
}
@Override
public List<TbMerchantAccountDto> queryAll(TbMerchantAccountQueryCriteria criteria){
return tbMerchantAccountMapper.toDto(tbMerchantAccountRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbMerchantAccountDto findById(Integer id) {
TbMerchantAccount tbMerchantAccount = tbMerchantAccountRepository.findById(id).orElseGet(TbMerchantAccount::new);
ValidationUtil.isNull(tbMerchantAccount.getId(),"TbMerchantAccount","id",id);
return tbMerchantAccountMapper.toDto(tbMerchantAccount);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbMerchantAccountDto create(TbMerchantAccount resources) {
return tbMerchantAccountMapper.toDto(tbMerchantAccountRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbMerchantAccount resources) {
TbMerchantAccount tbMerchantAccount = tbMerchantAccountRepository.findById(resources.getId()).orElseGet(TbMerchantAccount::new);
ValidationUtil.isNull( tbMerchantAccount.getId(),"TbMerchantAccount","id",resources.getId());
tbMerchantAccount.copy(resources);
tbMerchantAccountRepository.save(tbMerchantAccount);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbMerchantAccountRepository.deleteById(id);
}
}
@Override
public void download(List<TbMerchantAccountDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbMerchantAccountDto tbMerchantAccount : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("登陆帐号", tbMerchantAccount.getAccount());
map.put("登陆密码", tbMerchantAccount.getPassword());
map.put("商家Id", tbMerchantAccount.getMerchantId());
map.put("门店Id", tbMerchantAccount.getShopId());
map.put(" shopSnap", tbMerchantAccount.getShopSnap());
map.put("是否管理员", tbMerchantAccount.getIsAdmin());
map.put("是否商户1商户帐号0-店铺帐号", tbMerchantAccount.getIsMercantile());
map.put("姓名", tbMerchantAccount.getName());
map.put("性别:0女 1 男", tbMerchantAccount.getSex());
map.put("邮箱", tbMerchantAccount.getEmail());
map.put("头像", tbMerchantAccount.getHeadImg());
map.put("联系电话", tbMerchantAccount.getTelephone());
map.put("状态", tbMerchantAccount.getStatus());
map.put("排序", tbMerchantAccount.getSort());
map.put(" roleId", tbMerchantAccount.getRoleId());
map.put("最后登陆时间", tbMerchantAccount.getLastLoginAt());
map.put("公众号openId", tbMerchantAccount.getMpOpenId());
map.put("是否接收消息通知", tbMerchantAccount.getMsgAble());
map.put(" createdAt", tbMerchantAccount.getCreatedAt());
map.put(" updatedAt", tbMerchantAccount.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,151 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbMerchantRegisterRepository;
import cn.ysk.cashier.service.shop.TbMerchantRegisterService;
import cn.ysk.cashier.dto.shop.TbMerchantRegisterDto;
import cn.ysk.cashier.dto.shop.TbMerchantRegisterQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbMerchantRegisterMapper;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-02-23
**/
@Service
@RequiredArgsConstructor
public class TbMerchantRegisterServiceImpl implements TbMerchantRegisterService {
private final TbMerchantRegisterRepository tbMerchantRegisterRepository;
private final TbMerchantRegisterMapper tbMerchantRegisterMapper;
@Override
public Map<String,Object> queryAll(TbMerchantRegisterQueryCriteria criteria){
Sort sort = Sort.by(Sort.Direction.DESC, "id");
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
Page<TbMerchantRegister> page = tbMerchantRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
for (TbMerchantRegister data : page.getContent()) {
data.setName(data.getName() == null?"":data.getName());
data.setTelephone(data.getTelephone() == null?"": data.getTelephone());
data.setType(data.getType() == null?"": data.getType());
data.setProxyId(data.getProxyId() == null?"":data.getProxyId());
}
return PageUtil.toPage(page.getContent(),page.getTotalElements());
}
// @Override
// public List<TbMerchantRegisterDto> queryAll(TbMerchantRegisterQueryCriteria criteria){
// return tbMerchantRegisterMapper.toDto(tbMerchantRegisterRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
// }
@Override
@Transactional
public TbMerchantRegisterDto findById(Integer id) {
TbMerchantRegister tbMerchantRegister = tbMerchantRegisterRepository.findById(id).orElseGet(TbMerchantRegister::new);
ValidationUtil.isNull(tbMerchantRegister.getId(),"TbMerchantRegister","id",id);
return tbMerchantRegisterMapper.toDto(tbMerchantRegister);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbMerchantRegisterDto create(TbMerchantRegisterDto resources) {
if (resources.getNumber()>10){
throw new BadRequestException("每次最多生成10条激活码");
}
for (int i = 0; i < resources.getNumber(); i++) {
TbMerchantRegister tbMerchantRegister = new TbMerchantRegister();
tbMerchantRegister.setRegisterCode(UUID.randomUUID().toString().replaceAll("-", ""));
tbMerchantRegister.setStatus(0);
tbMerchantRegister.setCreatedAt(Instant.now().toEpochMilli());
tbMerchantRegister.setUpdatedAt(Instant.now().toEpochMilli());
tbMerchantRegister.setPeriodYear(resources.getPeriodYear());
tbMerchantRegisterRepository.save(tbMerchantRegister);
}
return tbMerchantRegisterMapper.toDto(new TbMerchantRegister());
}
public static void main(String[] args) {
String uuid = UUID.randomUUID().toString().replaceAll("-", "");
System.out.println(uuid);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbMerchantRegister resources) {
TbMerchantRegister tbMerchantRegister = tbMerchantRegisterRepository.findById(resources.getId()).orElseGet(TbMerchantRegister::new);
ValidationUtil.isNull( tbMerchantRegister.getId(),"TbMerchantRegister","id",resources.getId());
tbMerchantRegister.copy(resources);
tbMerchantRegisterRepository.save(tbMerchantRegister);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbMerchantRegisterRepository.deleteById(id);
}
}
@Override
public void download(List<TbMerchantRegisterDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbMerchantRegisterDto tbMerchantRegister : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("激活码", tbMerchantRegister.getRegisterCode());
map.put("授权token", tbMerchantRegister.getAppCode());
map.put(" telephone", tbMerchantRegister.getTelephone());
map.put(" merchantId", tbMerchantRegister.getMerchantId());
map.put("店铺id", tbMerchantRegister.getShopId());
map.put("版本类型", tbMerchantRegister.getType());
map.put("激活码金额", tbMerchantRegister.getAmount());
map.put("激活时长(月)", tbMerchantRegister.getPeriodYear());
map.put(" name", tbMerchantRegister.getName());
map.put(" address", tbMerchantRegister.getAddress());
map.put(" logo", tbMerchantRegister.getLogo());
map.put(" industry", tbMerchantRegister.getIndustry());
map.put(" industryName", tbMerchantRegister.getIndustryName());
map.put("状态0未使用1已使用", tbMerchantRegister.getStatus());
map.put(" limitShopNumber", tbMerchantRegister.getLimitShopNumber());
map.put(" sourcePath", tbMerchantRegister.getSourcePath());
map.put("创建时间", tbMerchantRegister.getCreatedAt());
map.put(" updatedAt", tbMerchantRegister.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,130 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbMerchantThirdApply;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbMerchantThirdApplyRepository;
import cn.ysk.cashier.service.shop.TbMerchantThirdApplyService;
import cn.ysk.cashier.dto.shop.TbMerchantThirdApplyDto;
import cn.ysk.cashier.dto.shop.TbMerchantThirdApplyQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbMerchantThirdApplyMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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-02-02
**/
@Service
@RequiredArgsConstructor
public class TbMerchantThirdApplyServiceImpl implements TbMerchantThirdApplyService {
private final TbMerchantThirdApplyRepository tbMerchantThirdApplyRepository;
private final TbMerchantThirdApplyMapper tbMerchantThirdApplyMapper;
@Override
public Map<String,Object> queryAll(TbMerchantThirdApplyQueryCriteria criteria, Pageable pageable){
Page<TbMerchantThirdApply> page = tbMerchantThirdApplyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbMerchantThirdApplyMapper::toDto));
}
@Override
public TbMerchantThirdApplyDto findByShopId(Integer shopId) {
TbMerchantThirdApply byShopId = tbMerchantThirdApplyRepository.findByShopId(shopId);
return tbMerchantThirdApplyMapper.toDto(byShopId);
}
@Override
public List<TbMerchantThirdApplyDto> queryAll(TbMerchantThirdApplyQueryCriteria criteria){
return tbMerchantThirdApplyMapper.toDto(tbMerchantThirdApplyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbMerchantThirdApplyDto findById(Integer id) {
TbMerchantThirdApply tbMerchantThirdApply = tbMerchantThirdApplyRepository.findById(id).orElseGet(TbMerchantThirdApply::new);
ValidationUtil.isNull(tbMerchantThirdApply.getId(),"TbMerchantThirdApply","id",id);
return tbMerchantThirdApplyMapper.toDto(tbMerchantThirdApply);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbMerchantThirdApplyDto create(TbMerchantThirdApply resources) {
// if(tbMerchantThirdApplyRepository.findByAppId(resources.getAppId()) != null){
// throw new EntityExistException(TbMerchantThirdApply.class,"app_id",resources.getAppId());
// }
return tbMerchantThirdApplyMapper.toDto(tbMerchantThirdApplyRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbMerchantThirdApply resources) {
TbMerchantThirdApply tbMerchantThirdApply = tbMerchantThirdApplyRepository.findByShopId(resources.getId());
if (tbMerchantThirdApply == null){
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setCreatedAt(Instant.now().toEpochMilli());
tbMerchantThirdApplyRepository.save(resources);
}else {
ValidationUtil.isNull(tbMerchantThirdApply.getId(), "TbMerchantThirdApply", "id", resources.getId());
tbMerchantThirdApply.setUpdatedAt(Instant.now().toEpochMilli());
tbMerchantThirdApply.copy(resources);
tbMerchantThirdApplyRepository.saveAndFlush(tbMerchantThirdApply);
}
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbMerchantThirdApplyRepository.deleteById(id);
}
}
@Override
public void download(List<TbMerchantThirdApplyDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbMerchantThirdApplyDto tbMerchantThirdApply : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" type", tbMerchantThirdApply.getType());
map.put("商户应用", tbMerchantThirdApply.getAppId());
map.put("商户token", tbMerchantThirdApply.getAppToken());
map.put("审核详情-1未提交0已提交不可修改 1审核通过", tbMerchantThirdApply.getStatus());
map.put("支付密码", tbMerchantThirdApply.getPayPassword());
map.put(" createdAt", tbMerchantThirdApply.getCreatedAt());
map.put(" updatedAt", tbMerchantThirdApply.getUpdatedAt());
map.put("shopId", tbMerchantThirdApply.getShopId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,118 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
import cn.ysk.cashier.utils.*;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbPlussShopStaffRepository;
import cn.ysk.cashier.service.shop.TbPlussShopStaffService;
import cn.ysk.cashier.dto.shop.TbPlussShopStaffDto;
import cn.ysk.cashier.dto.shop.TbPlussShopStaffQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbPlussShopStaffMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.time.Instant;
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-03-01
**/
@Service
@RequiredArgsConstructor
public class TbPlussShopStaffServiceImpl implements TbPlussShopStaffService {
private final TbPlussShopStaffRepository tbPlussShopStaffRepository;
private final TbPlussShopStaffMapper tbPlussShopStaffMapper;
@Override
public Map<String,Object> queryAll(TbPlussShopStaffQueryCriteria criteria, Pageable pageable){
Page<TbPlussShopStaff> page = tbPlussShopStaffRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbPlussShopStaffMapper::toDto));
}
@Override
public List<TbPlussShopStaffDto> queryAll(TbPlussShopStaffQueryCriteria criteria){
return tbPlussShopStaffMapper.toDto(tbPlussShopStaffRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbPlussShopStaffDto findById(Integer id) {
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(id).orElseGet(TbPlussShopStaff::new);
ValidationUtil.isNull(tbPlussShopStaff.getId(),"TbPlussShopStaff","id",id);
return tbPlussShopStaffMapper.toDto(tbPlussShopStaff);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbPlussShopStaffDto create(TbPlussShopStaff resources) {
if (!PhoneUtil.validator(resources.getAccount())){
throw new BadRequestException("手机号格式有误");
}
resources.setPassword(MD5Utils.md5("123456"));
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
return tbPlussShopStaffMapper.toDto(tbPlussShopStaffRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbPlussShopStaff resources) {
TbPlussShopStaff tbPlussShopStaff = tbPlussShopStaffRepository.findById(resources.getId()).orElseGet(TbPlussShopStaff::new);
resources.setUpdatedAt(tbPlussShopStaff.getUpdatedAt());
ValidationUtil.isNull( tbPlussShopStaff.getId(),"TbPlussShopStaff","id",resources.getId());
tbPlussShopStaff.copy(resources);
tbPlussShopStaffRepository.save(tbPlussShopStaff);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbPlussShopStaffRepository.deleteById(id);
}
}
@Override
public void download(List<TbPlussShopStaffDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbPlussShopStaffDto tbPlussShopStaff : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("员工编号", tbPlussShopStaff.getCode());
map.put("员工名称", tbPlussShopStaff.getName());
map.put("登录账号", tbPlussShopStaff.getAccount());
map.put("密码", tbPlussShopStaff.getPassword());
map.put("最大优惠金额", tbPlussShopStaff.getMaxDiscountAmount());
map.put("1启用0不启用", tbPlussShopStaff.getStatus());
map.put("登录端", tbPlussShopStaff.getEmployee());
map.put("shopId", tbPlussShopStaff.getShopId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,164 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.controller.shop.TbPrintMachine;
import cn.ysk.cashier.dto.shop.PrintMachineDto;
import cn.ysk.cashier.utils.FileUtil;
import cn.ysk.cashier.utils.ListUtil;
import cn.ysk.cashier.utils.QueryHelp;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.vo.TbPrintMachineVO;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbPrintMachineRepository;
import cn.ysk.cashier.service.shop.TbPrintMachineService;
import cn.ysk.cashier.dto.shop.TbPrintMachineDto;
import cn.ysk.cashier.dto.shop.TbPrintMachineQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbPrintMachineMapper;
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 java.time.Instant;
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-02-28
**/
@Service
@RequiredArgsConstructor
public class TbPrintMachineServiceImpl implements TbPrintMachineService {
private final TbPrintMachineRepository tbPrintMachineRepository;
private final TbPrintMachineMapper tbPrintMachineMapper;
@Override
public List<TbPrintMachineVO> queryAll(TbPrintMachineQueryCriteria criteria, Pageable pageable){
Page<TbPrintMachine> page = tbPrintMachineRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<TbPrintMachineVO> printMachineVOList = new ArrayList<>();
for (TbPrintMachine dtoData : page.getContent()) {
TbPrintMachineVO tbPrintMachineVO = new TbPrintMachineVO();
if (dtoData.getConfig() != null){
tbPrintMachineVO.setConfig(ListUtil.stringToJSONObject(dtoData.getConfig()));
}
BeanUtils.copyProperties(dtoData,tbPrintMachineVO);
printMachineVOList.add(tbPrintMachineVO);
}
return printMachineVOList;
}
// @Override
// public List<TbPrintMachineDto> queryAll(TbPrintMachineQueryCriteria criteria){
// List<TbPrintMachineDto> dto = tbPrintMachineMapper.toDto(tbPrintMachineRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
// List<TbPrintMachineVO> printMachineVOList = new ArrayList<>();
// for (TbPrintMachineDto dtoData : dto) {
// TbPrintMachineVO tbPrintMachineVO = new TbPrintMachineVO();
// if (dtoData.getConfig() != null){
// tbPrintMachineVO.setConfig(ListUtil.stringChangeList(dtoData.getConfig()));
// }
// BeanUtils.copyProperties(dtoData,tbPrintMachineVO);
// printMachineVOList.add(tbPrintMachineVO);
// }
// return printMachineVOList;
// }
@Override
@Transactional
public TbPrintMachineVO findById(Integer id) {
TbPrintMachine tbPrintMachine = tbPrintMachineRepository.findById(id).orElseGet(TbPrintMachine::new);
if (tbPrintMachine.getId() == null){
throw new BadRequestException("数据有误");
}
TbPrintMachineVO tbPrintMachineVO = new TbPrintMachineVO();
if (tbPrintMachine.getConfig() != null){
tbPrintMachineVO.setConfig(ListUtil.stringToJSONObject(tbPrintMachine.getConfig()));
}
BeanUtils.copyProperties(tbPrintMachine,tbPrintMachineVO);
ValidationUtil.isNull(tbPrintMachine.getId(),"TbPrintMachine","id",id);
return tbPrintMachineVO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbPrintMachine create(PrintMachineDto resources) {
TbPrintMachine tbPrintMachine = new TbPrintMachine();
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
if (resources.getConfig() != null){
tbPrintMachine.setConfig(ListUtil.toString(resources.getConfig()));
}
BeanUtils.copyProperties(resources,tbPrintMachine);
return tbPrintMachineRepository.save(tbPrintMachine);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(PrintMachineDto resources) {
TbPrintMachine tbPrintMachine = tbPrintMachineRepository.findById(resources.getId()).orElseGet(TbPrintMachine::new);
resources.setUpdatedAt(Instant.now().toEpochMilli());
if (resources.getConfig() != null){
tbPrintMachine.setConfig(ListUtil.toString(resources.getConfig()));
}
ValidationUtil.isNull( tbPrintMachine.getId(),"TbPrintMachine","id",resources.getId());
BeanUtils.copyProperties(resources,tbPrintMachine);
tbPrintMachineRepository.save(tbPrintMachine);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbPrintMachineRepository.deleteById(id);
}
}
@Override
public void download(List<TbPrintMachineDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbPrintMachineDto tbPrintMachine : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("设备名称", tbPrintMachine.getName());
map.put("printer", tbPrintMachine.getType());
map.put("现在打印机支持USB 和 网络、蓝牙", tbPrintMachine.getConnectionType());
map.put("ip地址", tbPrintMachine.getAddress());
map.put("端口", tbPrintMachine.getPort());
map.put("打印类型(分类)", tbPrintMachine.getSubType());
map.put("状态 online", tbPrintMachine.getStatus());
map.put("店铺Id", tbPrintMachine.getShopId());
map.put("分类Id", tbPrintMachine.getCategoryIds());
map.put("现在打印机支持USB 和 网络两种", tbPrintMachine.getContentType());
map.put("主配置", tbPrintMachine.getConfig());
map.put(" createdAt", tbPrintMachine.getCreatedAt());
map.put(" updatedAt", tbPrintMachine.getUpdatedAt());
map.put("分类", tbPrintMachine.getCategoryList());
map.put("排序", tbPrintMachine.getSort());
map.put("Android打印机需要标识设备ID ", tbPrintMachine.getVendorId());
map.put("Android打印机需要标识设备ID ", tbPrintMachine.getProductId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -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 cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbReceiptSales;
import cn.ysk.cashier.mapper.shop.TbReceiptSalesMapper;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbReceiptSalesRepository;
import cn.ysk.cashier.service.shop.TbReceiptSalesService;
import cn.ysk.cashier.dto.shop.TbReceiptSalesDto;
import cn.ysk.cashier.dto.shop.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 cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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);
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("打印会员开关 01", tbReceiptSales.getShowMember());
map.put("打印会员编号开关", tbReceiptSales.getShowMemberCode());
map.put("打印会员积分", tbReceiptSales.getShowMemberScore());
map.put("打印会员余额开关 01", 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);
}
}

View File

@@ -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 cn.ysk.cashier.service.impl.shopimpl;
import cn.ysk.cashier.mapper.shop.TbShopAreaMapper;
import cn.ysk.cashier.pojo.shop.TbShopArea;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopAreaRepository;
import cn.ysk.cashier.service.shop.TbShopAreaService;
import cn.ysk.cashier.dto.shop.TbShopAreaDto;
import cn.ysk.cashier.dto.shop.TbShopAreaQueryCriteria;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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-31
**/
@Service
@RequiredArgsConstructor
public class TbShopAreaServiceImpl implements TbShopAreaService {
private final TbShopAreaRepository tbShopAreaRepository;
private final TbShopAreaMapper tbShopAreaMapper;
@Override
public Map<String,Object> queryAll(TbShopAreaQueryCriteria criteria, Pageable pageable){
Page<TbShopArea> page = tbShopAreaRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopAreaMapper::toDto));
}
@Override
public List<TbShopAreaDto> queryAll(TbShopAreaQueryCriteria criteria){
return tbShopAreaMapper.toDto(tbShopAreaRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopAreaDto findById(Integer id) {
TbShopArea tbShopArea = tbShopAreaRepository.findById(id).orElseGet(TbShopArea::new);
ValidationUtil.isNull(tbShopArea.getId(),"TbShopArea","id",id);
return tbShopAreaMapper.toDto(tbShopArea);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopAreaDto create(TbShopArea resources) {
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
resources.setSort(0);
return tbShopAreaMapper.toDto(tbShopAreaRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopArea resources) {
TbShopArea tbShopArea = tbShopAreaRepository.findById(resources.getId()).orElseGet(TbShopArea::new);
tbShopArea.setUpdatedAt(Instant.now().toEpochMilli());
ValidationUtil.isNull( tbShopArea.getId(),"TbShopArea","id",resources.getId());
tbShopArea.copy(resources);
tbShopAreaRepository.save(tbShopArea);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopAreaRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopAreaDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopAreaDto tbShopArea : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺Id", tbShopArea.getShopId());
map.put("排序", tbShopArea.getSort());
map.put("区域名称", tbShopArea.getName());
map.put("区域价格", tbShopArea.getPrice());
map.put("图片", tbShopArea.getView());
map.put("建议人数 5-10", tbShopArea.getCapacityRange());
map.put(" createdAt", tbShopArea.getCreatedAt());
map.put(" updatedAt", tbShopArea.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,115 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbShopCashSpread;
import cn.ysk.cashier.service.shop.TbShopCashSpreadService;
import cn.ysk.cashier.dto.shop.TbShopCashSpreadDto;
import cn.ysk.cashier.mapper.shop.TbShopCashSpreadMapper;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopCashSpreadRepository;
import cn.ysk.cashier.dto.shop.TbShopCashSpreadQueryCriteria;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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-05
**/
@Service
@RequiredArgsConstructor
public class TbShopCashSpreadServiceImpl implements TbShopCashSpreadService {
private final TbShopCashSpreadRepository tbShopCashSpreadRepository;
private final TbShopCashSpreadMapper tbShopCashSpreadMapper;
@Override
public Map<String,Object> queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable){
Page<TbShopCashSpread> page = tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopCashSpreadMapper::toDto));
}
@Override
public List<TbShopCashSpreadDto> queryAll(TbShopCashSpreadQueryCriteria criteria){
return tbShopCashSpreadMapper.toDto(tbShopCashSpreadRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopCashSpreadDto findById(String id) {
TbShopCashSpread tbShopCashSpread = tbShopCashSpreadRepository.findById(id).orElseGet(TbShopCashSpread::new);
ValidationUtil.isNull(tbShopCashSpread.getId(),"TbShopCashSpread","id",id);
return tbShopCashSpreadMapper.toDto(tbShopCashSpread);
}
@Override
public TbShopCashSpread findByShopId(Integer id) {
TbShopCashSpread byShopId = tbShopCashSpreadRepository.findByShopId(id);
return byShopId;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopCashSpreadDto create(TbShopCashSpread resources) {
return tbShopCashSpreadMapper.toDto(tbShopCashSpreadRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public Integer update(TbShopCashSpread resources) {
return tbShopCashSpreadRepository.updateConfig(resources.getId(), resources.getScreenConfig().trim(), Instant.now().toEpochMilli());
}
@Override
public void deleteAll(String[] ids) {
for (String id : ids) {
tbShopCashSpreadRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopCashSpreadDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopCashSpreadDto tbShopCashSpread : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("登陆密码", tbShopCashSpread.getSaleReceipt());
map.put("状态", tbShopCashSpread.getTriplicateReceipt());
map.put("到期提醒时间", tbShopCashSpread.getScreenConfig());
map.put(" tagConfig", tbShopCashSpread.getTagConfig());
map.put(" scaleConfig", tbShopCashSpread.getScaleConfig());
map.put(" createdAt", tbShopCashSpread.getCreatedAt());
map.put(" updatedAt", tbShopCashSpread.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,130 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbShopCurrency;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopCurrencyRepository;
import cn.ysk.cashier.service.shop.TbShopCurrencyService;
import cn.ysk.cashier.dto.shop.TbShopCurrencyDto;
import cn.ysk.cashier.dto.shop.TbShopCurrencyQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopCurrencyMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-05
**/
@Service
@RequiredArgsConstructor
public class TbShopCurrencyServiceImpl implements TbShopCurrencyService {
private final TbShopCurrencyRepository tbShopCurrencyRepository;
private final TbShopCurrencyMapper tbShopCurrencyMapper;
@Override
public Map<String,Object> queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable){
Page<TbShopCurrency> page = tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopCurrencyMapper::toDto));
}
@Override
public List<TbShopCurrencyDto> queryAll(TbShopCurrencyQueryCriteria criteria){
return tbShopCurrencyMapper.toDto(tbShopCurrencyRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopCurrencyDto findById(Integer id) {
TbShopCurrency tbShopCurrency = tbShopCurrencyRepository.findById(id).orElseGet(TbShopCurrency::new);
ValidationUtil.isNull(tbShopCurrency.getId(),"TbShopCurrency","id",id);
return tbShopCurrencyMapper.toDto(tbShopCurrency);
}
@Override
public TbShopCurrency findByShopId(String id) {
TbShopCurrency byShopId = tbShopCurrencyRepository.findByShopId(id);
return byShopId;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopCurrencyDto create(TbShopCurrency resources) {
return tbShopCurrencyMapper.toDto(tbShopCurrencyRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopCurrency resources) {
TbShopCurrency tbShopCurrency = tbShopCurrencyRepository.findById(resources.getId()).orElseGet(TbShopCurrency::new);
ValidationUtil.isNull( tbShopCurrency.getId(),"TbShopCurrency","id",resources.getId());
tbShopCurrency.copy(resources);
tbShopCurrencyRepository.save(tbShopCurrency);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopCurrencyRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopCurrencyDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopCurrencyDto tbShopCurrency : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺Id", tbShopCurrency.getShopId());
map.put("备用金", tbShopCurrency.getPrepareAmount());
map.put("货币单位 ¥,$", tbShopCurrency.getCurrency());
map.put("小数位012", tbShopCurrency.getDecimalsDigits());
map.put("四舍五入五舍六入none,round4up5,round5up6,round12up34", tbShopCurrency.getDiscountRound());
map.put("商户Id", tbShopCurrency.getMerchantId());
map.put("订单抹零 -1无0元 1角2分 0.5=0.5元", tbShopCurrency.getSmallChange());
map.put("使折扣生效", tbShopCurrency.getEnableCustomDiscount());
map.put("最大抹零金额(100)", tbShopCurrency.getMaxDiscount());
map.put("最大折扣百分比,优先级高于max_discount", tbShopCurrency.getMaxPercent());
map.put("折扣显示详情", tbShopCurrency.getDiscountConfigs());
map.put("营业时间(弃用)", tbShopCurrency.getBizDuration());
map.put("允许网络支付", tbShopCurrency.getAllowWebPay());
map.put("自动抹零,开启时,系统自动抹零", tbShopCurrency.getIsAutoToZero());
map.put("商品含税", tbShopCurrency.getIsIncludeTaxPrice());
map.put("服务费配置(小费)", tbShopCurrency.getServiceCharge());
map.put("税号", tbShopCurrency.getTaxNumber());
map.put(" createdAt", tbShopCurrency.getCreatedAt());
map.put(" updatedAt", tbShopCurrency.getUpdatedAt());
map.put("自动锁屏", tbShopCurrency.getAutoLockScreen());
map.put("语音通知", tbShopCurrency.getVoiceNotification());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,254 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
import cn.ysk.cashier.repository.shop.TbMerchantAccountRepository;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
import cn.ysk.cashier.repository.shop.TbMerchantRegisterRepository;
import cn.ysk.cashier.system.domain.Dept;
import cn.ysk.cashier.system.domain.Job;
import cn.ysk.cashier.system.domain.Role;
import cn.ysk.cashier.system.domain.User;
import cn.ysk.cashier.system.repository.UserRepository;
import cn.ysk.cashier.utils.*;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopInfoRepository;
import cn.ysk.cashier.service.shop.TbShopInfoService;
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopInfoMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.time.Instant;
import java.util.*;
import java.io.IOException;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2023-11-07
**/
@Service
@RequiredArgsConstructor
public class TbShopInfoServiceImpl implements TbShopInfoService {
private final TbShopInfoRepository tbShopInfoRepository;
@Resource
private TbShopInfoMapper tbShopInfoMapper;
private final TbMerchantAccountRepository merchantAccountRepository;
private final UserRepository userRepository;
private final TbMerchantRegisterRepository merchantRegisterRepository;
private final PasswordEncoder passwordEncoder;
@Override
public Map<String,Object> queryAll(TbShopInfoQueryCriteria criteria, Pageable pageable){
// if (!"admin".equals(criteria.getAccount())){
// throw new BadRequestException("登录账号有误");
// }
Page<TbShopInfo> page = tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
List<TbShopInfo> content = page.getContent();
for (TbShopInfo data: content){
if (data.getProfiles() == null){
data.setProfiles("");
}
}
return PageUtil.toPage(page);
}
@Override
public List<TbShopInfoDto> queryAll(TbShopInfoQueryCriteria criteria){
return tbShopInfoMapper.toDto(tbShopInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopInfoDto findById(Integer id) {
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(id).orElseGet(TbShopInfo::new);
ValidationUtil.isNull(tbShopInfo.getId(),"TbShopInfo","id",id);
return tbShopInfoMapper.toDto(tbShopInfo);
}
@Override
public TbShopInfo findByIdInfo(Integer id) {
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(id).orElseGet(TbShopInfo::new);
return tbShopInfo;
}
@Override
public TbShopInfoDto finByAccount(String account) {
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopInfoDto create(TbShopInfoDto resources) {
if ("release".equals(resources.getProfiles())){
if (resources.getRegisterCode() == null){
throw new BadRequestException("未绑定激活码");
}
}
TbShopInfo byAccount = tbShopInfoRepository.findByAccount(resources.getAccount());
if (byAccount != null){
throw new BadRequestException("登录名重复");
}
TbShopInfo tbShopInfo = new TbShopInfo();
BeanUtils.copyProperties(resources,tbShopInfo);
tbShopInfo.setCreatedAt(Instant.now().toEpochMilli());
tbShopInfo.setUpdatedAt(Instant.now().toEpochMilli());
//增加商户详情
TbShopInfo save = tbShopInfoRepository.save(tbShopInfo);
//增加商户登录账号
TbMerchantAccount tbMerchantAccount = new TbMerchantAccount();
tbMerchantAccount.setAccount(resources.getAccount());
tbMerchantAccount.setPassword(MD5Utils.encrypt(resources.getPassword()));
tbMerchantAccount.setShopId(String.valueOf(save.getId()));
tbMerchantAccount.setIsAdmin(0);
tbMerchantAccount.setIsMercantile(0);
tbMerchantAccount.setStatus(1);
tbMerchantAccount.setMsgAble(0);
TbMerchantAccount save1 = merchantAccountRepository.save(tbMerchantAccount);
//绑定accountId
tbShopInfo.setMerchantId(String.valueOf(save1.getId()));
tbShopInfoRepository.save(tbShopInfo);
//添加收银系统后台账号
User user = new User();
user.setPassword(passwordEncoder.encode(resources.getPassword()));
user.setUsername(resources.getAccount());
user.setPhone(resources.getPhone());
user.setCreateBy("admin");
user.setEnabled(true);
Dept dept = new Dept();
dept.setId(18L);
user.setDept(dept);
Set<Role> roles = new HashSet<>();
Role role = new Role();
role.setId(2L);
roles.add(role);
user.setRoles(roles);
Set<Job> jobs = new HashSet<>();
Job job = new Job();
job.setId(10L);
jobs.add(job);
user.setJobs(jobs);
userRepository.save(user);
if (resources.getRegisterCode() != null){
//激活码绑定
TbMerchantRegister tbMerchantRegister = merchantRegisterRepository.findByRegisterCode(resources.getRegisterCode());
if(tbMerchantRegister == null){
throw new BadRequestException("激活码有误");
}
if (tbMerchantRegister.getStatus() == 1){
throw new BadRequestException("激活码已激活,不能重复绑定");
}
tbMerchantRegister.setStatus(1);
tbMerchantAccount.setShopId(String.valueOf(save.getId()));
tbMerchantAccount.setName(save.getShopName());
merchantRegisterRepository.save(tbMerchantRegister);
}
return tbShopInfoMapper.toDto(new TbShopInfo());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopInfo resources) {
TbShopInfo tbShopInfo = tbShopInfoRepository.findById(resources.getId()).orElseGet(TbShopInfo::new);
ValidationUtil.isNull( tbShopInfo.getId(),"TbShopInfo","id",resources.getId());
tbShopInfo.copy(resources);
tbShopInfoRepository.save(tbShopInfo);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopInfoRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopInfoDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopInfoDto tbShopInfo : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺帐号", tbShopInfo.getAccount());
map.put("店铺代号策略方式为city +店铺号8位", tbShopInfo.getShopCode());
map.put("店铺口号", tbShopInfo.getSubTitle());
map.put("商户Id", tbShopInfo.getMerchantId());
map.put("店铺名称", tbShopInfo.getShopName());
map.put("连锁店扩展店名", tbShopInfo.getChainName());
map.put("背景图", tbShopInfo.getBackImg());
map.put("门头照", tbShopInfo.getFrontImg());
map.put("联系人姓名", tbShopInfo.getContactName());
map.put("联系电话", tbShopInfo.getPhone());
map.put("店铺log", tbShopInfo.getLogo());
map.put("是否参与代收 0--不参与 1参与 ", tbShopInfo.getIsDeposit());
map.put("是否为供应商", tbShopInfo.getIsSupply());
map.put("封面图", tbShopInfo.getCoverImg());
map.put("店铺分享图", tbShopInfo.getShareImg());
map.put("轮播图", tbShopInfo.getView());
map.put("店铺简介", tbShopInfo.getDetail());
map.put("经纬度", tbShopInfo.getLat());
map.put("经纬度", tbShopInfo.getLng());
map.put("未用", tbShopInfo.getMchId());
map.put(" registerType", tbShopInfo.getRegisterType());
map.put("是否独立的微信小程序", tbShopInfo.getIsWxMaIndependent());
map.put("详细地址", tbShopInfo.getAddress());
map.put("类似于这种规则51.51.570", tbShopInfo.getCity());
map.put("店铺类型 超市--MARKET---其它店SHOP", tbShopInfo.getType());
map.put("行业", tbShopInfo.getIndustry());
map.put("行业名称", tbShopInfo.getIndustryName());
map.put("营业时间", tbShopInfo.getBusinessTime());
map.put("配送时间", tbShopInfo.getPostTime());
map.put(" postAmountLine", tbShopInfo.getPostAmountLine());
map.put("0停业1正常营业,网上售卖", tbShopInfo.getOnSale());
map.put("0今日1次日", tbShopInfo.getSettleType());
map.put("时间", tbShopInfo.getSettleTime());
map.put("入驻时间", tbShopInfo.getEnterAt());
map.put("到期时间", tbShopInfo.getExpireAt());
map.put("门店状态", tbShopInfo.getStatus());
map.put("人均消费", tbShopInfo.getAverage());
map.put("订单等待时间", tbShopInfo.getOrderWaitPayMinute());
map.put("支持登陆设备个数", tbShopInfo.getSupportDeviceNumber());
map.put("分销层级1-下级分销 2-两下级分销)", tbShopInfo.getDistributeLevel());
map.put(" createdAt", tbShopInfo.getCreatedAt());
map.put(" updatedAt", tbShopInfo.getUpdatedAt());
map.put(" proxyId", tbShopInfo.getProxyId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,121 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbShopPurveyor;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopPurveyorRepository;
import cn.ysk.cashier.service.shop.TbShopPurveyorService;
import cn.ysk.cashier.dto.shop.TbShopPurveyorDto;
import cn.ysk.cashier.dto.shop.TbShopPurveyorQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopPurveyorMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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-22
**/
@Service
@RequiredArgsConstructor
public class TbShopPurveyorServiceImpl implements TbShopPurveyorService {
private final TbShopPurveyorRepository tbShopPurveyorRepository;
private final TbShopPurveyorMapper tbShopPurveyorMapper;
@Override
public Map<String,Object> queryAll(TbShopPurveyorQueryCriteria criteria, Pageable pageable){
Page<TbShopPurveyor> page = tbShopPurveyorRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopPurveyorMapper::toDto));
}
@Override
public List<TbShopPurveyorDto> queryAll(TbShopPurveyorQueryCriteria criteria){
return tbShopPurveyorMapper.toDto(tbShopPurveyorRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopPurveyorDto findById(Integer id) {
TbShopPurveyor tbShopPurveyor = tbShopPurveyorRepository.findById(id).orElseGet(TbShopPurveyor::new);
ValidationUtil.isNull(tbShopPurveyor.getId(),"TbShopPurveyor","id",id);
return tbShopPurveyorMapper.toDto(tbShopPurveyor);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopPurveyorDto create(TbShopPurveyor resources) {
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
return tbShopPurveyorMapper.toDto(tbShopPurveyorRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopPurveyor resources) {
TbShopPurveyor tbShopPurveyor = tbShopPurveyorRepository.findById(resources.getId()).orElseGet(TbShopPurveyor::new);
tbShopPurveyor.setUpdatedAt(Instant.now().toEpochMilli());
tbShopPurveyor.setSort(0);
ValidationUtil.isNull( tbShopPurveyor.getId(),"TbShopPurveyor","id",resources.getId());
tbShopPurveyor.copy(resources);
tbShopPurveyorRepository.save(tbShopPurveyor);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopPurveyorRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopPurveyorDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopPurveyorDto tbShopPurveyor : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺Id", tbShopPurveyor.getShopId());
map.put("排序", tbShopPurveyor.getSort());
map.put("名称", tbShopPurveyor.getName());
map.put("联系人名字", tbShopPurveyor.getPurveyorName());
map.put("联系人电话", tbShopPurveyor.getPurveyorTelephone());
map.put("结算周期(日)", tbShopPurveyor.getPeriod());
map.put("供应商地址", tbShopPurveyor.getAddress());
map.put("标签", tbShopPurveyor.getTip());
map.put("备注", tbShopPurveyor.getRemark());
map.put(" createdAt", tbShopPurveyor.getCreatedAt());
map.put(" updatedAt", tbShopPurveyor.getUpdatedAt());
map.put("最后一次交易时间(主要做排序)", tbShopPurveyor.getLastTransactAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,216 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.repository.shop.TbShopPurveyorRepository;
import cn.ysk.cashier.pojo.shop.TbShopPurveyorTransact;
import cn.ysk.cashier.vo.PurveyorTransactVO;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopPurveyorTransactRepository;
import cn.ysk.cashier.service.shop.TbShopPurveyorTransactService;
import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactDto;
import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopPurveyorTransactMapper;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.QueryHelp;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.io.IOException;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-01-23
**/
@Service
@RequiredArgsConstructor
public class TbShopPurveyorTransactServiceImpl implements TbShopPurveyorTransactService {
private final TbShopPurveyorTransactRepository tbShopPurveyorTransactRepository;
private final TbShopPurveyorTransactMapper tbShopPurveyorTransactMapper;
private final TbShopPurveyorRepository tbShopPurveyorRepository;
private final String LEFTQUERYSQL="SELECT\n" +
"\ta.purveyor_name AS purveyorName,\n" +
"\tb.last_transact_at AS lastTransactAt,\n" +
"\tIFNULL( b.waitAmount, 0 ) AS waitAmount,\n" +
"\tIFNULL( b.waitCount, 0 ) AS waitCount,\n" +
"\ta.id AS purveyorId \n" +
"FROM\n" +
"\ttb_shop_purveyor a\n" +
"\tLEFT JOIN (\n" +
"\tSELECT\n" +
"\t\tsum( a.wait_amount ) AS waitAmount,\n" +
"\t\tcount( a.id ) AS waitCount,\n" +
"\t\ta.purveyor_id AS id,\n" +
"\t\tb.purveyor_name,\n" +
"\t\tb.last_transact_at \n" +
"\tFROM\n" +
"\t\ttb_shop_purveyor_transact a\n" +
"\t\tLEFT JOIN tb_shop_purveyor b ON a.purveyor_id = b.id \n" +
"\tWHERE " +
"a.`status` = 0 ";
private final String RIGHTQUERYSQL = " GROUP BY\n" +
"\t\tb.id \n" +
"\t) b ON a.id = b.id\n" +
"WHERE 1=1";
@PersistenceContext
private EntityManager em;
@Override
public Map<String, Object> queryPurveyorTransact(TbShopPurveyorTransactQueryCriteria criteria) {
Sort sort = Sort.by(Sort.Direction.DESC, "id");
Pageable pageable = PageRequest.of(criteria.getPage(), criteria.getSize(), sort);
Page<TbShopPurveyorTransact> pageShopPurveyor = tbShopPurveyorTransactRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
Map<String, Object> map = new HashMap<>();
map.put("content",pageShopPurveyor.getContent());
map.put("totalElements",pageShopPurveyor.getTotalElements());
return map;
}
@Override
public Map<String, Object> queryTransactDate(TbShopPurveyorTransactQueryCriteria criteria, Pageable pageable){
// 构建动态SQL语句
StringBuilder sqlQuery = new StringBuilder(LEFTQUERYSQL);
sqlQuery.append(" and b.shop_id=").append(criteria.getShopId()).append(" AND a.type=").append("'purveyor'").append(RIGHTQUERYSQL);
//没有条件时
if (criteria.getStatus() == null && "".equals(criteria.getPurveyorName())){
sqlQuery.append(" AND a.shop_id = ").append(criteria.getShopId());
}
//付款状态
if (criteria.getStatus() != null) {
sqlQuery.append(" AND a.id IN (SELECT purveyor_id FROM tb_shop_purveyor_transact WHERE shop_id AND `status` = ").append(criteria.getStatus())
.append(" GROUP BY purveyor_id)");
}
//供应商名字
if (criteria.getPurveyorName() != null && !"".equals(criteria.getPurveyorName())) {
sqlQuery.append(" AND a.purveyor_name LIKE '").append(criteria.getPurveyorName()).append("%'");
}
//获取页码号
int pageNum = pageable.getPageNumber();
//获取每页大小
int pageSize = pageable.getPageSize();
int beginNo;
if(pageNum <=0){
beginNo = 0;
}else{
beginNo = (pageNum - 1) * pageSize;
}
sqlQuery.append(" LIMIT ").append(beginNo).append(",").append(pageSize);
Query query = em.createNativeQuery(String.valueOf(sqlQuery));
List<Object[]> resultList = query.getResultList();
List<PurveyorTransactVO> userVOs = new ArrayList<>();
for (Object[] result : resultList) {
PurveyorTransactVO purveyorTransactVO = new PurveyorTransactVO();
purveyorTransactVO.setLastTransactAt((BigInteger) result[1]);
purveyorTransactVO.setPurveyorId((Integer) result[4]);
purveyorTransactVO.setPurveyorName((String) result[0]);
purveyorTransactVO.setWaitAmount((BigDecimal) result[2]);
purveyorTransactVO.setWaitCount((BigInteger) result[3]);
purveyorTransactVO.setType(purveyorTransactVO.getWaitCount().intValue()<1?1:0);
userVOs.add(purveyorTransactVO);
}
Integer byCount = tbShopPurveyorRepository.findByCount(criteria.getShopId());
Map<String, Object> map = new HashMap<>();
map.put("content",userVOs);
map.put("totalElements",byCount);
return map;
}
@Override
public Map<String, Object> queryTransactSum(TbShopPurveyorTransactQueryCriteria criteria) {
Map<String, Object> bySum = tbShopPurveyorTransactRepository.findBySum(criteria.getPurveyorId(), criteria.getType());
Map<String, Object> byStatusSum = tbShopPurveyorTransactRepository.findByStatusSum(criteria.getPurveyorId(), criteria.getType(), 0);
Map<String, Object> sumMap = new HashMap<>(bySum);
sumMap.put("waitNumber",byStatusSum.get("waitNumber"));
return sumMap;
}
@Override
public List<TbShopPurveyorTransactDto> queryAll(TbShopPurveyorTransactQueryCriteria criteria){
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransactRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopPurveyorTransactDto findById(Integer id) {
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(id).orElseGet(TbShopPurveyorTransact::new);
ValidationUtil.isNull(tbShopPurveyorTransact.getId(),"TbShopPurveyorTransact","id",id);
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransact);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopPurveyorTransactDto create(TbShopPurveyorTransact resources) {
return tbShopPurveyorTransactMapper.toDto(tbShopPurveyorTransactRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopPurveyorTransact resources) {
TbShopPurveyorTransact tbShopPurveyorTransact = tbShopPurveyorTransactRepository.findById(resources.getId()).orElseGet(TbShopPurveyorTransact::new);
ValidationUtil.isNull( tbShopPurveyorTransact.getId(),"TbShopPurveyorTransact","id",resources.getId());
tbShopPurveyorTransact.copy(resources);
tbShopPurveyorTransactRepository.save(tbShopPurveyorTransact);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopPurveyorTransactRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopPurveyorTransactDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopPurveyorTransactDto tbShopPurveyorTransact : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("店铺Id", tbShopPurveyorTransact.getShopId());
map.put("供应商名字", tbShopPurveyorTransact.getPurveyorName());
map.put("供应商Id", tbShopPurveyorTransact.getPurveyorId());
map.put("0待付款1已付款 -1是否作废", tbShopPurveyorTransact.getStatus());
map.put("备注", tbShopPurveyorTransact.getRemark());
map.put(" createdAt", tbShopPurveyorTransact.getCreatedAt());
map.put(" updatedAt", tbShopPurveyorTransact.getUpdatedAt());
map.put("应付金额", tbShopPurveyorTransact.getTotalAmount());
map.put("待付款金额", tbShopPurveyorTransact.getWaitAmount());
map.put("已支付金额", tbShopPurveyorTransact.getPaidAmount());
map.put(" paidAt", tbShopPurveyorTransact.getPaidAt());
map.put(" type", tbShopPurveyorTransact.getType());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,151 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.pojo.shop.TbShopTable;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopTableRepository;
import cn.ysk.cashier.service.shop.TbShopTableService;
import cn.ysk.cashier.dto.shop.TbShopTableDto;
import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopTableMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
import java.util.*;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-01-18
**/
@Service
@RequiredArgsConstructor
public class TbShopTableServiceImpl implements TbShopTableService {
private final TbShopTableRepository tbShopTableRepository;
private final TbShopTableMapper tbShopTableMapper;
/**
*桌码前缀
*/
private final String QRCODE = "https://kysh.sxczgkj.cn/codeplate?code=";
@Override
public Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable){
if (criteria.getAreaId() == 0){
criteria.setAreaId(null);
}
Page<TbShopTable> page = tbShopTableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
for (TbShopTable date : page.getContent()) {
if (!"".equals(date.getQrcode())){
date.setQrcode(QRCODE+date.getQrcode().trim());
}
}
HashMap<String, Object> map = new HashMap<>();
map.put("content",page.getContent());
map.put("totalElements",page.getTotalElements());
return map;
}
@Override
public List<TbShopTableDto> queryAll(TbShopTableQueryCriteria criteria){
return tbShopTableMapper.toDto(tbShopTableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopTableDto findById(Integer id) {
TbShopTable tbShopTable = tbShopTableRepository.findById(id).orElseGet(TbShopTable::new);
ValidationUtil.isNull(tbShopTable.getId(),"TbShopTable","id",id);
return tbShopTableMapper.toDto(tbShopTable);
}
@Override
public void binding(TbShopTable resources) {
//判是否绑定过
TbShopTable byQrcode = tbShopTableRepository.findByQrcode(resources.getQrcode());
if (byQrcode != null){
throw new BadRequestException("已绑定");
}
TbShopTable tbShopTable = tbShopTableRepository.findById(resources.getId()).orElseGet(TbShopTable::new);
if (tbShopTable.getId() == null){
throw new BadRequestException("找不到台桌");
}
ValidationUtil.isNull( tbShopTable.getId(),"TbShopTable","id",resources.getId());
tbShopTable.copy(resources);
tbShopTableRepository.save(tbShopTable);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopTable create(TbShopTable resources) {
resources.setCreatedAt(Instant.now().toEpochMilli());
resources.setUpdatedAt(Instant.now().toEpochMilli());
resources.setQrcode("");
return tbShopTableRepository.save(resources);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopTable resources) {
TbShopTable tbShopTable = tbShopTableRepository.findById(resources.getId()).orElseGet(TbShopTable::new);
ValidationUtil.isNull( tbShopTable.getId(),"TbShopTable","id",resources.getId());
tbShopTable.copy(resources);
tbShopTableRepository.save(tbShopTable);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopTableRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopTableDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopTableDto tbShopTable : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put(" name", tbShopTable.getName());
map.put(" shopId", tbShopTable.getShopId());
map.put("客座数,允许的客座数量", tbShopTable.getMaxCapacity());
map.put("台桌排序", tbShopTable.getSort());
map.put("区域Id", tbShopTable.getAreaId());
map.put("是否接受网络预定", tbShopTable.getIsPredate());
map.put("网络预定台桌支付金额", tbShopTable.getPredateAmount());
map.put("subscribe预定closed--关台, opening 开台中cleaning 台桌清理中", tbShopTable.getStatus());
map.put("台桌计算价格类型0-低消类型amount 2计时类型", tbShopTable.getType());
map.put("当type=0时amount生效,为台桌的低消金额", tbShopTable.getAmount());
map.put("当type=2时perhour生效为计时类型,每小时收款金额", tbShopTable.getPerhour());
map.put("台桌展示图---预留", tbShopTable.getView());
map.put(" createdAt", tbShopTable.getCreatedAt());
map.put(" updatedAt", tbShopTable.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,131 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.exception.NewBadRequestException;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopUnitRepository;
import cn.ysk.cashier.service.shop.TbShopUnitService;
import cn.ysk.cashier.dto.shop.TbShopUnitDto;
import cn.ysk.cashier.dto.shop.TbShopUnitQueryCriteria;
import cn.ysk.cashier.mapper.shop.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 cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.utils.QueryHelp;
import java.time.Instant;
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-02
**/
@Service
@RequiredArgsConstructor
public class TbShopUnitServiceImpl implements TbShopUnitService {
private final TbShopUnitRepository tbShopUnitRepository;
private final TbShopUnitMapper tbShopUnitMapper;
@Override
public Map<String,Object> queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable){
Page<TbShopUnit> page = tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopUnitMapper::toDto));
}
@Override
public List<TbShopUnitDto> queryAll(TbShopUnitQueryCriteria criteria){
return tbShopUnitMapper.toDto(tbShopUnitRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopUnitDto findById(Integer id) {
TbShopUnit tbShopUnit = tbShopUnitRepository.findById(id).orElseGet(TbShopUnit::new);
ValidationUtil.isNull(tbShopUnit.getId(),"TbShopUnit","id",id);
return tbShopUnitMapper.toDto(tbShopUnit);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopUnitDto create(TbShopUnit resources){
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) {
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);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopUnitRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopUnitDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopUnitDto tbShopUnit : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("单位名称", tbShopUnit.getName());
map.put("小数位个数大于0表示小数据精度位数", tbShopUnit.getDecimalsDigits());
map.put("单位类型(weight代表重量小数单位为number代表个数)", tbShopUnit.getUnitType());
map.put("0后台添加 -1系统默认 (公斤、瓶)", tbShopUnit.getIsSystem());
map.put("预留字段1-正常", tbShopUnit.getStatus());
map.put(" merchantId", tbShopUnit.getMerchantId());
map.put("店铺Id", tbShopUnit.getShopId());
map.put(" createdAt", tbShopUnit.getCreatedAt());
map.put(" updatedAt", tbShopUnit.getUpdatedAt());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -0,0 +1,130 @@
/*
* 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.service.impl.shopimpl;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.utils.FileUtil;
import lombok.RequiredArgsConstructor;
import cn.ysk.cashier.repository.shop.TbShopUserRepository;
import cn.ysk.cashier.service.shop.TbShopUserService;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import cn.ysk.cashier.utils.PageUtil;
import cn.ysk.cashier.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-03-01
**/
@Service
@RequiredArgsConstructor
public class TbShopUserServiceImpl implements TbShopUserService {
private final TbShopUserRepository tbShopUserRepository;
private final TbShopUserMapper tbShopUserMapper;
@Override
public Map<String,Object> queryAll(TbShopUserQueryCriteria criteria, Pageable pageable){
Page<TbShopUser> page = tbShopUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable);
return PageUtil.toPage(page.map(tbShopUserMapper::toDto));
}
@Override
public List<TbShopUserDto> queryAll(TbShopUserQueryCriteria criteria){
return tbShopUserMapper.toDto(tbShopUserRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
}
@Override
@Transactional
public TbShopUserDto findById(Integer id) {
TbShopUser tbShopUser = tbShopUserRepository.findById(id).orElseGet(TbShopUser::new);
ValidationUtil.isNull(tbShopUser.getId(),"TbShopUser","id",id);
return tbShopUserMapper.toDto(tbShopUser);
}
@Override
@Transactional(rollbackFor = Exception.class)
public TbShopUserDto create(TbShopUser resources) {
return tbShopUserMapper.toDto(tbShopUserRepository.save(resources));
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(TbShopUser resources) {
TbShopUser tbShopUser = tbShopUserRepository.findById(resources.getId()).orElseGet(TbShopUser::new);
ValidationUtil.isNull( tbShopUser.getId(),"TbShopUser","id",resources.getId());
tbShopUser.copy(resources);
tbShopUserRepository.save(tbShopUser);
}
@Override
public void deleteAll(Integer[] ids) {
for (Integer id : ids) {
tbShopUserRepository.deleteById(id);
}
}
@Override
public void download(List<TbShopUserDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (TbShopUserDto tbShopUser : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("钱包余额", tbShopUser.getAmount());
map.put("授权金额", tbShopUser.getCreditAmount());
map.put("消费累计", tbShopUser.getConsumeAmount());
map.put("消费数量累计", tbShopUser.getConsumeNumber());
map.put("等级积分", tbShopUser.getLevelConsume());
map.put("0-不可使用 1可使用", tbShopUser.getStatus());
map.put("代理Id", tbShopUser.getMerchantId());
map.put("店铺Id", tbShopUser.getShopId());
map.put("用户Id", tbShopUser.getUserId());
map.put("上级Id", tbShopUser.getParentId());
map.put("上级的层级", tbShopUser.getParentLevel());
map.put("真实名字", tbShopUser.getName());
map.put(" headImg", tbShopUser.getHeadImg());
map.put("性别", tbShopUser.getSex());
map.put("生日", tbShopUser.getBirthDay());
map.put("联系电话", tbShopUser.getTelephone());
map.put("是否会员,", tbShopUser.getIsVip());
map.put("会员编号", tbShopUser.getCode());
map.put("是否通过关注而成为会员的,此字段固定后不改", tbShopUser.getIsAttention());
map.put("关注时间", tbShopUser.getAttentionAt());
map.put("是否股东(分销商)", tbShopUser.getIsShareholder());
map.put("层级1-顶级 2-次级 3最低", tbShopUser.getLevel());
map.put("分销类型 auto-自动获取 set手动设置 charge充值", tbShopUser.getDistributeType());
map.put("排序", tbShopUser.getSort());
map.put(" createdAt", tbShopUser.getCreatedAt());
map.put(" updatedAt", tbShopUser.getUpdatedAt());
map.put("小程序openId", tbShopUser.getMiniOpenId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@@ -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 cn.ysk.cashier.service.order;
import cn.ysk.cashier.pojo.order.TbCashierCart;
import cn.ysk.cashier.dto.order.TbCashierCartDto;
import cn.ysk.cashier.dto.order.TbCashierCartQueryCriteria;
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-03-02
**/
public interface TbCashierCartService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbCashierCartQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbCashierCartDto>
*/
List<TbCashierCartDto> queryAll(TbCashierCartQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbCashierCartDto
*/
TbCashierCartDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbCashierCartDto
*/
TbCashierCartDto create(TbCashierCart resources);
/**
* 编辑
* @param resources /
*/
void update(TbCashierCart resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbCashierCartDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.order;
import cn.ysk.cashier.pojo.order.TbOrderDetail;
import cn.ysk.cashier.dto.order.TbOrderDetailDto;
import cn.ysk.cashier.dto.order.TbOrderDetailQueryCriteria;
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-03-02
**/
public interface TbOrderDetailService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbOrderDetailQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbOrderDetailDto>
*/
List<TbOrderDetailDto> queryAll(TbOrderDetailQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbOrderDetailDto
*/
TbOrderDetailDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbOrderDetailDto
*/
TbOrderDetailDto create(TbOrderDetail resources);
/**
* 编辑
* @param resources /
*/
void update(TbOrderDetail resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbOrderDetailDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.order;
import cn.ysk.cashier.pojo.order.TbOrderInfo;
import cn.ysk.cashier.dto.order.TbOrderInfoDto;
import cn.ysk.cashier.dto.order.TbOrderInfoQueryCriteria;
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-03-02
**/
public interface TbOrderInfoService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbOrderInfoQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbOrderInfoDto>
*/
List<TbOrderInfoDto> queryAll(TbOrderInfoQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbOrderInfoDto
*/
TbOrderInfoDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbOrderInfoDto
*/
TbOrderInfoDto create(TbOrderInfo resources);
/**
* 编辑
* @param resources /
*/
void update(TbOrderInfo resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,91 @@
/*
* 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.service.product;
import cn.ysk.cashier.pojo.product.TbProduct;
import cn.ysk.cashier.pojo.product.TbProductGroup;
import cn.ysk.cashier.dto.product.TbProductGroupDto;
import cn.ysk.cashier.dto.product.TbProductGroupQueryCriteria;
import cn.ysk.cashier.vo.AddProduct;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
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 2023-12-16
**/
public interface TbProductGroupService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbProductGroupQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductGroupDto>
*/
List<TbProductGroupDto> queryAll(TbProductGroupQueryCriteria criteria);
List<TbProduct> findByIdProduct(Integer productGroup);
/**
* 根据ID查询
* @param id ID
* @return TbProductGroupDto
*/
TbProductGroupDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbProductGroupDto
*/
TbProductGroupDto create(TbProductGroup resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductGroup resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductGroupDto> all, HttpServletResponse response) throws IOException;
ResponseEntity<Object> updateProductIds(AddProduct addProduct, String userName);
}

View File

@@ -0,0 +1,89 @@
/*
* 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.service.product;
import cn.ysk.cashier.pojo.product.TbProduct;
import cn.ysk.cashier.vo.TbProductVo;
import cn.ysk.cashier.dto.product.TbProductDto;
import cn.ysk.cashier.dto.product.TbProductQueryCriteria;
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 2023-12-11
**/
public interface TbProductService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbProductQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductDto>
*/
List<TbProductDto> queryAll(TbProductQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbProductDto
*/
TbProductDto findById(Integer id);
TbProductVo findByProductId(Integer id)throws Exception;
List<TbProduct>findByProductList(List<String> productList);
/**
* 创建
* @param resources /
* @return TbProductDto
*/
Object create(TbProductVo resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductVo resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.product;
import cn.ysk.cashier.pojo.product.TbProductSkuResult;
import cn.ysk.cashier.dto.product.TbProductSkuResultDto;
import cn.ysk.cashier.dto.product.TbProductSkuResultQueryCriteria;
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-02-08
**/
public interface TbProductSkuResultService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbProductSkuResultQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductSkuResultDto>
*/
List<TbProductSkuResultDto> queryAll(TbProductSkuResultQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbProductSkuResultDto
*/
TbProductSkuResultDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbProductSkuResultDto
*/
TbProductSkuResultDto create(TbProductSkuResult resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductSkuResult resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductSkuResultDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.product;
import cn.ysk.cashier.pojo.product.TbProductSku;
import cn.ysk.cashier.dto.product.TbProductSkuQueryCriteria;
import cn.ysk.cashier.dto.product.TbProductSkuDto;
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-03
**/
public interface TbProductSkuService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbProductSkuQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductSkuDto>
*/
List<TbProductSkuDto> queryAll(TbProductSkuQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbProductSkuDto
*/
TbProductSkuDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbProductSkuDto
*/
TbProductSkuDto create(TbProductSku resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductSku resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductSkuDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,84 @@
/*
* 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.service.product;
import cn.ysk.cashier.dto.product.SpecDto;
import cn.ysk.cashier.dto.product.TbProductSpecDto;
import cn.ysk.cashier.dto.product.TbProductSpecQueryCriteria;
import cn.ysk.cashier.pojo.product.TbProductSpec;
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-03
**/
public interface TbProductSpecService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbProductSpecQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductSpecDto>
*/
List<TbProductSpecDto> queryAll(TbProductSpecQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbProductSpecDto
*/
TbProductSpecDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbProductSpecDto
*/
TbProductSpecDto create(SpecDto resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductSpec resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductSpecDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,89 @@
/*
* 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.service.product;
import cn.ysk.cashier.pojo.product.TbProductStockDetail;
import cn.ysk.cashier.dto.product.TbProductStockDetailDto;
import cn.ysk.cashier.dto.product.TbProductStockDetailQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.math.BigDecimal;
import java.util.HashMap;
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-19
**/
public interface TbProductStockDetailService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbProductStockDetailQueryCriteria criteria, Pageable pageable);
Map<String,Object> queryPage(TbProductStockDetailQueryCriteria criteria);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbProductStockDetailDto>
*/
List<TbProductStockDetailDto> queryAll(TbProductStockDetailQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbProductStockDetailDto
*/
TbProductStockDetailDto findById(Long id);
HashMap<String, BigDecimal> sumStockNumber(String productId);
/**
* 创建
* @param resources /
* @return TbProductStockDetailDto
*/
TbProductStockDetailDto create(TbProductStockDetail resources);
/**
* 编辑
* @param resources /
*/
void update(TbProductStockDetail resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbProductStockDetailDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.product;
import cn.ysk.cashier.pojo.product.TbShopCategory;
import cn.ysk.cashier.dto.product.TbShopCategoryDto;
import cn.ysk.cashier.dto.product.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
*/
TbShopCategory 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;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbMerchantAccount;
import cn.ysk.cashier.dto.shop.TbMerchantAccountDto;
import cn.ysk.cashier.dto.shop.TbMerchantAccountQueryCriteria;
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-02-08
**/
public interface TbMerchantAccountService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbMerchantAccountQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbMerchantAccountDto>
*/
List<TbMerchantAccountDto> queryAll(TbMerchantAccountQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbMerchantAccountDto
*/
TbMerchantAccountDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbMerchantAccountDto
*/
TbMerchantAccountDto create(TbMerchantAccount resources);
/**
* 编辑
* @param resources /
*/
void update(TbMerchantAccount resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbMerchantAccountDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbMerchantRegister;
import cn.ysk.cashier.dto.shop.TbMerchantRegisterDto;
import cn.ysk.cashier.dto.shop.TbMerchantRegisterQueryCriteria;
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-02-23
**/
public interface TbMerchantRegisterService {
/**
* 查询数据分页
* @param criteria 条件
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbMerchantRegisterQueryCriteria criteria);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbMerchantRegisterDto>
*/
// List<TbMerchantRegisterDto> queryAll(TbMerchantRegisterQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbMerchantRegisterDto
*/
TbMerchantRegisterDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbMerchantRegisterDto
*/
TbMerchantRegisterDto create(TbMerchantRegisterDto resources);
/**
* 编辑
* @param resources /
*/
void update(TbMerchantRegister resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbMerchantRegisterDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,86 @@
/*
* 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.service.shop;
import cn.ysk.cashier.pojo.shop.TbMerchantThirdApply;
import cn.ysk.cashier.dto.shop.TbMerchantThirdApplyDto;
import cn.ysk.cashier.dto.shop.TbMerchantThirdApplyQueryCriteria;
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-02-02
**/
public interface TbMerchantThirdApplyService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbMerchantThirdApplyQueryCriteria criteria, Pageable pageable);
TbMerchantThirdApplyDto findByShopId(Integer shopId);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbMerchantThirdApplyDto>
*/
List<TbMerchantThirdApplyDto> queryAll(TbMerchantThirdApplyQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbMerchantThirdApplyDto
*/
TbMerchantThirdApplyDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbMerchantThirdApplyDto
*/
TbMerchantThirdApplyDto create(TbMerchantThirdApply resources);
/**
* 编辑
* @param resources /
*/
void update(TbMerchantThirdApply resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbMerchantThirdApplyDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbPlussShopStaff;
import cn.ysk.cashier.dto.shop.TbPlussShopStaffDto;
import cn.ysk.cashier.dto.shop.TbPlussShopStaffQueryCriteria;
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-03-01
**/
public interface TbPlussShopStaffService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbPlussShopStaffQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbPlussShopStaffDto>
*/
List<TbPlussShopStaffDto> queryAll(TbPlussShopStaffQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbPlussShopStaffDto
*/
TbPlussShopStaffDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbPlussShopStaffDto
*/
TbPlussShopStaffDto create(TbPlussShopStaff resources);
/**
* 编辑
* @param resources /
*/
void update(TbPlussShopStaff resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbPlussShopStaffDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,85 @@
/*
* 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.service.shop;
import cn.ysk.cashier.controller.shop.TbPrintMachine;
import cn.ysk.cashier.dto.shop.PrintMachineDto;
import cn.ysk.cashier.dto.shop.TbPrintMachineDto;
import cn.ysk.cashier.dto.shop.TbPrintMachineQueryCriteria;
import cn.ysk.cashier.vo.TbPrintMachineVO;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
* @website https://eladmin.vip
* @description 服务接口
* @author lyf
* @date 2024-02-28
**/
public interface TbPrintMachineService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
List<TbPrintMachineVO> queryAll(TbPrintMachineQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbPrintMachineDto>
*/
// List<TbPrintMachineDto> queryAll(TbPrintMachineQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbPrintMachineDto
*/
TbPrintMachineVO findById(Integer id);
/**
* 创建
* @param resources /
* @return TbPrintMachineDto
*/
TbPrintMachine create(PrintMachineDto resources);
/**
* 编辑
* @param resources /
*/
void update(PrintMachineDto resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbPrintMachineDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbReceiptSales;
import cn.ysk.cashier.dto.shop.TbReceiptSalesDto;
import cn.ysk.cashier.dto.shop.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;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopArea;
import cn.ysk.cashier.dto.shop.TbShopAreaDto;
import cn.ysk.cashier.dto.shop.TbShopAreaQueryCriteria;
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-31
**/
public interface TbShopAreaService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopAreaQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopAreaDto>
*/
List<TbShopAreaDto> queryAll(TbShopAreaQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopAreaDto
*/
TbShopAreaDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopAreaDto
*/
TbShopAreaDto create(TbShopArea resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopArea resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopAreaDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,84 @@
/*
* 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.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopCashSpread;
import cn.ysk.cashier.dto.shop.TbShopCashSpreadDto;
import cn.ysk.cashier.dto.shop.TbShopCashSpreadQueryCriteria;
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-05
**/
public interface TbShopCashSpreadService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopCashSpreadQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopCashSpreadDto>
*/
List<TbShopCashSpreadDto> queryAll(TbShopCashSpreadQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopCashSpreadDto
*/
TbShopCashSpreadDto findById(String id);
TbShopCashSpread findByShopId(Integer id);
/**
* 创建
* @param resources /
* @return TbShopCashSpreadDto
*/
TbShopCashSpreadDto create(TbShopCashSpread resources);
/**
* 编辑
* @param resources /
*/
Integer update(TbShopCashSpread resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(String[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopCashSpreadDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,90 @@
/*
* 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.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopCurrency;
import cn.ysk.cashier.dto.shop.TbShopCurrencyDto;
import cn.ysk.cashier.dto.shop.TbShopCurrencyQueryCriteria;
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-05
**/
public interface TbShopCurrencyService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopCurrencyQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopCurrencyDto>
*/
List<TbShopCurrencyDto> queryAll(TbShopCurrencyQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopCurrencyDto
*/
TbShopCurrencyDto findById(Integer id);
/**
* 根据ID查询
* @param id ID
* @return TbShopCurrencyDto
*/
TbShopCurrency findByShopId(String id);
/**
* 创建
* @param resources /
* @return TbShopCurrencyDto
*/
TbShopCurrencyDto create(TbShopCurrency resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopCurrency resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopCurrencyDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,85 @@
/*
* 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.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopInfo;
import cn.ysk.cashier.dto.shop.TbShopInfoDto;
import cn.ysk.cashier.dto.shop.TbShopInfoQueryCriteria;
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 2023-11-07
**/
public interface TbShopInfoService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopInfoQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopInfoDto>
*/
List<TbShopInfoDto> queryAll(TbShopInfoQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopInfoDto
*/
TbShopInfoDto findById(Integer id);
TbShopInfo findByIdInfo(Integer id);
TbShopInfoDto finByAccount(String account);
/**
* 创建
* @param resources /
* @return TbShopInfoDto
*/
TbShopInfoDto create(TbShopInfoDto resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopInfo resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopInfoDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopPurveyor;
import cn.ysk.cashier.dto.shop.TbShopPurveyorDto;
import cn.ysk.cashier.dto.shop.TbShopPurveyorQueryCriteria;
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-22
**/
public interface TbShopPurveyorService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopPurveyorQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopPurveyorDto>
*/
List<TbShopPurveyorDto> queryAll(TbShopPurveyorQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopPurveyorDto
*/
TbShopPurveyorDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopPurveyorDto
*/
TbShopPurveyorDto create(TbShopPurveyor resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopPurveyor resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopPurveyorDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,85 @@
/*
* 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.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopPurveyorTransact;
import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactDto;
import cn.ysk.cashier.dto.shop.TbShopPurveyorTransactQueryCriteria;
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-23
**/
public interface TbShopPurveyorTransactService {
/**
* 查询数据分页
* @param criteria 条件
* @return Map<String,Object>
*/
Map<String,Object> queryPurveyorTransact(TbShopPurveyorTransactQueryCriteria criteria);
Map<String, Object> queryTransactDate(TbShopPurveyorTransactQueryCriteria criteria, Pageable pageable);
Map<String, Object> queryTransactSum(TbShopPurveyorTransactQueryCriteria criteria);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopPurveyorTransactDto>
*/
List<TbShopPurveyorTransactDto> queryAll(TbShopPurveyorTransactQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopPurveyorTransactDto
*/
TbShopPurveyorTransactDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopPurveyorTransactDto
*/
TbShopPurveyorTransactDto create(TbShopPurveyorTransact resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopPurveyorTransact resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopPurveyorTransactDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -0,0 +1,86 @@
/*
* 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.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopTable;
import cn.ysk.cashier.dto.shop.TbShopTableDto;
import cn.ysk.cashier.dto.shop.TbShopTableQueryCriteria;
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-18
**/
public interface TbShopTableService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopTableDto>
*/
List<TbShopTableDto> queryAll(TbShopTableQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopTableDto
*/
TbShopTableDto findById(Integer id);
void binding(TbShopTable resources);
/**
* 创建
*
* @param resources /
* @return TbShopTableDto
*/
TbShopTable create(TbShopTable resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopTable resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopTableDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopUnit;
import cn.ysk.cashier.dto.shop.TbShopUnitDto;
import cn.ysk.cashier.dto.shop.TbShopUnitQueryCriteria;
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-02
**/
public interface TbShopUnitService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopUnitQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopUnitDto>
*/
List<TbShopUnitDto> queryAll(TbShopUnitQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopUnitDto
*/
TbShopUnitDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopUnitDto
*/
TbShopUnitDto create(TbShopUnit resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopUnit resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopUnitDto> all, HttpServletResponse response) throws IOException;
}

View File

@@ -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 cn.ysk.cashier.service.shop;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
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-03-01
**/
public interface TbShopUserService {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(TbShopUserQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<TbShopUserDto>
*/
List<TbShopUserDto> queryAll(TbShopUserQueryCriteria criteria);
/**
* 根据ID查询
* @param id ID
* @return TbShopUserDto
*/
TbShopUserDto findById(Integer id);
/**
* 创建
* @param resources /
* @return TbShopUserDto
*/
TbShopUserDto create(TbShopUser resources);
/**
* 编辑
* @param resources /
*/
void update(TbShopUser resources);
/**
* 多选删除
* @param ids /
*/
void deleteAll(Integer[] ids);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<TbShopUserDto> all, HttpServletResponse response) throws IOException;
}