Browse Source

Merge remote-tracking branch 'origin/dev' into dev

cangku
chencheng 3 years ago
parent
commit
7b553af047
  1. 5
      hiver-admin/pom.xml
  2. 2
      hiver-admin/src/main/resources/application.yml
  3. 16
      hiver-admin/test-output/test-report.html
  4. 68
      hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java
  5. 33
      hiver-core/src/main/java/cc/hiver/core/base/HiverBasePageQuery.java
  6. 10
      hiver-core/src/main/java/cc/hiver/core/common/constant/CommonConstant.java
  7. 48
      hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java
  8. 52
      hiver-core/src/main/java/cc/hiver/core/vo/Option.java
  9. 13
      hiver-modules/hiver-mall/pom.xml
  10. 30
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/AttributeTypeEnum.java
  11. 70
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/AddressController.java
  12. 63
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomAddressController.java
  13. 71
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsAttributeController.java
  14. 47
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsBrandController.java
  15. 107
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCartController.java
  16. 87
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCategoryController.java
  17. 90
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsController.java
  18. 111
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsStockController.java
  19. 83
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java
  20. 49
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PopularUrlController.java
  21. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/RoleSettingController.java
  22. 33
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/UserClockInController.java
  23. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/converter/GoodsAttributeConverter.java
  24. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/converter/GoodsConverter.java
  25. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/CustomAddressDao.java
  26. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/GoodsBrandDao.java
  27. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/GoodsInStockDao.java
  28. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/MallDao.java
  29. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/PopularUrlDao.java
  30. 10
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/PopularUrlGoodsDao.java
  31. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/RoleSettingDao.java
  32. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SalesOrderDao.java
  33. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SalesOrderItemDao.java
  34. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/UserClockInDao.java
  35. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/UserMallDao.java
  36. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/AddressMapper.java
  37. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsAttributeMapper.java
  38. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsCategoryAttributeMapper.java
  39. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsCategoryBrandMapper.java
  40. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsCategoryMapper.java
  41. 51
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsMapper.java
  42. 35
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsStockMapper.java
  43. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java
  44. 44
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Address.java
  45. 44
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/CustomAddress.java
  46. 71
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Goods.java
  47. 41
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsAttribute.java
  48. 39
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsBrand.java
  49. 46
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsCategory.java
  50. 32
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsCategoryAttribute.java
  51. 27
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsCategoryBrand.java
  52. 29
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsInStock.java
  53. 58
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsStock.java
  54. 45
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Mall.java
  55. 29
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PopularUrl.java
  56. 29
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PopularUrlGoods.java
  57. 35
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/RoleSetting.java
  58. 56
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SalesOrder.java
  59. 51
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SalesOrderItem.java
  60. 51
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/UserClockIn.java
  61. 31
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/UserMall.java
  62. 36
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/CartItemDTO.java
  63. 38
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/CategoryAttributeDto.java
  64. 66
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/CheckPriceDTO.java
  65. 58
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/GoodsStockDto.java
  66. 57
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/LockStockDTO.java
  67. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/PopularUrlDto.java
  68. 19
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SalesOrderDto.java
  69. 22
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/GoodsAttributeForm.java
  70. 54
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/GoodsCategoryAttributeForm.java
  71. 81
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/GoodsForm.java
  72. 18
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/CustomAddressQueryCriteria.java
  73. 40
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/GoodsPageQuery.java
  74. 53
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/GoodsCategoryVO.java
  75. 80
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/GoodsDetailVO.java
  76. 85
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/GoodsPageVO.java
  77. 113
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallGoodsDetailVO.java
  78. 32
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallGoodsPageVO.java
  79. 21
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/CartService.java
  80. 11
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/CustomAddressService.java
  81. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/GoodsBrandService.java
  82. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/GoodsInStockService.java
  83. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/MallService.java
  84. 10
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/PopularUrlGoodsService.java
  85. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/PopularUrlService.java
  86. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/RoleSettingService.java
  87. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SalesOrderItemService.java
  88. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SalesOrderService.java
  89. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/UserClockInService.java
  90. 8
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/UserMallService.java
  91. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsAttributeService.java
  92. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsCategoryAttributeService.java
  93. 7
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsCategoryBrandService.java
  94. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsCategoryService.java
  95. 87
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsService.java
  96. 66
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsStockService.java
  97. 31
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IAddressService.java
  98. 17
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java
  99. 135
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/CartServiceImpl.java
  100. 33
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/CustomAddressServiceImpl.java

5
hiver-admin/pom.xml

@ -43,6 +43,11 @@
<artifactId>hiver-open</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>cc.hiver</groupId>
<artifactId>hiver-mall</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!-- 数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>

2
hiver-admin/src/main/resources/application.yml

@ -283,6 +283,8 @@ ignored:
- /hiver/iot/sensorHelper/**
- /hiver/goview/visual/**
- /hiver/license/verifyLicense
# 临时增加
- /hiver/app/**
# 限流及黑名单不拦截的路径
limitUrls:
- /**/*.js

16
hiver-admin/test-output/test-report.html

@ -35,7 +35,7 @@
<a href="#"><span class="badge badge-primary">Hiver</span></a>
</li>
<li class="m-r-10">
<a href="#"><span class="badge badge-primary">六月 27, 2023 11:49:37</span></a>
<a href="#"><span class="badge badge-primary">七月 31, 2023 23:25:57</span></a>
</li>
</ul>
</div>
@ -84,7 +84,7 @@
<div class="test-detail">
<span class="meta text-white badge badge-sm"></span>
<p class="name">passTest</p>
<p class="text-sm"><span>11:49:37 上</span> / <span>0.017 secs</span></p>
<p class="text-sm"><span>23:25:57 下</span> / <span>0.01 secs</span></p>
</div>
<div class="test-contents d-none">
<div class="detail-head">
@ -92,9 +92,9 @@
<div class="info">
<div class='float-right'><span class='badge badge-default'>#test-id=1</span></div>
<h5 class="test-status text-pass">passTest</h5>
<span class='badge badge-success'>06.27.2023 11:49:37</span>
<span class='badge badge-danger'>06.27.2023 11:49:37</span>
<span class='badge badge-default'>0.017 secs</span>
<span class='badge badge-success'>07.31.2023 23:25:57</span>
<span class='badge badge-danger'>07.31.2023 23:25:57</span>
<span class='badge badge-default'>0.01 secs</span>
</div>
<div class="m-t-10 m-l-5"></div>
</div>
@ -104,7 +104,7 @@
<tbody>
<tr class="event-row">
<td><span class="badge log pass-bg">Pass</span></td>
<td>11:49:37</td>
<td>23:25:57</td>
<td>
Test passed
</td>
@ -128,13 +128,13 @@
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Started</p>
<h3>六月 27, 2023 11:49:37</h3>
<h3>七月 31, 2023 23:25:57</h3>
</div></div>
</div>
<div class="col-md-3">
<div class="card"><div class="card-body">
<p class="m-b-0">Ended</p>
<h3>六月 27, 2023 11:49:38</h3>
<h3>七月 31, 2023 23:25:57</h3>
</div></div>
</div>
<div class="col-md-3">

68
hiver-core/src/main/java/cc/hiver/core/base/HiverBaseMallEntity.java

@ -0,0 +1,68 @@
package cc.hiver.core.base;
import cc.hiver.core.common.constant.CommonConstant;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;
@Data
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@JsonIgnoreProperties(value = {"hibernateLazyInitializer", "handler", "fieldHandler"})
public abstract class HiverBaseMallEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@TableId
@ApiModelProperty(value = "唯一标识")
private String id = SnowFlakeUtil.nextId().toString();
@ApiModelProperty("店铺id")
private String mallId;
@ApiModelProperty("办公区域")
private String region;
@ApiModelProperty(value = "创建者")
@CreatedBy
@TableField(fill = FieldFill.INSERT)
private String createBy;
@CreatedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新者")
@LastModifiedBy
@TableField(fill = FieldFill.UPDATE)
private String updateBy;
@LastModifiedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新时间")
@TableField(fill = FieldFill.UPDATE)
private Date updateTime;
@ApiModelProperty(value = "删除标志 默认0")
private Integer delFlag = CommonConstant.STATUS_NORMAL;
}

33
hiver-core/src/main/java/cc/hiver/core/base/HiverBasePageQuery.java

@ -0,0 +1,33 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.core.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Yazhi Li
*/
@Data
@ApiModel
public class HiverBasePageQuery {
@ApiModelProperty(value = "页码", example = "1")
private int pageNum = 1;
@ApiModelProperty(value = "每页记录数", example = "10")
private int pageSize = 10;
}

10
hiver-core/src/main/java/cc/hiver/core/common/constant/CommonConstant.java

@ -125,4 +125,14 @@ public interface CommonConstant {
* 部门负责人类型 副负责人
*/
Integer HEADER_TYPE_VICE = 1;
/**
*
*/
Integer STATUS_YES = 1;
/**
*
*/
Integer STATUS_NO = 0;
}

48
hiver-core/src/main/java/cc/hiver/core/common/constant/MallConstant.java

@ -0,0 +1,48 @@
package cc.hiver.core.common.constant;
/**
* 商城静态常量
*
* @author Yazhi Li
*/
public interface MallConstant {
/**
* 上架
*/
Integer GOODS_PUT_ON_SALE = 0;
/**
* 下架
*/
Integer GOODS_PULL_ON_SALE = -1;
/**
* 销售单处理中
*/
Integer SALES_ORDER_PROCESS = 0;
/**
* 销售单临时保存
*/
Integer SALES_ORDER_SAVED = 1;
/**
* 订单锁定的商品列表key前缀
*/
String ORDER_LOCKED_SKUS_PREFIX = "order:locked:goods:";
/**
* 商品分布式锁key前缀
*/
String SKU_LOCK_PREFIX = "product:stock:lock:";
/**
* 临时规格ID前缀
*/
String SPEC_TEMP_ID_PREFIX = "tid_";
/**
* 会员购物车缓存KEY前缀
*/
String MEMBER_CART_PREFIX = "MEMBER:CART:";
}

