Skip to content

Commit ae650d8

Browse files
committed
登录状态下进行第三方绑定
1 parent 1c6cfea commit ae650d8

File tree

14 files changed

+99
-36
lines changed

14 files changed

+99
-36
lines changed

springboot-dubbo-api/springboot-dubbo-api.iml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
4+
<facet type="JRebel" name="JRebel">
5+
<configuration>
6+
<option name="ideModuleStorage">
7+
<map>
8+
<entry key="com.zeroturnaround.jrebel.FormatVersion" value="7.0.0" />
9+
<entry key="com.zeroturnaround.jrebel.remoting.DeleteUnindexedFiles" value="false" />
10+
<entry key="com.zeroturnaround.jrebel.remoting.ModuleRemoteServerSelection" value="off" />
11+
<entry key="jrebelEnabled" value="true" />
12+
</map>
13+
</option>
14+
</configuration>
15+
</facet>
416
<facet type="Spring" name="Spring">
517
<configuration />
618
</facet>

springboot-dubbo-api/src/main/java/com/lzq/api/dto/AccountResult.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,23 @@ public class AccountResult implements Serializable{
5858
@TableField(value = "user_picture")
5959
@JsonProperty("userPicture")
6060
private String userPicture;
61+
/**
62+
* 背景颜色
63+
*/
64+
@TableField(value = "background_color")
65+
@JsonProperty("backgroundColor")
66+
private String backgroundColor;
6167
/**
6268
* github主键id
6369
*/
6470
@TableField(value = "github_id")
65-
@JsonIgnore
71+
@JsonProperty("githubId")
6672
private String githubId;
6773
/**
6874
* gitee主键id
6975
*/
7076
@TableField(value = "gitee_id")
71-
@JsonIgnore
77+
@JsonProperty("giteeId")
7278
private String giteeId;
7379
/**
7480
* 角色id

springboot-dubbo-api/src/main/java/com/lzq/api/pojo/Account.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@ public class Account implements Serializable, UserDetails {
6868
/**
6969
* 背景颜色
7070
*/
71-
@TableField(value = "backgroud_color")
71+
@TableField(value = "background_color")
7272
@JsonIgnore
73-
private String backgroudColor;
73+
private String backgroundColor;
7474
/**
7575
* github主键id
7676
*/
7777
@TableField(value = "github_id")
78-
@JsonProperty("githubId")
78+
@JsonIgnore
7979
private String githubId;
8080
/**
8181
* gitee主键id
8282
*/
8383
@TableField(value = "gitee_id")
84-
@JsonProperty("giteeId")
84+
@JsonIgnore
8585
private String giteeId;
8686
/**
8787
* 角色id

springboot-dubbo-api/src/main/java/com/lzq/api/service/AccountResultService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import com.github.pagehelper.PageInfo;
55
import com.lzq.api.dto.AccountResult;
6+
import com.lzq.api.pojo.Account;
67

78
/**
89
* @author :LZQ
@@ -34,5 +35,11 @@ public interface AccountResultService {
3435
*/
3536
PageInfo<AccountResult> getFanList(AccountResult result,Integer currentPage);
3637

38+
/**
39+
* 更新喜爱数(校正喜爱数)
40+
* @param result
41+
* @return
42+
*/
43+
Boolean updateFavorites(AccountResult result);
3744

3845
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
5+
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
6+
-->
7+
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
8+
9+
<id>springboot-dubbo-api</id>
10+
11+
<classpath>
12+
<dir name="F:/项目/MyDemo/OnlineIDE/springboot-dubbo-api/target/classes">
13+
</dir>
14+
</classpath>
15+
16+
</application>

springboot-dubbo-service/src/main/java/com/lzq/dubboservice/mapper/AccountResultMapper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
44
import com.lzq.api.dto.AccountResult;
5+
import com.lzq.api.pojo.Account;
56
import org.springframework.stereotype.Repository;
67

78
import java.util.List;
@@ -17,4 +18,6 @@ public interface AccountResultMapper extends BaseMapper<AccountResult> {
1718
public List<AccountResult> getFollowList(AccountResult result);
1819

1920
public List<AccountResult> getFanList(AccountResult result);
21+
22+
Integer updateFavorites(AccountResult result);
2023
}

springboot-dubbo-service/src/main/java/com/lzq/dubboservice/service/AccountResultServiceImpl.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,9 @@ public PageInfo<AccountResult> getFanList(AccountResult result,Integer currentPa
4545
List<AccountResult> list = baseMapper.getFanList(result);
4646
return new PageInfo<>(list);
4747
}
48+
49+
@Override
50+
public Boolean updateFavorites(AccountResult result) {
51+
return baseMapper.updateFavorites(result)>0?true:false;
52+
}
4853
}

springboot-dubbo-service/src/main/resources/mapper/AccoutResultMapper.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
<mapper namespace="com.lzq.dubboservice.mapper.AccountResultMapper">
44

55
<sql id="AccountResult">
6-
a.username, name, email, contact_email, password, user_picture,
7-
description, fan, following
6+
a.username, name, email, contact_email, user_picture
87
</sql>
98

109
<select id="getFollowList" resultType="com.lzq.api.dto.AccountResult">
@@ -26,4 +25,8 @@
2625
where
2726
b.follow_username=#{username}
2827
</select>
28+
29+
<update id="updateFavorites">
30+
update account set favorites=#{favorites} where username=#{username}
31+
</update>
2932
</mapper>

springboot-dubbo-web/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
<artifactId>selenium-java</artifactId>
8787
<version>3.9.1</version>
8888
</dependency>
89-
<!--版本冲突必须和seleniumhq同时导入-->
89+
<!--版本冲突时必须和seleniumhq同时导入-->
9090
<dependency>
9191
<groupId>com.google.guava</groupId>
9292
<artifactId>guava</artifactId>

springboot-dubbo-web/src/main/java/com/lzq/web/config/SecurityConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ protected void configure(HttpSecurity http) throws Exception {
100100
.authenticationSuccessHandler((httpServletRequest, httpServletResponse, authentication) -> {
101101
Map<String, Object> map = new HashMap();
102102
HashMap<String, String> jwtmap = new HashMap();
103-
jwtmap.put("username", authentication.getName());
104-
//生成token
105-
String token = JWTUtils.getToken(jwtmap);
106103
//获取用户
107104
Account account = (Account) authentication.getPrincipal();
105+
jwtmap.put("username", account.getUsername());
106+
//生成token
107+
String token = JWTUtils.getToken(jwtmap);
108108
Map<String, Object> withToken = ResultMapUtils.ResultMapWithToken(true, 0, account, token);
109109
httpServletRequest.getSession().setAttribute("map", withToken);
110110
UserUtils.responseMessage(httpServletResponse, withToken, objectMapper);

0 commit comments

Comments
 (0)