Commit 05c3ab8d by 邓敏

Merge branch '2.7.1人脸识别版本' into websocker

2 parents 99ef83c5 2db05a18
Showing with 858 additions and 387 deletions
......@@ -5,10 +5,7 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.*;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.MemberDO;
import com.subsidy.model.*;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
......@@ -91,7 +88,7 @@ public class AdministerController {
@PostMapping("classSummary")
@ApiOperation("班级详情--数据概览 id 班级id ")
@LoginRequired
// @LoginRequired
public ResponseVO classSummary(@RequestBody ClassDetailDTO classDetailDTO){
return ResponseData.generateCreatedResponse(0,administerService.classSummary(classDetailDTO));
}
......@@ -233,6 +230,12 @@ public class AdministerController {
return ResponseData.generateCreatedResponse(0,administerService.imageCheckDetail(classDetailDTO));
}
@PostMapping("getMemberCheckDetail")
@ApiOperation("查看某个学生的验证详情 memberId 学员id classId")
@LoginRequired
public ResponseVO getMemberCheckDetail(@RequestBody ImageCheckRecordDO imageCheckRecordDO){
return ResponseData.generateCreatedResponse(0,administerService.getMemberCheckDetail(imageCheckRecordDO));
}
@PostMapping("exportZip")
@ApiOperation("下载压缩包 id 班级id")
......@@ -257,9 +260,17 @@ public class AdministerController {
}
@PostMapping("manageMember")
@ApiOperation("用户管理 {pageSize pageNum userName:名字 【废弃】}")
@ApiOperation("用户管理 {pageSize pageNum userName:名字 }")
@LoginRequired
public ResponseVO manageMember(@RequestBody ManageMemberDTO manageMemberDTO){
return ResponseData.generateCreatedResponse(0,administerService.manageMember(manageMemberDTO));
}
@PostMapping("exportManageMember")
@ApiOperation("导出认证信息 {pageSize pageNum userName:名字 } ")
@LoginRequired
public void exportManageMember(@RequestBody ManageMemberDTO manageMemberDTO){
administerService.exportManageMember(manageMemberDTO);
}
}
......@@ -10,6 +10,7 @@ import com.subsidy.service.AnsweringQuestionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -41,6 +42,7 @@ public class AnsweringQuestionController {
@PostMapping("addQuestion")
@ApiOperation("新增答疑 {classId askId title}")
@LoginRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#answeringQuestionDO.getClassId()")
public ResponseVO addQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.addQuestion(answeringQuestionDO));
}
......@@ -48,6 +50,7 @@ public class AnsweringQuestionController {
@PostMapping("deleteQuestion")
@ApiOperation(" 删除答疑 {id}")
@LoginRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#answeringQuestionDO.getClassId()")
public ResponseVO deleteQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0,answeringQuestionService.deleteQuestion(answeringQuestionDO));
}
......@@ -55,6 +58,7 @@ public class AnsweringQuestionController {
@PostMapping("updateQuestion")
@ApiOperation("编辑答疑 {id answerId answer}")
@LoginRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#answeringQuestionDO.getClassId()")
public ResponseVO updateQuestion(@RequestBody AnsweringQuestionDO answeringQuestionDO){
return ResponseData.generateCreatedResponse(0, answeringQuestionService.updateQuestion(answeringQuestionDO));
}
......
......@@ -8,6 +8,7 @@ import com.subsidy.dto.category.GetCategoriesDTO;
import com.subsidy.model.CategoryDO;
import com.subsidy.service.CategoryService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.catagory.GetCategoriesVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -25,7 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
* @since 2021-10-11
*/
@RestController
@Api(tags = "类目")
@Api(tags = "行业领域")
@RequestMapping("/category")
public class CategoryController {
......@@ -33,37 +34,37 @@ public class CategoryController {
private CategoryService categoryService;
@PostMapping("getCategories")
@ApiOperation("查询类目 name 类目名称 companyId pageSize pageNum")
@ApiOperation("查询行业领域 name 类目名称 companyId pageSize pageNum")
@LoginRequired
public ResponseVO getCategories(@RequestBody GetCategoriesDTO getCategoriesDTO){
return ResponseData.generateCreatedResponse(0,categoryService.getCategories(getCategoriesDTO));
}
@PostMapping("getAll")
@ApiOperation("查询所有类目 companyId")
@ApiOperation("查询所有类目【是否还有用?】 companyId")
public ResponseVO getAll(@RequestBody GetCategoriesDTO getCategoriesDTO){
return ResponseData.generateCreatedResponse(0,categoryService.getAll(getCategoriesDTO));
}
@PostMapping("addCategory")
@ApiOperation("新增类目 name companyId")
@ApiOperation("新增行业领域 name companyId categoryDOS[name 行业领域名称]")
@LoginRequired
public ResponseVO addCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.addCategory(categoryDO));
public ResponseVO addCategory(@RequestBody GetCategoriesVO getCategoriesVO){
return ResponseData.generateCreatedResponse(0,categoryService.addCategory(getCategoriesVO));
}
@PostMapping("deleteCategory")
@ApiOperation("删除类目 id")
@ApiOperation("删除一级行业领域 id")
@LoginRequired
public ResponseVO deleteCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.deleteCategory(categoryDO));
}
@PostMapping("updateCategory")
@ApiOperation("修改类目 id name companyId")
@ApiOperation("修改行业领域 id name companyId categoryDOS[name 行业领域名称]")
@LoginRequired
public ResponseVO updateCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.updateCategory(categoryDO));
public ResponseVO updateCategory(@RequestBody GetCategoriesVO getCategoriesVO){
return ResponseData.generateCreatedResponse(0,categoryService.updateCategory(getCategoriesVO));
}
}
......@@ -16,6 +16,7 @@ import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -59,7 +60,10 @@ public class ClassDictController {
}
@PostMapping("updateClass")
@ApiOperation("修改班级 id companyId className classTypeId startDate endDate")
@ApiOperation("修改班级 id className classTypeId startDate endDate isOrder 是否按顺序播放 isFastPlay 是否允许快进 " +
"testRule:测试规则 limitHour 学习上限时长 imageClassCheck:首次进入班级时人脸验证 imageTestCheck:测试前人脸识别验证" +
"activityDetection:活跃度检测开启/关闭 activityDetectionMethod:活跃度检测方式 firstDragAllowed:首次播放允许拖曳" +
"firstSpeedAllowed:首次播放允许倍速 playSnap 课程抓拍 ")
@LoginRequired
public ResponseVO updateClass(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.updateClass(classDictDO));
......
......@@ -57,12 +57,28 @@ public class CompanyDictController {
}
@PostMapping("updateCompany")
@ApiOperation("修改企业 id superviseName 第三方监管名称 accountName:账号 logo companyName:企业名称 address 企业所在地 shortName 简称 banner:标语 field[]:领域 role 1:超级管理员 2:普通成员")
@ApiOperation("修改企业 id superviseName 第三方监管名称 accountName:账号 logo companyName:企业名称 address 企业所在地 shortName 简称 " +
"banner:标语 field[]:领域 role 1:超级管理员 2:普通成员 ")
@LoginRequired
public ResponseVO updateAdminister(@RequestBody AddCompanyDTO addCompanyDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.updateAdminister(addCompanyDTO));
}
@PostMapping("updateCompanySettings")
@ApiOperation("修改企业设置 id timeLimit:上课时间不晚于23:30,不早于6:30" +
"ipAddressRecord: 签到时记录IP地址 deviceNoRecord: 设备类型")
@LoginRequired
public ResponseVO updateCompanySettings(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.updateCompanySettings(companyDictDO));
}
@PostMapping("getCompanyInfo")
@ApiOperation("获取公司配置信息 id ")
@LoginRequired
public ResponseVO getCompanyInfo(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.getCompanyInfo(companyDictDO));
}
@PostMapping("getAllCompany")
@ApiOperation("获取全部企业 {companyName}")
@LoginRequired
......
......@@ -15,6 +15,7 @@ import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -61,6 +62,7 @@ public class ExerciseDictController {
@ApiOperation("提交答案 {paperId 卷子id memberId 成员id classId课程 courseId 课程id memberExerciseVOS [ id selectAnswer ] length:做题时长} ")
@LoginRequired
@TimeRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#submitDTO.getClassId()")
public ResponseVO submit(@RequestBody SubmitDTO submitDTO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.submit(submitDTO));
}
......
......@@ -4,6 +4,8 @@ package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.common.interceptor.TimeRequired;
import com.subsidy.dto.image.CheckResultDTO;
import com.subsidy.dto.image.ImageCheckDTO;
import com.subsidy.model.ImageCheckRecordDO;
import com.subsidy.service.ImageCheckRecordService;
......@@ -41,11 +43,37 @@ public class ImageCheckRecordController {
}
@PostMapping("imageCheck")
@ApiOperation("人身核验 id 用户id nonce ")
@ApiOperation("课程/测评人身核验(权威库:身份证) PC端 id 用户id classId 班级id ")
@TimeRequired
public ResponseVO imageCheck(@RequestBody ImageCheckDTO imageCheckDTO) throws Exception {
return ResponseData.generateCreatedResponse(0, imageCheckRecordService.imageCheck(imageCheckDTO));
}
@PostMapping("h5ImageCheck")
@ApiOperation("课程/测评人脸核验(权威库:身份证) 微信浮层H5 id 用户id classId 班级id")
@TimeRequired
public ResponseVO h5CheckResult(@RequestBody ImageCheckDTO imageCheckDTO)throws Exception{
return ResponseData.generateCreatedResponse(0,imageCheckRecordService.h5CheckResult(imageCheckDTO));
}
@PostMapping("loginCheck")
@ApiOperation("签到页做人脸核验 (权威库:身份证) PC端 id 用户id")
@TimeRequired
public ResponseVO loginCheck(@RequestBody ImageCheckDTO imageCheckDTO)throws Exception{
return ResponseData.generateCreatedResponse(0,imageCheckRecordService.loginCheck(imageCheckDTO));
}
@PostMapping("h5LoginCheck")
@ApiOperation("签到页做人脸核验 (权威库:身份证) PC端 id 用户id")
@TimeRequired
public ResponseVO h5LoginCheck(@RequestBody ImageCheckDTO imageCheckDTO)throws Exception{
return ResponseData.generateCreatedResponse(0,imageCheckRecordService.h5LoginCheck(imageCheckDTO));
}
@PostMapping("checkResult")
@ApiOperation("人脸验证结果 存图片 id 订单号 ")
public ResponseVO checkResult(@RequestBody CheckResultDTO checkResultDTO)throws Exception{
return ResponseData.generateCreatedResponse(0,imageCheckRecordService.checkResult(checkResultDTO));
}
}
......@@ -110,7 +110,7 @@ public class MemberController {
@PostMapping("myCourses")
@ApiOperation("手机端:我的学习--课程 memberId 学员id status 状态 0:全部 1:进行中 2:待开始 3:已完成 ")
// @LoginRequired
@LoginRequired
@TimeRequired
public ResponseVO myCourses(@RequestBody MyCoursesDTO myCoursesDTO){
return ResponseData.generateCreatedResponse(0,memberService.myCourses(myCoursesDTO));
......@@ -118,7 +118,7 @@ public class MemberController {
@PostMapping("contentVod")
@ApiOperation("手机端:目录+视频 classId 班级id courseId 课程 memberId 学员id")
// @LoginRequired
@LoginRequired
@TimeRequired
public ResponseVO contentVod(@RequestBody ContentMemberDTO contentVodDTO){
return ResponseData.generateCreatedResponse(0,memberService.contentVod(contentVodDTO));
......
......@@ -13,6 +13,7 @@ import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CachePut;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -35,16 +36,17 @@ public class SignInRecordController {
private SignInRecordService signInRecordService;
@PostMapping("getMemberSignInfo")
@ApiOperation("获取某个成员的签到记录 id 成员id pageSize pageNum")
@ApiOperation("获取某个成员的签到记录 id 成员id classId 班级id pageSize pageNum")
@LoginRequired
public ResponseVO getMemberSignInfo(@RequestBody GetMemberSignInfoDTO getMemberSignInfoDTO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.getMemberSignInfo(getMemberSignInfoDTO));
}
@PostMapping("signIn")
@ApiOperation("签到 memberId")
@LoginRequired
@ApiOperation("签到 memberId deviceNo:设备号")
// @LoginRequired
@TimeRequired
@CachePut(value = "ResultData" ,key = "'classId_'+#signInRecordDO.getClassId()")
public ResponseVO signIn(@RequestBody SignInRecordDO signInRecordDO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.signIn(signInRecordDO));
}
......@@ -58,7 +60,7 @@ public class SignInRecordController {
@PostMapping("signInStatus")
@ApiOperation("判断学生当天有没有打卡 {memberId 学生id}")
@LoginRequired
// @LoginRequired
@TimeRequired
public ResponseVO signInStatus(@RequestBody SignInRecordDO signInRecordDO) {
return ResponseData.generateCreatedResponse(0, signInRecordService.signInStatus(signInRecordDO));
......
......@@ -80,7 +80,6 @@ public class VodPlayHistoryController {
vodPlayHistoryService.playLengthFix(remainSecondsDTO);
}
@PostMapping("testPlays")
@ApiOperation("解决有交叉时间的数据")
public ResponseVO testPlays(@RequestBody VodPlayHistoryDO vodPlayHistoryDO){
......
package com.subsidy.dto.image;
import lombok.Data;
@Data
public class CheckResultDTO {
private String id;
}
......@@ -7,12 +7,6 @@ public class ImageCheckDTO {
private Long id;
private String imageBase64;
private Long classId;
private Long paperId;
private String nonce ;
}
......@@ -9,6 +9,8 @@ public class GetMemberSignInfoDTO {
private Integer pageNum;
private Long classId;
private Long id;
}
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.CategoryDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.catagory.GetCategoriesVO;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -19,8 +21,15 @@ public interface CategoryMapper extends BaseMapper<CategoryDO> {
/**
* 查看某个课程下的所有类目
* 查看某个课程下的所有行业领域
*/
List<CategoryDO> queryCourseCategory(Long courseId);
/**
* 查看行业领域
* 公司id为空的话就查平台的,否则传公司的行业领域
*/
IPage<GetCategoriesVO> getCategories(IPage page,Long companyId,String name);
}
......@@ -2,8 +2,11 @@ package com.subsidy.mapper;
import com.subsidy.model.ImageCheckRecordDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.image.GetMemberCheckDetailVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 实名验证记录表 Mapper 接口
......@@ -12,7 +15,13 @@ import org.springframework.stereotype.Repository;
* @author DengMin
* @since 2022-07-14
*/
@Repository
@Repository
public interface ImageCheckRecordMapper extends BaseMapper<ImageCheckRecordDO> {
/**
* 获取某个人某个课程的验证记录
*/
List<GetMemberCheckDetailVO> getMemberCheckDetail(Long memberId, Long classId);
}
......@@ -44,5 +44,5 @@ public interface VodDictMapper extends BaseMapper<VodDictDO> {
/**
* 重复数据查找
*/
List<VodPlayStateVO> testPlays(Long memberId);
List<VodPlayStateVO> testPlays(Long memberId,Long classId);
}
......@@ -26,6 +26,11 @@ public class CategoryDO extends BaseModel {
private Long id;
/**
* 父id
*/
private Long parentId;
/**
* 企业id
*/
private Long companyId;
......
......@@ -68,10 +68,10 @@ public class ClassDictDO extends BaseModel {
*/
private Integer isFastPlay;
///**
// * 班级状态
// */
//private String openStatus;
/**
* 班级状态
*/
private String openStatus;
/**
* 测试规则
......@@ -118,6 +118,4 @@ public class ClassDictDO extends BaseModel {
*/
private Integer playSnap;
}
......@@ -60,4 +60,20 @@ public class CompanyDictDO extends BaseModel {
*/
private String superviseName;
/**
* 上课时间不晚于23:30,不早于6:30
*/
private Integer timeLimit;
/**
* 签到时记录IP地址
*/
private Integer ipAddressRecord;
/**
* 签到时记录设备型号
*/
private Integer deviceNoRecord;
}
......@@ -26,7 +26,7 @@ public class ImageCheckRecordDO extends BaseModel {
private Long id;
/**
* 班级id
* 班级
*/
private Long classId;
......@@ -36,12 +36,39 @@ public class ImageCheckRecordDO extends BaseModel {
private Long memberId;
/**
* 请求id
* 活体检测得分
*/
private String requestId;
private String liveRate;
/**
* 图片地址
* 人脸检测得分
*/
private String imageUrl;
private String similarity;
/**
* 刷脸时间
*/
private String occurredTime;
/**
* 图片
*/
private String photo;
/**
* 流水号
*/
private String bizSeqNo;
/**
* 检测类型 检测类型 1,权威库 0照片比对
*/
private Integer checkType;
/**
* 检测地点 1,签到页 0 班级内
*/
private Integer checkPlace;
}
......@@ -46,5 +46,15 @@ public class SignInRecordDO extends BaseModel {
@ExcelColumnUtil(value = "sign_in_date", col = 4)
private LocalDateTime signInDate;
/**
* 地址
*/
private String ipAddress;
/**
* 设备号
*/
private String deviceNo;
}
......@@ -6,8 +6,10 @@ import com.subsidy.dto.administer.*;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ExerciseDoneHistoryDO;
import com.subsidy.model.ExerciseDoneResultDO;
import com.subsidy.model.ImageCheckRecordDO;
import com.subsidy.vo.administer.*;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.image.GetMemberCheckDetailVO;
import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.sign.AnswerRecordVO;
import org.springframework.web.multipart.MultipartFile;
......@@ -74,6 +76,8 @@ public interface AdministerService extends IService<AdministerDO> {
IPage<ImageCheckDetailVO> imageCheckDetail(ClassDetailDTO classDetailDTO);
List<GetMemberCheckDetailVO> getMemberCheckDetail(ImageCheckRecordDO imageCheckRecordDO);
void export(ClassDetailDTO classDetailDTO)throws Exception;
IPage memberStudy(MemberStudyLogDTO memberStudyLogDTO);
......@@ -83,4 +87,6 @@ public interface AdministerService extends IService<AdministerDO> {
String importMember(Long companyId, MultipartFile multipartFile)throws Exception;
IPage<ManageMemberVO> manageMember(ManageMemberDTO manageMemberDTO);
void exportManageMember(ManageMemberDTO manageMemberDTO);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.category.GetCategoriesDTO;
import com.subsidy.model.CategoryDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.catagory.GetCategoriesVO;
import java.util.List;
......@@ -17,13 +18,13 @@ import java.util.List;
*/
public interface CategoryService extends IService<CategoryDO> {
IPage<CategoryDO> getCategories(GetCategoriesDTO getCategoriesDTO);
IPage<GetCategoriesVO> getCategories(GetCategoriesDTO getCategoriesDTO);
List<CategoryDO> getAll(GetCategoriesDTO getCategoriesDTO);
String addCategory(CategoryDO categoryDO);
String addCategory(GetCategoriesVO getCategoriesVO);
String deleteCategory(CategoryDO categoryDO);
String updateCategory(CategoryDO categoryDO);
String updateCategory(GetCategoriesVO getCategoriesVO);
}
......@@ -33,6 +33,10 @@ public interface CompanyDictService extends IService<CompanyDictDO> {
String updateAdminister(AddCompanyDTO addCompanyDTO);
String updateCompanySettings(CompanyDictDO companyDictDO);
CompanyDictDO getCompanyInfo(CompanyDictDO companyDictDO);
List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO);
IPage<GetCompanyMembersVO> getCompanyMembers(GetCompanyMembersDTO getCompanyMembersDTO);
......
package com.subsidy.service;
import com.subsidy.dto.image.CheckResultDTO;
import com.subsidy.dto.image.ImageCheckDTO;
import com.subsidy.model.ImageCheckRecordDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.token.SendIdCardInfoVO;
import java.util.List;
......@@ -18,6 +20,14 @@ public interface ImageCheckRecordService extends IService<ImageCheckRecordDO> {
List<ImageCheckRecordDO> getImageCheckHistory(ImageCheckRecordDO imageCheckRecordDO);
String imageCheck(ImageCheckDTO imageCheckDTO)throws Exception;
SendIdCardInfoVO imageCheck(ImageCheckDTO imageCheckDTO)throws Exception;
SendIdCardInfoVO h5CheckResult(ImageCheckDTO imageCheckDTO) throws Exception;
SendIdCardInfoVO loginCheck(ImageCheckDTO imageCheckDTO)throws Exception;
SendIdCardInfoVO h5LoginCheck(ImageCheckDTO imageCheckDTO)throws Exception;
ImageCheckRecordDO checkResult(CheckResultDTO checkResultDTO)throws Exception;
}
......@@ -8,6 +8,7 @@ import com.subsidy.model.VodPlayHistoryDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.vod.VodPlayStateVO;
import java.util.HashSet;
import java.util.List;
/**
......@@ -32,5 +33,5 @@ public interface VodPlayHistoryService extends IService<VodPlayHistoryDO> {
void playLengthFix(RemainSecondsDTO remainSecondsDTO);
List<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO);
HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO);
}
......@@ -37,10 +37,12 @@ public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionM
activityDetectionDO.setMemberId(verifyDTO.getMemberId());
activityDetectionDO.setRequestId(resp.getRequestId());
if (resp.getCaptchaCode()==1){
//成功
activityDetectionDO.setStatus(1);
this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.SUCCESS_VERIFY;
}else {
//失败
activityDetectionDO.setStatus(0);
this.baseMapper.insert(activityDetectionDO);
return ConstantUtils.FAIL_VERIFY;
......@@ -48,7 +50,7 @@ public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionM
} catch (Exception e) {
// System.out.println(e.toString());
}
return null;
return ConstantUtils.SUCCESS_VERIFY;
}
public IPage<GetCheckHistoryVO> getCheckHistory(GetCheckHistoryDTO getCheckHistoryDTO){
......
......@@ -46,6 +46,8 @@ import com.subsidy.model.PaperDictDO;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.SignInRecordDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.mapper.*;
import com.subsidy.model.*;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.ExcelFormatUtils;
......@@ -57,6 +59,7 @@ import com.subsidy.vo.administer.*;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO;
import com.subsidy.vo.done.TestScoreInfoVO;
import com.subsidy.vo.image.GetMemberCheckDetailVO;
import com.subsidy.vo.member.ClassSignVO;
import com.subsidy.vo.sign.AnswerRecordVO;
import com.subsidy.vo.vod.ClassMemberPlayLengthVO;
......@@ -114,6 +117,7 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* <p>
* 管理平台用户 服务实现类
......@@ -176,6 +180,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
@Autowired
private PaperDictMapper paperDictMapper;
@Autowired
private ImageCheckRecordMapper imageCheckRecordMapper;
public LoginVO login(AdministerDO administerDO) {
LoginVO loginVO = new LoginVO();
......@@ -612,35 +619,9 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
IPage<ClassSignVO> classSignVOIPage = this.baseMapper.classSign(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<ClassSignVO> classSignVOS = classSignVOIPage.getRecords();
//课程由多少个视频
List<VodDictDO> vodDictDOS = classDictMapper.getClassVods(classDetailDTO.getId());
for (ClassSignVO classSignVO : classSignVOS) {
//该学生完成了多少个
int i = 0;
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classSignVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
playLength += totalPlayLength;
}
//课程进度
classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
//完成率
String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
classSignVO.setPercent(percent);
//培训时长
classSignVO.setTrainingLength(playLength);
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//签到
//Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
//签到次数
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getClassId, classDetailDTO.getId())
......@@ -651,7 +632,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
StringBuilder stringBuilder = new StringBuilder();
//签到时间
for (SignInRecordDO signInRecordDO : signInRecordDOS) {
//String[] array = signInRecordDO.split(":");
//时间戳转时间
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
}
......@@ -660,6 +640,11 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classSignVO.setSignInDateList(signInDate);
}
//最近一次签到
SignInRecordDO signInRecordDO = signInRecordDOS.get(signInRecordDOS.size() - 1);
classSignVO.setIpAddress(signInRecordDO.getIpAddress());
classSignVO.setDeviceNo(signInRecordDO.getDeviceNo());
}
classSignVOIPage.setRecords(classSignVOS);
return classSignVOIPage;
......@@ -676,29 +661,6 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
for (ClassSignVO classSignVO : classSignVOS) {
//该学生完成了多少个
int i = 0;
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classSignVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
playLength += totalPlayLength;
}
classSignVO.setClassProcess(i + "/" + vodDictDOS.size());
//完成率
String percent = MathUtil.getPercentAvgIndexWithPercent(new BigDecimal(i), new BigDecimal(vodDictDOS.size()));
classSignVO.setPercent(percent);
//培训时长 小时
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//培训时长 分钟
classSignVO.setTrainingLengthMinute(Math.floorDiv(playLength, 60) + "");
//签到
//Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
List<SignInRecordDO> signInRecordDOS = signInRecordMapper.selectList(new QueryWrapper<SignInRecordDO>()
......@@ -711,10 +673,8 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//sortSet.addAll(set);
StringBuilder stringBuilder = new StringBuilder();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//签到时间
for (SignInRecordDO signInRecordDO : signInRecordDOS) {
//String[] array = signInRecordDO.split(":");
//时间戳转时间
stringBuilder.append(signInRecordDO.getSignInDate().toString().replace("T", " ")).append(";");
}
......@@ -722,6 +682,12 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
String signInDate = stringBuilder.toString().substring(0, stringBuilder.length() - 1);
classSignVO.setSignInDateList(signInDate);
}
//最近一次签到
SignInRecordDO signInRecordDO = signInRecordDOS.get(signInRecordDOS.size() - 1);
classSignVO.setIpAddress(signInRecordDO.getIpAddress());
classSignVO.setDeviceNo(signInRecordDO.getDeviceNo());
}
if (classDetailDTO.getFlag()) {
......@@ -1031,9 +997,22 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//TODO
}
public IPage<ImageCheckDetailVO> imageCheckDetail(ClassDetailDTO classDetailDTO){
public IPage<ImageCheckDetailVO> imageCheckDetail(ClassDetailDTO classDetailDTO) {
Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize());
return this.baseMapper.imageCheckDetail(pager,classDetailDTO.getId(),classDetailDTO.getUserName());
return this.baseMapper.imageCheckDetail(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
}
public List<GetMemberCheckDetailVO> getMemberCheckDetail(ImageCheckRecordDO imageCheckRecordDO) {
List<GetMemberCheckDetailVO> memberCheckDetail = imageCheckRecordMapper.getMemberCheckDetail(imageCheckRecordDO.getMemberId(), imageCheckRecordDO.getClassId());
for (GetMemberCheckDetailVO gcdv : memberCheckDetail) {
if (gcdv.getSimilarity() > 60.0) {
gcdv.setResult("通过");
} else {
gcdv.setResult("不通过");
}
}
return memberCheckDetail;
}
public <T> void writeVodExcel(List<ClassDailyInfoVO> classDailyInfoVOS, HashMap<String, Integer> hashMap, List<String> title, HashMap<String, Integer> vodHashmap) {
......@@ -1399,6 +1378,31 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
return memberMapper.manageMember(pager, null, manageMemberDTO.getUserName(), null, null);
}
public void exportManageMember(ManageMemberDTO manageMemberDTO) {
Page pager = new Page(1, -1L);
IPage iPage = memberMapper.manageMember(pager, null, manageMemberDTO.getUserName(), null, null);
List<ManageMemberVO> manageMemberVOS = iPage.getRecords();
for (ManageMemberVO manageMemberVO : manageMemberVOS) {
if (manageMemberVO.getFirstLogin() == 1) {
manageMemberVO.setSmsCheck("已完成");
} else {
manageMemberVO.setSmsCheck("尚未完成");
}
if (!StringUtils.isEmpty(manageMemberVO.getCheckImage())) {
manageMemberVO.setImageCheckStatus("已完成");
} else {
manageMemberVO.setImageCheckStatus("尚未完成");
}
}
ExcelUtil.writeExcel(manageMemberVOS, ManageMemberVO.class);
}
public String userName(String originName, int i, Long companyId) {
i++;
List<MemberDO> memberDOS = memberMapper.selectList(new QueryWrapper<MemberDO>()
......@@ -1746,7 +1750,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
sheet.addMergedRegion(cellRangeAddress21);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress21, sheet, workbook); //给合并过的单元格加边框
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 4, 9);
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 4, 7);
sheet.addMergedRegion(cellRangeAddress22);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress22, sheet, workbook); //给合并过的单元格加边框
......@@ -1762,7 +1766,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
sheet.addMergedRegion(cellRangeAddress31);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress31, sheet, workbook); //给合并过的单元格加边框
CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 4, 9);
CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 4, 7);
sheet.addMergedRegion(cellRangeAddress32);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress32, sheet, workbook); //给合并过的单元格加边框
thirdRow.createCell(0).setCellValue(thirdHead[0]);
......@@ -1814,27 +1818,19 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
newCell = dataRow.createCell(4);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getTrainingLengthStr());
newCell.setCellValue(classSignVO.getSignCounts());
newCell = dataRow.createCell(5);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getTrainingLengthMinute());
newCell.setCellValue(classSignVO.getSignInDateList());
newCell = dataRow.createCell(6);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getClassProcess());
newCell.setCellValue(classSignVO.getIpAddress());
newCell = dataRow.createCell(7);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getPercent());
newCell = dataRow.createCell(8);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getSignCounts());
newCell = dataRow.createCell(9);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getSignInDateList());
newCell.setCellValue(classSignVO.getDeviceNo());
rowIndex++;
seq++;
......
......@@ -10,6 +10,8 @@ import com.subsidy.mapper.CategoryMapper;
import com.subsidy.service.CategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.catagory.GetCategoriesVO;
import org.springframework.beans.BeanUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -26,20 +28,21 @@ import java.util.List;
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO> implements CategoryService {
public IPage<CategoryDO> getCategories(GetCategoriesDTO getCategoriesDTO) {
public IPage<GetCategoriesVO> getCategories(GetCategoriesDTO getCategoriesDTO) {
Page pager = new Page(getCategoriesDTO.getPageNum(), getCategoriesDTO.getPageSize());
if (null == getCategoriesDTO.getCompanyId()) {
return this.baseMapper.selectPage(pager, new QueryWrapper<CategoryDO>()
.lambda()
.like(CategoryDO::getName, getCategoriesDTO.getName())
.isNull(CategoryDO::getCompanyId));
} else {
return this.baseMapper.selectPage(pager, new QueryWrapper<CategoryDO>()
.lambda()
.like(CategoryDO::getName, getCategoriesDTO.getName())
.eq(CategoryDO::getCompanyId, getCategoriesDTO.getCompanyId()));
IPage<GetCategoriesVO> categoryDOIPage = this.baseMapper.getCategories(pager,getCategoriesDTO.getCompanyId(),getCategoriesDTO.getName());
//二级行业领域
List<GetCategoriesVO> getCategoriesVOS = categoryDOIPage.getRecords();
for (GetCategoriesVO gcv : getCategoriesVOS){
//找二级
List<CategoryDO> categoryDOS = this.baseMapper.selectList(new QueryWrapper<CategoryDO>()
.lambda()
.eq(CategoryDO::getParentId,gcv.getId()));
gcv.setCategoryDOS(categoryDOS);
}
return categoryDOIPage;
}
......@@ -56,48 +59,79 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO>
}
}
public String addCategory(CategoryDO categoryDO) {
public String addCategory(GetCategoriesVO getCategoriesVO) {
int count;
if (null == categoryDO.getCompanyId()) {
if (null == getCategoriesVO.getCompanyId()) {
count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
.lambda()
.like(CategoryDO::getName, categoryDO.getName())
.like(CategoryDO::getName, getCategoriesVO.getName())
.isNull(CategoryDO::getCompanyId));
} else {
count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
.lambda()
.like(CategoryDO::getName, categoryDO.getName())
.eq(CategoryDO::getCompanyId, categoryDO.getCompanyId()));
.like(CategoryDO::getName, getCategoriesVO.getName())
.eq(CategoryDO::getCompanyId, getCategoriesVO.getCompanyId()));
}
if (count > 0) {
throw new HttpException(90001);
}
//一级目录
CategoryDO categoryDO = new CategoryDO();
BeanUtils.copyProperties(getCategoriesVO,categoryDO);
this.baseMapper.insert(categoryDO);
//二级目录
List<CategoryDO> categoryDOS = getCategoriesVO.getCategoryDOS();
for (CategoryDO cd : categoryDOS){
cd.setCompanyId(getCategoriesVO.getCompanyId());
cd.setParentId(categoryDO.getId());
this.baseMapper.insert(cd);
}
return ConstantUtils.ADD_SUCCESS;
}
public String deleteCategory(CategoryDO categoryDO) {
this.baseMapper.deleteById(categoryDO.getId());
this.baseMapper.delete(new QueryWrapper<CategoryDO>()
.lambda()
.eq(CategoryDO::getParentId,categoryDO.getId()));
return ConstantUtils.DELETE_SUCCESS;
}
public String updateCategory(CategoryDO categoryDO) {
public String updateCategory(GetCategoriesVO getCategoriesVO) {
int count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
.lambda()
.eq(CategoryDO::getName, categoryDO.getName())
.eq(CategoryDO::getCompanyId, categoryDO.getCompanyId())
.ne(CategoryDO::getId, categoryDO.getId()));
.eq(CategoryDO::getName, getCategoriesVO.getName())
.eq(CategoryDO::getCompanyId, getCategoriesVO.getCompanyId())
.ne(CategoryDO::getId, getCategoriesVO.getId()));
if (count > 0) {
throw new HttpException(90001);
}
CategoryDO categoryDO = new CategoryDO();
BeanUtils.copyProperties(getCategoriesVO,categoryDO);
this.baseMapper.updateById(categoryDO);
CategoryDO categoryDO1 = this.baseMapper.selectById(categoryDO.getId());
if (getCategoriesVO.getCategoryDOS().size()>0){
this.baseMapper.delete(new QueryWrapper<CategoryDO>()
.lambda()
.eq(CategoryDO::getParentId,getCategoriesVO.getId()));
List<CategoryDO> categoryDOS = getCategoriesVO.getCategoryDOS();
for (CategoryDO cd: categoryDOS){
cd.setParentId(getCategoriesVO.getId());
cd.setCompanyId(categoryDO1.getCompanyId());
this.baseMapper.insert(cd);
}
}
return ConstantUtils.SET_SUCCESS;
}
......
......@@ -279,13 +279,22 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
return ConstantUtils.SET_SUCCESS;
}
public String updateCompanySettings(CompanyDictDO companyDictDO) {
this.baseMapper.updateById(companyDictDO);
return ConstantUtils.SET_SUCCESS;
}
public CompanyDictDO getCompanyInfo(CompanyDictDO companyDictDO) {
return this.baseMapper.selectById(companyDictDO.getId());
}
public List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO) {
return this.baseMapper.getAllCompany(companyDictDO);
}
public IPage<GetCompanyMembersVO> getCompanyMembers(GetCompanyMembersDTO getCompanyMembersDTO) {
Page pager = new Page(getCompanyMembersDTO.getPageNum(), getCompanyMembersDTO.getPageSize());
return this.baseMapper.getCompanyMembers(pager,getCompanyMembersDTO.getCompanyId(),getCompanyMembersDTO.getUserName());
return this.baseMapper.getCompanyMembers(pager, getCompanyMembersDTO.getCompanyId(), getCompanyMembersDTO.getUserName());
}
@Override
......@@ -343,18 +352,18 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
//总数
Integer total = memberMapper.selectCount(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getCompanyId,getCompanyMembersDTO.getCompanyId()));
.lambda()
.eq(MemberDO::getCompanyId, getCompanyMembersDTO.getCompanyId()));
memberSummaryVO.setTotal(total);
//短信验证
Integer smsCnt = memberMapper.selectCount(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getCompanyId,getCompanyMembersDTO.getCompanyId())
.isNull(MemberDO::getFirstLogin));
.lambda()
.eq(MemberDO::getCompanyId, getCompanyMembersDTO.getCompanyId())
.isNull(MemberDO::getFirstLogin));
memberSummaryVO.setSmsCnt(smsCnt);
memberSummaryVO.setImgCnt(total-smsCnt);
memberSummaryVO.setImgCnt(total - smsCnt);
return memberSummaryVO;
}
......
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.generator.config.TemplateConfig;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.hash.Hashing;
import com.subsidy.common.configure.RestTemplateConfig;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.image.CheckResultDTO;
import com.subsidy.dto.image.ImageCheckDTO;
import com.subsidy.mapper.AccessTokenMapper;
import com.subsidy.mapper.ImageCheckRecordMapper;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.model.AccessTokenDO;
import com.subsidy.model.ImageCheckRecordDO;
import com.subsidy.mapper.ImageCheckRecordMapper;
import com.subsidy.model.MemberDO;
import com.subsidy.service.ImageCheckRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.ImageCheckUtil;
import com.subsidy.vo.image.CheckImageResultVO;
import com.subsidy.vo.token.*;
import com.subsidy.vo.wechat.AccessTokenVO;
import com.tencentcloudapi.faceid.v20180301.models.GetFaceIdResultResponse;
import com.tencentcloudapi.faceid.v20180301.models.ImageRecognitionResponse;
import org.apache.commons.codec.Charsets;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import sun.misc.BASE64Decoder;
//import org.apache.commons.codec.binary.Base64;
import java.io.*;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* <p>
......@@ -48,85 +50,190 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
@Autowired
private RestTemplateConfig restTemplateConfig;
@Autowired
private AccessTokenMapper accessTokenMapper;
@Autowired
private ImageCheckRecordMapper imageCheckRecordMapper;
// public static final String WBAPPID = "IDAaOibN";
// public static final String SECRET= "GD6Z55rHXSlBZB4oxEEowwI5h4IgwUdh0xOOHi6fambXYMFcHuDaBRxtnMx5FVhk";
public static final String WBAPPID = "TIDAbX8x";
public static final String SECRET = "cWAMlQ8Aq7aOad0wrtfJcSpcgksCLFT62qHC4uDHFCGx0SPKqtpt1PungiAKya2M";
public static final String NONCE = "08f1209ee37b4ba29e61e51f3643a24e";
public List<ImageCheckRecordDO> getImageCheckHistory(ImageCheckRecordDO imageCheckRecordDO) {
return this.baseMapper.selectList(new QueryWrapper<ImageCheckRecordDO>()
.lambda()
.eq(ImageCheckRecordDO::getClassId, imageCheckRecordDO.getClassId())
.eq(ImageCheckRecordDO::getMemberId, imageCheckRecordDO.getMemberId())
.orderByDesc(ImageCheckRecordDO::getCreateDate));
}
public String imageCheck(ImageCheckDTO imageCheckDTO) throws Exception {
public SendIdCardInfoVO imageCheck(ImageCheckDTO imageCheckDTO) throws Exception {
return PCCheckIdCard(imageCheckDTO.getId(), imageCheckDTO.getClassId(), 0);
}
public SendIdCardInfoVO h5CheckResult(ImageCheckDTO imageCheckDTO) throws Exception {
return H5IdCheckCard(imageCheckDTO.getId(),imageCheckDTO.getClassId(),0);
}
public SendIdCardInfoVO loginCheck(ImageCheckDTO imageCheckDTO) throws Exception {
return PCCheckIdCard(imageCheckDTO.getId(), null, 1);
}
public SendIdCardInfoVO h5LoginCheck(ImageCheckDTO imageCheckDTO) throws Exception {
return H5IdCheckCard(imageCheckDTO.getId(),imageCheckDTO.getClassId(),1);
}
/**
* 当天验证次数超过
*/
public void getDailyCheckCnt(Long memberId){
int count = imageCheckRecordMapper.selectCount(new QueryWrapper<ImageCheckRecordDO>()
.lambda()
.eq(ImageCheckRecordDO::getMemberId,memberId)
.ge(ImageCheckRecordDO::getCreateDate,LocalDateTime.now()));
if (count>3){
throw new HttpException(18001);
}
}
/**
* H5端调取权威库(身份证)验证 权威库
* 1,签到页 0 班级内
*/
public SendIdCardInfoVO H5IdCheckCard(Long id, Long classId, Integer checkPlace) {
getDailyCheckCnt(id);
//获取这个学生的基本信息
MemberDO memberDO = memberMapper.selectById(imageCheckDTO.getId());
MemberDO memberDO = memberMapper.selectById(id);
if (StringUtils.isEmpty(memberDO.getIdCard())) {
throw new HttpException(10025);
}
//获取token
IdCardAccessTokenVO idCardAccessTokenVO = this.accessToken();
// 生成订单
ImageCheckRecordDO imageCheckRecordDO = new ImageCheckRecordDO();
imageCheckRecordDO.setMemberId(id);
imageCheckRecordDO.setClassId(classId);
imageCheckRecordDO.setCheckType(1);
imageCheckRecordDO.setCheckPlace(checkPlace);
imageCheckRecordMapper.insert(imageCheckRecordDO);
//获取signTicket
IdCardTicketsVO idCardTicketsVO = this.signTickets(idCardAccessTokenVO.getAccess_token());
IdCardTicketsVO idCardTicketsVO = this.signTickets(getLatestAccessToken());
//生成签名
List<String> signList1 = Arrays.asList(WBAPPID, NONCE, memberDO.getId() + "", "1.0.0");
String sign = sign(signList1, idCardTicketsVO.getValue());
//合作方后台上送身份信息
SendIdCardInfoVO sendIdCardInfoVO = this.h5SendIdCardInfo(imageCheckRecordDO.getId() + "", memberDO, sign);
if (!"0".equals(sendIdCardInfoVO.getCode())) {
imageCheckRecordMapper.deleteById(imageCheckRecordDO.getId());
throw new HttpException(10026);
}
//获取 NONCE ticket
IdCardTicketsVO nonceTicket = this.nonceTicket(getLatestAccessToken(), memberDO.getId() + "");
//签名2
List<String> signList2 = Arrays.asList(WBAPPID, NONCE, imageCheckRecordDO.getId() + "", sendIdCardInfoVO.getResult().getH5faceId(), memberDO.getId() + "", "1.0.0");
String sign2 = sign(signList2, nonceTicket.getValue());
sendIdCardInfoVO.getResult().setWbAppId(WBAPPID);
sendIdCardInfoVO.getResult().setNonce(NONCE);
sendIdCardInfoVO.getResult().setUserId(memberDO.getId());
sendIdCardInfoVO.getResult().setSign(sign2);
return sendIdCardInfoVO;
}
/**
* PC端调取权威库(身份证)验证 权威库
* 1,签到页 0 班级内
*/
public SendIdCardInfoVO PCCheckIdCard(Long id, Long classId, Integer checkPlace) {
List<String> signList1 = new ArrayList<>();
signList1.add(WBAPPID);
signList1.add("001");
signList1.add(memberDO.getUserName());
signList1.add(memberDO.getIdCard());
signList1.add(memberDO.getId() + "");
signList1.add("1.0.0");
getDailyCheckCnt(id);
//获取这个学生的基本信息
MemberDO memberDO = memberMapper.selectById(id);
if (StringUtils.isEmpty(memberDO.getIdCard())) {
throw new HttpException(10025);
}
//生成订单
ImageCheckRecordDO imageCheckRecordDO = new ImageCheckRecordDO();
imageCheckRecordDO.setMemberId(memberDO.getId());
imageCheckRecordDO.setClassId(classId);
imageCheckRecordDO.setCheckType(1);
imageCheckRecordDO.setCheckPlace(checkPlace);
imageCheckRecordMapper.insert(imageCheckRecordDO);
//获取signTicket
IdCardTicketsVO idCardTicketsVO = this.signTickets(getLatestAccessToken());
//生成签名
List<String> signList1 = Arrays.asList(WBAPPID, imageCheckRecordDO.getId() + "", memberDO.getUserName(), memberDO.getIdCard(), memberDO.getId() + "", "1.0.0");
String sign = sign(signList1, idCardTicketsVO.getValue());
System.out.println(sign);
//合作方后台上送身份信息
SendIdCardInfoVO sendIdCardInfoVO = this.sendIdCardInfo("001", memberDO, sign);
SendIdCardInfoVO sendIdCardInfoVO = this.sendIdCardInfo(imageCheckRecordDO.getId() + "", memberDO, sign);
if (!"0".equals(sendIdCardInfoVO.getCode())) {
imageCheckRecordMapper.deleteById(imageCheckRecordDO.getId());
throw new HttpException(10026);
}
//获取 NONCE ticket
IdCardTicketsVO nonceTicket = this.nonceTicket(idCardAccessTokenVO.getAccess_token(), memberDO.getId() + "");
IdCardTicketsVO nonceTicket = this.nonceTicket(getLatestAccessToken(), memberDO.getId() + "");
//签名2
List<String> signList2 = new ArrayList<>();
signList2.add(WBAPPID);
signList2.add(memberDO.getId() + "");
signList2.add(imageCheckDTO.getNonce());
signList2.add("1.0.0");
signList2.add(sendIdCardInfoVO.getResult().getH5faceId());
signList2.add(sendIdCardInfoVO.getResult().getOrderNo());
List<String> signList2 = Arrays.asList(WBAPPID, memberDO.getId() + "", NONCE, "1.0.0", sendIdCardInfoVO.getResult().getFaceId(), sendIdCardInfoVO.getResult().getOrderNo());
String sign2 = sign(signList2, nonceTicket.getValue());
//启动人脸验证
this.startCheck(imageCheckDTO.getNonce(), sendIdCardInfoVO.getResult(), memberDO.getId() + "", sign2);
sendIdCardInfoVO.getResult().setWbAppId(WBAPPID);
sendIdCardInfoVO.getResult().setNonce(NONCE);
sendIdCardInfoVO.getResult().setUserId(memberDO.getId());
sendIdCardInfoVO.getResult().setSign(sign2);
return sendIdCardInfoVO;
}
public ImageCheckRecordDO checkResult(CheckResultDTO checkResultDTO) throws Exception {
CheckImageResultVO checkImageResultVO = new CheckImageResultVO();
//获取signTicket
IdCardTicketsVO idCardTicketsVO = this.signTickets(getLatestAccessToken());
//签名3
List<String> signList3 = new ArrayList<>();
signList3.add(WBAPPID);
signList3.add("001");
signList3.add(checkResultDTO.getId());
signList3.add("1.0.0");
signList3.add(imageCheckDTO.getNonce());
signList3.add(NONCE);
String sign3 = sign(signList3,idCardTicketsVO.getValue());
System.out.println(sign3);
String sign3 = sign(signList3, idCardTicketsVO.getValue());
//人身核验结果
ResultVO resultVO = this.checkResult("001", imageCheckDTO.getNonce(), sign3);
ResultVO resultVO = this.checkResult(checkResultDTO.getId(), sign3);
//存数据库
ImageCheckRecordDO imageCheckRecordDO = imageCheckRecordMapper.selectById(checkResultDTO.getId());
BeanUtils.copyProperties(resultVO, imageCheckRecordDO);
imageCheckRecordMapper.updateById(imageCheckRecordDO);
BeanUtils.copyProperties(imageCheckRecordDO, checkImageResultVO);
if (Double.valueOf(resultVO.getSimilarity()) > 80.0) {
return ConstantUtils.SUCCESS_VERIFY;
//如果是签到页的认证,则把图片写到member表里
MemberDO memberDO = memberMapper.selectById(imageCheckRecordDO.getMemberId());
memberDO.setImage(checkImageResultVO.getPhoto());
memberDO.setCheckTime(DateFormatUtil.format(new Date(),DateFormatUtil.FMT_sdf14_L));
memberMapper.updateById(memberDO);
if ((Double.valueOf(imageCheckRecordDO.getSimilarity()) > 60)) {
checkImageResultVO.setResult(true);
} else {
return ConstantUtils.FAIL_VERIFY;
checkImageResultVO.setResult(false);
}
return imageCheckRecordDO;
}
/**
......@@ -138,9 +245,6 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
+ "&secret=" + SECRET + "&grant_type=client_credential&version=1.0.0";
ResponseEntity<IdCardAccessTokenVO> response = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.GET, null, IdCardAccessTokenVO.class);
System.out.println(response.getBody().toString());
return response.getBody();
}
......@@ -148,13 +252,9 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
* 获取sign_ticket
*/
public IdCardTicketsVO signTickets(String accessToken) {
String url = "https://miniprogram-kyc.tencentcloudapi.com/api/oauth2/api_ticket?app_id=" + WBAPPID + "&access_token=" + accessToken + "&type=SIGN&version=1.0.0";
ResponseEntity<IdCardSignTicketVO> response = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.GET, null, IdCardSignTicketVO.class);
System.out.println(response.getBody().getTickets());
return response.getBody().getTickets().get(0);
}
......@@ -177,7 +277,7 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
}
/**
* 合作方后台上送身份信息 POST请求
* PC端 合作方后台上送身份信息 POST请求
*/
public SendIdCardInfoVO sendIdCardInfo(String orderNo, MemberDO memberDO, String sign) {
String url = "https://miniprogram-kyc.tencentcloudapi.com/api/server/h5/geth5faceid?orderNo=" + orderNo;
......@@ -191,14 +291,35 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
" \"version\":\"1.0.0\"," +
" \"sign\":\"" + sign + "\"" +
"}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
ResponseEntity<SendIdCardInfoVO> responseEntity = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.POST, new HttpEntity<>(input, headers), SendIdCardInfoVO.class);
return responseEntity.getBody();
}
/**
* PC端 合作方后台上送身份信息 POST请求
*/
public SendIdCardInfoVO h5SendIdCardInfo(String orderNo, MemberDO memberDO, String sign) {
String url = "https://kyc.qcloud.com/api/server/getAdvFaceId?orderNo=" + orderNo;
String input = "{\n" +
" \"appId\":\"" + WBAPPID + "\",\n" +
" \"orderNo\":\"" + orderNo + "\",\n" +
" \"name\":\"" + memberDO.getUserName() + "\"," +
" \"idNo\":\"" + memberDO.getIdCard() + "\"," +
" \"userId\":\"" + memberDO.getId() + "\"," +
" \"version\":\"1.0.0\"," +
" \"sign\":\"" + sign + "\"," +
" \"nonce\":\"" + NONCE + "\"" +
"}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
ResponseEntity<SendIdCardInfoVO> responseEntity = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.POST, new HttpEntity<>(input, headers), SendIdCardInfoVO.class);
return responseEntity.getBody();
}
......@@ -216,49 +337,44 @@ public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMap
}
/**
* 启动 H5 人脸核身
*/
public void startCheck(String nonce, SendResultVO sendResultVO, String userId, String sign) {
String url = "https://miniprogram-kyc.tencentcloudapi.com/api/pc/login?webankAppId=" + WBAPPID +
"&version=1.0.0" +
"&nonce=" + nonce +
"&orderNo=" + sendResultVO.getOrderNo() +
"&h5faceId=" + sendResultVO.getH5faceId() +
"&url=" + sendResultVO.getOptimalDomain() +
"&userId=" + userId +
"&sign=" + sign;
restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.GET, null, IdCardSignTicketVO.class);
}
/**
* 人脸核身结果查询 POST
*/
public ResultVO checkResult(String orderNo,String nonce,String sign) {
public ResultVO checkResult(String orderNo, String sign) {
String url = "https://miniprogram-kyc.tencentcloudapi.com/api/v2/base/queryfacerecord?orderNo="+orderNo;
String url = "https://miniprogram-kyc.tencentcloudapi.com/api/v2/base/queryfacerecord?orderNo=" + orderNo;
String input = "{\n" +
" \"appId\":\"" + WBAPPID + "\",\n" +
" \"version\":\"1.0.0\",\n" +
" \"nonce\":\""+nonce+"\"," +
" \"nonce\":\"" + NONCE + "\"," +
" \"orderNo\":\"" + orderNo + "\"," +
" \"sign\":\"" + sign + "\"," +
" \"getFile\":\"2\"," +
" \"queryVersion\":\"\"" +
"}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
ResponseEntity<CheckResultVO> responseEntity = restTemplateConfig.restTemplate()
.exchange(url, HttpMethod.POST, new HttpEntity<>(input.getBytes(), headers), CheckResultVO.class);
return responseEntity.getBody().getResult();
}
return responseEntity.getBody().getResultVO();
//获取最新的accessToken
public String getLatestAccessToken() {
AccessTokenDO accessTokenDO = accessTokenMapper.selectOne(new QueryWrapper<AccessTokenDO>()
.lambda()
.lt(AccessTokenDO::getCreateDate, LocalDateTime.now().minusMinutes(19L)));
//数据库没有的话
if (null == accessTokenDO) {
accessTokenMapper.delete(null);
//获取token
IdCardAccessTokenVO idCardAccessTokenVO = this.accessToken();
accessTokenDO = new AccessTokenDO();
accessTokenDO.setAccessToken(idCardAccessTokenVO.getAccess_token());
accessTokenMapper.insert(accessTokenDO);
}
return accessTokenDO.getAccessToken();
}
......
......@@ -21,6 +21,7 @@ import com.subsidy.model.VodDictDO;
import com.subsidy.service.SignInRecordService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.IpAddressUtil;
import com.subsidy.vo.member.GetMemberSignInfoVO;
import com.subsidy.vo.sign.DataViewVO;
import com.subsidy.vo.sign.SignInStatusVO;
......@@ -73,6 +74,7 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
return this.baseMapper.selectPage(pager, new QueryWrapper<SignInRecordDO>()
.lambda()
.eq(SignInRecordDO::getMemberId, getMemberSignInfoDTO.getId())
.eq(SignInRecordDO::getClassId,getMemberSignInfoDTO.getClassId())
.orderByDesc(SignInRecordDO::getCreateDate));
}
......@@ -99,12 +101,12 @@ public class SignInRecordServiceImpl extends ServiceImpl<SignInRecordMapper, Sig
this.baseMapper.deleteById(sign.getId());
}
// signInRecordDO.setIpAddress(IpAddressUtil.getIpAddress());
signInRecordDO.setClassId(classDictDO.getId());
signInRecordDO.setSignInDate(LocalDateTime.now());
signInRecordDO.setCreateDate(LocalDateTime.now());
this.baseMapper.insert(signInRecordDO);
}
return ConstantUtils.ADD_SUCCESS;
}
......
......@@ -11,6 +11,7 @@ import com.subsidy.mapper.*;
import com.subsidy.model.*;
import com.subsidy.service.VodPlayHistoryService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.DateFormatUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.vo.vod.VodPlayStateVO;
import org.apache.commons.lang3.StringUtils;
......@@ -21,11 +22,7 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Random;
import java.util.*;
/**
* <p>
......@@ -81,7 +78,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total == classHourDictDO.getClassHour() * 3600){
if (total == classHourDictDO.getClassHour() * 3600) {
throw new HttpException(13001);
}
......@@ -90,7 +87,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength>3){
if (playLength > 3) {
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001);
......@@ -119,7 +116,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//查看当天这个人看了多少时间
Integer total = vodPlayHistoryMapper.memberDailyStudyLength(memberDO.getId());
if (total == classHourDictDO.getClassHour() * 3600){
if (total == classHourDictDO.getClassHour() * 3600) {
throw new HttpException(13001);
}
......@@ -128,7 +125,7 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
int playLength = classHourDictDO.getClassHour() * 3600 - total;
vodPlayHistoryDO.setPlayLength(playLength);
vodPlayHistoryDO.setPlayCount(1);
if (playLength >3){
if (playLength > 3) {
this.baseMapper.insert(vodPlayHistoryDO);
}
throw new HttpException(13001);
......@@ -631,89 +628,94 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// }
}
public List<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) {
public HashSet<Long> testPlays(VodPlayHistoryDO vodPlayHistoryDO) {
String classIds = "261";
String classIds = "150,151,152,153,165,195,199,200,202,207,209,210,211,212,213,215,227,228,229,233,234,235,240,241,243,244,248,249,250,251,252,253,254,255,256,257,258,261,268,278,280,282,286,287,288,289,292,293,294,295,297,298,300,301,303,304,305,306";
// String classIds = "122,150";
List<String> classIdArr = Arrays.asList(classIds.split(","));
List<Long> result = new ArrayList<>();
HashSet<Long> result = new HashSet<>();
for (String classId : classIdArr) {
List<ClassMemberMappingDO> classMemberMappingDOS = classMemberMappingMapper.selectList(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId, classId));
for (ClassMemberMappingDO classMemberMappingDO : classMemberMappingDOS) {
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId());
for (int i = 0; i < vodPlayStateVOS.size(); i++) {
for (int k = i + 1; k < vodPlayStateVOS.size(); k++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(k);
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i);
if (vodPlayStateVO.getStartDate().after(vodPlayStateVO1.getStartDate()) && vodPlayStateVO.getStartDate().before(vodPlayStateVO1.getEndDate())) {
System.out.println("111111111"+vodPlayStateVO);
//这一条数据有问题
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
// List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), vodPlayStateVO.getMemberId(), vodPlayStateVO.getEndDate());
//从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
// for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
// VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l);
// VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1);
// LocalDateTime dateTmp = vph1.getCreateDate().minusSeconds(-vph2.getPlayLength() - getRandom1_2());
// vph2.setCreateDate(dateTmp);
// this.baseMapper.updateById(vph2);
result.add(vodPlayStateVO.getId());
// }
List<VodPlayStateVO> vodPlayStateVOS = vodDictMapper.testPlays(classMemberMappingDO.getMemberId(), Long.valueOf(classId));
for (int i = 0; i < vodPlayStateVOS.size() - 1; i++) {
VodPlayStateVO vodPlayStateVO = vodPlayStateVOS.get(i + 1); //后面
VodPlayStateVO vodPlayStateVO1 = vodPlayStateVOS.get(i); //前面
if (vodPlayStateVO1.getEndDate().getTime() - 3000 > vodPlayStateVO.getStartDate().getTime() && vodPlayStateVO.getPlayLength() >= 3) {
//这一条数据有问题
System.out.println("111111111111111111111" + vodPlayStateVO);
//查看这个人 这个课程 当天的全部数据 按照createDate升序排序
List<VodPlayHistoryDO> vodPlayHistoryDOS = this.baseMapper.getVodPlayDay(Long.valueOf(classId), classMemberMappingDO.getMemberId(), vodPlayStateVO.getStartDate());
// //从第一条开始看,顺延减去第二条的playlength得到第二条的create_date 以此类推
for (int l = 0; l < vodPlayHistoryDOS.size() - 1; l++) {
VodPlayHistoryDO vph1 = vodPlayHistoryDOS.get(l); //第一条
if (l==0){
vph1.setPlayDate(vph1.getCreateDate());
}
VodPlayHistoryDO vph2 = vodPlayHistoryDOS.get(l + 1); //第二条
LocalDateTime dateTmp = vph1.getPlayDate().plusSeconds(vph2.getPlayLength()+getRandom1_2());
vph2.setPlayDate(dateTmp);
this.baseMapper.updateById(vph2);
}
result.add(vodPlayStateVO.getId());
// break;
}
}
}
return result;
}
return result;
}
//19为基数的话,3次签到6.5到8,4次签到4.8-6,
// 5次4-6,6次3.2-6,7次及以上2.5-6吧
//int randNumber =rand.nextInt(MAX - MIN + 1) + MIN;
//19为基数的话,3次签到6.5到8,4次签到4.8-6,
// 5次4-6,6次3.2-6,7次及以上2.5-6吧
//int randNumber =rand.nextInt(MAX - MIN + 1) + MIN;
/**
* 3次签到 23400---28800
*/
public Integer _3times () {
return new Random().nextInt(28800 - 23400 + 1) + 23400;
}
/**
* 3次签到 23400---28800
*/
public Integer _3times() {
return new Random().nextInt(28800 - 23400 + 1) + 23400;
}
/**
* 4次签到 23400---28800
*/
public Integer _4times () {
return new Random().nextInt(6 * 60 * 60 - 48 * 6 * 60 + 1) + 48 * 6 * 60;
}
/**
* 4次签到 23400---28800
*/
public Integer _4times() {
return new Random().nextInt(6 * 60 * 60 - 48 * 6 * 60 + 1) + 48 * 6 * 60;
}
/**
* 5次签到 23400---28800
*/
public Integer _5times () {
return new Random().nextInt(6 * 60 * 60 - 4 * 60 * 60 + 1) + 4 * 60 * 60;
}
/**
* 5次签到 23400---28800
*/
public Integer _5times() {
return new Random().nextInt(6 * 60 * 60 - 4 * 60 * 60 + 1) + 4 * 60 * 60;
}
/**
* 6次签到 23400---28800
*/
public Integer _6times () {
return new Random().nextInt(6 * 60 * 60 - 32 * 6 * 60 + 1) + 32 * 60 * 6;
}
/**
* 6次签到 23400---28800
*/
public Integer _6times() {
return new Random().nextInt(6 * 60 * 60 - 32 * 6 * 60 + 1) + 32 * 60 * 6;
}
/**
* 7次签到 23400---28800
*/
public Integer _7times() {
return new Random().nextInt(6 * 60 * 60 - 25 * 6 * 60 + 1) + 25 * 6 * 60;
}
/**
* 7次签到 23400---28800
*/
public Integer _7times () {
return new Random().nextInt(6 * 60 * 60 - 25 * 6 * 60 + 1) + 25 * 6 * 60;
public static void main(String[] args) {
while (true) {
System.out.println(getRandom1_2());
}
public static void main (String[]args){
while (true) {
System.out.println(getRandom());
}
// System.out.println(LocalDateTime.now());
// System.out.println(LocalDateTime.now().minusMinutes(3));
// int m = 0;
//
// int signInrecord = 4;
......@@ -777,22 +779,21 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
// System.out.println(integer+"=====");
// }
//while (true) {
// int i = getRandom();
// System.out.println(i + "============");
// if (i > 11 || i < 5) {
// System.out.println("error");
// }
//}
}
public static Integer getRandom () {
return (int) (Math.random() * 3 / 2 + 5);
}
public static Integer getRandom1_2 () {
return (int) (Math.random() * 3 / 2 + 1);
}
//while (true) {
// int i = getRandom();
// System.out.println(i + "============");
// if (i > 11 || i < 5) {
// System.out.println("error");
// }
//}
}
public static Integer getRandom() {
return (int) (Math.random() * 3 / 2 + 5);
}
public static Integer getRandom1_2() {
return (int) (Math.random() * 3 / 2 + 1);
}
}
......@@ -8,7 +8,7 @@ public class ExcelFormatUtils {
public static final List<String> memberList = Arrays.asList("序号", "成员名称","身份证号码", "性别", "账号", "联系方式", "签到次数", "课程进度", "学习时长(小时)","学习时长(分钟)", "答疑数", "测试成绩", "总评价");
public static final List<String> signList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "学习时长(小时)","学习时长(分钟)", "课程进度", "完成率", "签到次数", "签到日期");
public static final List<String> signList = Arrays.asList("序号", "成员名称", "身份证号", "联系方式", "签到次数", "签到时间","最近签到ip地址","最近签到设备型号");
public static final List<String> scoreList = Arrays.asList("序号", "成员名称", "身份证号码", "联系方式", "测试成绩", "测试次数", "总评价");
......
......@@ -6,6 +6,9 @@ import java.net.UnknownHostException;
public class IpAddressUtil {
/**
* 返回客户端ip
*/
public static String getIpAddress(HttpServletRequest request) {
String ipAddress = request.getHeader("x-forwarded-for");
if (ipAddress == null || ipAddress.length() == 0 || "unknown".equalsIgnoreCase(ipAddress)) {
......
......@@ -313,51 +313,78 @@ public class ExcelUtil {
return dataList;
}
public static <T> void writeExcel(List<Long> memberIds, HashMap<Long, HashMap<String, Integer>> hashMap, List<String> dates) {
/**
* 导出excel文件
* @param list
* @param cls
* @param <T>
*/
public static <T> void writeExcel(List<T> list, Class cls) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
Field[] fields = cls.getDeclaredFields();
List<Field> fieldList = Arrays.stream(fields).filter(field -> {
ExcelColumn annotation = field.getAnnotation(ExcelColumn.class);
if(annotation != null) {
field.setAccessible(true);
return true;
}
return false;
}).sorted(Comparator.comparing(field -> {
int col = 0;
ExcelColumn annotation = field.getAnnotation(ExcelColumn.class);
if(annotation != null) {
col = annotation.col();
}
return col;
})).collect(Collectors.toList());
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet();
AtomicInteger ai = new AtomicInteger();
Row row = sheet.createRow(ai.getAndIncrement());
AtomicInteger at = new AtomicInteger();
dates.forEach(field -> {
Cell cell = row.createCell(at.getAndIncrement());
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
cellStyle.setFont(font);
cell.setCellStyle(cellStyle);
cell.setCellValue(field);
});
if (hashMap != null) {
memberIds.forEach(data -> {
Row r = sheet.createRow(ai.getAndIncrement());
AtomicInteger a = new AtomicInteger();
Cell cell = r.createCell(at.getAndIncrement());
{
Row row = sheet.createRow(ai.getAndIncrement());
AtomicInteger at = new AtomicInteger();
fieldList.forEach(field -> {
ExcelColumn annotation = field.getAnnotation(ExcelColumn.class);
String columnName = "";
if (annotation != null) {
columnName = annotation.value();
}
Cell cell = row.createCell(at.getAndIncrement());
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
cellStyle.setFont(font);
cell.setCellStyle(cellStyle);
HashMap<String, Integer> hashMap1 = hashMap.get(data);
dates.forEach(field -> {
System.out.println(data + "========");
System.out.println(field);
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap1) {
cell1.setCellValue(null == hashMap1.get(field) ? 0 : hashMap1.get(field));
} else {
cell1.setCellValue(0);
}
});
cell.setCellValue(columnName);
});
}
String fileName = String.valueOf(new Date().getTime());
buildExcelDocument(fileName + "." + EXCEL2007, wb, response);
if (list != null) {
list.forEach(data -> {
Row r = sheet.createRow(ai.getAndIncrement());
AtomicInteger a = new AtomicInteger();
fieldList.forEach(field -> {
try {
Class<?> type = field.getType();
Object value = field.get(data);
Cell cell = r.createCell(a.getAndIncrement());
if (value != null) {
cell.setCellValue(value.toString());
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
});
});
for (int i = 0; i < list.size(); i++) {
sheet.autoSizeColumn(i);
}
}
String fileName = String.valueOf(new Date().getTime());
buildExcelDocument(fileName + "." + EXCEL2007, wb, response);
}
}
public static <T> void writeMemberExcel(String companyName, String studyDate, String courseName, String title, List<ClassDetailVO> list, List<String> headerList) throws Exception {
......@@ -697,7 +724,7 @@ public class ExcelUtil {
sheet.addMergedRegion(cellRangeAddress21);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress21, sheet, workbook); //给合并过的单元格加边框
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 4, 9);
CellRangeAddress cellRangeAddress22 = new CellRangeAddress(1, 1, 4, 7);
sheet.addMergedRegion(cellRangeAddress22);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress22, sheet, workbook); //给合并过的单元格加边框
......@@ -713,7 +740,7 @@ public class ExcelUtil {
sheet.addMergedRegion(cellRangeAddress31);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress31, sheet, workbook); //给合并过的单元格加边框
CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 4, 9);
CellRangeAddress cellRangeAddress32 = new CellRangeAddress(2, 2, 4, 7);
sheet.addMergedRegion(cellRangeAddress32);
setBorderStyle(HSSFCellStyle.BORDER_THIN, cellRangeAddress32, sheet, workbook); //给合并过的单元格加边框
thirdRow.createCell(0).setCellValue(thirdHead[0]);
......@@ -765,28 +792,19 @@ public class ExcelUtil {
newCell = dataRow.createCell(4);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getTrainingLengthStr());
newCell.setCellValue(classSignVO.getSignCounts());
newCell = dataRow.createCell(5);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getTrainingLengthMinute());
newCell.setCellValue(classSignVO.getSignInDateList());
newCell = dataRow.createCell(6);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getClassProcess());
newCell.setCellValue(classSignVO.getIpAddress());
newCell = dataRow.createCell(7);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getPercent());
newCell = dataRow.createCell(8);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getSignCounts());
newCell = dataRow.createCell(9);
newCell.setCellStyle(cellStyle);
newCell.setCellValue(classSignVO.getSignInDateList());
newCell.setCellValue(classSignVO.getDeviceNo());
rowIndex++;
seq++;
......
......@@ -4,4 +4,19 @@ import lombok.Data;
@Data
public class ImageCheckDetailVO {
private Long id;
private String userName;
private String accountName;
private String telephone;
private String idCard;
private String cnt;
private String recentDate;
}
package com.subsidy.vo.administer;
import com.subsidy.util.excel.ExcelColumn;
import lombok.Data;
@Data
......@@ -7,14 +8,28 @@ public class ManageMemberVO {
private Long id;
@ExcelColumn(col = 1,value = "用户名称")
private String userName;
@ExcelColumn(col = 2,value = "手机号")
private String telephone;
@ExcelColumn(col = 3,value = "身份证号")
private String idCard;
@ExcelColumn(col = 4,value = "所属企业")
private String companyName;
private String accountName;
private String checkImage;
private String checkTime;
private Integer firstLogin;
private String smsCheck;
private String imageCheckStatus;
}
package com.subsidy.vo.catagory;
import com.subsidy.model.CategoryDO;
import lombok.Data;
import java.util.List;
@Data
public class GetCategoriesVO extends CategoryDO {
private List<CategoryDO> categoryDOS;
}
package com.subsidy.vo.image;
import com.subsidy.model.ImageCheckRecordDO;
import lombok.Data;
@Data
public class CheckImageResultVO extends ImageCheckRecordDO {
private Boolean result;
}
package com.subsidy.vo.image;
import lombok.Data;
@Data
public class GetMemberCheckDetailVO {
private Long id;
private String occurredTime;
private String photo;
private Double similarity;
private String result;
}
......@@ -27,25 +27,14 @@ public class ClassSignVO {
private String signInDateList;
/**
* 培训时长
* ip地址
*/
private Integer trainingLength;
@ExcelColumn(col = 4,value = "培训时长(小时)")
private String trainingLengthStr;
@ExcelColumn(col = 5,value = "培训时长(分钟)")
private String trainingLengthMinute;
@ExcelColumn(col = 6,value = "课程进度")
private String classProcess;
private String ipAddress;
/**
* 完成率
* 最近设型号
*/
@ExcelColumn(col = 7,value = "完成率")
private String percent;
private String deviceNo;
......
......@@ -4,4 +4,14 @@ import lombok.Data;
@Data
public class GetMemberSignInfoVO {
private Long id;
private String ipAddress;
private String deviceNo;
private String signInDate;
}
......@@ -11,7 +11,7 @@ public class CheckResultVO {
private String bizSeqNo;
private ResultVO resultVO;
private ResultVO result;
private String transactionTime;
......
......@@ -17,4 +17,14 @@ public class SendResultVO {
private Boolean success;
private String wbAppId;
private String nonce;
private Long userId;
private String sign;
private String faceId;
}
......@@ -18,6 +18,7 @@ meishu.code-message[10022]=密码输入错误,您还可以输入2次密码
meishu.code-message[10023]=密码输入错误,您还可以输入3次密码
meishu.code-message[10024]=密码输入错误,您还可以输入4次密码
meishu.code-message[10025]=身份证识别错误
meishu.code-message[10026]=姓名或身份证号格式不正确
meishu.code-message[20001]=该课程已存在
......@@ -65,7 +66,9 @@ meishu.code-message[16001]=该条件已存在
meishu.code-message[17001]=系统不支持00:00:00~06:00:00学习
meishu.code-message[18000]=视频不存在
meishu.code-message[18001]=删除失败,目录下没有该视频
meishu.code-message[18001]=已超过当日验证次数上线
......@@ -30,4 +30,23 @@
AND t2.delete_date IS NULL
and t.course_id = #{courseId}
</select>
<select id="getCategories" resultType="com.subsidy.vo.catagory.GetCategoriesVO">
SELECT
*
FROM
category t
WHERE
t.delete_date IS NULL
AND t.parent_id IS NULL
<if test="name !=null and name != ''">
AND t.`name` like concat('%',#{name} ,'%')
</if>
<if test="companyId != null and companyId != ''">
and t.company_id = #{companyId}
</if>
<if test="companyId == null">
and t.company_id is null
</if>
</select>
</mapper>
......@@ -9,8 +9,6 @@
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="class_id" property="classId" />
<result column="paper_id" property="paperId" />
<result column="request_id" property="requestId" />
</resultMap>
<!-- 通用查询结果列 -->
......@@ -21,4 +19,18 @@
id, class_id, paper_id, request_id
</sql>
<select id="getMemberCheckDetail" resultType="com.subsidy.vo.image.GetMemberCheckDetailVO">
SELECT
t.id,
t.occurred_time,
t.photo,
t.similarity
FROM
image_check_record t
WHERE
t.delete_date IS NULL
AND t.class_id = #{classId}
AND t.member_id = #{memberId}
</select>
</mapper>
......@@ -270,7 +270,10 @@
t.telephone,
t.id_card,
t.account_name,
t2.company_name
t2.company_name,
t.check_image,
t.check_time,
t.first_login
FROM
member t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
......@@ -325,6 +328,6 @@
</select>
<update id="removeCheckImage" parameterType="long">
update member set check_image = nulll where id = #{id}
update member set check_image = null,check_time = null where id = #{id}
</update>
</mapper>
......@@ -105,7 +105,10 @@
create_date
FROM
vod_play_history t
where t.member_id = #{memberId}
where
t.delete_date is null
and t.member_id = #{memberId}
and t.class_id =#{classId}
ORDER BY
t.member_id,
start_date
......
# 此处为本项目src所在路径(代码生成器输出路径)
outputDir=/src/main/java
author=DengMin
author=Tuyp
# 父的包名
setParent=com.subsidy
# mapper.xml文件生成路径
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!