52
hiver-core/src/main/java/cc/hiver/core/vo/Option.java

@ -0,0 +1,52 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.core.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author Yazhi Li
*/
@ApiModel("下拉选项对象")
@Data
@NoArgsConstructor
public class Option<T> {
public Option(T value, String label) {
this.value = value;
this.label = label;
}
public Option(T value, String label, List<Option> children) {
this.value = value;
this.label = label;
this.children= children;
}
@ApiModelProperty("选项的值")
private T value;
@ApiModelProperty("选项的标签")
private String label;
@JsonInclude(value = JsonInclude.Include.NON_EMPTY)
private List<Option> children;
}

13
hiver-modules/hiver-mall/pom.xml

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>cc.hiver</groupId>
<artifactId>hiver-modules</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<name>商城模块</name>
<artifactId>hiver-mall</artifactId>
</project>

30
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/common/AttributeTypeEnum.java

@ -0,0 +1,30 @@
package cc.hiver.mall.common;
import lombok.Getter;
public enum AttributeTypeEnum {
SPEC(1, "规格"),
ATTR(2, "属性");
AttributeTypeEnum(int value, String name) {
this.value = value;
this.name = name;
}
@Getter
private Integer value;
@Getter
private String name;
public static AttributeTypeEnum getByValue(Integer value) {
AttributeTypeEnum attributeTypeEnum = null;
for (AttributeTypeEnum item : values()) {
if (item.getValue().equals(value)) {
attributeTypeEnum = item;
}
}
return attributeTypeEnum;
}
}

70
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/AddressController.java

