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
4f369cd6
Commit
4f369cd6
authored
Mar 23, 2021
by
zsh
🇨🇳
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Shen' into 'master'
Shen See merge request
!18
parents
24182b73
c30e13b6
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
208 additions
and
22 deletions
+208
-22
SwaggerConfig.java
hmit-api/src/main/java/io/hmit/config/SwaggerConfig.java
+1
-1
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
PensionOrderController.java
...dules/serviceOrder/controller/PensionOrderController.java
+1
-1
RoleUserDao.java
...in/java/io/hmit/modules/serviceOrder/dao/RoleUserDao.java
+1
-1
PensionOldFamilyDTO.java
...io/hmit/modules/serviceOrder/dto/PensionOldFamilyDTO.java
+11
-2
RoleUserService.java
...io/hmit/modules/serviceOrder/service/RoleUserService.java
+2
-0
PensionOrderServiceImpl.java
...es/serviceOrder/service/impl/PensionOrderServiceImpl.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
+61
-8
UserDao.xml
hmit-api/src/main/resources/mapper/UserDao.xml
+5
-0
PensionOldFamilyDao.xml
...ain/resources/mapper/serviceOrder/PensionOldFamilyDao.xml
+3
-1
No files found.
hmit-api/src/main/java/io/hmit/config/SwaggerConfig.java
View file @
4f369cd6
...
...
@@ -27,7 +27,7 @@ public class SwaggerConfig {
@Bean
public
Docket
createRestApi
()
{
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
//
.host("byyl.zjhmit.com")
.
host
(
"byyl.zjhmit.com"
)
.
apiInfo
(
apiInfo
())
.
select
()
//加了ApiOperation注解的类,才生成接口文档
...
...
hmit-api/src/main/java/io/hmit/controller/UserController.java
View file @
4f369cd6
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 @
4f369cd6
...
...
@@ -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 @
4f369cd6
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 @
4f369cd6
...
...
@@ -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/controller/PensionOrderController.java
View file @
4f369cd6
...
...
@@ -261,7 +261,7 @@ public class PensionOrderController {
@ApiImplicitParams
({
@ApiImplicitParam
(
name
=
Constant
.
PAGE
,
value
=
"当前页码,从1开始"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
LIMIT
,
value
=
"每页显示记录数"
,
paramType
=
"query"
,
required
=
true
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
"status"
,
value
=
"订单状态:
0未接单
6待完成 3已取消 4待评价 留空全部"
,
paramType
=
"query"
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
"status"
,
value
=
"订单状态: 6待完成 3已取消 4待评价 留空全部"
,
paramType
=
"query"
,
dataType
=
"int"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER_FIELD
,
value
=
"排序字段"
,
paramType
=
"query"
,
dataType
=
"String"
)
,
@ApiImplicitParam
(
name
=
Constant
.
ORDER
,
value
=
"排序方式,可选值(asc、desc)"
,
paramType
=
"query"
,
dataType
=
"String"
)
})
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dao/RoleUserDao.java
View file @
4f369cd6
hmit-api/src/main/java/io/hmit/modules/serviceOrder/dto/PensionOldFamilyDTO.java
View file @
4f369cd6
...
...
@@ -31,16 +31,25 @@ public class PensionOldFamilyDTO implements Serializable {
@ApiModelProperty
(
value
=
"家属id"
)
private
Long
familyMemberId
;
@ApiModelProperty
(
value
=
"家属姓名"
)
private
String
familyMemberName
;
@ApiModelProperty
(
value
=
"家属与老人的关系"
)
private
String
familyMemberRole
;
@ApiModelProperty
(
value
=
"性别"
)
private
String
gender
;
@ApiModelProperty
(
value
=
"手机号"
)
private
String
mobile
;
@ApiModelProperty
(
value
=
"身份证号"
)
private
String
idCardNo
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
@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 @
4f369cd6
...
...
@@ -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/PensionOrderServiceImpl.java
View file @
4f369cd6
...
...
@@ -123,8 +123,10 @@ public class PensionOrderServiceImpl extends CrudServiceImpl<PensionOrderDao, Pe
}
else
if
(
status
!=
6
)
{
list
=
pensionOrderDao
.
getElderAllOrderOrByStatusList
(
params
,
creator
,
status
);
}
else
{
List
<
PensionOrderDTO
>
list0
=
pensionOrderDao
.
getElderAllOrderOrByStatusList
(
params
,
creator
,
0
);
List
<
PensionOrderDTO
>
list1
=
pensionOrderDao
.
getElderAllOrderOrByStatusList
(
params
,
creator
,
1
);
List
<
PensionOrderDTO
>
list2
=
pensionOrderDao
.
getElderAllOrderOrByStatusList
(
params
,
creator
,
5
);
list
.
addAll
(
list0
);
list
.
addAll
(
list1
);
list
.
addAll
(
list2
);
}
...
...
hmit-api/src/main/java/io/hmit/modules/serviceOrder/service/impl/RoleUserServiceImpl.java
View file @
4f369cd6
...
...
@@ -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 @
4f369cd6
...
...
@@ -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 @
4f369cd6
...
...
@@ -9,24 +9,22 @@ 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.
text.ParseException
;
import
java.
text.SimpleDateFormat
;
import
java.util.
*
;
import
java.util.
stream.Collectors
;
@Service
public
class
UserServiceImpl
extends
BaseServiceImpl
<
UserDao
,
UserEntity
>
implements
UserService
{
...
...
@@ -40,6 +38,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
);
...
...
@@ -101,6 +102,7 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
map
.
put
(
"token"
,
tokenEntity
.
getToken
());
map
.
put
(
"expire"
,
tokenEntity
.
getExpireDate
().
getTime
()
-
System
.
currentTimeMillis
());
List
<
UserRoleInfoDTO
>
roles
=
userDao
.
getUserRoleInfo
(
user
.
getId
());
roles
=
roles
.
stream
().
distinct
().
collect
(
Collectors
.
toList
());
map
.
put
(
"roles"
,
roles
);
return
map
;
...
...
@@ -129,4 +131,55 @@ 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
)
{
UserEntity
reRegister
=
getByOpenId
(
dto
.
getOpenid
());
if
(
null
!=
reRegister
)
{
reRegister
.
setOpenid
(
""
);
updateById
(
reRegister
);
}
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
.
setHealthStatus
(
"良好"
);
//TODO
String
year
=
dto
.
getIdCardNo
().
toString
().
substring
(
6
,
10
);
String
month
=
dto
.
getIdCardNo
().
toString
().
substring
(
10
,
12
);
String
day
=
dto
.
getIdCardNo
().
toString
().
substring
(
12
,
14
);
String
time
=
year
+
"-"
+
month
+
"-"
+
day
;
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
date
=
new
Date
();
try
{
date
=
sdf
.
parse
(
time
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
userEntity
.
setBirthday
(
date
);
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 @
4f369cd6
...
...
@@ -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 @
4f369cd6
...
...
@@ -17,7 +17,9 @@
</resultMap>
<select
id=
"findByOldId"
resultType=
"io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO"
>
SELECT * FROM pension_old_family pof, tb_user tu
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, 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