Commit 205d0ae8 by 涂亚平

结束两个月居家办公

1 parent 2db33758
Showing with 613 additions and 87 deletions
......@@ -133,11 +133,11 @@
<version>${swagger2.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.amdelamar</groupId>-->
<!-- <artifactId>jhash</artifactId>-->
<!-- <version>${jhash.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.amdelamar</groupId>-->
<!-- <artifactId>jhash</artifactId>-->
<!-- <version>${jhash.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.apache.poi</groupId>
......@@ -208,10 +208,16 @@
<version>${jedis.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->
<!--webSocket-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-data-mongodb</artifactId>-->
<!-- </dependency>-->
</dependencies>
......
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 = "qxueyou")
public class QXueYouConfig {
private String appId;
private String securityKey;
private String url;
}
......@@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import sun.security.provider.certpath.ResponderId;
/**
* <p>
......@@ -32,7 +31,7 @@ public class CertCompanyMappingController {
@PostMapping("getCompanyCertsWithStatus")
@ApiOperation("获取某个公司的项目证书(返回学生报名状态) companyId 公司id typeId 类型id(查全部传空) memberId 学生id")
public ResponseVO getCompanyCertsWithStatus(@RequestParam GetCompanyCertsWithStatusDTO getCompanyCertsDTO){
public ResponseVO getCompanyCertsWithStatus(@RequestBody GetCompanyCertsWithStatusDTO getCompanyCertsDTO){
return ResponseData.generateCreatedResponse(0,certCompanyMappingService.getCompanyCertsWithStatus(getCompanyCertsDTO));
}
......
......@@ -5,6 +5,7 @@ import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.dto.cert.AddCertDTO;
import com.subsidy.dto.cert.GetAllCertsDTO;
import com.subsidy.dto.cert.GetOneCertDTO;
import com.subsidy.model.CertDictDO;
import com.subsidy.service.CertDictService;
import io.swagger.annotations.ApiOperation;
......@@ -33,7 +34,7 @@ public class CertDictController {
private CertDictService certDictService;
@PostMapping("addCert")
@ApiOperation("添加证书 certName price coverPage title副标题 scribePrice 划线价格 detail chargeAndSubsidy 学费和补贴 serviceProcess服务流程 refundGuarantee 退费流程 typeIds[] 类型id requirementDesc 条件说明 submitDesc 提交说明")
@ApiOperation("添加证书 certName price coverPage title副标题 scribePrice 划线价格 certDesc 证书简介 detail chargeAndSubsidy 学费和补贴 serviceProcess服务流程 refundGuarantee 退费流程 typeIds[] 类型id requirementDesc 条件说明 submitDesc 提交说明")
public ResponseVO addCert(@RequestBody AddCertDTO addCertDTO){
return ResponseData.generateCreatedResponse(0,certDictService.addCert(addCertDTO));
}
......@@ -51,9 +52,9 @@ public class CertDictController {
}
@PostMapping("getOneCert")
@ApiOperation("获取一个证书 id")
public ResponseVO getOneCert(@RequestBody CertDictDO certDictDO){
return ResponseData.generateCreatedResponse(0,certDictService.getOneCert(certDictDO));
@ApiOperation("获取一个证书 id userId")
public ResponseVO getOneCert(@RequestBody GetOneCertDTO getOneCertDTO){
return ResponseData.generateCreatedResponse(0,certDictService.getOneCert(getOneCertDTO));
}
@PostMapping("getAllCerts")
......
......@@ -33,7 +33,7 @@ public class CertTypeDictController {
@PostMapping("getCompanyCertTypes")
@ApiOperation("(手机端)获取某个公司所有的证书类型 companyId")
public ResponseVO getCompanyCertTypes(@RequestParam CertCompanyMappingDO certCompanyMappingDO){
public ResponseVO getCompanyCertTypes(@RequestBody CertCompanyMappingDO certCompanyMappingDO){
return ResponseData.generateCreatedResponse(0,certTypeDictService.getCompanyCertTypes(certCompanyMappingDO));
}
......
......@@ -167,4 +167,11 @@ public class MemberController {
public ResponseVO changeDepartments(@RequestBody ChangeDepartmentsDTO changeDepartmentsDTO){
return ResponseData.generateCreatedResponse(0,memberService.changeDepartments(changeDepartmentsDTO));
}
@PostMapping("qxy")
@ApiOperation("Q学友授权 telephone 手机号")
public ResponseVO qxy(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.qxy(memberDO));
}
}
......@@ -10,7 +10,7 @@ public class GetAllCertsDTO {
private Integer pageNum;
private Long certTypeId;
private Long typeId;
private String certName;
......
package com.subsidy.dto.cert;
import lombok.Data;
@Data
public class GetOneCertDTO {
private Integer id;
private Long userId;
}
package com.subsidy.dto.exercise;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.subsidy.util.excel.ExcelColumnUtil;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
@Data
public class ImportHistory {
......@@ -57,6 +59,7 @@ public class ImportHistory {
private String result;
@ExcelColumnUtil(value = "create_date", col = 10)
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private String create_date;
}
......@@ -21,7 +21,7 @@ import java.util.List;
public interface CertCompanyMappingMapper extends BaseMapper<CertCompanyMappingDO> {
//获取某个公司的某个类型下的证书 companyId typeId
List<CertDictDO> getCompanyCerts(Long CompanyId, Long typeId);
List<CertDictDO> getCompanyCerts(Long companyId, Long typeId);
//获取全部证书公司映射情况 分页 包含企业状态
IPage<GetCompanyCertsVO> getCompanyCertStatus(IPage page);
......
......@@ -34,5 +34,7 @@ public interface CertMemberMappingMapper extends BaseMapper<CertMemberMappingDO>
*/
GetSignInfoVO getSignInfo(Long memberId,Long certId);
int memberCertStatus(Long memberId,Long certId);
}
......@@ -32,5 +32,4 @@ public interface OprAdmDictMapper extends BaseMapper<OprAdmDictDO> {
List<OprAdmDictDO> getRecordByDate();
void deleteById(Long id);
}
......@@ -23,5 +23,4 @@ public interface OprMemDictMapper extends BaseMapper<OprMemDictDO> {
List<OprMemDictDO> getRecordByDate();
void deleteById(Long id);
}
......@@ -57,6 +57,11 @@ public class CertDictDO extends BaseModel {
private String coverPage;
/**
* 详情封面
*/
private String detailPage;
/**
* 详情
*/
private String detail;
......
......@@ -50,5 +50,10 @@ public class CompanyDictDO extends BaseModel {
*/
private String address;
/**
* 是否需要跳转到Q学友
*/
private Boolean qxyStatus;
}
......@@ -3,6 +3,7 @@ package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.cert.AddCertDTO;
import com.subsidy.dto.cert.GetAllCertsDTO;
import com.subsidy.dto.cert.GetOneCertDTO;
import com.subsidy.model.CertDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.cert.GetAllCertsVO;
......@@ -27,7 +28,7 @@ public interface CertDictService extends IService<CertDictDO> {
String updateCert(AddCertDTO addCertDTO);
GetOneCertVO getOneCert(CertDictDO certDictDO);
GetOneCertVO getOneCert(GetOneCertDTO getOneCertDTO);
IPage<GetAllCertsVO> getAllCerts(GetAllCertsDTO getAllCertsDTO);
......
......@@ -63,4 +63,5 @@ public interface MemberService extends IService<MemberDO> {
String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO);
QxyVO qxy(MemberDO memberDO);
}
......@@ -5,11 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.cert.AddCertDTO;
import com.subsidy.dto.cert.GetAllCertsDTO;
import com.subsidy.mapper.CertRequirementMapper;
import com.subsidy.mapper.CertTypeDictMapper;
import com.subsidy.mapper.CertTypeMappingMapper;
import com.subsidy.dto.cert.GetOneCertDTO;
import com.subsidy.mapper.*;
import com.subsidy.model.*;
import com.subsidy.mapper.CertDictMapper;
import com.subsidy.service.CertDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.service.CertTypeDictService;
......@@ -17,6 +15,7 @@ import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.cert.GetAllCertsVO;
import com.subsidy.vo.cert.GetAllCertsWithoutTypeVO;
import com.subsidy.vo.cert.GetOneCertVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -46,6 +45,9 @@ public class CertDictServiceImpl extends ServiceImpl<CertDictMapper, CertDictDO>
@Autowired
private CertRequirementMapper certRequirementMapper;
@Autowired
private CertMemberMappingMapper certMemberMappingMapper;
@Transactional(rollbackFor = Exception.class)
public String addCert(AddCertDTO addCertDTO) {
......@@ -106,23 +108,31 @@ public class CertDictServiceImpl extends ServiceImpl<CertDictMapper, CertDictDO>
return ConstantUtils.SET_SUCCESS;
}
public GetOneCertVO getOneCert(CertDictDO certDictDO) {
public GetOneCertVO getOneCert(GetOneCertDTO getOneCertDTO) {
GetOneCertVO getOneCertVO = new GetOneCertVO();
CertDictDO certDictDO1 = this.baseMapper.selectById(certDictDO.getId());
CertDictDO certDictDO1 = this.baseMapper.selectById(getOneCertDTO.getId());
BeanUtils.copyProperties(certDictDO1, getOneCertVO);
//查看证书有哪些类型
List<CertTypeDictDO> certTypeDictDOS = certTypeDictMapper.getCertTypes(certDictDO.getId());
List<CertTypeDictDO> certTypeDictDOS = certTypeDictMapper.getCertTypes(certDictDO1.getId());
getOneCertVO.setCertTypeDictDOS(certTypeDictDOS);
Integer count = certMemberMappingMapper.memberCertStatus(getOneCertDTO.getUserId(),certDictDO1.getId());
if (count > 0){
getOneCertVO.setStatus(true);
}else {
getOneCertVO.setStatus(false);
}
return getOneCertVO;
}
public IPage<GetAllCertsVO> getAllCerts(GetAllCertsDTO getAllCertsDTO) {
Page pager = new Page(getAllCertsDTO.getPageNum(), getAllCertsDTO.getPageSize());
IPage<GetAllCertsVO> getAllCertsVOIPage = this.baseMapper.getAllCerts(pager,getAllCertsDTO.getCertTypeId(),getAllCertsDTO.getCertName());
IPage<GetAllCertsVO> getAllCertsVOIPage = this.baseMapper.getAllCerts(pager,getAllCertsDTO.getTypeId(),getAllCertsDTO.getCertName());
List<GetAllCertsVO> getAllCertsVOS = getAllCertsVOIPage.getRecords();
for (GetAllCertsVO gav : getAllCertsVOS){
......
......@@ -23,6 +23,7 @@ import com.subsidy.vo.cert.GetSignInfoVO;
import com.subsidy.vo.cert.SignManagementVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
......@@ -47,6 +48,7 @@ public class CertMemberMappingServiceImpl extends ServiceImpl<CertMemberMappingM
@Autowired
private CertRequirementMapper certRequirementMapper;
@Transactional(rollbackFor = Exception.class)
public String signUp(SignUpDTO signUpDTO) {
List<CertMemberFileMappingDO> certMemberFileMappingDOS = signUpDTO.getFiles();
......@@ -54,13 +56,14 @@ public class CertMemberMappingServiceImpl extends ServiceImpl<CertMemberMappingM
for (CertMemberFileMappingDO certMemberFileMappingDO : certMemberFileMappingDOS) {
certMemberFileMappingDO.setCertId(signUpDTO.getCertId());
certMemberFileMappingDO.setMemberId(signUpDTO.getMemberId());
certMemberFileMappingDO.setRequirementId(certMemberFileMappingDO.getRequirementId());
certMemberFileMappingMapper.insert(certMemberFileMappingDO);
}
CertMemberMappingDO certMemberMappingDO = new CertMemberMappingDO();
certMemberMappingDO.setCertId(signUpDTO.getCertId());
certMemberMappingDO.setMemberId(signUpDTO.getMemberId());
certMemberMappingDO.setOrderNo(System.currentTimeMillis());
certMemberMappingDO.setStatus("报名成功");
certMemberMappingDO.setStatus("等待确认");
this.baseMapper.insert(certMemberMappingDO);
//生成订单逻辑 TODO
......@@ -93,7 +96,7 @@ public class CertMemberMappingServiceImpl extends ServiceImpl<CertMemberMappingM
public String changeStatus(CertMemberMappingDO certMemberMappingDO) {
CertMemberMappingDO certMemberMappingDO1 = this.baseMapper.selectById(certMemberMappingDO.getId());
certMemberMappingDO1.setStatus(certMemberMappingDO.getStatus());
this.baseMapper.updateById(certMemberMappingDO);
this.baseMapper.updateById(certMemberMappingDO1);
return ConstantUtils.SET_SUCCESS;
}
......
......@@ -9,14 +9,20 @@ import com.subsidy.service.ExerciseDoneResultService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.excel.ExcelUtil;
import com.subsidy.vo.exercise.GetDoneDetailVO;
import org.apache.poi.ss.usermodel.DateUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.swing.text.DateFormatter;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Random;
/**
......@@ -62,9 +68,9 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
.eq(ExerciseDoneHistoryDO::getDoneId,exerciseDoneResultDO.getId())
.eq(ExerciseDoneHistoryDO::getMemberId,exerciseDoneResultDO.getMemberId())
.eq(ExerciseDoneHistoryDO::getPaperId,exerciseDoneResultDO.getPaperId()));
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter formatter =
DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss zzz yyyy",Locale.ENGLISH);
//遍历写入
for (ExerciseDoneHistoryDO exerciseDoneHistoryDO : exerciseDoneHistoryDOS){
ExerciseDoneHistoryDO ex = new ExerciseDoneHistoryDO();
......@@ -74,7 +80,9 @@ public class ExerciseDoneResultServiceImpl extends ServiceImpl<ExerciseDoneResul
ex.setDoneId(s.getId());
ex.setClassId(s.getClassId());
ex.setPaperId(s.getPaperId());
ex.setCreateDate(LocalDateTime.parse(s.getCreate_date(),df));
// DateUtil.getJavaDate()
ex.setCreateDate(LocalDateTime.parse(s.getCreate_date(),formatter));
exerciseDoneHistoryMapper.insert(ex);
}
......
package com.subsidy.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.common.configure.QXueYouConfig;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.VerifyCodeDTO;
import com.subsidy.dto.member.*;
......@@ -44,15 +46,20 @@ import com.subsidy.model.RotationImgDictDO;
import com.subsidy.model.SmsVerifyCodeDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.*;
//import com.subsidy.util.RedisUtil;
import com.subsidy.util.JwtUtil;
import com.subsidy.util.RedisUtil;
import com.subsidy.util.SecretUtils;
import com.subsidy.vo.administer.UserRoleVO;
import com.subsidy.vo.member.*;
import com.subsidy.vo.paper.QueryPapersVO;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.methods.RequestBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.AsyncResult;
......@@ -136,6 +143,9 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
@Autowired
private ClassHourDictMapper classHourDictMapper;
@Autowired
private QXueYouConfig qXueYouConfig;
public IPage<GetAllVO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
......@@ -369,6 +379,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
userRoleVO.setLogo(companyDictDO.getLogo());
userRoleVO.setQxyStatus(companyDictDO.getQxyStatus());
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
......@@ -405,6 +416,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
BeanUtils.copyProperties(memberDO, memberVO);
memberVO.setCompanyId(companyDictDO.getId());
memberVO.setCompanyName(companyDictDO.getCompanyName());
memberVO.setQxyStatus(companyDictDO.getQxyStatus());
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
......@@ -470,10 +482,10 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return null;
}
// 9a79cda9ef6f4a52a8
// 9a79cda9ef6f4a52a8
// 552a4147db2d4026bc4e9021acd614f8
public static void main(String[] args) {
String uuid = UUID.randomUUID().toString().replace("-","");
String uuid = UUID.randomUUID().toString().replace("-", "");
System.out.println(uuid);
}
......@@ -497,7 +509,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
/**
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp()-System.currentTimeMillis()>=5*60*1000 || System.currentTimeMillis()-qingxuetangLoginDTO.getTimestamp()>=5*60*1000){
if (qingxuetangLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - qingxuetangLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
......@@ -509,25 +521,25 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//鉴权逻辑 对不对
String preAuthen = "";
if (!StringUtils.isEmpty(qingxuetangLoginDTO.getNickname())){
preAuthen = "appId=b8fc3013c8ce409c90&authCorpId="+qingxuetangLoginDTO.getAuthCorpId()
+"&authCorpName="+ qingxuetangLoginDTO.getAuthCorpName()
+"&mobile="+qingxuetangLoginDTO.getMobile()
+"&nickname="+qingxuetangLoginDTO.getNickname()
+"&openId="+qingxuetangLoginDTO.getOpenId()
+"&timestamp="+qingxuetangLoginDTO.getTimestamp()
+"&appSecret=90876d91b3b7426c9184437a09358787" ;
}else {
preAuthen = "appId=b8fc3013c8ce409c90&authCorpId="+qingxuetangLoginDTO.getAuthCorpId()
+"&authCorpName="+ qingxuetangLoginDTO.getAuthCorpName()
+"&mobile="+qingxuetangLoginDTO.getMobile()
+"&openId="+qingxuetangLoginDTO.getOpenId()
+"&timestamp="+qingxuetangLoginDTO.getTimestamp()
+"&appSecret=90876d91b3b7426c9184437a09358787" ;
if (!StringUtils.isEmpty(qingxuetangLoginDTO.getNickname())) {
preAuthen = "appId=b8fc3013c8ce409c90&authCorpId=" + qingxuetangLoginDTO.getAuthCorpId()
+ "&authCorpName=" + qingxuetangLoginDTO.getAuthCorpName()
+ "&mobile=" + qingxuetangLoginDTO.getMobile()
+ "&nickname=" + qingxuetangLoginDTO.getNickname()
+ "&openId=" + qingxuetangLoginDTO.getOpenId()
+ "&timestamp=" + qingxuetangLoginDTO.getTimestamp()
+ "&appSecret=90876d91b3b7426c9184437a09358787";
} else {
preAuthen = "appId=b8fc3013c8ce409c90&authCorpId=" + qingxuetangLoginDTO.getAuthCorpId()
+ "&authCorpName=" + qingxuetangLoginDTO.getAuthCorpName()
+ "&mobile=" + qingxuetangLoginDTO.getMobile()
+ "&openId=" + qingxuetangLoginDTO.getOpenId()
+ "&timestamp=" + qingxuetangLoginDTO.getTimestamp()
+ "&appSecret=90876d91b3b7426c9184437a09358787";
}
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)){
if (!qingxuetangLoginDTO.getSign().equals(result)) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
......@@ -567,6 +579,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
userRoleVO.setLogo(companyDictDO.getLogo());
userRoleVO.setQxyStatus(companyDictDO.getQxyStatus());
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
......@@ -577,7 +590,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return userRoleVO;
}
public UserRoleVO kunchiLogin(QingxuetangLoginDTO qingxuetangLoginDTO){
public UserRoleVO kunchiLogin(QingxuetangLoginDTO qingxuetangLoginDTO) {
UserRoleVO userRoleVO = new UserRoleVO();
......@@ -594,7 +607,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
/**
* 时间戳有没有过期
*/
if (qingxuetangLoginDTO.getTimestamp()-System.currentTimeMillis()>=5*60*1000 || System.currentTimeMillis()-qingxuetangLoginDTO.getTimestamp()>=5*60*1000){
if (qingxuetangLoginDTO.getTimestamp() - System.currentTimeMillis() >= 5 * 60 * 1000 || System.currentTimeMillis() - qingxuetangLoginDTO.getTimestamp() >= 5 * 60 * 1000) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
......@@ -605,14 +618,14 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
//鉴权逻辑 对不对
String preAuthen = "appId=9a79cda9ef6f4a52a8"
+"&authCorpName="+ qingxuetangLoginDTO.getAuthCorpName()
+"&mobile="+qingxuetangLoginDTO.getMobile()
+"&nickname="+qingxuetangLoginDTO.getNickname()
+"&timestamp="+qingxuetangLoginDTO.getTimestamp()
+"&appSecret=552a4147db2d4026bc4e9021acd614f8" ;
+ "&authCorpName=" + qingxuetangLoginDTO.getAuthCorpName()
+ "&mobile=" + qingxuetangLoginDTO.getMobile()
+ "&nickname=" + qingxuetangLoginDTO.getNickname()
+ "&timestamp=" + qingxuetangLoginDTO.getTimestamp()
+ "&appSecret=552a4147db2d4026bc4e9021acd614f8";
String result = SecretUtils.getMD5String(preAuthen);
if (!qingxuetangLoginDTO.getSign().equals(result)){
if (!qingxuetangLoginDTO.getSign().equals(result)) {
OprMemDictDO oprMemDictDO = new OprMemDictDO();
oprMemDictDO.setUserId(memberDO.getId());
oprMemDictDO.setOprType("登录");
......@@ -652,6 +665,7 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
userRoleVO.setCompanyId(companyDictDO.getId());
userRoleVO.setCompanyName(companyDictDO.getCompanyName());
userRoleVO.setLogo(companyDictDO.getLogo());
userRoleVO.setQxyStatus(companyDictDO.getQxyStatus());
List<RotationImgDictDO> rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper<RotationImgDictDO>()
.lambda()
.eq(RotationImgDictDO::getCompanyId, companyDictDO.getId()));
......@@ -954,4 +968,45 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> imple
return ConstantUtils.SET_SUCCESS;
}
public QxyVO qxy(MemberDO memberDO) {
CloseableHttpClient client = null;
CloseableHttpResponse response = null;
String resValue = "";
long timestamp = System.currentTimeMillis();
String nonce = SecretUtils.getNonce(5);
String appId = qXueYouConfig.getAppId();
String appKey = qXueYouConfig.getSecurityKey();
String mobile = memberDO.getTelephone();
String signature = SecretUtils.gen(appKey, nonce, String.valueOf(timestamp), appId, mobile);
try {
client = HttpClients.createDefault();
HttpUriRequest build = RequestBuilder
.post(qXueYouConfig.getUrl())
.addHeader("Content-Type", "application/json")
.setEntity(new StringEntity(""))
.addParameter("appId", appId)
.addParameter("mobile", mobile)
.addParameter("timestamp", String.valueOf(timestamp))
.addParameter("signature", signature)
.addParameter("nonce", nonce)
.build();
//请求
response = client.execute(build);
HttpEntity entity = response.getEntity();
if (entity != null) {
resValue = EntityUtils.toString(entity, "UTF-8");
ResultMode resMode = JSON.parseObject(resValue, ResultMode.class);
QxyVO qxyVO = new QxyVO();
qxyVO.setToken(resMode.getData().toString());
return qxyVO;
}
} catch (Exception e) {
e.printStackTrace();
}
return new QxyVO();
}
}
package com.subsidy.util;
public class ResultMode {
/**
* 成功:true,失败:false
*/
private boolean success;
/**
* 返回编码
*/
private int resultCode;
/**
* 返回消息
*/
private String msg;
/**
* 结果数据
*/
private Object data;
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public int getResultCode() {
return resultCode;
}
public void setResultCode(int resultCode) {
this.resultCode = resultCode;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}
package com.subsidy.util;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Arrays;
import java.util.Random;
import java.util.UUID;
public class SecretUtils {
......@@ -61,6 +64,38 @@ public class SecretUtils {
}
/**
* Q学友SHA加密
* @param arr
* @return
*/
public static String gen(String... arr) {
if (StringUtils.isAnyEmpty(arr)) {
throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr));
} else {
Arrays.sort(arr);
StringBuilder sb = new StringBuilder();
String[] var2 = arr;
int var3 = arr.length;
for (int var4 = 0; var4 < var3; ++var4) {
String a = var2[var4];
sb.append(a);
}
return DigestUtils.sha1Hex(sb.toString());
}
}
public static String getNonce(int length) {
String val = "";
Random random = new Random();
//参数length,表示生成几位随机数
for (int i = 0; i < length; i++) {
val += String.valueOf(random.nextInt(10));
}
return val;
}
private static byte[] md5(String s)
{
......
package com.subsidy.util.websocket;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpSession;
import javax.websocket.*;
import javax.websocket.server.ServerEndpoint;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@ServerEndpoint(value = "/chat",configurator = GetHttpSessionConfigurator.class) //与前端的那个对应
@Component
public class ChatEndPoint {
/**
* 用来存储每一个客户端对象对应的ChatEndPoint
*/
private static Map<String, ChatEndPoint> onlineUsers = new ConcurrentHashMap<>();
/**
* 声明session对象 通过该对象可以发送消息给指定的用户/客户端
*/
private Session session;
/**
* 声明一个HttpSession对象,我们之前在HttpSession对象中存储了用户名
*/
private HttpSession httpSession;
/**
* 连接建立时候被调用
*/
@OnOpen
public void open(Session session, EndpointConfig endpointConfig) {
//将局部的Session对象赋值给成员Session
this.session = session;
//获取httpSession对象
HttpSession httpSession = (HttpSession) session.getUserProperties().get(HttpSession.class.getName());
this.httpSession = httpSession;
//从httpSession对象中获取用户名
String userName = (String) httpSession.getAttribute("user");
//将当前对象存储到容器里面 当前chatEndpoint对象
onlineUsers.put(userName, this);
//将当前在线用户的用户名推送给所有的客户端
//1.获取消息
//所有在线的用户名
String msg = MessageUtils.getMessage(true, null, getName());
// 2.调用方法进行系统消息的推送
broadcastAllUsers(msg);
}
private void broadcastAllUsers(String message){
try {
//要将该消息推送给所有的客户端
Set<String> set = onlineUsers.keySet();
for (String user : set){
ChatEndPoint chatEndPoint = onlineUsers.get(user);
chatEndPoint.session.getBasicRemote().sendText(message);
}
}catch (Exception e){
e.printStackTrace();
}
}
private Set<String> getName() {
return onlineUsers.keySet();
}
/**
* 接收到客户端发送的数据时候被调用
*/
@OnMessage
public void onMessage(String msg, Session session) {
try {
//将msg转换成Message对象
ObjectMapper objectMapper = new ObjectMapper();
Message message = objectMapper.readValue(msg,Message.class);
//获取要接受数据的人
String toName = message.getToName();
//获取消息数据
String data = message.getMessage();
//获取当前登录的用户
String userName = (String) httpSession.getAttribute("user");
//获取推送给指定用户的消息格式的数据
String result = MessageUtils.getMessage(false,userName,data);
//发送数据
onlineUsers.get(toName).session.getBasicRemote().sendText(result);
}catch (Exception e){
e.printStackTrace();
}
}
/**
* 客户端关闭时候被调用
*/
@OnClose
public void onClose(Session session) {
//获取当前登录的用户
String userName = (String) httpSession.getAttribute("user");
// 从容器中删除指定的用户
onlineUsers.remove(userName);
//获取推送消息
String msg = MessageUtils.getMessage(true,null,getName());
broadcastAllUsers(msg);
}
}
package com.subsidy.util.websocket;
import javax.servlet.http.HttpSession;
import javax.websocket.HandshakeResponse;
import javax.websocket.server.HandshakeRequest;
import javax.websocket.server.ServerEndpointConfig;
public class GetHttpSessionConfigurator extends ServerEndpointConfig.Configurator {
@Override
public void modifyHandshake(ServerEndpointConfig sec, HandshakeRequest request, HandshakeResponse response) {
HttpSession httpSession = (HttpSession) request.getHttpSession();
//将HttpSession对象存储到配置对象中
sec.getUserProperties().put(HttpSession.class.getName(),httpSession);
// super.modifyHandshake(sec, request, response);
}
}
package com.subsidy.util.websocket;
import lombok.Data;
/**
* 浏览器给服务端发的websocket数据
*/
@Data
public class Message {
private String toName;
private String message;
}
package com.subsidy.util.websocket;
import com.fasterxml.jackson.databind.ObjectMapper;
/**
* 封装消息的工具类
*/
public class MessageUtils {
public static String getMessage(Boolean isSystemMessage,String fromName,Object message){
try {
ResultMessage resultMessage = new ResultMessage();
resultMessage.setIsSystem(isSystemMessage);
resultMessage.setMessage(message);
if (fromName != null){
resultMessage.setFromName(fromName);
}
ObjectMapper objectMapper = new ObjectMapper();
return objectMapper.writeValueAsString(resultMessage);
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}
package com.subsidy.util.websocket;
import lombok.Data;
/**
* 登陆响应给浏览器的数据
*/
@Data
public class Result {
private Boolean flag;
private String message;
}
package com.subsidy.util.websocket;
import lombok.Data;
/**
* 服务端发送给浏览器的websocket数据
*/
@Data
public class ResultMessage {
private Boolean isSystem;
private String fromName;
private Object message; //系统消息的话就是数组
}
package com.subsidy.util.websocket;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@Configuration
public class WebsocketConfig {
/**
* 注入 ServerEndpointExporter 对象,可以自动注册使用了@ServerEndpoint注解的bean
*/
@Bean
public ServerEndpointExporter serverEndpointExporter(){
return new ServerEndpointExporter();
}
}
......@@ -24,6 +24,8 @@ public class UserRoleVO {
private String companyName;
private Boolean qxyStatus;
private Long companyId;
private String logo;
......
......@@ -4,4 +4,16 @@ import lombok.Data;
@Data
public class GetListVO {
private Integer id;
private String certName;
private Integer certId;
private String coverPage;
private String createDate;
private String status;
}
......@@ -11,4 +11,6 @@ public class GetOneCertVO extends CertDictDO {
private List<CertTypeDictDO> certTypeDictDOS;
private Boolean status;
}
......@@ -5,8 +5,15 @@ import lombok.Data;
@Data
public class GetSignInfoVO {
private Long memberId;
// private Long memberId;
private Long certId;
// private Long certId;
private String userName;
private String orderNo;
private String certName;
private String status;
}
......@@ -24,6 +24,8 @@ public class MemberVO {
private Long companyId;
private Boolean qxyStatus;
private String logo;
private List<RotationImgDictDO> rotationImgDictDOS;
......
......@@ -16,6 +16,8 @@ public class MyCoursesVO {
private String courseName;
private String startDate;
private String endDate;
private Integer totalCnt;
......
package com.subsidy.vo.member;
import lombok.Data;
@Data
public class QxyVO {
private String token;
}
......@@ -49,4 +49,8 @@ spring.redis.password=Ykhl@208
spring.redis.port=6389
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
spring.redis.lettuce.pool.min-idle=8
qxueyou.appId=qxywz5nnWMI77CM3Tx
qxueyou.securityKey=626737T1-65K0-5xC2-0Y0V-2Aq95qxy
qxueyou.url=https://dev.qxueyou.com/auth/user/token
\ No newline at end of file
......@@ -43,4 +43,8 @@ spring.redis.password=Ykhl@302
spring.redis.port=20260
spring.redis.lettuce.pool.max-idle=16
spring.redis.lettuce.pool.max-active=32
spring.redis.lettuce.pool.min-idle=8
\ No newline at end of file
spring.redis.lettuce.pool.min-idle=8
qxueyou.appId=qxy1a2n6h16012nJ6x
qxueyou.securityKey=44420Tlu-P463-9041-2h1q-29Z59qxy
qxueyou.url=https://www.qxueyou.com/auth/user/token
\ No newline at end of file
......@@ -22,19 +22,20 @@
<select id="getCompanyCerts" resultType="com.subsidy.model.CertDictDO">
SELECT
t2.*
distinct t.*
FROM
cert_company_mapping t
LEFT JOIN cert_type_mapping t3 ON t.cert_id = t3.cert_id
LEFT JOIN cert_dict t2 ON t.cert_id = t2.id
cert_dict t
LEFT JOIN cert_type_mapping t3 ON t.id = t3.cert_id
LEFT JOIN cert_company_mapping t2 ON t.id = t2.cert_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t.company_id = #{companyId}
AND t2.company_id = #{companyId}
<if test="typeId != null and typeId !=''">
AND t3.type_id = #{typeId}
</if>
order by t.id
</select>
<select id="getCompanyCertStatus" resultType="com.subsidy.vo.cert.GetCompanyCertsVO">
......
......@@ -80,7 +80,8 @@
t2.cert_name,
t2.id AS cert_id,
t2.cover_page,
t.create_date
t.create_date,
t.status
FROM
cert_member_mapping t
LEFT JOIN cert_dict t2 ON t.cert_id = t2.id
......@@ -96,14 +97,32 @@
<select id="getSignInfo" resultType="com.subsidy.vo.cert.GetSignInfoVO">
SELECT
t2.user_name,
t.order_no
t.order_no,
t.status,
t3.cert_name
FROM
cert_member_mapping t
LEFT JOIN member t2 ON t.member_id = t2.id
left join cert_dict t3 on t.cert_id = t3.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t.cert_id =#{certId}
and t.member_id = #{memberId}
</select>
<select id="memberCertStatus" resultType="integer">
SELECT
count( 1 )
FROM
cert_member_mapping t
WHERE
t.delete_date IS NULL
AND t.member_id = #{memberId}
AND t.cert_id = #{certId}
AND (
t.`status` = "等待确认"
OR t.`status` = "等待支付"
OR t.`status` = "有效订单")
</select>
</mapper>
......@@ -66,6 +66,7 @@
t2.id AS classId,
t2.class_name,
t3.course_name,
t2.start_date,
t2.end_date,
t4.cnt AS totalCnt,
t5.result AS studyCnt,
......
......@@ -20,10 +20,6 @@
id, user_id, opr_type
</sql>
<delete id="deleteById">
delete from opr_adm_dict
where id = #{id}
</delete>
<select id="getHistory" resultType="com.subsidy.vo.opr.GetHistoryVO">
SELECT
......
......@@ -20,10 +20,6 @@
id, user_id, opr_type
</sql>
<delete id="deleteById">
delete from opr_mem_dict
where id = #{id}
</delete>
<select id="getHistory" resultType="com.subsidy.vo.opr.GetHistoryVO">
SELECT
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!