@ -0,0 +1,70 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.Address;
import cc.hiver.mall.service.mybatis.IAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "收货地址接口")
@RequestMapping(value = "/hiver/app/address/")
@Transactional
public class AddressController {
@Autowired
private IAddressService addressService;
@RequestMapping(value = "/getAll/{memberId}", method = RequestMethod.GET)
@ApiOperation(value = "根据会员id获得收货地址列表")
public Result getAllByMemberId(@ApiParam("会员ID") @PathVariable String memberId) {
List<Address> list = addressService.listCurrentMemberAddresses(memberId);
return ResultUtil.data(list);
}
@RequestMapping(value = "/{addressId}", method = RequestMethod.GET)
@ApiOperation(value = "通过id获取")
public Result<Address> get(@ApiParam("地址ID") @PathVariable String addressId) {
Address data = addressService.getById(addressId);
return new ResultUtil<Address>().setData(data);
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(value = "保存数据")
public Result addAddress(Address entity) {
boolean result = addressService.addAddress(entity);
if(result) {
return ResultUtil.success("添加成功");
} else {
return ResultUtil.error("添加失败");
}
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "更新数据")
public Result updateAddress(Address entity) {
boolean result = addressService.updateAddress(entity);
if(result) {
return ResultUtil.success("更新成功");
} else {
return ResultUtil.error("更新失败");
}
}
@RequestMapping(value = "/delByIds", method = RequestMethod.POST)
@ApiOperation(value = "批量通过ids删除")
public Result delByIds(@RequestParam String[] ids) {
for (String id : ids) {
addressService.removeById(id);
}
return ResultUtil.success("批量通过id删除数据成功");
}
}

63
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/CustomAddressController.java

@ -0,0 +1,63 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.PageUtil;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.CustomAddress;
import cc.hiver.mall.service.CustomAddressService;
import cc.hiver.mall.pojo.query.CustomAddressQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@Api(tags = "客户地址接口")
@RequestMapping(value = "/hiver/app/customAddress/")
@Transactional
public class CustomAddressController {
@Autowired
private CustomAddressService customAddressService;
@RequestMapping(value = "/getByCondition", method = RequestMethod.POST)
@ApiOperation(value = "根据条件获得分页")
public Result<Page<CustomAddress>> queryAll(CustomAddressQueryCriteria criteria, PageVo pageVo) {
Page<CustomAddress> users = customAddressService.queryAll(criteria, PageUtil.initPage(pageVo));
return new ResultUtil<Page<CustomAddress>>().setData(users);
}
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
@ApiOperation(value = "通过id获取")
public Result<CustomAddress> get(@PathVariable String id) {
CustomAddress data = customAddressService.findById(id);
return new ResultUtil<CustomAddress>().setData(data);
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(value = "保存数据")
public Result<CustomAddress> save(CustomAddress entity) {
CustomAddress address = customAddressService.save(entity);
return new ResultUtil<CustomAddress>().setData(address);
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "更新数据")
public Result<CustomAddress> edit(CustomAddress entity) {
CustomAddress address = customAddressService.update(entity);
return new ResultUtil<CustomAddress>().setData(address);
}
@RequestMapping(value = "/delByIds", method = RequestMethod.POST)
@ApiOperation(value = "批量通过ids删除")
public Result delByIds(@RequestParam String[] ids) {
for (String id : ids) {
customAddressService.delete(id);
}
return ResultUtil.success("批量通过id删除数据成功");
}
}

71
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsAttributeController.java

@ -0,0 +1,71 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.GoodsCategoryAttribute;
import cc.hiver.mall.pojo.form.GoodsCategoryAttributeForm;
import cc.hiver.mall.service.mybatis.GoodsCategoryAttributeService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author Yazhi Li
*/
@Slf4j
@RestController
@Api(tags = "商品规格接口")
@RequestMapping(value = "/hiver/app/attribute/")
@Transactional
public class GoodsAttributeController {
@Autowired
private GoodsCategoryAttributeService goodsCategoryAttributeService;
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(value = "属性列表")
public Result<List<GoodsCategoryAttribute>> listAttributes(
@ApiParam("商品分类ID") Long categoryId,
@ApiParam("类型(1:规格;2:属性)") Integer type
) {
List<GoodsCategoryAttribute> list = goodsCategoryAttributeService.list(new LambdaQueryWrapper<GoodsCategoryAttribute>()
.eq(categoryId != null, GoodsCategoryAttribute::getCategoryId, categoryId)
.eq(type != null, GoodsCategoryAttribute::getType, type)
);
return new ResultUtil<List<GoodsCategoryAttribute>>().setData(list);
}
@RequestMapping(value = "/batch", method = RequestMethod.POST)
@ApiOperation(value = "批量新增/修改")
public Result saveBatch(GoodsCategoryAttributeForm goodsCategoryAttributeForm) {
boolean result = goodsCategoryAttributeService.saveBatch(goodsCategoryAttributeForm);
if(result) {
return ResultUtil.success("批量处理成功");
} else {
return ResultUtil.error("批量处理失败");
}
}
}

47
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsBrandController.java

@ -0,0 +1,47 @@
package cc.hiver.mall.controller;
import cc.hiver.core.base.HiverBaseController;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.core.common.utils.PageUtil;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.PageVo;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.GoodsBrand;
import cc.hiver.mall.service.GoodsBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* 商品品牌控制器
*
* @author Yazhi Li
*/
@Slf4j
@RestController
@Api(tags = "商品品牌接口")
@RequestMapping(value = "/hiver/app/brand/")
@Transactional
public class GoodsBrandController extends HiverBaseController<GoodsBrand, String> {
@Autowired
private GoodsBrandService goodsBrandService;
@Override
public HiverBaseService<GoodsBrand, String> getService() {
return goodsBrandService;
}
@RequestMapping(value = "/getByCondition", method = RequestMethod.GET)
@ApiOperation(value = "多条件分页获取品牌列表")
public Result<Page<GoodsBrand>> getByCondition(GoodsBrand goodsBrand,
PageVo pageVo) {
Page<GoodsBrand> page = goodsBrandService.findByCondition(goodsBrand, PageUtil.initPage(pageVo));
return new ResultUtil<Page<GoodsBrand>>().setData(page);
}
}

107
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCartController.java

@ -0,0 +1,107 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.utils.SecurityUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.pojo.dto.CartItemDTO;
import cc.hiver.mall.service.CartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author Yazhi Li
*/
@Slf4j
@RestController
@Api(tags = "销售单接口")
@RequestMapping(value = "/hiver/app/cart/")
@Transactional
public class GoodsCartController {
@Autowired
private CartService cartService;
@Autowired
private SecurityUtil securityUtil;
@RequestMapping(value = "/get", method = RequestMethod.GET)
@ApiOperation(value = "查询购物车")
public Result<List<CartItemDTO>> getCart() {
List<CartItemDTO> result = cartService.listCartItems(securityUtil.getCurrUser().getId());
return new ResultUtil<List<CartItemDTO>>().setData(result);
}
@RequestMapping(value = "/delete", method = RequestMethod.POST)
@ApiOperation(value = "删除购物车")
public Result deleteCart() {
boolean result = cartService.deleteCart(securityUtil.getCurrUser().getId());
if(result) {
return ResultUtil.success("删除成功");
} else {
return ResultUtil.error("删除失败");
}
}
@RequestMapping(value = "/add", method = RequestMethod.POST)
@ApiOperation(value = "添加购物车商品")
public Result addCartItem(String skuId) {
cartService.addCartItem(skuId, securityUtil.getCurrUser().getId());
return ResultUtil.success();
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "更新购物车商品")
public Result updateCartItem(CartItemDTO cartItem) {
boolean result = cartService.updateCartItem(cartItem, securityUtil.getCurrUser().getId());
if(result) {
return ResultUtil.success("更新成功");
} else {
return ResultUtil.error("更新失败");
}
}
@RequestMapping(value = "/item/delete", method = RequestMethod.POST)
@ApiOperation(value = "删除购物车商品")
public <T> Result<T> removeCartItem(String goodsStockId) {
boolean result = cartService.removeCartItem(goodsStockId, securityUtil.getCurrUser().getId());
if(result) {
return ResultUtil.success("删除成功");
} else {
return ResultUtil.error("删除失败");
}
}
@RequestMapping(value = "/_check", method = RequestMethod.POST)
@ApiOperation(value = "全选/全不选购物车商品")
public Result check(@ApiParam("全选/全不选") boolean checked) {
boolean result = cartService.checkAll(checked, securityUtil.getCurrUser().getId());
if(result) {
return ResultUtil.success("设置成功");
} else {
return ResultUtil.error("设置失败");
}
}
}

87
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsCategoryController.java

@ -0,0 +1,87 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.core.vo.Option;
import cc.hiver.mall.entity.GoodsCategory;
import cc.hiver.mall.entity.GoodsCategoryAttribute;
import cc.hiver.mall.pojo.vo.GoodsCategoryVO;
import cc.hiver.mall.service.mybatis.GoodsCategoryAttributeService;
import cc.hiver.mall.service.mybatis.GoodsCategoryService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "商品分类接口")
@RequestMapping(value = "/hiver/app/goodsCategory/")
@Transactional
public class GoodsCategoryController {
@Autowired
private GoodsCategoryService goodsCategoryService;
@Autowired
private GoodsCategoryAttributeService goodsCategoryAttributeService;
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(value = "根据parentId获得商品分类列表")
public Result<List<GoodsCategoryVO>> list(@ApiParam("上级分类ID") String parentId) {
List<GoodsCategoryVO> list = goodsCategoryService.listCategory(parentId);
return new ResultUtil<List<GoodsCategoryVO>>().setData(list);
}
@RequestMapping(value = "/getAll", method = RequestMethod.GET)
@ApiOperation(value = "获得商品分类列表")
public Result<List<GoodsCategoryVO>> getAll() {
List<GoodsCategoryVO> list = goodsCategoryService.listCategory(null);
return new ResultUtil<List<GoodsCategoryVO>>().setData(list);
}
@RequestMapping(value = "/options", method = RequestMethod.GET)
@ApiOperation(value = "商品分类级联列表")
public Result<List<Option>> listCategoryOptions() {
List<Option> list = goodsCategoryService.listCategoryOptions();
return new ResultUtil<List<Option>>().setData(list);
}
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
@ApiOperation(value = "商品分类详情")
public Result<GoodsCategory> get(@PathVariable String id) {
GoodsCategory data = goodsCategoryService.getById(id);
return new ResultUtil<GoodsCategory>().setData(data);
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(value = "新增商品分类")
public Result<String> save(GoodsCategory entity) {
String id = goodsCategoryService.saveCategory(entity);
return ResultUtil.success(id);
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "修改商品分类")
public Result<String> edit(GoodsCategory entity) {
String id = goodsCategoryService.saveCategory(entity);
return ResultUtil.success(id);
}
@RequestMapping(value = "/delByIds", method = RequestMethod.POST)
@ApiOperation(value = "删除商品分类")
@CacheEvict(value = "mall", key = "'categoryList'")
public Result delByIds(@RequestParam String[] ids) {
for (String id : ids) {
goodsCategoryAttributeService.remove(new LambdaQueryWrapper<GoodsCategoryAttribute>().eq(GoodsCategoryAttribute::getCategoryId, id));
goodsCategoryService.removeById(id);
}
return ResultUtil.success("批量通过id删除数据成功");
}
}

90
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsController.java

@ -0,0 +1,90 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.pojo.form.GoodsForm;
import cc.hiver.mall.pojo.query.GoodsPageQuery;
import cc.hiver.mall.pojo.vo.GoodsDetailVO;
import cc.hiver.mall.pojo.vo.GoodsPageVO;
import cc.hiver.mall.pojo.vo.MallGoodsDetailVO;
import cc.hiver.mall.pojo.vo.MallGoodsPageVO;
import cc.hiver.mall.service.mybatis.GoodsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@Api(tags = "商品接口")
@RequestMapping(value = "/hiver/app/goods/")
@Transactional
public class GoodsController {
@Autowired
private GoodsService goodsService;
@RequestMapping(value = "/listGoodsPages", method = RequestMethod.POST)
@ApiOperation(value = "商品分页列表")
public Result<IPage<GoodsPageVO>> listGoodsPages(GoodsPageQuery queryParams) {
IPage<GoodsPageVO> result = goodsService.listGoodsPages(queryParams);
return new ResultUtil<IPage<GoodsPageVO>>().setData(result);
}
@RequestMapping(value = "/getGoodsDetail/{id}", method = RequestMethod.GET)
@ApiOperation(value = "商品详情")
public Result<GoodsDetailVO> getGoodsDetail(@ApiParam("商品ID") @PathVariable String id) {
GoodsDetailVO goodsDetailVO = goodsService.getGoodsDetail(id);
return new ResultUtil<GoodsDetailVO>().setData(goodsDetailVO);
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(value = "新增商品")
public Result addSpu(GoodsForm formData) {
boolean result = goodsService.addGoods(formData);
if(result) {
return ResultUtil.success("添加成功");
} else {
return ResultUtil.error("添加失败");
}
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "修改商品")
public Result updateSpuById(GoodsForm formData) {
boolean result = goodsService.updateGoods(formData);
if(result) {
return ResultUtil.success("修改成功");
} else {
return ResultUtil.error("修改失败");
}
}
@RequestMapping(value = "/delByIds", method = RequestMethod.POST)
@ApiOperation(value = "删除商品")
public Result delete(@RequestParam String[] ids) {
boolean result = goodsService.removeByGoodsIds(ids);
if(result) {
return ResultUtil.success("删除成功");
} else {
return ResultUtil.error("删除失败");
}
}
@RequestMapping(value = "/listMallGoodsPages", method = RequestMethod.POST)
@ApiOperation(value = "商品分页列表")
public Result listMallGoodsPages(GoodsPageQuery queryParams) {
IPage<MallGoodsPageVO> result = goodsService.listMallGoodsPages(queryParams);
return new ResultUtil<IPage<MallGoodsPageVO>>().setData(result);
}
@RequestMapping(value = "/getMallGoodsDetail/{id}", method = RequestMethod.GET)
@ApiOperation(value = "获取商品详情")
public Result<MallGoodsDetailVO> getMallGoodsDetail(@ApiParam("商品ID") @PathVariable String id) {
MallGoodsDetailVO mallGoodsDetailVO = goodsService.getMallGoodsDetail(id);
return new ResultUtil<MallGoodsDetailVO>().setData(mallGoodsDetailVO);
}
}

111
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/GoodsStockController.java

@ -0,0 +1,111 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.GoodsInStock;
import cc.hiver.mall.entity.GoodsStock;
import cc.hiver.mall.pojo.dto.CheckPriceDTO;
import cc.hiver.mall.pojo.dto.LockStockDTO;
import cc.hiver.mall.service.GoodsInStockService;
import cc.hiver.mall.service.mybatis.GoodsStockService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@Api(tags = "商品库存接口")
@RequestMapping(value = "/hiver/app/goodsStock/")
@Transactional
public class GoodsStockController {
@Autowired
private GoodsStockService goodsStockService;
@Autowired
private GoodsInStockService goodsInStockService;
@RequestMapping(value = "/stockIn", method = RequestMethod.POST)
@ApiOperation(value = "入库操作")
public Result save(GoodsInStock entity) {
goodsInStockService.save(entity);
GoodsStock goodsStock = goodsStockService.getById(entity.getGoodsStockId());
goodsStock.setStock(goodsStock.getStock() + entity.getNum());
goodsStockService.updateStockNum(entity.getGoodsStockId(), goodsStock.getStock()+entity.getNum());
return ResultUtil.success();
}
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
@ApiOperation(value = "获得库存详细")
public Result<GoodsStock> getStockDetail(@PathVariable String id) {
GoodsStock goodsStock = goodsStockService.getById(id);
return new ResultUtil<GoodsStock>().setData(goodsStock);
}
@RequestMapping(value = "/{id}/stock_num", method = RequestMethod.GET)
@ApiOperation(value = "获得库存数量")
public Result<Integer> getStockNum(@PathVariable String id) {
Integer stockNum = goodsStockService.getStockNum(id);
return new ResultUtil<Integer>().setData(stockNum);
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "修改库存信息")
public Result updateStock(GoodsStock goodsStock) {
boolean result = goodsStockService.updateById(goodsStock);
if(result) {
return ResultUtil.success("修改成功");
} else {
return ResultUtil.error("修改失败");
}
}
@RequestMapping(value = "/_lock", method = RequestMethod.POST)
@ApiOperation(value = "锁定库存")
public Result lockStock(LockStockDTO lockStockDTO) {
boolean result = goodsStockService.lockStock(lockStockDTO);
if(result) {
return ResultUtil.success("锁定库存成功");
} else {
return ResultUtil.error("锁定库存失败");
}
}
@RequestMapping(value = "/_unlock", method = RequestMethod.POST)
@ApiOperation(value = "解锁库存")
public Result<Boolean> unlockStock(String orderToken) {
boolean result = goodsStockService.unlockStock(orderToken);
if(result) {
return ResultUtil.success("解锁库存成功");
} else {
return ResultUtil.error("解锁库存失败");
}
}
@RequestMapping(value = "/_deduct", method = RequestMethod.POST)
@ApiOperation(value = "扣减库存")
public Result<Boolean> deductStock(String orderToken) {
boolean result = goodsStockService.deductStock(orderToken);
if(result) {
return ResultUtil.success("扣减库存成功");
} else {
return ResultUtil.error("扣减库存失败");
}
}
@RequestMapping(value = "/price/_check", method = RequestMethod.POST)
@ApiOperation(value = "商品验价")
public Result<Boolean> checkPrice(CheckPriceDTO checkPriceDTO) {
boolean result = goodsStockService.checkPrice(checkPriceDTO);
if(result) {
return ResultUtil.success("商品验价成功");
} else {
return ResultUtil.error("商品验价失败");
}
}
}

83
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/MallController.java

@ -0,0 +1,83 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.Mall;
import cc.hiver.mall.entity.UserMall;
import cc.hiver.mall.service.MallService;
import cc.hiver.mall.service.UserMallService;
import cc.hiver.mall.service.mybatis.IMallService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@Api(tags = "商铺接口")
@RequestMapping(value = "/hiver/app/mall/")
@Transactional
public class MallController {
@Autowired
private MallService mallService;
@Autowired
private UserMallService userMallService;
@Autowired
private IMallService iMallService;
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
@ApiOperation(value = "通过id获取")
public Result<Mall> get(@PathVariable String id) {
Mall data = mallService.findById(id);
return new ResultUtil<Mall>().setData(data);
}
@RequestMapping(value = "/save", method = RequestMethod.POST)
@ApiOperation(value = "保存数据")
public Result<Mall> save(Mall entity) {
Mall mall = mallService.save(entity);
return new ResultUtil<Mall>().setData(mall);
}
@RequestMapping(value = "/edit", method = RequestMethod.POST)
@ApiOperation(value = "更新数据")
public Result<Mall> edit(Mall entity) {
Mall mall = mallService.update(entity);
return new ResultUtil<Mall>().setData(mall);
}
@RequestMapping(value = "/delByIds", method = RequestMethod.POST)
@ApiOperation(value = "批量通过ids删除")
public Result delByIds(@RequestParam String[] ids) {
for (String id : ids) {
mallService.delete(id);
}
return ResultUtil.success("批量通过id删除数据成功");
}
@RequestMapping(value = "/set", method = RequestMethod.POST)
@ApiOperation(value = "设置用户对应商铺")
public Result save(String mallId, List<String> userIds) {
userMallService.deleteAllByMallId(mallId);
for(String userId : userIds) {
UserMall userMall = new UserMall();
userMall.setMallId(mallId);
userMall.setUserId(userId);
userMallService.save(userMall);
}
return ResultUtil.success();
}
@RequestMapping(value = "/getAll", method = RequestMethod.GET)
@ApiOperation(value = "根据会员id获得商铺列表")
public Result getAllByUserId(String userId) {
List<Mall> list = iMallService.findByUserId(userId);
return ResultUtil.data(list);
}
}

49
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/PopularUrlController.java

@ -0,0 +1,49 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.pojo.dto.PopularUrlDto;
import cc.hiver.mall.entity.PopularUrlGoods;
import cc.hiver.mall.service.PopularUrlGoodsService;
import cc.hiver.mall.service.PopularUrlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@Api(tags = "热销商品接口")
@RequestMapping(value = "/hiver/app/popularUrl/")
@Transactional
public class PopularUrlController {
@Autowired
private PopularUrlService popularUrlService;
@Autowired
private PopularUrlGoodsService popularUrlGoodsService;
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ApiOperation(value = "创建分享链接")
public Result<String> create(PopularUrlDto entity) {
popularUrlService.save(entity.getUrl());
for(PopularUrlGoods good : entity.getGoodsList()) {
popularUrlGoodsService.save(good);
}
return ResultUtil.data(entity.getUrl().getUrl());
}
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
@ApiOperation(value = "通过id获取")
public Result<PopularUrlDto> get(@PathVariable String id) {
PopularUrlDto data = new PopularUrlDto();
data.setUrl(popularUrlService.get(id));
data.setGoodsList(popularUrlGoodsService.findAllByUrlId(id));
return new ResultUtil<PopularUrlDto>().setData(data);
}
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/RoleSettingController.java

@ -0,0 +1,19 @@
package cc.hiver.mall.controller;
import cc.hiver.mall.service.RoleSettingService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@Api(tags = "角色配置接口")
@RequestMapping(value = "/hiver/app/roleSetting/")
@Transactional
public class RoleSettingController {
@Autowired
private RoleSettingService roleSettingService;
}

33
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/UserClockInController.java

@ -0,0 +1,33 @@
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.UserClockIn;
import cc.hiver.mall.service.UserClockInService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@Slf4j
@RestController
@Api(tags = "用户打卡接口")
@RequestMapping(value = "/hiver/app/clockIn")
@Transactional
public class UserClockInController {
@Autowired
private UserClockInService userClockInService;
@RequestMapping(value = "/", method = RequestMethod.GET)
@ApiOperation(value = "打卡操作")
public Result clockIn(String userId) {
UserClockIn userClockIn = new UserClockIn();
userClockIn.setUserId(userId);
userClockInService.save(userClockIn);
return ResultUtil.success();
}
}

15
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/converter/GoodsAttributeConverter.java

@ -0,0 +1,15 @@
package cc.hiver.mall.converter;
import cc.hiver.mall.entity.GoodsAttribute;
import cc.hiver.mall.pojo.form.GoodsAttributeForm;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
@Mapper(componentModel = "spring")
public interface GoodsAttributeConverter {
@Mappings({
@Mapping(target = "id",ignore = true)
})
GoodsAttribute form2Entity(GoodsAttributeForm form);
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/converter/GoodsConverter.java

@ -0,0 +1,19 @@
package cc.hiver.mall.converter;
import cc.hiver.mall.entity.Goods;
import cc.hiver.mall.pojo.form.GoodsForm;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
@Mapper(componentModel = "spring")
public interface GoodsConverter {
@Mappings({
@Mapping(target = "album", source = "subPicUrls")
})
Goods form2Entity(GoodsForm form);
@InheritInverseConfiguration(name="form2Entity")
GoodsForm entity2Form(Goods entity);
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/CustomAddressDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.CustomAddress;
public interface CustomAddressDao extends HiverBaseDao<CustomAddress, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/GoodsBrandDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.GoodsBrand;
public interface GoodsBrandDao extends HiverBaseDao<GoodsBrand, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/GoodsInStockDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.GoodsInStock;
public interface GoodsInStockDao extends HiverBaseDao<GoodsInStock, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/MallDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.Mall;
public interface MallDao extends HiverBaseDao<Mall, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/PopularUrlDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.PopularUrl;
public interface PopularUrlDao extends HiverBaseDao<PopularUrl, String> {
}

10
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/PopularUrlGoodsDao.java

@ -0,0 +1,10 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.PopularUrlGoods;
import java.util.List;
public interface PopularUrlGoodsDao extends HiverBaseDao<PopularUrlGoods, String> {
List<PopularUrlGoods> findAllByUrlId(String urlId);
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/RoleSettingDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.RoleSetting;
public interface RoleSettingDao extends HiverBaseDao<RoleSetting, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SalesOrderDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.SalesOrder;
public interface SalesOrderDao extends HiverBaseDao<SalesOrder, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/SalesOrderItemDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.SalesOrderItem;
public interface SalesOrderItemDao extends HiverBaseDao<SalesOrderItem, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/UserClockInDao.java

@ -0,0 +1,7 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.UserClockIn;
public interface UserClockInDao extends HiverBaseDao<UserClockIn, String> {
}

8
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/UserMallDao.java

@ -0,0 +1,8 @@
package cc.hiver.mall.dao;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.mall.entity.UserMall;
public interface UserMallDao extends HiverBaseDao<UserMall, String> {
void deleteAllByMallId(String mallId);
}

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/AddressMapper.java

@ -0,0 +1,16 @@
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.Address;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface AddressMapper extends BaseMapper<Address> {
@Select("<script>" +
" SELECT m.* from t_address m where m.member_id =#{memberId} " +
"</script>")
List<Address> listByMemberId(String memberId);
}

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsAttributeMapper.java

@ -0,0 +1,27 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.GoodsAttribute;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Yazhi Li
*/
@Mapper
public interface GoodsAttributeMapper extends BaseMapper<GoodsAttribute> {
}

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsCategoryAttributeMapper.java

@ -0,0 +1,27 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.GoodsCategoryAttribute;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Yazhi Li
*/
@Mapper
public interface GoodsCategoryAttributeMapper extends BaseMapper<GoodsCategoryAttribute> {
}

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsCategoryBrandMapper.java

@ -0,0 +1,27 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.GoodsCategoryBrand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Yazhi Li
*/
@Mapper
public interface GoodsCategoryBrandMapper extends BaseMapper<GoodsCategoryBrand> {
}

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsCategoryMapper.java

@ -0,0 +1,27 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.GoodsCategory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Yazhi Li
*/
@Mapper
public interface GoodsCategoryMapper extends BaseMapper<GoodsCategory> {
}

51
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsMapper.java

@ -0,0 +1,51 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.Goods;
import cc.hiver.mall.pojo.query.GoodsPageQuery;
import cc.hiver.mall.pojo.vo.GoodsPageVO;
import cc.hiver.mall.pojo.vo.MallGoodsPageVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @author Yazhi Li
*/
@Mapper
public interface GoodsMapper extends BaseMapper<Goods> {
/**
* 商品分页列表管理用
*
* @param page
* @param queryParams
* @return
*/
List<GoodsPageVO> listGoodsPages(Page<GoodsPageVO> page, @Param("queryParams") GoodsPageQuery queryParams);
/**
* 商品分页列表商铺用
*
* @param page
* @param queryParams
* @return
*/
List<MallGoodsPageVO> listMallGoodsPages(Page<MallGoodsPageVO> page, @Param("queryParams") GoodsPageQuery queryParams);
}

35
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/GoodsStockMapper.java

@ -0,0 +1,35 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.GoodsStock;
import cc.hiver.mall.pojo.dto.GoodsStockDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* @author Yazhi Li
*/
@Mapper
public interface GoodsStockMapper extends BaseMapper<GoodsStock> {
/**
* 获取商品库存单元信息
*
* @param id
* @return
*/
GoodsStockDto getStockInfo(String id);
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/MallMapper.java

@ -0,0 +1,19 @@
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.Mall;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MallMapper extends BaseMapper<Mall> {
/**
* 通过用户id获取
*
* @param userId
* @return
*/
List<Mall> findByUserId(@Param("userId") String userId);
}

44
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Address.java

@ -0,0 +1,44 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_address")
@TableName("t_address")
@ApiModel(value = "收获地址表")
public class Address extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "会员ID")
private String memberId;
@ApiModelProperty(value = "'收货人姓名")
private String consigneeName;
@ApiModelProperty(value = "收货人联系方式")
private String consigneeMobile;
@ApiModelProperty(value = "收货人所属区域")
private String consigneeArea;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "邮编")
private String zipCode;
@ApiModelProperty(value = "是否默认地址")
private Integer defaulted;
}

44
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/CustomAddress.java

@ -0,0 +1,44 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_custom_address")
@TableName("t_custom_address")
@ApiModel(value = "客户地址表")
public class CustomAddress extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户ID")
private String userId;
@ApiModelProperty(value = "收货人姓名")
private String consigneeName;
@ApiModelProperty(value = "收货人联系方式")
private String consigneeMobile;
@ApiModelProperty(value = "收货人公司")
private String consigneeCompany;
@ApiModelProperty(value = "收货人所属区域")
private String consigneeArea;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "邮编")
private String zipCode;
}

71
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Goods.java

@ -0,0 +1,71 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import cc.hiver.core.common.constant.MallConstant;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods")
@TableName("t_goods")
@ApiModel(value = "商品表")
public class Goods extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品类型ID")
private String categoryId;
@ApiModelProperty(value = "商品品牌ID")
private String brandId;
@ApiModelProperty(value = "采购价")
@Column(precision = 10, scale = 2)
private BigDecimal purchasePrice = new BigDecimal(0);
@ApiModelProperty(value = "市场价")
@Column(precision = 10, scale = 2)
private BigDecimal price = new BigDecimal(0);
@ApiModelProperty(value = "批发价")
@Column(precision = 10, scale = 2)
private BigDecimal wholesalePrice = new BigDecimal(0);
@ApiModelProperty(value = "销量")
private Integer sales;
@ApiModelProperty(value = "商品主图")
private String picUrl;
@ApiModelProperty(value = "视频地址")
private String videoUrl;
@ApiModelProperty(value = "商品图册")
private String[] album;
@ApiModelProperty(value = "单位")
private String unit;
@ApiModelProperty(value = "商品简介")
private String description;
@ApiModelProperty(value = "商品详情")
private String detail;
@ApiModelProperty(value = "是否启用 0上架 -1下架")
private Integer status = MallConstant.GOODS_PUT_ON_SALE;
}

41
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsAttribute.java

@ -0,0 +1,41 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_attribute")
@TableName("t_goods_attribute")
@ApiModel(value = "商品属性/规格表")
public class GoodsAttribute extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商品ID")
private String goodsId;
@ApiModelProperty(value = "属性ID")
private String attributeId;
@ApiModelProperty(value = "属性名称")
private String name;
@ApiModelProperty(value = "属性值")
private String value;
@ApiModelProperty(value = "类型(1:规格;2:属性;)")
private Integer type;
@ApiModelProperty(value = "规格图片")
private String picUrl;
}

39
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsBrand.java

@ -0,0 +1,39 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import cc.hiver.core.common.constant.CommonConstant;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_brand")
@TableName("t_goods_brand")
@ApiModel(value = "商品品牌表")
public class GoodsBrand extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "品牌名称")
private String name;
@ApiModelProperty(value = "LOGO图片")
private String logoUrl;
@ApiModelProperty(value = "排序值")
@Column(precision = 10, scale = 2)
private BigDecimal sortOrder;
@ApiModelProperty(value = "是否启用 0启用 -1禁用")
private Integer status = CommonConstant.STATUS_NORMAL;
}

