Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
rpc-openplatform
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f627cdf1
authored
Dec 17, 2020
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
完成Dubbo基本开发
1 parent
614a87af
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
0 deletions
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/service/CustomerMgrService.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/PlatformCustomerMapper.java
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/service/CustomerMgrServiceImpl.java
rpc-openplatform-container/src/main/resources/META-INF/orm/PlatformCustomerMapper.xml
rpc-openplatform-api/src/main/java/cn/com/glsx/openplatform/service/CustomerMgrService.java
View file @
f627cdf
...
@@ -16,4 +16,6 @@ public interface CustomerMgrService {
...
@@ -16,4 +16,6 @@ public interface CustomerMgrService {
int
register
(
PlatformCustomer
customer
);
int
register
(
PlatformCustomer
customer
);
int
login
(
PlatformCustomer
customer
);
int
login
(
PlatformCustomer
customer
);
List
<
String
>
getAddressOptionList
(
int
id
);
}
}
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/mapper/PlatformCustomerMapper.java
View file @
f627cdf
...
@@ -2,6 +2,7 @@ package cn.com.glsx.openplatform.mapper;
...
@@ -2,6 +2,7 @@ package cn.com.glsx.openplatform.mapper;
import
cn.com.glsx.openplatform.model.PlatformCustomer
;
import
cn.com.glsx.openplatform.model.PlatformCustomer
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.oreframework.datasource.mybatis.mapper.OreMapper
;
import
org.oreframework.datasource.mybatis.mapper.OreMapper
;
import
java.util.List
;
import
java.util.List
;
...
@@ -23,4 +24,6 @@ public interface PlatformCustomerMapper extends OreMapper<PlatformCustomer> {
...
@@ -23,4 +24,6 @@ public interface PlatformCustomerMapper extends OreMapper<PlatformCustomer> {
int
getCustomerCount
();
int
getCustomerCount
();
int
login
(
PlatformCustomer
customer
);
int
login
(
PlatformCustomer
customer
);
List
<
String
>
getAddressOptionList
(
@Param
(
"id"
)
int
id
);
}
}
\ No newline at end of file
\ No newline at end of file
rpc-openplatform-container/src/main/java/cn/com/glsx/openplatform/service/CustomerMgrServiceImpl.java
View file @
f627cdf
...
@@ -2,12 +2,18 @@ package cn.com.glsx.openplatform.service;
...
@@ -2,12 +2,18 @@ package cn.com.glsx.openplatform.service;
import
cn.com.glsx.openplatform.mapper.PlatformCustomerMapper
;
import
cn.com.glsx.openplatform.mapper.PlatformCustomerMapper
;
import
cn.com.glsx.openplatform.model.PlatformCustomer
;
import
cn.com.glsx.openplatform.model.PlatformCustomer
;
import
net.dreamlu.mica.core.utils.RsaUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
com.alibaba.dubbo.config.annotation.Service
;
import
com.alibaba.dubbo.config.annotation.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.security.PrivateKey
;
import
java.security.PublicKey
;
import
java.security.SecureRandom
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.UUID
;
@Service
@Service
public
class
CustomerMgrServiceImpl
implements
CustomerMgrService
{
public
class
CustomerMgrServiceImpl
implements
CustomerMgrService
{
...
@@ -47,6 +53,13 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
...
@@ -47,6 +53,13 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
@Override
@Override
public
int
register
(
PlatformCustomer
customer
)
{
public
int
register
(
PlatformCustomer
customer
)
{
String
modulus
=
UUID
.
randomUUID
().
toString
();
String
exponent
=
UUID
.
randomUUID
().
toString
();
PrivateKey
privateKey
=
RsaUtil
.
generatePrivateKey
(
modulus
,
exponent
);
PublicKey
publicKey
=
RsaUtil
.
generatePublicKey
(
modulus
,
exponent
);
customer
.
setPrivateKey
(
privateKey
.
getAlgorithm
());
customer
.
setPublicKey
(
publicKey
.
getAlgorithm
());
return
customerMapper
.
insertSelective
(
customer
);
return
customerMapper
.
insertSelective
(
customer
);
}
}
...
@@ -54,4 +67,9 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
...
@@ -54,4 +67,9 @@ public class CustomerMgrServiceImpl implements CustomerMgrService {
public
int
login
(
PlatformCustomer
customer
)
{
public
int
login
(
PlatformCustomer
customer
)
{
return
customerMapper
.
login
(
customer
);
return
customerMapper
.
login
(
customer
);
}
}
@Override
public
List
<
String
>
getAddressOptionList
(
int
id
)
{
return
customerMapper
.
getAddressOptionList
(
id
);
}
}
}
rpc-openplatform-container/src/main/resources/META-INF/orm/PlatformCustomerMapper.xml
View file @
f627cdf
...
@@ -54,4 +54,19 @@
...
@@ -54,4 +54,19 @@
and password = #{password,jdbcType=VARCHAR}
and password = #{password,jdbcType=VARCHAR}
</select>
</select>
<select
id=
"getAddressOptionList"
resultType=
"java.lang.String"
>
select
area_name
from t_sys_area
where 1 = 1
<choose>
<when
test=
"id != null and id != '' "
>
and parent_id = #{id,jdbcType=INTEGER}
</when>
<otherwise>
and parent_id = 0
</otherwise>
</choose>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment