diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java b/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java index cb6cfc2..5c49993 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/auth/LoginFilter.java @@ -45,6 +45,7 @@ public class LoginFilter implements Filter { "cashierService/home",//首页 "cashierService/order/testMessage",//首页 "cashierService/common/**",//通用接口 + "cashierService/tbShopShare/**",//通用接口 "cashierService/distirict/**",//首页其它接口 // "cashierService/login/**",//登录部分接口不校验 diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java index 12bf3da..db76bd7 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/controller/TbShopShareController.java @@ -1,12 +1,11 @@ package com.chaozhanggui.system.cashierservice.controller; +import com.chaozhanggui.system.cashierservice.entity.TbShopShareRecord; +import com.chaozhanggui.system.cashierservice.service.TbShopShareRecordService; import com.chaozhanggui.system.cashierservice.service.TbShopShareService; import com.chaozhanggui.system.cashierservice.sign.Result; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -19,12 +18,12 @@ import javax.annotation.Resource; @RestController @RequestMapping("tbShopShare") public class TbShopShareController { - /** - * 服务对象 - */ + @Autowired private TbShopShareService tbShopShareService; + @Autowired + private TbShopShareRecordService tbShopShareRecordService; /** * 通过主键查询单条数据 @@ -37,5 +36,40 @@ public class TbShopShareController { return Result.successWithData(tbShopShareService.queryByShopId(shopId)); } + + /** + * 查询 + * + * @param tbShopShareRecord 筛选条件 + * @return 查询结果 + */ + @GetMapping("record") + public Result queryByPage(TbShopShareRecord tbShopShareRecord) { + return Result.successWithData(tbShopShareRecordService.query(tbShopShareRecord)); + } + + + /** + * 进入页面 + * + * @param tbShopShareRecord 实体 + * @return 新增结果 + */ + @PostMapping("open") + public Result open(@RequestBody TbShopShareRecord tbShopShareRecord) { + return tbShopShareRecordService.insert(tbShopShareRecord); + } + + /** + * 领取优惠券 + * + * @param tbShopShareRecord 实体 + * @return 新增结果 + */ + @PostMapping("receive") + public Result receive(@RequestBody TbShopShareRecord tbShopShareRecord) { + return tbShopShareRecordService.receive(tbShopShareRecord); + } + } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java new file mode 100644 index 0000000..a48eace --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbShopShareRecordMapper.java @@ -0,0 +1,75 @@ +package com.chaozhanggui.system.cashierservice.dao; + +import com.chaozhanggui.system.cashierservice.entity.TbShopShareRecord; +import org.apache.ibatis.annotations.Param; +import org.springframework.data.domain.Pageable; + +import java.util.List; + +/** + * (TbShopShareRecord)表数据库访问层 + * + * @author ww + * @since 2024-11-07 15:50:03 + */ +public interface TbShopShareRecordMapper { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbShopShareRecord queryById(Integer id); + + TbShopShareRecord queryByData( + @Param("shareId") Integer shareId, @Param("shopId") Integer shopId, + @Param("invitedId") Integer invitedId, @Param("beInvitedId") Integer beInvitedId); + + TbShopShareRecord queryByDataByBeInvited( + @Param("shareId") Integer shareId, @Param("shopId") Integer shopId, + @Param("beInvitedId") Integer beInvitedId); + + /** + * 查询数据 + * + * @param tbShopShareRecord 查询条件 + * @return 对象列表 + */ + List query(TbShopShareRecord tbShopShareRecord); + + + /** + * 新增数据 + * + * @param tbShopShareRecord 实例对象 + * @return 影响行数 + */ + int insert(TbShopShareRecord tbShopShareRecord); + + /** + * 批量新增数据(MyBatis原生foreach方法) + * + * @param entities List 实例对象列表 + * @return 影响行数 + */ + int insertBatch(@Param("entities") List entities); + + /** + * 修改数据 + * + * @param tbShopShareRecord 实例对象 + * @return 影响行数 + */ + int update(TbShopShareRecord tbShopShareRecord); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserInfoMapper.java b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserInfoMapper.java index 975d431..1802d04 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserInfoMapper.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/dao/TbUserInfoMapper.java @@ -17,6 +17,8 @@ public interface TbUserInfoMapper { TbUserInfo selectByPrimaryKey(Integer id); + String selectNameByPrimaryKey(Integer id); + int updateByPrimaryKeySelective(TbUserInfo record); int updateByPrimaryKey(TbUserInfo record); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java index e7385df..e914a25 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbActivateInRecord.java @@ -73,6 +73,7 @@ public class TbActivateInRecord implements Serializable { private Date updateTime; private String couponJson; + private String source; public Integer getId() { @@ -219,5 +220,13 @@ public class TbActivateInRecord implements Serializable { this.couponJson = couponJson; } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } } diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java new file mode 100644 index 0000000..36b0a63 --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/entity/TbShopShareRecord.java @@ -0,0 +1,156 @@ +package com.chaozhanggui.system.cashierservice.entity; + +import java.util.Date; +import java.io.Serializable; + +/** + * (TbShopShareRecord)实体类 + * + * @author ww + * @since 2024-11-07 15:50:04 + */ +public class TbShopShareRecord implements Serializable { + private static final long serialVersionUID = -41620929736900271L; + + private Integer id; + /** + * tb_shop_share 主键Id + */ + private Integer shareId; + /** + * 店铺Id + */ + private Integer shopId; + /** + * 邀请人id + */ + private Integer invitedId; + /** + * 邀请人名称 + */ + private String invitedName; + /** + * 被邀请人Id + */ + private Integer beInvitedId; + /** + * 被邀请人名称 + */ + private String beInvitedName; + /** + * 奖励券获得方式 get/use 领取获得/使用获得 + */ + private String method; + /** + * 1 未领取 2 已领取 3 已使用 + */ + private Integer status; + /** + * 生效时间/获得奖励的时间 + */ + private Date rewardTime; + + 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; + } + +} + diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java new file mode 100644 index 0000000..c71057c --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/TbShopShareRecordService.java @@ -0,0 +1,62 @@ +package com.chaozhanggui.system.cashierservice.service; + +import com.chaozhanggui.system.cashierservice.entity.TbShopShareRecord; +import com.chaozhanggui.system.cashierservice.sign.Result; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; + +import java.util.List; + +/** + * (TbShopShareRecord)表服务接口 + * + * @author ww + * @since 2024-11-07 15:50:04 + */ +public interface TbShopShareRecordService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + TbShopShareRecord queryById(Integer id); + + /** + * 分页查询 + * + * @param tbShopShareRecord 筛选条件 + * @return 查询结果 + */ + List query(TbShopShareRecord tbShopShareRecord); + + Result receive(TbShopShareRecord tbShopShareRecord); + + /** + * 新增数据 + * + * @param tbShopShareRecord 实例对象 + * @return 实例对象 + */ + Result insert(TbShopShareRecord tbShopShareRecord); + + /** + * 修改数据 + * + * @param tbShopShareRecord 实例对象 + * @return 实例对象 + */ + TbShopShareRecord update(TbShopShareRecord tbShopShareRecord); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + + void give(TbShopShareRecord shareRecord, Integer userId); + +} diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java index bf1e314..f7a0973 100644 --- a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopCouponServiceImpl.java @@ -7,10 +7,12 @@ import com.chaozhanggui.system.cashierservice.entity.*; import com.chaozhanggui.system.cashierservice.entity.dto.CouponDto; import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo; import com.chaozhanggui.system.cashierservice.service.TbShopCouponService; +import com.chaozhanggui.system.cashierservice.service.TbShopShareRecordService; import com.chaozhanggui.system.cashierservice.sign.CodeEnum; import com.chaozhanggui.system.cashierservice.sign.Result; import com.google.gson.JsonObject; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; @@ -43,6 +45,12 @@ public class TbShopCouponServiceImpl implements TbShopCouponService { @Resource private TbActivateOutRecordMapper outRecordMapper; + @Autowired + private TbShopShareRecordMapper shareRecordMapper; + + @Autowired + private TbShopShareRecordService shareRecordService; + @Override public List getActivateCouponByAmount(Integer shopId, String userId, BigDecimal amount) { TbShopUser tbShopUser = shopUserMapper.selectByUserIdAndShopId(userId, String.valueOf(shopId)); @@ -174,6 +182,14 @@ public class TbShopCouponServiceImpl implements TbShopCouponService { public boolean use(Integer shopId, Integer orderId, Integer vipUserId, List param) { for (TbActivateOutRecord outRecord : param) { TbActivateInRecord inRecord = inRecordMapper.queryById(outRecord.getGiveId()); + if (inRecord.getSource().equals("invited")) { + TbShopShareRecord shareRecord = shareRecordMapper.queryById(inRecord.getSourceActId()); + if (shareRecord.getMethod().equals("use")) { + shareRecord.setStatus(3); + shareRecordService.give(shareRecord,shareRecord.getInvitedId()); + shareRecordMapper.update(shareRecord); + } + } inRecord.setOverNum(inRecord.getOverNum() - outRecord.getUseNum()); inRecordMapper.updateOverNum(inRecord.getId(), inRecord.getOverNum()); diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java new file mode 100644 index 0000000..35ff26a --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/service/impl/TbShopShareRecordServiceImpl.java @@ -0,0 +1,262 @@ +package com.chaozhanggui.system.cashierservice.service.impl; + +import cn.hutool.core.collection.CollectionUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.ObjectUtil; +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.Result; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Service; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; +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; + +/** + * (TbShopShareRecord)表服务实现类 + * + * @author ww + * @since 2024-11-07 15:50:04 + */ +@Primary +@Service +public class TbShopShareRecordServiceImpl implements TbShopShareRecordService { + @Autowired + private TbShopShareMapper tbShopShareMapper; + @Autowired + private TbShopShareRecordMapper tbShopShareRecordMapper; + @Autowired + private TbShopUserMapper shopUserMapper; + @Autowired + private TbCouponProductMapper couProductMapper; + @Autowired + private TbShopCouponMapper couponMapper; + @Autowired + private TbActivateInRecordMapper activateInRecordMapper; + @Autowired + private TbUserInfoMapper userInfoMapper; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public TbShopShareRecord queryById(Integer id) { + return this.tbShopShareRecordMapper.queryById(id); + } + + /** + * 分页查询 + * + * @param tbShopShareRecord 筛选条件 + * @return 查询结果 + */ + @Override + public List query(TbShopShareRecord tbShopShareRecord) { + List records = tbShopShareRecordMapper.query(tbShopShareRecord); + for (TbShopShareRecord shareRecord : records) { + shareRecord.setBeInvitedName(userInfoMapper.selectNameByPrimaryKey(shareRecord.getBeInvitedId())); + } + return records; + } + + @Override + public Result receive(TbShopShareRecord tbShopShareRecord) { +// TbShopShareRecord query = tbShopShareRecordMapper.queryByDataByBeInvited( +// tbShopShareRecord.getShareId(), tbShopShareRecord.getShopId(), tbShopShareRecord.getBeInvitedId()); + + TbShopShareRecord query = tbShopShareRecordMapper.queryByData( + tbShopShareRecord.getShareId(), tbShopShareRecord.getShopId(), + tbShopShareRecord.getInvitedId(), tbShopShareRecord.getBeInvitedId()); + if (query.getStatus() == 1) { + give(query, query.getBeInvitedId()); + if (query.getMethod().equals("get")) { + give(query, query.getInvitedId()); + } + query.setRewardTime(new Date()); + query.setStatus(2); + query.setUpdateTime(new Date()); + tbShopShareRecordMapper.update(query); + return Result.successWithData("领取成功。"); + } else { + return Result.fail("不可重复领取。"); + } + } + + /** + * 新增数据 + * + * @param tbShopShareRecord 实例对象 + * @return 实例对象 + */ + @Override + public Result insert(TbShopShareRecord tbShopShareRecord) { + TbShopUser shopUserInfo = getShopUserInfo(tbShopShareRecord.getBeInvitedId(), tbShopShareRecord.getShopId()); + TbShopShareRecord query = tbShopShareRecordMapper.queryByData( + tbShopShareRecord.getShareId(), tbShopShareRecord.getShopId(), + tbShopShareRecord.getInvitedId(), tbShopShareRecord.getBeInvitedId()); + if (query == null) { + TbShopShare tbShopShare = tbShopShareMapper.queryById(tbShopShareRecord.getShareId()); + tbShopShareRecord.setMethod(tbShopShare.getGetMethod()); + tbShopShareRecord.setShopId(tbShopShareRecord.getShopId()); + tbShopShareRecord.setCreateTime(new Date()); + tbShopShareRecord.setUpdateTime(new Date()); + }else { + query.setUpdateTime(new Date()); + } + if (shopUserInfo == null) { + if (query != null) { + query.setStatus(1); + tbShopShareRecordMapper.update(query); + } else { + tbShopShareRecord.setStatus(1); + tbShopShareRecordMapper.insert(tbShopShareRecord); + } + saveShopUser(tbShopShareRecord.getBeInvitedId(), tbShopShareRecord.getShopId()); + } else { + if (query != null) { + query.setStatus(0); + tbShopShareRecordMapper.update(query); + } else { + tbShopShareRecord.setStatus(0); + tbShopShareRecordMapper.insert(tbShopShareRecord); + } + } + if (query == null) { + query = tbShopShareRecord; + } + return Result.successWithData(query); + } + + /** + * 修改数据 + * + * @param tbShopShareRecord 实例对象 + * @return 实例对象 + */ + @Override + public TbShopShareRecord update(TbShopShareRecord tbShopShareRecord) { + this.tbShopShareRecordMapper.update(tbShopShareRecord); + return this.queryById(tbShopShareRecord.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.tbShopShareRecordMapper.deleteById(id) > 0; + } + + public TbShopUser getShopUserInfo(Integer userId, Integer shopId) { + return shopUserMapper.selectByUserIdAndShopId(userId.toString(), shopId.toString()); + } + + public void saveShopUser(Integer userId, Integer shopId) { + TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId); + TbShopUser shopUser = new TbShopUser(); + shopUser.setName(tbUserInfo.getNickName()); + shopUser.setSex(tbUserInfo.getSex()); + shopUser.setBirthDay(tbUserInfo.getBirthDay()); + shopUser.setLevel(Byte.parseByte("1")); + String dynamicCode = RandomUtil.randomNumbers(8); + shopUser.setCode(dynamicCode); + shopUser.setTelephone(tbUserInfo.getTelephone()); + shopUser.setAmount(BigDecimal.ZERO); + shopUser.setIsVip(Byte.parseByte("0")); + shopUser.setCreditAmount(BigDecimal.ZERO); + shopUser.setConsumeAmount(BigDecimal.ZERO); + shopUser.setConsumeNumber(0); + shopUser.setLevelConsume(BigDecimal.ZERO); + shopUser.setStatus(Byte.parseByte("1")); + shopUser.setShopId(shopId.toString()); + shopUser.setUserId(userId.toString()); + shopUser.setMiniOpenId(tbUserInfo.getMiniAppOpenId()); + shopUser.setCreatedAt(System.currentTimeMillis()); + shopUser.setUpdatedAt(System.currentTimeMillis()); + shopUserMapper.insert(shopUser); + } + + @Override + public void give(TbShopShareRecord shareRecord, Integer userId) { + TbShopShare shopShare = tbShopShareMapper.queryById(shareRecord.getShareId()); + TbShopUser tbShopUser = getShopUserInfo(userId, shareRecord.getShopId()); + if (userId.equals(shareRecord.getInvitedId())) { + giveCoupon(shopShare, tbShopUser, shopShare.getRewardCoupons()); + } else if (userId.equals(shareRecord.getBeInvitedId())) { + giveCoupon(shopShare, tbShopUser, shopShare.getNewCoupons()); + } + } + + public void giveCoupon(TbShopShare shopShare, TbShopUser tbShopUser, List coupons) { + for (TbShopShare.ShareCoupons newCoupon : coupons) { + TbShopCoupon tbShopCoupon = couponMapper.queryById(newCoupon.getCouponId()); + Date start = new Date(); + Date end = new Date(); + if ("fixed".equals(tbShopCoupon.getValidityType())) { + //固定时间 + end = DateUtil.offsetDay(new Date(), tbShopCoupon.getValidDays()); + } else if ("custom".equals(tbShopCoupon.getValidityType())) { + //自定义时间 + start = tbShopCoupon.getValidStartTime(); + end = tbShopCoupon.getValidEndTime(); + } + if (tbShopCoupon != null) { + List actGiveRecords = new ArrayList<>(); + if (tbShopCoupon.getType() == 1) { + //满减 + TbActivateInRecord record = new TbActivateInRecord(); + record.setVipUserId(Integer.valueOf(tbShopUser.getId())); + record.setCouponId(tbShopCoupon.getId()); + record.setName("满" + tbShopCoupon.getFullAmount() + "减" + tbShopCoupon.getDiscountAmount()); + record.setFullAmount(tbShopCoupon.getFullAmount()); + record.setDiscountAmount(tbShopCoupon.getDiscountAmount()); + record.setType(1); + record.setNum(newCoupon.getCouponNum()); + record.setOverNum(newCoupon.getCouponNum()); + record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setSourceActId(shopShare.getId()); + record.setUseStartTime(start); + record.setUseEndTime(end); + record.setSource("invited"); + actGiveRecords.add(record); + } else if (tbShopCoupon.getType() == 2) { + //商品卷 + List tbCouponProducts = couProductMapper.queryAllByCouponId(tbShopCoupon.getId()); + for (TbCouponProduct actPro : tbCouponProducts) { + TbActivateInRecord record = new TbActivateInRecord(); + record.setVipUserId(Integer.valueOf(tbShopUser.getId())); + record.setCouponId(tbShopCoupon.getId()); + record.setName("商品卷"); + record.setType(2); + record.setProId(actPro.getProductId()); + record.setNum(actPro.getNum() * tbShopCoupon.getNumber()); + record.setOverNum(actPro.getNum() * tbShopCoupon.getNumber()); + record.setShopId(Integer.valueOf(tbShopUser.getShopId())); + record.setSourceActId(shopShare.getId()); + record.setUseStartTime(start); + record.setUseEndTime(end); + record.setSource("invited"); + actGiveRecords.add(record); + } + } + activateInRecordMapper.insertBatch(actGiveRecords); + } + } + + } +} diff --git a/src/main/resources/mapper/TbActivateInRecordMapper.xml b/src/main/resources/mapper/TbActivateInRecordMapper.xml index 0c5af4d..c5eafbf 100644 --- a/src/main/resources/mapper/TbActivateInRecordMapper.xml +++ b/src/main/resources/mapper/TbActivateInRecordMapper.xml @@ -21,10 +21,11 @@ + -id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, num, over_num, shop_id, source_act_id, source_flow_id, use_start_time, use_end_time, create_time, update_time, coupon_json +id, vip_user_id, coupon_id, name, type, pro_id, full_amount, discount_amount, num, over_num, shop_id, source_act_id, source_flow_id, use_start_time, use_end_time, create_time, update_time, coupon_json,source diff --git a/src/main/resources/mapper/TbShopShareRecordMapper.xml b/src/main/resources/mapper/TbShopShareRecordMapper.xml new file mode 100644 index 0000000..12d0744 --- /dev/null +++ b/src/main/resources/mapper/TbShopShareRecordMapper.xml @@ -0,0 +1,160 @@ + + + + + + + + + + + + + + + + + + + + id + , share_id, shop_id, invited_id, invited_name, be_invited_id, method, status, reward_time, create_time, update_time + + + + + + + + + + + + + + insert into tb_shop_share_record(share_id, shop_id, invited_id, invited_name, be_invited_id, method, status, + reward_time, create_time, update_time) + values (#{shareId}, #{shopId}, #{invitedId}, #{invitedName}, #{beInvitedId}, #{method}, #{status}, + #{rewardTime}, #{createTime}, #{updateTime}) + + + + insert into tb_shop_share_record(share_id, shop_id, invited_id, invited_name, be_invited_id, method, status, + reward_time, create_time, update_time) + values + + (#{entity.shareId}, #{entity.shopId}, #{entity.invitedId}, #{entity.invitedName}, #{entity.beInvitedId}, + #{entity.method}, #{entity.status}, #{entity.rewardTime}, #{entity.createTime}, #{entity.updateTime}) + + + + + + update tb_shop_share_record + + + share_id = #{shareId}, + + + shop_id = #{shopId}, + + + invited_id = #{invitedId}, + + + invited_name = #{invitedName}, + + + be_invited_id = #{beInvitedId}, + + + method = #{method}, + + + status = #{status}, + + + reward_time = #{rewardTime}, + + + create_time = #{createTime}, + + + update_time = #{updateTime}, + + + where id = #{id} + + + + + delete + from tb_shop_share_record + where id = #{id} + + + + diff --git a/src/main/resources/mapper/TbUserInfoMapper.xml b/src/main/resources/mapper/TbUserInfoMapper.xml index 7f5ec68..8945e15 100644 --- a/src/main/resources/mapper/TbUserInfoMapper.xml +++ b/src/main/resources/mapper/TbUserInfoMapper.xml @@ -67,6 +67,14 @@ from tb_user_info where id = #{id,jdbcType=INTEGER} + + + delete from tb_user_info where id = #{id,jdbcType=INTEGER}