46
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsCategory.java

@ -0,0 +1,46 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import cc.hiver.core.common.constant.CommonConstant;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_category")
@TableName("t_goods_category")
@ApiModel(value = "商品分类表")
public class GoodsCategory extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商品分类名称")
private String name;
@ApiModelProperty(value = "父级ID")
@Column(nullable = false)
private String parentId;
@ApiModelProperty(value = "层级")
private Integer level;
@ApiModelProperty(value = "图标地址")
private String iconUrl;
@ApiModelProperty(value = "排序值")
@Column(precision = 10, scale = 2)
private BigDecimal sortOrder;
@ApiModelProperty(value = "是否启用 0启用 -1禁用")
private Integer status = CommonConstant.STATUS_NORMAL;
}

32
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsCategoryAttribute.java

@ -0,0 +1,32 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_category_attribute")
@TableName("t_goods_category_attribute")
@ApiModel(value = "商品属性表")
public class GoodsCategoryAttribute extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "分类ID")
private String categoryId;
@ApiModelProperty(value = "属性名称")
private String name;
@ApiModelProperty(value = "类型(1:规格;2:属性;)")
private Integer type;
}

27
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsCategoryBrand.java

@ -0,0 +1,27 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_category_brand")
@TableName("t_goods_category_brand")
@ApiModel(value = "商品品牌表")
public class GoodsCategoryBrand extends HiverBaseMallEntity {
@ApiModelProperty(value = "分类ID")
private String categoryId;
@ApiModelProperty(value = "品牌ID")
private String brandId;
}

