Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
c4ddba09
Commit
c4ddba09
authored
Jul 24, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优惠券
parent
91c9966b
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
32 additions
and
23 deletions
+32
-23
UserCouponFindDTO.java
...ava/com/xxfc/platform/activity/dto/UserCouponFindDTO.java
+1
-1
ActivityApplication.java
.../java/com/xxfc/platform/activity/ActivityApplication.java
+2
-1
CouponBiz.java
...c/main/java/com/xxfc/platform/activity/biz/CouponBiz.java
+2
-2
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+3
-2
SwaggerConfig.java
...java/com/xxfc/platform/activity/config/SwaggerConfig.java
+1
-2
UserCouponMapper.java
...a/com/xxfc/platform/activity/mapper/UserCouponMapper.java
+2
-0
CouponAdminController.java
...c/platform/activity/rest/admin/CouponAdminController.java
+3
-0
UserCouponAdminController.java
...atform/activity/rest/admin/UserCouponAdminController.java
+4
-8
usercoupon.xlsx
...x-activity-server/src/main/resources/file/usercoupon.xlsx
+0
-0
CouponMapper.xml
...ctivity-server/src/main/resources/mapper/CouponMapper.xml
+1
-1
UserCouponMapper.xml
...ity-server/src/main/resources/mapper/UserCouponMapper.xml
+13
-6
No files found.
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/dto/UserCouponFindDTO.java
View file @
c4ddba09
...
...
@@ -16,7 +16,7 @@ public class UserCouponFindDTO extends PageParam {
private
String
phone
;
private
String
title
;
private
Integer
couponId
;
private
BigDecimal
usedAmount
;
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/ActivityApplication.java
View file @
c4ddba09
...
...
@@ -20,7 +20,8 @@ import tk.mybatis.spring.annotation.MapperScan;
@SpringBootApplication
(
scanBasePackages
=
{
"com.xxfc.platform"
,
"com.github.wxiaoqi.security.common.handler"
,
"com.github.wxiaoqi.security.common.log"
"com.github.wxiaoqi.security.common.log"
,
"com.github.wxiaoqi.security.admin.support.aop"
})
@EnableDiscoveryClient
@EnableScheduling
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/CouponBiz.java
View file @
c4ddba09
...
...
@@ -50,7 +50,7 @@ public class CouponBiz extends BaseBiz<CouponMapper, Coupon> {
Example
example
=
new
Example
(
Coupon
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
if
(!
StringUtils
.
isEmpty
(
couponFindDTO
.
getTitle
())){
criteria
.
andLike
(
"title"
,
couponFindDTO
.
getTitle
(
));
criteria
.
andLike
(
"title"
,
String
.
format
(
"%%%s%%"
,
couponFindDTO
.
getTitle
()
));
}
if
(
Objects
.
nonNull
(
couponFindDTO
.
getChannel
())){
criteria
.
andEqualTo
(
"channel"
,
couponFindDTO
.
getChannel
());
...
...
@@ -74,7 +74,7 @@ public class CouponBiz extends BaseBiz<CouponMapper, Coupon> {
CouponPagVo
coupon
;
for
(
Coupon
coup
:
data
)
{
coupon
=
new
CouponPagVo
();
BeanUtils
.
copyProperties
(
coup
on
,
coup
);
BeanUtils
.
copyProperties
(
coup
,
coupon
);
couponPagVos
.
add
(
coupon
);
}
couponPagVo
.
setPageNum
(
couponPage
.
getPageNum
());
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
c4ddba09
...
...
@@ -300,7 +300,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon
.
setExpireTime
(
couponVo
.
getValidEndTime
());
userCoupons
.
add
(
userCoupon
);
}
return
mapper
.
inser
tList
(
userCoupons
);
return
mapper
.
inser
Batch
(
userCoupons
);
}
public
long
importUserCoupon
(
Integer
couponId
,
List
<
String
[]>
userCounponData
)
{
...
...
@@ -316,10 +316,11 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon
.
setCouponId
(
couponId
);
userCoupon
.
setStartTime
(
couponVo
.
getValidStartTime
());
userCoupon
.
setExpireTime
(
couponVo
.
getValidEndTime
());
userCoupon
.
setCrtTime
(
Instant
.
now
().
toEpochMilli
());
userCoupon
.
setUserId
(
phoneAndAppUserLoginMap
.
get
(
userCounponData
.
get
(
i
)[
0
]));
userCoupons
.
add
(
userCoupon
);
}
return
mapper
.
inser
tList
(
userCoupons
);
return
mapper
.
inser
Batch
(
userCoupons
);
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/config/SwaggerConfig.java
View file @
c4ddba09
...
...
@@ -49,10 +49,9 @@ public class SwaggerConfig {
pars
.
add
(
ticketPar2
.
build
());
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
host
(
"10.1.37.248:8765/api/activity"
)
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.xxfc.platform.activity"
))
//
.apis(RequestHandlerSelectors.any())
.
apis
(
RequestHandlerSelectors
.
any
())
.
build
()
.
globalOperationParameters
(
pars
)
.
apiInfo
(
apiInfo
());
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/UserCouponMapper.java
View file @
c4ddba09
...
...
@@ -32,4 +32,6 @@ public interface UserCouponMapper extends Mapper<UserCoupon> , InsertListMapper<
List
<
UserCouponDTO
>
findUserCoupons
(
UserCouponFindDTO
userCouponFindDTO
);
int
inserBatch
(
@Param
(
"userCoupons"
)
List
<
UserCoupon
>
userCoupons
);
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/admin/CouponAdminController.java
View file @
c4ddba09
package
com
.
xxfc
.
platform
.
activity
.
rest
.
admin
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializeConfig
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/admin/UserCouponAdminController.java
View file @
c4ddba09
package
com
.
xxfc
.
platform
.
activity
.
rest
.
admin
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.excel.ExcelImport
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
...
...
@@ -54,11 +56,6 @@ public class UserCouponAdminController {
if
(
userCounponData
.
size
()
<
1
)
{
return
ObjectRestResponse
.
createFailedResult
(
1001
,
"导入不能没数据!!!"
);
}
for
(
String
[]
userCounponDateNum
:
userCounponData
)
{
if
(
userCounponDateNum
.
length
!=
4
){
return
ObjectRestResponse
.
createFailedResult
(
1002
,
"数据不完整!!!"
);
}
}
userCounponData
.
remove
(
0
);
userCouponBiz
.
importUserCoupon
(
couponId
,
userCounponData
);
return
ObjectRestResponse
.
succ
();
...
...
@@ -66,12 +63,12 @@ public class UserCouponAdminController {
@ApiOperation
(
"用户劵excel模板下载"
)
@GetMapping
(
"/excel_model/dowload"
)
public
ResponseEntity
<
byte
[]>
dowloadUserMemberExcelModel
(
HttpServletResponse
response
){
public
ResponseEntity
<
byte
[]>
dowloadUserMemberExcelModel
(
HttpServletResponse
response
)
{
// 重置response
response
.
reset
();
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setContentType
(
"multipart/form-data"
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment;filename=user
member
.xlsx"
);
response
.
addHeader
(
"Content-Disposition"
,
"attachment;filename=user
coupon
.xlsx"
);
InputStream
inputStream
=
ActivityApplication
.
class
.
getClassLoader
().
getResourceAsStream
(
"file/usercoupon.xlsx"
);
try
{
byte
[]
bytes
=
IOUtils
.
toByteArray
(
inputStream
);
...
...
@@ -81,5 +78,4 @@ public class UserCouponAdminController {
}
return
ResponseEntity
.
status
(
HttpStatus
.
BAD_REQUEST
).
body
(
null
);
}
}
xx-activity/xx-activity-server/src/main/resources/file/usercoupon.xlsx
0 → 100644
View file @
c4ddba09
File added
xx-activity/xx-activity-server/src/main/resources/mapper/CouponMapper.xml
View file @
c4ddba09
...
...
@@ -37,7 +37,7 @@
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
<select
id=
"selectTitles"
resultType=
"
string
"
>
<select
id=
"selectTitles"
resultType=
"
com.xxfc.platform.activity.vo.CouponTitleVo
"
>
select `id`,`title` from `coupon` where `is_del`=0
</select>
</mapper>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/UserCouponMapper.xml
View file @
c4ddba09
...
...
@@ -85,21 +85,28 @@
uc.expire_time AS `expireTime`,
uc.use_time AS `useTime`
FROM
( SELECT `id`,
coupon_id, `user_id`, `is_use`, `crt_time`, `expire_time`, `use_time` FROM user_coupon
WHERE
( SELECT `id`,
`coupon_id`, `user_id`, `is_use`, `crt_time`, `expire_time`, `use_time` FROM `user_coupon`
WHERE
`is_del` = 0
<if
test=
"userId != null"
>
`user_id`=#{userId}
AND
`user_id`=#{userId}
</if>
<if
test=
"status != null"
>
`is_use`=#{status}
AND
`is_use`=#{status}
</if>
) AS `uc`
INNER JOIN ( SELECT `id`, `title`, `used_amount` FROM `coupon` WHERE 1=1
<if
test=
"
title != null and title != ''
"
>
AND `
title`=#{title
}
<if
test=
"
couponId != null
"
>
AND `
id`=#{couponId
}
</if>
<if
test=
"usedAmount != null"
>
AND `used_amount`=#{usedAmount}
</if>
) AS `cp` ON uc.coupon_id = cp.id
;
) AS `cp` ON uc.coupon_id = cp.id
order by `crtTime` DESC
</select>
<insert
id=
"inserBatch"
>
INSERT INTO `user_coupon`(`user_id`,`coupon_id`,`start_time`,`expire_time`,`crt_time`) VALUES
<foreach
collection=
"userCoupons"
item=
"userCoupon"
separator=
","
>
(#{userCoupon.userId},#{userCoupon.couponId},#{userCoupon.startTime},#{userCoupon.expireTime},#{userCoupon.crtTime} )
</foreach>
</insert>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
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