Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
member-api
Project
Project
Details
Activity
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
曲欣亮
member-api
Commits
50bab80d
Commit
50bab80d
authored
Dec 13, 2018
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
4af1ab44
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
136 deletions
+100
-136
ReviewService.java
src/main/java/com/egolm/film/api/service/ReviewService.java
+6
-0
VoteService.java
src/main/java/com/egolm/film/api/service/VoteService.java
+0
-15
ReviewServiceImpl.java
...va/com/egolm/film/api/service/impl/ReviewServiceImpl.java
+90
-0
VoteServiceImpl.java
...java/com/egolm/film/api/service/impl/VoteServiceImpl.java
+0
-113
AdminFirstController.java
...va/com/egolm/film/api/web/admin/AdminFirstController.java
+3
-3
UserReviewController.java
...ava/com/egolm/film/api/web/user/UserReviewController.java
+1
-5
No files found.
src/main/java/com/egolm/film/api/service/ReviewService.java
View file @
50bab80d
...
...
@@ -30,4 +30,10 @@ public interface ReviewService {
List
<
Map
<
String
,
Object
>>
queryReviewRecordList
(
Integer
review_id
);
void
toFirstRound
(
Long
member_film_id
,
Integer
enroll_type_id
);
void
toNextRound
(
Integer
review_id
);
void
tryNextRound
(
Integer
review_id
);
}
\ No newline at end of file
src/main/java/com/egolm/film/api/service/VoteService.java
deleted
100644 → 0
View file @
4af1ab44
package
com
.
egolm
.
film
.
api
.
service
;
public
interface
VoteService
{
/**
* 进入下一个审片环节
* @param member_film_id
*/
void
toFirstRound
(
Long
member_film_id
,
Integer
enroll_type_id
);
void
toNextRound
(
Integer
review_id
);
void
tryNextRound
(
Integer
review_id
);
}
src/main/java/com/egolm/film/api/service/impl/ReviewServiceImpl.java
View file @
50bab80d
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -118,4 +120,92 @@ public class ReviewServiceImpl implements ReviewService {
return
jdbcTemplate
.
queryForList
(
sql
,
review_id
);
}
@Override
@Transactional
public
void
toFirstRound
(
Long
member_film_id
,
Integer
enroll_type_id
)
{
Date
now
=
new
Date
();
Fc_review
review
=
new
Fc_review
();
review
.
setEnroll_type_id
(
enroll_type_id
);
review
.
setFilm_id
(
member_film_id
.
intValue
());
review
.
setReview_round
(
1
);
review
.
setPush_time
(
now
);
review
.
setAllot_state
(
0
);
review
.
setState
(
0
);
review
.
setReview_state
(
null
);
review
.
setCreate_time
(
now
);
jdbcTemplate
.
save
(
review
);
}
@Override
public
void
toNextRound
(
Integer
review_id
)
{
Integer
count
=
jdbcTemplate
.
queryForInt
(
"select count(*) from fc_review_record where review_id = ?"
,
review_id
);
Integer
allot_state
=
count
>
0
?
1
:
0
;
jdbcTemplate
.
executeUpdate
(
"update fc_review set review_round = review_round + 1, state = 0, allot_state = ?, review_state = null, push_time = now() where id = ?"
,
allot_state
,
review_id
);
}
private
Integer
reviewStateElection
(
List
<
Fc_review_record
>
records
)
{
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<
Integer
,
Integer
>();
for
(
Fc_review_record
record
:
records
)
{
Integer
review_state
=
record
.
getReview_state
();;
if
(
review_state
.
intValue
()
<=
1
)
{
return
null
;
}
map
.
put
(
review_state
,
map
.
get
(
review_state
)
==
null
?
1
:
(
map
.
get
(
review_state
)
+
1
));
}
Collection
<
Integer
>
ary
=
map
.
values
();
Integer
maxCount
=
0
;
for
(
Integer
count
:
ary
)
{
maxCount
=
count
>
maxCount
?
count
:
maxCount
;
}
if
(
maxCount
>
0
)
{
Integer
i
=
0
;
Integer
review_state
=
null
;
for
(
Integer
key
:
map
.
keySet
())
{
Integer
value
=
map
.
get
(
key
);
if
(
value
.
intValue
()
==
maxCount
.
intValue
())
{
review_state
=
key
;
i
++;
}
}
if
(
i
.
intValue
()
==
1
)
{
return
review_state
;
}
else
{
return
-
1
;
}
}
return
null
;
}
/**
* 1剧情
* 2纪录
* 3动画
* 4短片
*/
@Override
public
void
tryNextRound
(
Integer
review_id
)
{
Fc_review
review
=
jdbcTemplate
.
queryForBean
(
"select * from fc_review where id ?"
,
Fc_review
.
class
,
review_id
);
List
<
Fc_review_record
>
records
=
jdbcTemplate
.
queryForBeans
(
"select * from fc_review_record where review_id = ?"
,
Fc_review_record
.
class
,
review
.
getId
());
Integer
enroll_type_id
=
review
.
getEnroll_type_id
();
Integer
review_round
=
review
.
getReview_round
();
Integer
review_state
=
this
.
reviewStateElection
(
records
);
if
(
review_state
==
null
)
{
//没有审完
return
;
}
else
if
(
review_state
==
-
1
)
{
//审片结果有争议,等待增加新评委或管理员决定本轮最终结果
jdbcTemplate
.
executeUpdate
(
"update fc_review set state = 1 where id = ?"
,
review
.
getId
());
}
else
if
((
enroll_type_id
.
intValue
()
==
2
||
enroll_type_id
.
intValue
()
==
4
)
&&
(
review_round
==
2
||
review_round
==
3
))
{
//理员决定是否晋级下一轮评选
jdbcTemplate
.
executeUpdate
(
"update fc_review set state = 2 where id = ?"
,
review
.
getId
());
}
else
{
if
(
review_round
<
6
)
{
//自动进入下一轮评选
this
.
toNextRound
(
review
.
getId
());
}
else
{
//已经是最后一轮评选
jdbcTemplate
.
executeUpdate
(
"update fc_review set state = 3 where id = ?"
,
review
.
getId
());
}
}
}
}
src/main/java/com/egolm/film/api/service/impl/VoteServiceImpl.java
deleted
100644 → 0
View file @
4af1ab44
package
com
.
egolm
.
film
.
api
.
service
.
impl
;
import
java.util.Collection
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.film.api.service.VoteService
;
import
com.egolm.film.bean.Fc_review
;
import
com.egolm.film.bean.Fc_review_record
;
@Service
public
class
VoteServiceImpl
implements
VoteService
{
@Autowired
JdbcTemplate
jdbcTemplate
;
@Override
@Transactional
public
void
toFirstRound
(
Long
member_film_id
,
Integer
enroll_type_id
)
{
Date
now
=
new
Date
();
Fc_review
review
=
new
Fc_review
();
review
.
setEnroll_type_id
(
enroll_type_id
);
review
.
setFilm_id
(
member_film_id
.
intValue
());
review
.
setReview_round
(
1
);
review
.
setPush_time
(
now
);
review
.
setAllot_state
(
0
);
review
.
setState
(
0
);
review
.
setReview_state
(
null
);
review
.
setCreate_time
(
now
);
jdbcTemplate
.
save
(
review
);
}
@Override
public
void
toNextRound
(
Integer
review_id
)
{
Integer
count
=
jdbcTemplate
.
queryForInt
(
"select count(*) from fc_review_record where review_id = ?"
,
review_id
);
Integer
allot_state
=
count
>
0
?
1
:
0
;
jdbcTemplate
.
executeUpdate
(
"update fc_review set review_round = review_round + 1, state = 0, allot_state = ?, review_state = null, push_time = now() where id = ?"
,
allot_state
,
review_id
);
}
private
Integer
reviewStateElection
(
List
<
Fc_review_record
>
records
)
{
Map
<
Integer
,
Integer
>
map
=
new
HashMap
<
Integer
,
Integer
>();
for
(
Fc_review_record
record
:
records
)
{
Integer
review_state
=
record
.
getReview_state
();;
if
(
review_state
.
intValue
()
<=
1
)
{
return
null
;
}
map
.
put
(
review_state
,
map
.
get
(
review_state
)
==
null
?
1
:
(
map
.
get
(
review_state
)
+
1
));
}
Collection
<
Integer
>
ary
=
map
.
values
();
Integer
maxCount
=
0
;
for
(
Integer
count
:
ary
)
{
maxCount
=
count
>
maxCount
?
count
:
maxCount
;
}
if
(
maxCount
>
0
)
{
Integer
i
=
0
;
Integer
review_state
=
null
;
for
(
Integer
key
:
map
.
keySet
())
{
Integer
value
=
map
.
get
(
key
);
if
(
value
.
intValue
()
==
maxCount
.
intValue
())
{
review_state
=
key
;
i
++;
}
}
if
(
i
.
intValue
()
==
1
)
{
return
review_state
;
}
else
{
return
-
1
;
}
}
return
null
;
}
/**
* 1剧情
* 2纪录
* 3动画
* 4短片
*/
@Override
public
void
tryNextRound
(
Integer
review_id
)
{
Fc_review
review
=
jdbcTemplate
.
queryForBean
(
"select * from fc_review where id ?"
,
Fc_review
.
class
,
review_id
);
List
<
Fc_review_record
>
records
=
jdbcTemplate
.
queryForBeans
(
"select * from fc_review_record where review_id = ?"
,
Fc_review_record
.
class
,
review
.
getId
());
Integer
enroll_type_id
=
review
.
getEnroll_type_id
();
Integer
review_round
=
review
.
getReview_round
();
Integer
review_state
=
this
.
reviewStateElection
(
records
);
if
(
review_state
==
null
)
{
//没有审完
return
;
}
else
if
(
review_state
==
-
1
)
{
//审片结果有争议,等待增加新评委或管理员决定本轮最终结果
jdbcTemplate
.
executeUpdate
(
"update fc_review set state = 1 where id = ?"
,
review
.
getId
());
}
else
if
((
enroll_type_id
.
intValue
()
==
2
||
enroll_type_id
.
intValue
()
==
4
)
&&
(
review_round
==
2
||
review_round
==
3
))
{
//理员决定是否晋级下一轮评选
jdbcTemplate
.
executeUpdate
(
"update fc_review set state = 2 where id = ?"
,
review
.
getId
());
}
else
{
if
(
review_round
<
6
)
{
//自动进入下一轮评选
this
.
toNextRound
(
review
.
getId
());
}
else
{
//已经是最后一轮评选
jdbcTemplate
.
executeUpdate
(
"update fc_review set state = 3 where id = ?"
,
review
.
getId
());
}
}
}
}
src/main/java/com/egolm/film/api/web/admin/AdminFirstController.java
View file @
50bab80d
...
...
@@ -22,7 +22,7 @@ import com.egolm.film.api.service.EmailService;
import
com.egolm.film.api.service.FilmService
;
import
com.egolm.film.api.service.MemberService
;
import
com.egolm.film.api.service.Messages
;
import
com.egolm.film.api.service.
Vote
Service
;
import
com.egolm.film.api.service.
Review
Service
;
import
com.egolm.film.bean.Fc_member
;
import
com.egolm.film.bean.Fc_member_film
;
import
com.egolm.film.bean.Fc_member_film_enroll
;
...
...
@@ -60,7 +60,7 @@ public class AdminFirstController {
Messages
messages
;
@Autowired
VoteService
vote
Service
;
ReviewService
review
Service
;
@ResponseBody
@PostMapping
(
"list"
)
...
...
@@ -124,7 +124,7 @@ public class AdminFirstController {
memberFilmService
.
pass
(
member_film_id
);
List
<
Fc_member_film_enroll
>
enrolls
=
memberFilmService
.
queryFilmEnrollList
(
member_film_id
);
for
(
Fc_member_film_enroll
enroll
:
enrolls
)
{
vote
Service
.
toFirstRound
(
member_film_id
,
enroll
.
getEnroll_type_id
());
review
Service
.
toFirstRound
(
member_film_id
,
enroll
.
getEnroll_type_id
());
}
Fc_member_film
memberFilm
=
memberFilmService
.
queryMemberFilmById
(
member_film_id
);
Fc_member
member
=
memberService
.
getMemberById
(
memberFilm
.
getMember_id
());
...
...
src/main/java/com/egolm/film/api/web/user/UserReviewController.java
View file @
50bab80d
...
...
@@ -18,7 +18,6 @@ import com.egolm.common.jdbc.Page;
import
com.egolm.film.api.service.FilmService
;
import
com.egolm.film.api.service.ReviewService
;
import
com.egolm.film.api.service.UserTokenService
;
import
com.egolm.film.api.service.VoteService
;
import
com.egolm.film.bean.Fc_review_doubtful
;
import
com.egolm.film.bean.Fc_review_record
;
import
com.egolm.film.bean.Fc_review_record_ext
;
...
...
@@ -44,9 +43,6 @@ public class UserReviewController {
@Autowired
FilmService
filmService
;
@Autowired
VoteService
voteService
;
@ResponseBody
@PostMapping
(
"review_list"
)
@ApiOperation
(
"审核列表"
)
...
...
@@ -149,7 +145,7 @@ public class UserReviewController {
throw
new
XException
(
"评奖项目参数数量错误"
);
}
service
.
saveReviewRecord
(
ru
,
exts
);
voteS
ervice
.
tryNextRound
(
review_id
);
s
ervice
.
tryNextRound
(
review_id
);
return
Rjx
.
jsonOk
();
}
...
...
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