Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
涂亚平
/
subsidy
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c4710bba
authored
Mar 04, 2022
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2.2.1上线了。。。。
1 parent
e58aafd0
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
21 deletions
src/main/java/com/subsidy/controller/ClassNoticeController.java
src/main/java/com/subsidy/model/ClassNoticeDO.java
src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
src/main/resources/application.properties
src/main/java/com/subsidy/controller/ClassNoticeController.java
View file @
c4710bb
...
@@ -50,7 +50,7 @@ public class ClassNoticeController {
...
@@ -50,7 +50,7 @@ public class ClassNoticeController {
}
}
@PostMapping
(
"queryClassNotices"
)
@PostMapping
(
"queryClassNotices"
)
@ApiOperation
(
"查看某个课程的通知提醒 classId 课程id
noticeType
状态(待发送/已发送)"
)
@ApiOperation
(
"查看某个课程的通知提醒 classId 课程id
status
状态(待发送/已发送)"
)
public
ResponseVO
queryClassNotices
(
@RequestBody
ClassNoticeDO
classNoticeDO
){
public
ResponseVO
queryClassNotices
(
@RequestBody
ClassNoticeDO
classNoticeDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
classNoticeService
.
queryClassNotices
(
classNoticeDO
));
return
ResponseData
.
generateCreatedResponse
(
0
,
classNoticeService
.
queryClassNotices
(
classNoticeDO
));
}
}
...
...
src/main/java/com/subsidy/model/ClassNoticeDO.java
View file @
c4710bb
...
@@ -41,5 +41,9 @@ public class ClassNoticeDO extends BaseModel {
...
@@ -41,5 +41,9 @@ public class ClassNoticeDO extends BaseModel {
*/
*/
private
String
noticeTime
;
private
String
noticeTime
;
/**
* 发送状态
*/
private
String
status
;
}
}
src/main/java/com/subsidy/service/impl/ClassHourDictServiceImpl.java
View file @
c4710bb
...
@@ -133,7 +133,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
...
@@ -133,7 +133,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
if
(
classHourDictDO
==
null
)
{
if
(
classHourDictDO
==
null
)
{
pollingGetVO
.
setBool
(
true
);
pollingGetVO
.
setBool
(
true
);
}
else
{
}
else
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
<
=
classHourDictDO
.
getClassHour
()
*
3600
)
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
<
classHourDictDO
.
getClassHour
()
*
3600
)
{
pollingGetVO
.
setBool
(
false
);
pollingGetVO
.
setBool
(
false
);
}
else
{
}
else
{
pollingGetVO
.
setBool
(
true
);
pollingGetVO
.
setBool
(
true
);
...
...
src/main/java/com/subsidy/service/impl/ClassNoticeServiceImpl.java
View file @
c4710bb
...
@@ -22,7 +22,6 @@ import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
...
@@ -22,7 +22,6 @@ import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
...
@@ -51,18 +50,19 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
...
@@ -51,18 +50,19 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
@Override
public
String
addNotice
(
ClassNoticeDO
classNoticeDO
)
{
public
String
addNotice
(
ClassNoticeDO
classNoticeDO
)
{
if
(
DateFormatUtil
.
parse
(
classNoticeDO
.
getNoticeTime
(),
"yyyy-MM-dd HH"
).
before
(
new
Date
()))
{
if
(
DateFormatUtil
.
parse
(
classNoticeDO
.
getNoticeTime
(),
"yyyy-MM-dd HH"
).
before
(
new
Date
()))
{
throw
new
HttpException
(
70001
);
throw
new
HttpException
(
70001
);
}
}
classNoticeDO
.
setStatus
(
CourseNotification
.
UNSENT
);
this
.
baseMapper
.
insert
(
classNoticeDO
);
this
.
baseMapper
.
insert
(
classNoticeDO
);
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
classNoticeDO
.
getClassId
());
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
classNoticeDO
.
getClassId
());
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"classId"
,
classNoticeDO
.
getClassId
());
params
.
put
(
"classId"
,
classNoticeDO
.
getClassId
());
params
.
put
(
"id"
,
classNoticeDO
.
getId
());
params
.
put
(
"id"
,
classNoticeDO
.
getId
());
String
name
=
classDictDO
.
getClassName
()
+
"-"
+
classNoticeDO
.
getNoticeType
()
+
"-"
+
classNoticeDO
.
getNoticeTime
();
String
name
=
classDictDO
.
getClassName
()
+
"-"
+
classNoticeDO
.
getNoticeType
()+
"-"
+
classNoticeDO
.
getNoticeTime
();
quartzUtil
.
addSimpleJob
(
CourseNotificationJob
.
class
,
DateFormatUtil
.
parse
(
classNoticeDO
.
getNoticeTime
(),
"yyyy-MM-dd HH:mm:ss"
)
,
params
,
name
,
"CourseNotificationJob"
);
quartzUtil
.
addSimpleJob
(
CourseNotificationJob
.
class
,
DateFormatUtil
.
parse
(
classNoticeDO
.
getNoticeTime
(),
"yyyy-MM-dd HH:mm:ss"
)
,
params
,
name
,
"CourseNotificationJob"
);
return
ConstantUtils
.
ADD_SUCCESS
;
return
ConstantUtils
.
ADD_SUCCESS
;
}
}
...
@@ -78,41 +78,41 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
...
@@ -78,41 +78,41 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
this
.
baseMapper
.
deleteById
(
classNoticeDO
.
getId
());
this
.
baseMapper
.
deleteById
(
classNoticeDO
.
getId
());
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
noticeDO
.
getClassId
());
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
noticeDO
.
getClassId
());
String
name
=
classDictDO
.
getClassName
()
+
"-"
+
noticeDO
.
getNoticeType
()
+
"-"
+
noticeDO
.
getNoticeTime
();
String
name
=
classDictDO
.
getClassName
()
+
"-"
+
noticeDO
.
getNoticeType
()+
"-"
+
noticeDO
.
getNoticeTime
();
quartzUtil
.
deleteJob
(
name
,
"CourseNotificationJob"
);
quartzUtil
.
deleteJob
(
name
,
"CourseNotificationJob"
);
return
ConstantUtils
.
DELETE_SUCCESS
;
return
ConstantUtils
.
DELETE_SUCCESS
;
}
}
public
List
<
ClassNoticeDO
>
queryClassNotices
(
ClassNoticeDO
classNoticeDO
)
{
public
List
<
ClassNoticeDO
>
queryClassNotices
(
ClassNoticeDO
classNoticeDO
){
return
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
ClassNoticeDO
>()
return
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
ClassNoticeDO
>()
.
lambda
()
.
lambda
()
.
eq
(
ClassNoticeDO:
:
getNoticeType
,
classNoticeDO
.
getNoticeType
())
.
eq
(
ClassNoticeDO:
:
getStatus
,
classNoticeDO
.
getStatus
())
.
eq
(
ClassNoticeDO:
:
getClassId
,
classNoticeDO
.
getClassId
()));
.
eq
(
ClassNoticeDO:
:
getClassId
,
classNoticeDO
.
getClassId
()));
}
}
@Override
@Override
public
void
sendNotification
(
SendNotificationDTO
sendNotificationDTO
)
{
public
void
sendNotification
(
SendNotificationDTO
sendNotificationDTO
)
{
ClassAndCompanyInfoVO
cmInfo
=
classDictMapper
.
getClassAndCompanyInfoVO
(
sendNotificationDTO
.
getClassId
());
ClassAndCompanyInfoVO
cmInfo
=
classDictMapper
.
getClassAndCompanyInfoVO
(
sendNotificationDTO
.
getClassId
());
if
(
sendNotificationDTO
.
getSendType
().
equals
(
SmsCode
.
ALL
.
getType
()))
{
if
(
sendNotificationDTO
.
getSendType
().
equals
(
SmsCode
.
ALL
.
getType
()))
{
String
params
=
"{\"company\":\""
+
cmInfo
.
getCompany
()
+
"\", \"course\":\""
+
cmInfo
.
getCourseName
()
+
"\", \"startDate\": \""
+
cmInfo
.
getStartDate
()
+
"\", \"endDate\": \""
+
cmInfo
.
getEndDate
()
+
"\"}"
;
String
params
=
"{\"company\":\""
+
cmInfo
.
getCompany
()
+
"\", \"course\":\""
+
cmInfo
.
getCourseName
()
+
"\", \"startDate\": \""
+
cmInfo
.
getStartDate
()+
"\", \"endDate\": \""
+
cmInfo
.
getEndDate
()+
"\"}"
;
List
<
MemberDO
>
list
=
memberMapper
.
getMemberList
(
sendNotificationDTO
.
getClassId
());
List
<
MemberDO
>
list
=
memberMapper
.
getMemberList
(
sendNotificationDTO
.
getClassId
());
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
for
(
MemberDO
memberDO
:
list
)
{
for
(
MemberDO
memberDO
:
list
)
{
SMSUtils
.
sendNoticeSMS
(
SmsCode
.
ALL
.
getCode
(),
memberDO
.
getTelephone
(),
params
);
SMSUtils
.
sendNoticeSMS
(
SmsCode
.
ALL
.
getCode
(),
memberDO
.
getTelephone
(),
params
);
}
}
}
}
}
else
if
(
sendNotificationDTO
.
getSendType
().
equals
(
SmsCode
.
NOT_SIGNED_IN
.
getType
()))
{
}
else
if
(
sendNotificationDTO
.
getSendType
().
equals
(
SmsCode
.
NOT_SIGNED_IN
.
getType
()))
{
String
params
=
"{ \"name\": \""
+
cmInfo
.
getName
()
+
"\", \"course\":\""
+
cmInfo
.
getCourseName
()
+
"\"}"
;
String
params
=
"{ \"name\": \""
+
cmInfo
.
getName
()
+
"\", \"course\":\""
+
cmInfo
.
getCourseName
()+
"\"}"
;
List
<
MemberDO
>
list
=
memberMapper
.
getMemberListBySignInRecord
(
sendNotificationDTO
.
getClassId
());
List
<
MemberDO
>
list
=
memberMapper
.
getMemberListBySignInRecord
(
sendNotificationDTO
.
getClassId
());
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
for
(
MemberDO
memberDO
:
list
)
{
for
(
MemberDO
memberDO
:
list
)
{
SMSUtils
.
sendNoticeSMS
(
SmsCode
.
NOT_SIGNED_IN
.
getCode
(),
memberDO
.
getTelephone
(),
params
);
SMSUtils
.
sendNoticeSMS
(
SmsCode
.
NOT_SIGNED_IN
.
getCode
(),
memberDO
.
getTelephone
(),
params
);
}
}
}
}
}
else
if
(
sendNotificationDTO
.
getSendType
().
equals
(
SmsCode
.
UNFINISHED
.
getType
()))
{
}
else
if
(
sendNotificationDTO
.
getSendType
().
equals
(
SmsCode
.
UNFINISHED
.
getType
()))
{
String
params
=
"{ \"name\": \""
+
cmInfo
.
getName
()
+
"\", \"course\":\""
+
cmInfo
.
getCourseName
()
+
"\"}"
;
String
params
=
"{ \"name\": \""
+
cmInfo
.
getName
()
+
"\", \"course\":\""
+
cmInfo
.
getCourseName
()+
"\"}"
;
List
<
MemberDO
>
list
=
memberMapper
.
getUnfinishedMemberList
(
sendNotificationDTO
.
getClassId
());
List
<
MemberDO
>
list
=
memberMapper
.
getUnfinishedMemberList
(
sendNotificationDTO
.
getClassId
());
if
(
list
!=
null
)
{
if
(
list
!=
null
)
{
for
(
MemberDO
memberDO
:
list
)
{
for
(
MemberDO
memberDO
:
list
)
{
SMSUtils
.
sendNoticeSMS
(
SmsCode
.
UNFINISHED
.
getCode
(),
memberDO
.
getTelephone
(),
params
);
SMSUtils
.
sendNoticeSMS
(
SmsCode
.
UNFINISHED
.
getCode
(),
memberDO
.
getTelephone
(),
params
);
}
}
...
...
src/main/java/com/subsidy/service/impl/VodPlayHistoryServiceImpl.java
View file @
c4710bb
...
@@ -71,6 +71,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -71,6 +71,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//是否超过时长 没超过 false 超过 true
//是否超过时长 没超过 false 超过 true
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>=
classHourDictDO
.
getClassHour
()
*
3600
)
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>=
classHourDictDO
.
getClassHour
()
*
3600
)
{
int
playLength
=
classHourDictDO
.
getClassHour
()*
3600
-
total
;
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
}
}
...
@@ -92,6 +95,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
...
@@ -92,6 +95,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//是否超过时长 没超过 false 超过 true
//是否超过时长 没超过 false 超过 true
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>=
classHourDictDO
.
getClassHour
()
*
3600
)
{
if
(
total
+
vodPlayHistoryDO
.
getPlayLength
()
>=
classHourDictDO
.
getClassHour
()
*
3600
)
{
int
playLength
=
classHourDictDO
.
getClassHour
()*
3600
-
total
;
vodPlayHistoryDO
.
setPlayLength
(
playLength
);
this
.
baseMapper
.
insert
(
vodPlayHistoryDO
);
throw
new
HttpException
(
13001
);
throw
new
HttpException
(
13001
);
}
}
}
}
...
...
src/main/resources/application.properties
View file @
c4710bb
# 环境配置
# 环境配置
spring.profiles.active
=
prod
spring.profiles.active
=
dev
# 端口号
# 端口号
spring.server.port
=
2345
9
spring.server.port
=
2345
7
#嵌入tomcat配置
#嵌入tomcat配置
#和CPU数
#和CPU数
spring.server.acceptorThreadCount
=
600
spring.server.acceptorThreadCount
=
600
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment