邀请记录

This commit is contained in:
2024-11-08 11:42:12 +08:00
parent ac09705e8c
commit 19202f5881
7 changed files with 69 additions and 119 deletions

View File

@@ -45,7 +45,6 @@ public class LoginFilter implements Filter {
"cashierService/home",//首页
"cashierService/order/testMessage",//首页
"cashierService/common/**",//通用接口
"cashierService/tbShopShare/**",//通用接口
"cashierService/distirict/**",//首页其它接口
// "cashierService/login/**",//登录部分接口不校验

View File

@@ -1,10 +1,12 @@
package com.chaozhanggui.system.cashierservice.dao;
import com.chaozhanggui.system.cashierservice.entity.TbShopShareRecord;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* (TbShopShareRecord)表数据库访问层
@@ -37,6 +39,10 @@ public interface TbShopShareRecordMapper {
* @return 对象列表
*/
List<TbShopShareRecord> query(TbShopShareRecord tbShopShareRecord);
Map<String,Object> statisticsRecord(TbShopShareRecord tbShopShareRecord);
List<TbShopShareRecord> queryIsSuccess(TbShopShareRecord tbShopShareRecord);
List<TbShopShareRecord> queryIsNoSuccess(TbShopShareRecord tbShopShareRecord);
/**

View File

@@ -1,5 +1,8 @@
package com.chaozhanggui.system.cashierservice.entity;
import com.chaozhanggui.system.cashierservice.entity.dto.BasePageDto;
import lombok.Data;
import java.util.Date;
import java.io.Serializable;
@@ -9,7 +12,8 @@ import java.io.Serializable;
* @author ww
* @since 2024-11-07 15:50:04
*/
public class TbShopShareRecord implements Serializable {
@Data
public class TbShopShareRecord extends BasePageDto implements Serializable {
private static final long serialVersionUID = -41620929736900271L;
private Integer id;
@@ -45,6 +49,7 @@ public class TbShopShareRecord implements Serializable {
* 1 未领取 2 已领取 3 已使用
*/
private Integer status;
private boolean isSuccess = true;
/**
* 生效时间/获得奖励的时间
*/
@@ -53,104 +58,5 @@ public class TbShopShareRecord implements Serializable {
private Date createTime;
private Date updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getShareId() {
return shareId;
}
public void setShareId(Integer shareId) {
this.shareId = shareId;
}
public Integer getShopId() {
return shopId;
}
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
public Integer getInvitedId() {
return invitedId;
}
public void setInvitedId(Integer invitedId) {
this.invitedId = invitedId;
}
public String getInvitedName() {
return invitedName;
}
public void setInvitedName(String invitedName) {
this.invitedName = invitedName;
}
public Integer getBeInvitedId() {
return beInvitedId;
}
public void setBeInvitedId(Integer beInvitedId) {
this.beInvitedId = beInvitedId;
}
public String getBeInvitedName() {
return beInvitedName;
}
public void setBeInvitedName(String beInvitedName) {
this.beInvitedName = beInvitedName;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Date getRewardTime() {
return rewardTime;
}
public void setRewardTime(Date rewardTime) {
this.rewardTime = rewardTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@@ -1,11 +0,0 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import lombok.Data;
@Data
public class UserCouponDto extends BasePageDto{
private Integer userId;
private Integer status;
private Integer shopId;
}

View File

@@ -6,6 +6,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import java.util.List;
import java.util.Map;
/**
* (TbShopShareRecord)表服务接口
@@ -29,7 +30,7 @@ public interface TbShopShareRecordService {
* @param tbShopShareRecord 筛选条件
* @return 查询结果
*/
List<TbShopShareRecord> query(TbShopShareRecord tbShopShareRecord);
Map query(TbShopShareRecord tbShopShareRecord);
Result receive(TbShopShareRecord tbShopShareRecord);

View File

@@ -7,7 +7,10 @@ import cn.hutool.core.util.RandomUtil;
import com.chaozhanggui.system.cashierservice.dao.*;
import com.chaozhanggui.system.cashierservice.entity.*;
import com.chaozhanggui.system.cashierservice.service.TbShopShareRecordService;
import com.chaozhanggui.system.cashierservice.sign.CodeEnum;
import com.chaozhanggui.system.cashierservice.sign.Result;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
@@ -17,9 +20,7 @@ import org.springframework.data.domain.PageRequest;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
* (TbShopShareRecord)表服务实现类
@@ -63,12 +64,21 @@ public class TbShopShareRecordServiceImpl implements TbShopShareRecordService {
* @return 查询结果
*/
@Override
public List<TbShopShareRecord> query(TbShopShareRecord tbShopShareRecord) {
List<TbShopShareRecord> records = tbShopShareRecordMapper.query(tbShopShareRecord);
public Map query(TbShopShareRecord tbShopShareRecord) {
Map<String, Object> result = tbShopShareRecordMapper.statisticsRecord(tbShopShareRecord);
PageHelper.startPage(tbShopShareRecord.getPage(), tbShopShareRecord.getSize());
List<TbShopShareRecord> records;
if(tbShopShareRecord.isSuccess()){
records = tbShopShareRecordMapper.queryIsSuccess(tbShopShareRecord);
}else {
records = tbShopShareRecordMapper.queryIsNoSuccess(tbShopShareRecord);
}
for (TbShopShareRecord shareRecord : records) {
shareRecord.setBeInvitedName(userInfoMapper.selectNameByPrimaryKey(shareRecord.getBeInvitedId()));
}
return records;
result.put("records",new PageInfo<>(records));
return result;
}
@Override

View File

@@ -92,6 +92,45 @@
</where>
</select>
<select id="statisticsRecord" resultType="java.util.HashMap">
SELECT
SUM(CASE WHEN (`method` = 'get' AND `status`= 2 ) OR ( `method` = 'use' AND `status`= 3 ) THEN 1 ELSE 0 END) AS isSuccess,
SUM(CASE WHEN (`method` = 'get' AND `status`!= 2 ) OR ( `method` = 'use' AND `status`!= 3 ) THEN 1 ELSE 0 END) AS isFail
FROM
tb_shop_share_record
WHERE
share_id = #{shareId}
AND invited_id = #{invitedId}
ORDER BY
create_time DESC;
</select>
<select id="queryIsSuccess" resultMap="TbShopShareRecordMap">
select
<include refid="Base_Column_List"/>
from tb_shop_share_record
where
share_id = #{shareId}
and invited_id = #{invitedId}
and (`method` = 'get' and status = 2 )
or (`method` = 'use' and status = 3 )
order by create_time desc
</select>
<select id="queryIsNoSuccess" resultMap="TbShopShareRecordMap">
select
<include refid="Base_Column_List"/>
from tb_shop_share_record
where
share_id = #{shareId}
and invited_id = #{invitedId}
and (`method` = 'get' and status != 2 )
or (`method` = 'use' and status != 3 )
order by create_time desc
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">