Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
personnelManager
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
黄夏豪
personnelManager
Commits
1adff340
提交
1adff340
authored
11月 03, 2021
作者:
黄夏豪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
项目完善
上级
bf66e8d9
隐藏空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
62 行增加
和
35 行删除
+62
-35
PersonnelmanagerApplication.java
...example/personnelmanager/PersonnelmanagerApplication.java
+4
-3
JWTAuthorizationFilter.java
...er/common/authencation/filter/JWTAuthorizationFilter.java
+3
-2
SecurityWebConfig.java
...ple/personnelmanager/common/config/SecurityWebConfig.java
+0
-1
DateCenterJsonUtil.java
...ple/personnelmanager/common/utils/DateCenterJsonUtil.java
+2
-2
DateCenterUtil.java
...example/personnelmanager/common/utils/DateCenterUtil.java
+6
-2
UserController.java
...m/example/personnelmanager/controller/UserController.java
+1
-1
People.java
...main/java/com/example/personnelmanager/entity/People.java
+1
-0
Post.java
src/main/java/com/example/personnelmanager/entity/Post.java
+2
-0
UserDetail.java
.../java/com/example/personnelmanager/entity/UserDetail.java
+2
-1
AgainEntryInformationServiceImpl.java
...anager/service/impl/AgainEntryInformationServiceImpl.java
+2
-0
OrganizationNodeServiceImpl.java
...nnelmanager/service/impl/OrganizationNodeServiceImpl.java
+7
-3
PeoplePostServiceImpl.java
.../personnelmanager/service/impl/PeoplePostServiceImpl.java
+6
-2
PeopleServiceImpl.java
...mple/personnelmanager/service/impl/PeopleServiceImpl.java
+9
-8
UserDetailsServiceImpl.java
...personnelmanager/service/impl/UserDetailsServiceImpl.java
+1
-0
application-dev.yml
src/main/resources/application-dev.yml
+5
-2
application-prod.yml
src/main/resources/application-prod.yml
+8
-6
application.yml
src/main/resources/application.yml
+3
-2
没有找到文件。
src/main/java/com/example/personnelmanager/PersonnelmanagerApplication.java
浏览文件 @
1adff340
...
@@ -6,6 +6,7 @@ import com.example.personnelmanager.dao.SimpleJpaRepositoryImpl;
...
@@ -6,6 +6,7 @@ import com.example.personnelmanager.dao.SimpleJpaRepositoryImpl;
import
gnu.io.CommPortIdentifier
;
import
gnu.io.CommPortIdentifier
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.web.servlet.ServletComponentScan
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.boot.web.servlet.support.SpringBootServletInitializer
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
import
org.springframework.data.jpa.repository.config.EnableJpaAuditing
;
...
@@ -22,11 +23,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
...
@@ -22,11 +23,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
*/
*/
@EnableAsync
@EnableAsync
@EnableScheduling
@EnableScheduling
//@EnableDiscoveryClient
@SpringBootApplication
@SpringBootApplication
@EnableSwagger2
@EnableSwagger2
@EnableJpaAuditing
@EnableJpaAuditing
@EnableJpaRepositories
(
repositoryBaseClass
=
SimpleJpaRepositoryImpl
.
class
)
@EnableJpaRepositories
(
repositoryBaseClass
=
SimpleJpaRepositoryImpl
.
class
)
@ServletComponentScan
public
class
PersonnelmanagerApplication
extends
SpringBootServletInitializer
{
public
class
PersonnelmanagerApplication
extends
SpringBootServletInitializer
{
...
@@ -34,8 +35,8 @@ public class PersonnelmanagerApplication extends SpringBootServletInitializer {
...
@@ -34,8 +35,8 @@ public class PersonnelmanagerApplication extends SpringBootServletInitializer {
SpringApplication
.
run
(
PersonnelmanagerApplication
.
class
,
args
);
SpringApplication
.
run
(
PersonnelmanagerApplication
.
class
,
args
);
//todo 初始化一个初始企业 初始化一个admin 初始化一个节点
//todo 初始化一个初始企业 初始化一个admin 初始化一个节点
System
.
out
.
println
(
"程序运行成功"
);
System
.
out
.
println
(
"程序运行成功"
);
DateCenterUtil
dateCenterUtil
=
SpringUtils
.
getBean
(
"dateCenterUtil"
);
//
DateCenterUtil dateCenterUtil = SpringUtils.getBean("dateCenterUtil");
dateCenterUtil
.
sendDateToCenter
();
//
dateCenterUtil.sendDateToCenter();
// dateCenterUtil.initUser();
// dateCenterUtil.initUser();
}
}
...
...
src/main/java/com/example/personnelmanager/common/authencation/filter/JWTAuthorizationFilter.java
浏览文件 @
1adff340
...
@@ -28,11 +28,12 @@ public class JWTAuthorizationFilter extends BasicAuthenticationFilter {
...
@@ -28,11 +28,12 @@ public class JWTAuthorizationFilter extends BasicAuthenticationFilter {
@Override
@Override
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
protected
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
IOException
,
ServletException
{
if
(
request
.
getHeader
(
"
jwt
"
)!=
null
){
if
(
request
.
getHeader
(
"
token
"
)!=
null
){
System
.
out
.
println
(
"1"
);
System
.
out
.
println
(
"1"
);
}
}
// 如果请求头中有token,则进行解析,并且设置认证信息
// 如果请求头中有token,则进行解析,并且设置认证信息
SecurityContextHolder
.
getContext
().
setAuthentication
(
new
UsernamePasswordAuthenticationToken
(
"username"
,
null
,
SecurityContextHolder
.
getContext
().
setAuthentication
(
new
UsernamePasswordAuthenticationToken
(
"username"
,
null
,
Collections
.
singleton
(
new
SimpleGrantedAuthority
(
"ROLE_ADMIN"
))
Collections
.
singleton
(
new
SimpleGrantedAuthority
(
"ROLE_ADMIN"
))
));
));
super
.
doFilterInternal
(
request
,
response
,
chain
);
super
.
doFilterInternal
(
request
,
response
,
chain
);
...
...
src/main/java/com/example/personnelmanager/common/config/SecurityWebConfig.java
浏览文件 @
1adff340
...
@@ -7,7 +7,6 @@ import com.example.personnelmanager.common.authencation.filter.CustomJwtAuthenti
...
@@ -7,7 +7,6 @@ import com.example.personnelmanager.common.authencation.filter.CustomJwtAuthenti
import
com.example.personnelmanager.common.authencation.filter.CustomUsernamePasswordAuthenticationFilter
;
import
com.example.personnelmanager.common.authencation.filter.CustomUsernamePasswordAuthenticationFilter
;
import
com.example.personnelmanager.entity.commonEntity.ResultObj
;
import
com.example.personnelmanager.entity.commonEntity.ResultObj
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
...
...
src/main/java/com/example/personnelmanager/common/utils/DateCenterJsonUtil.java
浏览文件 @
1adff340
...
@@ -45,7 +45,7 @@ public class DateCenterJsonUtil {
...
@@ -45,7 +45,7 @@ public class DateCenterJsonUtil {
*/
*/
public
String
initAllPeopleJsonStr
(
List
<
People
>
allPeople
){
public
String
initAllPeopleJsonStr
(
List
<
People
>
allPeople
){
JsonObject
jsonObject
=
new
JsonObject
();
JsonObject
jsonObject
=
new
JsonObject
();
jsonObject
.
addProperty
(
"tableId"
,
13
20331389656211458
L
);
jsonObject
.
addProperty
(
"tableId"
,
13
46658905505366017
L
);
jsonObject
.
addProperty
(
"primaryKeyName"
,
"people_id"
);
jsonObject
.
addProperty
(
"primaryKeyName"
,
"people_id"
);
JsonArray
jsonElements
=
new
JsonArray
();
JsonArray
jsonElements
=
new
JsonArray
();
allPeople
.
forEach
(
people
->
{
allPeople
.
forEach
(
people
->
{
...
@@ -106,7 +106,7 @@ public class DateCenterJsonUtil {
...
@@ -106,7 +106,7 @@ public class DateCenterJsonUtil {
*/
*/
public
String
initAllOrganizationNodeJsonStr
(
List
<
OrganizationNode
>
allNode
){
public
String
initAllOrganizationNodeJsonStr
(
List
<
OrganizationNode
>
allNode
){
JsonObject
jsonObject
=
new
JsonObject
();
JsonObject
jsonObject
=
new
JsonObject
();
jsonObject
.
addProperty
(
"tableId"
,
13
20331411160408065
L
);
jsonObject
.
addProperty
(
"tableId"
,
13
46658965509079041
L
);
jsonObject
.
addProperty
(
"primaryKeyName"
,
"node_id"
);
jsonObject
.
addProperty
(
"primaryKeyName"
,
"node_id"
);
JsonArray
jsonElements
=
new
JsonArray
();
JsonArray
jsonElements
=
new
JsonArray
();
allNode
.
forEach
(
node
->
{
allNode
.
forEach
(
node
->
{
...
...
src/main/java/com/example/personnelmanager/common/utils/DateCenterUtil.java
浏览文件 @
1adff340
...
@@ -12,6 +12,7 @@ import com.example.personnelmanager.service.UserServer;
...
@@ -12,6 +12,7 @@ import com.example.personnelmanager.service.UserServer;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.data.domain.Sort
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
...
@@ -29,6 +30,9 @@ import java.util.List;
...
@@ -29,6 +30,9 @@ import java.util.List;
@Component
@Component
public
class
DateCenterUtil
{
public
class
DateCenterUtil
{
@Value
(
"${dataCenter}"
)
public
String
dataCenterIp
;
@Autowired
@Autowired
PeopleRepository
peopleRepository
;
PeopleRepository
peopleRepository
;
...
@@ -50,10 +54,10 @@ public class DateCenterUtil {
...
@@ -50,10 +54,10 @@ public class DateCenterUtil {
public
void
sendDateToCenter
(){
public
void
sendDateToCenter
(){
// 将数据库中的人员数据存放到数据中心
// 将数据库中的人员数据存放到数据中心
List
<
People
>
allPeople
=
peopleRepository
.
findAll
();
List
<
People
>
allPeople
=
peopleRepository
.
findAll
();
httpClientUtil
.
post
(
"http://
124.70.194.194:8090
/opt/data"
,
jsonUtil
.
initAllPeopleJsonStr
(
allPeople
),
"utf-8"
);
httpClientUtil
.
post
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
jsonUtil
.
initAllPeopleJsonStr
(
allPeople
),
"utf-8"
);
// 将数据库中的部门信息存放到数据中心
// 将数据库中的部门信息存放到数据中心
List
<
OrganizationNode
>
allNode
=
organizationNodeRepository
.
findAll
();
List
<
OrganizationNode
>
allNode
=
organizationNodeRepository
.
findAll
();
httpClientUtil
.
post
(
"http://
124.70.194.194:8090
/opt/data"
,
jsonUtil
.
initAllOrganizationNodeJsonStr
(
allNode
),
"utf-8"
);
httpClientUtil
.
post
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
jsonUtil
.
initAllOrganizationNodeJsonStr
(
allNode
),
"utf-8"
);
};
};
public
void
initUser
(){
public
void
initUser
(){
...
...
src/main/java/com/example/personnelmanager/controller/UserController.java
浏览文件 @
1adff340
...
@@ -62,7 +62,7 @@ public class UserController {
...
@@ -62,7 +62,7 @@ public class UserController {
JsonObject
jsonObject
=
new
JsonObject
();
JsonObject
jsonObject
=
new
JsonObject
();
jsonObject
.
addProperty
(
"appId"
,
"35"
);
jsonObject
.
addProperty
(
"appId"
,
"35"
);
jsonObject
.
addProperty
(
"des"
,
"请用户完善系统中人员信息"
);
jsonObject
.
addProperty
(
"des"
,
"请用户完善系统中人员信息"
);
jsonObject
.
addProperty
(
"link"
,
"http://192.168.100.24
8
:8080/personnel"
);
jsonObject
.
addProperty
(
"link"
,
"http://192.168.100.24
6
:8080/personnel"
);
jsonObject
.
addProperty
(
"title"
,
"请用户完善人员信息"
);
jsonObject
.
addProperty
(
"title"
,
"请用户完善人员信息"
);
jsonObject
.
addProperty
(
"userId"
,
"1"
);
jsonObject
.
addProperty
(
"userId"
,
"1"
);
String
post
=
httpClientUtil
.
post
(
centerServe
+
"/task/add"
,
jsonObject
.
toString
(),
"utf-8"
);
String
post
=
httpClientUtil
.
post
(
centerServe
+
"/task/add"
,
jsonObject
.
toString
(),
"utf-8"
);
...
...
src/main/java/com/example/personnelmanager/entity/People.java
浏览文件 @
1adff340
...
@@ -35,6 +35,7 @@ import java.util.List;
...
@@ -35,6 +35,7 @@ import java.util.List;
public
class
People
{
public
class
People
{
@Id
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"people_id"
,
columnDefinition
=
"bigint comment '人员编号' "
)
@Column
(
name
=
"people_id"
,
columnDefinition
=
"bigint comment '人员编号' "
)
private
Long
peopleId
;
private
Long
peopleId
;
...
...
src/main/java/com/example/personnelmanager/entity/Post.java
浏览文件 @
1adff340
...
@@ -71,4 +71,6 @@ public class Post {
...
@@ -71,4 +71,6 @@ public class Post {
}
}
src/main/java/com/example/personnelmanager/entity/UserDetail.java
浏览文件 @
1adff340
...
@@ -21,7 +21,8 @@ import java.util.List;
...
@@ -21,7 +21,8 @@ import java.util.List;
public
class
UserDetail
extends
User
implements
UserDetails
{
public
class
UserDetail
extends
User
implements
UserDetails
{
@Override
@Override
public
Collection
<?
extends
GrantedAuthority
>
getAuthorities
()
{
public
Collection
<?
extends
GrantedAuthority
>
getAuthorities
()
{
List
<
GrantedAuthority
>
simpleGrantedAuthorities
=
new
ArrayList
<>();
List
<
GrantedAuthority
>
simpleGrantedAuthorities
=
new
ArrayList
<>();
return
simpleGrantedAuthorities
;
return
simpleGrantedAuthorities
;
}
}
...
...
src/main/java/com/example/personnelmanager/service/impl/AgainEntryInformationServiceImpl.java
浏览文件 @
1adff340
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
...
@@ -69,6 +70,7 @@ public class AgainEntryInformationServiceImpl implements AgainEntryInformationSe
...
@@ -69,6 +70,7 @@ public class AgainEntryInformationServiceImpl implements AgainEntryInformationSe
AgainEntryInformation
againEntryInformation
=
byId
.
get
();
AgainEntryInformation
againEntryInformation
=
byId
.
get
();
againEntryInformation
.
setDeleteTag
(
1
);
againEntryInformation
.
setDeleteTag
(
1
);
againEntryInformationRepository
.
save
(
againEntryInformation
);
againEntryInformationRepository
.
save
(
againEntryInformation
);
return
true
;
return
true
;
}
}
...
...
src/main/java/com/example/personnelmanager/service/impl/OrganizationNodeServiceImpl.java
浏览文件 @
1adff340
...
@@ -18,6 +18,7 @@ import com.github.wenhao.jpa.PredicateBuilder;
...
@@ -18,6 +18,7 @@ import com.github.wenhao.jpa.PredicateBuilder;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
javafx.geometry.Pos
;
import
javafx.geometry.Pos
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
...
@@ -40,6 +41,9 @@ import java.util.stream.Collectors;
...
@@ -40,6 +41,9 @@ import java.util.stream.Collectors;
@Transactional
@Transactional
public
class
OrganizationNodeServiceImpl
implements
OrganizationNodeService
{
public
class
OrganizationNodeServiceImpl
implements
OrganizationNodeService
{
@Value
(
"${dataCenter}"
)
public
String
dataCenterIp
;
@Autowired
@Autowired
OrganizationNodeRepository
organizationNodeRepository
;
OrganizationNodeRepository
organizationNodeRepository
;
...
@@ -73,7 +77,7 @@ public class OrganizationNodeServiceImpl implements OrganizationNodeService {
...
@@ -73,7 +77,7 @@ public class OrganizationNodeServiceImpl implements OrganizationNodeService {
organizationNode
.
setEnterprise
(
userDetails
.
getEnterprise
());
organizationNode
.
setEnterprise
(
userDetails
.
getEnterprise
());
OrganizationNode
save
=
organizationNodeRepository
.
save
(
organizationNode
);
OrganizationNode
save
=
organizationNodeRepository
.
save
(
organizationNode
);
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
post
(
"http://
124.70.194.194:8090
/opt/data"
,
dateCenterJsonUtil
.
initAllOrganizationNodeJsonStr
(
Arrays
.
asList
(
save
)),
"utf-8"
);
httpClientUtil
.
post
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllOrganizationNodeJsonStr
(
Arrays
.
asList
(
save
)),
"utf-8"
);
});
});
return
save
;
return
save
;
}
}
...
@@ -173,7 +177,7 @@ public class OrganizationNodeServiceImpl implements OrganizationNodeService {
...
@@ -173,7 +177,7 @@ public class OrganizationNodeServiceImpl implements OrganizationNodeService {
OrganizationNode
after
=
organizationNodeRepository
.
save
(
organizationNode
);
OrganizationNode
after
=
organizationNodeRepository
.
save
(
organizationNode
);
//向数据中心修改旧的数据
//向数据中心修改旧的数据
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
put
(
"http://
124.70.194.194
:8090/opt/data"
,
dateCenterJsonUtil
.
initAllOrganizationNodeJsonStr
(
Arrays
.
asList
(
after
)),
"utf-8"
);
httpClientUtil
.
put
(
"http://
"
+
dataCenterIp
+
"
:8090/opt/data"
,
dateCenterJsonUtil
.
initAllOrganizationNodeJsonStr
(
Arrays
.
asList
(
after
)),
"utf-8"
);
});
});
return
after
;
return
after
;
}
}
...
@@ -210,7 +214,7 @@ public class OrganizationNodeServiceImpl implements OrganizationNodeService {
...
@@ -210,7 +214,7 @@ public class OrganizationNodeServiceImpl implements OrganizationNodeService {
});
});
//向数据中心修改旧的数据
//向数据中心修改旧的数据
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
put
(
"http://
124.70.194.194:8090
/opt/data"
,
dateCenterJsonUtil
.
initAllOrganizationNodeJsonStr
(
Arrays
.
asList
(
one
)),
"utf-8"
);
httpClientUtil
.
put
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllOrganizationNodeJsonStr
(
Arrays
.
asList
(
one
)),
"utf-8"
);
});
});
return
true
;
return
true
;
}
}
...
...
src/main/java/com/example/personnelmanager/service/impl/PeoplePostServiceImpl.java
浏览文件 @
1adff340
...
@@ -12,6 +12,7 @@ import com.example.personnelmanager.service.PeoplePostService;
...
@@ -12,6 +12,7 @@ import com.example.personnelmanager.service.PeoplePostService;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
...
@@ -35,6 +36,9 @@ import java.util.concurrent.ExecutorService;
...
@@ -35,6 +36,9 @@ import java.util.concurrent.ExecutorService;
@Service
@Service
public
class
PeoplePostServiceImpl
implements
PeoplePostService
{
public
class
PeoplePostServiceImpl
implements
PeoplePostService
{
@Value
(
"${dataCenter}"
)
public
String
dataCenterIp
;
@Autowired
@Autowired
DateCenterJsonUtil
dateCenterJsonUtil
;
DateCenterJsonUtil
dateCenterJsonUtil
;
...
@@ -68,7 +72,7 @@ public class PeoplePostServiceImpl implements PeoplePostService {
...
@@ -68,7 +72,7 @@ public class PeoplePostServiceImpl implements PeoplePostService {
}
}
PeoplePost
save
=
peoplePostRepository
.
save
(
peoplePost
);
PeoplePost
save
=
peoplePostRepository
.
save
(
peoplePost
);
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
put
(
"http://
124.70.194.194:8090
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
peopleRepository
.
getOne
(
save
.
getPeople
().
getPeopleId
()))),
"utf-8"
);
httpClientUtil
.
put
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
peopleRepository
.
getOne
(
save
.
getPeople
().
getPeopleId
()))),
"utf-8"
);
});
});
return
save
;
return
save
;
}
}
...
@@ -89,7 +93,7 @@ public class PeoplePostServiceImpl implements PeoplePostService {
...
@@ -89,7 +93,7 @@ public class PeoplePostServiceImpl implements PeoplePostService {
public
PeoplePost
update
(
PeoplePost
peoplePost
)
{
public
PeoplePost
update
(
PeoplePost
peoplePost
)
{
PeoplePost
save
=
peoplePostRepository
.
save
(
peoplePost
);
PeoplePost
save
=
peoplePostRepository
.
save
(
peoplePost
);
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
put
(
"http://
124.70.194.194:8090
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
peopleRepository
.
getOne
(
save
.
getPeople
().
getPeopleId
()))),
"utf-8"
);
httpClientUtil
.
put
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
peopleRepository
.
getOne
(
save
.
getPeople
().
getPeopleId
()))),
"utf-8"
);
});
});
return
save
;
return
save
;
...
...
src/main/java/com/example/personnelmanager/service/impl/PeopleServiceImpl.java
浏览文件 @
1adff340
...
@@ -7,17 +7,15 @@ import com.example.personnelmanager.common.utils.DateCenterJsonUtil;
...
@@ -7,17 +7,15 @@ import com.example.personnelmanager.common.utils.DateCenterJsonUtil;
import
com.example.personnelmanager.common.utils.HttpClientUtil
;
import
com.example.personnelmanager.common.utils.HttpClientUtil
;
import
com.example.personnelmanager.dao.PeopleRepository
;
import
com.example.personnelmanager.dao.PeopleRepository
;
import
com.example.personnelmanager.entity.*
;
import
com.example.personnelmanager.entity.*
;
import
com.example.personnelmanager.entity.vo.PeopleVo
;
import
com.example.personnelmanager.entity.vo.pageableVo.PeoplePageableVo
;
import
com.example.personnelmanager.entity.vo.pageableVo.PeoplePageableVo
;
import
com.example.personnelmanager.service.*
;
import
com.example.personnelmanager.service.*
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.PredicateBuilder
;
import
com.github.wenhao.jpa.Specifications
;
import
com.github.wenhao.jpa.Specifications
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Page
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.domain.Pageable
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.security.core.parameters.P
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
...
@@ -41,6 +39,9 @@ import java.util.concurrent.ExecutorService;
...
@@ -41,6 +39,9 @@ import java.util.concurrent.ExecutorService;
@Service
@Service
public
class
PeopleServiceImpl
implements
PeopleService
{
public
class
PeopleServiceImpl
implements
PeopleService
{
@Value
(
"${dataCenter}"
)
public
String
dataCenterIp
;
@Autowired
@Autowired
PeopleRepository
peopleRepository
;
PeopleRepository
peopleRepository
;
...
@@ -107,9 +108,9 @@ public class PeopleServiceImpl implements PeopleService {
...
@@ -107,9 +108,9 @@ public class PeopleServiceImpl implements PeopleService {
user
.
setPhone
(
people
.
getPhone
());
user
.
setPhone
(
people
.
getPhone
());
userServer
.
addEntity
(
user
);
userServer
.
addEntity
(
user
);
// //向数据中心插入新的数据
// //向数据中心插入新的数据
//
executorService.submit(() -> {
executorService
.
submit
(()
->
{
// httpClientUtil.post("http://124.70.194.194:8090
/opt/data", dateCenterJsonUtil.initAllPeopleJsonStr(Arrays.asList(save)), "utf-8");
httpClientUtil
.
post
(
"http://"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
save
)),
"utf-8"
);
//
});
});
return
save
;
return
save
;
}
}
...
@@ -141,7 +142,7 @@ public class PeopleServiceImpl implements PeopleService {
...
@@ -141,7 +142,7 @@ public class PeopleServiceImpl implements PeopleService {
People
after
=
peopleRepository
.
save
(
people
);
People
after
=
peopleRepository
.
save
(
people
);
//向数据中心修改旧的数据
//向数据中心修改旧的数据
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
put
(
"http://
124.70.194.194:8090
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
after
)),
"utf-8"
);
httpClientUtil
.
put
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
after
)),
"utf-8"
);
});
});
return
after
;
return
after
;
}
}
...
@@ -166,7 +167,7 @@ public class PeopleServiceImpl implements PeopleService {
...
@@ -166,7 +167,7 @@ public class PeopleServiceImpl implements PeopleService {
People
after
=
peopleRepository
.
save
(
people
);
People
after
=
peopleRepository
.
save
(
people
);
//向数据中心修改旧的数据
//向数据中心修改旧的数据
executorService
.
submit
(()
->
{
executorService
.
submit
(()
->
{
httpClientUtil
.
put
(
"http://
124.70.194.194:8090
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
after
)),
"utf-8"
);
httpClientUtil
.
put
(
"http://
"
+
dataCenterIp
+
"
/opt/data"
,
dateCenterJsonUtil
.
initAllPeopleJsonStr
(
Arrays
.
asList
(
after
)),
"utf-8"
);
});
});
return
true
;
return
true
;
}
}
...
...
src/main/java/com/example/personnelmanager/service/impl/UserDetailsServiceImpl.java
浏览文件 @
1adff340
package
com
.
example
.
personnelmanager
.
service
.
impl
;
package
com
.
example
.
personnelmanager
.
service
.
impl
;
import
com.example.personnelmanager.entity.Enterprise
;
import
com.example.personnelmanager.entity.Enterprise
;
import
com.example.personnelmanager.entity.People
;
import
com.example.personnelmanager.entity.User
;
import
com.example.personnelmanager.entity.User
;
import
com.example.personnelmanager.entity.UserDetail
;
import
com.example.personnelmanager.entity.UserDetail
;
import
com.example.personnelmanager.service.UserServer
;
import
com.example.personnelmanager.service.UserServer
;
...
...
src/main/resources/application-dev.yml
浏览文件 @
1adff340
...
@@ -12,6 +12,8 @@ file:
...
@@ -12,6 +12,8 @@ file:
#center:
#center:
# ip: 124.70.194.194
# ip: 124.70.194.194
# serve: http://124.70.194.194:12346
# serve: http://124.70.194.194:12346
##Eureka设置
##Eureka设置
#eureka:
#eureka:
# instance:
# instance:
...
@@ -72,4 +74,6 @@ spring:
...
@@ -72,4 +74,6 @@ spring:
center
:
center
:
ip
:
124.70.194.194
ip
:
124.70.194.194
serve
:
http://124.70.194.194:11324
serve
:
http://124.70.194.194:11324
\ No newline at end of file
dataCenter
:
192.168.100.246:8090
src/main/resources/application-prod.yml
浏览文件 @
1adff340
...
@@ -10,8 +10,9 @@ file:
...
@@ -10,8 +10,9 @@ file:
# serverAddress: 124.70.194.194:${server.port}
# serverAddress: 124.70.194.194:${server.port}
#
#
center
:
center
:
ip
:
124.70.194.194
ip
:
127.0.0.1
serve
:
http://124.70.194.194:11324
serve
:
http://127.0.0.1:11324
##Eureka设置
##Eureka设置
#eureka:
#eureka:
# instance:
# instance:
...
@@ -64,10 +65,10 @@ center:
...
@@ -64,10 +65,10 @@ center:
# com.zjty: debug
# com.zjty: debug
# dao: debug
# dao: debug
dataCenter
:
192.168.100.246:8090
spring
:
spring
:
datasource
:
datasource
:
username
:
hxh
username
:
root
password
:
Qwert123123
password
:
root
url
:
jdbc:mysql://1
24.70.145.101
:3306/personnelManager?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8
url
:
jdbc:mysql://1
92.168.100.246
:3306/personnelManager?useSSL=false&serverTimezone=UTC&characterEncoding=utf-8
# dao: debug
# dao: debug
\ No newline at end of file
src/main/resources/application.yml
浏览文件 @
1adff340
...
@@ -28,4 +28,5 @@ spring:
...
@@ -28,4 +28,5 @@ spring:
sql-dialect
:
MySQL5Dialect
sql-dialect
:
MySQL5Dialect
jackson
:
jackson
:
date-format
:
yyyy-MM-dd HH:mm:ss
date-format
:
yyyy-MM-dd HH:mm:ss
time-zone
:
GMT+8
time-zone
:
GMT+8
\ No newline at end of file
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论