Commit bcbbb8c4 by 涂亚平

测试版本

1 parent 254dd350
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;
}
}
......@@ -29,11 +29,13 @@ public class WebConfig implements WebMvcConfigurer {
// .allowCredentials(true)
.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
......@@ -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));
......
......@@ -108,7 +108,7 @@ public class MemberController {
}
@PostMapping("getCourseTest")
@ApiOperation("获取课程下的测试情况 {memberId courseId}")
@ApiOperation("获取课程下的测试情况 {memberId 成员id courseId 课程id classId}")
public ResponseVO getCourseTest(@RequestBody ContentMemberDTO contentMemberDTO){
return ResponseData.generateCreatedResponse(0,memberService.getCourseTest(contentMemberDTO));
}
......
......@@ -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));
}
}
......@@ -15,4 +15,6 @@ public class OperatorsDTO {
private String userName;
private Integer id;
}
......@@ -9,4 +9,6 @@ public class ContentMemberDTO {
private Integer courseId;
private Integer classId;
}
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);
}
......@@ -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查找企业的管理员
......
......@@ -53,9 +53,9 @@ public class CourseDictDO extends BaseModel {
*/
private String courseSource;
/**
* 习题截止时间
*/
private LocalDateTime deadline;
///**
// * 习题截止时间
// */
//private LocalDateTime deadline;
}
......@@ -29,12 +29,12 @@ public class SignInRecordDO extends BaseModel {
/**
* 学生id
*/
private Integer studentId;
private Long memberId;
/**
* 班级id
*/
private Integer classId;
private Long classId;
/**
* 签到时间
......
......@@ -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);
}
......@@ -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) {
......
......@@ -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(courseDictDO.getDeadline().toString().replace("T"," "));
getCourseTestVO.setDeadline(classDictDO.getEndDate());
ExerciseDoneResultDO exerciseDoneResultDO = exerciseDoneResultMapper.selectOne(new QueryWrapper<ExerciseDoneResultDO>()
.lambda()
.eq(ExerciseDoneResultDO::getCourseId,contentMemberDTO.getCourseId())
.eq(ExerciseDoneResultDO::getCourseId,courseDictDO.getId())
.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,contentMemberDTO.getCourseId()));
.eq(ExerciseDictDO::getCourseId,courseDictDO.getId()));
getCourseTestVO.setTotalCount(String.valueOf(count));
}
return getCourseTestVO;
......
......@@ -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::getStudentId, getMemberSignInfoDTO.getId())
.eq(SignInRecordDO::getMemberId, 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()));
/**
* 查看学生所有在读班级
*/
List<ClassDictDO> classDictDOS = classMemberMappingMapper.getMemberClass(signInRecordDO.getMemberId());
if (signInRecordDOS.size() == 0) {
this.baseMapper.insert(signInRecordDO);
return ConstantUtils.ADD_SUCCESS;
} else {
//不用签到
return "";
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;
}
}
......@@ -7,4 +7,5 @@ public class LoginVO {
private String token;
}
......@@ -24,4 +24,6 @@ public class OperatorsVO {
private String accountName;
private Integer companyId;
private String logo;
}
......@@ -17,4 +17,5 @@ public class MemberStudyPageVO {
private String img;
private String logo;
}
package com.subsidy.vo.sign;
import lombok.Data;
@Data
public class SignInStatusVO {
private Boolean status;
}
......@@ -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 &lt;= now()
and t2.end_date >= now()
and t.member_id = #{memberId}
</select>
</mapper>
......@@ -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">
......
......@@ -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="studentId" />
<result column="student_id" property="memberId" />
<result column="class_id" property="classId" />
<result column="sign_in_date" property="signInDate" />
</resultMap>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!