Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
pension
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
pension
Commits
545beac6
Commit
545beac6
authored
Mar 19, 2021
by
mlchun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.注册、登录
parent
6de52e01
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
178 additions
and
18 deletions
+178
-18
UserController.java
...-api/src/main/java/io/hmit/controller/UserController.java
+28
-4
UserDao.java
hmit-api/src/main/java/io/hmit/dao/UserDao.java
+3
-0
UserRegisterDTO.java
hmit-api/src/main/java/io/hmit/dto/UserRegisterDTO.java
+74
-0
UserEntity.java
hmit-api/src/main/java/io/hmit/entity/UserEntity.java
+4
-0
RoleUserDao.java
...in/java/io/hmit/modules/serviceOrder/dao/RoleUserDao.java
+1
-1
PensionOldFamilyDTO.java
...io/hmit/modules/serviceOrder/dto/PensionOldFamilyDTO.java
+9
-0
RoleUserService.java
...io/hmit/modules/serviceOrder/service/RoleUserService.java
+2
-0
RoleUserServiceImpl.java
...odules/serviceOrder/service/impl/RoleUserServiceImpl.java
+7
-0
UserService.java
hmit-api/src/main/java/io/hmit/service/UserService.java
+5
-4
UserServiceImpl.java
...i/src/main/java/io/hmit/service/impl/UserServiceImpl.java
+39
-8
UserDao.xml
hmit-api/src/main/resources/mapper/UserDao.xml
+5
-0
PensionOldFamilyDao.xml
...ain/resources/mapper/serviceOrder/PensionOldFamilyDao.xml
+1
-1
No files found.
hmit-api/src/main/java/io/hmit/controller/UserController.java
View file @
545beac6
package
io
.
hmit
.
controller
;
import
ch.qos.logback.core.pattern.ConverterUtil
;
import
com.alibaba.fastjson.JSON
;
import
io.hmit.annotation.Login
;
import
io.hmit.annotation.LoginUser
;
import
io.hmit.common.utils.ConvertUtils
;
...
...
@@ -8,21 +9,23 @@ import io.hmit.common.utils.Result;
import
io.hmit.dto.OrgUserInfoDTO
;
import
io.hmit.dto.ServiceUserInfoDTO
;
import
io.hmit.dto.UserInfoDTO
;
import
io.hmit.dto.UserRegisterDTO
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderEvaluationDTO
;
import
io.hmit.modules.serviceOrder.service.PensionOldFamilyService
;
import
io.hmit.service.UserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
springfox.documentation.annotations.ApiIgnore
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.util.List
;
/**
...
...
@@ -75,4 +78,25 @@ public class UserController {
return
new
Result
<
ServiceUserInfoDTO
>().
ok
(
serviceUser
);
}
@GetMapping
(
"checkIdCardNo"
)
@ApiOperation
(
"注册身份证ID查询"
)
public
Result
<
UserRegisterDTO
>
checkIdCardNo
(
@RequestParam
(
"idCardNo"
)
Long
idCardNo
){
UserRegisterDTO
userRegisterDTO
=
userService
.
getUserInfoByIdCardNo
(
idCardNo
);
return
new
Result
<
UserRegisterDTO
>().
ok
(
userRegisterDTO
);
}
@PostMapping
(
"registerUser"
)
@ApiOperation
(
"注册用户"
)
public
Result
registerUser
(
@RequestBody
String
dto
){
UserRegisterDTO
userRegisterDTO
=
null
;
try
{
userRegisterDTO
=
JSON
.
parseObject
(
URLDecoder
.
decode
(
dto
,
"UTF-8"
),
UserRegisterDTO
.
class
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
userService
.
registerUser
(
userRegisterDTO
);
return
new
Result
();
}
}
hmit-api/src/main/java/io/hmit/dao/UserDao.java
View file @
545beac6
...
...
@@ -3,6 +3,7 @@ package io.hmit.dao;
import
io.hmit.common.dao.BaseDao
;
import
io.hmit.dto.OrgUserInfoDTO
;
import
io.hmit.dto.ServiceUserInfoDTO
;
import
io.hmit.dto.UserRegisterDTO
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.UserRoleInfoDTO
;
import
org.apache.ibatis.annotations.Mapper
;
...
...
@@ -31,4 +32,6 @@ public interface UserDao extends BaseDao<UserEntity> {
List
<
UserRoleInfoDTO
>
getUserRoleInfo
(
Long
userId
);
UserRegisterDTO
getUserInfoByIdCardNo
(
Long
idCardNo
);
}
hmit-api/src/main/java/io/hmit/dto/UserRegisterDTO.java
0 → 100644
View file @
545beac6
package
io
.
hmit
.
dto
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
import
java.util.List
;
/**
* @author Eve
* @email mengmengeve@gmail.com
* @create 2021/1/27
*/
@Data
@ApiModel
(
value
=
"用户注册信息"
)
public
class
UserRegisterDTO
{
@JsonIgnore
private
Long
id
;
/**
* 用户名
*/
@ApiModelProperty
(
value
=
"姓名"
)
private
String
username
;
/**
* 手机号
*/
@ApiModelProperty
(
value
=
"手机号"
)
private
String
mobile
;
/**
* 身份证号码
*/
@ApiModelProperty
(
value
=
"身份证号码"
)
private
Long
idCardNo
;
/**
* 性别
*/
@ApiModelProperty
(
value
=
"性别"
)
private
String
gender
;
/**
* 地址_地区
*/
@ApiModelProperty
(
value
=
"地址_地区"
)
private
String
addressArea
;
/**
* 详细地址
*/
@ApiModelProperty
(
value
=
"详细地址"
)
private
String
address
;
/**
* 所属社区Id
*/
@ApiModelProperty
(
value
=
"所属社区ID"
)
private
Long
communityId
;
/**
* 所属社区名称
*/
@ApiModelProperty
(
value
=
"所属社区名称"
)
private
String
communityName
;
/**
* 微信openid
*/
@ApiModelProperty
(
value
=
"微信openid"
)
private
String
openid
;
/**
* 注册角色
*/
@ApiModelProperty
(
value
=
"注册角色"
)
private
Long
userRole
;
}
hmit-api/src/main/java/io/hmit/entity/UserEntity.java
View file @
545beac6
...
...
@@ -90,5 +90,9 @@ public class UserEntity implements Serializable {
* 所属社区Id
*/
private
Long
communityId
;
/**
* 身份证号码
*/
private
Long
idCardNo
;
}
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dao/RoleUserDao.java
View file @
545beac6
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOldFamilyDTO.java
View file @
545beac6
...
...
@@ -37,10 +37,19 @@ public class PensionOldFamilyDTO implements Serializable {
@ApiModelProperty
(
value
=
"家属与老人的关系"
)
private
String
familyMemberRole
;
@ApiModelProperty
(
value
=
"性别"
)
private
String
gender
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
mobile
;
@ApiModelProperty
(
value
=
"身份证号"
)
private
String
idCardNo
;
@ApiModelProperty
(
value
=
"地址_地区"
)
private
String
addressArea
;
@ApiModelProperty
(
value
=
"详细地址"
)
private
String
address
;
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/RoleUserService.java
View file @
545beac6
...
...
@@ -12,4 +12,6 @@ import io.hmit.modules.serviceOrder.entity.RoleUserEntity;
*/
public
interface
RoleUserService
extends
CrudService
<
RoleUserEntity
,
RoleUserDTO
>
{
void
addRelation
(
Long
roleId
,
Long
userId
);
}
\ No newline at end of file
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/RoleUserServiceImpl.java
View file @
545beac6
...
...
@@ -33,4 +33,11 @@ public class RoleUserServiceImpl extends CrudServiceImpl<RoleUserDao, RoleUserEn
}
@Override
public
void
addRelation
(
Long
roleId
,
Long
userId
)
{
RoleUserEntity
roleUserEntity
=
new
RoleUserEntity
();
roleUserEntity
.
setRoleId
(
roleId
);
roleUserEntity
.
setUserId
(
userId
);
insert
(
roleUserEntity
);
}
}
hmit-api/src/main/java/io/hmit/service/UserService.java
View file @
545beac6
...
...
@@ -2,10 +2,7 @@ package io.hmit.service;
import
io.hmit.common.page.PageData
;
import
io.hmit.common.service.BaseService
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.OrgUserInfoDTO
;
import
io.hmit.dto.ServiceUserInfoDTO
;
import
io.hmit.dto.UserInfoDTO
;
import
io.hmit.dto.*
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.PensionOrderDTO
;
...
...
@@ -48,4 +45,8 @@ public interface UserService extends BaseService<UserEntity> {
ServiceUserInfoDTO
getServiceUserByUserId
(
Long
userId
);
UserRegisterDTO
getUserInfoByIdCardNo
(
Long
idCardNo
);
void
registerUser
(
UserRegisterDTO
dto
);
}
hmit-api/src/main/java/io/hmit/service/impl/UserServiceImpl.java
View file @
545beac6
...
...
@@ -9,24 +9,19 @@ import io.hmit.common.service.impl.BaseServiceImpl;
import
io.hmit.common.utils.ConvertUtils
;
import
io.hmit.common.validator.AssertUtils
;
import
io.hmit.dao.UserDao
;
import
io.hmit.dto.LoginDTO
;
import
io.hmit.dto.OrgUserInfoDTO
;
import
io.hmit.dto.ServiceUserInfoDTO
;
import
io.hmit.dto.UserInfoDTO
;
import
io.hmit.dto.*
;
import
io.hmit.entity.TokenEntity
;
import
io.hmit.entity.UserEntity
;
import
io.hmit.modules.serviceOrder.dto.UserRoleInfoDTO
;
import
io.hmit.modules.serviceOrder.service.PensionOldFamilyService
;
import
io.hmit.modules.serviceOrder.service.RoleUserService
;
import
io.hmit.service.TokenService
;
import
io.hmit.service.UserService
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Service
public
class
UserServiceImpl
extends
BaseServiceImpl
<
UserDao
,
UserEntity
>
implements
UserService
{
...
...
@@ -40,6 +35,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Autowired
private
PensionOldFamilyService
pensionOldFamilyService
;
@Autowired
private
RoleUserService
roleUserService
;
@Override
public
UserEntity
getByMobile
(
String
mobile
)
{
return
baseDao
.
getUserByMobile
(
mobile
);
...
...
@@ -129,4 +127,37 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return
userDao
.
getServiceUserByUserId
(
userId
);
}
@Override
public
UserRegisterDTO
getUserInfoByIdCardNo
(
Long
idCardNo
)
{
return
userDao
.
getUserInfoByIdCardNo
(
idCardNo
);
}
@Override
public
void
registerUser
(
UserRegisterDTO
dto
)
{
UserRegisterDTO
userRegisterDTO
=
getUserInfoByIdCardNo
(
dto
.
getIdCardNo
());
UserEntity
userEntity
;
if
(
null
!=
userRegisterDTO
)
{
userEntity
=
getUserByUserId
(
userRegisterDTO
.
getId
());
userEntity
.
setOpenid
(
dto
.
getOpenid
());
updateById
(
userEntity
);
roleUserService
.
addRelation
(
dto
.
getUserRole
(),
userRegisterDTO
.
getId
());
}
else
{
userEntity
=
new
UserEntity
();
userEntity
.
setUsername
(
dto
.
getUsername
());
userEntity
.
setMobile
(
dto
.
getMobile
());
userEntity
.
setPassword
(
DigestUtils
.
sha256Hex
(
dto
.
getIdCardNo
().
toString
()));
userEntity
.
setAddress
(
dto
.
getAddress
());
userEntity
.
setAddressArea
(
dto
.
getAddressArea
());
userEntity
.
setCommunityId
(
dto
.
getCommunityId
());
userEntity
.
setCreateDate
(
new
Date
());
userEntity
.
setIdCardNo
(
dto
.
getIdCardNo
());
userEntity
.
setCommunityName
(
dto
.
getCommunityName
());
userEntity
.
setGender
(
Integer
.
parseInt
(
dto
.
getIdCardNo
().
toString
().
substring
(
16
,
17
))
%
2
==
1
?
"男"
:
"女"
);
userEntity
.
setOpenid
(
dto
.
getOpenid
());
insert
(
userEntity
);
UserEntity
byOpenId
=
getByOpenId
(
dto
.
getOpenid
());
roleUserService
.
addRelation
(
dto
.
getUserRole
(),
byOpenId
.
getId
());
}
}
}
\ No newline at end of file
hmit-api/src/main/resources/mapper/UserDao.xml
View file @
545beac6
...
...
@@ -39,4 +39,9 @@
WHERE tru.role_id = tr.id AND tru.user_id = #{userId};
</select>
<select
id=
"getUserInfoByIdCardNo"
resultType=
"io.hmit.dto.UserRegisterDTO"
>
SELECT * FROM tb_user
WHERE tb_user.id_card_no = #{idCardNo};
</select>
</mapper>
\ No newline at end of file
hmit-api/src/main/resources/mapper/serviceOrder/PensionOldFamilyDao.xml
View file @
545beac6
...
...
@@ -18,7 +18,7 @@
<select
id=
"findByOldId"
resultType=
"io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO"
>
SELECT tu.id, pof.old_id, pof.parent_role, pof.family_member_id, tu.username AS familyMemberName,
pof.family_member_role, tu.mobile, tu.id_card_no
pof.family_member_role, tu.mobile, tu.id_card_no
, tu.address_area, tu.address, tu.gender
FROM pension_old_family pof, tb_user tu
WHERE pof.family_member_id = tu.id and pof.old_id = #{oldId}
</select>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment