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;
}
}
......@@ -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
......@@ -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);
}
......@@ -79,6 +79,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Autowired
private CompanyDictMapper companyDictMapper;
@Autowired
private RoleAdministerMappingMapper roleAdministerMappingMapper;
public LoginVO login(AdministerDO administerDO) {
LoginVO loginVO = new LoginVO();
......@@ -133,7 +136,18 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
return companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getUserName(), 0);
//判断该用户的角色
Integer count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,operatorsDTO.getId())
.eq(RoleAdministerMappingDO::getRoleId,1));
if (count > 0){
operatorsDTO.setId(null);
}
return companyDictMapper.operators(pager, operatorsDTO.getCompanyName(),operatorsDTO.getId(), operatorsDTO.getUserName(), 0);
}
public String addAdminister(AdministerDO administerDO) {
......@@ -313,7 +327,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//签到次数
Integer signCount = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getStudentId, classDetailVO.getId())
.eq(SignInRecordDO::getMemberId, classDetailVO.getId())
.eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
classDetailVO.setSignCounts(signCount);
......@@ -382,7 +396,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//签到次数
Integer signCount = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getStudentId, classDetailVO.getId())
.eq(SignInRecordDO::getMemberId, classDetailVO.getId())
.eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
classDetailVO.setSignCounts(signCount);
......@@ -434,7 +448,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//签到次数
Integer count = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getStudentId, classSignVO.getId())
.eq(SignInRecordDO::getMemberId, classSignVO.getId())
.eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
classSignVO.setSignCounts(count);
......@@ -486,7 +500,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//签到次数
Integer count = signInRecordMapper.selectCount(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getStudentId, classSignVO.getId())
.eq(SignInRecordDO::getMemberId, classSignVO.getId())
.eq(SignInRecordDO::getClassId, classDetailDTO.getId()));
classSignVO.setSignCounts(count);
......@@ -589,8 +603,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
ZipOutputStream zipOutputStream = new ZipOutputStream(sos);
String zipname = "summary.zip";
response.reset();
response.setContentType(ALL_VALUE);
response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes(), "iso-8859-1"));
response.setHeader("Access-Control-Allow-Origin","*");
response.setContentType("application/zip;charset=utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + new String((zipname).getBytes("UTF-8"), "ISO8859-1"));
/**
* 班级成员
......@@ -601,6 +616,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
membersListExcel("班级成员", memberList, classDetailVOS, null, 0, baos);
compressFileToZipStream(zipOutputStream, baos, "member.xlsx");
//ZipEntry entry = new ZipEntry("member.xlsx");
//zipOutputStream.putNextEntry(entry);
//baos.writeTo(zipOutputStream);
/**
* 注册签到
*/
......@@ -659,24 +677,24 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
titleStyle.setFont(titleFont);
// 列头样式
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
Font headerFont = workbook.createFont();
headerFont.setFontHeightInPoints((short) 12);
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
//headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headerStyle.setFont(headerFont);
// 单元格样式
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
Font cellFont = workbook.createFont();
cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
......@@ -699,23 +717,23 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
ii++;
}
// 遍历集合数据,产生数据行
SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
titleRow.createCell(0).setCellValue(title);
titleRow.getCell(0).setCellStyle(titleStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
for (int i = 0; i < headers.length; i++) {
headerRow.createCell(i).setCellValue(headers[i]);
headerRow.getCell(i).setCellStyle(headerStyle);
}
int rowIndex = 0;
for (ClassDetailVO classDetailVO : classDetailVOS) {
if (rowIndex == 65535 || rowIndex == 0) {
if (rowIndex != 0) {
sheet = workbook.createSheet();//如果数据超过了,则在第二页显示
}
SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
titleRow.createCell(0).setCellValue(title);
titleRow.getCell(0).setCellStyle(titleStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
for (int i = 0; i < headers.length; i++) {
headerRow.createCell(i).setCellValue(headers[i]);
headerRow.getCell(i).setCellStyle(headerStyle);
}
rowIndex = 2;//数据内容从 rowIndex=2开始
}
......@@ -777,25 +795,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
titleStyle.setFont(titleFont);
// 列头样式
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
Font headerFont = workbook.createFont();
headerFont.setFontHeightInPoints((short) 12);
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headerStyle.setFont(headerFont);
// 单元格样式
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
//cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
Font cellFont = workbook.createFont();
cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
cellStyle.setFont(cellFont);
......@@ -818,22 +836,23 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
// 遍历集合数据,产生数据行
int rowIndex = 0;
SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
titleRow.createCell(0).setCellValue(title);
titleRow.getCell(0).setCellStyle(titleStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
for (int i = 0; i < headers.length; i++) {
headerRow.createCell(i).setCellValue(headers[i]);
headerRow.getCell(i).setCellStyle(headerStyle);
}
for (ClassSignVO classSignVO : classSignVOS) {
if (rowIndex == 65535 || rowIndex == 0) {
if (rowIndex != 0) {
sheet = workbook.createSheet();//如果数据超过了,则在第二页显示
}
SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
titleRow.createCell(0).setCellValue(title);
titleRow.getCell(0).setCellStyle(titleStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
for (int i = 0; i < headers.length; i++) {
headerRow.createCell(i).setCellValue(headers[i]);
headerRow.getCell(i).setCellStyle(headerStyle);
}
rowIndex = 2;//数据内容从 rowIndex=2开始
}
......@@ -886,25 +905,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
titleStyle.setFont(titleFont);
// 列头样式
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
Font headerFont = workbook.createFont();
headerFont.setFontHeightInPoints((short) 12);
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headerStyle.setFont(headerFont);
// 单元格样式
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
//cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
Font cellFont = workbook.createFont();
cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
cellStyle.setFont(cellFont);
......@@ -989,25 +1008,25 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
titleStyle.setFont(titleFont);
// 列头样式
CellStyle headerStyle = workbook.createCellStyle();
headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//headerStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//headerStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
Font headerFont = workbook.createFont();
headerFont.setFontHeightInPoints((short) 12);
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
headerStyle.setFont(headerFont);
// 单元格样式
CellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
//cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
//cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
//cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
//cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
//cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
Font cellFont = workbook.createFont();
cellFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
cellStyle.setFont(cellFont);
......@@ -1030,22 +1049,23 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
// 遍历集合数据,产生数据行
int rowIndex = 0;
SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
titleRow.createCell(0).setCellValue(title);
titleRow.getCell(0).setCellStyle(titleStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
for (int i = 0; i < headers.length; i++) {
headerRow.createCell(i).setCellValue(headers[i]);
headerRow.getCell(i).setCellStyle(headerStyle);
}
for (AnswerRecordVO answerRecordVO : answerRecordVOS) {
if (rowIndex == 65535 || rowIndex == 0) {
if (rowIndex != 0) {
sheet = workbook.createSheet();//如果数据超过了,则在第二页显示
}
SXSSFRow titleRow = sheet.createRow(0);//表头 rowIndex=0
titleRow.createCell(0).setCellValue(title);
titleRow.getCell(0).setCellStyle(titleStyle);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, headList.size() - 1));
SXSSFRow headerRow = sheet.createRow(1); //列头 rowIndex =1
for (int i = 0; i < headers.length; i++) {
headerRow.createCell(i).setCellValue(headers[i]);
headerRow.getCell(i).setCellStyle(headerStyle);
}
rowIndex = 2;//数据内容从 rowIndex=2开始
}
......
......@@ -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()));
/**
* 查看学生所有在读班级
*/
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;
}
}
......@@ -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!