Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
c3ed3135
Commit
c3ed3135
authored
Apr 21, 2020
by
黄森林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信注册
parent
e5ad2787
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
183 additions
and
24 deletions
+183
-24
common/src/main/java/com/winsun/mapper/SchoolMapper.java
+3
-0
common/src/main/java/com/winsun/mapper/SysUserMapper.java
+6
-0
common/src/main/java/com/winsun/utils/HttpHelper.java
+4
-24
core-service/src/main/java/com/winsun/item/modular/system/controller/LoginPwdController.java
+3
-0
service-manager/pom.xml
+4
-0
service-manager/src/main/java/com/winsun/controller/MobileTerminalUserController.java
+163
-0
No files found.
common/src/main/java/com/winsun/mapper/SchoolMapper.java
View file @
c3ed3135
...
...
@@ -20,4 +20,7 @@ public interface SchoolMapper extends BaseMapper<School> {
@Select
(
"select school_id schoolId from `hhr_user_school` where user_id = #{partner}"
)
String
selectSchoolIdByUserId
(
String
partner
);
@Select
(
"SELECT sub_name FROM `hhr_school` GROUP BY sub_name"
)
List
<
String
>
selectAdress
();
}
common/src/main/java/com/winsun/mapper/SysUserMapper.java
View file @
c3ed3135
...
...
@@ -2,7 +2,10 @@ package com.winsun.mapper;
import
com.baomidou.mybatisplus.mapper.BaseMapper
;
import
com.winsun.bean.SysUser
;
import
org.apache.ibatis.annotations.Insert
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Options
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
/**
...
...
@@ -11,4 +14,7 @@ import org.springframework.stereotype.Component;
@Mapper
@Component
public
interface
SysUserMapper
extends
BaseMapper
<
SysUser
>
{
@Insert
(
"insert into `hhr_user` (user_id,school_id) values(#{userId},#{schoolId})"
)
Integer
insertUserSchool
(
@Param
(
"userId"
)
String
userId
,
@Param
(
"schoolId"
)
String
schoolId
);
}
common/src/main/java/com/winsun/utils/HttpHelper.java
View file @
c3ed3135
...
...
@@ -2,6 +2,7 @@ package com.winsun.utils;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.winsun.auth.core.util.IOUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpHost
;
import
org.apache.http.HttpResponse
;
...
...
@@ -91,15 +92,7 @@ public class HttpHelper {
}
catch
(
IOException
e
)
{
log
.
error
(
"http请求异常"
+
e
.
getMessage
(),
e
);
}
finally
{
if
(
response
!=
null
)
try
{
response
.
close
();
//释放资源
}
catch
(
IOException
e
)
{
log
.
error
(
"http请求异常"
+
e
.
getMessage
(),
e
);
}
if
(
httpClient
!=
null
){
httpClient
.
close
();
}
IOUtils
.
closeQuite
(
response
,
httpClient
);
}
return
null
;
...
...
@@ -168,15 +161,7 @@ public class HttpHelper {
}
catch
(
IOException
e
)
{
log
.
error
(
"http请求异常"
+
e
.
getMessage
(),
e
);
}
finally
{
if
(
response
!=
null
)
try
{
response
.
close
();
//释放资源
}
catch
(
IOException
e
)
{
log
.
error
(
"http请求异常"
+
e
.
getMessage
(),
e
);
}
if
(
httpClient
!=
null
){
httpClient
.
close
();
}
IOUtils
.
closeQuite
(
response
,
httpClient
);
}
return
null
;
...
...
@@ -243,12 +228,7 @@ public class HttpHelper {
}
catch
(
IllegalStateException
e
)
{
log
.
error
(
"http代理请求异常"
+
e
.
getMessage
(),
e
);
}
finally
{
try
{
httpClient
.
close
();
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
log
.
error
(
"http代理请求异常"
+
e
.
getMessage
(),
e
);
}
IOUtils
.
closeQuite
(
httpClient
);
}
return
string
;
...
...
core-service/src/main/java/com/winsun/item/modular/system/controller/LoginPwdController.java
View file @
c3ed3135
...
...
@@ -186,6 +186,7 @@ public class LoginPwdController extends BaseController {
String
openId
=
map
.
get
(
"openid"
).
toString
();
Wrapper
<
HhrUser
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"open_id"
,
openId
);
log
.
info
(
"openId:"
+
openId
);
List
<
HhrUser
>
hhrUsers
=
hhrUserMapper
.
selectList
(
wrapper
);
if
(
hhrUsers
.
size
()
==
0
)
{
return
ResponseData
.
error
(
"当前微信未绑定账号,请先绑定账号!"
);
...
...
@@ -244,6 +245,7 @@ public class LoginPwdController extends BaseController {
}
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
jsonObject
,
Map
.
class
);
String
openId
=
map
.
get
(
"openid"
).
toString
();
log
.
info
(
"openId:"
+
openId
);
SysUser
sysUser
=
users
.
get
(
0
);
Wrapper
<
HhrUser
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
sysUser
.
getId
());
...
...
@@ -303,6 +305,7 @@ public class LoginPwdController extends BaseController {
}
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
jsonObject
,
Map
.
class
);
String
openId
=
map
.
get
(
"openid"
).
toString
();
log
.
info
(
"openId:"
+
openId
);
SysUser
sysUser
=
users
.
get
(
0
);
Wrapper
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"id"
,
sysUser
.
getId
());
...
...
service-manager/pom.xml
View file @
c3ed3135
...
...
@@ -131,6 +131,10 @@
<artifactId>
easyexcel
</artifactId>
<version>
2.1.6
</version>
</dependency>
<dependency>
<groupId>
com.winsun.framework
</groupId>
<artifactId>
winsun-core-service
</artifactId>
</dependency>
</dependencies>
<build>
...
...
service-manager/src/main/java/com/winsun/controller/MobileTerminalUserController.java
0 → 100644
View file @
c3ed3135
package
com
.
winsun
.
controller
;
import
com.baomidou.mybatisplus.mapper.EntityWrapper
;
import
com.baomidou.mybatisplus.mapper.Wrapper
;
import
com.winsun.auth.core.common.model.ResponseData
;
import
com.winsun.bean.HhrUser
;
import
com.winsun.bean.School
;
import
com.winsun.bean.SysUser
;
import
com.winsun.item.core.shiro.ShiroKit
;
import
com.winsun.mapper.HhrUserMapper
;
import
com.winsun.mapper.SchoolMapper
;
import
com.winsun.mapper.SysUserMapper
;
import
com.winsun.utils.IDCardUtil
;
import
com.winsun.utils.PicturesUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.security.NoSuchAlgorithmException
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Author: hsl
* @Date: 2020/4/21 11:19
*/
@RequestMapping
(
"mobileTerminalUser"
)
@RestController
@Slf4j
public
class
MobileTerminalUserController
{
private
static
String
PATHTYPE
=
"idCard"
;
private
static
HhrUserMapper
hhrUserMapper
;
private
static
SysUserMapper
sysUserMapper
;
private
static
SchoolMapper
schoolMapper
;
@Autowired
public
MobileTerminalUserController
(
HhrUserMapper
hhrUserMapper
,
SysUserMapper
sysUserMapper
,
SchoolMapper
schoolMapper
){
MobileTerminalUserController
.
hhrUserMapper
=
hhrUserMapper
;
MobileTerminalUserController
.
sysUserMapper
=
sysUserMapper
;
MobileTerminalUserController
.
schoolMapper
=
schoolMapper
;
}
@RequestMapping
(
"selectAddress"
)
public
ResponseData
<
List
<
String
>>
selectAddress
(){
return
ResponseData
.
success
(
schoolMapper
.
selectAdress
());
}
@RequestMapping
(
"selectSchool"
)
public
ResponseData
<
List
<
Map
<
String
,
Object
>>>
selectSchool
(
String
subName
){
Wrapper
<
School
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"sub_name"
,
subName
);
wrapper
.
setSqlSelect
(
"id"
,
"school_name"
);
List
<
Map
<
String
,
Object
>>
list
=
schoolMapper
.
selectMaps
(
wrapper
);
return
ResponseData
.
success
(
list
);
}
@RequestMapping
(
"registeredAccount"
)
public
ResponseData
<
String
>
registeredAccount
(
@RequestParam
(
"gender"
)
String
gender
,
@RequestParam
(
"username"
)
String
username
,
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"idCard"
)
String
idCard
,
@RequestParam
(
"stuCard"
)
String
stuCard
,
@RequestParam
(
"idcardZ"
)
String
idcardZ
,
@RequestParam
(
"password"
)
String
password
,
@RequestParam
(
"cpassword"
)
String
cpassword
,
@RequestParam
(
"school"
)
String
school
,
@RequestParam
(
"classZ"
)
String
classZ
,
@RequestParam
(
"substName"
)
String
substName
,
@RequestParam
(
"account"
)
String
account
)
throws
NoSuchAlgorithmException
{
if
(
StringUtils
.
isBlank
(
gender
)){
return
ResponseData
.
error
(
"性别不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
username
)){
return
ResponseData
.
error
(
"姓名不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
phone
)){
return
ResponseData
.
error
(
"电话不能为空!"
);
}
if
(
phone
.
length
()
!=
11
){
return
ResponseData
.
error
(
"手机号码有误!"
);
}
if
(
StringUtils
.
isBlank
(
idCard
)){
return
ResponseData
.
error
(
"身份证号码不能为空!"
);
}
if
(!
IDCardUtil
.
IDCardValidate
(
idCard
)){
return
ResponseData
.
error
(
"身份证号码有误!"
);
}
if
(
StringUtils
.
isBlank
(
stuCard
)){
return
ResponseData
.
error
(
"请上传学生证!"
);
}
if
(
StringUtils
.
isBlank
(
idcardZ
)){
return
ResponseData
.
error
(
"请上传身份证!"
);
}
if
(
StringUtils
.
isBlank
(
password
)){
return
ResponseData
.
error
(
"密码不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
cpassword
)){
return
ResponseData
.
error
(
"原密码不能为空!"
);
}
if
(!
password
.
equals
(
cpassword
)){
return
ResponseData
.
error
(
"密码和原密码不同!"
);
}
if
(
StringUtils
.
isBlank
(
school
)){
return
ResponseData
.
error
(
"学校不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
substName
)){
return
ResponseData
.
error
(
"县分不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
classZ
)){
return
ResponseData
.
error
(
"年级不能为空!"
);
}
if
(
StringUtils
.
isBlank
(
account
)){
return
ResponseData
.
error
(
"账号不能为空!"
);
}
String
pattern
=
"^(?![A-Za-z]+$)(?![A-Z\\d]+$)(?![A-Z\\W]+$)(?![a-z\\d]+$)(?![a-z\\W]+$)(?![\\d\\W]+$)\\S{8,}$"
;
if
(!
password
.
matches
(
pattern
))
{
return
ResponseData
.
error
(
"密码强制等级低,必须要数字、小写英文字母、大写英文字母或特殊字符混合组成,长度至少8位!"
);
}
if
(
password
.
contains
(
account
))
{
return
ResponseData
.
error
(
"密码与账号信息吻合,禁止使用!"
);
}
Wrapper
<
SysUser
>
wrapper
=
new
EntityWrapper
<>();
wrapper
.
eq
(
"account"
,
account
);
List
<
SysUser
>
users
=
sysUserMapper
.
selectList
(
wrapper
);
if
(
users
.
size
()
!=
0
){
return
ResponseData
.
error
(
"账号已被使用,请换一个账号!"
);
}
Wrapper
<
HhrUser
>
wrapper1
=
new
EntityWrapper
<>();
wrapper1
.
eq
(
"id_card"
,
account
);
List
<
HhrUser
>
hhrUsers
=
hhrUserMapper
.
selectList
(
wrapper1
);
if
(
hhrUsers
.
size
()
!=
0
){
return
ResponseData
.
error
(
"一个身份证只能创建一个账号,请换一个身份证!"
);
}
int
insert
=
0
;
SysUser
sysUser
=
new
SysUser
();
sysUser
.
setSex
(
gender
);
sysUser
.
setAccount
(
account
);
sysUser
.
setName
(
username
);
sysUser
.
setPhone
(
phone
);
sysUser
.
setSalt
(
ShiroKit
.
getRandomSalt
(
5
));
sysUser
.
setSubstName
(
substName
);
sysUser
.
setPassword
(
ShiroKit
.
md5
(
password
,
sysUser
.
getSalt
()));
insert
=+
sysUserMapper
.
insert
(
sysUser
);
insert
=+
sysUserMapper
.
insertUserSchool
(
sysUser
.
getId
(),
school
);
HhrUser
hhrUser
=
new
HhrUser
();
hhrUser
.
setId
(
sysUser
.
getId
());
hhrUser
.
setIdCard
(
idCard
);
hhrUser
.
setIdcardImgUrl
(
PicturesUtil
.
uploadPictures
(
idcardZ
,
sysUser
.
getId
(),
PATHTYPE
));
hhrUser
.
setStudentImgUrl
(
PicturesUtil
.
uploadPictures
(
stuCard
,
sysUser
.
getId
(),
PATHTYPE
));
hhrUser
.
setGrade
(
classZ
);
insert
=+
hhrUserMapper
.
insert
(
hhrUser
);
if
(
insert
==
3
){
return
ResponseData
.
success
(
"账号创建成功!"
);
}
if
(
insert
==
0
){
return
ResponseData
.
error
(
"账号创建失败!"
);
}
return
ResponseData
.
error
(
"账号创建异常,请联系管理员!"
);
}
}
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