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 bcbbb8c4
authored
Oct 29, 2021
by
涂亚平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试版本
1 parent
254dd350
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
181 additions
and
39 deletions
src/main/java/com/subsidy/common/Code.java
src/main/java/com/subsidy/common/configure/WebConfig.java
src/main/java/com/subsidy/controller/CompanyDictController.java
src/main/java/com/subsidy/controller/MemberController.java
src/main/java/com/subsidy/controller/SignInRecordController.java
src/main/java/com/subsidy/dto/administer/OperatorsDTO.java
src/main/java/com/subsidy/dto/member/ContentMemberDTO.java
src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java
src/main/java/com/subsidy/mapper/CompanyDictMapper.java
src/main/java/com/subsidy/model/CourseDictDO.java
src/main/java/com/subsidy/model/SignInRecordDO.java
src/main/java/com/subsidy/service/SignInRecordService.java
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
src/main/java/com/subsidy/vo/administer/LoginVO.java
src/main/java/com/subsidy/vo/administer/OperatorsVO.java
src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java
src/main/java/com/subsidy/vo/sign/SignInStatusVO.java
src/main/resources/mapper/ClassMemberMappingMapper.xml
src/main/resources/mapper/CompanyDictMapper.xml
src/main/resources/mapper/SignInRecordMapper.xml
src/main/java/com/subsidy/common/Code.java
0 → 100644
View file @
bcbbb8c
package
com
.
subsidy
.
common
;
public
enum
Code
{
USERNAMENOTFOUND
(
10001
,
"用户不存在"
),
BADCREDENTIALS
(
10002
,
"账户或者密码错误"
),
ACCOUNTEXPIRED
(
10003
,
"账户过期"
),
LOCKEDEXCEPTION
(
10004
,
"账户已锁定"
),
DISABLEDEXCEPTION
(
10005
,
"账户已禁用"
),
ACCESSDENIED
(
10006
,
"无权限访问"
),
AUTHENTICATION
(
10007
,
"身份验证异常"
),
NOHANDLERFOUND
(
10008
,
"找不到相应的视图处理器"
),
PARAM_INVALID
(
10009
,
"参数不合法"
),
TOKEN_EXCEPTION
(
10010
,
"Token不合法"
),
TOKEN_EXPIRED
(
10011
,
"Token已过期"
),
OSS_ERROR
(
10012
,
"OSS文件上传异常"
),
Network_ERROR
(
90000
,
"网络请求失败"
),
SERVER_INTERNAL_ERROR
(
99999
,
"服务器内部错误"
),
;
private
Integer
code
;
private
String
message
;
Code
(
Integer
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
src/main/java/com/subsidy/common/configure/WebConfig.java
View file @
bcbbb8c
...
...
@@ -27,13 +27,15 @@ public class WebConfig implements WebMvcConfigurer {
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
// .allowCredentials(true)
.
allowedOrigins
(
"*"
)
.
allowedMethods
(
"GET"
,
"HEAD"
,
"POST"
,
"PUT"
,
"DELETE"
,
"OPTIONS"
)
.
maxAge
(
3600
);
.
allowedOrigins
(
"*"
)
.
allowedMethods
(
"GET"
,
"HEAD"
,
"POST"
,
"PUT"
,
"DELETE"
,
"OPTIONS"
)
.
allowedHeaders
(
"*"
)
.
maxAge
(
3600
);
}
/**
* Swagger
*
* @param registry
*/
@Override
...
...
@@ -47,6 +49,7 @@ public class WebConfig implements WebMvcConfigurer {
/**
* 鉴权
*
* @param registry
*/
@Override
...
...
@@ -57,5 +60,4 @@ public class WebConfig implements WebMvcConfigurer {
}
}
\ No newline at end of file
src/main/java/com/subsidy/controller/CompanyDictController.java
View file @
bcbbb8c
...
...
@@ -36,7 +36,7 @@ public class CompanyDictController {
private
CompanyDictService
companyDictService
;
@PostMapping
(
"/administers"
)
@ApiOperation
(
"查询所有企业 { companyName pageNum pageSize }"
)
@ApiOperation
(
"查询所有企业 {
id
companyName pageNum pageSize }"
)
@LoginRequired
(
value
=
{
ConstantUtils
.
ADMINISTER_TERMINATE
})
public
ResponseVO
operators
(
@RequestBody
OperatorsDTO
operatorsDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
companyDictService
.
operators
(
operatorsDTO
));
...
...
src/main/java/com/subsidy/controller/MemberController.java
View file @
bcbbb8c
...
...
@@ -108,7 +108,7 @@ public class MemberController {
}
@PostMapping
(
"getCourseTest"
)
@ApiOperation
(
"获取课程下的测试情况 {memberId
course
Id}"
)
@ApiOperation
(
"获取课程下的测试情况 {memberId
成员id courseId 课程id class
Id}"
)
public
ResponseVO
getCourseTest
(
@RequestBody
ContentMemberDTO
contentMemberDTO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
memberService
.
getCourseTest
(
contentMemberDTO
));
}
...
...
src/main/java/com/subsidy/controller/SignInRecordController.java
View file @
bcbbb8c
...
...
@@ -43,7 +43,7 @@ public class SignInRecordController {
}
@PostMapping
(
"signIn"
)
@ApiOperation
(
"签到
classId :班级id
memberId"
)
@ApiOperation
(
"签到 memberId"
)
public
ResponseVO
signIn
(
@RequestBody
SignInRecordDO
signInRecordDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
signIn
(
signInRecordDO
));
}
...
...
@@ -55,5 +55,10 @@ public class SignInRecordController {
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
classSignInfo
(
classSignInfoDTO
));
}
@PostMapping
(
"signInStatus"
)
@ApiOperation
(
"判断学生当天有没有打卡 {memberId 学生id}"
)
public
ResponseVO
signInStatus
(
@RequestBody
SignInRecordDO
signInRecordDO
){
return
ResponseData
.
generateCreatedResponse
(
0
,
signInRecordService
.
signInStatus
(
signInRecordDO
));
}
}
src/main/java/com/subsidy/dto/administer/OperatorsDTO.java
View file @
bcbbb8c
...
...
@@ -15,4 +15,6 @@ public class OperatorsDTO {
private
String
userName
;
private
Integer
id
;
}
src/main/java/com/subsidy/dto/member/ContentMemberDTO.java
View file @
bcbbb8c
...
...
@@ -9,4 +9,6 @@ public class ContentMemberDTO {
private
Integer
courseId
;
private
Integer
classId
;
}
src/main/java/com/subsidy/mapper/ClassMemberMappingMapper.java
View file @
bcbbb8c
package
com
.
subsidy
.
mapper
;
import
com.subsidy.dto.classDict.GetSpareMembersDTO
;
import
com.subsidy.model.ClassDictDO
;
import
com.subsidy.model.ClassMemberMappingDO
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.subsidy.model.MemberDO
;
...
...
@@ -19,5 +20,9 @@ import java.util.List;
@Repository
public
interface
ClassMemberMappingMapper
extends
BaseMapper
<
ClassMemberMappingDO
>
{
/**
* 获取学生当前有效班级
*/
List
<
ClassDictDO
>
getMemberClass
(
Long
memberId
);
}
src/main/java/com/subsidy/mapper/CompanyDictMapper.java
View file @
bcbbb8c
...
...
@@ -23,7 +23,7 @@ public interface CompanyDictMapper extends BaseMapper<CompanyDictDO> {
*
* @return
*/
IPage
<
OperatorsVO
>
operators
(
IPage
page
,
String
companyName
,
String
userName
,
Integer
role
);
IPage
<
OperatorsVO
>
operators
(
IPage
page
,
String
companyName
,
Integer
id
,
String
userName
,
Integer
role
);
/**
* 通过企业id查找企业的管理员
...
...
src/main/java/com/subsidy/model/CourseDictDO.java
View file @
bcbbb8c
...
...
@@ -53,9 +53,9 @@ public class CourseDictDO extends BaseModel {
*/
private
String
courseSource
;
/**
* 习题截止时间
*/
private
LocalDateTime
deadline
;
/
//
**
//
* 习题截止时间
//
*/
//
private LocalDateTime deadline;
}
src/main/java/com/subsidy/model/SignInRecordDO.java
View file @
bcbbb8c
...
...
@@ -29,12 +29,12 @@ public class SignInRecordDO extends BaseModel {
/**
* 学生id
*/
private
Integer
student
Id
;
private
Long
member
Id
;
/**
* 班级id
*/
private
Integer
classId
;
private
Long
classId
;
/**
* 签到时间
...
...
src/main/java/com/subsidy/service/SignInRecordService.java
View file @
bcbbb8c
...
...
@@ -8,6 +8,7 @@ import com.subsidy.model.MemberDO;
import
com.subsidy.model.SignInRecordDO
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.subsidy.vo.member.GetMemberSignInfoVO
;
import
com.subsidy.vo.sign.SignInStatusVO
;
import
com.tencentcloudapi.common.Sign
;
/**
...
...
@@ -25,4 +26,6 @@ public interface SignInRecordService extends IService<SignInRecordDO> {
String
signIn
(
SignInRecordDO
signInRecordDO
);
IPage
classSignInfo
(
ClassSignInfoDTO
classSignInfoDTO
);
SignInStatusVO
signInStatus
(
SignInRecordDO
signInRecordDO
);
}
src/main/java/com/subsidy/service/impl/AdministerServiceImpl.java
View file @
bcbbb8c
This diff is collapsed.
Click to expand it.
src/main/java/com/subsidy/service/impl/CompanyDictServiceImpl.java
View file @
bcbbb8c
...
...
@@ -8,9 +8,11 @@ import com.subsidy.common.exception.HttpException;
import
com.subsidy.dto.administer.OperatorsDTO
;
import
com.subsidy.dto.company.AddCompanyDTO
;
import
com.subsidy.mapper.AdministerMapper
;
import
com.subsidy.mapper.RoleAdministerMappingMapper
;
import
com.subsidy.model.AdministerDO
;
import
com.subsidy.model.CompanyDictDO
;
import
com.subsidy.mapper.CompanyDictMapper
;
import
com.subsidy.model.RoleAdministerMappingDO
;
import
com.subsidy.service.CompanyDictService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.subsidy.util.ConstantUtils
;
...
...
@@ -34,9 +36,22 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
@Autowired
private
AdministerMapper
administerMapper
;
@Autowired
private
RoleAdministerMappingMapper
roleAdministerMappingMapper
;
public
IPage
<
OperatorsVO
>
operators
(
OperatorsDTO
operatorsDTO
)
{
Page
pager
=
new
Page
(
operatorsDTO
.
getPageNum
(),
operatorsDTO
.
getPageSize
());
return
this
.
baseMapper
.
operators
(
pager
,
operatorsDTO
.
getCompanyName
(),
operatorsDTO
.
getUserName
(),
1
);
//判断该用户的角色
Integer
count
=
roleAdministerMappingMapper
.
selectCount
(
new
QueryWrapper
<
RoleAdministerMappingDO
>()
.
lambda
()
.
eq
(
RoleAdministerMappingDO:
:
getAdministerId
,
operatorsDTO
.
getId
())
.
eq
(
RoleAdministerMappingDO:
:
getRoleId
,
1
));
if
(
count
>
0
){
operatorsDTO
.
setId
(
null
);
}
return
this
.
baseMapper
.
operators
(
pager
,
operatorsDTO
.
getCompanyName
(),
operatorsDTO
.
getId
(),
operatorsDTO
.
getUserName
(),
1
);
}
public
String
addOperator
(
AddCompanyDTO
addCompanyDTO
)
{
...
...
src/main/java/com/subsidy/service/impl/MemberServiceImpl.java
View file @
bcbbb8c
...
...
@@ -95,8 +95,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
Integer
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
MemberDO
>()
.
lambda
()
.
eq
(
MemberDO:
:
getTelephone
,
memberDO
.
getTelephone
())
.
eq
(
MemberDO:
:
getDepartmentId
,
memberDO
.
getDepartmentId
()));
.
eq
(
MemberDO:
:
getTelephone
,
memberDO
.
getTelephone
()));
if
(
count
>
0
)
{
throw
new
HttpException
(
20002
);
...
...
@@ -361,14 +360,16 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
GetCourseTestVO
getCourseTestVO
=
new
GetCourseTestVO
();
CourseDictDO
courseDictDO
=
courseDictMapper
.
selectById
(
contentMemberDTO
.
getCourseId
());
ClassDictDO
classDictDO
=
classDictMapper
.
selectById
(
contentMemberDTO
.
getClassId
());
CourseDictDO
courseDictDO
=
courseDictMapper
.
selectById
(
classDictDO
.
getCourseId
());
getCourseTestVO
.
setCourseId
(
courseDictDO
.
getId
());
getCourseTestVO
.
setCourseName
(
courseDictDO
.
getCourseName
());
getCourseTestVO
.
setDeadline
(
c
ourseDictDO
.
getDeadline
().
toString
().
replace
(
"T"
,
" "
));
getCourseTestVO
.
setDeadline
(
c
lassDictDO
.
getEndDate
(
));
ExerciseDoneResultDO
exerciseDoneResultDO
=
exerciseDoneResultMapper
.
selectOne
(
new
QueryWrapper
<
ExerciseDoneResultDO
>()
.
lambda
()
.
eq
(
ExerciseDoneResultDO:
:
getCourseId
,
co
ntentMemberDTO
.
getCourse
Id
())
.
eq
(
ExerciseDoneResultDO:
:
getCourseId
,
co
urseDictDO
.
get
Id
())
.
eq
(
ExerciseDoneResultDO:
:
getMemberId
,
contentMemberDTO
.
getMemberId
()));
if
(
null
!=
exerciseDoneResultDO
){
...
...
@@ -379,7 +380,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//该课程下有多少习题
Integer
count
=
exerciseDictMapper
.
selectCount
(
new
QueryWrapper
<
ExerciseDictDO
>()
.
lambda
()
.
eq
(
ExerciseDictDO:
:
getCourseId
,
co
ntentMemberDTO
.
getCourse
Id
()));
.
eq
(
ExerciseDictDO:
:
getCourseId
,
co
urseDictDO
.
get
Id
()));
getCourseTestVO
.
setTotalCount
(
String
.
valueOf
(
count
));
}
return
getCourseTestVO
;
...
...
src/main/java/com/subsidy/service/impl/SignInRecordServiceImpl.java
View file @
bcbbb8c
...
...
@@ -14,9 +14,12 @@ import com.subsidy.util.ConstantUtils;
import
com.subsidy.util.MathUtil
;
import
com.subsidy.vo.member.GetMemberSignInfoVO
;
import
com.subsidy.vo.sign.ClassSignInfoVO
;
import
com.subsidy.vo.sign.SignInStatusVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.List
;
/**
...
...
@@ -50,30 +53,31 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
return
this
.
baseMapper
.
selectPage
(
pager
,
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
get
Student
Id
,
getMemberSignInfoDTO
.
getId
())
.
eq
(
SignInRecordDO:
:
get
Member
Id
,
getMemberSignInfoDTO
.
getId
())
.
orderByDesc
(
SignInRecordDO:
:
getCreateDate
));
}
public
String
signIn
(
SignInRecordDO
signInRecordDO
)
{
/**
* 查看学生打卡记录
*/
List
<
SignInRecordDO
>
signInRecordDOS
=
this
.
baseMapper
.
selectList
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getStudentId
,
signInRecordDO
.
getStudentId
()));
/**
* 查看学生所有在读班级
*/
if
(
signInRecordDOS
.
size
()
==
0
)
{
this
.
baseMapper
.
insert
(
signInRecordDO
);
return
ConstantUtils
.
ADD_SUCCESS
;
}
else
{
//不用签到
return
""
;
List
<
ClassDictDO
>
classDictDOS
=
classMemberMappingMapper
.
getMemberClass
(
signInRecordDO
.
getMemberId
());
this
.
baseMapper
.
delete
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getMemberId
,
signInRecordDO
.
getMemberId
())
.
gt
(
SignInRecordDO:
:
getSignInDate
,
LocalDate
.
now
()));
for
(
ClassDictDO
classDictDO
:
classDictDOS
){
SignInRecordDO
signInRecordDO1
=
new
SignInRecordDO
();
signInRecordDO1
.
setClassId
(
classDictDO
.
getId
());
signInRecordDO1
.
setMemberId
(
signInRecordDO
.
getMemberId
());
signInRecordDO1
.
setSignInDate
(
LocalDateTime
.
now
());
this
.
baseMapper
.
insert
(
signInRecordDO1
);
}
return
ConstantUtils
.
ADD_SUCCESS
;
}
public
IPage
classSignInfo
(
ClassSignInfoDTO
classSignInfoDTO
)
{
...
...
@@ -157,4 +161,31 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
return
classSignInfoVOIPage
;
}
public
SignInStatusVO
signInStatus
(
SignInRecordDO
signInRecordDO
){
SignInStatusVO
signInStatusVO
=
new
SignInStatusVO
();
Boolean
flag
=
true
;
//获取有效课程
List
<
ClassDictDO
>
classDictDOS
=
classMemberMappingMapper
.
getMemberClass
(
signInRecordDO
.
getMemberId
());
for
(
ClassDictDO
classDictDO
:
classDictDOS
){
Integer
count
=
this
.
baseMapper
.
selectCount
(
new
QueryWrapper
<
SignInRecordDO
>()
.
lambda
()
.
eq
(
SignInRecordDO:
:
getClassId
,
classDictDO
.
getId
())
.
eq
(
SignInRecordDO:
:
getMemberId
,
signInRecordDO
.
getMemberId
())
.
gt
(
SignInRecordDO:
:
getSignInDate
,
LocalDate
.
now
()));
if
(
count
==
0
){
flag
=
false
;
}
}
signInStatusVO
.
setStatus
(
flag
);
return
signInStatusVO
;
}
}
src/main/java/com/subsidy/vo/administer/LoginVO.java
View file @
bcbbb8c
...
...
@@ -7,4 +7,5 @@ public class LoginVO {
private
String
token
;
}
src/main/java/com/subsidy/vo/administer/OperatorsVO.java
View file @
bcbbb8c
...
...
@@ -24,4 +24,6 @@ public class OperatorsVO {
private
String
accountName
;
private
Integer
companyId
;
private
String
logo
;
}
src/main/java/com/subsidy/vo/member/MemberStudyPageVO.java
View file @
bcbbb8c
...
...
@@ -17,4 +17,5 @@ public class MemberStudyPageVO {
private
String
img
;
private
String
logo
;
}
src/main/java/com/subsidy/vo/sign/SignInStatusVO.java
0 → 100644
View file @
bcbbb8c
package
com
.
subsidy
.
vo
.
sign
;
import
lombok.Data
;
@Data
public
class
SignInStatusVO
{
private
Boolean
status
;
}
src/main/resources/mapper/ClassMemberMappingMapper.xml
View file @
bcbbb8c
...
...
@@ -20,4 +20,18 @@
id, member_id, class_id
</sql>
<select
id=
"getMemberClass"
parameterType=
"long"
resultType=
"com.subsidy.model.ClassDictDO"
>
SELECT
*
FROM
class_member_mapping t
LEFT JOIN class_dict t2 ON t.class_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t2.start_date
<
= now()
and t2.end_date >= now()
and t.member_id = #{memberId}
</select>
</mapper>
src/main/resources/mapper/CompanyDictMapper.xml
View file @
bcbbb8c
...
...
@@ -30,7 +30,8 @@
t2.short_name,
t.account_name,
t.img,
t2.company_name
t2.company_name,
t2.logo
FROM
administer t
left join company_dict t2 on t.company_id = t2.id
...
...
@@ -43,6 +44,9 @@
<if
test=
"userName != null and userName != ''"
>
and t.user_name like concat('%',#{userName} ,'%')
</if>
<if
test=
"id != null and id !=''"
>
and t.id = #{id}
</if>
</select>
<select
id=
"getAdministerByCompanyId"
parameterType=
"long"
resultType=
"com.subsidy.model.AdministerDO"
>
...
...
src/main/resources/mapper/SignInRecordMapper.xml
View file @
bcbbb8c
...
...
@@ -8,7 +8,7 @@
<result
column=
"create_date"
property=
"createDate"
/>
<result
column=
"update_date"
property=
"updateDate"
/>
<result
column=
"delete_date"
property=
"deleteDate"
/>
<result
column=
"student_id"
property=
"
student
Id"
/>
<result
column=
"student_id"
property=
"
member
Id"
/>
<result
column=
"class_id"
property=
"classId"
/>
<result
column=
"sign_in_date"
property=
"signInDate"
/>
</resultMap>
...
...
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