Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
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
8timerv2
8timerapiv200
Commits
23c03adc
Commit
23c03adc
authored
Jul 31, 2020
by
ilal
Committed by
chenzg
Jul 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二维码登录
parent
c2d5a64c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
182 additions
and
8 deletions
+182
-8
src/main/java/cn/timer/api/bean/zzgl/ZzglCodeLogin.java
+49
-0
src/main/java/cn/timer/api/controller/LoginController.java
+35
-8
src/main/java/cn/timer/api/dao/zzgl/ZzglCodeLoginMapper.java
+17
-0
src/main/resources/mapping/zzgl/ZzglCodeLoginMapper.xml
+81
-0
No files found.
src/main/java/cn/timer/api/bean/zzgl/ZzglCodeLogin.java
0 → 100644
View file @
23c03adc
package
cn
.
timer
.
api
.
bean
.
zzgl
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author LAL 2020-07-31
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"zzgl_code_login"
)
@ApiModel
(
"二维码登录"
)
public
class
ZzglCodeLogin
extends
Model
<
ZzglCodeLogin
>
{
/**
*
*/
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"id id"
,
example
=
"101"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"key_code "
,
example
=
"key_code"
)
private
String
keyCode
;
@ApiModelProperty
(
value
=
"vlaue "
,
example
=
"vlaue"
)
private
String
vlaue
;
}
\ No newline at end of file
src/main/java/cn/timer/api/controller/LoginController.java
View file @
23c03adc
...
...
@@ -53,6 +53,7 @@ import cn.timer.api.bean.qyzx.QyzxEntInfoM;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.bean.zzgl.ZzglAuth
;
import
cn.timer.api.bean.zzgl.ZzglBmgwM
;
import
cn.timer.api.bean.zzgl.ZzglCodeLogin
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.enuminterface.YgEnumInterface
;
...
...
@@ -912,8 +913,11 @@ public class LoginController {
String
result
=
new
cn
.
hutool
.
json
.
JSONObject
(
hashMap
).
toString
();
//转化为json格式
System
.
out
.
println
(
"全部信息="
+
result
);
//打印json串
session
.
setAttribute
(
key
,
timercode
);
session
.
setAttribute
(
key
+
"_code"
,
"1"
);
// session.setAttribute(key,timercode);
// session.setAttribute(key+"_code","1");
ZzglCodeLogin
.
builder
().
keyCode
(
key
).
vlaue
(
timercode
).
build
().
insert
();
ZzglCodeLogin
.
builder
().
keyCode
(
key
+
"_code"
).
vlaue
(
"1"
).
build
().
insert
();
// PrintWriter pw = response.getWriter();
ServletOutputStream
pw
=
response
.
getOutputStream
();
...
...
@@ -929,8 +933,15 @@ public class LoginController {
public
Result
<
QyzxEmpLogin
>
Scan_code_login
(
@CurrentUser
UserBean
userBean
,
@RequestBody
ScancodeloginparametersDto
scancodelogin
,
HttpServletRequest
request
)
throws
ParseException
{
String
current_time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
String
timer_code
=
session
.
getAttribute
(
scancodelogin
.
getKey
()+
"_code"
).
toString
();
//扫码状态
String
timercode
=
session
.
getAttribute
(
scancodelogin
.
getKey
()).
toString
();
//扫码时间
// String timer_code = session.getAttribute(scancodelogin.getKey()+"_code").toString(); //扫码状态
// String timercode = session.getAttribute(scancodelogin.getKey()).toString(); //扫码时间
ZzglCodeLogin
colo
=
ZzglCodeLogin
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
ZzglCodeLogin
>().
lambda
().
eq
(
ZzglCodeLogin:
:
getKeyCode
,
scancodelogin
.
getKey
()));
String
timercode
=
colo
.
getVlaue
();
ZzglCodeLogin
colo_
=
ZzglCodeLogin
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
ZzglCodeLogin
>().
lambda
().
eq
(
ZzglCodeLogin:
:
getKeyCode
,
scancodelogin
.
getKey
()+
"_code"
));
String
timer_code
=
colo_
.
getVlaue
();
timercode
=
ClockInTool
.
stampToDate
(
timercode
);
long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
timercode
,
"+"
+
expiration_time
)));
...
...
@@ -980,19 +991,30 @@ public class LoginController {
String
current_time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
if
(
scancodelogin
.
getKey
()
!=
null
)
{
String
timercode
=
session
.
getAttribute
(
scancodelogin
.
getKey
()).
toString
();
//扫码时间
// String timercode = session.getAttribute(scancodelogin.getKey()).toString(); //扫码时间
ZzglCodeLogin
colo
=
ZzglCodeLogin
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
ZzglCodeLogin
>().
lambda
().
eq
(
ZzglCodeLogin:
:
getKeyCode
,
scancodelogin
.
getKey
()));
if
(
colo
!=
null
)
{
String
timercode
=
colo
.
getVlaue
();
timercode
=
ClockInTool
.
stampToDate
(
timercode
);
long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
timercode
,
"+"
+
expiration_time
)));
Date
sd1
=
df1
.
parse
(
ClockInTool
.
stampToDate
(
String
.
valueOf
(
changed_time
)));
//当天应打的首次上班卡时间
Date
sd2
=
df1
.
parse
(
current_time
);
//当前时间
if
(
sd1
.
after
(
sd2
))
{
session
.
setAttribute
(
scancodelogin
.
getKey
()+
"_code"
,
"2"
);
// session.setAttribute(scancodelogin.getKey()+"_code","2");
ZzglCodeLogin
.
builder
().
vlaue
(
"2"
).
build
().
update
(
new
QueryWrapper
<
ZzglCodeLogin
>().
lambda
().
eq
(
ZzglCodeLogin:
:
getKeyCode
,
scancodelogin
.
getKey
()+
"_code"
));
return
ResultUtil
.
success
(
"扫码成功"
);
}
else
{
return
ResultUtil
.
error
(
"二维码已过期"
);
}
}
else
{
return
ResultUtil
.
error
(
"扫码失败"
);
}
}
else
{
return
ResultUtil
.
error
(
"验证失败"
);
}
...
...
@@ -1004,7 +1026,11 @@ public class LoginController {
String
current_time
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
if
(
scancodelogin
.
getKey
()
!=
null
)
{
String
timercode
=
session
.
getAttribute
(
scancodelogin
.
getKey
()).
toString
();
//扫码时间
// String timercode = session.getAttribute(scancodelogin.getKey()).toString(); //扫码时间
ZzglCodeLogin
colo
=
ZzglCodeLogin
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
ZzglCodeLogin
>().
lambda
().
eq
(
ZzglCodeLogin:
:
getKeyCode
,
scancodelogin
.
getKey
()));
String
timercode
=
colo
.
getVlaue
();
timercode
=
ClockInTool
.
stampToDate
(
timercode
);
long
changed_time
=
Long
.
valueOf
(
ClockInTool
.
dateToStamp
(
ClockInTool
.
addtime
(
timercode
,
"+"
+
expiration_time
)));
...
...
@@ -1012,7 +1038,8 @@ public class LoginController {
Date
sd2
=
df1
.
parse
(
current_time
);
//当前时间
if
(
sd1
.
after
(
sd2
))
{
session
.
setAttribute
(
scancodelogin
.
getKey
()+
"_code"
,
"3"
);
ZzglCodeLogin
.
builder
().
vlaue
(
"3"
).
build
().
update
(
new
QueryWrapper
<
ZzglCodeLogin
>().
lambda
().
eq
(
ZzglCodeLogin:
:
getKeyCode
,
scancodelogin
.
getKey
()+
"_code"
));
// session.setAttribute(scancodelogin.getKey()+"_code","3");
YgglMainEmp
ygam
=
YgglMainEmp
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
YgglMainEmp
>().
lambda
().
eq
(
YgglMainEmp:
:
getEmpNum
,
userBean
.
getEmpNum
()).
eq
(
YgglMainEmp:
:
getOrgCode
,
userBean
.
getOrgCode
()));
if
(
ygam
!=
null
)
{
...
...
src/main/java/cn/timer/api/dao/zzgl/ZzglCodeLoginMapper.java
0 → 100644
View file @
23c03adc
package
cn
.
timer
.
api
.
dao
.
zzgl
;
import
org.springframework.stereotype.Repository
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.zzgl.ZzglCodeLogin
;
/**
* 二维码登录
* @author LAL 2020-07-31
*/
@Repository
public
interface
ZzglCodeLoginMapper
extends
BaseMapper
<
ZzglCodeLogin
>
{
}
src/main/resources/mapping/zzgl/ZzglCodeLoginMapper.xml
0 → 100644
View file @
23c03adc
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.zzgl.ZzglCodeLoginMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"cn.timer.api.bean.zzgl.ZzglCodeLogin"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"key_code"
property=
"keyCode"
/>
<result
column=
"vlaue"
property=
"vlaue"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,
key_code,
vlaue
</sql>
<sql
id=
"Base_Column_List_Alias"
>
id ZzglCodeLogin_id,
key_code ZzglCodeLogin_key_code,
vlaue ZzglCodeLogin_vlaue
</sql>
<!--
<insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.zzgl.ZzglCodeLogin">
INSERT INTO zzgl_code_login
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test ='null != keyCode'>
key_code,
</if>
<if test ='null != vlaue'>
vlaue
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test ='null != keyCode'>
#{keyCode},
</if>
<if test ='null != vlaue'>
#{vlaue}
</if>
</trim>
</insert>
<delete id="delete" >
DELETE FROM zzgl_code_login
WHERE id = #{id}
</delete>
<update id="update" parameterType="cn.timer.api.bean.zzgl.ZzglCodeLogin">
UPDATE zzgl_code_login
<set>
<if test ='null != keyCode'>key_code = #{keyCode},</if>
<if test ='null != vlaue'>vlaue = #{vlaue}</if>
</set>
WHERE id = #{id}
</update>
<select id="load" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_code_login
WHERE id = #{id}
</select>
<select id="pageList" resultMap="BaseResultMap">
SELECT <include refid="Base_Column_List" />
FROM zzgl_code_login
LIMIT #{offset}, #{pageSize}
</select>
<select id="pageListCount" resultType="java.lang.Integer">
SELECT count(1)
FROM zzgl_code_login
</select>
-->
</mapper>
\ No newline at end of file
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