diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoService.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoService.java index 52282a80..00b50224 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/TbConsInfoService.java @@ -49,7 +49,7 @@ public interface TbConsInfoService { * 编辑 * @param resources / */ - void update(TbConsInfo resources); + void update(TbConsInfo resources) throws Exception; /** * 多选删除 diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoQueryCriteria.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoQueryCriteria.java index 2229c6c2..3be0dd7e 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoQueryCriteria.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/dto/TbConsInfoQueryCriteria.java @@ -30,4 +30,7 @@ public class TbConsInfoQueryCriteria{ /** 精确 */ @Query private Integer shopId; + + @Query + private String status; } \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java index 8a49254c..2c8315d4 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/cons/service/impl/TbConsInfoServiceImpl.java @@ -117,9 +117,21 @@ public class TbConsInfoServiceImpl implements TbConsInfoService { @Override @Transactional(rollbackFor = Exception.class) - public void update(TbConsInfo resources) { + public void update(TbConsInfo resources) throws Exception { TbConsInfo tbConsInfo = tbConsInfoRepository.findById(resources.getId()).orElseGet(TbConsInfo::new); - ValidationUtil.isNull( tbConsInfo.getId(),"TbConsInfo","id",resources.getId()); + + if(Objects.isNull(tbConsInfo)){ + throw new Exception("耗材信息不存在"); + } + + + tbConsInfo.setConCode(resources.getConCode()); + tbConsInfo.setConName(resources.getConName()); + tbConsInfo.setPrice(resources.getPrice()); + tbConsInfo.setConUnit(resources.getConUnit()); + tbConsInfo.setConWarning(resources.getConWarning()); + tbConsInfo.setStatus(resources.getStatus()); + tbConsInfo.setUpdateTime(new Timestamp(System.currentTimeMillis())); tbConsInfoRepository.save(tbConsInfo); } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java index fd15d20c..b1110f52 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/SummaryByDayController.java @@ -1,5 +1,6 @@ package cn.ysk.cashier.controller.shop; +import cn.ysk.cashier.annotation.AnonymousAccess; import cn.ysk.cashier.annotation.Log; import cn.ysk.cashier.dto.ShopSummaryDto; import cn.ysk.cashier.service.SummaryService; diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopUserController.java b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopUserController.java index 395b4899..3c572c26 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopUserController.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/controller/shop/TbShopUserController.java @@ -1,6 +1,10 @@ package cn.ysk.cashier.controller.shop; +import cn.hutool.core.util.StrUtil; +import cn.ysk.cashier.annotation.AnonymousAccess; import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; +import cn.ysk.cashier.exception.BadRequestException; +import cn.ysk.cashier.mybatis.service.TbMShopUserService; import cn.ysk.cashier.pojo.shop.TbShopUser; import cn.ysk.cashier.service.shop.TbShopUserService; import io.swagger.annotations.Api; @@ -27,6 +31,7 @@ import java.io.IOException; public class TbShopUserController { private final TbShopUserService tbShopUserService; + private final TbMShopUserService tbMShopUserService; @ApiOperation("导出数据") @GetMapping(value = "/download") @@ -46,6 +51,16 @@ public class TbShopUserController { return new ResponseEntity<>(tbShopUserService.queryShopUser(criteria),HttpStatus.OK); } + @AnonymousAccess + @GetMapping("summary") + @ApiOperation("查询会员概述") + public ResponseEntity summary(TbShopUserQueryCriteria criteria){ + if (StrUtil.isBlank(criteria.getShopId())) { + throw new BadRequestException("店铺id不为空"); + } + return new ResponseEntity<>(tbMShopUserService.summary(criteria),HttpStatus.OK); + } + @PostMapping @ApiOperation("新增/shop/user") @@ -66,4 +81,4 @@ public class TbShopUserController { tbShopUserService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } -} \ No newline at end of file +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMShopUser.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMShopUser.java new file mode 100644 index 00000000..19382b3b --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/entity/TbMShopUser.java @@ -0,0 +1,284 @@ +package cn.ysk.cashier.mybatis.entity; + +import java.io.Serializable; +import java.math.BigDecimal; +import javax.persistence.Column; +import javax.persistence.GeneratedValue; +import javax.persistence.Id; +import javax.persistence.Table; +import lombok.Data; + +/** + * 商户储值会员 + * @TableName tb_shop_user + */ +@Table(name="tb_shop_user") +@Data +public class TbMShopUser implements Serializable { + /** + * (随机) + */ + @Id + private Integer id; + + /** + * 钱包余额 + */ + private BigDecimal amount; + + /** + * 授权金额 + */ + private BigDecimal credit_amount; + + /** + * 消费累计 + */ + private BigDecimal consume_amount; + + /** + * 消费数量累计 + */ + private Integer consume_number; + + /** + * 等级积分 + */ + private BigDecimal level_consume; + + /** + * 0-不可使用 1可使用 + */ + private Integer status; + + /** + * 代理Id + */ + private String merchant_id; + + /** + * 店铺Id + */ + private String shop_id; + + /** + * 用户Id + */ + private String user_id; + + /** + * 上级Id + */ + private String parent_id; + + /** + * 上级的层级 + */ + private String parent_level; + + /** + * 真实名字 + */ + private String name; + + /** + * + */ + private String head_img; + + /** + * 性别 + */ + private Integer sex; + + /** + * 生日 + */ + private String birth_day; + + /** + * 联系电话 + */ + private String telephone; + + /** + * 是否会员, + */ + private Integer is_vip; + + /** + * 会员编号 + */ + private String code; + + /** + * 是否通过关注而成为会员的,此字段固定后不改 + */ + private Integer is_attention; + + /** + * 关注时间 + */ + private Integer attention_at; + + /** + * 是否股东(分销商) + */ + private Integer is_shareholder; + + /** + * 层级1-顶级 2-次级 3最低 + */ + private Integer level; + + /** + * 分销类型 auto-自动获取 set手动设置 charge充值 + */ + private String distribute_type; + + /** + * 排序 + */ + private Integer sort; + + /** + * + */ + private Long created_at; + + /** + * + */ + private Long updated_at; + + /** + * 小程序openId + */ + private String mini_open_id; + + /** + * 会员码 + */ + private String dynamic_code; + + private static final long serialVersionUID = 1L; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that == null) { + return false; + } + if (getClass() != that.getClass()) { + return false; + } + TbMShopUser other = (TbMShopUser) that; + return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) + && (this.getAmount() == null ? other.getAmount() == null : this.getAmount().equals(other.getAmount())) + && (this.getCredit_amount() == null ? other.getCredit_amount() == null : this.getCredit_amount().equals(other.getCredit_amount())) + && (this.getConsume_amount() == null ? other.getConsume_amount() == null : this.getConsume_amount().equals(other.getConsume_amount())) + && (this.getConsume_number() == null ? other.getConsume_number() == null : this.getConsume_number().equals(other.getConsume_number())) + && (this.getLevel_consume() == null ? other.getLevel_consume() == null : this.getLevel_consume().equals(other.getLevel_consume())) + && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) + && (this.getMerchant_id() == null ? other.getMerchant_id() == null : this.getMerchant_id().equals(other.getMerchant_id())) + && (this.getShop_id() == null ? other.getShop_id() == null : this.getShop_id().equals(other.getShop_id())) + && (this.getUser_id() == null ? other.getUser_id() == null : this.getUser_id().equals(other.getUser_id())) + && (this.getParent_id() == null ? other.getParent_id() == null : this.getParent_id().equals(other.getParent_id())) + && (this.getParent_level() == null ? other.getParent_level() == null : this.getParent_level().equals(other.getParent_level())) + && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) + && (this.getHead_img() == null ? other.getHead_img() == null : this.getHead_img().equals(other.getHead_img())) + && (this.getSex() == null ? other.getSex() == null : this.getSex().equals(other.getSex())) + && (this.getBirth_day() == null ? other.getBirth_day() == null : this.getBirth_day().equals(other.getBirth_day())) + && (this.getTelephone() == null ? other.getTelephone() == null : this.getTelephone().equals(other.getTelephone())) + && (this.getIs_vip() == null ? other.getIs_vip() == null : this.getIs_vip().equals(other.getIs_vip())) + && (this.getCode() == null ? other.getCode() == null : this.getCode().equals(other.getCode())) + && (this.getIs_attention() == null ? other.getIs_attention() == null : this.getIs_attention().equals(other.getIs_attention())) + && (this.getAttention_at() == null ? other.getAttention_at() == null : this.getAttention_at().equals(other.getAttention_at())) + && (this.getIs_shareholder() == null ? other.getIs_shareholder() == null : this.getIs_shareholder().equals(other.getIs_shareholder())) + && (this.getLevel() == null ? other.getLevel() == null : this.getLevel().equals(other.getLevel())) + && (this.getDistribute_type() == null ? other.getDistribute_type() == null : this.getDistribute_type().equals(other.getDistribute_type())) + && (this.getSort() == null ? other.getSort() == null : this.getSort().equals(other.getSort())) + && (this.getCreated_at() == null ? other.getCreated_at() == null : this.getCreated_at().equals(other.getCreated_at())) + && (this.getUpdated_at() == null ? other.getUpdated_at() == null : this.getUpdated_at().equals(other.getUpdated_at())) + && (this.getMini_open_id() == null ? other.getMini_open_id() == null : this.getMini_open_id().equals(other.getMini_open_id())) + && (this.getDynamic_code() == null ? other.getDynamic_code() == null : this.getDynamic_code().equals(other.getDynamic_code())); + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); + result = prime * result + ((getAmount() == null) ? 0 : getAmount().hashCode()); + result = prime * result + ((getCredit_amount() == null) ? 0 : getCredit_amount().hashCode()); + result = prime * result + ((getConsume_amount() == null) ? 0 : getConsume_amount().hashCode()); + result = prime * result + ((getConsume_number() == null) ? 0 : getConsume_number().hashCode()); + result = prime * result + ((getLevel_consume() == null) ? 0 : getLevel_consume().hashCode()); + result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); + result = prime * result + ((getMerchant_id() == null) ? 0 : getMerchant_id().hashCode()); + result = prime * result + ((getShop_id() == null) ? 0 : getShop_id().hashCode()); + result = prime * result + ((getUser_id() == null) ? 0 : getUser_id().hashCode()); + result = prime * result + ((getParent_id() == null) ? 0 : getParent_id().hashCode()); + result = prime * result + ((getParent_level() == null) ? 0 : getParent_level().hashCode()); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getHead_img() == null) ? 0 : getHead_img().hashCode()); + result = prime * result + ((getSex() == null) ? 0 : getSex().hashCode()); + result = prime * result + ((getBirth_day() == null) ? 0 : getBirth_day().hashCode()); + result = prime * result + ((getTelephone() == null) ? 0 : getTelephone().hashCode()); + result = prime * result + ((getIs_vip() == null) ? 0 : getIs_vip().hashCode()); + result = prime * result + ((getCode() == null) ? 0 : getCode().hashCode()); + result = prime * result + ((getIs_attention() == null) ? 0 : getIs_attention().hashCode()); + result = prime * result + ((getAttention_at() == null) ? 0 : getAttention_at().hashCode()); + result = prime * result + ((getIs_shareholder() == null) ? 0 : getIs_shareholder().hashCode()); + result = prime * result + ((getLevel() == null) ? 0 : getLevel().hashCode()); + result = prime * result + ((getDistribute_type() == null) ? 0 : getDistribute_type().hashCode()); + result = prime * result + ((getSort() == null) ? 0 : getSort().hashCode()); + result = prime * result + ((getCreated_at() == null) ? 0 : getCreated_at().hashCode()); + result = prime * result + ((getUpdated_at() == null) ? 0 : getUpdated_at().hashCode()); + result = prime * result + ((getMini_open_id() == null) ? 0 : getMini_open_id().hashCode()); + result = prime * result + ((getDynamic_code() == null) ? 0 : getDynamic_code().hashCode()); + return result; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", id=").append(id); + sb.append(", amount=").append(amount); + sb.append(", credit_amount=").append(credit_amount); + sb.append(", consume_amount=").append(consume_amount); + sb.append(", consume_number=").append(consume_number); + sb.append(", level_consume=").append(level_consume); + sb.append(", status=").append(status); + sb.append(", merchant_id=").append(merchant_id); + sb.append(", shop_id=").append(shop_id); + sb.append(", user_id=").append(user_id); + sb.append(", parent_id=").append(parent_id); + sb.append(", parent_level=").append(parent_level); + sb.append(", name=").append(name); + sb.append(", head_img=").append(head_img); + sb.append(", sex=").append(sex); + sb.append(", birth_day=").append(birth_day); + sb.append(", telephone=").append(telephone); + sb.append(", is_vip=").append(is_vip); + sb.append(", code=").append(code); + sb.append(", is_attention=").append(is_attention); + sb.append(", attention_at=").append(attention_at); + sb.append(", is_shareholder=").append(is_shareholder); + sb.append(", level=").append(level); + sb.append(", distribute_type=").append(distribute_type); + sb.append(", sort=").append(sort); + sb.append(", created_at=").append(created_at); + sb.append(", updated_at=").append(updated_at); + sb.append(", mini_open_id=").append(mini_open_id); + sb.append(", dynamic_code=").append(dynamic_code); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMShopUserMapper.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMShopUserMapper.java new file mode 100644 index 00000000..fe7f49b6 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/mapper/TbMShopUserMapper.java @@ -0,0 +1,39 @@ +package cn.ysk.cashier.mybatis.mapper; + +import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; +import cn.ysk.cashier.mybatis.entity.TbMShopUser; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.Map; + +/** +* @author Administrator +* @description 针对表【tb_shop_user(商户储值会员)】的数据库操作Mapper +* @createDate 2024-07-06 11:46:46 +* @Entity cn.ysk.cashier.mybatis.entity.TbMShopUser +*/ +public interface TbMShopUserMapper extends BaseMapper { + @Select("") + Map selectUserSummary(@Param("shopId") String shopId, @Param("isVip") Integer isVip); + +} + + + + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMShopUserService.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMShopUserService.java new file mode 100644 index 00000000..c1fa81ab --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/TbMShopUserService.java @@ -0,0 +1,21 @@ +package cn.ysk.cashier.mybatis.service; + +import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; +import cn.ysk.cashier.mybatis.entity.TbMShopUser; +import com.baomidou.mybatisplus.extension.service.IService; + +/** +* @author Administrator +* @description 针对表【tb_shop_user(商户储值会员)】的数据库操作Service +* @createDate 2024-07-06 11:46:46 +*/ +public interface TbMShopUserService extends IService { + + /** + * 查询会员概述信息 + * @param criteria 查询 + * @return 会员概述 + */ + Object summary(TbShopUserQueryCriteria criteria); + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMShopUserServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMShopUserServiceImpl.java new file mode 100644 index 00000000..d2f005c3 --- /dev/null +++ b/eladmin-system/src/main/java/cn/ysk/cashier/mybatis/service/impl/TbMShopUserServiceImpl.java @@ -0,0 +1,33 @@ +package cn.ysk.cashier.mybatis.service.impl; + +import cn.ysk.cashier.dto.shop.TbShopUserQueryCriteria; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import cn.ysk.cashier.mybatis.entity.TbMShopUser; +import cn.ysk.cashier.mybatis.service.TbMShopUserService; +import cn.ysk.cashier.mybatis.mapper.TbMShopUserMapper; +import org.springframework.stereotype.Service; + +/** +* @author Administrator +* @description 针对表【tb_shop_user(商户储值会员)】的数据库操作Service实现 +* @createDate 2024-07-06 11:46:46 +*/ +@Service +public class TbMShopUserServiceImpl extends ServiceImpl + implements TbMShopUserService{ + + private final TbMShopUserMapper shopUserMapper; + + public TbMShopUserServiceImpl(TbMShopUserMapper shopUserMapper) { + this.shopUserMapper = shopUserMapper; + } + + @Override + public Object summary(TbShopUserQueryCriteria criteria) { + return shopUserMapper.selectUserSummary(criteria.getShopId(), criteria.getIsVip()); + } +} + + + + diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java index 1defaa6e..8ba9e9bc 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/repository/shop/TbShopUserRepository.java @@ -27,6 +27,7 @@ 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 @@ -47,4 +48,6 @@ public interface TbShopUserRepository extends JpaRepository @Query("SELECT user.userId from TbShopUser user where user.shopId = :shopId") List getUserIdByShopId(String shopId); + + } diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUserServiceImpl.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUserServiceImpl.java index 7480a530..e9d131c2 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUserServiceImpl.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopUserServiceImpl.java @@ -128,4 +128,5 @@ public class TbShopUserServiceImpl implements TbShopUserService { } FileUtil.downloadExcel(list, response); } -} \ No newline at end of file + +} diff --git a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopUserService.java b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopUserService.java index efba8dd5..2fc389f0 100644 --- a/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopUserService.java +++ b/eladmin-system/src/main/java/cn/ysk/cashier/service/shop/TbShopUserService.java @@ -74,4 +74,5 @@ public interface TbShopUserService { * @throws IOException / */ void download(List all, HttpServletResponse response) throws IOException; -} \ No newline at end of file + +} diff --git a/eladmin-system/src/main/resources/logback.xml b/eladmin-system/src/main/resources/logback.xml index 5a1793be..c959995d 100644 --- a/eladmin-system/src/main/resources/logback.xml +++ b/eladmin-system/src/main/resources/logback.xml @@ -38,6 +38,9 @@ + + + diff --git a/eladmin-system/src/main/resources/mapper/TbMShopUserMapper.xml b/eladmin-system/src/main/resources/mapper/TbMShopUserMapper.xml new file mode 100644 index 00000000..5f2c0ca4 --- /dev/null +++ b/eladmin-system/src/main/resources/mapper/TbMShopUserMapper.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id,amount,credit_amount, + consume_amount,consume_number,level_consume, + status,merchant_id,shop_id, + user_id,parent_id,parent_level, + name,head_img,sex, + birth_day,telephone,is_vip, + code,is_attention,attention_at, + is_shareholder,level,distribute_type, + sort,created_at,updated_at, + mini_open_id,dynamic_code + + +