perf: 团购代码优化

This commit is contained in:
Junling Bu
2019-12-08 19:23:32 +08:00
parent eff4862dc8
commit d6f243d8d8
36 changed files with 1317 additions and 1085 deletions

View File

@@ -2787,7 +2787,7 @@ API应该存在版本控制以保证兼容性。
请求参数
cartId: 购物车ID如果0则是购物车商品如果非0则是立即单一商品
grouponRulesId: 团购活动ID如果是团购商品则需要设置具体团购活动ID
grouponRulesId: 团购规则ID如果是团购商品则需要设置具体团购规则ID
响应内容

View File

@@ -84,55 +84,4 @@ public class OrderJob {
}
}
}
/**
* 团购订单拼团超期自动取消
*/
@Scheduled(initialDelay = 5000, fixedDelay = 10 * 60 * 1000)
@Transactional(rollbackFor = Exception.class)
public void checkGrouponOrderTimeout() {
logger.info("系统开启定时任务检查团购订单是否已经拼团超期自动取消订单");
List<LitemallGroupon> grouponList = grouponService.queryJoinRecord(0);
for (LitemallGroupon groupon : grouponList) {
LitemallGrouponRules rules = rulesService.queryById(groupon.getRulesId());
if (rulesService.isExpired(rules)) {
List<LitemallGroupon> subGrouponList = grouponService.queryJoinRecord(groupon.getId());
for (LitemallGroupon subGroupon : subGrouponList) {
cancelGrouponScope(subGroupon);
}
cancelGrouponScope(groupon);
}
}
}
private void cancelGrouponScope(LitemallGroupon groupon) {
LitemallOrder order = orderService.findById(groupon.getOrderId());
if (order.getOrderStatus().equals(OrderUtil.STATUS_PAY_GROUPON)) {
order.setOrderStatus(OrderUtil.STATUS_TIMEOUT_GROUPON);
order.setEndTime(LocalDateTime.now());
cancelOrderScope(order);
logger.info("团购订单 ID" + order.getId() + " 已经拼团超期自动取消订单");
}
}
private void cancelOrderScope(LitemallOrder order) {
if (orderService.updateWithOptimisticLocker(order) == 0) {
throw new RuntimeException("更新数据已失效");
}
// 商品货品数量增加
Integer orderId = order.getId();
List<LitemallOrderGoods> orderGoodsList = orderGoodsService.queryByOid(orderId);
for (LitemallOrderGoods orderGoods : orderGoodsList) {
Integer productId = orderGoods.getProductId();
Short number = orderGoods.getNumber();
if (productService.addStock(productId, number) == 0) {
throw new RuntimeException("商品货品库存增加失败");
}
}
}
}

View File

@@ -138,6 +138,7 @@ public class AdminOrderService {
// 设置订单取消状态
order.setOrderStatus(OrderUtil.STATUS_REFUND_CONFIRM);
order.setEndTime(LocalDateTime.now());
if (orderService.updateWithOptimisticLocker(order) == 0) {
throw new RuntimeException("更新数据已失效");
}

View File

@@ -0,0 +1,41 @@
package org.linlinjava.litemall.admin.task;
import org.linlinjava.litemall.core.task.TaskService;
import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.service.LitemallGrouponRulesService;
import org.linlinjava.litemall.db.util.GrouponConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.List;
@Component
public class AdminTaskStartupRunner implements ApplicationRunner {
@Autowired
private LitemallGrouponRulesService rulesService;
@Autowired
private TaskService taskService;
@Override
public void run(ApplicationArguments args) throws Exception {
List<LitemallGrouponRules> grouponRulesList = rulesService.queryByStatus(GrouponConstant.RULE_STATUS_ON);
for(LitemallGrouponRules grouponRules : grouponRulesList){
LocalDateTime now = LocalDateTime.now();
LocalDateTime expire = grouponRules.getExpireTime();
if(expire.isBefore(now)) {
// 已经过期,则加入延迟队列
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), 0));
}
else{
// 还没过期,则加入延迟队列
long delay = ChronoUnit.MILLIS.between(now, expire);
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), delay));
}
}
}
}

View File

@@ -0,0 +1,68 @@
package org.linlinjava.litemall.admin.task;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.litemall.core.task.Task;
import org.linlinjava.litemall.core.util.BeanUtil;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.domain.LitemallOrder;
import org.linlinjava.litemall.db.service.*;
import org.linlinjava.litemall.db.util.GrouponConstant;
import org.linlinjava.litemall.db.util.OrderUtil;
import java.util.List;
public class GrouponRuleExpiredTask extends Task {
private final Log logger = LogFactory.getLog(GrouponRuleExpiredTask.class);
private int grouponRuleId = -1;
public GrouponRuleExpiredTask(Integer grouponRuleId, long delayInMilliseconds){
super("GrouponRuleExpiredTask-" + grouponRuleId, delayInMilliseconds);
this.grouponRuleId = grouponRuleId;
}
@Override
public void run() {
logger.info("系统开始处理延时任务---团购规则过期---" + this.grouponRuleId);
LitemallOrderService orderService = BeanUtil.getBean(LitemallOrderService.class);
LitemallGrouponService grouponService = BeanUtil.getBean(LitemallGrouponService.class);
LitemallGrouponRulesService grouponRulesService = BeanUtil.getBean(LitemallGrouponRulesService.class);
LitemallGrouponRules grouponRules = grouponRulesService.findById(grouponRuleId);
if(grouponRules == null){
return;
}
if(!grouponRules.getStatus().equals(GrouponConstant.RULE_STATUS_ON)){
return;
}
// 团购活动取消
grouponRules.setStatus(GrouponConstant.RULE_STATUS_DOWN_EXPIRE);
grouponRulesService.updateById(grouponRules);
List<LitemallGroupon> grouponList = grouponService.queryByRuleId(grouponRuleId);
// 用户团购处理
for(LitemallGroupon groupon : grouponList){
Short status = groupon.getStatus();
LitemallOrder order = orderService.findById(groupon.getOrderId());
if(status.equals(GrouponConstant.STATUS_NONE)){
groupon.setStatus(GrouponConstant.STATUS_FAIL);
grouponService.updateById(groupon);
}
else if(status.equals(GrouponConstant.STATUS_ON)){
// 如果团购进行中
// (1) 团购设置团购失败等待退款状态
groupon.setStatus(GrouponConstant.STATUS_FAIL);
grouponService.updateById(groupon);
// (2) 团购订单申请退款
if(OrderUtil.isPayStatus(order)) {
order.setOrderStatus(OrderUtil.STATUS_REFUND);
orderService.updateWithOptimisticLocker(order);
}
}
}
logger.info("系统结束处理延时任务---团购规则过期---" + this.grouponRuleId);
}
}

View File

@@ -20,5 +20,8 @@ public class AdminResponseCode {
public static final Integer ROLE_NAME_EXIST = 640;
public static final Integer ROLE_SUPER_SUPERMISSION = 641;
public static final Integer ROLE_USER_EXIST = 642;
public static final Integer GROUPON_GOODS_UNKNOWN = 650;
public static final Integer GROUPON_GOODS_EXISTED = 651;
public static final Integer GROUPON_GOODS_OFFLINE = 652;
}

View File

