9.25百度人脸信息同步修改
parent
621e3e4b59
commit
5071ae5146
|
@ -16,17 +16,17 @@ public class BaiduFaceProperties {
|
|||
/**
|
||||
* 百度人脸识别应用的App ID
|
||||
*/
|
||||
private String appId = "119949649";//"117160042";//
|
||||
private String appId = "117160042";//"119949649";//
|
||||
|
||||
/**
|
||||
* 百度人脸识别应用的API Key
|
||||
*/
|
||||
private String apiKey = "L3PiEzO9dMFJDExMTjOxuTtq";//"rS40xCCuGuVNFRopPI0jlMuj";//
|
||||
private String apiKey = "rS40xCCuGuVNFRopPI0jlMuj";//"L3PiEzO9dMFJDExMTjOxuTtq";//
|
||||
|
||||
/**
|
||||
* 百度人脸识别应用的Secret Key
|
||||
*/
|
||||
private String secretKey ="40LMey6WC1MYIqLU4m5Qe8K4foFUM1bc" ;//"3bY7dADqQq3O4UpXpFA1FJAj6LN57QCS";//
|
||||
private String secretKey ="3bY7dADqQq3O4UpXpFA1FJAj6LN57QCS";//"40LMey6WC1MYIqLU4m5Qe8K4foFUM1bc" ;//
|
||||
|
||||
/**
|
||||
* 相似度阈值,大于此值认为是同一个人
|
||||
|
|
|
@ -17,7 +17,7 @@ public interface IBaiduFaceService {
|
|||
* @param user
|
||||
* @return
|
||||
*/
|
||||
String updateSysUser(SysUser user);
|
||||
String updateSysUser(SysUser user,boolean isRefresh);
|
||||
|
||||
/**
|
||||
* 系统用户百度人脸识别删除
|
||||
|
@ -31,7 +31,7 @@ public interface IBaiduFaceService {
|
|||
* @param proProjectInfoSubdeptsUsers
|
||||
* @return
|
||||
*/
|
||||
String updateProUser(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers);
|
||||
String updateProUser(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers,boolean isRefresh);
|
||||
|
||||
/**
|
||||
* 项目用户百度人脸识别删除
|
||||
|
|
|
@ -50,10 +50,11 @@ public class BaiduFaceService implements IBaiduFaceService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String updateSysUser(SysUser user) {
|
||||
public String updateSysUser(SysUser user,boolean isRefresh) {
|
||||
if(StringUtils.isEmpty(user.getAvatar())){
|
||||
return "失败:无照片";
|
||||
}
|
||||
if(!isRefresh){
|
||||
SysUser oldUser=sysUserMapper.selectUserByUserId(user.getUserId());
|
||||
if(oldUser==null){
|
||||
return "失败:用户不存在";
|
||||
|
@ -61,6 +62,7 @@ public class BaiduFaceService implements IBaiduFaceService {
|
|||
if(StringUtils.equals(oldUser.getAvatar(),user.getAvatar())){
|
||||
return "失败:照片未改变";
|
||||
}
|
||||
}
|
||||
BaiduFaceUserInfo bfUser = new BaiduFaceUserInfo();
|
||||
bfUser.setUserId("S"+user.getUserId());
|
||||
bfUser.setGroupId("G"+user.getDeptId());
|
||||
|
@ -95,10 +97,11 @@ public class BaiduFaceService implements IBaiduFaceService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String updateProUser(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers) {
|
||||
public String updateProUser(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers,boolean isRefresh) {
|
||||
if(StringUtils.isEmpty(proProjectInfoSubdeptsUsers.getUserPicture())){
|
||||
return "失败:无照片";
|
||||
}
|
||||
if(!isRefresh) {
|
||||
ProProjectInfoSubdeptsUsers oldUser = proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersById(proProjectInfoSubdeptsUsers.getId());
|
||||
if (oldUser == null) {
|
||||
return "失败:用户不存在";
|
||||
|
@ -106,6 +109,7 @@ public class BaiduFaceService implements IBaiduFaceService {
|
|||
if (StringUtils.equals(oldUser.getUserPicture(), proProjectInfoSubdeptsUsers.getUserPicture())) {
|
||||
return "失败:照片未改变";
|
||||
}
|
||||
}
|
||||
BaiduFaceUserInfo bfUser = new BaiduFaceUserInfo();
|
||||
bfUser.setUserId("P"+proProjectInfoSubdeptsUsers.getUserId());
|
||||
bfUser.setGroupId("G"+proProjectInfoSubdeptsUsers.getProjectId());
|
||||
|
|
|
@ -63,7 +63,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and ( (c.is_all=1 and c.valid=0 ) or g.group_id= #{groupId})
|
||||
</if>
|
||||
<if test="userId!=null">
|
||||
and ( (c.is_all=1 and c.valid=0 ) or g.group_id in (SELECT sub_dept_group from pro_project_info_subdepts_users where user_id=#{userId}) )
|
||||
and ( (c.is_all=1 and c.valid=0 ) or g.group_id in (SELECT sub_dept_group from pro_project_info_subdepts_users where user_id=#{userId} order by ifnull(update_time,date('2099-12-31')) desc ,create_time desc LIMIT 1) )
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
@ -39,7 +39,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
dic1.dict_label as craft_type_name,dic2.dict_label as craft_post_name,pma.att_device,
|
||||
psu.user_name, psu.user_phone,psu.sub_dept_name,psu.sub_dept_group_name,psu.user_post,psu.user_sex
|
||||
from pro_mobile_attendance_data pma
|
||||
left join pro_project_info_subdepts_users psu on pma.user_id=psu.user_id
|
||||
left join (
|
||||
SELECT t.* FROM pro_project_info_subdepts_users t
|
||||
INNER JOIN (SELECT user_id, MAX(CONCAT(IFNULL(update_time, DATE('2099-12-31')), create_time)) AS max_time_key FROM pro_project_info_subdepts_users GROUP BY user_id) t_max ON t.user_id = t_max.user_id
|
||||
AND CONCAT(IFNULL(t.update_time, DATE('2099-12-31')), t.create_time) = t_max.max_time_key
|
||||
) psu ON pma.user_id = psu.user_id
|
||||
left join sys_dict_data dic1 on psu.`craft_type`=dic1.`dict_value` and dic1.`dict_type`='pro_craft_type'
|
||||
left join sys_dict_data dic2 on psu.`craft_post`=dic2.`dict_value` and dic2.`dict_type`='pro_craft_post'
|
||||
|
||||
|
|
|
@ -825,4 +825,14 @@ public class ProProjectInfoSubdeptsUsersController extends BaseController
|
|||
return userList;
|
||||
}
|
||||
|
||||
@GetMapping("/updateBaiduFaceLibrary/{projectId}")
|
||||
@RequiresPermissions("manage:proProjectInfoSubdeptsUsers:list")
|
||||
public AjaxResult updateBaiduFaceLibrary(@PathVariable("projectId") Long projectId){
|
||||
if(SecurityUtils.isAdmin(SecurityUtils.getUserId())){
|
||||
proProjectInfoSubdeptsUsersService.updateBaiduFaceLibrary(projectId);
|
||||
return AjaxResult.success("更新成功");
|
||||
}else{
|
||||
return AjaxResult.error("非管理员不能操作");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -267,4 +267,11 @@ public interface IProProjectInfoSubdeptsUsersService
|
|||
* 完成三级安全教育人数
|
||||
*/
|
||||
Long getEduCompletedCount(Long prjId);
|
||||
|
||||
/**
|
||||
* 更新项目的百度人脸库
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
Long updateBaiduFaceLibrary(Long projectId);
|
||||
}
|
||||
|
|
|
@ -1003,7 +1003,7 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu
|
|||
}
|
||||
|
||||
public int updateProjectInfoSubdeptsUsers(ProProjectInfoSubdeptsUsers proProjectInfoSubdeptsUsers){
|
||||
baiduFaceService.updateProUser(proProjectInfoSubdeptsUsers);
|
||||
baiduFaceService.updateProUser(proProjectInfoSubdeptsUsers,false);
|
||||
return proProjectInfoSubdeptsUsersMapper.updateProProjectInfoSubdeptsUsers(proProjectInfoSubdeptsUsers);
|
||||
}
|
||||
/**
|
||||
|
@ -1835,4 +1835,33 @@ public class ProProjectInfoSubdeptsUsersServiceImpl implements IProProjectInfoSu
|
|||
return proProjectInfoSubdeptsUsersMapper.getEduCompletedCount(prjId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新项目的百度人脸库
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long updateBaiduFaceLibrary(Long projectId) {
|
||||
ProProjectInfoSubdeptsUsers where=new ProProjectInfoSubdeptsUsers();
|
||||
where.setProjectId(projectId);
|
||||
List<ProProjectInfoSubdeptsUsers> list=proProjectInfoSubdeptsUsersMapper.selectProProjectInfoSubdeptsUsersList(where);
|
||||
int cnt=0;
|
||||
for(ProProjectInfoSubdeptsUsers u:list){
|
||||
String res= baiduFaceService.updateProUser(u,true);
|
||||
if(res!=null && res.contains("成功")){
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
SysUser syWhere=new SysUser();
|
||||
syWhere.setDeptId(projectId);
|
||||
List<SysUser> sysUsers=sysUserMapper.selectUserList(syWhere);
|
||||
for(SysUser sysUser:sysUsers){
|
||||
String res= baiduFaceService.updateSysUser(sysUser,true);
|
||||
if(res!=null && res.contains("成功")){
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
return cnt*1L;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ public class SysUserController extends BaseController {
|
|||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
baiduFaceService.updateSysUser(user);
|
||||
baiduFaceService.updateSysUser(user,false);
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
|
|
|
@ -102,3 +102,11 @@ export function fileAllUsers(proId) {
|
|||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function updateBaiduFaceLibrary(projectId){
|
||||
return request({
|
||||
url: '/manage/proProjectInfoSubdeptsUsers/updateBaiduFaceLibrary/' + projectId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
|
@ -55,6 +55,9 @@
|
|||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Download" @click="handleBatchEnterState(0)" v-hasPermi="['manage:proProjectInfoSubdeptsUsers:export']">批量入场</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" icon="Refresh" @click="handleSyncFace()" v-if="data.isAdmin">同步百度人脸库</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
|
@ -324,6 +327,7 @@ import {
|
|||
updateProProjectInfoSubdeptsUsers,
|
||||
editPhone,
|
||||
fileSign,
|
||||
updateBaiduFaceLibrary
|
||||
} from '@/api/manage/proProjectInfoSubdeptsUsers'
|
||||
import { listProProjectInfoSubdepts } from '@/api/manage/proProjectInfoSubdepts'
|
||||
import { listProProjectInfoSubdeptsGroup } from '@/api/manage/proProjectInfoSubdeptsGroup'
|
||||
|
@ -355,6 +359,7 @@ const total = ref(0)
|
|||
const title = ref('')
|
||||
const dateRange = ref([])
|
||||
|
||||
|
||||
const validatePhone = (rule, value, callback) => {
|
||||
if (!/^1\d{10}$/.test(value)) {
|
||||
callback(new Error('请输入有效手机号码!'))
|
||||
|
@ -423,10 +428,18 @@ const data = reactive({
|
|||
prjWorkTypeObj: {},
|
||||
prjWorkCategories: [], //项目人员岗位大类
|
||||
prjWorkTypes: [], //项目人员岗位类型
|
||||
isAdmin:userStore.isAdmin,
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
//同步百度人脸库
|
||||
function handleSyncFace(){
|
||||
updateBaiduFaceLibrary(queryParams.value.projectId).then(res=>{
|
||||
proxy.$modal.msgSuccess('同步百度人脸库成功!')
|
||||
});
|
||||
}
|
||||
|
||||
//进场,离场
|
||||
function handleEnter(row) {
|
||||
let ids = [row.id]
|
||||
|
|
Loading…
Reference in New Issue