29
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsInStock.java

@ -0,0 +1,29 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_in_stock")
@TableName("t_goods_in_stock")
@ApiModel(value = "商品入库表")
public class GoodsInStock extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "在库商品id")
private String goodsStockId;
@ApiModelProperty(value = "入库数量")
private Integer num;
}

58
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/GoodsStock.java

@ -0,0 +1,58 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_goods_stock")
@TableName("t_goods_stock")
@ApiModel(value = "商品库存表")
public class GoodsStock extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商品编码")
private String sn;
@ApiModelProperty(value = "商品ID")
private String goodsId;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品规格值,以英文逗号(,)分割")
private String specIds;
@ApiModelProperty(value = "采购价")
@Column(precision = 10, scale = 2)
private BigDecimal purchasePrice = new BigDecimal(0);
@ApiModelProperty(value = "市场价")
@Column(precision = 10, scale = 2)
private BigDecimal price = new BigDecimal(0);
@ApiModelProperty(value = "批发价")
@Column(precision = 10, scale = 2)
private BigDecimal wholesalePrice = new BigDecimal(0);
@ApiModelProperty(value = "库存数量")
private Integer stock = 0;
@ApiModelProperty(value = "锁定库存数量")
private Integer lockedStock = 0;
@ApiModelProperty(value = "商品图片")
private String picUrl;
}

45
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Mall.java

@ -0,0 +1,45 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseMallEntity;
import cc.hiver.core.common.constant.CommonConstant;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_mall")
@TableName("t_mall")
@ApiModel(value = "商铺表")
public class Mall extends HiverBaseMallEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "商铺名称")
private String name;
@ApiModelProperty(value = "商铺简介")
private String description;
@ApiModelProperty(value = "商铺图片")
private String picUrl;
@ApiModelProperty(value = "排序值")
@Column(precision = 10, scale = 2)
private BigDecimal sortOrder;
@ApiModelProperty(value = "是否启用 0启用 -1禁用")
private Integer status = CommonConstant.STATUS_NORMAL;
@ApiModelProperty(value = "是否默认商铺")
private Integer defaulted;
}

29
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PopularUrl.java

@ -0,0 +1,29 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_popular_url")
@TableName("t_popular_url")
@ApiModel(value = "热销推荐地址表")
public class PopularUrl extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "热销地址")
private String url;
@ApiModelProperty(value = "商铺id")
private String mallId;
}

29
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/PopularUrlGoods.java

@ -0,0 +1,29 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_popular_url_goods")
@TableName("t_popular_url_goods")
@ApiModel(value = "热销推荐地址对应商品表")
public class PopularUrlGoods extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "链接id")
private String urlId;
@ApiModelProperty(value = "商品id")
private String goodsId;
}

35
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/RoleSetting.java

@ -0,0 +1,35 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_role_setting")
@TableName("t_role_setting")
@ApiModel(value = "角色配置表")
@NoArgsConstructor
public class RoleSetting extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "关联角色id")
private String roleId;
@ApiModelProperty(value = "配置值value")
private String value;
public RoleSetting(String id) {
super.setId(id);
}
}

56
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SalesOrder.java

