公众号 视频号 商家用户管理 字典标识字段

This commit is contained in:
2024-04-13 15:13:30 +08:00
parent eedc6fe307
commit 78c37b2636
14 changed files with 190 additions and 57 deletions

View File

@@ -192,8 +192,8 @@ public class TbProductServiceImpl implements TbProductService {
TbProduct tbProduct = tbProductRepository.findById(id).orElseGet(TbProduct::new);
//单位
CompletableFuture<TbShopUnit> tbShopUnits = CompletableFuture.supplyAsync(() ->
tbShopUnitRepository.searchUnit(Integer.valueOf(StringUtils.isEmpty(tbProduct.getUnitId()) ? null : tbProduct.getUnitId())));
// CompletableFuture<TbShopUnit> tbShopUnits = CompletableFuture.supplyAsync(() ->
// tbShopUnitRepository.searchUnit(Integer.valueOf(StringUtils.isEmpty(tbProduct.getUnitId()) ? null : tbProduct.getUnitId())));
//sku
CompletableFuture<List<TbProductSku>> tbProductSkus = CompletableFuture.supplyAsync(() ->
tbProductSkuRepository.searchSku(tbProduct.getId().toString()));
@@ -201,15 +201,16 @@ public class TbProductServiceImpl implements TbProductService {
CompletableFuture<TbProductSpec> tbProductSpec = CompletableFuture.supplyAsync(() ->
tbProductSpecRepository.searchSpec(tbProduct.getSpecId()));
Threads.call(tbShopUnits, tbProductSkus, tbProductSpec);
// Threads.call(tbShopUnits, tbProductSkus, tbProductSpec);
Threads.call(tbProductSkus, tbProductSpec);
//组装
TbProductVo tbProductVo = new TbProductVo();
tbProductVo.setCategoryId(tbProduct.getCategoryId());
//单位
if (tbProduct.getUnitId() == null) {
tbProductVo.setUnitId(null);
tbProductVo.setUnitName(null);
}
// if (tbProduct.getUnitId() == null) {
// tbProductVo.setUnitId(null);
// tbProductVo.setUnitName(null);
// }
//套餐
if (tbProduct.getGroupSnap() == null) {
tbProductVo.setGroupSnap(new JSONArray());

View File

@@ -15,34 +15,36 @@
*/
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.pojo.shop.TbShopUser;
import cn.ysk.cashier.repository.shop.TbShopUserRepository;
import cn.ysk.cashier.service.shop.TbShopUserService;
import cn.ysk.cashier.utils.FileUtil;
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 cn.ysk.cashier.utils.ValidationUtil;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @website https://eladmin.vip
* @description 服务实现
* @author lyf
* @date 2024-03-01
**/
* @author lyf
* @website https://eladmin.vip
* @description 服务实现
* @date 2024-03-01
**/
@Service
@RequiredArgsConstructor
public class TbShopUserServiceImpl implements TbShopUserService {
@@ -51,21 +53,33 @@ public class TbShopUserServiceImpl implements TbShopUserService {
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);
public Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
Page<ShopUserInfoVo> shopUserJoinUserInfo =
tbShopUserRepository.findShopUserJoinUserInfo(
criteria.getShopId(),
criteria.getIsVip(),
criteria.getTelephone(),
pageable);
return PageUtil.toPage(shopUserJoinUserInfo);
}
@Override
public Map<String, Object> queryAll(TbShopUserQueryCriteria criteria, Pageable pageable) {
criteria.setIsVip(1);
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)));
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);
ValidationUtil.isNull(tbShopUser.getId(), "TbShopUser", "id", id);
return tbShopUserMapper.toDto(tbShopUser);
}
@@ -79,7 +93,7 @@ public class TbShopUserServiceImpl implements TbShopUserService {
@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());
ValidationUtil.isNull(tbShopUser.getId(), "TbShopUser", "id", resources.getId());
tbShopUser.copy(resources);
tbShopUserRepository.save(tbShopUser);
}
@@ -95,7 +109,7 @@ public class TbShopUserServiceImpl implements TbShopUserService {
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<String, Object> map = new LinkedHashMap<>();
map.put("钱包余额", tbShopUser.getAmount());
map.put("授权金额", tbShopUser.getCreditAmount());
map.put("消费累计", tbShopUser.getConsumeAmount());
@@ -108,7 +122,7 @@ public class TbShopUserServiceImpl implements TbShopUserService {
map.put("上级Id", tbShopUser.getParentId());
map.put("上级的层级", tbShopUser.getParentLevel());
map.put("真实名字", tbShopUser.getName());
map.put(" headImg", tbShopUser.getHeadImg());
map.put(" headImg", tbShopUser.getHeadImg());
map.put("性别", tbShopUser.getSex());
map.put("生日", tbShopUser.getBirthDay());
map.put("联系电话", tbShopUser.getTelephone());
@@ -120,8 +134,8 @@ public class TbShopUserServiceImpl implements TbShopUserService {
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(" createdAt", tbShopUser.getCreatedAt());
map.put(" updatedAt", tbShopUser.getUpdatedAt());
map.put("小程序openId", tbShopUser.getMiniOpenId());
list.add(map);
}

View File

@@ -32,8 +32,17 @@ import javax.servlet.http.HttpServletResponse;
**/
public interface TbShopUserService {
/**
* 查询数据分页
* 商家后台 用户管理
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String, Object> queryAllShopUser(TbShopUserQueryCriteria criteria, Pageable pageable);
/**
* 会员管理
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>