Commit 8c7865bf by 涂亚平

备个份

1 parent d01760d2
Showing with 758 additions and 104 deletions
package com.subsidy.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "activity")
public class ActivityDetectionConfig {
private Long captchaAppId;
private String appSecretKey;
private Long businessId;
}
......@@ -111,8 +111,6 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
}
throw new HttpException(1010);
}
return true;
}
......
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.detection.VerifyDTO;
import com.subsidy.model.ActivityDetectionDO;
import com.subsidy.service.ActivityDetectionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import javax.servlet.http.HttpServletRequest;
/**
* <p>
* 活跃度检测表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-07-13
*/
@RestController
@Api(tags = "活跃度检测表")
@RequestMapping("/activityDetection")
public class ActivityDetectionController {
@Autowired
private ActivityDetectionService activityDetectionService;
@PostMapping("verify")
@ApiOperation("验证滑块 ticket randStr memberId classId")
public ResponseVO verify(@RequestBody VerifyDTO verifyDTO, HttpServletRequest request){
return ResponseData.generateCreatedResponse(0,activityDetectionService.verify(verifyDTO,request));
}
}
......@@ -42,11 +42,11 @@ public class AdministerController {
@Autowired
private AdministerService administerService;
@GetMapping("getIp")
public String getIp()throws Exception{
InetAddress addr = InetAddress.getLocalHost();
return addr.getHostAddress();
}
// @GetMapping("getIp")
// public String getIp()throws Exception{
// InetAddress addr = InetAddress.getLocalHost();
// return addr.getHostAddress();
// }
@PostMapping("/login")
@ApiOperation("登录接口 accountName password")
......@@ -212,6 +212,20 @@ public class AdministerController {
return ResponseData.generateCreatedResponse(0,administerService.memberStudy(memberStudyLogDTO));
}
@PostMapping("memberDetectionRecord")
@ApiOperation("获取某个班级活跃度检测记录 id userName pageSize pageNum ")
@LoginRequired
public ResponseVO memberDetectionRecord(@RequestBody ClassDetailDTO classDetailDTO ){
return ResponseData.generateCreatedResponse(0,administerService.memberDetectionRecord(classDetailDTO));
}
@PostMapping("exportMemberDetectionRecord")
@ApiOperation("获取某个班级活跃度检测记录 id userName ")
@LoginRequired
public void exportMemberDetectionRecord(@RequestBody ClassDetailDTO classDetailDTO ){
administerService.exportMemberDetectionRecord(classDetailDTO);
}
@PostMapping("exportZip")
@ApiOperation("下载压缩包 id 班级id")
@CrossOrigin
......
......@@ -6,7 +6,9 @@ import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
import com.subsidy.dto.company.GetCompanyMembersDTO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.CompanyDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.Api;
......@@ -63,8 +65,16 @@ public class CompanyDictController {
@PostMapping("getAllCompany")
@ApiOperation("获取全部企业 {companyName}")
@LoginRequired
public ResponseVO getAllCompany(@RequestBody CompanyDictDO companyDictDO){
return ResponseData.generateCreatedResponse(0,companyDictService.getAllCompany(companyDictDO));
}
@PostMapping("getCompanyMembers")
@ApiOperation("获取公司里的成员 pageNum pageSize companyId 公司id userName 成员名称")
@LoginRequired
public ResponseVO getCompanyMembers(@RequestBody GetCompanyMembersDTO getCompanyMembersDTO){
return ResponseData.generateCreatedResponse(0,companyDictService.getCompanyMembers(getCompanyMembersDTO));
}
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 实名验证记录表 前端控制器
* </p>
*
* @author DengMin
* @since 2022-07-14
*/
@RestController
@Api(tags = "实名验证记录表")
@RequestMapping("/image-check-record-do")
public class ImageCheckRecordController {
}
......@@ -87,6 +87,13 @@ public class MemberController {
return ResponseData.generateCreatedResponse(0,memberService.kunchiLogin(qingxuetangLoginDTO));
}
@PostMapping("checkStatus")
@ApiOperation("实名制验证状态 memberId")
@TimeRequired
public ResponseVO checkStatus(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.checkStatus(memberDO));
}
@PostMapping("updatePassword")
@ApiOperation("修改密码 {id password}")
@LoginRequired
......@@ -95,10 +102,17 @@ public class MemberController {
return ResponseData.generateCreatedResponse(0,memberService.updatePassword(memberDO));
}
@PostMapping("studyPage")
@ApiOperation("[废弃]手机端:学习主页 id 学员id")
public ResponseVO studyPage(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.studyPage(memberDO));
@PostMapping("updateCheckImage")
@ApiOperation("上传采集照片 id checkImage")
@TimeRequired
public ResponseVO updateCheckImage(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.updateCheckImage(memberDO));
}
@PostMapping("removeCheckImage")
@ApiOperation("清除采集照片 id ")
public ResponseVO removeCheckImage(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.removeCheckImage(memberDO));
}
@PostMapping("myCourses")
......
package com.subsidy.dto.company;
import lombok.Data;
@Data
public class GetCompanyMembersDTO {
private Integer pageSize;
private Integer pageNum;
private Long companyId;
private String userName;
}
package com.subsidy.dto.detection;
import lombok.Data;
@Data
public class VerifyDTO {
private String ticket;
private String userIp;
private String randStr;
private Long memberId;
private Long classId;
}
package com.subsidy.mapper;
import com.subsidy.model.ActivityDetectionDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 活跃度检测表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-07-13
*/
@Repository
public interface ActivityDetectionMapper extends BaseMapper<ActivityDetectionDO> {
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.AdministerDO;
import com.subsidy.vo.administer.ExerciseTestVO;
import com.subsidy.vo.administer.MemberDetectionRecordVO;
import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.member.ClassSignVO;
......@@ -45,5 +46,10 @@ public interface AdministerMapper extends BaseMapper<AdministerDO> {
*/
IPage<AnswerRecordVO> answerRecord(IPage iPage, Long classId, String userName);
/**
* 活跃度检测
*/
IPage<MemberDetectionRecordVO> classActivityDetection(IPage iPage, Long classId, String userName);
}
......@@ -3,8 +3,10 @@ package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO;
import com.subsidy.vo.company.GetCompanyMembersVO;
import org.springframework.stereotype.Repository;
import java.util.List;
......@@ -22,13 +24,20 @@ public interface CompanyDictMapper extends BaseMapper<CompanyDictDO> {
/**
* 企业管理--查找所有主账号 、运营者
*
* @return
*/
IPage<OperatorsVO> operators(IPage page, String companyName,Long fieldId,Long id,Integer role,String superviseName);
IPage<OperatorsVO> operators(IPage page, String companyName, Long fieldId, Long id, Integer role, String superviseName);
/**
* 查找所有的公司名称
*/
List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO);
/**
* 查看某个公司的学生
*/
IPage<GetCompanyMembersVO> getCompanyMembers(IPage page, Long companyId, String userName);
}
package com.subsidy.mapper;
import com.subsidy.model.ImageCheckRecordDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 实名验证记录表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2022-07-14
*/
@Repository
public interface ImageCheckRecordMapper extends BaseMapper<ImageCheckRecordDO> {
}
......@@ -70,4 +70,11 @@ public interface MemberMapper extends BaseMapper<MemberDO> {
List<MemberDO> getMemberListBySignInRecord(Long classId);
List<MemberDO> getUnfinishedMemberList(Long classId);
/**
* 清除采集照片
*/
void removeCheckImage(Long id);
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 活跃度检测表
* </p>
*
* @author DengMin
* @since 2022-07-13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("activity_detection")
public class ActivityDetectionDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 班级id
*/
private Long classId;
/**
* 人员id
*/
private Long memberId;
/**
* 成功/失败
*/
private Integer status;
/**
* RequestId
*/
private String requestId;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 实名验证记录表
* </p>
*
* @author DengMin
* @since 2022-07-14
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("image_check_record")
public class ImageCheckRecordDO extends BaseModel {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 班级id
*/
private Long classId;
/**
* 试卷id
*/
private Long paperId;
private String requestId;
}
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
import java.util.Date;
/**
......@@ -85,6 +86,16 @@ public class MemberDO extends BaseModel {
private String image;
/**
* 人脸核验--照片
*/
private String checkImage;
/**
* 采集时间
*/
private LocalDateTime checkTime;
/**
* 身份证号
*/
private String idCard;
......
package com.subsidy.service;
import com.subsidy.dto.detection.VerifyDTO;
import com.subsidy.model.ActivityDetectionDO;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.servlet.http.HttpServletRequest;
/**
* <p>
* 活跃度检测表 服务类
* </p>
*
* @author DengMin
* @since 2022-07-13
*/
public interface ActivityDetectionService extends IService<ActivityDetectionDO> {
String verify(VerifyDTO verifyDTO, HttpServletRequest request);
}
......@@ -68,6 +68,10 @@ public interface AdministerService extends IService<AdministerDO> {
void exportClassVodDailyInfo(ClassVodDailyInfoDTO classVodDailyInfoDTO);
IPage memberDetectionRecord(ClassDetailDTO classDetailDTO);
void exportMemberDetectionRecord(ClassDetailDTO classDetailDTO);
void export(ClassDetailDTO classDetailDTO)throws Exception;
IPage memberStudy(MemberStudyLogDTO memberStudyLogDTO);
......
......@@ -4,9 +4,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
import com.subsidy.dto.company.GetCompanyMembersDTO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.MemberDO;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO;
import com.subsidy.vo.company.GetCompanyMembersVO;
import java.util.List;
......@@ -30,4 +33,6 @@ public interface CompanyDictService extends IService<CompanyDictDO> {
List<GetAllCompanyVO> getAllCompany(CompanyDictDO companyDictDO);
IPage<GetCompanyMembersVO> getCompanyMembers(GetCompanyMembersDTO getCompanyMembersDTO);
}
package com.subsidy.service;
import com.subsidy.model.ImageCheckRecordDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 实名验证记录表 服务类
* </p>
*
* @author DengMin
* @since 2022-07-14
*/
public interface ImageCheckRecordService extends IService<ImageCheckRecordDO> {
}
......@@ -39,9 +39,13 @@ public interface MemberService extends IService<MemberDO> {
UserRoleVO kunchiLogin(QingxuetangLoginDTO qingxuetangLoginDTO);
CheckStatusVO checkStatus(MemberDO memberDO);
String updatePassword(MemberDO memberDO);
MemberStudyPageVO studyPage(MemberDO memberDO);
String updateCheckImage(MemberDO memberDO);
String removeCheckImage(MemberDO memberDO);
List<MyCoursesVO> myCourses(MyCoursesDTO myCoursesDTO);
......
package com.subsidy.service.impl;
import com.subsidy.common.configure.ActivityDetectionConfig;
import com.subsidy.common.configure.VODConfig;
import com.subsidy.common.configure.WechatConfig;
import com.subsidy.dto.detection.VerifyDTO;
import com.subsidy.model.ActivityDetectionDO;
import com.subsidy.mapper.ActivityDetectionMapper;
import com.subsidy.service.ActivityDetectionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.tencentcloudapi.captcha.v20190722.CaptchaClient;
import com.tencentcloudapi.captcha.v20190722.models.DescribeCaptchaResultRequest;
import com.tencentcloudapi.captcha.v20190722.models.DescribeCaptchaResultResponse;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
/**
* <p>
* 活跃度检测表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-07-13
*/
@Service
public class ActivityDetectionServiceImpl extends ServiceImpl<ActivityDetectionMapper, ActivityDetectionDO> implements ActivityDetectionService {
@Autowired
private ActivityDetectionConfig activityDetectionConfig;
@Autowired
private VODConfig vodConfig;
public String verify(VerifyDTO verifyDTO, HttpServletRequest request){
try{
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
Credential cred = new Credential(vodConfig.getSecretId(),vodConfig.getSecretKey());
// 实例化一个http选项,可选的,没有特殊需求可以跳过
HttpProfile httpProfile = new HttpProfile();
httpProfile.setEndpoint("captcha.tencentcloudapi.com");
// 实例化一个client选项,可选的,没有特殊需求可以跳过
ClientProfile clientProfile = new ClientProfile();
clientProfile.setHttpProfile(httpProfile);
// 实例化要请求产品的client对象,clientProfile是可选的
CaptchaClient client = new CaptchaClient(cred, "", clientProfile);
// 实例化一个请求对象,每个接口都会对应一个request对象
DescribeCaptchaResultRequest req = new DescribeCaptchaResultRequest();
req.setCaptchaType(9L);
req.setTicket(verifyDTO.getTicket());
// String ip = request.getHeader("x-forwarded-for");
String ip = request.getHeader( " x-forwarded-for " );
if (ip == null || ip.length() == 0 || " unknown " .equalsIgnoreCase(ip)) {
ip = request.getHeader( " Proxy-Client-IP " );
}
if (ip == null || ip.length() == 0 || " unknown " .equalsIgnoreCase(ip)) {
ip = request.getHeader( " WL-Proxy-Client-IP " );
}
if (ip == null || ip.length() == 0 || " unknown " .equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
req.setUserIp(ip);
req.setRandstr(verifyDTO.getRandStr());
req.setCaptchaAppId(activityDetectionConfig.getCaptchaAppId());
req.setAppSecretKey(activityDetectionConfig.getAppSecretKey());
req.setBusinessId(activityDetectionConfig.getBusinessId());
// 返回的resp是一个DescribeCaptchaResultResponse的实例,与请求对象对应
DescribeCaptchaResultResponse resp = client.DescribeCaptchaResult(req);
// 输出json格式的字符串回包
System.out.println(DescribeCaptchaResultResponse.toJsonString(resp));
ActivityDetectionDO activityDetectionDO = new ActivityDetectionDO();
activityDetectionDO.setClassId(verifyDTO.getClassId());
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;
}
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
return null;
}
}
......@@ -54,19 +54,7 @@ import com.subsidy.util.JwtUtil;
import com.subsidy.util.Localstorage;
import com.subsidy.util.MathUtil;
import com.subsidy.util.excel.ExcelUtil;
import com.subsidy.vo.administer.AdministerPermissionVO;
import com.subsidy.vo.administer.ClassDailyInfoVO;
import com.subsidy.vo.administer.ClassSummaryVO;
import com.subsidy.vo.administer.ClassVodDailyInfoItemVO;
import com.subsidy.vo.administer.ClassVodInfoVO;
import com.subsidy.vo.administer.ExerciseTestVO;
import com.subsidy.vo.administer.GetMemberPapersVO;
import com.subsidy.vo.administer.GetPaperDetailVO;
import com.subsidy.vo.administer.LoginVO;
import com.subsidy.vo.administer.ManageMemberVO;
import com.subsidy.vo.administer.MemberStudyLogVO;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO;
import com.subsidy.vo.administer.*;
import com.subsidy.vo.classdict.ClassDetailVO;
import com.subsidy.vo.done.GetMaxScoreVO;
import com.subsidy.vo.done.TestScoreInfoVO;
......@@ -325,7 +313,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//查询角色
RoleAdministerMappingDO roleAdministerMappingDO = roleAdministerMappingMapper.selectOne(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,administerDO.getId()));
.eq(RoleAdministerMappingDO::getAdministerId, administerDO.getId()));
administerPermissionVO.setRole(roleAdministerMappingDO.getRoleId());
return administerPermissionVO;
}
......@@ -333,7 +321,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO) {
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), null, 1,null);
IPage<OperatorsVO> operatorsVOIPage = companyDictMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), null, 1, null);
List<OperatorsVO> operatorsVOS = operatorsVOIPage.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
......@@ -432,7 +420,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
//视频
int i = 0;
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength( classDetailDTO.getId(),classMemberMappingDO.getMemberId(), vodDictDO.getId());
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classMemberMappingDO.getMemberId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
......@@ -483,7 +471,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(),classDetailVO.getId(), vodDictDO.getId());
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classDetailVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
......@@ -554,7 +542,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(),classDetailVO.getId(), vodDictDO.getId());
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classDetailVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
......@@ -593,7 +581,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classDetailVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//培训时长 分钟
classDetailVO.setTrainingLengthMinute(Math.floorDiv(playLength,60)+"");
classDetailVO.setTrainingLengthMinute(Math.floorDiv(playLength, 60) + "");
//答疑
Integer count = answeringQuestionMapper.selectCount(new QueryWrapper<AnsweringQuestionDO>()
......@@ -638,7 +626,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(),classSignVO.getId(), vodDictDO.getId());
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classSignVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
......@@ -697,7 +685,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int playLength = 0;
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(),classSignVO.getId(), vodDictDO.getId());
int totalPlayLength = vodPlayHistoryMapper.memberVodTotalLength(classDetailDTO.getId(), classSignVO.getId(), vodDictDO.getId());
if (totalPlayLength >= vodDictDO.getVodLength()) {
i++;
}
......@@ -713,7 +701,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
classSignVO.setTrainingLengthStr(MathUtil.secToTime(playLength));
//培训时长 分钟
classSignVO.setTrainingLengthMinute(Math.floorDiv(playLength,60)+"");
classSignVO.setTrainingLengthMinute(Math.floorDiv(playLength, 60) + "");
//签到
//Set<String> set = redisUtil.scan(RedisPrefixConstant.SUBSIDY_SIGN_INFO_PREFIX + classSignVO.getId() + ":classId:" + classDetailDTO.getId() + "*");
......@@ -1035,6 +1023,18 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
public IPage<MemberDetectionRecordVO> memberDetectionRecord(ClassDetailDTO classDetailDTO) {
Page pager = new Page(classDetailDTO.getPageNum(), classDetailDTO.getPageSize());
return this.baseMapper.classActivityDetection(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
}
public void exportMemberDetectionRecord(ClassDetailDTO classDetailDTO) {
Page pager = new Page(1, -1L);
IPage iPage = baseMapper.classActivityDetection(pager, classDetailDTO.getId(), classDetailDTO.getUserName());
List<MemberDetectionRecordVO> memberDetectionRecordVOS = iPage.getRecords();
//TODO
}
public <T> void writeVodExcel(List<ClassDailyInfoVO> classDailyInfoVOS, HashMap<String, Integer> hashMap, List<String> title, HashMap<String, Integer> vodHashmap) {
......@@ -1081,7 +1081,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
int studyLength = 0;
for (String tt : title) {
if (!"姓名".equals(tt) && !"完成率".equals(tt) && !"学习时长(小时)".equals(tt) && !"序号".equals(tt)&&!"学习时长".equals(tt)) {
if (!"姓名".equals(tt) && !"完成率".equals(tt) && !"学习时长(小时)".equals(tt) && !"序号".equals(tt) && !"学习时长".equals(tt)) {
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap) {
......@@ -1099,7 +1099,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
}
}
studyLengthCell.setCellValue(MathUtil.secToTime(studyLength));
studyLengthCellm.setCellValue(Math.floorDiv(studyLength,60));
studyLengthCellm.setCellValue(Math.floorDiv(studyLength, 60));
totalCell.setCellValue(MathUtil.intDivFloorPercent(total, vodHashmap.keySet().size()) + "%");
}
}
......@@ -1156,7 +1156,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
namecell.setCellValue(memberMapper.selectById(lg).getUserName());
int total = 0;
for (String date : dates) {
if (!date.equals("姓名") && !"合计时长(小时)".equals(date) && !"序号".equals(date)&&!"合计时长(分钟)".equals(date)) {
if (!date.equals("姓名") && !"合计时长(小时)".equals(date) && !"序号".equals(date) && !"合计时长(分钟)".equals(date)) {
Cell cell1 = r.createCell(a.getAndIncrement());
if (null != hashMap1) {
total += null == hashMap1.get(date) ? 0 : hashMap1.get(date);
......@@ -1169,7 +1169,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
Cell totalCell = r.createCell(a.getAndIncrement());
totalCell.setCellValue(MathUtil.secToTime(total));
Cell totalCell1 = r.createCell(a.getAndIncrement());
totalCell1.setCellValue(Math.floorDiv(total,60));
totalCell1.setCellValue(Math.floorDiv(total, 60));
}
}
......@@ -1260,7 +1260,7 @@ public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, Adminis
.lambda()
.eq(PaperDictDO::getCourseId, classDictDO1.getCourseId()));
for (int i = 0 ; i < paperDictDOS.size() ; i ++){
for (int i = 0; i < paperDictDOS.size(); i++) {
ByteArrayOutputStream baos2 = new ByteArrayOutputStream();
classDetailDTO.setFlag(false);
classDetailDTO.setPaperId(paperDictDOS.get(i).getId());
......
......@@ -8,6 +8,7 @@ import com.subsidy.common.RedisPrefixConstant;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.dto.company.AddCompanyDTO;
import com.subsidy.dto.company.GetCompanyMembersDTO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.mapper.ClassHourDictMapper;
import com.subsidy.mapper.ClassTypeDictMapper;
......@@ -19,22 +20,13 @@ import com.subsidy.mapper.JobDictMapper;
import com.subsidy.mapper.RankDictMapper;
import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.mapper.RotationImgDictMapper;
import com.subsidy.model.AdministerDO;
import com.subsidy.model.ClassHourDictDO;
import com.subsidy.model.ClassTypeDictDO;
import com.subsidy.model.CompanyDictDO;
import com.subsidy.model.CompanyFieldMappingDO;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.model.FieldDictDO;
import com.subsidy.model.JobDictDO;
import com.subsidy.model.RankDictDO;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.model.RotationImgDictDO;
import com.subsidy.model.*;
import com.subsidy.service.CompanyDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.company.GetAllCompanyVO;
import com.subsidy.vo.company.GetCompanyMembersVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
......@@ -64,9 +56,6 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
@Autowired
private DepartmentDictMapper departmentDictMapper;
//@Autowired
//private RedisUtil redisUtil;
@Autowired
private FieldDictMapper fieldDictMapper;
......@@ -96,13 +85,13 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
//判断该用户的角色
Integer count = roleAdministerMappingMapper.selectCount(new QueryWrapper<RoleAdministerMappingDO>()
.lambda()
.eq(RoleAdministerMappingDO::getAdministerId,operatorsDTO.getId())
.eq(RoleAdministerMappingDO::getRoleId,1));
.eq(RoleAdministerMappingDO::getAdministerId, operatorsDTO.getId())
.eq(RoleAdministerMappingDO::getRoleId, 1));
if (count > 0){
if (count > 0) {
administerDO.setCompanyId(null);
}
IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(),administerDO.getCompanyId(),2,operatorsDTO.getSuperviseName());
IPage page = this.baseMapper.operators(pager, operatorsDTO.getCompanyName(), operatorsDTO.getFieldId(), administerDO.getCompanyId(), 2, operatorsDTO.getSuperviseName());
List<OperatorsVO> operatorsVOS = page.getRecords();
for (OperatorsVO operatorsVO : operatorsVOS) {
//查看公司所在行业
......@@ -183,7 +172,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
List<JobDictDO> jobDictDOS = jobDictMapper.selectList(new QueryWrapper<JobDictDO>()
.lambda()
.isNull(JobDictDO::getCompanyId));
for (JobDictDO jobDictDO : jobDictDOS){
for (JobDictDO jobDictDO : jobDictDOS) {
jobDictDO.setCompanyId(companyDictDO.getId());
jobDictMapper.insert(jobDictDO);
}
......@@ -192,7 +181,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
List<RankDictDO> rankDictDOS = rankDictMapper.selectList(new QueryWrapper<RankDictDO>()
.lambda()
.isNull(RankDictDO::getCompanyId));
for (RankDictDO rankDictDO : rankDictDOS){
for (RankDictDO rankDictDO : rankDictDOS) {
rankDictDO.setCompanyId(companyDictDO.getId());
rankDictMapper.insert(rankDictDO);
}
......@@ -201,7 +190,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.isNull(RotationImgDictDO::getCompanyId));
for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS){
for (RotationImgDictDO rotationImgDictDO : rotationImgDictDOS) {
rotationImgDictDO.setCompanyId(companyDictDO.getId());
rotationImgDictMapper.insert(rotationImgDictDO);
}
......@@ -248,7 +237,7 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
//查找企业管理员
AdministerDO administerDO = roleAdministerMappingMapper.getAdminister(addCompanyDTO.getId());
if (null !=administerDO){
if (null != administerDO) {
if (StringUtils.isNotBlank(addCompanyDTO.getAccountName())) {
administerDO.setAccountName(addCompanyDTO.getAccountName());
}
......@@ -264,4 +253,10 @@ public class CompanyDictServiceImpl extends ServiceImpl<CompanyDictMapper, Compa
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());
}
}
package com.subsidy.service.impl;
import com.subsidy.model.ImageCheckRecordDO;
import com.subsidy.mapper.ImageCheckRecordMapper;
import com.subsidy.service.ImageCheckRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 实名验证记录表 服务实现类
* </p>
*
* @author DengMin
* @since 2022-07-14
*/
@Service
public class ImageCheckRecordServiceImpl extends ServiceImpl<ImageCheckRecordMapper, ImageCheckRecordDO> implements ImageCheckRecordService {
}
......@@ -680,49 +680,42 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return userRoleVO;
}
public String updatePassword(MemberDO memberDO) {
this.baseMapper.updateById(memberDO);
//MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
//redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
return ConstantUtils.SET_SUCCESS;
}
public CheckStatusVO checkStatus(MemberDO memberDO) {
public MemberStudyPageVO studyPage(MemberDO memberDO) {
MemberStudyPageVO memberStudyPageVO = new MemberStudyPageVO();
List<StudyPageVO> studyPageVOS = this.baseMapper.studyPage(memberDO);
CheckStatusVO checkStatusVO = new CheckStatusVO();
MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
final ExecutorService newCachedThreadPool = Executors.newCachedThreadPool();
for (StudyPageVO studyPageVO : studyPageVOS) {
//查看课程下有几节课
List<VodDictDO> vodDictDOS = courseContentMapper.getCourseVods(studyPageVO.getId());
studyPageVO.setTotalVods(vodDictDOS.size());
newCachedThreadPool.submit(() -> studyPageTask1(studyPageVO, vodDictDOS, memberDO.getId()));
if (StringUtils.isEmpty(memberDO1.getCheckImage())) {
checkStatusVO.setImageStatus(false);
} else {
checkStatusVO.setImageStatus(true);
}
newCachedThreadPool.shutdown();
memberStudyPageVO.setStudyPageVOS(studyPageVOS);
return memberStudyPageVO;
if (memberDO1.getFirstLogin() == 1) {
checkStatusVO.setSMSStatus(true);
} else {
checkStatusVO.setSMSStatus(false);
}
public Future<StudyPageVO> studyPageTask1(StudyPageVO studyPageVO, List<VodDictDO> vodDictDOS, Long memberId) {
return checkStatusVO;
}
int i = 0;
public String updatePassword(MemberDO memberDO) {
this.baseMapper.updateById(memberDO);
//MemberDO memberDO1 = this.baseMapper.selectById(memberDO.getId());
//redisUtil.set(RedisPrefixConstant.SUBSIDY_COMPANY_MEMBER_PREFIX + memberDO1.getCompanyId() + ":" + memberDO.getAccountName(), memberDO);
return ConstantUtils.SET_SUCCESS;
}
//该成员完成了几个视频
for (VodDictDO vodDictDO : vodDictDOS) {
int completeVodOrNot = vodPlayHistoryMapper.completeVodOrNot(memberId, vodDictDO.getId(), studyPageVO.getClassId());
i += completeVodOrNot;
public String updateCheckImage(MemberDO memberDO) {
memberDO.setCheckTime(LocalDateTime.now());
this.baseMapper.updateById(memberDO);
return ConstantUtils.SET_SUCCESS;
}
studyPageVO.setDoneVods(i);
////该班级课程下有多少人
//Integer count = classMemberMappingMapper.selectCount(new QueryWrapper<ClassMemberMappingDO>()
// .lambda()
// .eq(ClassMemberMappingDO::getClassId, studyPageVO.getClassId()));
//studyPageVO.setTotalMember(count);
return new AsyncResult<>(studyPageVO);
public String removeCheckImage(MemberDO memberDO) {
this.baseMapper.removeCheckImage(memberDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public List<MyCoursesVO> myCourses(MyCoursesDTO myCoursesDTO) {
......
package com.subsidy.vo.administer;
import com.subsidy.util.excel.ExcelColumn;
import lombok.Data;
@Data
public class MemberDetectionRecordVO {
private Long id;
@ExcelColumn(col = 1,value = "成员名称")
private String userName;
@ExcelColumn(col = 2,value = "账号")
private String accountName;
@ExcelColumn(col = 3,value = "身份证号")
private String idCard;
@ExcelColumn(col = 4,value = "身份证号")
private String telephone;
@ExcelColumn(col = 5,value = "检测次数")
private Integer cnt;
}
package com.subsidy.vo.company;
import lombok.Data;
@Data
public class GetCompanyMembersVO {
private Long id;
private String userName;
private String idCard;
private String companyName;
private Integer firstLogin;
private String checkImage;
private String checkTime;
}
package com.subsidy.vo.member;
import lombok.Data;
@Data
public class CheckStatusVO {
private Boolean SMSStatus;
private Boolean imageStatus;
}
# 环境配置
spring.profiles.active=prod
spring.profiles.active=dev
#和CPU数
spring.server.acceptorThreadCount=600
spring.server.minSpareThreads=100
......@@ -69,3 +69,9 @@ wechat:
#pro
appId: wx5e1ecb9c9bd33451
appSecret: 4f5e1abb6fb4f68f5273820b6295ec6b
#活体检测配置
activity.captchaAppId: 2013197365
activity.appSecretKey: 04ABoF0ZVuMje8NP84DE5Sg**
activity.businessId: 1
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.ActivityDetectionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.ActivityDetectionDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="class_id" property="classId" />
<result column="member_id" property="memberId" />
<result column="status" property="status" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, class_id, member_id, status
</sql>
</mapper>
......@@ -120,4 +120,28 @@
</if>
</select>
<select id="classActivityDetection" resultType="com.subsidy.vo.administer.MemberDetectionRecordVO">
SELECT
t2.id,
t2.user_name,
t2.account_name,
t2.telephone,
t2.id_card,
count( t3.id ) as cnt
FROM
class_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
LEFT JOIN activity_detection t3 ON t.class_id = t3.class_id
AND t.member_id = t3.member_id
where t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.class_id = #{classId}
<if test="userName != null and userName !=''">
and t2.user_name like concat('%',#{userName} ,'%')
</if>
GROUP BY
t.member_id
order by t2.id
</select>
</mapper>
......@@ -75,4 +75,24 @@
</if>
</select>
<select id="getCompanyMembers" resultType="com.subsidy.vo.company.GetCompanyMembersVO">
SELECT
t.id,
t.user_name,
t.id_card,
t2.company_name,
t.first_login,
t.check_image,
t.check_time
FROM
member t
LEFT JOIN company_dict t2 ON t.company_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t.company_id = #{companyId}
and t.user_name like concat('%',#{userName} ,'%')
</select>
</mapper>
......@@ -119,11 +119,19 @@
<select id="testScoreInfo" resultType="com.subsidy.vo.done.TestScoreInfoVO">
SELECT
t1.paper_id,
t1.score,
t1.result,
t2.cnt
FROM
(
SELECT
t.paper_id,
max( t.score ) AS score,
count( 1 ) AS cnt,
t.class_id,
t.member_id,
t.score,
IF
( max( t.score )>= 60, '合格', '不合格' ) AS result
( ( t.score )>= 60, '合格', '不合格' ) AS result
FROM
exercise_done_result t
LEFT JOIN paper_dict t2 ON t.paper_id = t2.id
......@@ -131,11 +139,27 @@
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.paper_id = #{paperId}
and t.class_id = #{classId}
GROUP BY
t.class_id,
t.paper_id,
t.member_id
AND t.class_id = #{classId}
ORDER BY
t.create_date DESC
LIMIT 1
) t1
LEFT JOIN (
SELECT
t2.paper_id,
t2.class_id,
t2.member_id,
count( 1 ) AS cnt
FROM
exercise_done_result t2
WHERE
t2.delete_date IS NULL
AND t2.member_id = #{memberId}
AND t2.paper_id = #{paperId}
AND t2.class_id = #{classId}
) t2 ON t1.paper_id = t2.paper_id
AND t1.member_id = t2.member_id
AND t1.class_id = t2.class_id
</select>
<select id="getClassTestPassRate" parameterType="long" resultType="integer">
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.ImageCheckRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.ImageCheckRecordDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<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>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, class_id, paper_id, request_id
</sql>
</mapper>
......@@ -323,4 +323,8 @@
AND r.ts is NULL
and m.delete_date is null
</select>
<update id="removeCheckImage" parameterType="long">
update member set check_image = nulll where id = #{id}
</update>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!