@ -0,0 +1,56 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import cc.hiver.core.common.constant.MallConstant;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_sales_order")
@TableName("t_sales_order")
@ApiModel(value = "销售单主表")
public class SalesOrder extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "销售单号")
private String sn = "SN" + SnowFlakeUtil.nextId().toString();
@ApiModelProperty(value = "用户ID")
private String userId;
@ApiModelProperty(value = "收货人姓名")
private String consigneeName;
@ApiModelProperty(value = "收货人联系方式")
private String consigneeMobile;
@ApiModelProperty(value = "收货人公司")
private String consigneeCompany;
@ApiModelProperty(value = "收货人所属区域")
private String consigneeArea;
@ApiModelProperty(value = "详细地址")
private String address;
@ApiModelProperty(value = "邮编")
private String zipCode;
@ApiModelProperty(value = "是否启用 0处理中 1已保存")
private Integer status = MallConstant.SALES_ORDER_PROCESS;
@ApiModelProperty(value = "订单总额")
private BigDecimal totalAmount = new BigDecimal(0);
}

51
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/SalesOrderItem.java

@ -0,0 +1,51 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_sales_order_item")
@TableName("t_sales_order_item")
@ApiModel(value = "销售单详细表")
public class SalesOrderItem extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "销售单主表id")
private String salesOrderId;
@ApiModelProperty(value = "商品编号")
private String sn;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品ID")
private String goodsId;
@ApiModelProperty(value = "商品规格值,以英文逗号(,)分割")
private String specIds;
@ApiModelProperty(value = "商品图片")
private String picUrl;
@ApiModelProperty(value = "商品单价")
private BigDecimal price = new BigDecimal(0);
@ApiModelProperty(value = "商品数量")
private Integer count = 0;
@ApiModelProperty(value = "商品总价")
private BigDecimal totalAmount = new BigDecimal(0);
}

51
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/UserClockIn.java

@ -0,0 +1,51 @@
package cc.hiver.mall.entity;
import cc.hiver.core.common.utils.SnowFlakeUtil;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_user_clock_in")
@TableName("t_user_clock_in")
@ApiModel(value = "用户打卡表")
public class UserClockIn {
private static final long serialVersionUID = 1L;
@Id
@TableId
@ApiModelProperty(value = "唯一标识")
private String id = SnowFlakeUtil.nextId().toString();
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "打卡人")
@CreatedBy
@TableField(fill = FieldFill.INSERT)
private String clockInBy;
@CreatedDate
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "打卡时间")
private Date clockInTime;
}

31
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/UserMall.java

@ -0,0 +1,31 @@
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.Entity;
import javax.persistence.Table;
@Data
@Accessors(chain = true)
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_user_mall")
@TableName("t_user_mall")
@ApiModel(value = "用户管理商铺表")
public class UserMall extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "商铺id")
private String mallId;
}

36
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/CartItemDTO.java

@ -0,0 +1,36 @@
package cc.hiver.mall.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
public class CartItemDTO implements Serializable {
@ApiModelProperty(value = "商品库存ID")
private String goodsStockId;
@ApiModelProperty(value = "商品库存名称")
private String goodsStockName;
@ApiModelProperty(value = "商品编码")
private String goodsStockSN;
@ApiModelProperty(value = "商品图片")
private String picUrl;
@ApiModelProperty(value = "商品数量")
private Integer count;
@ApiModelProperty(value = "加入购物车时价格,因会变动,不能作为订单计算因子,订单提交时需验价")
private Long price;
@ApiModelProperty(value = "是否选中")
private Boolean checked;
@ApiModelProperty(value = "商品库存数量,页面控制能选择最大数量")
private Integer stock;
@ApiModelProperty(value = "商品名称")
private String goodsName;
}

38
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/CategoryAttributeDto.java

@ -0,0 +1,38 @@
package cc.hiver.mall.pojo.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ApiModel("属性表单")
public class CategoryAttributeDto {
@ApiModelProperty("分类ID")
@NotNull
private Long categoryId;
@ApiModelProperty("属性类型(1:规格;2:属性)")
@NotNull
private Integer type;
@ApiModelProperty("属性集合")
@NotEmpty
private List<Attribute> attributes;
@Data
public static class Attribute {
@ApiModelProperty("属性ID")
private Long id;
@ApiModelProperty("属性名称")
@NotBlank
private String name;
}
}

66
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/CheckPriceDTO.java

@ -0,0 +1,66 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class CheckPriceDTO {
/**
* 订单编号
*/
private String orderSn;
/**
* 订单总金额
*/
private BigDecimal orderTotalAmount;
/**
* 订单商品明细
*/
private List<OrderSku> orderSkus;
/**
* 订单商品对象
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class OrderSku {
/**
* 商品ID
*/
private String goodsId;
/**
* 商品数量
*/
private Integer count;
}
}

58
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/GoodsStockDto.java

@ -0,0 +1,58 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.math.BigDecimal;
/**
* @author Yazhi Li
*/
@Data
public class GoodsStockDto {
@ApiModelProperty(value = "序号")
private String id;
@ApiModelProperty(value = "库存编码")
private String sn;
@ApiModelProperty(value = "库存名称")
private String name;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "采购价")
@Column(precision = 10, scale = 2)
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
@Column(precision = 10, scale = 2)
private BigDecimal price;
@ApiModelProperty(value = "批发价")
@Column(precision = 10, scale = 2)
private BigDecimal wholesalePrice;
@ApiModelProperty(value = "库存数量")
private Integer stock = 0;
@ApiModelProperty(value = "商品图片")
private String picUrl;
}

57
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/LockStockDTO.java

