Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gassafety-progress
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
耿迪迪
gassafety-progress
Commits
0321965b
Commit
0321965b
authored
Mar 08, 2022
by
wuqinghua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022-3-8 吴卿华
parent
910cf076
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
206 deletions
+49
-206
TEmployedPeopleInfoController.java
...b/controller/supervise/TEmployedPeopleInfoController.java
+2
-42
SecurityConfig.java
...main/java/com/zehong/framework/config/SecurityConfig.java
+15
-4
TEmployedPeopleInfoMapper.xml
...ain/resources/mapper/system/TEmployedPeopleInfoMapper.xml
+2
-1
index.vue
...fetyprogress-web/src/views/regulation/supervise/index.vue
+30
-159
No files found.
gassafetyprogress-admin/src/main/java/com/zehong/web/controller/supervise/TEmployedPeopleInfoController.java
View file @
0321965b
package
com
.
zehong
.
web
.
controller
.
supervise
;
package
com
.
zehong
.
web
.
controller
.
supervise
;
import
java.io.File
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -16,7 +12,7 @@ import com.zehong.system.domain.TEmployedPeopleInfo;
...
@@ -16,7 +12,7 @@ import com.zehong.system.domain.TEmployedPeopleInfo;
import
com.zehong.system.service.ITEmployedPeopleInfoService
;
import
com.zehong.system.service.ITEmployedPeopleInfoService
;
import
com.zehong.common.utils.poi.ExcelUtil
;
import
com.zehong.common.utils.poi.ExcelUtil
;
import
com.zehong.common.core.page.TableDataInfo
;
import
com.zehong.common.core.page.TableDataInfo
;
import
org.springframework.web.multipart.MultipartFile
;
/**
/**
* 从业人员信息Controller
* 从业人员信息Controller
...
@@ -72,7 +68,7 @@ public class TEmployedPeopleInfoController extends BaseController
...
@@ -72,7 +68,7 @@ public class TEmployedPeopleInfoController extends BaseController
@PreAuthorize
(
"@ss.hasPermi('regulation:supervise:add')"
)
@PreAuthorize
(
"@ss.hasPermi('regulation:supervise:add')"
)
@Log
(
title
=
"从业人员信息"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"从业人员信息"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
@PostMapping
public
AjaxResult
add
(
TEmployedPeopleInfo
tEmployedPeopleInfo
)
throws
ParseException
{
public
AjaxResult
add
(
@RequestBody
TEmployedPeopleInfo
tEmployedPeopleInfo
)
throws
ParseException
{
//根据企业id查询企业名称
//根据企业id查询企业名称
String
EnterpriseName
=
tEmployedPeopleInfoService
.
selectEnterpriseName
(
tEmployedPeopleInfo
.
getBeyondEnterpriseId
());
String
EnterpriseName
=
tEmployedPeopleInfoService
.
selectEnterpriseName
(
tEmployedPeopleInfo
.
getBeyondEnterpriseId
());
tEmployedPeopleInfo
.
setBeyondEnterpriseName
(
EnterpriseName
);
tEmployedPeopleInfo
.
setBeyondEnterpriseName
(
EnterpriseName
);
...
@@ -112,41 +108,5 @@ public class TEmployedPeopleInfoController extends BaseController
...
@@ -112,41 +108,5 @@ public class TEmployedPeopleInfoController extends BaseController
return
AjaxResult
.
success
(
tEmployedPeopleInfoService
.
selectTEnterprise
());
return
AjaxResult
.
success
(
tEmployedPeopleInfoService
.
selectTEnterprise
());
}
}
/**
* 图片上传接口
* @param file
* @return
*/
@ResponseBody
@RequestMapping
(
"/addParent"
)
public
String
upFile
(
@RequestParam
(
"file"
)
MultipartFile
file
)
{
String
path
=
"D:\\img"
;
String
fileName
=
file
.
getOriginalFilename
();
//获取文件名称
String
suffixName
=
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
//获取文件后缀
//uuid+文件名
fileName
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
).
toLowerCase
()+
suffixName
;
//重新生成文件名
System
.
out
.
println
(
fileName
);
System
.
out
.
println
(
"type::"
+
suffixName
);
System
.
out
.
println
(
"filename::"
+
fileName
);
File
targetFile
=
new
File
(
path
);
if
(!
targetFile
.
exists
())
{
// 判断文件夹是否未空,空则创建
targetFile
.
mkdirs
();
}
File
saveFile
=
new
File
(
targetFile
,
fileName
);
try
{
//指定本地存入路径
file
.
transferTo
(
saveFile
);
System
.
out
.
println
(
"执行成功"
);
String
path1
=
path
+
fileName
;
//图片存储地址
System
.
out
.
println
(
path1
);
return
path1
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"执行失败"
);
return
"failed"
;
}
}
}
}
gassafetyprogress-framework/src/main/java/com/zehong/framework/config/SecurityConfig.java
View file @
0321965b
...
@@ -7,6 +7,7 @@ import org.springframework.security.authentication.AuthenticationManager;
...
@@ -7,6 +7,7 @@ import org.springframework.security.authentication.AuthenticationManager;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.builders.WebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.security.config.http.SessionCreationPolicy
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
...
@@ -20,7 +21,7 @@ import com.zehong.framework.security.handle.LogoutSuccessHandlerImpl;
...
@@ -20,7 +21,7 @@ import com.zehong.framework.security.handle.LogoutSuccessHandlerImpl;
/**
/**
* spring security配置
* spring security配置
*
*
* @author zehong
* @author zehong
*/
*/
@EnableGlobalMethodSecurity
(
prePostEnabled
=
true
,
securedEnabled
=
true
)
@EnableGlobalMethodSecurity
(
prePostEnabled
=
true
,
securedEnabled
=
true
)
...
@@ -31,7 +32,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -31,7 +32,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/
*/
@Autowired
@Autowired
private
UserDetailsService
userDetailsService
;
private
UserDetailsService
userDetailsService
;
/**
/**
* 认证失败处理类
* 认证失败处理类
*/
*/
...
@@ -55,7 +56,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -55,7 +56,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
*/
*/
@Autowired
@Autowired
private
CorsFilter
corsFilter
;
private
CorsFilter
corsFilter
;
/**
/**
* 解决 无法直接注入 AuthenticationManager
* 解决 无法直接注入 AuthenticationManager
*
*
...
@@ -125,7 +126,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -125,7 +126,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
httpSecurity
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
httpSecurity
.
addFilterBefore
(
corsFilter
,
LogoutFilter
.
class
);
}
}
/**
/**
* 强散列哈希加密实现
* 强散列哈希加密实现
*/
*/
...
@@ -143,4 +144,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
...
@@ -143,4 +144,14 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
{
{
auth
.
userDetailsService
(
userDetailsService
).
passwordEncoder
(
bCryptPasswordEncoder
());
auth
.
userDetailsService
(
userDetailsService
).
passwordEncoder
(
bCryptPasswordEncoder
());
}
}
/**
* 静态资源放行
* @param web
*/
@Override
public
void
configure
(
WebSecurity
web
)
{
web
.
ignoring
().
antMatchers
(
"/static/**"
,
"/index.html"
,
"/login"
);
}
}
}
gassafetyprogress-system/src/main/resources/mapper/system/TEmployedPeopleInfoMapper.xml
View file @
0321965b
...
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
</select>
<select
id=
"selectTEmployedPeopleInfoById"
parameterType=
"Long"
resultMap=
"TEmployedPeopleInfoResult"
>
<select
id=
"selectTEmployedPeopleInfoById"
parameterType=
"Long"
resultMap=
"TEmployedPeopleInfoResult"
>
select employed_people_id, employed_people_name, id_card, certificate_num, beyond_enterprise_name, beyond_enterprise_id, register_examination_type, people_occupation, issue_date, certificate_change, create_by, create_time, update_by, update_time, is_del, remarks from t_employed_people_info
select employed_people_id, employed_people_name, id_card, certificate_num, beyond_enterprise_name, beyond_enterprise_id, register_examination_type, people_occupation, issue_date, certificate_change, create_by, create_time, update_by, update_time, is_del, remarks
,avatar_address
from t_employed_people_info
where employed_people_id = #{employedPeopleId} and is_del='0'
where employed_people_id = #{employedPeopleId} and is_del='0'
</select>
</select>
...
@@ -119,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -119,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"isDel != null"
>
is_del = #{isDel},
</if>
<if
test=
"isDel != null"
>
is_del = #{isDel},
</if>
<if
test=
"remarks != null"
>
remarks = #{remarks},
</if>
<if
test=
"remarks != null"
>
remarks = #{remarks},
</if>
<if
test=
"avatarAddress != null"
>
avatar_address = #{avatarAddress},
</if>
</trim>
</trim>
where employed_people_id = #{employedPeopleId}
where employed_people_id = #{employedPeopleId}
</update>
</update>
...
...
gassafetyprogress-web/src/views/regulation/supervise/index.vue
View file @
0321965b
...
@@ -83,6 +83,11 @@
...
@@ -83,6 +83,11 @@
<el-table
v-loading=
"loading"
:data=
"infoList"
@
selection-change=
"handleSelectionChange"
>
<el-table
v-loading=
"loading"
:data=
"infoList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"照片"
align=
"center"
>
<template
scope=
"List"
>
<img
:src=
"List.row.avatarAddress"
width=
"100px"
>
</
template
>
</el-table-column>
<el-table-column
label=
"姓名"
align=
"center"
prop=
"employedPeopleName"
/>
<el-table-column
label=
"姓名"
align=
"center"
prop=
"employedPeopleName"
/>
<el-table-column
label=
"身份证号"
align=
"center"
prop=
"idCard"
/>
<el-table-column
label=
"身份证号"
align=
"center"
prop=
"idCard"
/>
<el-table-column
label=
"技能岗位证书编号"
align=
"center"
prop=
"certificateNum"
/>
<el-table-column
label=
"技能岗位证书编号"
align=
"center"
prop=
"certificateNum"
/>
...
@@ -139,20 +144,14 @@
...
@@ -139,20 +144,14 @@
<el-row>
<el-row>
<el-col
:span=
"22"
>
<el-col
:span=
"22"
>
<el-form-item
label=
"上传头像"
prop=
"idCard"
>
<el-form-item
label=
"上传照片"
>
<el-upload
<FileUpload
class=
"upload-demo"
listType=
"picture"
:on-preview=
"handlePreview"
@
resFun=
"getFileInfo"
:on-remove=
"handleRemove"
@
remove=
"listRemove"
:on-change=
"fileChange"
:fileArr=
"fileList"
>
:before-upload=
"beforeUploadFile"
</FileUpload>
:before-remove=
"beforeRemove"
<el-input
v-show=
"false"
disabled
v-model=
"form.avatarAddress"
></el-input>
:limit=
"1"
:on-exceed=
"handleExceed"
:file-list=
"fileList"
>
<el-button
size=
"small"
type=
"primary"
>
点击上传
</el-button>
<div
slot=
"tip"
class=
"el-upload__tip"
>
只能上传jpg/jpeg/png格式,且不超过10MB
</div>
</el-upload>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
</el-row>
</el-row>
...
@@ -232,15 +231,18 @@
...
@@ -232,15 +231,18 @@
<
script
>
<
script
>
import
{
listInfo
,
getInfo
,
delInfo
,
addInfo
,
updateInfo
,
exportInfo
,
selectTEnterprise
,
addFile
}
from
"@/api/regulation/supervise"
;
import
{
listInfo
,
getInfo
,
delInfo
,
addInfo
,
updateInfo
,
exportInfo
,
selectTEnterprise
,
addFile
}
from
"@/api/regulation/supervise"
;
import
FileUpload
from
'@/components/FileSuperviseUpload'
;
export
default
{
export
default
{
name
:
"Info"
,
name
:
"Info"
,
components
:
{
components
:
{
FileUpload
,
},
},
data
()
{
data
()
{
return
{
return
{
//头像
//头像
这个数组只用做前端展示已经上传的图片名称使用 不存放真实的文件数据
fileList
:
[],
fileList
:
[],
//头像 这个数据存储file文件数据 向后台发送文件数据
fileLists
:
[],
//头像数据
//头像数据
fileo
:{
fileo
:{
name
:
""
,
name
:
""
,
...
@@ -297,41 +299,17 @@ export default {
...
@@ -297,41 +299,17 @@ export default {
this
.
getList
();
this
.
getList
();
},
},
methods
:
{
methods
:
{
/**上传头像方法*/
/**上传头像*/
handleRemove
(
file
,
fileList
)
{
getFileInfo
(
res
){
console
.
log
(
file
,
fileList
);
this
.
form
.
dealPlan
=
res
.
fileName
;
},
this
.
form
.
avatarAddress
=
res
.
url
;
handlePreview
(
file
)
{
this
.
fileList
.
push
({
console
.
log
(
file
);
name
:
res
.
fileName
,
},
url
:
uploadfile
,
handleExceed
(
files
,
fileList
)
{
});
this
.
$message
.
warning
(
`当前限制选择 1 个文件,本次选择了
${
files
.
length
}
个文件,共选择了
${
files
.
length
+
fileList
.
length
}
个文件`
);
},
// 上传文件之前的钩子, 参数为上传的文件,若返回 false 或者返回 Promise 且被 reject,则停止上传
beforeUploadFile
(
file
)
{
let
extension
=
file
.
name
.
substring
(
file
.
name
.
lastIndexOf
(
'.'
)
+
1
);
let
size
=
file
.
size
/
1024
/
1024
;
const
isIMG
=
file
.
type
===
'image/jpg'
||
file
.
type
===
'image/jpeg'
||
file
.
type
===
'image/png'
if
(
!
isIMG
)
{
this
.
$message
.
error
(
'上传头像图片只支持jpg、jpeg、png格式!'
)
}
if
(
size
>
10
)
{
this
.
$message
.
warning
(
'图片大小不得超过10M'
);
}
},
// 文件状态改变时的钩子
fileChange
(
file
,
fileList
)
{
this
.
fileList
=
[];
this
.
fileo
.
name
=
file
.
name
;
this
.
fileo
.
url
=
file
.
raw
;
this
.
fileList
.
push
(
this
.
fileo
);
},
},
beforeRemove
(
file
,
fileList
)
{
listRemove
(
e
)
{
return
this
.
$confirm
(
`确定移除
${
file
.
name
}
?`
)
;
this
.
form
.
dealPlan
=
""
;
this
.
fileList
=
[];
this
.
fileList
=
[];
},
},
/** 查询从业人员信息列表 */
/** 查询从业人员信息列表 */
...
@@ -368,7 +346,8 @@ export default {
...
@@ -368,7 +346,8 @@ export default {
updateBy
:
null
,
updateBy
:
null
,
updateTime
:
null
,
updateTime
:
null
,
isDel
:
null
,
isDel
:
null
,
remarks
:
null
remarks
:
null
,
avatarAddress
:
null
};
};
this
.
resetForm
(
"form"
);
this
.
resetForm
(
"form"
);
},
},
...
@@ -423,40 +402,12 @@ export default {
...
@@ -423,40 +402,12 @@ export default {
this
.
getList
();
this
.
getList
();
});
});
}
else
{
}
else
{
// if (this.fileList.length === 0) {
// this.$message.warning('请上传图片');
// } else {
let
file
=
new
FormData
();
file
.
append
(
'file'
,
this
.
fileList
[
0
]);
// axios({
// method: "post",
// url: `${this.url}/transferRelationshipFile`,
// headers: {
// 'Content-type': 'multipart/form-data'
// },
// data: form
// }).then(function (response) {
// loading.close()
// that.$message({
// message: '图片上传完成',
// type: 'success'
// });
// })
//先传图片 返回图片存储地址
addFile
(
file
).
then
(
response
=>
{
//传form表单
//传form表单
addInfo
(
this
.
form
).
then
(
response
=>
{
addInfo
(
this
.
form
).
then
(
response
=>
{
this
.
msgSuccess
(
"新增成功"
);
this
.
msgSuccess
(
"新增成功"
);
this
.
open
=
false
;
this
.
open
=
false
;
this
.
getList
();
this
.
getList
();
});
});
});
// }
}
}
}
}
});
});
...
@@ -491,86 +442,6 @@ export default {
...
@@ -491,86 +442,6 @@ export default {
}).
catch
(()
=>
{});
}).
catch
(()
=>
{});
},
},
/**
* 文件提交方法
*/
uploadFile
()
{
let
that
=
this
;
//是否清空数据
let
accumulate
;
if
(
this
.
fileList
.
length
===
0
)
{
this
.
$message
.
warning
(
'请上传文件'
);
}
else
{
this
.
$confirm
(
'是否清空现有数据?'
,
'提示'
,
{
confirmButtonText
:
'是'
,
cancelButtonText
:
'否'
,
type
:
'warning'
/**
* 这个是清空方法 走这个
*/
}).
then
(()
=>
{
accumulate
=
0
;
this
.
$message
({
type
:
'success'
,
message
:
'已清空'
});
let
form
=
new
FormData
();
form
.
append
(
'file'
,
this
.
fileList
[
0
]);
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'数据正在上传中'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
axios
({
method
:
"post"
,
url
:
`
${
this
.
url
}
/transferRelationshipFile?Accumulate=`
+
accumulate
,
headers
:
{
'Content-type'
:
'multipart/form-data'
},
data
:
form
}).
then
(
function
(
response
)
{
loading
.
close
()
that
.
$message
({
message
:
'数据上传完成'
,
type
:
'success'
});
})
/**
* 这个是取消清空方法 走这个
*/
}).
catch
(()
=>
{
accumulate
=
1
;
this
.
$message
({
type
:
'success'
,
message
:
'取消清空'
,
});
let
form
=
new
FormData
();
form
.
append
(
'file'
,
this
.
fileList
[
0
]);
const
loading
=
this
.
$loading
({
lock
:
true
,
text
:
'数据正在上传中'
,
spinner
:
'el-icon-loading'
,
background
:
'rgba(0, 0, 0, 0.7)'
});
axios
({
method
:
"post"
,
url
:
`
${
this
.
url
}
/transferRelationshipFile?Accumulate=`
+
accumulate
,
headers
:
{
'Content-type'
:
'multipart/form-data'
},
data
:
form
}).
then
(
function
(
response
)
{
loading
.
close
()
that
.
$message
({
message
:
'数据上传完成'
,
type
:
'success'
});
})
});
}
},
}
}
...
...
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