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
40fb68a7
Commit
40fb68a7
authored
Dec 11, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/luck_draw_feature' into luck_draw_feature
parents
e6963bbe
a1903fc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
17 deletions
+44
-17
ActivityPopularizeUserBiz.java
...xxfc/platform/activity/biz/ActivityPopularizeUserBiz.java
+44
-17
No files found.
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityPopularizeUserBiz.java
View file @
40fb68a7
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
org.springframework.stereotype.Service
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.activity.entity.ActivityPopularizeUser
;
import
com.xxfc.platform.activity.mapper.ActivityPopularizeUserMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.Map
;
/**
* 用户与推广活动(邀请有礼)的关系表
...
...
@@ -19,19 +21,44 @@ import java.util.List;
* @date 2019-07-05 15:23:04
*/
@Service
public
class
ActivityPopularizeUserBiz
extends
BaseBiz
<
ActivityPopularizeUserMapper
,
ActivityPopularizeUser
>
{
public
ActivityPopularizeUser
insertSelectiveReT
(
ActivityPopularizeUser
entity
)
{
if
(
insertSelectiveRe
(
entity
)
>
0
)
{
return
selectById
(
entity
.
getId
());
}
else
{
throw
new
BaseException
(
ResultCode
.
DB_OPERATION_FAIL_CODE
);
}
}
public
class
ActivityPopularizeUserBiz
extends
BaseBiz
<
ActivityPopularizeUserMapper
,
ActivityPopularizeUser
>
{
public
ActivityPopularizeUser
insertSelectiveReT
(
ActivityPopularizeUser
entity
)
{
if
(
insertSelectiveRe
(
entity
)
>
0
)
{
return
selectById
(
entity
.
getId
());
}
else
{
throw
new
BaseException
(
ResultCode
.
DB_OPERATION_FAIL_CODE
);
}
}
public
void
deleteByUserIds
(
List
<
Integer
>
userIds
)
{
Example
example
=
new
Example
(
ActivityPopularizeUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIn
(
"userId"
,
userIds
);
mapper
.
deleteByExample
(
example
);
}
public
void
deleteByUserIds
(
List
<
Integer
>
userIds
)
{
Example
example
=
new
Example
(
ActivityPopularizeUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andIn
(
"userId"
,
userIds
);
mapper
.
deleteByExample
(
example
);
}
public
Map
<
String
,
Object
>
getByUserIdAndPopularizeId
(
Integer
userId
,
List
<
Integer
>
popularizeIds
)
{
Map
<
String
,
Object
>
map
=
Maps
.
newHashMap
();
if
(
userId
==
null
||
popularizeIds
==
null
)
{
return
map
;
}
map
.
put
(
"userId"
,
userId
);
List
<
Map
<
Integer
,
Boolean
>>
activityIds
=
Lists
.
newArrayList
();
popularizeIds
.
parallelStream
().
forEach
(
id
->
{
Example
example
=
new
Example
(
ActivityPopularizeUser
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"userId"
,
userId
);
criteria
.
andEqualTo
(
"popularizeId"
,
popularizeIds
);
ActivityPopularizeUser
activityPopularizeUsers
=
mapper
.
selectOneByExample
(
example
);
Map
<
Integer
,
Boolean
>
map1
=
Maps
.
newHashMap
();
if
(
activityPopularizeUsers
!=
null
)
{
map1
.
put
(
id
,
true
);
}
else
{
map1
.
put
(
id
,
false
);
}
activityIds
.
add
(
map1
);
});
map
.
put
(
"popularizeIds"
,
activityIds
);
return
map
;
}
}
\ 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