@ -0,0 +1,57 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
@ToString
@NoArgsConstructor
@AllArgsConstructor
public class LockStockDTO {
/**
* 订单编号
*/
private String orderSn;
/**
* 锁定商品集合
*/
private List<LockedStock> lockedStocks;
@Data
@AllArgsConstructor
@NoArgsConstructor
public static class LockedStock {
/**
* 锁定商品ID
*/
private String goodsId;
/**
* 商品数量
*/
private Integer count;
}
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/PopularUrlDto.java

@ -0,0 +1,19 @@
package cc.hiver.mall.pojo.dto;
import cc.hiver.mall.entity.PopularUrl;
import cc.hiver.mall.entity.PopularUrlGoods;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class PopularUrlDto {
@ApiModelProperty(value = "热销链接主表")
private PopularUrl url;
@ApiModelProperty(value = "热销商品列表")
private List<PopularUrlGoods> goodsList;
}

19
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/dto/SalesOrderDto.java

@ -0,0 +1,19 @@
package cc.hiver.mall.pojo.dto;
import cc.hiver.mall.entity.SalesOrder;
import cc.hiver.mall.entity.SalesOrderItem;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class SalesOrderDto {
@ApiModelProperty("销售单主表")
private SalesOrder order;
@ApiModelProperty(value = "销售单列表")
private List<SalesOrderItem> orderItems;
}

22
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/GoodsAttributeForm.java

@ -0,0 +1,22 @@
package cc.hiver.mall.pojo.form;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class GoodsAttributeForm {
@ApiModelProperty(value = "序号")
private String id;
@ApiModelProperty(value = "属性ID")
private Long attributeId;
@ApiModelProperty(value = "商品属性名")
private String name;
@ApiModelProperty(value = "商品属性值")
private String value;
@ApiModelProperty(value = "商品图片")
private String picUrl;
}

54
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/GoodsCategoryAttributeForm.java

@ -0,0 +1,54 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.form;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
@ApiModel("属性表单")
public class GoodsCategoryAttributeForm {
@ApiModelProperty("分类ID")
@NotNull
private String categoryId;
@ApiModelProperty("属性类型(1:规格;2:属性)")
@NotNull
private Integer type;
@ApiModelProperty("属性集合")
@NotEmpty
private List<Attribute> attributes;
@Data
public static class Attribute {
@ApiModelProperty("属性ID")
private String id;
@ApiModelProperty("属性名称")
@NotBlank
private String name;
}
}

81
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/form/GoodsForm.java

@ -0,0 +1,81 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.form;
import cc.hiver.mall.entity.GoodsStock;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.persistence.Column;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
public class GoodsForm {
@ApiModelProperty(value = "序号")
private String id;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品类型ID")
private String categoryId;
@ApiModelProperty(value = "商品品牌ID")
private String brandId;
@ApiModelProperty(value = "采购价")
@Column(precision = 10, scale = 2)
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
@Column(precision = 10, scale = 2)
private BigDecimal price;
@ApiModelProperty(value = "批发价")
@Column(precision = 10, scale = 2)
private BigDecimal wholesalePrice;
@ApiModelProperty(value = "商品主图")
private String picUrl;
@ApiModelProperty("商品副图")
private String[] subPicUrls;
@ApiModelProperty(value = "视频地址")
private String videoUrl;
@ApiModelProperty(value = "商品简介")
private String description;
@ApiModelProperty(value = "商品详情")
private String detail;
@ApiModelProperty(value = "是否启用 0上架 -1下架")
private Integer status;
@ApiModelProperty(value = "属性列表")
private List<GoodsAttributeForm> attrList;
@ApiModelProperty(value = "规格列表")
private List<GoodsAttributeForm> specList;
@ApiModelProperty(value = "库存列表")
private List<GoodsStock> goodsStockList;
}

18
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/CustomAddressQueryCriteria.java

@ -0,0 +1,18 @@
package cc.hiver.mall.pojo.query;
import cc.hiver.core.common.annotation.Query;
import lombok.Data;
import java.io.Serializable;
@Data
public class CustomAddressQueryCriteria implements Serializable {
@Query
private String id;
@Query
private String userId;
@Query(blurry = "consignee,receivingMobile,receivingCompany")
private String blurry;
}

40
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/query/GoodsPageQuery.java

@ -0,0 +1,40 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.query;
import cc.hiver.core.base.HiverBasePageQuery;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Yazhi Li
*/
@ApiModel("商品分页查询对象")
@Data
public class GoodsPageQuery extends HiverBasePageQuery {
@ApiModelProperty("关键字")
private String keywords;
@ApiModelProperty("商品分类ID")
private Long categoryId;
@ApiModelProperty("排序字段名")
private String sortField;
@ApiModelProperty("排序规则(asc:升序;desc:降序)")
private String sort;
}

53
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/GoodsCategoryVO.java

@ -0,0 +1,53 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
public class GoodsCategoryVO {
@ApiModelProperty(value = "编号")
private String id;
@ApiModelProperty(value = "商品分类名称")
private String name;
@ApiModelProperty(value = "父级ID")
private String parentId;
@ApiModelProperty(value = "层级")
private Integer level;
@ApiModelProperty(value = "图标地址")
private String iconUrl;
@ApiModelProperty(value = "排序值")
private BigDecimal sortOrder;
@ApiModelProperty(value = "是否启用 0启用 -1禁用")
private Integer status;
@ApiModelProperty(value = "子节点")
private List<GoodsCategoryVO> children = new ArrayList<>();
}

80
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/GoodsDetailVO.java

@ -0,0 +1,80 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.vo;
import cc.hiver.mall.entity.GoodsAttribute;
import cc.hiver.mall.entity.GoodsStock;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
@ApiModel("商品详情视图对象")
public class GoodsDetailVO {
@ApiModelProperty(value = "序号")
private String id;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品类型ID")
private String categoryId;
@ApiModelProperty(value = "商品品牌ID")
private String brandId;
@ApiModelProperty(value = "采购价")
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
private BigDecimal price;
@ApiModelProperty(value = "批发价")
private BigDecimal wholesalePrice;
@ApiModelProperty(value = "商品主图")
private String picUrl;
@ApiModelProperty("商品副图")
private String[] subPicUrls;
@ApiModelProperty(value = "视频地址")
private String videoUrl;
@ApiModelProperty(value = "商品简介")
private String description;
@ApiModelProperty(value = "商品详情")
private String detail;
@ApiModelProperty(value = "是否启用 0上架 -1下架")
private Integer status;
@ApiModelProperty(value = "属性列表")
private List<GoodsAttribute> attrList;
@ApiModelProperty(value = "规格列表")
private List<GoodsAttribute> specList;
@ApiModelProperty(value = "库存列表")
private List<GoodsStock> goodsStockList;
}

85
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/GoodsPageVO.java

@ -0,0 +1,85 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.pojo.vo;
import cc.hiver.mall.entity.GoodsStock;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Yazhi Li
*/
@Data
@Accessors(chain = true)
public class GoodsPageVO {
@ApiModelProperty(value = "序号")
private String id;
@ApiModelProperty(value = "商品名称")
private String name;
@ApiModelProperty(value = "商品类型ID")
private String categoryId;
@ApiModelProperty(value = "商品品牌ID")
private String brandId;
@ApiModelProperty(value = "采购价")
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
private BigDecimal price;
@ApiModelProperty(value = "批发价")
private BigDecimal wholesalePrice;
@ApiModelProperty(value = "销量")
private Integer sales;
@ApiModelProperty(value = "商品主图")
private String picUrl;
@ApiModelProperty(value = "视频地址")
private String videoUrl;
@ApiModelProperty(value = "商品图册")
private String album;
@ApiModelProperty(value = "单位")
private String unit;
@ApiModelProperty(value = "商品简介")
private String description;
@ApiModelProperty(value = "商品详情")
private String detail;
@ApiModelProperty(value = "是否启用 0上架 -1下架")
private Integer status;
@ApiModelProperty(value = "分类名称")
private String categoryName;
@ApiModelProperty(value = "品牌名称")
private String brandName;
@ApiModelProperty(value = "库存列表")
private List<GoodsStock> goodsStockList;
}

113
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallGoodsDetailVO.java

@ -0,0 +1,113 @@
package cc.hiver.mall.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
@Data
@ApiModel("商品详情")
public class MallGoodsDetailVO {
@ApiModelProperty("商品基本信息")
private GoodsInfo goodsInfo;
@ApiModelProperty("商品属性列表")
private List<Attribute> attributeList;
@ApiModelProperty("商品规格列表")
private List<Specification> specList;
@ApiModelProperty("商品库存单元列表")
private List<Sku> skuList;
@Data
@ApiModel("商品信息")
public static class GoodsInfo {
@ApiModelProperty("商品ID")
private String id;
@ApiModelProperty("商品名称")
private String name;
@ApiModelProperty(value = "采购价")
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
private BigDecimal price;
@ApiModelProperty(value = "批发价")
private BigDecimal wholesalePrice;
@ApiModelProperty("销量")
private Integer sales;
@ApiModelProperty("商品图册")
private List<String> album;
@ApiModelProperty("商品详情")
private String detail;
}
@Data
@ApiModel("属性信息")
public static class Attribute {
@ApiModelProperty("属性ID")
private String id;
@ApiModelProperty("属性名称")
private String name;
@ApiModelProperty("属性值")
private String value;
}
@Data
@ApiModel("规格信息")
public static class Specification {
@ApiModelProperty(value = "规格名称", example = "颜色")
private String name;
@ApiModelProperty(value = "规格项列表", example = "黑,白")
private List<Value> values;
@Data
@ApiModel("规格项")
public static class Value {
@ApiModelProperty("规格项ID")
private String id;
@ApiModelProperty("规格项值")
private String value;
}
}
@Data
@ApiModel("商品库存单元")
public static class Sku {
@ApiModelProperty("库存单元ID")
private String id;
@ApiModelProperty("库存单元名称")
private String name;
@ApiModelProperty("库存单元规格值ID集合,以英文逗号拼接")
private String specIds;
@ApiModelProperty(value = "采购价")
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
private BigDecimal price;
@ApiModelProperty(value = "批发价")
private BigDecimal wholesalePrice;
@ApiModelProperty("库存")
private Integer stockNum;
@ApiModelProperty("商品图片URL")
private String picUrl;
}
}

32
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/MallGoodsPageVO.java

@ -0,0 +1,32 @@
package cc.hiver.mall.pojo.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@ApiModel("商品分页对象")
@Data
public class MallGoodsPageVO {
@ApiModelProperty("商品ID")
private Long id;
@ApiModelProperty("商品名称")
private String name;
@ApiModelProperty(value = "采购价")
private BigDecimal purchasePrice;
@ApiModelProperty(value = "市场价")
private BigDecimal price;
@ApiModelProperty(value = "批发价")
private BigDecimal wholesalePrice;
@ApiModelProperty("销量")
private Integer sales;
@ApiModelProperty("图片地址")
private String picUrl;
}

21
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/CartService.java

@ -0,0 +1,21 @@
package cc.hiver.mall.service;
import cc.hiver.mall.pojo.dto.CartItemDTO;
import java.util.List;
public interface CartService {
List<CartItemDTO> listCartItems(String memberId);
boolean deleteCart(String memberId);
boolean addCartItem(String goodsStockId, String memberId);
boolean updateCartItem(CartItemDTO cartItem, String memberId);
boolean removeCartItem(String goodsStockId, String memberId);
boolean removeCheckedItem(String memberId);
boolean checkAll(boolean checked, String memberId);
}

11
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/CustomAddressService.java

@ -0,0 +1,11 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.CustomAddress;
import cc.hiver.mall.pojo.query.CustomAddressQueryCriteria;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
public interface CustomAddressService extends HiverBaseService<CustomAddress, String> {
Page<CustomAddress> queryAll(CustomAddressQueryCriteria criteria, Pageable pageable);
}

15
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/GoodsBrandService.java

@ -0,0 +1,15 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.GoodsBrand;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
/**
* 商品品牌服务接口
*
* @author Yazhi Li
*/
public interface GoodsBrandService extends HiverBaseService<GoodsBrand, String> {
Page<GoodsBrand> findByCondition(GoodsBrand goodsBrand, Pageable pageable);
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/GoodsInStockService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.GoodsInStock;
public interface GoodsInStockService extends HiverBaseService<GoodsInStock, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/MallService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.Mall;
public interface MallService extends HiverBaseService<Mall, String> {
}

10
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/PopularUrlGoodsService.java

@ -0,0 +1,10 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.PopularUrlGoods;
import java.util.List;
public interface PopularUrlGoodsService extends HiverBaseService<PopularUrlGoods, String> {
List<PopularUrlGoods> findAllByUrlId(String urlId);
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/PopularUrlService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.PopularUrl;
public interface PopularUrlService extends HiverBaseService<PopularUrl, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/RoleSettingService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.RoleSetting;
public interface RoleSettingService extends HiverBaseService<RoleSetting, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SalesOrderItemService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.SalesOrderItem;
public interface SalesOrderItemService extends HiverBaseService<SalesOrderItem, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/SalesOrderService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.SalesOrder;
public interface SalesOrderService extends HiverBaseService<SalesOrder, String> {
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/UserClockInService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.UserClockIn;
public interface UserClockInService extends HiverBaseService<UserClockIn, String> {
}

8
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/UserMallService.java

@ -0,0 +1,8 @@
package cc.hiver.mall.service;
import cc.hiver.core.base.HiverBaseService;
import cc.hiver.mall.entity.UserMall;
public interface UserMallService extends HiverBaseService<UserMall, String> {
void deleteAllByMallId(String mallId);
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsAttributeService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.GoodsAttribute;
import com.baomidou.mybatisplus.extension.service.IService;
public interface GoodsAttributeService extends IService<GoodsAttribute> {
}

9
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsCategoryAttributeService.java

@ -0,0 +1,9 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.GoodsCategoryAttribute;
import cc.hiver.mall.pojo.form.GoodsCategoryAttributeForm;
import com.baomidou.mybatisplus.extension.service.IService;
public interface GoodsCategoryAttributeService extends IService<GoodsCategoryAttribute> {
boolean saveBatch(GoodsCategoryAttributeForm formData);
}

7
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsCategoryBrandService.java

@ -0,0 +1,7 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.GoodsCategoryBrand;
import com.baomidou.mybatisplus.extension.service.IService;
public interface GoodsCategoryBrandService extends IService<GoodsCategoryBrand> {
}

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsCategoryService.java

@ -0,0 +1,16 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.core.vo.Option;
import cc.hiver.mall.entity.GoodsCategory;
import cc.hiver.mall.pojo.vo.GoodsCategoryVO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface GoodsCategoryService extends IService<GoodsCategory> {
List<GoodsCategoryVO> listCategory(String parentId);
List<Option> listCategoryOptions();
String saveCategory(GoodsCategory category);
}

87
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsService.java

@ -0,0 +1,87 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.Goods;
import cc.hiver.mall.pojo.form.GoodsForm;
import cc.hiver.mall.pojo.query.GoodsPageQuery;
import cc.hiver.mall.pojo.vo.GoodsDetailVO;
import cc.hiver.mall.pojo.vo.GoodsPageVO;
import cc.hiver.mall.pojo.vo.MallGoodsDetailVO;
import cc.hiver.mall.pojo.vo.MallGoodsPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author Yazhi Li
*/
public interface GoodsService extends IService<Goods> {
/**
* 管理端商品分页列表
*
* @param queryParams
* @return
*/
IPage<GoodsPageVO> listGoodsPages(GoodsPageQuery queryParams);
/**
* 商铺端商品分页列表
*
* @param queryParams
* @return
*/
IPage<MallGoodsPageVO> listMallGoodsPages(GoodsPageQuery queryParams);
/**
* 管理端获取商品详情
*
* @param id
* @return
*/
GoodsDetailVO getGoodsDetail(String id);
/**
* 商铺端获取商品详情
*
* @param id
* @return
*/
MallGoodsDetailVO getMallGoodsDetail(String id);
/**
* 新增商品
*
* @param formData
* @return
*/
boolean addGoods(GoodsForm formData);
/**
* 修改商品
*
* @param formData
* @return
*/
boolean updateGoods(GoodsForm formData);
/**
* 删除商品
*
* @param ids 商品ID多个以英文逗号(,)分割
* @return
*/
boolean removeByGoodsIds(String[] ids);
}

66
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/GoodsStockService.java

@ -0,0 +1,66 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.GoodsStock;
import cc.hiver.mall.pojo.dto.CheckPriceDTO;
import cc.hiver.mall.pojo.dto.GoodsStockDto;
import cc.hiver.mall.pojo.dto.LockStockDTO;
import com.baomidou.mybatisplus.extension.service.IService;
public interface GoodsStockService extends IService<GoodsStock> {
/**
* 获取商品的库存数量
*
* @param id
* @return
*/
Integer getStockNum(String id);
/**
* 获取商品库存信息
*
* @param id
* @return
*/
GoodsStockDto getStockInfo(String id);
/**
* 锁定库存
*/
boolean lockStock(LockStockDTO lockStockDTO);
/**
* 解锁库存
*/
boolean unlockStock(String orderSn);
/**
* 扣减库存
*/
boolean deductStock(String orderSn);
/**
* 商品验价
*
* @param checkPriceDTO
* @return
*/
boolean checkPrice(CheckPriceDTO checkPriceDTO);
/**
* 修改商品库存数量
*
* @param id
* @param stockNum 商品库存数量
* @return
*/
boolean updateStockNum(String id, Integer stockNum);
/**
* 扣减商品库存
*
* @param id
* @param num 商品库存数量
* @return
*/
boolean deductStock(String id, Integer num);
}

31
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IAddressService.java

@ -0,0 +1,31 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.Address;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface IAddressService extends IService<Address> {
/**
* 新增地址
*
* @param entity
* @return
*/
boolean addAddress(Address entity);
/**
* 修改地址
*
* @param entity
* @return
*/
boolean updateAddress(Address entity);
/**
* 获取当前登录会员的地址列表
*
* @return
*/
List<Address> listCurrentMemberAddresses(String memberId);
}

17
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/IMallService.java

@ -0,0 +1,17 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.Mall;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IMallService extends IService<Mall> {
/**
* 通过用户id获取
*
* @param userId
* @return
*/
List<Mall> findByUserId(@Param("userId") String userId);
}

135
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/CartServiceImpl.java

@ -0,0 +1,135 @@
package cc.hiver.mall.serviceimpl;
import cc.hiver.core.common.constant.MallConstant;
import cc.hiver.mall.pojo.dto.CartItemDTO;
import cc.hiver.mall.pojo.dto.GoodsStockDto;
import cc.hiver.mall.service.CartService;
import cc.hiver.mall.service.mybatis.GoodsStockService;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Assert;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@Service
@Slf4j
@AllArgsConstructor
public class CartServiceImpl implements CartService {
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private GoodsStockService goodsStockService;
@Override
public List<CartItemDTO> listCartItems(String memberId) {
if (memberId != null) {
BoundHashOperations cartHashOperations = getCartHashOperations(memberId);
List<CartItemDTO> cartItems = cartHashOperations.values();
return cartItems;
}
return Collections.EMPTY_LIST;
}
@Override
public boolean deleteCart(String memberId) {
String key = MallConstant.MEMBER_CART_PREFIX + memberId;
redisTemplate.delete(key);
return true;
}
@Override
public boolean addCartItem(String goodsStockId, String memberId) {
BoundHashOperations cartHashOperations = getCartHashOperations(memberId);
String hKey = goodsStockId + "";
CartItemDTO cartItem;
// 购物车已存在该商品,更新商品数量
if (cartHashOperations.get(hKey) != null) {
cartItem = (CartItemDTO) cartHashOperations.get(hKey);
cartItem.setCount(cartItem.getCount() + 1); // 点击一次“加入购物车”,数量+1
cartItem.setChecked(true);
cartHashOperations.put(hKey, cartItem);
return true;
}
// 购物车不存在该商品,添加商品至购物车
cartItem = new CartItemDTO();
CompletableFuture<Void> cartItemCompletableFuture = CompletableFuture.runAsync(() -> {
GoodsStockDto goodsStockDto = goodsStockService.getStockInfo(goodsStockId);
if (goodsStockDto != null) {
BeanUtil.copyProperties(goodsStockDto, cartItem);
cartItem.setStock(goodsStockDto.getStock());
cartItem.setCount(1);
cartItem.setChecked(true);
}
});
CompletableFuture.allOf(cartItemCompletableFuture).join();
Assert.isTrue(cartItem.getGoodsStockId() != null, "商品不存在");
cartHashOperations.put(hKey, cartItem);
return true;
}
@Override
public boolean updateCartItem(CartItemDTO cartItem, String memberId) {
BoundHashOperations cartHashOperations = getCartHashOperations(memberId);
String hKey = cartItem.getGoodsStockId() + "";
if (cartHashOperations.get(hKey) != null) {
CartItemDTO cacheCartItem = (CartItemDTO) cartHashOperations.get(hKey);
if (cartItem.getChecked() != null) {
cacheCartItem.setChecked(cartItem.getChecked());
}
if (cartItem.getCount() != null) {
cacheCartItem.setCount(cartItem.getCount());
}
cartHashOperations.put(hKey, cacheCartItem);
}
return true;
}
@Override
public boolean removeCartItem(String goodsStockId, String memberId) {
BoundHashOperations cartHashOperations = getCartHashOperations(memberId);
String hKey = goodsStockId + "";
cartHashOperations.delete(hKey);
return true;
}
@Override
public boolean removeCheckedItem(String memberId) {
BoundHashOperations cartHashOperations = getCartHashOperations(memberId);
for (Object value : cartHashOperations.values()) {
CartItemDTO cartItem = (CartItemDTO) value;
if (cartItem.getChecked()) {
cartHashOperations.delete(cartItem.getGoodsStockId() + "");
}
}
return true;
}
@Override
public boolean checkAll(boolean checked, String memberId) {
BoundHashOperations cartHashOperations = getCartHashOperations(memberId);
for (Object value : cartHashOperations.values()) {
CartItemDTO cartItem = (CartItemDTO) value;
cartItem.setChecked(checked);
String hKey = cartItem.getGoodsStockId() + "";
cartHashOperations.put(hKey, cartItem);
}
return true;
}
/**
* 获取第一层即某个用户的购物车
*/
private BoundHashOperations getCartHashOperations(String memberId) {
String cartKey = MallConstant.MEMBER_CART_PREFIX + memberId;
BoundHashOperations operations = redisTemplate.boundHashOps(cartKey);
return operations;
}
}

33
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/CustomAddressServiceImpl.java

@ -0,0 +1,33 @@
package cc.hiver.mall.serviceimpl;
import cc.hiver.core.base.HiverBaseDao;
import cc.hiver.core.common.utils.QueryHelp;
import cc.hiver.mall.dao.CustomAddressDao;
import cc.hiver.mall.entity.CustomAddress;
import cc.hiver.mall.service.CustomAddressService;
import cc.hiver.mall.pojo.query.CustomAddressQueryCriteria;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@Transactional
public class CustomAddressServiceImpl implements CustomAddressService {
@Autowired
private CustomAddressDao customAddressDao;
@Override
public HiverBaseDao<CustomAddress, String> getRepository() {
return customAddressDao;
}
@Override
public Page<CustomAddress> queryAll(CustomAddressQueryCriteria criteria, Pageable pageable) {
Page<CustomAddress> list = customAddressDao.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable);
return list;
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save