Merge branch 'refs/heads/dev'

This commit is contained in:
GYJ 2024-07-10 09:27:25 +08:00
commit 27c8cb1959
19 changed files with 784 additions and 20 deletions

View File

@ -71,4 +71,5 @@ public interface CacheKey {
* 商品库存
*/
String PRODUCT = "PRODUCT:";
String SONG_URL = "song:";
}

View File

@ -0,0 +1,115 @@
package cn.ysk.cashier.controller.shop;
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
import cn.ysk.cashier.dto.shop.TbShopSongOrderQueryCriteria;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.utils.CacheKey;
import cn.ysk.cashier.utils.RedisUtils;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
import cn.ysk.cashier.mybatis.service.TbShopSongOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* (TbShopSongOrder)表控制层
*
* @author ww
* @since 2024-07-08 09:24:23
*/
@RestController
@RequiredArgsConstructor
@Api(tags = "歌曲订单管理")
@RequestMapping("/api/tbShopSongOrder")
public class TbShopSongOrderController{
private final RedisUtils redisUtils;
/**
* 服务对象
*/
@Resource
private TbShopSongOrderService tbShopSongOrderService;
/**
* 分页查询所有数据
* @param tbShopSongOrder 查询实体
* @return 所有数据
*/
@GetMapping
@ApiOperation("获取歌曲列表 分页")
@AnonymousGetMapping
public ResponseEntity<Object> selectAll(TbShopSongOrderQueryCriteria tbShopSongOrder) {
String code = "";
if(redisUtils.hasKey(CacheKey.SONG_URL + tbShopSongOrder.getShopId())){
code = (String) redisUtils.get(CacheKey.SONG_URL + tbShopSongOrder.getShopId());
}
Map<String, Object> stringObjectMap = tbShopSongOrderService.queryAll(tbShopSongOrder);
stringObjectMap.put("songUrl",code);
return new ResponseEntity<>(stringObjectMap, HttpStatus.OK);
}
@PostMapping("createUrl")
@ApiOperation("更新歌手页地址")
@AnonymousPostMapping
public ResponseEntity<Object> createUrl(String shopId) {
String key = RandomStringUtils.randomAlphanumeric(8);
redisUtils.set(CacheKey.SONG_URL + shopId, key);
redisUtils.set(CacheKey.SONG_URL + key, shopId);
return new ResponseEntity<>(key,HttpStatus.OK);
}
/**
* 通过主键查询单条数据
*
* @param id 主键
* @return 单条数据
*/
@GetMapping("{id}")
@ApiOperation("订单详情")
public ResponseEntity<Object> selectOne(@PathVariable Serializable id) {
return new ResponseEntity<>(tbShopSongOrderService.getById(id),HttpStatus.OK);
}
/**
* 歌手页 歌曲列表
* @param key 有效key
* @return 所有数据
*/
@GetMapping("songs")
@AnonymousGetMapping
public ResponseEntity<Object> singerSongs(String key) {
String shopId="";
if (redisUtils.hasKey(CacheKey.SONG_URL + key)) {
shopId = (String)redisUtils.get(CacheKey.SONG_URL + key);
}else {
throw new BadRequestException("地址已失效,请重新获取地址。");
}
return new ResponseEntity<>(tbShopSongOrderService.singerSongs(Integer.valueOf(shopId)), HttpStatus.OK);
}
/**
* 下一首
* @param shopId 店铺Id
*/
@PostMapping("next")
@AnonymousPostMapping
public ResponseEntity<Object> next(@RequestBody Integer shopId) {
tbShopSongOrderService.next(shopId);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@ -2,6 +2,9 @@ package cn.ysk.cashier.controller.shop;
import cn.hutool.core.util.StrUtil;
import cn.ysk.cashier.annotation.AnonymousAccess;
import cn.ysk.cashier.annotation.rest.AnonymousGetMapping;
import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.exception.BadRequestException;
import cn.ysk.cashier.mybatis.service.TbMShopUserService;
@ -20,10 +23,10 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @website https://eladmin.vip
* @author lyf
* @date 2024-03-01
**/
* @author lyf
* @website https://eladmin.vip
* @date 2024-03-01
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "/shop/user管理")
@ -41,35 +44,35 @@ public class TbShopUserController {
@GetMapping
@ApiOperation("查询/shop/user")
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(tbShopUserService.queryAll(criteria,pageable),HttpStatus.OK);
public ResponseEntity<Object> queryTbShopUser(TbShopUserQueryCriteria criteria, Pageable pageable) {
return new ResponseEntity<>(tbShopUserService.queryAll(criteria, pageable), HttpStatus.OK);
}
@GetMapping("queryAllShopUser")
@ApiOperation("查询商家用户")
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria){
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria),HttpStatus.OK);
public ResponseEntity<Object> queryAllShopUser(TbShopUserQueryCriteria criteria) {
return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria), HttpStatus.OK);
}
@GetMapping("summary")
@ApiOperation("查询会员概述")
public ResponseEntity<Object> summary(TbShopUserQueryCriteria criteria){
public ResponseEntity<Object> summary(TbShopUserQueryCriteria criteria) {
if (StrUtil.isBlank(criteria.getShopId())) {
throw new BadRequestException("店铺id不为空");
}
return new ResponseEntity<>(tbMShopUserService.summary(criteria),HttpStatus.OK);
return new ResponseEntity<>(tbMShopUserService.summary(criteria), HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增/shop/user")
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources){
return new ResponseEntity<>(tbShopUserService.create(resources),HttpStatus.CREATED);
public ResponseEntity<Object> createTbShopUser(@Validated @RequestBody TbShopUser resources) {
return new ResponseEntity<>(tbShopUserService.create(resources), HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改/shop/user")
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources){
public ResponseEntity<Object> updateTbShopUser(@Validated @RequestBody TbShopUser resources) {
tbShopUserService.update(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ -80,4 +83,16 @@ public class TbShopUserController {
tbShopUserService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@GetMapping("/recharge")
@ApiOperation("充值记录")
public ResponseEntity<Object> rechargeList(TbShopRechargeListDto criteria, Pageable pageable) {
return new ResponseEntity<>(tbShopUserService.rechargeList(criteria, pageable), HttpStatus.OK);
}
@PostMapping("/recharge/download")
@ApiOperation("导出充值记录")
public void rechargeListDownload(HttpServletResponse response, @RequestBody TbShopRechargeListDto criteria) throws IOException {
tbShopUserService.rechargeListDownload(response, criteria);
}
}

View File

@ -0,0 +1,18 @@
package cn.ysk.cashier.dto.shop;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author GYJ
*/
@Data
public class TbShopRechargeListDto {
private String shopId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
}

View File

@ -0,0 +1,36 @@
package cn.ysk.cashier.dto.shop;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @author GYJ
*/
@Data
public class TbShopRechargeRespDto {
private Integer id;
private String shopId;
private String shopName;
private String userId;
private String userName;
private String userPhone;
private Object rechargeAmount;
private String rechargeType;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date rechargeTime;
public TbShopRechargeRespDto(Integer id, String shopId, String shopName, String userId, String userName, String userPhone,
String rechargeAmount, String rechargeType, Date rechargeTime) {
this.id = id;
this.shopId = shopId;
this.shopName = shopName;
this.userId = userId;
this.userName = userName;
this.userPhone = userPhone;
this.rechargeAmount = rechargeAmount;
this.rechargeType = rechargeType;
this.rechargeTime = rechargeTime;
}
}

View File

@ -0,0 +1,42 @@
package cn.ysk.cashier.dto.shop;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
@Data
public class TbShopSongOrderQueryCriteria {
private String shopId;
private String orderNo;
private String name;
private Integer state;
/**
* 从1开始
*/
private Long page = 1L;
/**
* 展示数量
*/
private Long size = 10L;
public void setShopId(String shopId) {
if (StringUtils.isNotBlank(shopId) && !shopId.equals("1")) {
this.shopId = shopId;
}
}
public void setOrderNo(String orderNo) {
if (StringUtils.isNotBlank(orderNo))
this.orderNo = orderNo;
}
public void setName(String name) {
if (StringUtils.isNotBlank(name))
this.name = name;
}
public void setState(Integer state) {
if (state!=null)
this.state = state;
}
}

View File

@ -0,0 +1,148 @@
package cn.ysk.cashier.mybatis.entity;
import java.util.Date;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.io.Serializable;
/**
* (TbShopSongOrder)表实体类
*
* @author ww
* @since 2024-07-08 09:24:27
*/
@SuppressWarnings("serial")
public class TbShopSongOrder extends Model<TbShopSongOrder> {
private Integer id;
//歌曲id
private Integer songId;
private Integer shopId;
//歌曲名称
private String songName;
//用户id
private Integer userId;
//支付金额
private Double payMoney;
//状态 -1 未支付 0 已取消 1 已支付 2 演唱中 3 已演唱
private Integer state;
//创建时间
private Date createTime;
//下单来源
private Integer clientType;
//订单编号
private String orderNo;
//点歌人
private String fromName;
//收歌人
private String toName;
//祝福语
private String note;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSongId() {
return songId;
}
public void setSongId(Integer songId) {
this.songId = songId;
}
public String getSongName() {
return songName;
}
public void setSongName(String songName) {
this.songName = songName;
}
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public Double getPayMoney() {
return payMoney;
}
public void setPayMoney(Double payMoney) {
this.payMoney = payMoney;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getClientType() {
return clientType;
}
public void setClientType(Integer clientType) {
this.clientType = clientType;
}
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getFromName() {
return fromName;
}
public void setFromName(String fromName) {
this.fromName = fromName;
}
public String getToName() {
return toName;
}
public void setToName(String toName) {
this.toName = toName;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
}

View File

@ -5,16 +5,22 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author GYJ
*/
@Entity
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("tb_shop_user_flow")
@Table(name="tb_shop_user_flow")
public class TbShopUserFlow extends Model<TbShopUserFlow> {
@Id
private Integer id;
private Integer shopUserId;

View File

@ -1,5 +1,7 @@
package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.vo.ShopUserInfoVo;
@ -30,5 +32,25 @@ public interface ShopUserMapper extends BaseMapper<TbShopUser> {
"</where>" +
"</script>")
IPage<ShopUserInfoVo> queryUser(TbShopUserQueryCriteria param, Page pageInfo);
@Select("<script> " +
"select " +
"tsuf.id as id, " +
"tsu.shop_id as shop_id, " +
"tsi.shop_name, " +
"tsu.id as user_id, " +
"tsu.telephone as user_phone, " +
"tsu.`name` as user_name, " +
"tsuf.amount as recharge_amount, " +
"tsuf.biz_name as recharge_type, " +
"tsuf.create_time as recharge_time " +
" from tb_shop_user_flow tsuf " +
" left join tb_shop_user as tsu on tsuf.shop_user_id = tsu.id " +
"left join tb_shop_info as tsi on tsi.id = tsu.shop_id " +
"where tsuf.create_time BETWEEN #{param.startTime} and #{param.endTime} and tsuf.biz_code in ('cashMemberIn', 'scanMemberIn') " +
" and tsu.shop_id = #{param.shopId} " +
"order by tsuf.create_time desc " +
"</script>")
IPage<TbShopRechargeRespDto> queryRechargeList(TbShopRechargeListDto param, Page pageInfo);
}

View File

@ -0,0 +1,47 @@
package cn.ysk.cashier.mybatis.mapper;
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
import cn.ysk.cashier.mybatis.vo.SingerSongVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
/**
* (TbShopSongOrder)表数据库访问层
*
* @author ww
* @since 2024-07-08 09:24:26
*/
public interface TbShopSongOrderMapper extends BaseMapper<TbShopSongOrder> {
@Select("select " +
"song.img,song.name as songName,song.origin_singer as originSinger,orders.from_name as fromName," +
"orders.to_name as toName,orders.note " +
"from tb_shop_song_order orders " +
"left join tb_shop_song song on orders.song_id=song.id " +
"where state = #{state} and orders.shop_id=#{shopId} order by orders.create_time limit 12")
List<SingerSongVo> findByState(@Param("state") Integer state, @Param("shopId") Integer shopId);
@Update("update tb_shop_song_order set state=3 where state=2 and shop_id=#{shopId}")
int upState(@Param("shopId") Integer shopId);
@Update("update tb_shop_song_order " +
"set state = 2 " +
"where id = (" +
" select id " +
" from (" +
" select id " +
" from tb_shop_song_order " +
" where state = 1 and shop_id = #{shopId}" +
" order by create_time " +
" limit 1" +
" ) as subquery" +
")")
int setDuringSinging(@Param("shopId") Integer shopId);
}

View File

@ -0,0 +1,24 @@
package cn.ysk.cashier.mybatis.service;
import cn.ysk.cashier.dto.shop.TbShopSongOrderQueryCriteria;
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
import com.baomidou.mybatisplus.extension.service.IService;
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
import java.util.Map;
/**
* (TbShopSongOrder)表服务接口
*
* @author ww
* @since 2024-07-08 09:24:27
*/
public interface TbShopSongOrderService extends IService<TbShopSongOrder> {
Map<String,Object> queryAll(TbShopSongOrderQueryCriteria criteria);
Map<String,Object> singerSongs(Integer shopId);
void next(Integer shopId);
}

View File

@ -0,0 +1,80 @@
package cn.ysk.cashier.mybatis.service.impl;
import cn.ysk.cashier.dto.shop.TbShopSongOrderQueryCriteria;
import cn.ysk.cashier.dto.shop.TbShopSongQueryCriteria;
import cn.ysk.cashier.mybatis.entity.TbShopSong;
import cn.ysk.cashier.mybatis.mapper.TbShopSongMapper;
import cn.ysk.cashier.mybatis.vo.SingerSongVo;
import cn.ysk.cashier.utils.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ysk.cashier.mybatis.mapper.TbShopSongOrderMapper;
import cn.ysk.cashier.mybatis.entity.TbShopSongOrder;
import cn.ysk.cashier.mybatis.service.TbShopSongOrderService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* (TbShopSongOrder)表服务实现类
*
* @author ww
* @since 2024-07-08 09:24:27
*/
@Service("tbShopSongOrderService")
public class TbShopSongOrderServiceImpl extends ServiceImpl<TbShopSongOrderMapper, TbShopSongOrder> implements TbShopSongOrderService {
@Autowired
private TbShopSongOrderMapper tbShopSongOrderMapper;
@Override
public Map<String, Object> queryAll(TbShopSongOrderQueryCriteria criteria) {
Page<TbShopSongOrder> page = new Page<>(
criteria.getPage(),
criteria.getSize());
QueryWrapper<TbShopSongOrder> wrapper = new QueryWrapper<>();
if (StringUtils.isNotBlank(criteria.getShopId())) {
wrapper.eq("shop_id", criteria.getShopId());
}
if (StringUtils.isNotBlank(criteria.getOrderNo())) {
wrapper.eq("order_no", criteria.getOrderNo());
}
if (criteria.getState() != null) {
wrapper.eq("state", criteria.getState());
}
if (StringUtils.isNotBlank(criteria.getName())) {
wrapper.like("song_name", criteria.getName());
}
wrapper.orderByDesc("create_time");
Page<TbShopSongOrder> tbShopSongPage = tbShopSongOrderMapper.selectPage(page, wrapper);
return PageUtil.toPage(tbShopSongPage.getRecords(), tbShopSongPage.getTotal());
}
@Override
public Map<String, Object> singerSongs(Integer shopId) {
Map<String,Object> map = new LinkedHashMap<>(3);
map.put("shopId",shopId);
List<SingerSongVo> byState = tbShopSongOrderMapper.findByState(2, shopId);
if(CollectionUtils.isEmpty(byState)){
map.put("afoot","");//演唱中
}else {
map.put("afoot",byState.get(0));//演唱中
}
map.put("Waiting",tbShopSongOrderMapper.findByState(1,shopId));
return map;
}
@Override
@Transactional
public void next(Integer shopId) {
tbShopSongOrderMapper.upState(shopId);
tbShopSongOrderMapper.setDuringSinging(shopId);
}
}

View File

@ -0,0 +1,14 @@
package cn.ysk.cashier.mybatis.vo;
import lombok.Data;
@Data
public class SingerSongVo {
private String img;
private String songName;
private String originSinger;
private String fromName;
private String toName;
private String note;
}

View File

@ -16,10 +16,7 @@
package cn.ysk.cashier.repository.shop;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.vo.ShopUserInfoVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
@ -27,7 +24,6 @@ import org.springframework.data.jpa.repository.Query;
import javax.persistence.Tuple;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @website https://eladmin.vip
@ -48,6 +44,4 @@ public interface TbShopUserRepository extends JpaRepository<TbShopUser, Integer>
@Query("SELECT user.userId from TbShopUser user where user.shopId = :shopId")
List<Integer> getUserIdByShopId(String shopId);
}

View File

@ -126,6 +126,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
detail.setRefundNumber(detail.getNum());
});
}
orderInfoVo.setTableName(tbOrderInfo.getTableName());
orderInfoVo.setDetailList(details);
BeanUtils.copyProperties(tbOrderInfo, orderInfoVo);
orderInfoVo.setRefundAmount(refundAmount);
@ -188,6 +189,7 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
criteria.setOrderType(null);
}
}
List<TbOrderInfoDto> dto = tbOrderInfoMapper.toDto(tbOrderInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder)));
for (TbOrderInfoDto tbOrderInfo : dto) {
List<TbOrderDetail> details = tbOrderDetailRepository.searchDetailByOrderId(tbOrderInfo.getId());
@ -357,6 +359,8 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
@Override
public void download(List<TbOrderInfoDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
all=all.stream().sorted(Comparator.comparing(TbOrderInfoDto::getId).reversed()).collect(Collectors.toList());
for (TbOrderInfoDto tbOrderInfo : all) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("订单编号", tbOrderInfo.getOrderNo());

View File

@ -1,5 +1,8 @@
package cn.ysk.cashier.service.impl.shopimpl;
import cn.hutool.core.date.DateUtil;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import cn.ysk.cashier.mapper.shop.TbShopUserMapper;
@ -22,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.time.Instant;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
@ -47,7 +51,7 @@ public class TbShopUserServiceImpl implements TbShopUserService {
public Map<String, Object> queryShopUser(TbShopUserQueryCriteria criteria) {
IPage<ShopUserInfoVo> iPage = shopUserMapper.queryUser(criteria,
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()));
return PageUtil.toPlusPage(iPage.getRecords(),Integer.valueOf(iPage.getTotal()+""));
return PageUtil.toPlusPage(iPage.getRecords(), Integer.valueOf(iPage.getTotal() + ""));
}
@Override
@ -129,4 +133,34 @@ public class TbShopUserServiceImpl implements TbShopUserService {
FileUtil.downloadExcel(list, response);
}
@Override
public IPage<TbShopRechargeRespDto> rechargeList(TbShopRechargeListDto criteria, Pageable pageable) {
if (criteria.getStartTime() == null) {
criteria.setStartTime(DateUtil.parseDate("2024-01-01 00:00:00"));
}
if (criteria.getEndTime() == null) {
criteria.setEndTime(DateUtil.date(Instant.now()));
}
return shopUserMapper.queryRechargeList(criteria,
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageable == null ? 0 : pageable.getPageNumber(), pageable == null ? 1000000 : pageable.getPageSize()));
}
@Override
public void rechargeListDownload(HttpServletResponse response, TbShopRechargeListDto criteria) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
IPage<TbShopRechargeRespDto> page = rechargeList(criteria, null);
for (TbShopRechargeRespDto tbShopRechargeRespDto : page.getRecords()) {
Map<String, Object> map = new LinkedHashMap<>();
map.put("id", tbShopRechargeRespDto.getId());
map.put("门店", tbShopRechargeRespDto.getShopName());
map.put("用户手机号", tbShopRechargeRespDto.getUserPhone());
map.put("用户名", tbShopRechargeRespDto.getUserName());
map.put("充值金额", tbShopRechargeRespDto.getRechargeAmount());
map.put("充值类型", tbShopRechargeRespDto.getRechargeType());
map.put("充值时间", tbShopRechargeRespDto.getRechargeTime());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
}

View File

@ -1,8 +1,12 @@
package cn.ysk.cashier.service.shop;
import cn.ysk.cashier.dto.shop.TbShopRechargeListDto;
import cn.ysk.cashier.dto.shop.TbShopRechargeRespDto;
import cn.ysk.cashier.pojo.shop.TbShopUser;
import cn.ysk.cashier.dto.shop.TbShopUserDto;
import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import java.util.Map;
import java.util.List;
@ -75,4 +79,14 @@ public interface TbShopUserService {
*/
void download(List<TbShopUserDto> all, HttpServletResponse response) throws IOException;
/**
* 充值记录
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
IPage<TbShopRechargeRespDto> rechargeList(TbShopRechargeListDto criteria, Pageable pageable);
void rechargeListDownload(HttpServletResponse response, TbShopRechargeListDto criteria) throws IOException;
}

View File

@ -50,6 +50,8 @@ public class TbOrderInfoVo {
private String tableId;
private String tableName;
private BigDecimal smallChange;
private String sendType;

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ysk.cashier.mybatis.mapper.TbShopSongOrderMapper">
<resultMap type="cn.ysk.cashier.mybatis.entity.TbShopSongOrder" id="TbShopSongOrderMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="songId" column="song_id" jdbcType="INTEGER"/>
<result property="songName" column="song_name" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="payMoney" column="pay_money" jdbcType="NUMERIC"/>
<result property="state" column="state" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="clientType" column="client_type" jdbcType="INTEGER"/>
<result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
<result property="fromName" column="from_name" jdbcType="VARCHAR"/>
<result property="toName" column="to_name" jdbcType="VARCHAR"/>
<result property="note" column="note" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id
, song_id, song_name, user_id, pay_money, state, create_time, client_type, order_no, from_name, to_name, note </sql>
<!--查询单个-->
<select id="queryById" resultMap="TbShopSongOrderMap">
select
<include refid="Base_Column_List"/>
from tb_shop_song_order
where id = #{id}
</select>
<!--查询指定行数据-->
<select id="queryAll" resultMap="TbShopSongOrderMap">
select
<include refid="Base_Column_List"/>
from tb_shop_song_order
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="songId != null">
and song_id = #{songId}
</if>
<if test="songName != null and songName != ''">
and song_name = #{songName}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="payMoney != null">
and pay_money = #{payMoney}
</if>
<if test="state != null">
and state = #{state}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="clientType != null">
and client_type = #{clientType}
</if>
<if test="orderNo != null and orderNo != ''">
and order_no = #{orderNo}
</if>
<if test="fromName != null and fromName != ''">
and from_name = #{fromName}
</if>
<if test="toName != null and toName != ''">
and to_name = #{toName}
</if>
<if test="note != null and note != ''">
and note = #{note}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into tb_shop_song_order(song_id, song_name, user_id, pay_money, state, create_time, client_type,
order_no, from_name, to_name, note)
values (#{songId}, #{songName}, #{userId}, #{payMoney}, #{state}, #{createTime}, #{clientType}, #{orderNo},
#{fromName}, #{toName}, #{note})
</insert>
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into tb_shop_song_order(song_id, song_name, user_id, pay_money, state, create_time, client_type,
order_no, from_name, to_name, note)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.songId}, #{entity.songName}, #{entity.userId}, #{entity.payMoney}, #{entity.state},
#{entity.createTime}, #{entity.clientType}, #{entity.orderNo}, #{entity.fromName}, #{entity.toName},
#{entity.note})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update tb_shop_song_order
<set>
<if test="songId != null">
song_id = #{songId},
</if>
<if test="songName != null and songName != ''">
song_name = #{songName},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="payMoney != null">
pay_money = #{payMoney},
</if>
<if test="state != null">
state = #{state},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="clientType != null">
client_type = #{clientType},
</if>
<if test="orderNo != null and orderNo != ''">
order_no = #{orderNo},
</if>
<if test="fromName != null and fromName != ''">
from_name = #{fromName},
</if>
<if test="toName != null and toName != ''">
to_name = #{toName},
</if>
<if test="note != null and note != ''">
note = #{note},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete
from tb_shop_song_order
where id = #{id}
</delete>
</mapper>