diff --git a/pom.xml b/pom.xml index 95e2f29..5e21b2b 100644 --- a/pom.xml +++ b/pom.xml @@ -133,11 +133,11 @@ ${swagger2.version} - - - - - + + + + + org.apache.poi @@ -208,10 +208,16 @@ ${jedis.version} - - - - + + + org.springframework.boot + spring-boot-starter-websocket + + + + + + diff --git a/src/main/java/com/subsidy/common/configure/QXueYouConfig.java b/src/main/java/com/subsidy/common/configure/QXueYouConfig.java new file mode 100644 index 0000000..0bf6873 --- /dev/null +++ b/src/main/java/com/subsidy/common/configure/QXueYouConfig.java @@ -0,0 +1,18 @@ +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; + +} diff --git a/src/main/java/com/subsidy/controller/CertCompanyMappingController.java b/src/main/java/com/subsidy/controller/CertCompanyMappingController.java index 3ff8543..286998f 100644 --- a/src/main/java/com/subsidy/controller/CertCompanyMappingController.java +++ b/src/main/java/com/subsidy/controller/CertCompanyMappingController.java @@ -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; /** *

@@ -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)); } diff --git a/src/main/java/com/subsidy/controller/CertDictController.java b/src/main/java/com/subsidy/controller/CertDictController.java index 40d6d39..5f85275 100644 --- a/src/main/java/com/subsidy/controller/CertDictController.java +++ b/src/main/java/com/subsidy/controller/CertDictController.java @@ -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") diff --git a/src/main/java/com/subsidy/controller/CertTypeDictController.java b/src/main/java/com/subsidy/controller/CertTypeDictController.java index e542010..d2255c4 100644 --- a/src/main/java/com/subsidy/controller/CertTypeDictController.java +++ b/src/main/java/com/subsidy/controller/CertTypeDictController.java @@ -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)); } diff --git a/src/main/java/com/subsidy/controller/MemberController.java b/src/main/java/com/subsidy/controller/MemberController.java index cfa723b..ba1714e 100644 --- a/src/main/java/com/subsidy/controller/MemberController.java +++ b/src/main/java/com/subsidy/controller/MemberController.java @@ -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)); + } + } diff --git a/src/main/java/com/subsidy/dto/cert/GetAllCertsDTO.java b/src/main/java/com/subsidy/dto/cert/GetAllCertsDTO.java index b510252..b7bd620 100644 --- a/src/main/java/com/subsidy/dto/cert/GetAllCertsDTO.java +++ b/src/main/java/com/subsidy/dto/cert/GetAllCertsDTO.java @@ -10,7 +10,7 @@ public class GetAllCertsDTO { private Integer pageNum; - private Long certTypeId; + private Long typeId; private String certName; diff --git a/src/main/java/com/subsidy/dto/cert/GetOneCertDTO.java b/src/main/java/com/subsidy/dto/cert/GetOneCertDTO.java new file mode 100644 index 0000000..fc93a88 --- /dev/null +++ b/src/main/java/com/subsidy/dto/cert/GetOneCertDTO.java @@ -0,0 +1,12 @@ +package com.subsidy.dto.cert; + +import lombok.Data; + +@Data +public class GetOneCertDTO { + + private Integer id; + + private Long userId; + +} diff --git a/src/main/java/com/subsidy/dto/exercise/ImportHistory.java b/src/main/java/com/subsidy/dto/exercise/ImportHistory.java index 1dc602b..ef478da 100644 --- a/src/main/java/com/subsidy/dto/exercise/ImportHistory.java +++ b/src/main/java/com/subsidy/dto/exercise/ImportHistory.java @@ -1,7 +1,9 @@ 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; } diff --git a/src/main/java/com/subsidy/mapper/CertCompanyMappingMapper.java b/src/main/java/com/subsidy/mapper/CertCompanyMappingMapper.java index 3c22363..826c383 100644 --- a/src/main/java/com/subsidy/mapper/CertCompanyMappingMapper.java +++ b/src/main/java/com/subsidy/mapper/CertCompanyMappingMapper.java @@ -21,7 +21,7 @@ import java.util.List; public interface CertCompanyMappingMapper extends BaseMapper { //获取某个公司的某个类型下的证书 companyId typeId - List getCompanyCerts(Long CompanyId, Long typeId); + List getCompanyCerts(Long companyId, Long typeId); //获取全部证书公司映射情况 分页 包含企业状态 IPage getCompanyCertStatus(IPage page); diff --git a/src/main/java/com/subsidy/mapper/CertMemberMappingMapper.java b/src/main/java/com/subsidy/mapper/CertMemberMappingMapper.java index c5544cc..b08f893 100644 --- a/src/main/java/com/subsidy/mapper/CertMemberMappingMapper.java +++ b/src/main/java/com/subsidy/mapper/CertMemberMappingMapper.java @@ -34,5 +34,7 @@ public interface CertMemberMappingMapper extends BaseMapper */ GetSignInfoVO getSignInfo(Long memberId,Long certId); + int memberCertStatus(Long memberId,Long certId); + } diff --git a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java index d52761c..4353a1c 100644 --- a/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java +++ b/src/main/java/com/subsidy/mapper/OprAdmDictMapper.java @@ -32,5 +32,4 @@ public interface OprAdmDictMapper extends BaseMapper { List getRecordByDate(); - void deleteById(Long id); } diff --git a/src/main/java/com/subsidy/mapper/OprMemDictMapper.java b/src/main/java/com/subsidy/mapper/OprMemDictMapper.java index d9abf46..d05379c 100644 --- a/src/main/java/com/subsidy/mapper/OprMemDictMapper.java +++ b/src/main/java/com/subsidy/mapper/OprMemDictMapper.java @@ -23,5 +23,4 @@ public interface OprMemDictMapper extends BaseMapper { List getRecordByDate(); - void deleteById(Long id); } diff --git a/src/main/java/com/subsidy/model/CertDictDO.java b/src/main/java/com/subsidy/model/CertDictDO.java index acbf111..bda7fc8 100644 --- a/src/main/java/com/subsidy/model/CertDictDO.java +++ b/src/main/java/com/subsidy/model/CertDictDO.java @@ -57,6 +57,11 @@ public class CertDictDO extends BaseModel { private String coverPage; /** + * 详情封面 + */ + private String detailPage; + + /** * 详情 */ private String detail; diff --git a/src/main/java/com/subsidy/model/CompanyDictDO.java b/src/main/java/com/subsidy/model/CompanyDictDO.java index 76c7ed1..84ff62f 100644 --- a/src/main/java/com/subsidy/model/CompanyDictDO.java +++ b/src/main/java/com/subsidy/model/CompanyDictDO.java @@ -50,5 +50,10 @@ public class CompanyDictDO extends BaseModel { */ private String address; + /** + * 是否需要跳转到Q学友 + */ + private Boolean qxyStatus; + } diff --git a/src/main/java/com/subsidy/service/CertDictService.java b/src/main/java/com/subsidy/service/CertDictService.java index f26b182..1f9fb3b 100644 --- a/src/main/java/com/subsidy/service/CertDictService.java +++ b/src/main/java/com/subsidy/service/CertDictService.java @@ -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 { String updateCert(AddCertDTO addCertDTO); - GetOneCertVO getOneCert(CertDictDO certDictDO); + GetOneCertVO getOneCert(GetOneCertDTO getOneCertDTO); IPage getAllCerts(GetAllCertsDTO getAllCertsDTO); diff --git a/src/main/java/com/subsidy/service/MemberService.java b/src/main/java/com/subsidy/service/MemberService.java index 374ca1c..f79d37b 100644 --- a/src/main/java/com/subsidy/service/MemberService.java +++ b/src/main/java/com/subsidy/service/MemberService.java @@ -63,4 +63,5 @@ public interface MemberService extends IService { String changeDepartments(ChangeDepartmentsDTO changeDepartmentsDTO); + QxyVO qxy(MemberDO memberDO); } diff --git a/src/main/java/com/subsidy/service/impl/CertDictServiceImpl.java b/src/main/java/com/subsidy/service/impl/CertDictServiceImpl.java index 627f5d0..4f625d0 100644 --- a/src/main/java/com/subsidy/service/impl/CertDictServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CertDictServiceImpl.java @@ -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 @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 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 certTypeDictDOS = certTypeDictMapper.getCertTypes(certDictDO.getId()); + List 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 getAllCerts(GetAllCertsDTO getAllCertsDTO) { Page pager = new Page(getAllCertsDTO.getPageNum(), getAllCertsDTO.getPageSize()); - IPage getAllCertsVOIPage = this.baseMapper.getAllCerts(pager,getAllCertsDTO.getCertTypeId(),getAllCertsDTO.getCertName()); + IPage getAllCertsVOIPage = this.baseMapper.getAllCerts(pager,getAllCertsDTO.getTypeId(),getAllCertsDTO.getCertName()); List getAllCertsVOS = getAllCertsVOIPage.getRecords(); for (GetAllCertsVO gav : getAllCertsVOS){ diff --git a/src/main/java/com/subsidy/service/impl/CertMemberMappingServiceImpl.java b/src/main/java/com/subsidy/service/impl/CertMemberMappingServiceImpl.java index 1dc40f6..bc076f7 100644 --- a/src/main/java/com/subsidy/service/impl/CertMemberMappingServiceImpl.java +++ b/src/main/java/com/subsidy/service/impl/CertMemberMappingServiceImpl.java @@ -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 certMemberFileMappingDOS = signUpDTO.getFiles(); @@ -54,13 +56,14 @@ public class CertMemberMappingServiceImpl extends ServiceImpl imple @Autowired private ClassHourDictMapper classHourDictMapper; + @Autowired + private QXueYouConfig qXueYouConfig; + public IPage getAll(GetAllDTO getAllDTO) { Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize()); @@ -369,6 +379,7 @@ public class MemberServiceImpl extends ServiceImpl imple userRoleVO.setCompanyId(companyDictDO.getId()); userRoleVO.setCompanyName(companyDictDO.getCompanyName()); userRoleVO.setLogo(companyDictDO.getLogo()); + userRoleVO.setQxyStatus(companyDictDO.getQxyStatus()); List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() .lambda() .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); @@ -405,6 +416,7 @@ public class MemberServiceImpl extends ServiceImpl 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 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 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 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() - +"×tamp="+qingxuetangLoginDTO.getTimestamp() - +"&appSecret=90876d91b3b7426c9184437a09358787" ; - }else { - preAuthen = "appId=b8fc3013c8ce409c90&authCorpId="+qingxuetangLoginDTO.getAuthCorpId() - +"&authCorpName="+ qingxuetangLoginDTO.getAuthCorpName() - +"&mobile="+qingxuetangLoginDTO.getMobile() - +"&openId="+qingxuetangLoginDTO.getOpenId() - +"×tamp="+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() + + "×tamp=" + qingxuetangLoginDTO.getTimestamp() + + "&appSecret=90876d91b3b7426c9184437a09358787"; + } else { + preAuthen = "appId=b8fc3013c8ce409c90&authCorpId=" + qingxuetangLoginDTO.getAuthCorpId() + + "&authCorpName=" + qingxuetangLoginDTO.getAuthCorpName() + + "&mobile=" + qingxuetangLoginDTO.getMobile() + + "&openId=" + qingxuetangLoginDTO.getOpenId() + + "×tamp=" + 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 imple userRoleVO.setCompanyId(companyDictDO.getId()); userRoleVO.setCompanyName(companyDictDO.getCompanyName()); userRoleVO.setLogo(companyDictDO.getLogo()); + userRoleVO.setQxyStatus(companyDictDO.getQxyStatus()); List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() .lambda() .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); @@ -577,7 +590,7 @@ public class MemberServiceImpl extends ServiceImpl 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 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 imple //鉴权逻辑 对不对 String preAuthen = "appId=9a79cda9ef6f4a52a8" - +"&authCorpName="+ qingxuetangLoginDTO.getAuthCorpName() - +"&mobile="+qingxuetangLoginDTO.getMobile() - +"&nickname="+qingxuetangLoginDTO.getNickname() - +"×tamp="+qingxuetangLoginDTO.getTimestamp() - +"&appSecret=552a4147db2d4026bc4e9021acd614f8" ; + + "&authCorpName=" + qingxuetangLoginDTO.getAuthCorpName() + + "&mobile=" + qingxuetangLoginDTO.getMobile() + + "&nickname=" + qingxuetangLoginDTO.getNickname() + + "×tamp=" + 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 imple userRoleVO.setCompanyId(companyDictDO.getId()); userRoleVO.setCompanyName(companyDictDO.getCompanyName()); userRoleVO.setLogo(companyDictDO.getLogo()); + userRoleVO.setQxyStatus(companyDictDO.getQxyStatus()); List rotationImgDictDOS = rotationImgDictMapper.selectList(new QueryWrapper() .lambda() .eq(RotationImgDictDO::getCompanyId, companyDictDO.getId())); @@ -954,4 +968,45 @@ public class MemberServiceImpl extends ServiceImpl 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(); + } } diff --git a/src/main/java/com/subsidy/util/ResultMode.java b/src/main/java/com/subsidy/util/ResultMode.java new file mode 100644 index 0000000..91c758b --- /dev/null +++ b/src/main/java/com/subsidy/util/ResultMode.java @@ -0,0 +1,56 @@ +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; + } +} diff --git a/src/main/java/com/subsidy/util/SecretUtils.java b/src/main/java/com/subsidy/util/SecretUtils.java index 0796f3c..ce402ff 100644 --- a/src/main/java/com/subsidy/util/SecretUtils.java +++ b/src/main/java/com/subsidy/util/SecretUtils.java @@ -1,10 +1,13 @@ 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) { diff --git a/src/main/java/com/subsidy/util/websocket/ChatEndPoint.java b/src/main/java/com/subsidy/util/websocket/ChatEndPoint.java new file mode 100644 index 0000000..20f907f --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/ChatEndPoint.java @@ -0,0 +1,128 @@ +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 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 set = onlineUsers.keySet(); + for (String user : set){ + ChatEndPoint chatEndPoint = onlineUsers.get(user); + chatEndPoint.session.getBasicRemote().sendText(message); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + + private Set 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); + } + + +} diff --git a/src/main/java/com/subsidy/util/websocket/GetHttpSessionConfigurator.java b/src/main/java/com/subsidy/util/websocket/GetHttpSessionConfigurator.java new file mode 100644 index 0000000..ec1477a --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/GetHttpSessionConfigurator.java @@ -0,0 +1,18 @@ +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); + } +} diff --git a/src/main/java/com/subsidy/util/websocket/Message.java b/src/main/java/com/subsidy/util/websocket/Message.java new file mode 100644 index 0000000..f5f90fa --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/Message.java @@ -0,0 +1,15 @@ +package com.subsidy.util.websocket; + +import lombok.Data; + +/** + * 浏览器给服务端发的websocket数据 + */ +@Data +public class Message { + + private String toName; + + private String message; + +} diff --git a/src/main/java/com/subsidy/util/websocket/MessageUtils.java b/src/main/java/com/subsidy/util/websocket/MessageUtils.java new file mode 100644 index 0000000..ae886c7 --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/MessageUtils.java @@ -0,0 +1,29 @@ +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; + } + + +} diff --git a/src/main/java/com/subsidy/util/websocket/Result.java b/src/main/java/com/subsidy/util/websocket/Result.java new file mode 100644 index 0000000..5e980a2 --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/Result.java @@ -0,0 +1,15 @@ +package com.subsidy.util.websocket; + +import lombok.Data; + +/** + * 登陆响应给浏览器的数据 + */ +@Data +public class Result { + + private Boolean flag; + + private String message; + +} diff --git a/src/main/java/com/subsidy/util/websocket/ResultMessage.java b/src/main/java/com/subsidy/util/websocket/ResultMessage.java new file mode 100644 index 0000000..f106d90 --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/ResultMessage.java @@ -0,0 +1,18 @@ +package com.subsidy.util.websocket; + +import lombok.Data; + +/** + * 服务端发送给浏览器的websocket数据 + */ +@Data +public class ResultMessage { + + private Boolean isSystem; + + private String fromName; + + private Object message; //系统消息的话就是数组 + + +} diff --git a/src/main/java/com/subsidy/util/websocket/WebsocketConfig.java b/src/main/java/com/subsidy/util/websocket/WebsocketConfig.java new file mode 100644 index 0000000..f640b93 --- /dev/null +++ b/src/main/java/com/subsidy/util/websocket/WebsocketConfig.java @@ -0,0 +1,20 @@ +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(); + } + + +} diff --git a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java index cd47047..7d7f6a9 100644 --- a/src/main/java/com/subsidy/vo/administer/UserRoleVO.java +++ b/src/main/java/com/subsidy/vo/administer/UserRoleVO.java @@ -24,6 +24,8 @@ public class UserRoleVO { private String companyName; + private Boolean qxyStatus; + private Long companyId; private String logo; diff --git a/src/main/java/com/subsidy/vo/cert/GetListVO.java b/src/main/java/com/subsidy/vo/cert/GetListVO.java index 4d7a00a..7cecb91 100644 --- a/src/main/java/com/subsidy/vo/cert/GetListVO.java +++ b/src/main/java/com/subsidy/vo/cert/GetListVO.java @@ -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; } diff --git a/src/main/java/com/subsidy/vo/cert/GetOneCertVO.java b/src/main/java/com/subsidy/vo/cert/GetOneCertVO.java index a7225c7..6806288 100644 --- a/src/main/java/com/subsidy/vo/cert/GetOneCertVO.java +++ b/src/main/java/com/subsidy/vo/cert/GetOneCertVO.java @@ -11,4 +11,6 @@ public class GetOneCertVO extends CertDictDO { private List certTypeDictDOS; + private Boolean status; + } diff --git a/src/main/java/com/subsidy/vo/cert/GetSignInfoVO.java b/src/main/java/com/subsidy/vo/cert/GetSignInfoVO.java index 7fb3892..37a7e59 100644 --- a/src/main/java/com/subsidy/vo/cert/GetSignInfoVO.java +++ b/src/main/java/com/subsidy/vo/cert/GetSignInfoVO.java @@ -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; } diff --git a/src/main/java/com/subsidy/vo/member/MemberVO.java b/src/main/java/com/subsidy/vo/member/MemberVO.java index 968bf17..e005c1e 100644 --- a/src/main/java/com/subsidy/vo/member/MemberVO.java +++ b/src/main/java/com/subsidy/vo/member/MemberVO.java @@ -24,6 +24,8 @@ public class MemberVO { private Long companyId; + private Boolean qxyStatus; + private String logo; private List rotationImgDictDOS; diff --git a/src/main/java/com/subsidy/vo/member/MyCoursesVO.java b/src/main/java/com/subsidy/vo/member/MyCoursesVO.java index 1b5acee..79cad1d 100644 --- a/src/main/java/com/subsidy/vo/member/MyCoursesVO.java +++ b/src/main/java/com/subsidy/vo/member/MyCoursesVO.java @@ -16,6 +16,8 @@ public class MyCoursesVO { private String courseName; + private String startDate; + private String endDate; private Integer totalCnt; diff --git a/src/main/java/com/subsidy/vo/member/QxyVO.java b/src/main/java/com/subsidy/vo/member/QxyVO.java new file mode 100644 index 0000000..999923b --- /dev/null +++ b/src/main/java/com/subsidy/vo/member/QxyVO.java @@ -0,0 +1,10 @@ +package com.subsidy.vo.member; + +import lombok.Data; + +@Data +public class QxyVO { + + private String token; + +} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 74a1306..3307c09 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -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 diff --git a/src/main/resources/application-prod.properties b/src/main/resources/application-prod.properties index eb13e2d..83b8ad2 100644 --- a/src/main/resources/application-prod.properties +++ b/src/main/resources/application-prod.properties @@ -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 diff --git a/src/main/resources/mapper/CertCompanyMappingMapper.xml b/src/main/resources/mapper/CertCompanyMappingMapper.xml index 927079c..c5832c2 100644 --- a/src/main/resources/mapper/CertCompanyMappingMapper.xml +++ b/src/main/resources/mapper/CertCompanyMappingMapper.xml @@ -22,19 +22,20 @@ 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} + + diff --git a/src/main/resources/mapper/MemberMapper.xml b/src/main/resources/mapper/MemberMapper.xml index b3cba79..acdfca3 100644 --- a/src/main/resources/mapper/MemberMapper.xml +++ b/src/main/resources/mapper/MemberMapper.xml @@ -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, diff --git a/src/main/resources/mapper/OprAdmDictMapper.xml b/src/main/resources/mapper/OprAdmDictMapper.xml index aeccd0c..eba47cb 100644 --- a/src/main/resources/mapper/OprAdmDictMapper.xml +++ b/src/main/resources/mapper/OprAdmDictMapper.xml @@ -20,10 +20,6 @@ id, user_id, opr_type - - delete from opr_adm_dict - where id = #{id} - SELECT