@@ -4,6 +4,9 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.linlinjava.litemall.admin.annotation.RequiresPermissionsDesc;
import org.linlinjava.litemall.admin.task.GrouponRuleExpiredTask;
import org.linlinjava.litemall.admin.util.AdminResponseCode;
import org.linlinjava.litemall.core.task.TaskService;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.core.validator.Order;
import org.linlinjava.litemall.core.validator.Sort;
@@ -13,12 +16,15 @@ import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.service.LitemallGoodsService;
import org.linlinjava.litemall.db.service.LitemallGrouponRulesService;
import org.linlinjava.litemall.db.service.LitemallGrouponService;
import org.linlinjava.litemall.db.util.GrouponConstant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.Duration;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -36,6 +42,8 @@ public class AdminGrouponController {
private LitemallGoodsService goodsService;
@Autowired
private LitemallGrouponService grouponService;
@Autowired
private TaskService taskService;
@RequiresPermissions("admin:groupon:read")
@RequiresPermissionsDesc(menu = {"推广管理", "团购管理"}, button = "详情")
@@ -52,7 +60,7 @@ public class AdminGrouponController {
try {
Map<String, Object> recordData = new HashMap<>();
List<LitemallGroupon> subGrouponList = grouponService.queryJoinRecord(groupon.getId());
LitemallGrouponRules rules = rulesService.queryById(groupon.getRulesId());
LitemallGrouponRules rules = rulesService.findById(groupon.getRulesId());
LitemallGoods goods = goodsService.findById(rules.getGoodsId());
recordData.put("groupon", groupon);
@@ -111,6 +119,14 @@ public class AdminGrouponController {
return error;
}
LitemallGrouponRules rules = rulesService.findById(grouponRules.getId());
if(rules == null){
return ResponseUtil.badArgumentValue();
}
if(!rules.getStatus().equals(GrouponConstant.RULE_STATUS_ON)){
return ResponseUtil.fail(AdminResponseCode.GROUPON_GOODS_OFFLINE, "团购已经下线");
}
Integer goodsId = grouponRules.getGoodsId();
LitemallGoods goods = goodsService.findById(goodsId);
if (goods == null) {
@@ -139,14 +155,23 @@ public class AdminGrouponController {
Integer goodsId = grouponRules.getGoodsId();
LitemallGoods goods = goodsService.findById(goodsId);
if (goods == null) {
return ResponseUtil.badArgumentValue();
return ResponseUtil.fail(AdminResponseCode.GROUPON_GOODS_UNKNOWN, "团购商品不存在");
}
if(rulesService.countByGoodsId(goodsId) > 0){
return ResponseUtil.fail(AdminResponseCode.GROUPON_GOODS_EXISTED, "团购商品已经存在");
}
grouponRules.setGoodsName(goods.getName());
grouponRules.setPicUrl(goods.getPicUrl());
grouponRules.setStatus(GrouponConstant.RULE_STATUS_ON);
rulesService.createRules(grouponRules);
LocalDateTime now = LocalDateTime.now();
LocalDateTime expire = grouponRules.getExpireTime();
long delay = ChronoUnit.MILLIS.between(now, expire);
// 团购过期任务
taskService.addTask(new GrouponRuleExpiredTask(grouponRules.getId(), delay));
return ResponseUtil.ok(grouponRules);
}

View File

@@ -3,7 +3,7 @@
<!-- 查询和其他操作 -->
<div class="filter-container">
<el-input v-model="listQuery.goodsId" clearable class="filter-item" style="width: 200px;" placeholder="请输入商品编号"/>
<el-input v-model="listQuery.goodsId" clearable class="filter-item" style="width: 200px;" placeholder="请输入商品编号" />
<el-button v-permission="['GET /admin/groupon/list']" class="filter-item" type="primary" icon="el-icon-search" @click="handleFilter">查找</el-button>
<el-button v-permission="['POST /admin/groupon/create']" class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
<el-button
@@ -11,15 +11,18 @@
class="filter-item"
type="primary"
icon="el-icon-download"
@click="handleDownload">导出
@click="handleDownload"
>导出
</el-button>
</div>
<!-- 查询结果 -->
<el-table v-loading="listLoading" :data="list" element-loading-text="正在查询中。。。" border fit highlight-current-row>
<el-table-column align="center" label="商品ID" prop="goodsId"/>
<el-table-column align="center" label="团购规则ID" prop="id" />
<el-table-column align="center" min-width="100" label="名称" prop="goodsName"/>
<el-table-column align="center" label="商品ID" prop="goodsId" />
<el-table-column align="center" min-width="100" label="名称" prop="goodsName" />
<el-table-column align="center" property="picUrl" label="图片">
<template slot-scope="scope">
@@ -27,13 +30,17 @@
</template>
</el-table-column>
<el-table-column align="center" label="团购优惠" prop="discount"/>
<el-table-column align="center" label="团购优惠" prop="discount" />
<el-table-column align="center" label="团购要求" prop="discountMember"/>
<el-table-column align="center" label="团购要求" prop="discountMember" />
<el-table-column align="center" label="开始时间" prop="addTime"/>
<el-table-column align="center" label="状态" prop="status">
<template slot-scope="scope">
<el-tag :type="scope.row.status === 0 ? 'success' : 'error' ">{{ statusMap[scope.row.status] }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="结束时间" prop="expireTime"/>
<el-table-column align="center" label="结束时间" prop="expireTime" />
<el-table-column align="center" label="操作" width="200" class-name="small-padding fixed-width">
<template slot-scope="scope">
@@ -51,23 +58,25 @@
:model="dataForm"
status-icon
label-position="left"
label-width="100px"
style="width: 400px; margin-left:50px;">
label-width="120px"
style="width: 400px; margin-left:50px;"
>
<el-form-item label="商品ID" prop="goodsId">
<el-input v-model="dataForm.goodsId"/>
<el-input v-model="dataForm.goodsId" />
</el-form-item>
<el-form-item label="团购折扣" prop="discount">
<el-input v-model="dataForm.discount"/>
<el-input v-model="dataForm.discount" />
</el-form-item>
<el-form-item label="团购人数要求" prop="discountMember">
<el-input v-model="dataForm.discountMember"/>
<el-input v-model="dataForm.discountMember" />
</el-form-item>
<el-form-item label="过期时间" prop="expireTime">
<el-date-picker
v-model="dataForm.expireTime"
type="datetime"
placeholder="选择日期"
value-format="yyyy-MM-dd HH:mm:ss"/>
value-format="yyyy-MM-dd HH:mm:ss"
/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@@ -80,7 +89,7 @@
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" />
<el-tooltip placement="top" content="返回顶部">
<back-to-top :visibility-height="100"/>
<back-to-top :visibility-height="100" />
</el-tooltip>
</div>
@@ -120,8 +129,16 @@ export default {
update: '编辑',
create: '创建'
},
statusMap: [
'正常',
'到期下线',
'提前下线'
],
rules: {
goodsId: [{ required: true, message: '商品不能为空', trigger: 'blur' }]
goodsId: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
discount: [{ required: true, message: '团购折扣不能为空', trigger: 'blur' }],
discountMember: [{ required: true, message: '团购人数不能为空', trigger: 'blur' }],
expireTime: [{ required: true, message: '过期时间不能为空', trigger: 'blur' }]
}
}
},

View File

@@ -66,6 +66,15 @@ public class LitemallGroupon {
*/
private Integer userId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.share_url
*
* @mbg.generated
*/
private String shareUrl;
/**
*
* This field was generated by MyBatis Generator.
@@ -75,6 +84,24 @@ public class LitemallGroupon {
*/
private Integer creatorUserId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.creator_user_time
*
* @mbg.generated
*/
private LocalDateTime creatorUserTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.status
*
* @mbg.generated
*/
private Short status;
/**
*
* This field was generated by MyBatis Generator.
@@ -93,24 +120,6 @@ public class LitemallGroupon {
*/
private LocalDateTime updateTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.share_url
*
* @mbg.generated
*/
private String shareUrl;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.payed
*
* @mbg.generated
*/
private Boolean payed;
/**
*
* This field was generated by MyBatis Generator.
@@ -240,6 +249,30 @@ public class LitemallGroupon {
this.userId = userId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.share_url
*
* @return the value of litemall_groupon.share_url
*
* @mbg.generated
*/
public String getShareUrl() {
return shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.share_url
*
* @param shareUrl the value for litemall_groupon.share_url
*
* @mbg.generated
*/
public void setShareUrl(String shareUrl) {
this.shareUrl = shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.creator_user_id
@@ -264,6 +297,54 @@ public class LitemallGroupon {
this.creatorUserId = creatorUserId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.creator_user_time
*
* @return the value of litemall_groupon.creator_user_time
*
* @mbg.generated
*/
public LocalDateTime getCreatorUserTime() {
return creatorUserTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.creator_user_time
*
* @param creatorUserTime the value for litemall_groupon.creator_user_time
*
* @mbg.generated
*/
public void setCreatorUserTime(LocalDateTime creatorUserTime) {
this.creatorUserTime = creatorUserTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.status
*
* @return the value of litemall_groupon.status
*
* @mbg.generated
*/
public Short getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.status
*
* @param status the value for litemall_groupon.status
*
* @mbg.generated
*/
public void setStatus(Short status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.add_time
@@ -312,54 +393,6 @@ public class LitemallGroupon {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.share_url
*
* @return the value of litemall_groupon.share_url
*
* @mbg.generated
*/
public String getShareUrl() {
return shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.share_url
*
* @param shareUrl the value for litemall_groupon.share_url
*
* @mbg.generated
*/
public void setShareUrl(String shareUrl) {
this.shareUrl = shareUrl;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.payed
*
* @return the value of litemall_groupon.payed
*
* @mbg.generated
*/
public Boolean getPayed() {
return payed;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.payed
*
* @param payed the value for litemall_groupon.payed
*
* @mbg.generated
*/
public void setPayed(Boolean payed) {
this.payed = payed;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
@@ -413,11 +446,12 @@ public class LitemallGroupon {
sb.append(", grouponId=").append(grouponId);
sb.append(", rulesId=").append(rulesId);
sb.append(", userId=").append(userId);
sb.append(", shareUrl=").append(shareUrl);
sb.append(", creatorUserId=").append(creatorUserId);
sb.append(", creatorUserTime=").append(creatorUserTime);
sb.append(", status=").append(status);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", shareUrl=").append(shareUrl);
sb.append(", payed=").append(payed);
sb.append(", deleted=").append(deleted);
sb.append("]");
return sb.toString();
@@ -446,11 +480,12 @@ public class LitemallGroupon {
&& (this.getGrouponId() == null ? other.getGrouponId() == null : this.getGrouponId().equals(other.getGrouponId()))
&& (this.getRulesId() == null ? other.getRulesId() == null : this.getRulesId().equals(other.getRulesId()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getShareUrl() == null ? other.getShareUrl() == null : this.getShareUrl().equals(other.getShareUrl()))
&& (this.getCreatorUserId() == null ? other.getCreatorUserId() == null : this.getCreatorUserId().equals(other.getCreatorUserId()))
&& (this.getCreatorUserTime() == null ? other.getCreatorUserTime() == null : this.getCreatorUserTime().equals(other.getCreatorUserTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getShareUrl() == null ? other.getShareUrl() == null : this.getShareUrl().equals(other.getShareUrl()))
&& (this.getPayed() == null ? other.getPayed() == null : this.getPayed().equals(other.getPayed()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
}
@@ -469,11 +504,12 @@ public class LitemallGroupon {
result = prime * result + ((getGrouponId() == null) ? 0 : getGrouponId().hashCode());
result = prime * result + ((getRulesId() == null) ? 0 : getRulesId().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getShareUrl() == null) ? 0 : getShareUrl().hashCode());
result = prime * result + ((getCreatorUserId() == null) ? 0 : getCreatorUserId().hashCode());
result = prime * result + ((getCreatorUserTime() == null) ? 0 : getCreatorUserTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getShareUrl() == null) ? 0 : getShareUrl().hashCode());
result = prime * result + ((getPayed() == null) ? 0 : getPayed().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
return result;
}
@@ -558,11 +594,12 @@ public class LitemallGroupon {
grouponId("groupon_id", "grouponId", "INTEGER", false),
rulesId("rules_id", "rulesId", "INTEGER", false),
userId("user_id", "userId", "INTEGER", false),
shareUrl("share_url", "shareUrl", "VARCHAR", false),
creatorUserId("creator_user_id", "creatorUserId", "INTEGER", false),
creatorUserTime("creator_user_time", "creatorUserTime", "TIMESTAMP", false),
status("status", "status", "SMALLINT", true),
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
shareUrl("share_url", "shareUrl", "VARCHAR", false),
payed("payed", "payed", "BIT", false),
deleted("deleted", "deleted", "BIT", false);
/**

View File

@@ -893,6 +893,142 @@ public class LitemallGrouponExample {
return (Criteria) this;
}
public Criteria andShareUrlIsNull() {
addCriterion("share_url is null");
return (Criteria) this;
}
public Criteria andShareUrlIsNotNull() {
addCriterion("share_url is not null");
return (Criteria) this;
}
public Criteria andShareUrlEqualTo(String value) {
addCriterion("share_url =", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlNotEqualTo(String value) {
addCriterion("share_url <>", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlNotEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlGreaterThan(String value) {
addCriterion("share_url >", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlGreaterThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlGreaterThanOrEqualTo(String value) {
addCriterion("share_url >=", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlGreaterThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLessThan(String value) {
addCriterion("share_url <", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlLessThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLessThanOrEqualTo(String value) {
addCriterion("share_url <=", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlLessThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLike(String value) {
addCriterion("share_url like", value, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotLike(String value) {
addCriterion("share_url not like", value, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlIn(List<String> values) {
addCriterion("share_url in", values, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotIn(List<String> values) {
addCriterion("share_url not in", values, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlBetween(String value1, String value2) {
addCriterion("share_url between", value1, value2, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotBetween(String value1, String value2) {
addCriterion("share_url not between", value1, value2, "shareUrl");
return (Criteria) this;
}
public Criteria andCreatorUserIdIsNull() {
addCriterion("creator_user_id is null");
return (Criteria) this;
@@ -1019,6 +1155,258 @@ public class LitemallGrouponExample {
return (Criteria) this;
}
public Criteria andCreatorUserTimeIsNull() {
addCriterion("creator_user_time is null");
return (Criteria) this;
}
public Criteria andCreatorUserTimeIsNotNull() {
addCriterion("creator_user_time is not null");
return (Criteria) this;
}
public Criteria andCreatorUserTimeEqualTo(LocalDateTime value) {
addCriterion("creator_user_time =", value, "creatorUserTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andCreatorUserTimeEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("creator_user_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorUserTimeNotEqualTo(LocalDateTime value) {
addCriterion("creator_user_time <>", value, "creatorUserTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andCreatorUserTimeNotEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("creator_user_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorUserTimeGreaterThan(LocalDateTime value) {
addCriterion("creator_user_time >", value, "creatorUserTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andCreatorUserTimeGreaterThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("creator_user_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorUserTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("creator_user_time >=", value, "creatorUserTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andCreatorUserTimeGreaterThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("creator_user_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorUserTimeLessThan(LocalDateTime value) {
addCriterion("creator_user_time <", value, "creatorUserTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andCreatorUserTimeLessThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("creator_user_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorUserTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("creator_user_time <=", value, "creatorUserTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andCreatorUserTimeLessThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("creator_user_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andCreatorUserTimeIn(List<LocalDateTime> values) {
addCriterion("creator_user_time in", values, "creatorUserTime");
return (Criteria) this;
}
public Criteria andCreatorUserTimeNotIn(List<LocalDateTime> values) {
addCriterion("creator_user_time not in", values, "creatorUserTime");
return (Criteria) this;
}
public Criteria andCreatorUserTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("creator_user_time between", value1, value2, "creatorUserTime");
return (Criteria) this;
}
public Criteria andCreatorUserTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("creator_user_time not between", value1, value2, "creatorUserTime");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Short value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andStatusEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("`status` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Short value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andStatusNotEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("`status` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Short value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andStatusGreaterThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("`status` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Short value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andStatusGreaterThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("`status` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusLessThan(Short value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andStatusLessThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("`status` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Short value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andStatusLessThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("`status` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusIn(List<Short> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Short> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Short value1, Short value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Short value1, Short value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andAddTimeIsNull() {
addCriterion("add_time is null");
return (Criteria) this;
@@ -1271,268 +1659,6 @@ public class LitemallGrouponExample {
return (Criteria) this;
}
public Criteria andShareUrlIsNull() {
addCriterion("share_url is null");
return (Criteria) this;
}
public Criteria andShareUrlIsNotNull() {
addCriterion("share_url is not null");
return (Criteria) this;
}
public Criteria andShareUrlEqualTo(String value) {
addCriterion("share_url =", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlNotEqualTo(String value) {
addCriterion("share_url <>", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlNotEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlGreaterThan(String value) {
addCriterion("share_url >", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlGreaterThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlGreaterThanOrEqualTo(String value) {
addCriterion("share_url >=", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlGreaterThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLessThan(String value) {
addCriterion("share_url <", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlLessThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLessThanOrEqualTo(String value) {
addCriterion("share_url <=", value, "shareUrl");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andShareUrlLessThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("share_url <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andShareUrlLike(String value) {
addCriterion("share_url like", value, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotLike(String value) {
addCriterion("share_url not like", value, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlIn(List<String> values) {
addCriterion("share_url in", values, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotIn(List<String> values) {
addCriterion("share_url not in", values, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlBetween(String value1, String value2) {
addCriterion("share_url between", value1, value2, "shareUrl");
return (Criteria) this;
}
public Criteria andShareUrlNotBetween(String value1, String value2) {
addCriterion("share_url not between", value1, value2, "shareUrl");
return (Criteria) this;
}
public Criteria andPayedIsNull() {
addCriterion("payed is null");
return (Criteria) this;
}
public Criteria andPayedIsNotNull() {
addCriterion("payed is not null");
return (Criteria) this;
}
public Criteria andPayedEqualTo(Boolean value) {
addCriterion("payed =", value, "payed");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andPayedEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("payed = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPayedNotEqualTo(Boolean value) {
addCriterion("payed <>", value, "payed");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andPayedNotEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("payed <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPayedGreaterThan(Boolean value) {
addCriterion("payed >", value, "payed");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andPayedGreaterThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("payed > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPayedGreaterThanOrEqualTo(Boolean value) {
addCriterion("payed >=", value, "payed");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andPayedGreaterThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("payed >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPayedLessThan(Boolean value) {
addCriterion("payed <", value, "payed");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andPayedLessThanColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("payed < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPayedLessThanOrEqualTo(Boolean value) {
addCriterion("payed <=", value, "payed");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon
*
* @mbg.generated
*/
public Criteria andPayedLessThanOrEqualToColumn(LitemallGroupon.Column column) {
addCriterion(new StringBuilder("payed <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andPayedIn(List<Boolean> values) {
addCriterion("payed in", values, "payed");
return (Criteria) this;
}
public Criteria andPayedNotIn(List<Boolean> values) {
addCriterion("payed not in", values, "payed");
return (Criteria) this;
}
public Criteria andPayedBetween(Boolean value1, Boolean value2) {
addCriterion("payed between", value1, value2, "payed");
return (Criteria) this;
}
public Criteria andPayedNotBetween(Boolean value1, Boolean value2) {
addCriterion("payed not between", value1, value2, "payed");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;

View File

@@ -76,6 +76,24 @@ public class LitemallGrouponRules {
*/
private Integer discountMember;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.expire_time
*
* @mbg.generated
*/
private LocalDateTime expireTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.status
*
* @mbg.generated
*/
private Short status;
/**
*
* This field was generated by MyBatis Generator.
@@ -94,15 +112,6 @@ public class LitemallGrouponRules {
*/
private LocalDateTime updateTime;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon_rules.expire_time
*
* @mbg.generated
*/
private LocalDateTime expireTime;
/**
*
* This field was generated by MyBatis Generator.
@@ -256,6 +265,54 @@ public class LitemallGrouponRules {
this.discountMember = discountMember;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.expire_time
*
* @return the value of litemall_groupon_rules.expire_time
*
* @mbg.generated
*/
public LocalDateTime getExpireTime() {
return expireTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.expire_time
*
* @param expireTime the value for litemall_groupon_rules.expire_time
*
* @mbg.generated
*/
public void setExpireTime(LocalDateTime expireTime) {
this.expireTime = expireTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.status
*
* @return the value of litemall_groupon_rules.status
*
* @mbg.generated
*/
public Short getStatus() {
return status;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.status
*
* @param status the value for litemall_groupon_rules.status
*
* @mbg.generated
*/
public void setStatus(Short status) {
this.status = status;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.add_time
@@ -304,30 +361,6 @@ public class LitemallGrouponRules {
this.updateTime = updateTime;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon_rules.expire_time
*
* @return the value of litemall_groupon_rules.expire_time
*
* @mbg.generated
*/
public LocalDateTime getExpireTime() {
return expireTime;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon_rules.expire_time
*
* @param expireTime the value for litemall_groupon_rules.expire_time
*
* @mbg.generated
*/
public void setExpireTime(LocalDateTime expireTime) {
this.expireTime = expireTime;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
@@ -382,9 +415,10 @@ public class LitemallGrouponRules {
sb.append(", picUrl=").append(picUrl);
sb.append(", discount=").append(discount);
sb.append(", discountMember=").append(discountMember);
sb.append(", expireTime=").append(expireTime);
sb.append(", status=").append(status);
sb.append(", addTime=").append(addTime);
sb.append(", updateTime=").append(updateTime);
sb.append(", expireTime=").append(expireTime);
sb.append(", deleted=").append(deleted);
sb.append("]");
return sb.toString();
@@ -414,9 +448,10 @@ public class LitemallGrouponRules {
&& (this.getPicUrl() == null ? other.getPicUrl() == null : this.getPicUrl().equals(other.getPicUrl()))
&& (this.getDiscount() == null ? other.getDiscount() == null : this.getDiscount().equals(other.getDiscount()))
&& (this.getDiscountMember() == null ? other.getDiscountMember() == null : this.getDiscountMember().equals(other.getDiscountMember()))
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getAddTime() == null ? other.getAddTime() == null : this.getAddTime().equals(other.getAddTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
&& (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
}
@@ -436,9 +471,10 @@ public class LitemallGrouponRules {
result = prime * result + ((getPicUrl() == null) ? 0 : getPicUrl().hashCode());
result = prime * result + ((getDiscount() == null) ? 0 : getDiscount().hashCode());
result = prime * result + ((getDiscountMember() == null) ? 0 : getDiscountMember().hashCode());
result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getAddTime() == null) ? 0 : getAddTime().hashCode());
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
return result;
}
@@ -524,9 +560,10 @@ public class LitemallGrouponRules {
picUrl("pic_url", "picUrl", "VARCHAR", false),
discount("discount", "discount", "DECIMAL", false),
discountMember("discount_member", "discountMember", "INTEGER", false),
expireTime("expire_time", "expireTime", "TIMESTAMP", false),
status("status", "status", "SMALLINT", true),
addTime("add_time", "addTime", "TIMESTAMP", false),
updateTime("update_time", "updateTime", "TIMESTAMP", false),
expireTime("expire_time", "expireTime", "TIMESTAMP", false),
deleted("deleted", "deleted", "BIT", false);
/**

View File

@@ -1040,6 +1040,258 @@ public class LitemallGrouponRulesExample {
return (Criteria) this;
}
public Criteria andExpireTimeIsNull() {
addCriterion("expire_time is null");
return (Criteria) this;
}
public Criteria andExpireTimeIsNotNull() {
addCriterion("expire_time is not null");
return (Criteria) this;
}
public Criteria andExpireTimeEqualTo(LocalDateTime value) {
addCriterion("expire_time =", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeNotEqualTo(LocalDateTime value) {
addCriterion("expire_time <>", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeNotEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeGreaterThan(LocalDateTime value) {
addCriterion("expire_time >", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeGreaterThanColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("expire_time >=", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeGreaterThanOrEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeLessThan(LocalDateTime value) {
addCriterion("expire_time <", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeLessThanColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("expire_time <=", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeLessThanOrEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeIn(List<LocalDateTime> values) {
addCriterion("expire_time in", values, "expireTime");
return (Criteria) this;
}
public Criteria andExpireTimeNotIn(List<LocalDateTime> values) {
addCriterion("expire_time not in", values, "expireTime");
return (Criteria) this;
}
public Criteria andExpireTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("expire_time between", value1, value2, "expireTime");
return (Criteria) this;
}
public Criteria andExpireTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("expire_time not between", value1, value2, "expireTime");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Short value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andStatusEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("`status` = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Short value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andStatusNotEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("`status` <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Short value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andStatusGreaterThanColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("`status` > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Short value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andStatusGreaterThanOrEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("`status` >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusLessThan(Short value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andStatusLessThanColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("`status` < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Short value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andStatusLessThanOrEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("`status` <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andStatusIn(List<Short> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Short> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Short value1, Short value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Short value1, Short value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andAddTimeIsNull() {
addCriterion("add_time is null");
return (Criteria) this;
@@ -1292,132 +1544,6 @@ public class LitemallGrouponRulesExample {
return (Criteria) this;
}
public Criteria andExpireTimeIsNull() {
addCriterion("expire_time is null");
return (Criteria) this;
}
public Criteria andExpireTimeIsNotNull() {
addCriterion("expire_time is not null");
return (Criteria) this;
}
public Criteria andExpireTimeEqualTo(LocalDateTime value) {
addCriterion("expire_time =", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time = ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeNotEqualTo(LocalDateTime value) {
addCriterion("expire_time <>", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeNotEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time <> ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeGreaterThan(LocalDateTime value) {
addCriterion("expire_time >", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeGreaterThanColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time > ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("expire_time >=", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeGreaterThanOrEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time >= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeLessThan(LocalDateTime value) {
addCriterion("expire_time <", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeLessThanColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time < ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("expire_time <=", value, "expireTime");
return (Criteria) this;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_groupon_rules
*
* @mbg.generated
*/
public Criteria andExpireTimeLessThanOrEqualToColumn(LitemallGrouponRules.Column column) {
addCriterion(new StringBuilder("expire_time <= ").append(column.getEscapedColumnName()).toString());
return (Criteria) this;
}
public Criteria andExpireTimeIn(List<LocalDateTime> values) {
addCriterion("expire_time in", values, "expireTime");
return (Criteria) this;
}
public Criteria andExpireTimeNotIn(List<LocalDateTime> values) {
addCriterion("expire_time not in", values, "expireTime");
return (Criteria) this;
}
public Criteria andExpireTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("expire_time between", value1, value2, "expireTime");
return (Criteria) this;
}
public Criteria andExpireTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("expire_time not between", value1, value2, "expireTime");
return (Criteria) this;
}
public Criteria andDeletedIsNull() {
addCriterion("deleted is null");
return (Criteria) this;

View File

@@ -7,6 +7,7 @@ import org.linlinjava.litemall.db.dao.LitemallGrouponRulesMapper;
import org.linlinjava.litemall.db.domain.LitemallGoods;
import org.linlinjava.litemall.db.domain.LitemallGrouponRules;
import org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample;
import org.linlinjava.litemall.db.util.GrouponConstant;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -36,10 +37,8 @@ public class LitemallGrouponRulesService {
* @param id
* @return
*/
public LitemallGrouponRules queryById(Integer id) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
return mapper.selectOneByExample(example);
public LitemallGrouponRules findById(Integer id) {
return mapper.selectByPrimaryKey(id);
}
/**
@@ -50,12 +49,24 @@ public class LitemallGrouponRulesService {
*/
public List<LitemallGrouponRules> queryByGoodsId(Integer goodsId) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andGoodsIdEqualTo(goodsId).andDeletedEqualTo(false);
example.or().andGoodsIdEqualTo(goodsId).andStatusEqualTo(GrouponConstant.RULE_STATUS_ON).andDeletedEqualTo(false);
return mapper.selectByExample(example);
}
public int countByGoodsId(Integer goodsId) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andGoodsIdEqualTo(goodsId).andStatusEqualTo(GrouponConstant.RULE_STATUS_ON).andDeletedEqualTo(false);
return (int)mapper.countByExample(example);
}
public List<LitemallGrouponRules> queryByStatus(Short status) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andStatusEqualTo(status).andDeletedEqualTo(false);
return mapper.selectByExample(example);
}
/**
* 获取首页团购活动列表
* 获取首页团购规则列表
*
* @param page
* @param limit
@@ -67,14 +78,14 @@ public class LitemallGrouponRulesService {
public List<LitemallGrouponRules> queryList(Integer page, Integer limit, String sort, String order) {
LitemallGrouponRulesExample example = new LitemallGrouponRulesExample();
example.or().andDeletedEqualTo(false);
example.or().andStatusEqualTo(GrouponConstant.RULE_STATUS_ON).andDeletedEqualTo(false);
example.setOrderByClause(sort + " " + order);
PageHelper.startPage(page, limit);
return mapper.selectByExample(example);
}
/**
* 判断某个团购活动是否已经过期
* 判断某个团购规则是否已经过期
*
* @return
*/
@@ -83,7 +94,7 @@ public class LitemallGrouponRulesService {
}
/**
* 获取团购活动列表
* 获取团购规则列表
*
* @param goodsId
* @param page

View File

@@ -5,6 +5,7 @@ import com.github.pagehelper.PageHelper;
import org.linlinjava.litemall.db.dao.LitemallGrouponMapper;
import org.linlinjava.litemall.db.domain.LitemallGroupon;
import org.linlinjava.litemall.db.domain.LitemallGrouponExample;
import org.linlinjava.litemall.db.util.GrouponConstant;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -24,7 +25,7 @@ public class LitemallGrouponService {
*/
public List<LitemallGroupon> queryMyGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andDeletedEqualTo(false).andPayedEqualTo(true);
example.or().andUserIdEqualTo(userId).andCreatorUserIdEqualTo(userId).andGrouponIdEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
@@ -37,7 +38,7 @@ public class LitemallGrouponService {
*/
public List<LitemallGroupon> queryMyJoinGroupon(Integer userId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andGrouponIdNotEqualTo(0).andDeletedEqualTo(false).andPayedEqualTo(true);
example.or().andUserIdEqualTo(userId).andGrouponIdNotEqualTo(0).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
@@ -62,7 +63,7 @@ public class LitemallGrouponService {
*/
public List<LitemallGroupon> queryJoinRecord(Integer id) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andGrouponIdEqualTo(id).andDeletedEqualTo(false).andPayedEqualTo(true);
example.or().andGrouponIdEqualTo(id).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
example.orderBy("add_time desc");
return mapper.selectByExample(example);
}
@@ -75,7 +76,7 @@ public class LitemallGrouponService {
*/
public LitemallGroupon queryById(Integer id) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andIdEqualTo(id).andDeletedEqualTo(false).andPayedEqualTo(true);
example.or().andIdEqualTo(id).andDeletedEqualTo(false);
return mapper.selectOneByExample(example);
}
@@ -87,10 +88,16 @@ public class LitemallGrouponService {
*/
public int countGroupon(Integer grouponId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andGrouponIdEqualTo(grouponId).andDeletedEqualTo(false).andPayedEqualTo(true);
example.or().andGrouponIdEqualTo(grouponId).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
return (int) mapper.countByExample(example);
}
public boolean hasJoin(Integer userId, Integer grouponId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andUserIdEqualTo(userId).andGrouponIdEqualTo(grouponId).andStatusNotEqualTo(GrouponConstant.STATUS_NONE).andDeletedEqualTo(false);
return mapper.countByExample(example) != 0;
}
public int updateById(LitemallGroupon groupon) {
groupon.setUpdateTime(LocalDateTime.now());
return mapper.updateByPrimaryKeySelective(groupon);
@@ -127,10 +134,16 @@ public class LitemallGrouponService {
criteria.andRulesIdEqualTo(Integer.parseInt(rulesId));
}
criteria.andDeletedEqualTo(false);
criteria.andPayedEqualTo(true);
criteria.andStatusNotEqualTo(GrouponConstant.STATUS_NONE);
criteria.andGrouponIdEqualTo(0);
PageHelper.startPage(page, size);
return mapper.selectByExample(example);
}
public List<LitemallGroupon> queryByRuleId(int grouponRuleId) {
LitemallGrouponExample example = new LitemallGrouponExample();
example.or().andRulesIdEqualTo(grouponRuleId).andDeletedEqualTo(false);
return mapper.selectByExample(example);
}
}

View File

@@ -0,0 +1,15 @@
package org.linlinjava.litemall.db.util;
import org.linlinjava.litemall.db.domain.LitemallOrder;
public class GrouponConstant {
public static final Short RULE_STATUS_ON = 0;
public static final Short RULE_STATUS_DOWN_EXPIRE = 1;
public static final Short RULE_STATUS_DOWN_ADMIN = 2;
public static final Short STATUS_NONE = 0;
public static final Short STATUS_ON = 1;
public static final Short STATUS_SUCCEED = 2;
public static final Short STATUS_FAIL = 3;
}

View File

@@ -27,6 +27,7 @@ public class OrderUtil {
public static final Short STATUS_CONFIRM = 401;
public static final Short STATUS_CANCEL = 102;
public static final Short STATUS_AUTO_CANCEL = 103;
public static final Short STATUS_ADMIN_CANCEL = 104;
public static final Short STATUS_REFUND = 202;
public static final Short STATUS_REFUND_CONFIRM = 203;
public static final Short STATUS_AUTO_CONFIRM = 402;

View File

@@ -11,11 +11,12 @@
<result column="groupon_id" jdbcType="INTEGER" property="grouponId" />
<result column="rules_id" jdbcType="INTEGER" property="rulesId" />
<result column="user_id" jdbcType="INTEGER" property="userId" />
<result column="share_url" jdbcType="VARCHAR" property="shareUrl" />
<result column="creator_user_id" jdbcType="INTEGER" property="creatorUserId" />
<result column="creator_user_time" jdbcType="TIMESTAMP" property="creatorUserTime" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="share_url" jdbcType="VARCHAR" property="shareUrl" />
<result column="payed" jdbcType="BIT" property="payed" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Example_Where_Clause">
@@ -89,8 +90,8 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, order_id, groupon_id, rules_id, user_id, creator_user_id, add_time, update_time,
share_url, payed, deleted
id, order_id, groupon_id, rules_id, user_id, share_url, creator_user_id, creator_user_time,
`status`, add_time, update_time, deleted
</sql>
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponExample" resultMap="BaseResultMap">
<!--
@@ -212,13 +213,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_groupon (order_id, groupon_id, rules_id,
user_id, creator_user_id, add_time,
update_time, share_url, payed,
deleted)
user_id, share_url, creator_user_id,
creator_user_time, `status`, add_time,
update_time, deleted)
values (#{orderId,jdbcType=INTEGER}, #{grouponId,jdbcType=INTEGER}, #{rulesId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{creatorUserId,jdbcType=INTEGER}, #{addTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{shareUrl,jdbcType=VARCHAR}, #{payed,jdbcType=BIT},
#{deleted,jdbcType=BIT})
#{userId,jdbcType=INTEGER}, #{shareUrl,jdbcType=VARCHAR}, #{creatorUserId,jdbcType=INTEGER},
#{creatorUserTime,jdbcType=TIMESTAMP}, #{status,jdbcType=SMALLINT}, #{addTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallGroupon">
<!--
@@ -242,21 +243,24 @@
<if test="userId != null">
user_id,
</if>
<if test="shareUrl != null">
share_url,
</if>
<if test="creatorUserId != null">
creator_user_id,
</if>
<if test="creatorUserTime != null">
creator_user_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="shareUrl != null">
share_url,
</if>
<if test="payed != null">
payed,
</if>
<if test="deleted != null">
deleted,
</if>
@@ -274,21 +278,24 @@
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="shareUrl != null">
#{shareUrl,jdbcType=VARCHAR},
</if>
<if test="creatorUserId != null">
#{creatorUserId,jdbcType=INTEGER},
</if>
<if test="creatorUserTime != null">
#{creatorUserTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=SMALLINT},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shareUrl != null">
#{shareUrl,jdbcType=VARCHAR},
</if>
<if test="payed != null">
#{payed,jdbcType=BIT},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
@@ -326,21 +333,24 @@
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.shareUrl != null">
share_url = #{record.shareUrl,jdbcType=VARCHAR},
</if>
<if test="record.creatorUserId != null">
creator_user_id = #{record.creatorUserId,jdbcType=INTEGER},
</if>
<if test="record.creatorUserTime != null">
creator_user_time = #{record.creatorUserTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=SMALLINT},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.shareUrl != null">
share_url = #{record.shareUrl,jdbcType=VARCHAR},
</if>
<if test="record.payed != null">
payed = #{record.payed,jdbcType=BIT},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
@@ -360,11 +370,12 @@
groupon_id = #{record.grouponId,jdbcType=INTEGER},
rules_id = #{record.rulesId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
share_url = #{record.shareUrl,jdbcType=VARCHAR},
creator_user_id = #{record.creatorUserId,jdbcType=INTEGER},
creator_user_time = #{record.creatorUserTime,jdbcType=TIMESTAMP},
`status` = #{record.status,jdbcType=SMALLINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
share_url = #{record.shareUrl,jdbcType=VARCHAR},
payed = #{record.payed,jdbcType=BIT},
deleted = #{record.deleted,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -389,21 +400,24 @@
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="shareUrl != null">
share_url = #{shareUrl,jdbcType=VARCHAR},
</if>
<if test="creatorUserId != null">
creator_user_id = #{creatorUserId,jdbcType=INTEGER},
</if>
<if test="creatorUserTime != null">
creator_user_time = #{creatorUserTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=SMALLINT},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="shareUrl != null">
share_url = #{shareUrl,jdbcType=VARCHAR},
</if>
<if test="payed != null">
payed = #{payed,jdbcType=BIT},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
@@ -420,11 +434,12 @@
groupon_id = #{grouponId,jdbcType=INTEGER},
rules_id = #{rulesId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
share_url = #{shareUrl,jdbcType=VARCHAR},
creator_user_id = #{creatorUserId,jdbcType=INTEGER},
creator_user_time = #{creatorUserTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=SMALLINT},
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
share_url = #{shareUrl,jdbcType=VARCHAR},
payed = #{payed,jdbcType=BIT},
deleted = #{deleted,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>

View File

@@ -12,9 +12,10 @@
<result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
<result column="discount" jdbcType="DECIMAL" property="discount" />
<result column="discount_member" jdbcType="INTEGER" property="discountMember" />
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="add_time" jdbcType="TIMESTAMP" property="addTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="expire_time" jdbcType="TIMESTAMP" property="expireTime" />
<result column="deleted" jdbcType="BIT" property="deleted" />
</resultMap>
<sql id="Example_Where_Clause">
@@ -88,8 +89,8 @@
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, goods_id, goods_name, pic_url, discount, discount_member, add_time, update_time,
expire_time, deleted
id, goods_id, goods_name, pic_url, discount, discount_member, expire_time, `status`,
add_time, update_time, deleted
</sql>
<select id="selectByExample" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRulesExample" resultMap="BaseResultMap">
<!--
@@ -211,13 +212,13 @@
SELECT LAST_INSERT_ID()
</selectKey>
insert into litemall_groupon_rules (goods_id, goods_name, pic_url,
discount, discount_member, add_time,
update_time, expire_time, deleted
)
discount, discount_member, expire_time,
`status`, add_time, update_time,
deleted)
values (#{goodsId,jdbcType=INTEGER}, #{goodsName,jdbcType=VARCHAR}, #{picUrl,jdbcType=VARCHAR},
#{discount,jdbcType=DECIMAL}, #{discountMember,jdbcType=INTEGER}, #{addTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}, #{expireTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}
)
#{discount,jdbcType=DECIMAL}, #{discountMember,jdbcType=INTEGER}, #{expireTime,jdbcType=TIMESTAMP},
#{status,jdbcType=SMALLINT}, #{addTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{deleted,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="org.linlinjava.litemall.db.domain.LitemallGrouponRules">
<!--
@@ -244,15 +245,18 @@
<if test="discountMember != null">
discount_member,
</if>
<if test="expireTime != null">
expire_time,
</if>
<if test="status != null">
`status`,
</if>
<if test="addTime != null">
add_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="expireTime != null">
expire_time,
</if>
<if test="deleted != null">
deleted,
</if>
@@ -273,15 +277,18 @@
<if test="discountMember != null">
#{discountMember,jdbcType=INTEGER},
</if>
<if test="expireTime != null">
#{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
#{status,jdbcType=SMALLINT},
</if>
<if test="addTime != null">
#{addTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="expireTime != null">
#{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
#{deleted,jdbcType=BIT},
</if>
@@ -322,15 +329,18 @@
<if test="record.discountMember != null">
discount_member = #{record.discountMember,jdbcType=INTEGER},
</if>
<if test="record.expireTime != null">
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=SMALLINT},
</if>
<if test="record.addTime != null">
add_time = #{record.addTime,jdbcType=TIMESTAMP},
</if>
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
</if>
<if test="record.expireTime != null">
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
</if>
<if test="record.deleted != null">
deleted = #{record.deleted,jdbcType=BIT},
</if>
@@ -351,9 +361,10 @@
pic_url = #{record.picUrl,jdbcType=VARCHAR},
discount = #{record.discount,jdbcType=DECIMAL},
discount_member = #{record.discountMember,jdbcType=INTEGER},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
`status` = #{record.status,jdbcType=SMALLINT},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
deleted = #{record.deleted,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@@ -381,15 +392,18 @@
<if test="discountMember != null">
discount_member = #{discountMember,jdbcType=INTEGER},
</if>
<if test="expireTime != null">
expire_time = #{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="status != null">
`status` = #{status,jdbcType=SMALLINT},
</if>
<if test="addTime != null">
add_time = #{addTime,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="expireTime != null">
expire_time = #{expireTime,jdbcType=TIMESTAMP},
</if>
<if test="deleted != null">
deleted = #{deleted,jdbcType=BIT},
</if>
@@ -407,9 +421,10 @@
pic_url = #{picUrl,jdbcType=VARCHAR},
discount = #{discount,jdbcType=DECIMAL},
discount_member = #{discountMember,jdbcType=INTEGER},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
`status` = #{status,jdbcType=SMALLINT},
add_time = #{addTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
deleted = #{deleted,jdbcType=BIT}
where id = #{id,jdbcType=INTEGER}
</update>

View File

@@ -56,6 +56,7 @@ public class WxGrouponRuleService {
grouponRuleVo.setGrouponPrice(goods.getRetailPrice().subtract(rule.getDiscount()));
grouponRuleVo.setGrouponDiscount(rule.getDiscount());
grouponRuleVo.setGrouponMember(rule.getDiscountMember());
grouponRuleVo.setExpireTime(rule.getExpireTime());
grouponList.add(grouponRuleVo);
}

View File

@@ -25,6 +25,7 @@ import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.*;
import org.linlinjava.litemall.db.service.*;
import org.linlinjava.litemall.db.util.CouponUserConstant;
import org.linlinjava.litemall.db.util.GrouponConstant;
import org.linlinjava.litemall.db.util.OrderHandleOption;
import org.linlinjava.litemall.db.util.OrderUtil;
import org.linlinjava.litemall.core.util.IpUtil;
@@ -262,14 +263,31 @@ public class WxOrderService {
//如果是团购项目,验证活动是否有效
if (grouponRulesId != null && grouponRulesId > 0) {
LitemallGrouponRules rules = grouponRulesService.queryById(grouponRulesId);
LitemallGrouponRules rules = grouponRulesService.findById(grouponRulesId);
//找不到记录
if (rules == null) {
return ResponseUtil.badArgument();
}
//团购活动已经过期
if (grouponRulesService.isExpired(rules)) {
return ResponseUtil.fail(GROUPON_EXPIRED, "团购活动已过期!");
//团购规则已经过期
if (rules.getStatus().equals(GrouponConstant.RULE_STATUS_DOWN_EXPIRE)) {
return ResponseUtil.fail(GROUPON_EXPIRED, "团购已过期!");
}
//团购规则已经下线
if (rules.getStatus().equals(GrouponConstant.RULE_STATUS_DOWN_ADMIN)) {
return ResponseUtil.fail(GROUPON_OFFLINE, "团购已下线!");
}
if (grouponLinkId != null && grouponLinkId > 0) {
//团购人数已满
if(grouponService.countGroupon(grouponLinkId) >= rules.getDiscountMember()){
return ResponseUtil.fail(GROUPON_FULL, "团购活动人数已满!");
}
// NOTE
// 这里业务方面允许用户多次开团,以及多次参团,
// 但是不允许参加已经参加过的团购
if(grouponService.hasJoin(userId, grouponLinkId)){
return ResponseUtil.fail(GROUPON_JOIN, "团购活动已经参加!");
}
}
}
@@ -284,8 +302,8 @@ public class WxOrderService {
}
// 团购优惠
BigDecimal grouponPrice = new BigDecimal(0.00);
LitemallGrouponRules grouponRules = grouponRulesService.queryById(grouponRulesId);
BigDecimal grouponPrice = new BigDecimal(0);
LitemallGrouponRules grouponRules = grouponRulesService.findById(grouponRulesId);
if (grouponRules != null) {
grouponPrice = grouponRules.getDiscount();
}
@@ -302,7 +320,7 @@ public class WxOrderService {
if (checkedGoodsList.size() == 0) {
return ResponseUtil.badArgumentValue();
}
BigDecimal checkedGoodsPrice = new BigDecimal(0.00);
BigDecimal checkedGoodsPrice = new BigDecimal(0);
for (LitemallCart checkGoods : checkedGoodsList) {
// 只有当团购规格商品ID符合才进行团购优惠
if (grouponRules != null && grouponRules.getGoodsId().equals(checkGoods.getGoodsId())) {
@@ -314,7 +332,7 @@ public class WxOrderService {
// 获取可用的优惠券信息
// 使用优惠券减免的金额
BigDecimal couponPrice = new BigDecimal(0.00);
BigDecimal couponPrice = new BigDecimal(0);
// 如果couponId=0则没有优惠券couponId=-1则不使用优惠券
if (couponId != 0 && couponId != -1) {
LitemallCoupon coupon = couponVerifyService.checkCoupon(userId, couponId, userCouponId, checkedGoodsPrice);
@@ -326,16 +344,16 @@ public class WxOrderService {
// 根据订单商品总价计算运费满足条件例如88元则免运费否则需要支付运费例如8元
BigDecimal freightPrice = new BigDecimal(0.00);
BigDecimal freightPrice = new BigDecimal(0);
if (checkedGoodsPrice.compareTo(SystemConfig.getFreightLimit()) < 0) {
freightPrice = SystemConfig.getFreight();
}
// 可以使用的其他钱,例如用户积分
BigDecimal integralPrice = new BigDecimal(0.00);
BigDecimal integralPrice = new BigDecimal(0);
// 订单费用
BigDecimal orderTotalPrice = checkedGoodsPrice.add(freightPrice).subtract(couponPrice).max(new BigDecimal(0.00));
BigDecimal orderTotalPrice = checkedGoodsPrice.add(freightPrice).subtract(couponPrice).max(new BigDecimal(0));
// 最终支付费用
BigDecimal actualPrice = orderTotalPrice.subtract(integralPrice);
@@ -358,11 +376,11 @@ public class WxOrderService {
order.setOrderPrice(orderTotalPrice);
order.setActualPrice(actualPrice);
// 有团购活动
// 有团购
if (grouponRules != null) {
order.setGrouponPrice(grouponPrice); // 团购价格
} else {
order.setGrouponPrice(new BigDecimal(0.00)); // 团购价格
order.setGrouponPrice(new BigDecimal(0)); // 团购价格
}
// 添加订单表项
@@ -395,7 +413,7 @@ public class WxOrderService {
Integer productId = checkGoods.getProductId();
LitemallGoodsProduct product = productService.findById(productId);
Integer remainNumber = product.getNumber() - checkGoods.getNumber();
int remainNumber = product.getNumber() - checkGoods.getNumber();
if (remainNumber < 0) {
throw new RuntimeException("下单的商品货品数量大于库存量");
}
@@ -417,7 +435,7 @@ public class WxOrderService {
if (grouponRulesId != null && grouponRulesId > 0) {
LitemallGroupon groupon = new LitemallGroupon();
groupon.setOrderId(orderId);
groupon.setPayed(false);
groupon.setStatus(GrouponConstant.STATUS_NONE);
groupon.setUserId(userId);
groupon.setRulesId(grouponRulesId);
@@ -428,12 +446,14 @@ public class WxOrderService {
groupon.setCreatorUserId(baseGroupon.getCreatorUserId());
groupon.setGrouponId(grouponLinkId);
groupon.setShareUrl(baseGroupon.getShareUrl());
grouponService.createGroupon(groupon);
} else {
groupon.setCreatorUserId(userId);
groupon.setCreatorUserTime(LocalDateTime.now());
groupon.setGrouponId(0);
grouponService.createGroupon(groupon);
grouponLinkId = groupon.getId();
}
grouponService.createGroupon(groupon);
}
// 订单支付超期任务
@@ -441,6 +461,12 @@ public class WxOrderService {
Map<String, Object> data = new HashMap<>();
data.put("orderId", orderId);
if (grouponRulesId != null && grouponRulesId > 0) {
data.put("grouponLinkId", grouponLinkId);
}
else {
data.put("grouponLinkId", 0);
}
return ResponseUtil.ok(data);
}
@@ -451,7 +477,6 @@ public class WxOrderService {
* 2. 设置订单取消状态;
* 3. 商品货品库存恢复;
* 4. TODO 优惠券;
* 5. TODO 团购活动。
*
* @param userId 用户ID
* @param body 订单信息,{ orderIdxxx }
@@ -721,47 +746,29 @@ public class WxOrderService {
// 支付成功,有团购信息,更新团购信息
LitemallGroupon groupon = grouponService.queryByOrderId(order.getId());
if (groupon != null) {
LitemallGrouponRules grouponRules = grouponRulesService.queryById(groupon.getRulesId());
LitemallGrouponRules grouponRules = grouponRulesService.findById(groupon.getRulesId());
//仅当发起者才创建分享图片
if (groupon.getGrouponId() == 0) {
String url = qCodeService.createGrouponShareImage(grouponRules.getGoodsName(), grouponRules.getPicUrl(), groupon);
groupon.setShareUrl(url);
}
groupon.setPayed(true);
groupon.setStatus(GrouponConstant.STATUS_ON);
if (grouponService.updateById(groupon) == 0) {
return WxPayNotifyResponse.fail("更新数据已失效");
}
// 团购已达成,更新关联订单支付状态
if (groupon.getGrouponId() > 0) {
List<LitemallGroupon> grouponList = grouponService.queryJoinRecord(groupon.getGrouponId());
if (grouponList.size() >= grouponRules.getDiscountMember() - 1) {
for (LitemallGroupon grouponActivity : grouponList) {
if (grouponActivity.getOrderId().equals(order.getId())) {
//当前订单
continue;
}
LitemallOrder grouponOrder = orderService.findById(grouponActivity.getOrderId());
if (grouponOrder.getOrderStatus().equals(OrderUtil.STATUS_PAY_GROUPON)) {
grouponOrder.setOrderStatus(OrderUtil.STATUS_PAY);
orderService.updateWithOptimisticLocker(grouponOrder);
}
}
LitemallGroupon grouponSource = grouponService.queryById(groupon.getGrouponId());
LitemallOrder grouponOrder = orderService.findById(grouponSource.getOrderId());
if (grouponOrder.getOrderStatus().equals(OrderUtil.STATUS_PAY_GROUPON)) {
grouponOrder.setOrderStatus(OrderUtil.STATUS_PAY);
orderService.updateWithOptimisticLocker(grouponOrder);
}
List<LitemallGroupon> grouponList = grouponService.queryJoinRecord(groupon.getGrouponId());
if (groupon.getGrouponId() != 0 && (grouponList.size() >= grouponRules.getDiscountMember() - 1)) {
for (LitemallGroupon grouponActivity : grouponList) {
grouponActivity.setStatus(GrouponConstant.STATUS_SUCCEED);
grouponService.updateById(grouponActivity);
}
} else {
order = orderService.findBySn(orderSn);
order.setOrderStatus(OrderUtil.STATUS_PAY_GROUPON);
orderService.updateWithOptimisticLocker(order);
LitemallGroupon grouponSource = grouponService.queryById(groupon.getGrouponId());
grouponSource.setStatus(GrouponConstant.STATUS_SUCCEED);
grouponService.updateById(grouponSource);
}
}

View File

@@ -28,6 +28,9 @@ public class WxResponseCode {
public static final Integer ORDER_COMMENT_EXPIRED = 727;
public static final Integer GROUPON_EXPIRED = 730;
public static final Integer GROUPON_OFFLINE = 731;
public static final Integer GROUPON_FULL = 732;
public static final Integer GROUPON_JOIN = 733;
public static final int COUPON_EXCEED_LIMIT = 740;
public static final int COUPON_RECEIVE_FAIL= 741;

View File

@@ -1,6 +1,7 @@
package org.linlinjava.litemall.wx.vo;
import java.math.BigDecimal;
import java.time.LocalDateTime;
public class GrouponRuleVo {
private Integer id;
@@ -12,6 +13,15 @@ public class GrouponRuleVo {
private BigDecimal grouponPrice;
private BigDecimal grouponDiscount;
private Integer grouponMember;
private LocalDateTime expireTime;
public LocalDateTime getExpireTime() {
return expireTime;
}
public void setExpireTime(LocalDateTime expireTime) {
this.expireTime = expireTime;
}
public BigDecimal getGrouponDiscount() {
return grouponDiscount;

View File

@@ -438,7 +438,7 @@ public class WxCartController {
// 团购优惠
BigDecimal grouponPrice = new BigDecimal(0.00);
LitemallGrouponRules grouponRules = grouponRulesService.queryById(grouponRulesId);
LitemallGrouponRules grouponRules = grouponRulesService.findById(grouponRulesId);
if (grouponRules != null) {
grouponPrice = grouponRules.getDiscount();
}

View File

@@ -19,13 +19,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 优惠券服务
@@ -132,7 +129,7 @@ public class WxCouponController {
// 团购优惠
BigDecimal grouponPrice = new BigDecimal(0.00);
LitemallGrouponRules grouponRules = grouponRulesService.queryById(grouponRulesId);
LitemallGrouponRules grouponRules = grouponRulesService.findById(grouponRulesId);
if (grouponRules != null) {
grouponPrice = grouponRules.getDiscount();
}

View File

@@ -92,7 +92,7 @@ public class WxGrouponController {
return ResponseUtil.badArgumentValue();
}
LitemallGrouponRules rules = rulesService.queryById(groupon.getRulesId());
LitemallGrouponRules rules = rulesService.findById(groupon.getRulesId());
if (rules == null) {
return ResponseUtil.badArgumentValue();
}
@@ -186,7 +186,7 @@ public class WxGrouponController {
return ResponseUtil.badArgumentValue();
}
LitemallGrouponRules rules = rulesService.queryById(groupon.getRulesId());
LitemallGrouponRules rules = rulesService.findById(groupon.getRulesId());
if (rules == null) {
return ResponseUtil.badArgumentValue();
}
@@ -230,7 +230,7 @@ public class WxGrouponController {
LitemallUser creator;
for (LitemallGroupon groupon : myGroupons) {
order = orderService.findById(groupon.getOrderId());
rules = rulesService.queryById(groupon.getRulesId());
rules = rulesService.findById(groupon.getRulesId());
creator = userService.findById(groupon.getCreatorUserId());
Map<String, Object> grouponVo = new HashMap<>();
@@ -257,7 +257,6 @@ public class WxGrouponController {
grouponVo.put("orderSn", order.getOrderSn());
grouponVo.put("actualPrice", order.getActualPrice());
grouponVo.put("orderStatusText", OrderUtil.orderStatusText(order));
grouponVo.put("handleOption", OrderUtil.build(order));
List<LitemallOrderGoods> orderGoodsList = orderGoodsService.queryByOid(order.getId());
List<Map<String, Object>> orderGoodsVoList = new ArrayList<>(orderGoodsList.size());

View File

@@ -87,7 +87,8 @@
},
"debug": true,
"usingComponents": {
"van-tag": "./lib/vant-weapp/tag/index"
"van-tag": "./lib/vant-weapp/tag/index",
"van-steps": "./lib/vant-weapp/steps/index"
},
"sitemapLocation": "sitemap.json"
}

View File

@@ -19,7 +19,7 @@ Page({
couponId: 0,
userCouponId: 0,
message: '',
grouponLinkId: 0, //参与的团购如果是发起则为0
grouponLinkId: 0, //参与的团购
grouponRulesId: 0 //团购规则ID
},
onLoad: function(options) {
@@ -145,7 +145,7 @@ Page({
grouponLinkId: this.data.grouponLinkId
}, 'POST').then(res => {
if (res.errno === 0) {
// 下单成功重置couponId
try {
wx.setStorageSync('couponId', 0);
@@ -154,6 +154,7 @@ Page({
}
const orderId = res.data.orderId;
const grouponLinkId = res.data.grouponLinkId;
util.request(api.OrderPrepay, {
orderId: orderId
}, 'POST').then(function(res) {
@@ -168,9 +169,17 @@ Page({
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
if (grouponLinkId) {
setTimeout(() => {
wx.redirectTo({
url: '/pages/groupon/grouponDetail/grouponDetail?id=' + grouponLinkId
})
}, 1000);
} else {
wx.redirectTo({
url: '/pages/payResult/payResult?status=1&orderId=' + orderId
});
}
},
'fail': function(res) {
console.log("支付过程失败");

View File

@@ -4,15 +4,15 @@ var api = require('../../../config/api.js');
Page({
data: {
id: 0,
orderId: 0,
groupon: {},
linkGrouponId: 0,
joiners: [],
orderInfo: {},
orderGoods: [],
expressInfo: {},
flag: false,
handleOption: {}
rules: {},
active: 0,
steps: [],
activeIcon: '',
activeColor: ''
},
onLoad: function(options) {
@@ -29,249 +29,54 @@ Page({
return {
title: '邀请团购',
desc: '唯爱与美食不可辜负',
path: '/pages/index/index?grouponId=' + this.data.linkGrouponId
path: '/pages/index/index?grouponId=' + this.data.id
}
},
shareGroupon: function() {
let that = this;
wx.showActionSheet({
itemList: ['分享给朋友', '分享到朋友圈'],
success: function(res) {
if (res.tapIndex == 0) {
wx.showModal({
title: '提示',
content: '点击右上角 "..." 转发给朋友',
showCancel: false
});
} else if (res.tapIndex == 1) {
that.saveShare();
} else {
console.log(res.tapIndex);
}
},
fail: function(res) {
console.log(res.errMsg);
}
})
},
// 保存分享图
saveShare: function() {
let that = this;
wx.downloadFile({
url: that.data.groupon.shareUrl,
success: function(res) {
console.log(res)
wx.saveImageToPhotosAlbum({
filePath: res.tempFilePath,
success: function(res) {
wx.showModal({
title: '存图成功',
content: '图片成功保存到相册了,可以分享到朋友圈了',
showCancel: false,
confirmText: '好的',
confirmColor: '#a78845',
success: function(res) {
if (res.confirm) {
console.log('用户点击确定');
}
}
})
},
fail: function(res) {
console.log('fail')
}
})
},
fail: function() {
console.log('fail')
}
})
},
onPullDownRefresh() {
wx.showNavigationBarLoading() //在标题栏中显示加载
this.getOrderDetail();
wx.hideNavigationBarLoading() //完成停止加载
wx.stopPullDownRefresh() //停止下拉刷新
},
//获取物流信息
getOrderExpress: function() {
let that = this;
util.request(api.ExpressQuery, {
expCode: that.data.orderInfo.expCode,
expNo: that.data.orderInfo.expNo
}, 'POST').then(function(res) {
if (res.errno === 0) {
that.setData({
expressInfo: res.data
});
}
});
},
expandDetail: function() {
let that = this;
this.setData({
flag: !that.data.flag
})
},
getOrderDetail: function() {
let that = this;
util.request(api.GroupOnDetail, {
grouponId: that.data.id
}).then(function(res) {
if (res.errno === 0) {
let _steps = [{
text: '已开团'
},
{
text: '开团中'
},
{
text: '开团成功'
}
]
let _active = res.data.groupon.status
let _activeIcon = 'success'
let _activeColor = '#07c160'
if (res.data.groupon.status === 3) {
_steps = [{
text: '已开团'
},
{
text: '开团中'
},
{
text: '开团失败'
}
]
_active = 2
_activeIcon = 'fail'
_activeColor = '#EE0A24'
}
that.setData({
joiners: res.data.joiners,
groupon: res.data.groupon,
linkGrouponId: res.data.linkGrouponId,
orderId: res.data.orderInfo.id,
orderInfo: res.data.orderInfo,
orderGoods: res.data.orderGoods,
handleOption: res.data.orderInfo.handleOption
rules: res.data.rules,
active: _active,
steps: _steps,
activeIcon: _activeIcon,
activeColor: _activeColor
});
// 请求物流信息,仅当订单状态为发货时才请求
if (res.data.orderInfo.handleOption.confirm) {
that.getOrderExpress();
}
}
});
},
// “去付款”按钮点击效果
payOrder: function() {
let that = this;
util.request(api.OrderPrepay, {
orderId: that.data.orderId
}, 'POST').then(function(res) {
if (res.errno === 0) {
const payParam = res.data;
console.log("支付过程开始");
wx.requestPayment({
'timeStamp': payParam.timeStamp,
'nonceStr': payParam.nonceStr,
'package': payParam.packageValue,
'signType': payParam.signType,
'paySign': payParam.paySign,
'success': function(res) {
console.log("支付过程成功");
util.redirect('/pages/ucenter/order/order');
},
'fail': function(res) {
console.log("支付过程失败");
util.showErrorToast('支付失败');
},
'complete': function(res) {
console.log("支付过程结束")
}
});
}
});
},
// “取消订单”点击效果
cancelOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要取消此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderCancel, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “取消订单并退款”点击效果
refundOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要取消此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderRefund, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '取消订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “删除”点击效果
deleteOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确定要删除此订单?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderDelete, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '删除订单成功'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},
// “确认收货”点击效果
confirmOrder: function() {
let that = this;
let orderInfo = that.data.orderInfo;
wx.showModal({
title: '',
content: '确认收货?',
success: function(res) {
if (res.confirm) {
util.request(api.OrderConfirm, {
orderId: orderInfo.id
}, 'POST').then(function(res) {
if (res.errno === 0) {
wx.showToast({
title: '确认收货成功!'
});
util.redirect('/pages/ucenter/order/order');
} else {
util.showErrorToast(res.errmsg);
}
});
}
}
});
},

View File

@@ -1,13 +1,17 @@
<view class="container">
<view class="order-info">
<view class="item-a">下单时间:{{orderInfo.addTime}}</view>
<view class="item-b">订单编号:{{orderInfo.orderSn}}</view>
<view class="item-c">
<view class="l">实付:
<text class="cost">¥{{orderInfo.actualPrice}}</text>
<view class="progress">
<view class="item-a">
<van-steps steps="{{ steps }}" active="{{ active }}" active-icon="{{ activeIcon }}"
active-color="{{ activeColor }}" />
</view>
<view class="item-c" wx:if="{{groupon.status === 1}}">
<view class="l">
开团还缺
<van-tag type="danger">{{rules.discountMember - joiners.length}}</van-tag>
</view>
<view class="r">
<view class="btn active" bindtap="shareGroupon">邀请参团</view>
<button class="btn active" open-type="share">邀请参团</button>
</view>
</view>
</view>
@@ -26,7 +30,6 @@
<view class="order-goods">
<view class="h">
<view class="label">商品信息</view>
<view class="status">{{orderInfo.orderStatusText}}</view>
</view>
<view class="goods">
<view class="item" wx:for="{{orderGoods}}" wx:key="id">
@@ -45,47 +48,20 @@
</view>
<view class="order-bottom">
<view class="address">
<view class="t">
<text class="name">{{orderInfo.consignee}}</text>
<text class="mobile">{{orderInfo.mobile}}</text>
</view>
<view class="b">{{orderInfo.address}}</view>
</view>
<view class="total">
<view class="t">
<text class="label">商品合计:</text>
<text class="txt">¥{{orderInfo.goodsPrice}}</text>
</view>
<view class="t">
<text class="label">运费:</text>
<text class="label">商品运费:</text>
<text class="txt">¥{{orderInfo.freightPrice}}</text>
</view>
</view>
<view class="pay-fee">
<text class="label">实付:</text>
<text class="label">商品实付:</text>
<text class="txt">¥{{orderInfo.actualPrice}}</text>
</view>
</view>
</view>
<!-- 物流信息,仅收货状态下可见 -->
<view class="order-express" bindtap="expandDetail" wx:if="{{ handleOption.confirm }}">
<view class="expand">
<view class="title">
<view class="t">快递公司:{{expressInfo.shipperName}}</view>
<view class="b">物流单号:{{expressInfo.logisticCode}}</view>
</view>
<image class="ti" src="/static/images/address_right.png" background-size="cover"></image>
</view>
<!-- <view class="order-express" > -->
<view class="traces" wx:for="{{expressInfo.Traces}}" wx:key="item" wx:for-item="iitem" wx:if="{{ flag }}">
<view class="trace">
<view class="acceptStation">{{iitem.AcceptStation}}</view>
<view class="acceptTime">{{iitem.AcceptTime}}</view>
</view>
</view>
</view>
<!-- </view> -->
</view>

View File

@@ -4,7 +4,7 @@ page {
background: #f4f4f4;
}
.order-info {
.progress {
padding-top: 25rpx;
background: #fff;
height: auto;
@@ -12,27 +12,11 @@ page {
}
.item-a {
padding-left: 31.25rpx;
height: 42.5rpx;
padding-bottom: 12.5rpx;
line-height: 30rpx;
font-size: 30rpx;
color: #666;
}
.item-b {
padding-left: 31.25rpx;
height: 29rpx;
line-height: 29rpx;
margin-top: 12.5rpx;
margin-bottom: 41.5rpx;
font-size: 30rpx;
color: #666;
padding: 0 21.25rpx;
}
.item-c {
margin-left: 31.25rpx;
border-top: 1px solid #f4f4f4;
height: 103rpx;
line-height: 103rpx;
}
@@ -49,16 +33,10 @@ page {
padding-right: 16rpx;
}
.item-c .r .btn {
float: right;
}
.item-c .cost {
color: #b4282d;
}
.item-c .btn {
float: right;
line-height: 66rpx;
font-size: 30rpx;
border-radius: 5rpx;
text-align: center;
margin: 0 15rpx;
@@ -236,23 +214,21 @@ page {
height: 30rpx;
line-height: 30rpx;
margin-bottom: 7.5rpx;
display: flex;
}
.order-bottom .total .label {
.order-bottom .total .t .label {
width: 150rpx;
display: inline-block;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
}
.order-bottom .total .txt {
flex: 1;
display: inline-block;
.order-bottom .total .t .txt {
float: right;
height: 35rpx;
line-height: 35rpx;
font-size: 30rpx;
padding-right: 31.25rpx;
}
.order-bottom .pay-fee {
@@ -261,79 +237,12 @@ page {
}
.order-bottom .pay-fee .label {
display: inline-block;
width: 140rpx;
color: #b4282d;
}
.order-bottom .pay-fee .txt {
display: inline-block;
width: 140rpx;
color: #b4282d;
}
.order-express {
margin-top: 20rpx;
width: 100%;
height: 100rpx;
background: #fff;
}
.order-express .expand {
/* margin-top: 20rpx; */
width: 100%;
height: 100rpx;
background: #fff;
/* border: 10rpx #a78845; */
}
.order-express .title {
float: left;
margin-bottom: 20rpx;
padding: 10rpx;
}
.order-express .ti {
float: right;
width: 52rpx;
height: 52rpx;
margin-right: 16rpx;
margin-top: 28rpx;
}
.order-express .t {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
}
.order-express .b {
font-size: 29rpx;
margin-left: 10.25rpx;
color: #a78845;
}
.order-express .traces {
padding: 17.5rpx;
background: #fff;
border-bottom: 1rpx solid #f1e6cdcc;
}
.order-express .trace {
padding-bottom: 17.5rpx;
padding-top: 17.5rpx;
background: #fff;
}
.order-express .acceptTime {
margin-top: 20rpx;
margin-right: 40rpx;
text-align: right;
font-size: 26rpx;
}
.order-express .acceptStation {
font-size: 26rpx;
padding-right: 31.25rpx;
}
.menu-list-pro {

View File

@@ -8,8 +8,11 @@
<view class="text">
<view class="header">
<text class="name">{{item.name}}</text>
<van-tag type="warning">{{item.grouponMember}}人成团</van-tag>
<van-tag type="primary">{{item.grouponMember}}人成团</van-tag>
</view>
<view class="expire">
<van-tag round type="warning">有效期至 {{item.expireTime}}</van-tag>
</view>
<text class="desc">{{item.brief}}</text>
<view class="price">
<view class="counterPrice">现价:¥{{item.retailPrice}}</view>

View File

@@ -47,7 +47,6 @@ page, .container {
.groupon-list .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;

View File

@@ -16,6 +16,12 @@
<view class="orders">
<navigator url="../grouponDetail/grouponDetail?id={{item.id}}" class="order" open-type="navigate" wx:for="{{orderList}}" wx:key="id">
<view class="h">
<van-tag type="primary" wx:if="{{item.groupon.status === 1}}">开团中</van-tag>
<van-tag type="success" wx:if="{{item.groupon.status === 2}}">开团成功</van-tag>
<van-tag type="danger" wx:if="{{item.groupon.status === 3}}">开团失败</van-tag>
<van-tag round type="warning" wx:if="{{!item.isCreator}}">{{item.creator}}发起</van-tag>
</view>
<view class="h">
<view class="l">订单编号:{{item.orderSn}}</view>
<view class="r">{{item.orderStatusText}}</view>
@@ -26,7 +32,7 @@
</view>
<view class="i">
<view class="l">团购要求:{{item.rules.discountMember}}人</view>
<view class="r">当前参{{item.joinerCount}}</view>
<view class="r">当前参{{item.joinerCount}}</view>
</view>
<view class="goods" wx:for="{{item.goodsList}}" wx:key="id" wx:for-item="gitem">
<view class="img">
@@ -40,8 +46,6 @@
</view>
<view class="b">
<view class="l">实付:¥{{item.actualPrice}}</view>
<van-tag type="primary">{{item.joinerCount>=item.rules.discountMember?'已达成':'团购中'}}</van-tag>
<van-tag round type="warning" wx:if="{{!item.isCreator}}">{{item.creator}}发起</van-tag>
</view>
</navigator>
</view>

View File

@@ -72,7 +72,10 @@
<view class="text">
<view class="header">
<text class="name">{{item.name}}</text>
<van-tag type="warning">{{item.grouponMember}}人成团</van-tag>
<van-tag type="primary">{{item.grouponMember}}人成团</van-tag>
</view>
<view class="expire">
<van-tag round type="warning">有效期至 {{item.expireTime}}</van-tag>
</view>
<text class="desc">{{item.brief}}</text>
<view class="price">

View File

@@ -235,7 +235,6 @@
.a-groupon .b .name {
float: left;
width: 330rpx;
display: block;
color: #333;
line-height: 50rpx;

View File

@@ -267,6 +267,13 @@
"pathName": "pages/help/help",
"query": "",
"scene": null
},
{
"id": -1,
"name": "我的团购",
"pathName": "pages/groupon/myGroupon/myGroupon",
"query": "",
"scene": null
}
]
}