Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
39135af3
Commit
39135af3
authored
Aug 05, 2018
by
Menethil
Browse files
添加团购
parent
84afede4
Changes
7
Show whitespace changes
Inline
Side-by-side
litemall-core/src/main/java/org/linlinjava/litemall/core/qcode/QCodeService.java
View file @
39135af3
...
@@ -31,9 +31,9 @@ public class QCodeService {
...
@@ -31,9 +31,9 @@ public class QCodeService {
FileInputStream
inputStream
=
new
FileInputStream
(
file
);
FileInputStream
inputStream
=
new
FileInputStream
(
file
);
//将商品图片,商品名字,商城名字画到模版图中
//将商品图片,商品名字,商城名字画到模版图中
byte
[]
imageData
=
drawPicture
(
inputStream
,
goodPicUrl
,
goodName
,
SystemConfig
.
getMallName
());
byte
[]
imageData
=
drawPicture
(
inputStream
,
goodPicUrl
,
goodName
,
SystemConfig
.
getMallName
());
MultipartFile
multipartFile
=
new
MockMultipartFile
(
file
.
getName
(),
file
.
getName
(),
"image/jpeg"
,
imageData
);
ByteArrayInputStream
inputStream2
=
new
ByteArrayInputStream
(
imageData
);
//存储分享图
//存储分享图
storageService
.
store
(
multipartFile
,
getKeyName
(
groupon
.
getId
().
toString
()));
storageService
.
store
(
inputStream2
,
imageData
.
length
,
"image/jpeg"
,
getKeyName
(
groupon
.
getId
().
toString
()));
}
catch
(
WxErrorException
e
)
{
}
catch
(
WxErrorException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
catch
(
FileNotFoundException
e
)
{
}
catch
(
FileNotFoundException
e
)
{
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGroupon.java
View file @
39135af3
...
@@ -71,11 +71,11 @@ public class LitemallGroupon {
...
@@ -71,11 +71,11 @@ public class LitemallGroupon {
/**
/**
*
*
* This field was generated by MyBatis Generator.
* This field was generated by MyBatis Generator.
* This field corresponds to the database column litemall_groupon.user_
type
* This field corresponds to the database column litemall_groupon.
creator_
user_
id
*
*
* @mbg.generated
* @mbg.generated
*/
*/
private
Boolean
userType
;
private
Integer
creatorUserId
;
/**
/**
*
*
...
@@ -253,26 +253,26 @@ public class LitemallGroupon {
...
@@ -253,26 +253,26 @@ public class LitemallGroupon {
/**
/**
* This method was generated by MyBatis Generator.
* This method was generated by MyBatis Generator.
* This method returns the value of the database column litemall_groupon.user_
type
* This method returns the value of the database column litemall_groupon.
creator_
user_
id
*
*
* @return the value of litemall_groupon.user_
type
* @return the value of litemall_groupon.
creator_
user_
id
*
*
* @mbg.generated
* @mbg.generated
*/
*/
public
Boolean
getUserType
()
{
public
Integer
getCreatorUserId
()
{
return
userType
;
return
creatorUserId
;
}
}
/**
/**
* This method was generated by MyBatis Generator.
* This method was generated by MyBatis Generator.
* This method sets the value of the database column litemall_groupon.user_
type
* This method sets the value of the database column litemall_groupon.
creator_
user_
id
*
*
* @param
userType
the value for litemall_groupon.user_
type
* @param
creatorUserId
the value for litemall_groupon.
creator_
user_
id
*
*
* @mbg.generated
* @mbg.generated
*/
*/
public
void
set
UserType
(
Boolean
userType
)
{
public
void
set
CreatorUserId
(
Integer
creatorUserId
)
{
this
.
userType
=
userType
;
this
.
creatorUserId
=
creatorUserId
;
}
}
/**
/**
...
@@ -436,7 +436,7 @@ public class LitemallGroupon {
...
@@ -436,7 +436,7 @@ public class LitemallGroupon {
sb
.
append
(
", grouponId="
).
append
(
grouponId
);
sb
.
append
(
", grouponId="
).
append
(
grouponId
);
sb
.
append
(
", rulesId="
).
append
(
rulesId
);
sb
.
append
(
", rulesId="
).
append
(
rulesId
);
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
", userId="
).
append
(
userId
);
sb
.
append
(
",
userType="
).
append
(
userType
);
sb
.
append
(
",
creatorUserId="
).
append
(
creatorUserId
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
sb
.
append
(
", addTime="
).
append
(
addTime
);
sb
.
append
(
", expireTime="
).
append
(
expireTime
);
sb
.
append
(
", expireTime="
).
append
(
expireTime
);
sb
.
append
(
", shareUrl="
).
append
(
shareUrl
);
sb
.
append
(
", shareUrl="
).
append
(
shareUrl
);
...
@@ -470,7 +470,7 @@ public class LitemallGroupon {
...
@@ -470,7 +470,7 @@ public class LitemallGroupon {
&&
(
this
.
getGrouponId
()
==
null
?
other
.
getGrouponId
()
==
null
:
this
.
getGrouponId
().
equals
(
other
.
getGrouponId
()))
&&
(
this
.
getGrouponId
()
==
null
?
other
.
getGrouponId
()
==
null
:
this
.
getGrouponId
().
equals
(
other
.
getGrouponId
()))
&&
(
this
.
getRulesId
()
==
null
?
other
.
getRulesId
()
==
null
:
this
.
getRulesId
().
equals
(
other
.
getRulesId
()))
&&
(
this
.
getRulesId
()
==
null
?
other
.
getRulesId
()
==
null
:
this
.
getRulesId
().
equals
(
other
.
getRulesId
()))
&&
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
getUserId
()
==
null
?
other
.
getUserId
()
==
null
:
this
.
getUserId
().
equals
(
other
.
getUserId
()))
&&
(
this
.
get
UserType
()
==
null
?
other
.
get
UserType
()
==
null
:
this
.
get
UserType
().
equals
(
other
.
get
UserType
()))
&&
(
this
.
get
CreatorUserId
()
==
null
?
other
.
get
CreatorUserId
()
==
null
:
this
.
get
CreatorUserId
().
equals
(
other
.
get
CreatorUserId
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
&&
(
this
.
getAddTime
()
==
null
?
other
.
getAddTime
()
==
null
:
this
.
getAddTime
().
equals
(
other
.
getAddTime
()))
&&
(
this
.
getExpireTime
()
==
null
?
other
.
getExpireTime
()
==
null
:
this
.
getExpireTime
().
equals
(
other
.
getExpireTime
()))
&&
(
this
.
getExpireTime
()
==
null
?
other
.
getExpireTime
()
==
null
:
this
.
getExpireTime
().
equals
(
other
.
getExpireTime
()))
&&
(
this
.
getShareUrl
()
==
null
?
other
.
getShareUrl
()
==
null
:
this
.
getShareUrl
().
equals
(
other
.
getShareUrl
()))
&&
(
this
.
getShareUrl
()
==
null
?
other
.
getShareUrl
()
==
null
:
this
.
getShareUrl
().
equals
(
other
.
getShareUrl
()))
...
@@ -494,7 +494,7 @@ public class LitemallGroupon {
...
@@ -494,7 +494,7 @@ public class LitemallGroupon {
result
=
prime
*
result
+
((
getGrouponId
()
==
null
)
?
0
:
getGrouponId
().
hashCode
());
result
=
prime
*
result
+
((
getGrouponId
()
==
null
)
?
0
:
getGrouponId
().
hashCode
());
result
=
prime
*
result
+
((
getRulesId
()
==
null
)
?
0
:
getRulesId
().
hashCode
());
result
=
prime
*
result
+
((
getRulesId
()
==
null
)
?
0
:
getRulesId
().
hashCode
());
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
getUserId
()
==
null
)
?
0
:
getUserId
().
hashCode
());
result
=
prime
*
result
+
((
get
UserType
()
==
null
)
?
0
:
get
UserType
().
hashCode
());
result
=
prime
*
result
+
((
get
CreatorUserId
()
==
null
)
?
0
:
get
CreatorUserId
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
result
=
prime
*
result
+
((
getAddTime
()
==
null
)
?
0
:
getAddTime
().
hashCode
());
result
=
prime
*
result
+
((
getExpireTime
()
==
null
)
?
0
:
getExpireTime
().
hashCode
());
result
=
prime
*
result
+
((
getExpireTime
()
==
null
)
?
0
:
getExpireTime
().
hashCode
());
result
=
prime
*
result
+
((
getShareUrl
()
==
null
)
?
0
:
getShareUrl
().
hashCode
());
result
=
prime
*
result
+
((
getShareUrl
()
==
null
)
?
0
:
getShareUrl
().
hashCode
());
...
@@ -528,7 +528,7 @@ public class LitemallGroupon {
...
@@ -528,7 +528,7 @@ public class LitemallGroupon {
grouponId
(
"groupon_id"
,
"grouponId"
,
"INTEGER"
),
grouponId
(
"groupon_id"
,
"grouponId"
,
"INTEGER"
),
rulesId
(
"rules_id"
,
"rulesId"
,
"INTEGER"
),
rulesId
(
"rules_id"
,
"rulesId"
,
"INTEGER"
),
userId
(
"user_id"
,
"userId"
,
"INTEGER"
),
userId
(
"user_id"
,
"userId"
,
"INTEGER"
),
userType
(
"user_type"
,
"userType"
,
"BIT
"
),
creatorUserId
(
"creator_user_id"
,
"creatorUserId"
,
"INTEGER
"
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
),
addTime
(
"add_time"
,
"addTime"
,
"TIMESTAMP"
),
expireTime
(
"expire_time"
,
"expireTime"
,
"TIMESTAMP"
),
expireTime
(
"expire_time"
,
"expireTime"
,
"TIMESTAMP"
),
shareUrl
(
"share_url"
,
"shareUrl"
,
"VARCHAR"
),
shareUrl
(
"share_url"
,
"shareUrl"
,
"VARCHAR"
),
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/domain/LitemallGrouponExample.java
View file @
39135af3
...
@@ -526,63 +526,63 @@ public class LitemallGrouponExample {
...
@@ -526,63 +526,63 @@ public class LitemallGrouponExample {
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
IsNull
()
{
public
Criteria
and
CreatorUserId
IsNull
()
{
addCriterion
(
"user_
type
is null"
);
addCriterion
(
"
creator_
user_
id
is null"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
IsNotNull
()
{
public
Criteria
and
CreatorUserId
IsNotNull
()
{
addCriterion
(
"user_
type
is not null"
);
addCriterion
(
"
creator_
user_
id
is not null"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
EqualTo
(
Boolean
value
)
{
public
Criteria
and
CreatorUserId
EqualTo
(
Integer
value
)
{
addCriterion
(
"user_
type
="
,
value
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
="
,
value
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
NotEqualTo
(
Boolean
value
)
{
public
Criteria
and
CreatorUserId
NotEqualTo
(
Integer
value
)
{
addCriterion
(
"user_
type
<>"
,
value
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
<>"
,
value
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
GreaterThan
(
Boolean
value
)
{
public
Criteria
and
CreatorUserId
GreaterThan
(
Integer
value
)
{
addCriterion
(
"user_
type
>"
,
value
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
>"
,
value
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
GreaterThanOrEqualTo
(
Boolean
value
)
{
public
Criteria
and
CreatorUserId
GreaterThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"user_
type
>="
,
value
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
>="
,
value
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
LessThan
(
Boolean
value
)
{
public
Criteria
and
CreatorUserId
LessThan
(
Integer
value
)
{
addCriterion
(
"user_
type
<"
,
value
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
<"
,
value
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
LessThanOrEqualTo
(
Boolean
value
)
{
public
Criteria
and
CreatorUserId
LessThanOrEqualTo
(
Integer
value
)
{
addCriterion
(
"user_
type
<="
,
value
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
<="
,
value
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
In
(
List
<
Boolean
>
values
)
{
public
Criteria
and
CreatorUserId
In
(
List
<
Integer
>
values
)
{
addCriterion
(
"user_
type
in"
,
values
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
in"
,
values
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
NotIn
(
List
<
Boolean
>
values
)
{
public
Criteria
and
CreatorUserId
NotIn
(
List
<
Integer
>
values
)
{
addCriterion
(
"user_
type
not in"
,
values
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
not in"
,
values
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
Between
(
Boolean
value1
,
Boolean
value2
)
{
public
Criteria
and
CreatorUserId
Between
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"user_
type
between"
,
value1
,
value2
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
between"
,
value1
,
value2
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
public
Criteria
and
UserType
NotBetween
(
Boolean
value1
,
Boolean
value2
)
{
public
Criteria
and
CreatorUserId
NotBetween
(
Integer
value1
,
Integer
value2
)
{
addCriterion
(
"user_
type
not between"
,
value1
,
value2
,
"
userType
"
);
addCriterion
(
"
creator_
user_
id
not between"
,
value1
,
value2
,
"
creatorUserId
"
);
return
(
Criteria
)
this
;
return
(
Criteria
)
this
;
}
}
...
...
litemall-db/src/main/java/org/linlinjava/litemall/db/service/LitemallGrouponService.java
View file @
39135af3
...
@@ -25,6 +25,18 @@ public class LitemallGrouponService {
...
@@ -25,6 +25,18 @@ public class LitemallGrouponService {
return
mapper
.
selectByExample
(
example
);
return
mapper
.
selectByExample
(
example
);
}
}
public
List
<
LitemallGroupon
>
queryMyGroupon
(
Integer
userId
)
{
LitemallGrouponExample
example
=
new
LitemallGrouponExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andCreatorUserIdEqualTo
(
userId
).
andGrouponIdEqualTo
(
0
).
andDeletedEqualTo
(
false
);
return
mapper
.
selectByExample
(
example
);
}
public
List
<
LitemallGroupon
>
queryMyJoinGroupon
(
Integer
userId
)
{
LitemallGrouponExample
example
=
new
LitemallGrouponExample
();
example
.
or
().
andUserIdEqualTo
(
userId
).
andGrouponIdNotEqualTo
(
0
).
andDeletedEqualTo
(
false
);
return
mapper
.
selectByExample
(
example
);
}
public
LitemallGroupon
queryByOrderId
(
Integer
orderId
)
{
public
LitemallGroupon
queryByOrderId
(
Integer
orderId
)
{
LitemallGrouponExample
example
=
new
LitemallGrouponExample
();
LitemallGrouponExample
example
=
new
LitemallGrouponExample
();
example
.
or
().
andOrderIdEqualTo
(
orderId
).
andDeletedEqualTo
(
false
);
example
.
or
().
andOrderIdEqualTo
(
orderId
).
andDeletedEqualTo
(
false
);
...
...
litemall-db/src/main/resources/org/linlinjava/litemall/db/dao/LitemallGrouponMapper.xml
View file @
39135af3
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<result
column=
"groupon_id"
jdbcType=
"INTEGER"
property=
"grouponId"
/>
<result
column=
"groupon_id"
jdbcType=
"INTEGER"
property=
"grouponId"
/>
<result
column=
"rules_id"
jdbcType=
"INTEGER"
property=
"rulesId"
/>
<result
column=
"rules_id"
jdbcType=
"INTEGER"
property=
"rulesId"
/>
<result
column=
"user_id"
jdbcType=
"INTEGER"
property=
"userId"
/>
<result
column=
"user_id"
jdbcType=
"INTEGER"
property=
"userId"
/>
<result
column=
"user_
type
"
jdbcType=
"
BIT
"
property=
"
userType
"
/>
<result
column=
"
creator_
user_
id
"
jdbcType=
"
INTEGER
"
property=
"
creatorUserId
"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
<result
column=
"add_time"
jdbcType=
"TIMESTAMP"
property=
"addTime"
/>
<result
column=
"expire_time"
jdbcType=
"TIMESTAMP"
property=
"expireTime"
/>
<result
column=
"expire_time"
jdbcType=
"TIMESTAMP"
property=
"expireTime"
/>
<result
column=
"share_url"
jdbcType=
"VARCHAR"
property=
"shareUrl"
/>
<result
column=
"share_url"
jdbcType=
"VARCHAR"
property=
"shareUrl"
/>
...
@@ -90,8 +90,8 @@
...
@@ -90,8 +90,8 @@
WARNING - @mbg.generated
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
This element is automatically generated by MyBatis Generator, do not modify.
-->
-->
id, order_id, groupon_id, rules_id, user_id, user_
type
, add_time, expire_time,
share_url,
id, order_id, groupon_id, rules_id, user_id,
creator_
user_
id
, add_time, expire_time,
payed, deleted, version
share_url,
payed, deleted, version
</sql>
</sql>
<select
id=
"selectByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallGrouponExample"
resultMap=
"BaseResultMap"
>
<select
id=
"selectByExample"
parameterType=
"org.linlinjava.litemall.db.domain.LitemallGrouponExample"
resultMap=
"BaseResultMap"
>
<!--
<!--
...
@@ -128,8 +128,8 @@
...
@@ -128,8 +128,8 @@
</foreach>
</foreach>
</when>
</when>
<otherwise>
<otherwise>
id, order_id, groupon_id, rules_id, user_id, user_
type
, add_time, expire_time,
share_url,
id, order_id, groupon_id, rules_id, user_id,
creator_
user_
id
, add_time, expire_time,
payed, deleted, version
share_url,
payed, deleted, version
</otherwise>
</otherwise>
</choose>
</choose>
from litemall_groupon
from litemall_groupon
...
@@ -188,8 +188,8 @@
...
@@ -188,8 +188,8 @@
</foreach>
</foreach>
</when>
</when>
<otherwise>
<otherwise>
id, order_id, groupon_id, rules_id, user_id, user_
type
, add_time, expire_time,
share_url,
id, order_id, groupon_id, rules_id, user_id,
creator_
user_
id
, add_time, expire_time,
payed, deleted, version
share_url,
payed, deleted, version
</otherwise>
</otherwise>
</choose>
</choose>
from litemall_groupon
from litemall_groupon
...
@@ -222,11 +222,11 @@
...
@@ -222,11 +222,11 @@
SELECT LAST_INSERT_ID()
SELECT LAST_INSERT_ID()
</selectKey>
</selectKey>
insert into litemall_groupon (order_id, groupon_id, rules_id,
insert into litemall_groupon (order_id, groupon_id, rules_id,
user_id, user_
type
, add_time,
user_id,
creator_
user_
id
, add_time,
expire_time, share_url, payed,
expire_time, share_url, payed,
deleted, version)
deleted, version)
values (#{orderId,jdbcType=INTEGER}, #{grouponId,jdbcType=INTEGER}, #{rulesId,jdbcType=INTEGER},
values (#{orderId,jdbcType=INTEGER}, #{grouponId,jdbcType=INTEGER}, #{rulesId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER}, #{
userType
,jdbcType=
BIT
}, #{addTime,jdbcType=TIMESTAMP},
#{userId,jdbcType=INTEGER}, #{
creatorUserId
,jdbcType=
INTEGER
}, #{addTime,jdbcType=TIMESTAMP},
#{expireTime,jdbcType=TIMESTAMP}, #{shareUrl,jdbcType=VARCHAR}, #{payed,jdbcType=BIT},
#{expireTime,jdbcType=TIMESTAMP}, #{shareUrl,jdbcType=VARCHAR}, #{payed,jdbcType=BIT},
#{deleted,jdbcType=BIT}, #{version,jdbcType=INTEGER})
#{deleted,jdbcType=BIT}, #{version,jdbcType=INTEGER})
</insert>
</insert>
...
@@ -252,8 +252,8 @@
...
@@ -252,8 +252,8 @@
<if
test=
"userId != null"
>
<if
test=
"userId != null"
>
user_id,
user_id,
</if>
</if>
<if
test=
"
userType
!= null"
>
<if
test=
"
creatorUserId
!= null"
>
user_
type
,
creator_
user_
id
,
</if>
</if>
<if
test=
"addTime != null"
>
<if
test=
"addTime != null"
>
add_time,
add_time,
...
@@ -287,8 +287,8 @@
...
@@ -287,8 +287,8 @@
<if
test=
"userId != null"
>
<if
test=
"userId != null"
>
#{userId,jdbcType=INTEGER},
#{userId,jdbcType=INTEGER},
</if>
</if>
<if
test=
"
userType
!= null"
>
<if
test=
"
creatorUserId
!= null"
>
#{
userType
,jdbcType=
BIT
},
#{
creatorUserId
,jdbcType=
INTEGER
},
</if>
</if>
<if
test=
"addTime != null"
>
<if
test=
"addTime != null"
>
#{addTime,jdbcType=TIMESTAMP},
#{addTime,jdbcType=TIMESTAMP},
...
@@ -342,8 +342,8 @@
...
@@ -342,8 +342,8 @@
<if
test=
"record.userId != null"
>
<if
test=
"record.userId != null"
>
user_id = #{record.userId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
</if>
</if>
<if
test=
"record.
userType
!= null"
>
<if
test=
"record.
creatorUserId
!= null"
>
user_
type
= #{record.
userType
,jdbcType=
BIT
},
creator_
user_
id
= #{record.
creatorUserId
,jdbcType=
INTEGER
},
</if>
</if>
<if
test=
"record.addTime != null"
>
<if
test=
"record.addTime != null"
>
add_time = #{record.addTime,jdbcType=TIMESTAMP},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
...
@@ -379,7 +379,7 @@
...
@@ -379,7 +379,7 @@
groupon_id = #{record.grouponId,jdbcType=INTEGER},
groupon_id = #{record.grouponId,jdbcType=INTEGER},
rules_id = #{record.rulesId,jdbcType=INTEGER},
rules_id = #{record.rulesId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
user_
type
= #{record.
userType
,jdbcType=
BIT
},
creator_
user_
id
= #{record.
creatorUserId
,jdbcType=
INTEGER
},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
add_time = #{record.addTime,jdbcType=TIMESTAMP},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
expire_time = #{record.expireTime,jdbcType=TIMESTAMP},
share_url = #{record.shareUrl,jdbcType=VARCHAR},
share_url = #{record.shareUrl,jdbcType=VARCHAR},
...
@@ -409,8 +409,8 @@
...
@@ -409,8 +409,8 @@
<if
test=
"userId != null"
>
<if
test=
"userId != null"
>
user_id = #{userId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
</if>
</if>
<if
test=
"
userType
!= null"
>
<if
test=
"
creatorUserId
!= null"
>
user_
type
= #{
userType
,jdbcType=
BIT
},
creator_
user_
id
= #{
creatorUserId
,jdbcType=
INTEGER
},
</if>
</if>
<if
test=
"addTime != null"
>
<if
test=
"addTime != null"
>
add_time = #{addTime,jdbcType=TIMESTAMP},
add_time = #{addTime,jdbcType=TIMESTAMP},
...
@@ -443,7 +443,7 @@
...
@@ -443,7 +443,7 @@
groupon_id = #{grouponId,jdbcType=INTEGER},
groupon_id = #{grouponId,jdbcType=INTEGER},
rules_id = #{rulesId,jdbcType=INTEGER},
rules_id = #{rulesId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
user_id = #{userId,jdbcType=INTEGER},
user_
type
= #{
userType
,jdbcType=
BIT
},
creator_
user_
id
= #{
creatorUserId
,jdbcType=
INTEGER
},
add_time = #{addTime,jdbcType=TIMESTAMP},
add_time = #{addTime,jdbcType=TIMESTAMP},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
expire_time = #{expireTime,jdbcType=TIMESTAMP},
share_url = #{shareUrl,jdbcType=VARCHAR},
share_url = #{shareUrl,jdbcType=VARCHAR},
...
@@ -483,8 +483,8 @@
...
@@ -483,8 +483,8 @@
</foreach>
</foreach>
</when>
</when>
<otherwise>
<otherwise>
id, order_id, groupon_id, rules_id, user_id, user_
type
, add_time, expire_time,
share_url,
id, order_id, groupon_id, rules_id, user_id,
creator_
user_
id
, add_time, expire_time,
payed, deleted, version
share_url,
payed, deleted, version
</otherwise>
</otherwise>
</choose>
</choose>
from litemall_groupon
from litemall_groupon
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxGrouponController.java
View file @
39135af3
package
org.linlinjava.litemall.wx.web
;
package
org.linlinjava.litemall.wx.web
;
import
org.linlinjava.litemall.core.qcode.QCodeService
;
import
org.linlinjava.litemall.core.util.JacksonUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.db.domain.LitemallGoods
;
import
org.linlinjava.litemall.db.domain.*
;
import
org.linlinjava.litemall.db.domain.LitemallGroupon
;
import
org.linlinjava.litemall.db.service.*
;
import
org.linlinjava.litemall.db.domain.LitemallGrouponRules
;
import
org.linlinjava.litemall.db.util.OrderUtil
;
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.wx.annotation.LoginUser
;
import
org.linlinjava.litemall.wx.annotation.LoginUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.ti
me.LocalDateTime
;
import
java.
u
ti
l.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -34,7 +29,11 @@ public class WxGrouponController {
...
@@ -34,7 +29,11 @@ public class WxGrouponController {
@Autowired
@Autowired
private
LitemallGoodsService
goodsService
;
private
LitemallGoodsService
goodsService
;
@Autowired
@Autowired
private
QCodeService
qCodeService
;
private
LitemallOrderService
orderService
;
@Autowired
private
LitemallOrderGoodsService
orderGoodsService
;
@Autowired
private
LitemallUserService
userService
;
@GetMapping
(
"detail"
)
@GetMapping
(
"detail"
)
public
Object
detail
(
@LoginUser
Integer
userId
,
@NotNull
Integer
grouponId
)
{
public
Object
detail
(
@LoginUser
Integer
userId
,
@NotNull
Integer
grouponId
)
{
...
@@ -65,83 +64,75 @@ public class WxGrouponController {
...
@@ -65,83 +64,75 @@ public class WxGrouponController {
return
ResponseUtil
.
ok
(
groupInfo
);
return
ResponseUtil
.
ok
(
groupInfo
);
}
}
@GetMapping
(
"query"
)
@GetMapping
(
"my"
)
public
Object
query
(
@NotNull
Integer
goodsId
)
{
public
Object
my
(
@LoginUser
Integer
userId
,
@RequestParam
(
defaultValue
=
"0"
)
Integer
showType
)
{
LitemallGoods
goods
=
goodsService
.
findById
(
goodsId
);
if
(
goods
==
null
)
{
return
ResponseUtil
.
fail
(-
1
,
"未找到对应的商品"
);
}
List
<
LitemallGrouponRules
>
rules
=
rulesService
.
queryByGoodsId
(
goodsId
);
return
ResponseUtil
.
ok
(
rules
);
}
@RequestMapping
(
"join"
)
public
Object
join
(
@LoginUser
Integer
userId
,
@RequestBody
String
body
)
{
if
(
userId
==
null
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
unlogin
();
return
ResponseUtil
.
unlogin
();
}
}
Integer
rulesId
=
JacksonUtil
.
parseInteger
(
body
,
"rulesId"
);
List
<
LitemallGroupon
>
myGroupons
;
LitemallGrouponRules
rules
=
rulesService
.
queryById
(
rulesId
);
if
(
showType
==
0
)
{
if
(
rules
==
null
)
{
myGroupons
=
grouponService
.
queryMyGroupon
(
userId
);
return
ResponseUtil
.
fail
(-
1
,
"未找到对应的团购规则"
);
}
else
{
myGroupons
=
grouponService
.
queryMyJoinGroupon
(
userId
);
}
}
Integer
grouponId
=
JacksonUtil
.
parseInteger
(
body
,
"grouponId"
);
List
<
Map
<
String
,
Object
>>
grouponVoList
=
new
ArrayList
<>(
myGroupons
.
size
());
LitemallGroupon
groupon
=
grouponService
.
queryById
(
grouponId
);
if
(
groupon
==
null
)
{
LitemallOrder
order
;
return
ResponseUtil
.
fail
(-
1
,
"未找到对应的团购活动"
);
LitemallGrouponRules
rules
;
LitemallUser
creator
;
for
(
LitemallGroupon
groupon
:
myGroupons
)
{
order
=
orderService
.
findById
(
groupon
.
getOrderId
());
rules
=
rulesService
.
queryById
(
groupon
.
getRulesId
());
creator
=
userService
.
findById
(
groupon
.
getCreatorUserId
());
Map
<
String
,
Object
>
grouponVo
=
new
HashMap
<>();
//填充团购信息
grouponVo
.
put
(
"id"
,
groupon
.
getId
());
grouponVo
.
put
(
"groupon"
,
groupon
);
grouponVo
.
put
(
"rules"
,
rules
);
grouponVo
.
put
(
"creator"
,
creator
.
getNickname
());
grouponVo
.
put
(
"isCreator"
,
creator
.
getId
()
==
userId
&&
groupon
.
getGrouponId
()
==
0
);
//填充订单信息
grouponVo
.
put
(
"orderId"
,
order
.
getId
());
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
());
for
(
LitemallOrderGoods
orderGoods
:
orderGoodsList
)
{
Map
<
String
,
Object
>
orderGoodsVo
=
new
HashMap
<>();
orderGoodsVo
.
put
(
"id"
,
orderGoods
.
getId
());
orderGoodsVo
.
put
(
"goodsName"
,
orderGoods
.
getGoodsName
());
orderGoodsVo
.
put
(
"number"
,
orderGoods
.
getNumber
());
orderGoodsVo
.
put
(
"picUrl"
,
orderGoods
.
getPicUrl
());
orderGoodsVoList
.
add
(
orderGoodsVo
);
}
}
grouponVo
.
put
(
"goodsList"
,
orderGoodsVoList
);
LitemallGroupon
groupon2
=
new
LitemallGroupon
();
grouponVoList
.
add
(
grouponVo
);
groupon2
.
setUserId
(
userId
);
groupon2
.
setRulesId
(
rulesId
);
groupon2
.
setShareUrl
(
""
);
//参与者
groupon2
.
setUserType
(
false
);
groupon2
.
setGrouponId
(
grouponId
);
groupon2
.
setAddTime
(
LocalDateTime
.
now
());
//过期时间与创建一致
groupon2
.
setExpireTime
(
groupon
.
getExpireTime
());
grouponService
.
createGroupon
(
groupon
);
return
ResponseUtil
.
ok
();
}
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"count"
,
grouponVoList
.
size
());
result
.
put
(
"data"
,
grouponVoList
);
@GetMapping
(
"create"
)
return
ResponseUtil
.
ok
(
result
);
public
Object
create
(
@LoginUser
Integer
userId
,
@NotNull
Integer
rulesId
)
{
if
(
userId
==
null
)
{
return
ResponseUtil
.
unlogin
();
}
}
LitemallGrouponRules
rules
=
rulesService
.
queryById
(
rulesId
);
@GetMapping
(
"query"
)
if
(
rules
==
null
)
{
public
Object
query
(
@NotNull
Integer
goodsId
)
{
return
ResponseUtil
.
fail
(-
1
,
"未找到对应的团购规则"
);
LitemallGoods
goods
=
goodsService
.
findById
(
goodsId
);
if
(
goods
==
null
)
{
return
ResponseUtil
.
fail
(-
1
,
"未找到对应的商品"
);
}
}
LitemallGroupon
groupon
=
new
LitemallGroupon
();
List
<
LitemallGrouponRules
>
rules
=
rulesService
.
queryByGoodsId
(
goodsId
);
groupon
.
setUserId
(
userId
);
groupon
.
setRulesId
(
rulesId
);
//发起者
groupon
.
setUserType
(
true
);
groupon
.
setGrouponId
(
0
);
groupon
.
setAddTime
(
LocalDateTime
.
now
());
groupon
.
setExpireTime
(
LocalDateTime
.
now
().
plusDays
(
2
));
grouponService
.
createGroupon
(
groupon
);
qCodeService
.
createGrouponShareImage
(
rules
.
getGoodsName
(),
rules
.
getPicUrl
(),
groupon
);
groupon
.
setShareUrl
(
qCodeService
.
getShareImageUrl
(
groupon
.
getId
().
toString
()));
grouponService
.
update
(
groupon
);
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
(
rules
);
}
}
@RequestMapping
(
"list"
)
@RequestMapping
(
"list"
)
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
View file @
39135af3
...
@@ -401,10 +401,11 @@ public class WxOrderController {
...
@@ -401,10 +401,11 @@ public class WxOrderController {
//参与者
//参与者
if
(
grouponLinkId
!=
null
&&
grouponLinkId
>
0
)
{
if
(
grouponLinkId
!=
null
&&
grouponLinkId
>
0
)
{
groupon
.
setUserType
(
false
);
LitemallGroupon
baseGroupon
=
grouponService
.
queryById
(
grouponLinkId
);
groupon
.
setCreatorUserId
(
baseGroupon
.
getCreatorUserId
());
groupon
.
setGrouponId
(
grouponLinkId
);
groupon
.
setGrouponId
(
grouponLinkId
);
}
else
{
}
else
{
groupon
.
set
UserType
(
true
);
groupon
.
set
CreatorUserId
(
userId
);
groupon
.
setGrouponId
(
0
);
groupon
.
setGrouponId
(
0
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment