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 b692129d
authored
Sep 18, 2024
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拆班推送/班级里分组推送
1 parent
829fbc99
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
296 additions
and
43 deletions
src/main/java/com/subsidy/controller/RenSheJuController.java
src/main/java/com/subsidy/dto/renshe/PushClassMembersDataDTO.java
src/main/java/com/subsidy/mapper/RenSheJuMapper.java
src/main/java/com/subsidy/service/RenSheJuService.java
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
src/main/java/com/subsidy/vo/renshe/VodClassIdsVO.java
src/main/resources/mapper/RenSheJuMapper.xml
src/main/java/com/subsidy/controller/RenSheJuController.java
View file @
b692129
package
com
.
subsidy
.
controller
;
package
com
.
subsidy
.
controller
;
import
com.subsidy.common.ResponseVO
;
import
com.subsidy.dto.renshe.PushClassMembersDataDTO
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.vo.renshe.RensheResponseVO
;
import
com.subsidy.vo.renshe.RensheResponseVO
;
import
com.subsidy.vo.renshe.RensheStringVO
;
import
com.subsidy.vo.renshe.RensheStringVO
;
...
@@ -7,6 +9,7 @@ import io.swagger.annotations.Api;
...
@@ -7,6 +9,7 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
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.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
...
@@ -74,4 +77,10 @@ public class RenSheJuController {
...
@@ -74,4 +77,10 @@ public class RenSheJuController {
return
renSheJuService
.
post6plus
();
return
renSheJuService
.
post6plus
();
}
}
@PostMapping
(
"pushClassMembersData"
)
@ApiOperation
(
"推送某个班级前一天的数据 classId memberIds 逗号隔开"
)
public
RensheResponseVO
pushClassMembersData
(
@RequestBody
PushClassMembersDataDTO
pushClassMembersDataDTO
)
throws
Exception
{
return
renSheJuService
.
pushClassMembersData
(
pushClassMembersDataDTO
);
}
}
}
src/main/java/com/subsidy/dto/renshe/PushClassMembersDataDTO.java
0 → 100644
View file @
b692129
package
com
.
subsidy
.
dto
.
renshe
;
import
lombok.Data
;
@Data
public
class
PushClassMembersDataDTO
{
private
Long
classId
;
private
String
memberIds
;
}
src/main/java/com/subsidy/mapper/RenSheJuMapper.java
View file @
b692129
...
@@ -35,9 +35,19 @@ public interface RenSheJuMapper {
...
@@ -35,9 +35,19 @@ public interface RenSheJuMapper {
List
<
Long
>
newClasses
(
String
classType
);
List
<
Long
>
newClasses
(
String
classType
);
/**
/**
* 前一天
新增视频学习数据
* 前一天
班级的基本信息
*/
*/
List
<
DailyStudyInfoVO
>
dailyStudyInfo
(
Long
classId
);
List
<
DailyStudyInfoVO
>
dailyStudyInfo
(
Long
classId
,
List
<
Long
>
memberIds
);
/**
* 某班级去重学员
*/
List
<
Long
>
classDistinctMember
(
Long
classId
);
/**
* 查看前一天班级的数据条数
*/
Integer
dataCount
(
Long
classId
);
/**
/**
* 前一天活跃度检测列表
* 前一天活跃度检测列表
...
@@ -131,6 +141,11 @@ public interface RenSheJuMapper {
...
@@ -131,6 +141,11 @@ public interface RenSheJuMapper {
List
<
Long
>
vodClassIds
(
String
classType
);
List
<
Long
>
vodClassIds
(
String
classType
);
/**
/**
* 产生数据班级+数据量
*/
List
<
VodClassIdsVO
>
vodClassCnt
(
String
classType
);
/**
* 产生考试数据的班级
* 产生考试数据的班级
*/
*/
List
<
Long
>
examClassIds
(
String
classType
);
List
<
Long
>
examClassIds
(
String
classType
);
...
...
src/main/java/com/subsidy/service/RenSheJuService.java
View file @
b692129
package
com
.
subsidy
.
service
;
package
com
.
subsidy
.
service
;
import
com.subsidy.dto.renshe.PushClassMembersDataDTO
;
import
com.subsidy.vo.renshe.RensheResponseVO
;
import
com.subsidy.vo.renshe.RensheResponseVO
;
import
com.subsidy.vo.renshe.RensheStringVO
;
import
com.subsidy.vo.renshe.RensheStringVO
;
...
@@ -24,8 +25,8 @@ public interface RenSheJuService {
...
@@ -24,8 +25,8 @@ public interface RenSheJuService {
RensheStringVO
clear
()
throws
IOException
;
RensheStringVO
clear
()
throws
IOException
;
void
test
();
RensheResponseVO
post6plus
()
throws
Exception
;
RensheResponseVO
post6plus
()
throws
Exception
;
RensheResponseVO
pushClassMembersData
(
PushClassMembersDataDTO
pushClassMembersDataDTO
)
throws
Exception
;
}
}
src/main/java/com/subsidy/service/impl/RenSheJuServiceImpl.java
View file @
b692129
...
@@ -12,6 +12,7 @@ import com.subsidy.model.*;
...
@@ -12,6 +12,7 @@ import com.subsidy.model.*;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.service.RenSheJuService
;
import
com.subsidy.util.OSSUtils
;
import
com.subsidy.util.OSSUtils
;
import
com.subsidy.util.RenSheJuConstant
;
import
com.subsidy.util.RenSheJuConstant
;
import
com.subsidy.util.SMSUtils
;
import
com.subsidy.vo.renshe.*
;
import
com.subsidy.vo.renshe.*
;
import
net.sf.json.JSONObject
;
import
net.sf.json.JSONObject
;
import
okhttp3.*
;
import
okhttp3.*
;
...
@@ -21,8 +22,9 @@ import org.springframework.stereotype.Service;
...
@@ -21,8 +22,9 @@ import org.springframework.stereotype.Service;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.sql.Timestamp
;
import
java.sql.Timestamp
;
import
java.time.LocalDateTime
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.IntStream
;
@Service
@Service
public
class
RenSheJuServiceImpl
implements
RenSheJuService
{
public
class
RenSheJuServiceImpl
implements
RenSheJuService
{
...
@@ -42,6 +44,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -42,6 +44,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
@Autowired
@Autowired
private
ImageCheckRecordMapper
imageCheckRecordMapper
;
private
ImageCheckRecordMapper
imageCheckRecordMapper
;
@Autowired
private
SMSUtils
smsUtils
;
public
RensheResponseVO
classBaseInfo
()
throws
IOException
{
public
RensheResponseVO
classBaseInfo
()
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
...
@@ -69,7 +74,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -69,7 +74,6 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List
<
Long
>
imageClassIds
=
renSheJuMapper
.
imageClassIds
(
"0"
);
List
<
Long
>
imageClassIds
=
renSheJuMapper
.
imageClassIds
(
"0"
);
Set
<
Long
>
classIds
=
new
HashSet
<>();
Set
<
Long
>
classIds
=
new
HashSet
<>();
// classIds.add(490L);
vodClassIds
.
stream
().
forEach
(
x
->
classIds
.
add
(
x
));
vodClassIds
.
stream
().
forEach
(
x
->
classIds
.
add
(
x
));
examClassIds
.
stream
().
forEach
(
x
->
classIds
.
add
(
x
));
examClassIds
.
stream
().
forEach
(
x
->
classIds
.
add
(
x
));
...
@@ -153,26 +157,63 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -153,26 +157,63 @@ public class RenSheJuServiceImpl implements RenSheJuService {
.
build
();
.
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
ClassHourBehaviorDTO
classHourBehaviorDTO
=
new
ClassHourBehaviorDTO
();
// 产生视频学习数据的班级
List
<
VodClassIdsVO
>
vodClassIdsVOS
=
renSheJuMapper
.
vodClassCnt
(
"0"
);
for
(
VodClassIdsVO
vodClassIdsVO
:
vodClassIdsVOS
)
{
ClassHourBehaviorDTO
classHourBehaviorDTO
=
new
ClassHourBehaviorDTO
();
classHourBehaviorDTO
.
setPrivateKey
(
getSecret
());
classHourBehaviorDTO
.
setPrivateKey
(
getSecret
());
List
<
ClassHourBasic
>
classHourBasics
=
new
ArrayList
<>();
// 产生视频学习数据的班级
//查看该班级今天产生的数据条数
List
<
Long
>
vodClassIds
=
renSheJuMapper
.
vodClassIds
(
"0"
);
int
count
=
renSheJuMapper
.
dataCount
(
vodClassIdsVO
.
getClassId
());
List
<
Long
>
longs
=
renSheJuMapper
.
classDistinctMember
(
vodClassIdsVO
.
getClassId
());
// List<Long> vodClassIds = new ArrayList<>();
if
(
count
>
300
)
{
// vodClassIds.add(537L);
//某班级前一天数据人员去重
int
times
=
(
int
)
Math
.
ceil
((
double
)
count
/
300
);
int
block
=
(
int
)
Math
.
ceil
((
double
)
longs
.
size
()
/
times
);
List
<
List
<
Long
>>
devide
=
devide
(
longs
,
block
);
for
(
List
<
Long
>
memberIds
:
devide
)
{
try
{
sendStudyData
(
client
,
mediaType
,
classHourBehaviorDTO
,
vodClassIdsVO
.
getClassId
(),
memberIds
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
List
<
String
>
telephones
=
Arrays
.
asList
(
"15201936167"
,
"18201963812"
);
for
(
String
telephone
:
telephones
)
{
smsUtils
.
sendWarning
(
"SMS_460945631"
,
telephone
,
RenSheJuConstant
.
POST_3
);
}
}
}
}
else
{
try
{
sendStudyData
(
client
,
mediaType
,
classHourBehaviorDTO
,
vodClassIdsVO
.
getClassId
(),
longs
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
List
<
String
>
telephones
=
Arrays
.
asList
(
"15201936167"
,
"18201963812"
);
for
(
String
telephone
:
telephones
)
{
smsUtils
.
sendWarning
(
"SMS_460945631"
,
telephone
,
"3"
);
}
}
}
}
return
null
;
}
List
<
DailyStudyInfoVO
>
result
=
new
ArrayList
<>();
public
void
sendStudyData
(
OkHttpClient
client
,
MediaType
mediaType
,
ClassHourBehaviorDTO
classHourBehaviorDTO
,
Long
classId
,
List
<
Long
>
memberIds
)
throws
Exception
{
try
{
List
<
ClassHourBasic
>
classHourBasics
=
new
ArrayList
<>();
for
(
Long
classId
:
vodClassIds
)
{
//产生数据的班级
//产生数据的班级
List
<
DailyStudyInfoVO
>
dailyStudyInfoVOS
=
renSheJuMapper
.
dailyStudyInfo
(
classId
);
List
<
DailyStudyInfoVO
>
dailyStudyInfoVOS
=
renSheJuMapper
.
dailyStudyInfo
(
classId
,
memberIds
);
result
.
addAll
(
dailyStudyInfoVOS
);
for
(
DailyStudyInfoVO
dailyStudyInfoVO
:
dailyStudyInfoVOS
)
{
}
for
(
DailyStudyInfoVO
dailyStudyInfoVO
:
result
)
{
ClassHourBasic
classHourBasic
=
new
ClassHourBasic
();
ClassHourBasic
classHourBasic
=
new
ClassHourBasic
();
BeanUtils
.
copyProperties
(
dailyStudyInfoVO
,
classHourBasic
);
BeanUtils
.
copyProperties
(
dailyStudyInfoVO
,
classHourBasic
);
classHourBasic
.
setClassCode
(
dailyStudyInfoVO
.
getClassCode
());
classHourBasic
.
setClassCode
(
dailyStudyInfoVO
.
getClassCode
());
...
@@ -218,9 +259,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -218,9 +259,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
classHourBasic
.
setActivityList
(
activityLists
);
classHourBasic
.
setActivityList
(
activityLists
);
classHourBasics
.
add
(
classHourBasic
);
classHourBasics
.
add
(
classHourBasic
);
}
}
classHourBehaviorDTO
.
setClassHourBasic
(
classHourBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
classHourBehaviorDTO
));
classHourBehaviorDTO
.
setClassHourBasic
(
classHourBasics
);
// System.out.println(com.alibaba.fastjson.JSONObject.toJSONString(classHourBehaviorDTO));
if
(
classHourBasics
.
size
()
>
0
)
{
if
(
classHourBasics
.
size
()
>
0
)
{
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
...
@@ -242,7 +283,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -242,7 +283,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
return
rensheResponseVO
;
classHourBasics
.
clear
()
;
}
else
{
}
else
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
...
@@ -250,23 +291,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -250,23 +291,9 @@ public class RenSheJuServiceImpl implements RenSheJuService {
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
}
// return null;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
List
<
String
>
telephones
=
Arrays
.
asList
(
"15201936167"
,
"18201963812"
);
// for (String telephone : telephones) {
// smsUtils.sendWarning("SMS_460945631", telephone, RenSheJuConstant.POST_3);
// }
}
return
null
;
}
}
public
RensheResponseVO
uploadChapterBehavior
()
throws
IOException
{
public
RensheResponseVO
uploadChapterBehavior
()
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
...
@@ -690,7 +717,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -690,7 +717,7 @@ public class RenSheJuServiceImpl implements RenSheJuService {
List
<
Long
>
classIds
=
new
ArrayList
<>();
List
<
Long
>
classIds
=
new
ArrayList
<>();
classIds
.
add
(
477L
);
//
classIds.add(477L);
for
(
Long
classId
:
classIds
)
{
for
(
Long
classId
:
classIds
)
{
...
@@ -780,6 +807,123 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -780,6 +807,123 @@ public class RenSheJuServiceImpl implements RenSheJuService {
return
rensheStringVO
;
return
rensheStringVO
;
}
}
public
RensheResponseVO
pushClassMembersData
(
PushClassMembersDataDTO
pushClassMembersDataDTO
)
throws
Exception
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
.
build
();
MediaType
mediaType
=
MediaType
.
parse
(
"application/json"
);
// 产生视频学习数据的班级
ClassHourBehaviorDTO
classHourBehaviorDTO
=
new
ClassHourBehaviorDTO
();
classHourBehaviorDTO
.
setPrivateKey
(
getSecret
());
//查看该班级今天产生的数据条数
List
<
Long
>
memberIds
=
new
ArrayList
<>();
String
[]
strings
=
pushClassMembersDataDTO
.
getMemberIds
().
split
(
","
);
for
(
String
string
:
strings
)
{
memberIds
.
add
(
Long
.
valueOf
(
string
));
}
try
{
List
<
ClassHourBasic
>
classHourBasics
=
new
ArrayList
<>();
//产生数据的班级
List
<
DailyStudyInfoVO
>
dailyStudyInfoVOS
=
renSheJuMapper
.
dailyStudyInfo
(
pushClassMembersDataDTO
.
getClassId
(),
memberIds
);
for
(
DailyStudyInfoVO
dailyStudyInfoVO
:
dailyStudyInfoVOS
)
{
ClassHourBasic
classHourBasic
=
new
ClassHourBasic
();
BeanUtils
.
copyProperties
(
dailyStudyInfoVO
,
classHourBasic
);
classHourBasic
.
setClassCode
(
dailyStudyInfoVO
.
getClassCode
());
//找到当天每次上线下线时间
//上线时间
List
<
OprMemDictDO
>
loginRecords
=
renSheJuMapper
.
loginRecords
(
dailyStudyInfoVO
.
getMemberId
());
//下线时间
List
<
OprMemDictDO
>
loginOutRecords
=
renSheJuMapper
.
loginOutRecords
(
dailyStudyInfoVO
.
getMemberId
());
List
<
LoginList
>
loginLists
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
loginRecords
.
size
();
i
++)
{
LoginList
loginList
=
new
LoginList
();
loginList
.
setIp
(
loginRecords
.
get
(
i
).
getIpAddress
());
loginList
.
setStartTime
(
Timestamp
.
valueOf
(
loginRecords
.
get
(
i
).
getCreateDate
()).
getTime
());
loginList
.
setEndTime
(
Timestamp
.
valueOf
(
loginOutRecords
.
get
(
i
).
getCreateDate
()).
getTime
());
//查看这个人该时间段的学习记录
List
<
ChapterList3
>
chapterList3s
=
renSheJuMapper
.
dailyStudyRecords
(
dailyStudyInfoVO
.
getMemberId
(),
dailyStudyInfoVO
.
getClassId
(),
loginRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
),
loginOutRecords
.
get
(
i
).
getCreateDate
().
toString
().
replace
(
"T"
,
" "
));
if
(
chapterList3s
.
size
()
>
0
)
{
loginList
.
setChapterList
(
chapterList3s
);
loginLists
.
add
(
loginList
);
}
}
classHourBasic
.
setLoginList
(
loginLists
);
//活跃度列表
List
<
ActivityList
>
activityLists
=
new
ArrayList
<>();
List
<
DailyActivitiesVO
>
activityDetectionDOS
=
renSheJuMapper
.
dailyActivities
(
dailyStudyInfoVO
.
getClassId
(),
dailyStudyInfoVO
.
getMemberId
());
for
(
DailyActivitiesVO
dailyActivitiesVO
:
activityDetectionDOS
)
{
ActivityList
activityList
=
new
ActivityList
();
if
(
0
==
dailyActivitiesVO
.
getCheckType
())
{
activityList
.
setActivityDetection
(
2
);
}
else
if
(
1
==
dailyActivitiesVO
.
getCheckType
())
{
activityList
.
setActivityDetection
(
1
);
}
activityList
.
setActivityTime
(
dailyActivitiesVO
.
getActivityTime
());
activityLists
.
add
(
activityList
);
}
classHourBasic
.
setActivityList
(
activityLists
);
classHourBasics
.
add
(
classHourBasic
);
}
classHourBehaviorDTO
.
setClassHourBasic
(
classHourBasics
);
System
.
out
.
println
(
com
.
alibaba
.
fastjson
.
JSONObject
.
toJSONString
(
classHourBehaviorDTO
));
if
(
classHourBasics
.
size
()
>
0
)
{
RequestBody
body
=
RequestBody
.
create
(
mediaType
,
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
Request
request
=
new
Request
.
Builder
()
.
url
(
renSheConfig
.
getUrl
()
+
"/import/downstream/enterprise/uploadClassHourBehavior"
)
.
method
(
"POST"
,
body
)
.
addHeader
(
"User-Agent"
,
"Apifox/1.0.0 (https://www.apifox.cn)"
)
.
addHeader
(
"Content-Type"
,
"application/json"
)
.
build
();
Response
response
=
client
.
newCall
(
request
).
execute
();
RensheResponseVO
rensheResponseVO
=
JSON
.
parseObject
(
response
.
body
().
string
(),
RensheResponseVO
.
class
);
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
if
(
200
==
response
.
code
())
{
renshejuHistoryDO
.
setOutputParam
(
rensheResponseVO
.
getCtt
().
toString
());
}
else
{
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
API_ERROR
);
}
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
classHourBasics
.
clear
();
}
else
{
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
NO_DATA
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
RenshejuHistoryDO
renshejuHistoryDO
=
new
RenshejuHistoryDO
();
renshejuHistoryDO
.
setInterfaceName
(
RenSheJuConstant
.
POST_4
);
renshejuHistoryDO
.
setInputParam
(
JSONObject
.
fromObject
(
classHourBehaviorDTO
).
toString
());
renshejuHistoryDO
.
setOutputParam
(
RenSheJuConstant
.
PUSH_FAIL
);
renshejuHistoryMapper
.
insert
(
renshejuHistoryDO
);
List
<
String
>
telephones
=
Arrays
.
asList
(
"15201936167"
,
"18201963812"
);
for
(
String
telephone
:
telephones
)
{
smsUtils
.
sendWarning
(
"SMS_460945631"
,
telephone
,
RenSheJuConstant
.
POST_3
);
}
}
return
null
;
}
public
String
getSecret
()
throws
IOException
{
public
String
getSecret
()
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
OkHttpClient
client
=
new
OkHttpClient
().
newBuilder
()
...
@@ -811,13 +955,25 @@ public class RenSheJuServiceImpl implements RenSheJuService {
...
@@ -811,13 +955,25 @@ public class RenSheJuServiceImpl implements RenSheJuService {
// String s = JSONObject.fromObject(getSecretVO).toString();
// String s = JSONObject.fromObject(getSecretVO).toString();
// System.out.println(s);
// System.out.println(s);
LocalDateTime
localDateTime
=
LocalDateTime
.
now
();
//
LocalDateTime localDateTime = LocalDateTime.now();
System
.
out
.
println
(
localDateTime
.
toString
());
//
System.out.println(localDateTime.toString());
// int ttl = 1600;
// int memCnt = 173;
// System.out.println((int) Math.ceil((double) ttl / 500) + "=============");
System
.
out
.
println
(
devide
(
Arrays
.
asList
(
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
,
12
,
13
),
3
));
}
}
public
void
test
()
{
public
static
<
T
>
List
<
List
<
T
>>
devide
(
List
<
T
>
origin
,
int
size
)
{
System
.
out
.
println
(
"132222222222222222222222222222"
);
int
block
=
(
origin
.
size
()
+
size
-
1
)
/
size
;
return
IntStream
.
range
(
0
,
block
)
.
boxed
().
map
(
i
->
{
int
start
=
i
*
size
;
int
end
=
Math
.
min
(
start
+
size
,
origin
.
size
());
return
origin
.
subList
(
start
,
end
);
}).
collect
(
Collectors
.
toList
());
}
}
}
}
\ No newline at end of file
src/main/java/com/subsidy/vo/renshe/VodClassIdsVO.java
0 → 100644
View file @
b692129
package
com
.
subsidy
.
vo
.
renshe
;
import
lombok.Data
;
@Data
public
class
VodClassIdsVO
{
private
Long
classId
;
private
String
classCode
;
private
Integer
cnt
;
}
src/main/resources/mapper/RenSheJuMapper.xml
View file @
b692129
...
@@ -96,8 +96,36 @@
...
@@ -96,8 +96,36 @@
t.delete_date IS NULL
t.delete_date IS NULL
AND t3.delete_date IS NULL
AND t3.delete_date IS NULL
AND t.class_id = #{classId}
AND t.class_id = #{classId}
<if
test=
"memberIds != null and memberIds.size>0"
>
and t.member_id in
<foreach
collection=
"memberIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id}
</foreach>
</if>
</select>
</select>
<select
id=
"classDistinctMember"
parameterType=
"long"
resultType=
"long"
>
SELECT DISTINCT
t.member_id
FROM
vod_play_history t
WHERE
t.class_id = #{classId}
AND t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
</select>
<select
id=
"dataCount"
parameterType=
"long"
resultType=
"integer"
>
SELECT
count( 0 )
FROM
vod_play_history t
LEFT JOIN class_dict t2 ON t.class_id = t2.id
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
and t2.id = #{classId}
</select>
<select
id=
"dailyActivities"
resultType=
"com.subsidy.vo.renshe.DailyActivitiesVO"
>
<select
id=
"dailyActivities"
resultType=
"com.subsidy.vo.renshe.DailyActivitiesVO"
>
SELECT
SELECT
...
@@ -429,6 +457,23 @@
...
@@ -429,6 +457,23 @@
AND t.class_type = #{classType}
AND t.class_type = #{classType}
</select>
</select>
<select
id=
"vodClassCnt"
parameterType=
"string"
resultType=
"com.subsidy.vo.renshe.VodClassIdsVO"
>
SELECT
class_id,
t2.class_code,
count( 0 )
FROM
vod_play_history t
LEFT JOIN class_dict t2 ON t.class_id = t2.id
WHERE
t.delete_date IS NULL
AND DATE_FORMAT( DATE_ADD( t.create_date, interval 1 DAY ), '%Y-%m-%d' ) = DATE_FORMAT( NOW(), '%Y-%m-%d' )
AND t2.class_type = #{classType}
GROUP BY
class_id,
t2.class_code
</select>
<select
id=
"examClassIds"
parameterType=
"string"
resultType=
"long"
>
<select
id=
"examClassIds"
parameterType=
"string"
resultType=
"long"
>
SELECT
SELECT
t.id
t.id
...
...
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