优化权限
This commit is contained in:
parent
bd1c89670a
commit
dd2b19626c
@ -85,10 +85,6 @@ public class DataScopeHandler implements DataPermissionHandler {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getEngineeringSn() {
|
|
||||||
return "engineering_sn";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getProjectSn() {
|
protected String getProjectSn() {
|
||||||
return "project_sn";
|
return "project_sn";
|
||||||
}
|
}
|
||||||
@ -134,6 +130,7 @@ public class DataScopeHandler implements DataPermissionHandler {
|
|||||||
private HashMap<String, String> getFieldProjectSnTables() {
|
private HashMap<String, String> getFieldProjectSnTables() {
|
||||||
HashMap<String, String> tables = new HashMap<>(16);
|
HashMap<String, String> tables = new HashMap<>(16);
|
||||||
tables.put("notice_remind_sound", getProjectSn());
|
tables.put("notice_remind_sound", getProjectSn());
|
||||||
|
tables.put("project", getProjectSn());
|
||||||
return tables;
|
return tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,19 +165,16 @@ public class DataScopeHandler implements DataPermissionHandler {
|
|||||||
if (!DataScopeInterceptor.findIgnoreDataScope(parameter, ds)) {
|
if (!DataScopeInterceptor.findIgnoreDataScope(parameter, ds)) {
|
||||||
if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
|
if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
|
||||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get1CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get1CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
||||||
|
filterProjectForCompany(plainSelect, user, ds);
|
||||||
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue())) {
|
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_DISTRICT_ACCOUNT.getValue())) {
|
||||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get2CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get2CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
||||||
|
filterProjectForCompany(plainSelect, user, ds);
|
||||||
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_CITY_ACCOUNT.getValue())) {
|
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_CITY_ACCOUNT.getValue())) {
|
||||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get3CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get3CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
||||||
|
filterProjectForCompany(plainSelect, user, ds);
|
||||||
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_SUB_ACCOUNT.getValue())) {
|
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_SUB_ACCOUNT.getValue())) {
|
||||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get4CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get4CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
||||||
List<String> projectSns = companyService.getProjectSnsBySn(SecurityUtils.getUser().getSn());
|
filterProjectForCompany(plainSelect, user, ds);
|
||||||
// List<String> filterProjectItems = getNeedFilterLeftExpression(plainSelect, getFieldProjectSnTables(), ds);
|
|
||||||
// if (CollUtil.isNotEmpty(filterProjectItems)) {
|
|
||||||
// for (String item : filterProjectItems) {
|
|
||||||
// inExpression(item, , plainSelect);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue())) {
|
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue())) {
|
||||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> {
|
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> {
|
||||||
return StrUtil.format(" \n" +
|
return StrUtil.format(" \n" +
|
||||||
@ -264,6 +258,26 @@ public class DataScopeHandler implements DataPermissionHandler {
|
|||||||
return plainSelect;
|
return plainSelect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业过滤项目sn
|
||||||
|
*
|
||||||
|
* @param plainSelect
|
||||||
|
* @param user
|
||||||
|
* @param ds
|
||||||
|
*/
|
||||||
|
private void filterProjectForCompany(PlainSelect plainSelect, UserInfo user, DataScope ds) {
|
||||||
|
List<String> projectSns = companyService.getProjectSnsBySn(SecurityUtils.getUser().getSn(), user.getAccountType());
|
||||||
|
if (CollUtil.isEmpty(projectSns)) {
|
||||||
|
projectSns.add("0");
|
||||||
|
}
|
||||||
|
List<String> filterProjectItems = getNeedFilterLeftExpression(plainSelect, getFieldProjectSnTables(), ds);
|
||||||
|
if (CollUtil.isNotEmpty(filterProjectItems)) {
|
||||||
|
for (String item : filterProjectItems) {
|
||||||
|
inExpression(item, projectSns, plainSelect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 过滤供应商
|
* 过滤供应商
|
||||||
*
|
*
|
||||||
|
|||||||
@ -191,6 +191,6 @@ public interface CompanyMapper extends BaseMapper<Company> {
|
|||||||
|
|
||||||
boolean hasProjectSnAccessBy4(@Param("userId") Long userId, @Param("sn") String sn);
|
boolean hasProjectSnAccessBy4(@Param("userId") Long userId, @Param("sn") String sn);
|
||||||
|
|
||||||
List<String> getProjectSnsBySn(@Param("sn") String sn);
|
List<String> getProjectSnsBySn(@Param("sn") String sn, @Param("accountType") Integer accountType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -415,8 +415,21 @@
|
|||||||
<select id="getProjectSnsBySn" resultType="java.lang.String">
|
<select id="getProjectSnsBySn" resultType="java.lang.String">
|
||||||
SELECT distinct a.project_sn
|
SELECT distinct a.project_sn
|
||||||
FROM project a
|
FROM project a
|
||||||
INNER JOIN company cp ON a.company_sn = cp.company_sn
|
INNER JOIN company cp ON a.company_sn = cp.company_sn
|
||||||
INNER JOIN company b ON cp.parent_id = b.company_id
|
INNER JOIN company b ON cp.parent_id = b.company_id
|
||||||
LEFT JOIN company f ON b.parent_id = f.company_id
|
LEFT JOIN company f ON b.parent_id = f.company_id
|
||||||
|
where 1=1
|
||||||
|
<if test="accountType != null and accountType != '' and accountType == '7'.toString()">
|
||||||
|
and cp.company_sn = #{sn}
|
||||||
|
</if>
|
||||||
|
<if test="accountType != null and accountType != '' and accountType == '4'.toString()">
|
||||||
|
and b.company_sn = #{sn}
|
||||||
|
</if>
|
||||||
|
<if test="accountType != null and accountType != '' and accountType == '3'.toString()">
|
||||||
|
and f.company_sn = #{sn}
|
||||||
|
</if>
|
||||||
|
<if test="accountType != null and accountType != '' and accountType == '2'.toString()">
|
||||||
|
and f.headquarters_sn = #{sn}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -212,5 +212,5 @@ public interface ICompanyService extends IService<Company> {
|
|||||||
|
|
||||||
boolean hasProjectSnAccessBy4(Long userId, String sn);
|
boolean hasProjectSnAccessBy4(Long userId, String sn);
|
||||||
|
|
||||||
List<String> getProjectSnsBySn(String sn);
|
List<String> getProjectSnsBySn(String sn, Integer accountType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1015,8 +1015,8 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getProjectSnsBySn(String sn) {
|
public List<String> getProjectSnsBySn(String sn, Integer accountType) {
|
||||||
return baseMapper.getProjectSnsBySn(sn);
|
return baseMapper.getProjectSnsBySn(sn, accountType);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void recursionFilterData(Map<String, Object> existSnMap, JSONObject clJo, JSONArray rtJa) {
|
private void recursionFilterData(Map<String, Object> existSnMap, JSONObject clJo, JSONArray rtJa) {
|
||||||
|
|||||||
@ -74,4 +74,6 @@ public class ProjectConfig implements Serializable {
|
|||||||
private java.lang.Integer isMobileAttendance;
|
private java.lang.Integer isMobileAttendance;
|
||||||
@ApiModelProperty(value = "1作业票需要绑定作业执法仪0不需要")
|
@ApiModelProperty(value = "1作业票需要绑定作业执法仪0不需要")
|
||||||
private java.lang.Integer workTicketBindCamera;
|
private java.lang.Integer workTicketBindCamera;
|
||||||
|
@ApiModelProperty(value = "1开启人脸录入时的人脸检测识别功能0不开启")
|
||||||
|
private java.lang.Integer enableWorkerFaceCheck;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,6 +22,7 @@ import java.util.Map;
|
|||||||
* @version: V1.0
|
* @version: V1.0
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
|
@DataScope
|
||||||
public interface ProjectMapper extends BaseMapper<Project> {
|
public interface ProjectMapper extends BaseMapper<Project> {
|
||||||
/**
|
/**
|
||||||
* 项目分页查询
|
* 项目分页查询
|
||||||
|
|||||||
@ -20,7 +20,16 @@ public interface IProjectConfigService extends IService<ProjectConfig> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 外部调用修改项目状态
|
* 外部调用修改项目状态
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
*/
|
*/
|
||||||
void updateProjectAuditStatus(Map<String, Object> map);
|
void updateProjectAuditStatus(Map<String, Object> map);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 不需要检测人脸
|
||||||
|
*
|
||||||
|
* @param projectSn
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean doNotNeedCheck(String projectSn);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.modules.project.service.impl;
|
package com.zhgd.xmgl.modules.project.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.zhgd.xmgl.modules.project.entity.ProjectConfig;
|
import com.zhgd.xmgl.modules.project.entity.ProjectConfig;
|
||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectConfigMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectConfigMapper;
|
||||||
@ -12,6 +13,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 项目配置
|
* @Description: 项目配置
|
||||||
@ -50,14 +52,24 @@ public class ProjectConfigServiceImpl extends ServiceImpl<ProjectConfigMapper, P
|
|||||||
QueryWrapper<ProjectConfig> queryWrapper=new QueryWrapper<>();
|
QueryWrapper<ProjectConfig> queryWrapper=new QueryWrapper<>();
|
||||||
queryWrapper.lambda().eq(ProjectConfig::getProjectSn,MapUtils.getString(map,"projectSn"));
|
queryWrapper.lambda().eq(ProjectConfig::getProjectSn,MapUtils.getString(map,"projectSn"));
|
||||||
ProjectConfig tempProjectConfig=projectConfigMapper.selectOne(queryWrapper);
|
ProjectConfig tempProjectConfig=projectConfigMapper.selectOne(queryWrapper);
|
||||||
if(tempProjectConfig!=null) {
|
if (tempProjectConfig != null) {
|
||||||
map.put("projectAuditStatus", projectAuditStatus);
|
map.put("projectAuditStatus", projectAuditStatus);
|
||||||
projectConfigMapper.updateProjectAuditStatus(map);
|
projectConfigMapper.updateProjectAuditStatus(map);
|
||||||
}else{
|
} else {
|
||||||
ProjectConfig projectConfig=new ProjectConfig();
|
ProjectConfig projectConfig = new ProjectConfig();
|
||||||
projectConfig.setProjectSn(MapUtils.getString(map,"projectSn"));
|
projectConfig.setProjectSn(MapUtils.getString(map, "projectSn"));
|
||||||
projectConfig.setProjectAuditStatus(projectAuditStatus);
|
projectConfig.setProjectAuditStatus(projectAuditStatus);
|
||||||
projectConfigMapper.insert(projectConfig);
|
projectConfigMapper.insert(projectConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean doNotNeedCheck(String projectSn) {
|
||||||
|
ProjectConfig config = this.getOne(new LambdaQueryWrapper<ProjectConfig>()
|
||||||
|
.eq(ProjectConfig::getProjectSn, projectSn));
|
||||||
|
if (config != null && Objects.equals(config.getEnableWorkerFaceCheck(), 0)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,8 +17,10 @@ import com.zhgd.xmgl.call.api.WorkerManufacturer;
|
|||||||
import com.zhgd.xmgl.call.factory.WorkerManufacturerFactory;
|
import com.zhgd.xmgl.call.factory.WorkerManufacturerFactory;
|
||||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||||
|
import com.zhgd.xmgl.modules.project.service.IProjectConfigService;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||||
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
import com.zhgd.xmgl.util.Base64Util;
|
import com.zhgd.xmgl.util.Base64Util;
|
||||||
import com.zhgd.xmgl.util.EnvironmentUtil;
|
import com.zhgd.xmgl.util.EnvironmentUtil;
|
||||||
import com.zhgd.xmgl.util.MessageUtil;
|
import com.zhgd.xmgl.util.MessageUtil;
|
||||||
@ -60,8 +62,6 @@ public class UfaceRecognitionController {
|
|||||||
public static final String LINUX = "linux";
|
public static final String LINUX = "linux";
|
||||||
@Value("${basePath}")
|
@Value("${basePath}")
|
||||||
private String basePath;
|
private String basePath;
|
||||||
@Value("${enableCheckFace}")
|
|
||||||
private String enableCheckFace;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWorkerInfoService workerInfoService;
|
private IWorkerInfoService workerInfoService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -75,6 +75,9 @@ public class UfaceRecognitionController {
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private WorkerManufacturerFactory workerManufacturerFactory;
|
private WorkerManufacturerFactory workerManufacturerFactory;
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private IProjectConfigService projectConfigService;
|
||||||
|
|
||||||
@ApiOperation(value = "检测人脸照片是否有人脸", notes = "列表查询人脸设备信息", httpMethod = "POST")
|
@ApiOperation(value = "检测人脸照片是否有人脸", notes = "列表查询人脸设备信息", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ -91,7 +94,7 @@ public class UfaceRecognitionController {
|
|||||||
String message = "message";
|
String message = "message";
|
||||||
String projectSn = MapUtils.getString(map, "projectSn");
|
String projectSn = MapUtils.getString(map, "projectSn");
|
||||||
String fileUrl = MapUtils.getString(map, "fileUrl");
|
String fileUrl = MapUtils.getString(map, "fileUrl");
|
||||||
if (Objects.equals(enableCheckFace, "0")) {
|
if (projectConfigService.doNotNeedCheck(projectSn)) {
|
||||||
data.put(checkType, sucType);
|
data.put(checkType, sucType);
|
||||||
data.put(message, "成功");
|
data.put(message, "成功");
|
||||||
return Result.success(data);
|
return Result.success(data);
|
||||||
@ -152,10 +155,20 @@ public class UfaceRecognitionController {
|
|||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "fileUrl", value = "照片路径", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "fileUrl", value = "照片路径", paramType = "body", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "type", value = "1url、2base64", paramType = "body", required = false, dataType = "Integer"),
|
@ApiImplicitParam(name = "type", value = "1url、2base64", paramType = "body", required = false, dataType = "Integer"),
|
||||||
|
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = false, dataType = "String"),
|
||||||
})
|
})
|
||||||
@PostMapping(value = "/checkfaceHikvision")
|
@PostMapping(value = "/checkfaceHikvision")
|
||||||
public Result<Map<String, Object>> checkfaceHikvision(@RequestBody Map<String, Object> map) throws Exception {
|
public Result<Map<String, Object>> checkfaceHikvision(@RequestBody Map<String, Object> map) throws Exception {
|
||||||
|
String projectSn = MapUtils.getString(map, "projectSn");
|
||||||
Map<String, Object> data = new HashMap<>(16);
|
Map<String, Object> data = new HashMap<>(16);
|
||||||
|
if (StrUtil.isBlank(projectSn)) {
|
||||||
|
projectSn = SecurityUtils.getUser().getSn();
|
||||||
|
}
|
||||||
|
if (projectConfigService.doNotNeedCheck(projectSn)) {
|
||||||
|
data.put("checkType", "1");
|
||||||
|
data.put("message", "成功");
|
||||||
|
return Result.success(data);
|
||||||
|
}
|
||||||
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getSyncHikvision, 1).last("limit 1"));
|
Project project = projectMapper.selectOne(new LambdaQueryWrapper<Project>().eq(Project::getSyncHikvision, 1).last("limit 1"));
|
||||||
if (project == null) {
|
if (project == null) {
|
||||||
data.put("checkType", "0");
|
data.put("checkType", "0");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user