Compare commits
6 Commits
bc77718110
...
fb9a01a958
Author | SHA1 | Date |
---|---|---|
|
fb9a01a958 | |
|
c545e129ab | |
|
bb50f5a2b9 | |
|
2c07292727 | |
|
04dc67459d | |
|
9d9d3aa146 |
|
@ -1,6 +1,7 @@
|
|||
package doctor.system.api;
|
||||
|
||||
import doctor.common.core.constant.ServiceNameConstants;
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.system.api.factory.RemoteDoctorFallbackFactory;
|
||||
import doctor.system.api.model.LoginUser;
|
||||
|
@ -8,11 +9,11 @@ import org.springframework.cloud.openfeign.FeignClient;
|
|||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallback = RemoteDoctorFallbackFactory.class)
|
||||
@FeignClient(contextId = "remoteDoctorService", value = ServiceNameConstants.FILE_DOCTOR, fallbackFactory = RemoteDoctorFallbackFactory.class)
|
||||
public interface RemoteDoctorService {
|
||||
|
||||
@PostMapping("/doctor/getDoctor")
|
||||
public R<LoginUser> getDoctorInfo(@RequestParam("email") String email);
|
||||
public R<LoginUser> getDoctorInfo(@RequestParam("email") String email);
|
||||
|
||||
@PostMapping("/doctor/getUser")
|
||||
public R<LoginUser> getUser(@RequestParam("email") String email);
|
||||
|
|
|
@ -12,7 +12,7 @@ public class Doctor {
|
|||
private String userName;
|
||||
private Integer reviewStatus;
|
||||
private String phone;
|
||||
private String password;
|
||||
private String pwd;
|
||||
private String name;
|
||||
private String imagePic;
|
||||
private String jobTitle;
|
||||
|
@ -20,6 +20,10 @@ public class Doctor {
|
|||
private String personalProfile;
|
||||
private String goodField;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
private Department department;
|
||||
|
||||
public Department getDepartment() {
|
||||
|
@ -30,10 +34,6 @@ public class Doctor {
|
|||
this.department = department;
|
||||
}
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -82,12 +82,12 @@ public class Doctor {
|
|||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
public void setPwd(String password) {
|
||||
this.pwd = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -20,8 +20,8 @@ public class User {
|
|||
private String headPic;
|
||||
private Integer sex;
|
||||
private Integer age;
|
||||
private String height;
|
||||
private String weight;
|
||||
private Integer height;
|
||||
private Integer weight;
|
||||
private String invitationCode;
|
||||
private Date updateTime;
|
||||
private Long createTime;
|
||||
|
@ -98,19 +98,19 @@ public class User {
|
|||
this.age = age;
|
||||
}
|
||||
|
||||
public String getHeight() {
|
||||
public Integer getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(String height) {
|
||||
public void setHeight(Integer height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
public Integer getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
public void setWeight(Integer weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
|
@ -130,11 +130,11 @@ public class User {
|
|||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
public long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
public void setCreateTime(long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,45 +1,34 @@
|
|||
package doctor.system.api.factory;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.system.api.RemoteDoctorService;
|
||||
import doctor.system.api.model.LoginUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class RemoteDoctorFallbackFactory implements RemoteDoctorService {
|
||||
public class RemoteDoctorFallbackFactory implements FallbackFactory<RemoteDoctorService> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteDoctorFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public R<LoginUser> getDoctorInfo(String email) {
|
||||
log.error("文件服务调用失败");
|
||||
return R.fail("登录超时");
|
||||
}
|
||||
public RemoteDoctorService create(Throwable throwable)
|
||||
{
|
||||
log.error("文件服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteDoctorService() {
|
||||
@Override
|
||||
public R<LoginUser> getDoctorInfo(String email) {
|
||||
return R.fail("登录失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<LoginUser> getUser(String email) {
|
||||
log.error("文件服务调用失败");
|
||||
return R.fail("登录超时");
|
||||
}
|
||||
@Override
|
||||
public R<LoginUser> getUser(String email) {
|
||||
return R.fail("登录失败");
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public RemoteDoctorService create(Throwable throwable)
|
||||
// {
|
||||
// log.error("文件服务调用失败:{}", throwable.getMessage());
|
||||
// return new RemoteDoctorService() {
|
||||
// @Override
|
||||
// public R<LoginUser> getDoctorInfo(String email) {
|
||||
// return R.fail("登录超时");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public R<LoginUser> getUser(String email) {
|
||||
// return R.fail("登录失败");
|
||||
// }
|
||||
//
|
||||
//
|
||||
// };
|
||||
// }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package doctor.auth.service;
|
|||
import doctor.auth.util.RSAUtils;
|
||||
import doctor.auth.util.RsaKey;
|
||||
import doctor.auth.vo.DoctorVo;
|
||||
import doctor.auth.vo.UserVo;
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.common.security.service.TokenService;
|
||||
import doctor.system.api.RemoteDoctorService;
|
||||
|
@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Component
|
||||
public class HealthDoctorService {
|
||||
|
@ -31,7 +30,7 @@ public class HealthDoctorService {
|
|||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (s.equals(data.getSysUser().getPassword())){
|
||||
if (s.equals(data.getDoctor().getPwd())){
|
||||
Map<String, Object> token = tokenService.createToken(data);
|
||||
String accessToken = (String) token.get("access_token");
|
||||
doctorVo.setSessionId(accessToken);
|
||||
|
|
|
@ -44,8 +44,8 @@ public class HealthUserService {
|
|||
doctorUserVo.setJiGuangPwd(s);
|
||||
doctorUserVo.setHeadPic(data.getUser().getHeadPic());
|
||||
doctorUserVo.setSex(data.getUser().getSex());
|
||||
doctorUserVo.setHeight(Integer.valueOf(data.getUser().getHeight()));
|
||||
doctorUserVo.setWeight(Integer.valueOf(data.getUser().getWeight()));
|
||||
doctorUserVo.setHeight(data.getUser().getHeight());
|
||||
doctorUserVo.setWeight(data.getUser().getWeight());
|
||||
doctorUserVo.setFaceFlag(1);
|
||||
UUID uuid = UUID.randomUUID();
|
||||
String inviteCode = uuid.toString().replaceAll("-", "").substring(0, 8);
|
||||
|
@ -55,5 +55,4 @@ public class HealthUserService {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Tomcat
|
||||
server:
|
||||
server:
|
||||
port: 9200
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: doctor-auth
|
||||
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -113,6 +113,15 @@
|
|||
<artifactId>swagger-annotations</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.30</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -51,11 +51,6 @@ public class Constants
|
|||
* 成功标记
|
||||
*/
|
||||
public static final Integer SUCCESS = 200;
|
||||
/**
|
||||
* 维度健康成功标识
|
||||
*/
|
||||
public static final String SUCCESS_HEALTH = "0000";
|
||||
public static final String FAIL_HEALTH = "9001";
|
||||
|
||||
/**
|
||||
* 失败标记
|
||||
|
|
|
@ -16,5 +16,4 @@ import doctor.common.swagger.config.SwaggerAutoConfiguration;
|
|||
@Import({ SwaggerAutoConfiguration.class })
|
||||
public @interface EnableCustomSwagger2
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -84,6 +84,11 @@
|
|||
<artifactId>doctor-api-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.domain.entity.DepartmentEntity;
|
||||
import doctor.service.HealthDepartmentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/knowledgeBase/v1")
|
||||
public class HealthDepartmentController {
|
||||
|
||||
@Autowired
|
||||
private HealthDepartmentService healthV1Service;
|
||||
|
||||
@GetMapping("/findDepartment")
|
||||
public HealthR<List<DepartmentEntity>> findDepartment(){
|
||||
List<DepartmentEntity> departmentEntities=healthV1Service.findDepartment();
|
||||
return HealthR.ok(departmentEntities);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.domain.dto.ApplyJoinDto;
|
||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||
import doctor.service.HealthJobTitleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/v1")
|
||||
public class HealthJobTitleController {
|
||||
@Autowired
|
||||
private HealthJobTitleService healthJobTitleService;
|
||||
|
||||
@GetMapping("/findJobTitleList")
|
||||
public HealthR<List<DoctorJobTitleEntity>> findJobTitleList() {
|
||||
List<DoctorJobTitleEntity> doctorJobTitleEntities=healthJobTitleService.findJobTitleList();
|
||||
return HealthR.ok(doctorJobTitleEntities);
|
||||
}
|
||||
|
||||
@PostMapping("/sendEmailCode")
|
||||
public HealthR sendEmailCode(@RequestParam("email") String email) {
|
||||
HealthR healthR= healthJobTitleService.sendEmailCode(email);
|
||||
return HealthR.ok(healthR);
|
||||
}
|
||||
|
||||
@PostMapping("/applyJoin")
|
||||
public HealthR applyJoin(@RequestBody ApplyJoinDto applyJoinDto) {
|
||||
HealthR healthR= healthJobTitleService.applyJoin(applyJoinDto);
|
||||
return HealthR.ok(healthR);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package doctor.controller;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.system.api.domain.Doctor;
|
||||
import doctor.service.DoctorUserService;
|
||||
|
@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
@RestController
|
||||
@RequestMapping("/doctor")
|
||||
@DS("master")
|
||||
public class HealthLoginController {
|
||||
|
||||
@Autowired
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package doctor.controller;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.DoctorUser;
|
||||
import doctor.service.IDoctorUserService;
|
||||
import doctor.system.api.domain.SysUser;
|
||||
import doctor.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/doctor")
|
||||
@DS("master")
|
||||
public class SysDoctorController {
|
||||
|
||||
@Autowired
|
||||
private IDoctorUserService iDoctorUserService;
|
||||
|
||||
@PostMapping("/getUser")
|
||||
public R<LoginUser> getUser(String email) {
|
||||
DoctorUser user = iDoctorUserService.getUser(email);
|
||||
LoginUser loginUser = new LoginUser();
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(Long.valueOf(user.getId()));
|
||||
sysUser.setNickName(user.getNickName());
|
||||
sysUser.setUserName(user.getUserName());
|
||||
sysUser.setPhonenumber(user.getPhone());
|
||||
sysUser.setPassword(user.getPwd());
|
||||
if (user.getSex()==0){
|
||||
sysUser.setSex("男");
|
||||
}else {
|
||||
sysUser.setSex("女");
|
||||
}
|
||||
loginUser.setSysUser(sysUser);
|
||||
return R.ok(loginUser);
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package doctor.controller;
|
||||
|
||||
import doctor.common.core.domain.R;
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import doctor.service.UserVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
@ -24,8 +24,8 @@ public class UserVideoController {
|
|||
|
||||
//用户视频收藏列表
|
||||
@GetMapping("/findVideoCollectionList")
|
||||
public R<List<UserVideoCollection>>findVideoCollectionList(){
|
||||
List<UserVideoCollection> userVideoCollectionList =userVideoService.findVideoCollectionList();
|
||||
public R<List<UserVideoCollectionEntity>>findVideoCollectionList(){
|
||||
List<UserVideoCollectionEntity> userVideoCollectionList =userVideoService.findVideoCollectionList();
|
||||
return R.ok(userVideoCollectionList);
|
||||
}
|
||||
//用户取消视频收藏
|
||||
|
@ -36,8 +36,8 @@ public class UserVideoController {
|
|||
}
|
||||
//用户购买视频列表
|
||||
@GetMapping("/findUserVideoBuyList")
|
||||
public R<List<UserVideoBuy>>findUserVideoBuyList(){
|
||||
List<UserVideoBuy> userVideoBuys =userVideoService.findUserVideoBuyList();
|
||||
public R<List<UserVideoBuyEntity>>findUserVideoBuyList(){
|
||||
List<UserVideoBuyEntity> userVideoBuys =userVideoService.findUserVideoBuyList();
|
||||
return R.ok(userVideoBuys);
|
||||
}
|
||||
//用户删除购买的视频
|
||||
|
@ -49,8 +49,8 @@ public class UserVideoController {
|
|||
|
||||
//我的钱包
|
||||
@GetMapping("/findUserWallet")
|
||||
public R<List<UserWallet>> findUserWallet(){
|
||||
List<UserWallet> userWallets = userVideoService.findUserWallet();
|
||||
public R<List<UserWalletEntity>> findUserWallet(){
|
||||
List<UserWalletEntity> userWallets = userVideoService.findUserWallet();
|
||||
return R.ok(userWallets);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ public class VideoController {
|
|||
private VideoService videoService;
|
||||
//收藏健康讲堂视频列表
|
||||
@PostMapping("/verify/v1/addUserVideoCollection")
|
||||
public R addUserVideoCollection(@RequestBody UserVideoCollection userVideoCollection){
|
||||
public R addUserVideoCollection(@RequestBody UserVideoCollectionEntity userVideoCollection){
|
||||
videoService.addUserVideoCollection(userVideoCollection);
|
||||
return R.ok();
|
||||
}
|
||||
//购买健康讲堂视频
|
||||
@PostMapping("/verify/v1/videoBuy")
|
||||
public R videoBuy(@RequestBody UserVideoBuy userVideoBuy){
|
||||
public R videoBuy(@RequestBody UserVideoBuyEntity userVideoBuy){
|
||||
videoService.videoBuy(userVideoBuy);
|
||||
return R.ok();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
package doctor.domain.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ApplyJoinDto {
|
||||
private String email;
|
||||
private String code;
|
||||
private String pwd1;
|
||||
private String pwd2;
|
||||
private String name;
|
||||
private String inauguralHospital;
|
||||
private Integer departmentId;
|
||||
private Integer jobTitleId;
|
||||
private String personalProfile;
|
||||
private String goodFieId;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class DepartmentEntity {
|
||||
private Integer id;
|
||||
|
||||
private String departmentName;
|
||||
|
||||
private String pic;
|
||||
|
||||
private Integer rank;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@Data
|
||||
public class DoctorJobTitleEntity {
|
||||
|
||||
private Integer id;
|
||||
|
||||
|
||||
private String jobTitle;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
|
@ -1,9 +1,8 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import java.security.Timestamp;
|
||||
import java.util.Date;
|
||||
|
||||
public class DoctorUser {
|
||||
public class DoctorUserEntity {
|
||||
|
||||
private int id;
|
||||
private String phone;
|
|
@ -1,140 +0,0 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : User
|
||||
* @Description : 用户表
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 20:46
|
||||
*/
|
||||
public class User {
|
||||
private Integer id;
|
||||
private String phone;
|
||||
private String pwd;
|
||||
private String email;
|
||||
private String nickName;
|
||||
private String userName;
|
||||
private String headPic;
|
||||
private Integer sex;
|
||||
private Integer age;
|
||||
private String height;
|
||||
private String weight;
|
||||
private String invitationCode;
|
||||
private Date updateTime;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPwd(String pwd) {
|
||||
this.pwd = pwd;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getHeadPic() {
|
||||
return headPic;
|
||||
}
|
||||
|
||||
public void setHeadPic(String headPic) {
|
||||
this.headPic = headPic;
|
||||
}
|
||||
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public Integer getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
public void setAge(Integer age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
public String getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(String height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public String getInvitationCode() {
|
||||
return invitationCode;
|
||||
}
|
||||
|
||||
public void setInvitationCode(String invitationCode) {
|
||||
this.invitationCode = invitationCode;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
|
@ -6,7 +6,7 @@ package doctor.domain.entity;
|
|||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:20
|
||||
*/
|
||||
public class UserVideoBuy {
|
||||
public class UserVideoBuyEntity {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
|
@ -44,13 +44,13 @@ public class UserVideoBuy {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoBuy(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
public UserVideoBuyEntity(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.videoId = videoId;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoBuy() {
|
||||
public UserVideoBuyEntity() {
|
||||
}
|
||||
}
|
|
@ -1,10 +1,5 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import io.swagger.models.auth.In;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : UserVideoCollection
|
||||
* @Description : 用户视频收藏表
|
||||
|
@ -12,7 +7,7 @@ import java.util.Date;
|
|||
* @Date: 2024-01-10 14:28
|
||||
*/
|
||||
|
||||
public class UserVideoCollection {
|
||||
public class UserVideoCollectionEntity {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer videoId;
|
||||
|
@ -50,13 +45,13 @@ public class UserVideoCollection {
|
|||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoCollection(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
public UserVideoCollectionEntity(Integer id, Integer userId, Integer videoId, Long createTime) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.videoId = videoId;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public UserVideoCollection() {
|
||||
public UserVideoCollectionEntity() {
|
||||
}
|
||||
}
|
|
@ -1,16 +1,12 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : UserWallet
|
||||
* @Description : 用户钱包
|
||||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 20:30
|
||||
*/
|
||||
public class UserWallet {
|
||||
public class UserWalletEntity {
|
||||
private Integer id;
|
||||
private Integer userId;
|
||||
private Integer balance;
|
|
@ -1,5 +1,6 @@
|
|||
package doctor.domain.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -10,6 +11,7 @@ import java.util.Date;
|
|||
* @Author : FJJ
|
||||
* @Date: 2024-01-10 15:59
|
||||
*/
|
||||
@Data
|
||||
public class Video {
|
||||
private Integer id;
|
||||
private String title;
|
||||
|
@ -21,90 +23,4 @@ public class Video {
|
|||
private Integer price;
|
||||
private Long createTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Integer getCategoryId() {
|
||||
return categoryId;
|
||||
}
|
||||
|
||||
public void setCategoryId(Integer categoryId) {
|
||||
this.categoryId = categoryId;
|
||||
}
|
||||
|
||||
public String getShearUrl() {
|
||||
return shearUrl;
|
||||
}
|
||||
|
||||
public void setShearUrl(String shearUrl) {
|
||||
this.shearUrl = shearUrl;
|
||||
}
|
||||
|
||||
public String getAbstracts() {
|
||||
return abstracts;
|
||||
}
|
||||
|
||||
public void setAbstracts(String abstracts) {
|
||||
this.abstracts = abstracts;
|
||||
}
|
||||
|
||||
public String getOriginalUrl() {
|
||||
return originalUrl;
|
||||
}
|
||||
|
||||
public void setOriginalUrl(String originalUrl) {
|
||||
this.originalUrl = originalUrl;
|
||||
}
|
||||
|
||||
public Integer getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(Integer duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public Integer getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(Integer price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public Long getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Long createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Video(Integer id, String title, Integer categoryId, String shearUrl, String abstracts, String originalUrl, Integer duration, Integer price, Long createTime) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.categoryId = categoryId;
|
||||
this.shearUrl = shearUrl;
|
||||
this.abstracts = abstracts;
|
||||
this.originalUrl = originalUrl;
|
||||
this.duration = duration;
|
||||
this.price = price;
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public Video() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,10 @@ package doctor.mapper;
|
|||
import doctor.system.api.domain.Department;
|
||||
import doctor.system.api.domain.Doctor;
|
||||
import doctor.system.api.domain.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@MapperScan
|
||||
@Mapper
|
||||
public interface DoctorUserMapper {
|
||||
User selectUserByEmail(@Param("email") String email);
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.DepartmentEntity;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@MapperScan
|
||||
public interface HealthDepartmentMapper {
|
||||
List<DepartmentEntity> findDepartments();
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||
import doctor.system.api.domain.Doctor;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface HealthJobTitleMapper {
|
||||
List<DoctorJobTitleEntity> findJobTitleList();
|
||||
|
||||
void insertDoctor(Doctor doctor);
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.DoctorUser;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
@MapperScan
|
||||
public interface IDoctorUserMapper {
|
||||
DoctorUser selectDoctorUserByEmail(@Param("email") String email);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package doctor.mapper;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -16,13 +16,13 @@ import java.util.List;
|
|||
*/
|
||||
@Mapper
|
||||
public interface UserVideoMapper {
|
||||
List<UserVideoCollection> findVideoCollectionList();
|
||||
List<UserVideoCollectionEntity> findVideoCollectionList();
|
||||
|
||||
void cancelVideoCollection(@Param("id") Integer id);
|
||||
|
||||
List<UserVideoBuy> findUserVideoBuyList();
|
||||
List<UserVideoBuyEntity> findUserVideoBuyList();
|
||||
|
||||
void deleteVideoBuy(@Param("id") Integer id);
|
||||
|
||||
List<UserWallet> findUserWallet();
|
||||
List<UserWalletEntity> findUserWallet();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import java.util.List;
|
|||
public interface VideoMapper {
|
||||
|
||||
|
||||
void addUserVideoCollection(UserVideoCollection userVideoCollection);
|
||||
void addUserVideoCollection(UserVideoCollectionEntity userVideoCollection);
|
||||
|
||||
Video findById(@Param("videoId") Integer videoId);
|
||||
|
||||
|
@ -24,9 +24,9 @@ public interface VideoMapper {
|
|||
|
||||
void updateVideoCount(VideoCount videoCount);
|
||||
|
||||
User FindById(@Param("userId") Integer userId);
|
||||
UserEntity FindById(@Param("userId") Integer userId);
|
||||
|
||||
UserWallet FindUserWallet(@Param("id") Integer id);
|
||||
UserWalletEntity FindUserWallet(@Param("id") Integer id);
|
||||
|
||||
Video findByVideoId(@Param("videoId") Integer videoId);
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.DepartmentEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HealthDepartmentService {
|
||||
List<DepartmentEntity> findDepartment();
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.domain.dto.ApplyJoinDto;
|
||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface HealthJobTitleService {
|
||||
List<DoctorJobTitleEntity> findJobTitleList();
|
||||
|
||||
HealthR sendEmailCode(String email);
|
||||
|
||||
HealthR applyJoin(ApplyJoinDto applyJoinDto);
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.DoctorUser;
|
||||
import doctor.system.api.model.LoginUser;
|
||||
|
||||
public interface IDoctorUserService {
|
||||
DoctorUser getUser(String email);
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package doctor.service;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -13,13 +13,13 @@ import java.util.List;
|
|||
* @Date: 2024-01-10 14:33
|
||||
*/
|
||||
public interface UserVideoService {
|
||||
List<UserVideoCollection> findVideoCollectionList();
|
||||
List<UserVideoCollectionEntity> findVideoCollectionList();
|
||||
|
||||
void cancelVideoCollection(Integer id);
|
||||
|
||||
List<UserVideoBuy> findUserVideoBuyList();
|
||||
List<UserVideoBuyEntity> findUserVideoBuyList();
|
||||
|
||||
void deleteVideoBuy(Integer id);
|
||||
|
||||
List<UserWallet> findUserWallet();
|
||||
List<UserWalletEntity> findUserWallet();
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ import java.util.List;
|
|||
*/
|
||||
public interface VideoService {
|
||||
|
||||
void addUserVideoCollection(UserVideoCollection userVideoCollection);
|
||||
void addUserVideoCollection(UserVideoCollectionEntity userVideoCollection);
|
||||
|
||||
|
||||
void videoBuy(UserVideoBuy userVideoBuy);
|
||||
void videoBuy(UserVideoBuyEntity userVideoBuy);
|
||||
|
||||
List<VideoComment> findVideoCommentList();
|
||||
}
|
||||
|
|
|
@ -26,4 +26,5 @@ public class DoctorUserServiceImpl implements DoctorUserService {
|
|||
doctor.setDepartment(department);
|
||||
return doctor;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.domain.entity.DepartmentEntity;
|
||||
import doctor.mapper.HealthDepartmentMapper;
|
||||
import doctor.service.HealthDepartmentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class HealthDepartmentServiceImpl implements HealthDepartmentService {
|
||||
@Autowired
|
||||
private HealthDepartmentMapper healthV1Mapper;
|
||||
|
||||
@Override
|
||||
public List<DepartmentEntity> findDepartment() {
|
||||
return healthV1Mapper.findDepartments();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.common.core.domain.HealthR;
|
||||
import doctor.domain.dto.ApplyJoinDto;
|
||||
import doctor.domain.entity.DoctorJobTitleEntity;
|
||||
import doctor.mapper.HealthJobTitleMapper;
|
||||
import doctor.service.HealthJobTitleService;
|
||||
import doctor.system.api.domain.Doctor;
|
||||
import doctor.util.RSAUtils;
|
||||
import doctor.util.RsaKey;
|
||||
import doctor.util.SendEmail;
|
||||
import org.bouncycastle.jcajce.provider.asymmetric.rsa.RSAUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Service
|
||||
public class HealthJobTitleServiceImpl implements HealthJobTitleService {
|
||||
@Autowired
|
||||
private HealthJobTitleMapper healthJobTitleMapper;
|
||||
@Autowired
|
||||
private SendEmail sendEmail;
|
||||
@Resource
|
||||
private RedisTemplate<String,Integer> redisTemplate;
|
||||
|
||||
@Override
|
||||
public List<DoctorJobTitleEntity> findJobTitleList() {
|
||||
return healthJobTitleMapper.findJobTitleList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HealthR sendEmailCode(String email) {
|
||||
if (!redisTemplate.hasKey(email)){
|
||||
Integer integer = redisTemplate.opsForValue().get(email);
|
||||
sendEmail.sendEmail(email,integer);
|
||||
}
|
||||
if (email==null){
|
||||
return HealthR.fail();
|
||||
}
|
||||
Integer code=0;
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int i1 = random.nextInt();
|
||||
code=i+=i1;
|
||||
}
|
||||
sendEmail.sendEmail(email,code);
|
||||
redisTemplate.opsForValue().set(email,code,2, TimeUnit.MINUTES);
|
||||
return HealthR.ok();
|
||||
}
|
||||
|
||||
@Override
|
||||
public HealthR applyJoin(ApplyJoinDto applyJoinDto) {
|
||||
if (applyJoinDto==null){
|
||||
return HealthR.fail("参数为空");
|
||||
}
|
||||
String s="";
|
||||
try {
|
||||
s= RSAUtils.rsaDecrypt(applyJoinDto.getPwd1(), RsaKey.PRIVATE_KEY);
|
||||
String s2 = RSAUtils.rsaDecrypt(applyJoinDto.getPwd2(), RsaKey.PRIVATE_KEY);
|
||||
if (!s.equals(s2)){
|
||||
return HealthR.fail("请输入相同的密码");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (!redisTemplate.hasKey(applyJoinDto.getEmail())){
|
||||
return HealthR.fail("验证码过去请重新发送");
|
||||
}
|
||||
Integer integer = redisTemplate.opsForValue().get(applyJoinDto.getEmail());
|
||||
if (!String.valueOf(integer).equals(applyJoinDto.getCode())){
|
||||
return HealthR.fail("验车码错误");
|
||||
}
|
||||
Doctor doctor = new Doctor();
|
||||
BeanUtils.copyProperties(applyJoinDto,doctor);
|
||||
doctor.setCreateTime(new Date());
|
||||
healthJobTitleMapper.insertDoctor(doctor);
|
||||
redisTemplate.delete(applyJoinDto.getEmail());
|
||||
return HealthR.ok();
|
||||
}
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.mapper.IDoctorUserMapper;
|
||||
import doctor.domain.entity.DoctorUser;
|
||||
import doctor.service.IDoctorUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class IDoctorUserServiceImpl implements IDoctorUserService {
|
||||
@Autowired
|
||||
private IDoctorUserMapper iDoctorUserMapper;
|
||||
|
||||
@Override
|
||||
public DoctorUser getUser(String email) {
|
||||
DoctorUser doctorUser = iDoctorUserMapper.selectDoctorUserByEmail(email);
|
||||
return doctorUser;
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package doctor.service.impl;
|
||||
|
||||
import doctor.domain.entity.UserVideoBuy;
|
||||
import doctor.domain.entity.UserVideoCollection;
|
||||
import doctor.domain.entity.UserWallet;
|
||||
import doctor.domain.entity.UserVideoBuyEntity;
|
||||
import doctor.domain.entity.UserVideoCollectionEntity;
|
||||
import doctor.domain.entity.UserWalletEntity;
|
||||
import doctor.mapper.UserVideoMapper;
|
||||
import doctor.service.UserVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -21,7 +21,7 @@ public class UserVideoServiceImpl implements UserVideoService {
|
|||
@Autowired
|
||||
private UserVideoMapper userVideoMapper;
|
||||
@Override
|
||||
public List<UserVideoCollection> findVideoCollectionList() {
|
||||
public List<UserVideoCollectionEntity> findVideoCollectionList() {
|
||||
return userVideoMapper.findVideoCollectionList();
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class UserVideoServiceImpl implements UserVideoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserVideoBuy> findUserVideoBuyList() {
|
||||
public List<UserVideoBuyEntity> findUserVideoBuyList() {
|
||||
return userVideoMapper.findUserVideoBuyList();
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class UserVideoServiceImpl implements UserVideoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UserWallet> findUserWallet() {
|
||||
public List<UserWalletEntity> findUserWallet() {
|
||||
return userVideoMapper.findUserWallet();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ public class VideoServiceImpl implements VideoService {
|
|||
private VideoMapper videoMapper;
|
||||
|
||||
@Override
|
||||
public void addUserVideoCollection(UserVideoCollection userVideoCollection) {
|
||||
public void addUserVideoCollection(UserVideoCollectionEntity userVideoCollection) {
|
||||
// 添加收藏
|
||||
videoMapper.addUserVideoCollection(userVideoCollection);
|
||||
// 更新视频收藏数
|
||||
|
@ -30,13 +30,13 @@ public class VideoServiceImpl implements VideoService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void videoBuy(UserVideoBuy userVideoBuy) {
|
||||
public void videoBuy(UserVideoBuyEntity userVideoBuy) {
|
||||
//查询用户信息
|
||||
User user = videoMapper.FindById(userVideoBuy.getUserId());
|
||||
UserEntity user = videoMapper.FindById(userVideoBuy.getUserId());
|
||||
//查询视频信息
|
||||
Video video = videoMapper.findByVideoId(userVideoBuy.getVideoId());
|
||||
//查询用户钱包
|
||||
UserWallet userWallet = videoMapper.FindUserWallet(user.getId());
|
||||
UserWalletEntity userWallet = videoMapper.FindUserWallet(user.getId());
|
||||
//判断用户钱包是否足够
|
||||
if (userWallet.getBalance() >= video.getPrice()) {
|
||||
//更新用户钱包
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
package doctor.util;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import java.security.*;
|
||||
import java.security.interfaces.RSAPrivateKey;
|
||||
import java.security.interfaces.RSAPublicKey;
|
||||
import java.security.spec.InvalidKeySpecException;
|
||||
import java.security.spec.PKCS8EncodedKeySpec;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* RSA工具类 生成秘钥 加解密
|
||||
* @author : WangZhanpeng
|
||||
* @date : 2024/1/9 15:13
|
||||
*/
|
||||
public class RSAUtils {
|
||||
|
||||
|
||||
private static Map<Integer, String> keyMap = new HashMap<Integer, String>();
|
||||
|
||||
public static void getKey() throws NoSuchAlgorithmException {
|
||||
genKeyPair();
|
||||
System.out.println("公钥===:"+keyMap.get(0));
|
||||
System.out.println("私钥===:"+keyMap.get(1));
|
||||
}
|
||||
/**
|
||||
* 随机生成密钥对
|
||||
*
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
public static void genKeyPair() throws NoSuchAlgorithmException {
|
||||
// KeyPairGenerator类用于生成公钥和私钥对,基于RSA算法生成对象
|
||||
KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA");
|
||||
// 初始化密钥对生成器,密钥大小为96-1024位
|
||||
keyPairGen.initialize(1024, new SecureRandom());
|
||||
// 生成一个密钥对,保存在keyPair中
|
||||
KeyPair keyPair = keyPairGen.generateKeyPair();
|
||||
// 得到私钥
|
||||
RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
|
||||
// 得到公钥
|
||||
RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
|
||||
String publicKeyString = new String(Base64.encodeBase64(publicKey.getEncoded()));
|
||||
// 得到私钥字符串
|
||||
String privateKeyString = new String(Base64.encodeBase64((privateKey.getEncoded())));
|
||||
// 将公钥和私钥保存到Map
|
||||
//0表示公钥
|
||||
keyMap.put(0, publicKeyString);
|
||||
//1表示私钥
|
||||
keyMap.put(1, privateKeyString);
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA私钥解密
|
||||
* @param str 解密字符串
|
||||
* @param privateKey 私钥
|
||||
* @return 明文
|
||||
*/
|
||||
public static String rsaDecrypt(String str, String privateKey) throws Exception {
|
||||
//base64编码的私钥
|
||||
byte[] decoded = Base64.decodeBase64(privateKey);
|
||||
RSAPrivateKey priKey = (RSAPrivateKey) KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(decoded));
|
||||
//RSA解密
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.DECRYPT_MODE, priKey);
|
||||
byte[] inputArray = Base64.decodeBase64(str.getBytes("UTF-8"));
|
||||
int inputLength = inputArray.length;
|
||||
// 最大加密字节数,超出最大字节数需要分组加密
|
||||
int MAX_ENCRYPT_BLOCK = 128;
|
||||
// 标识
|
||||
int offSet = 0;
|
||||
byte[] resultBytes = {};
|
||||
byte[] cache;
|
||||
while (inputLength - offSet > 0) {
|
||||
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
|
||||
offSet += MAX_ENCRYPT_BLOCK;
|
||||
} else {
|
||||
cache = cipher.doFinal(inputArray, offSet, inputLength - offSet);
|
||||
offSet = inputLength;
|
||||
}
|
||||
resultBytes = Arrays.copyOf(resultBytes, resultBytes.length + cache.length);
|
||||
System.arraycopy(cache, 0, resultBytes, resultBytes.length - cache.length, cache.length);
|
||||
}
|
||||
String outStr = new String(resultBytes);
|
||||
return outStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* RSA公钥加密
|
||||
* @param input 需要加密的字符串
|
||||
* @param rsaPublicKey 公钥
|
||||
* @return 密文
|
||||
* @throws Exception 加密过程中的异常信息
|
||||
*/
|
||||
public static List<String> rsaEncrypt(String input, String rsaPublicKey) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
|
||||
String result = "";
|
||||
// 将Base64编码后的公钥转换成PublicKey对象
|
||||
byte[] buffer = Base64.decodeBase64(rsaPublicKey);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(buffer);
|
||||
PublicKey publicKey = keyFactory.generatePublic(keySpec);
|
||||
// 加密
|
||||
Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
|
||||
byte[] inputArray = input.getBytes();
|
||||
int inputLength = inputArray.length;
|
||||
System.out.println("加密字节数:" + inputLength);
|
||||
// 最大加密字节数,超出最大字节数需要分组加密
|
||||
int MAX_ENCRYPT_BLOCK = 117;
|
||||
// 标识
|
||||
int offSet = 0;
|
||||
List<String> results=new ArrayList<>();
|
||||
byte[] cache;
|
||||
while (inputLength - offSet > 0) {
|
||||
if (inputLength - offSet > MAX_ENCRYPT_BLOCK) {
|
||||
cache = cipher.doFinal(inputArray, offSet, MAX_ENCRYPT_BLOCK);
|
||||
offSet += MAX_ENCRYPT_BLOCK;
|
||||
} else {
|
||||
cache = cipher.doFinal(inputArray, offSet, inputLength - offSet);
|
||||
offSet = inputLength;
|
||||
}
|
||||
results.add(Base64.encodeBase64String(cache));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package doctor.util;
|
||||
|
||||
/**
|
||||
* 存放RSA 公钥和私钥
|
||||
* @author : WangZhanpeng
|
||||
* @date : 2024/1/9 15:49
|
||||
*/
|
||||
public class RsaKey {
|
||||
|
||||
/**
|
||||
* 公钥
|
||||
*/
|
||||
public static final String PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7xkwklONlHn8TGmTH6yyvv7Bv9AcxXgpkAhuPxpOCVHgkpGGJUJVc8JCMOAhmqI4zdJRqTJa1aOk1glcOaOWja28o6lqNzxn3X3fqdkcWoF/L9Znw1MSDK7oFeSsHqubc9wA2GKb4EFt2TWuaFB+dWfPUhFeJ1GoZhpjjgZLO9QIDAQAB";
|
||||
/**
|
||||
* 私钥
|
||||
*/
|
||||
public static final String PRIVATE_KEY = "MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALvGTCSU42UefxMaZMfrLK+/sG/0BzFeCmQCG4/Gk4JUeCSkYYlQlVzwkIw4CGaojjN0lGpMlrVo6TWCVw5o5aNrbyjqWo3PGfdfd+p2RxagX8v1mfDUxIMrugV5Kweq5tz3ADYYpvgQW3ZNa5oUH51Z89SEV4nUahmGmOOBks71AgMBAAECgYAQNJTts0vMtk0RQP3hoxJAOLLpdo4IXK1Y5DWsut6QKOoVf3pLd4DsfHZ9I3jWI0XievU0F1gKX/uAerc4ryTiR6dxHRyKQxhAamLCFqAgTd6GQf6nl7LlKJkHOKZ1/Un0l245zSLoUzNYxzLZhXfOX8lMNfnXpznfZV43nJJMIQJBAPEeKpEzK8/lEJCszBCXgAH75Qcwu+J/LjZFXChsEqx0ubbhg9orgwg+z5Z2uLXVbeScTkBIi+yY6Jd5RUbyhTsCQQDHXUUcylpo0vo9z/xMPTcd5m5UqTm6ZVacdnrkOQtGJJCKOLYTLhWGUPmE0s+cgn9/24H0H8FjOM/ta8tdTPmPAkEAyV5lNICk7WojzH/TqWOtb3q8yqWDtGR85qxEjCm96rNNSpPKt1ExjJhQbBvYpVuK/KshmwQ7f6wwTBjmp5rxcwJAVbJPAggtgr+l16ourmrl5VFm/bdcXDYxW8JGIxIuOXGAPBoSkf4OPJVUHHctzP3/Zmtp2hFIZKlIH6tlWG69GwJAUcnD0XMH8+h9mYUFdwgD0JtaEbeY3ofkO+RymFdcYO//ZjwnVWyGRIhi/lJ5URPiiDzt2MmX5G2a0NJPwP60Lg==";
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package doctor.util;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.internet.MimeMessage;
|
||||
@Component
|
||||
public class SendEmail {
|
||||
@Autowired
|
||||
private JavaMailSender javaMailSender;
|
||||
public void sendEmail(String email,Integer code){
|
||||
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
|
||||
try {
|
||||
MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);
|
||||
mimeMessageHelper.setTo(email);
|
||||
mimeMessageHelper.setFrom("3581044601@qq.com");
|
||||
mimeMessageHelper.setSubject("发送验证码");
|
||||
mimeMessageHelper.setText("验证码为:"+code);
|
||||
javaMailSender.send(mimeMessage);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,13 +15,24 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
mail:
|
||||
host: smtp.qq.com
|
||||
port: 587
|
||||
username: 3581044601@qq.com
|
||||
password: bwscqgqpkagjciih
|
||||
default-encoding: UTF8
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
socketFactoryClass: javax.net.ssl.SSLSocketFactory
|
||||
debug: true
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<?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="doctor.mapper.HealthDepartmentMapper">
|
||||
|
||||
|
||||
<select id="findDepartments" resultType="doctor.domain.entity.DepartmentEntity">
|
||||
select * from department
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,16 @@
|
|||
<?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="doctor.mapper.HealthJobTitleMapper">
|
||||
<insert id="insertDoctor">
|
||||
INSERT INTO doctor (id, department_id, email, user_name, review_status, phone, pwd, name, image_pic, job_title, inaugural_hospital, personal_profile, good_field, create_time)
|
||||
VALUES (0,#{departmentId},#{email},#{userName},#{reviewStatus},#{phone},#{pwd},#{name},#{imagePic},#{jobTitle},#{inauguralHospital},#{personalProfile},#{goodField},#{createTime});
|
||||
|
||||
</insert>
|
||||
|
||||
|
||||
<select id="findJobTitleList" resultType="doctor.domain.entity.DoctorJobTitleEntity">
|
||||
select * from doctor_job_title
|
||||
</select>
|
||||
</mapper>
|
|
@ -1,11 +0,0 @@
|
|||
<?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="doctor.mapper.IDoctorUserMapper">
|
||||
|
||||
|
||||
<select id="selectDoctorUserByEmail" resultType="doctor.domain.entity.DoctorUser">
|
||||
select * from user where email = #{email}
|
||||
</select>
|
||||
</mapper>
|
|
@ -13,15 +13,15 @@
|
|||
from user_video_buy
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollection">
|
||||
<select id="findVideoCollectionList" resultType="doctor.domain.entity.UserVideoCollectionEntity">
|
||||
select *
|
||||
from user_video_collection
|
||||
</select>
|
||||
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuy">
|
||||
<select id="findUserVideoBuyList" resultType="doctor.domain.entity.UserVideoBuyEntity">
|
||||
select *
|
||||
from user_video_buy
|
||||
</select>
|
||||
<select id="findUserWallet" resultType="doctor.domain.entity.UserWallet">
|
||||
<select id="findUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
|
||||
select *
|
||||
from user_wallet
|
||||
</select>
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
from video_count
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="FindById" resultType="doctor.domain.entity.User">
|
||||
<select id="FindById" resultType="doctor.domain.entity.UserEntity">
|
||||
SELECT user.*
|
||||
FROM user_video_buy
|
||||
LEFT JOIN user ON user.id = user_video_buy.user_id
|
||||
WHERE user_video_buy.user_id = #{userId}
|
||||
</select>
|
||||
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWallet">
|
||||
<select id="FindUserWallet" resultType="doctor.domain.entity.UserWalletEntity">
|
||||
SELECT user.*
|
||||
FROM user_wallet
|
||||
LEFT JOIN user ON user.id = user_wallet.user_id
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
|
@ -15,11 +15,11 @@ spring:
|
|||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: 101.34.77.101:8848
|
||||
namespace: 7e1e997d-5fa4-4f84-9f48-3e0adf830a37
|
||||
namespace: 9de208a6-cb30-41ae-a880-78196c99c050
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
|
Loading…
Reference in New Issue