优化权限
This commit is contained in:
parent
bd1c89670a
commit
dd2b19626c
@ -85,10 +85,6 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getEngineeringSn() {
|
||||
return "engineering_sn";
|
||||
}
|
||||
|
||||
protected String getProjectSn() {
|
||||
return "project_sn";
|
||||
}
|
||||
@ -134,6 +130,7 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
private HashMap<String, String> getFieldProjectSnTables() {
|
||||
HashMap<String, String> tables = new HashMap<>(16);
|
||||
tables.put("notice_remind_sound", getProjectSn());
|
||||
tables.put("project", getProjectSn());
|
||||
return tables;
|
||||
}
|
||||
|
||||
@ -168,19 +165,16 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
if (!DataScopeInterceptor.findIgnoreDataScope(parameter, ds)) {
|
||||
if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.ENTERPRISE_ADMINISTRATOR_ACCOUNT.getValue())) {
|
||||
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())) {
|
||||
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())) {
|
||||
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())) {
|
||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> get4CompanySql(SecurityUtils.getUser().getUserId(), userFilterItem));
|
||||
List<String> projectSns = companyService.getProjectSnsBySn(SecurityUtils.getUser().getSn());
|
||||
// List<String> filterProjectItems = getNeedFilterLeftExpression(plainSelect, getFieldProjectSnTables(), ds);
|
||||
// if (CollUtil.isNotEmpty(filterProjectItems)) {
|
||||
// for (String item : filterProjectItems) {
|
||||
// inExpression(item, , plainSelect);
|
||||
// }
|
||||
// }
|
||||
filterProjectForCompany(plainSelect, user, ds);
|
||||
} else if (Objects.equals(user.getAccountType(), SystemUserAccountTypeEnum.PROJECT_ACCOUNT.getValue())) {
|
||||
filterForCompanyOrProject(plainSelect, ds, expressions, SecurityUtils.getUser().getUserId(), (userFilterItem) -> {
|
||||
return StrUtil.format(" \n" +
|
||||
@ -264,6 +258,26 @@ public class DataScopeHandler implements DataPermissionHandler {
|
||||
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);
|
||||
|
||||
List<String> getProjectSnsBySn(@Param("sn") String sn);
|
||||
List<String> getProjectSnsBySn(@Param("sn") String sn, @Param("accountType") Integer accountType);
|
||||
|
||||
}
|
||||
|
||||
@ -418,5 +418,18 @@
|
||||
INNER JOIN company cp ON a.company_sn = cp.company_sn
|
||||
INNER JOIN company b ON cp.parent_id = b.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>
|
||||
</mapper>
|
||||
|
||||
@ -212,5 +212,5 @@ public interface ICompanyService extends IService<Company> {
|
||||
|
||||
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
|
||||
public List<String> getProjectSnsBySn(String sn) {
|
||||
return baseMapper.getProjectSnsBySn(sn);
|
||||
public List<String> getProjectSnsBySn(String sn, Integer accountType) {
|
||||
return baseMapper.getProjectSnsBySn(sn, accountType);
|
||||
}
|
||||
|
||||
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;
|
||||
@ApiModelProperty(value = "1作业票需要绑定作业执法仪0不需要")
|
||||
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
|
||||
*/
|
||||
@Mapper
|
||||
@DataScope
|
||||
public interface ProjectMapper extends BaseMapper<Project> {
|
||||
/**
|
||||
* 项目分页查询
|
||||
|
||||
@ -20,7 +20,16 @@ public interface IProjectConfigService extends IService<ProjectConfig> {
|
||||
|
||||
/**
|
||||
* 外部调用修改项目状态
|
||||
*
|
||||
* @param 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;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectConfig;
|
||||
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 java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 项目配置
|
||||
@ -60,4 +62,14 @@ public class ProjectConfigServiceImpl extends ServiceImpl<ProjectConfigMapper, P
|
||||
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.modules.project.entity.Project;
|
||||
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.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.Base64Util;
|
||||
import com.zhgd.xmgl.util.EnvironmentUtil;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
@ -60,8 +62,6 @@ public class UfaceRecognitionController {
|
||||
public static final String LINUX = "linux";
|
||||
@Value("${basePath}")
|
||||
private String basePath;
|
||||
@Value("${enableCheckFace}")
|
||||
private String enableCheckFace;
|
||||
@Autowired
|
||||
private IWorkerInfoService workerInfoService;
|
||||
@Autowired
|
||||
@ -75,6 +75,9 @@ public class UfaceRecognitionController {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private WorkerManufacturerFactory workerManufacturerFactory;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private IProjectConfigService projectConfigService;
|
||||
|
||||
@ApiOperation(value = "检测人脸照片是否有人脸", notes = "列表查询人脸设备信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ -91,7 +94,7 @@ public class UfaceRecognitionController {
|
||||
String message = "message";
|
||||
String projectSn = MapUtils.getString(map, "projectSn");
|
||||
String fileUrl = MapUtils.getString(map, "fileUrl");
|
||||
if (Objects.equals(enableCheckFace, "0")) {
|
||||
if (projectConfigService.doNotNeedCheck(projectSn)) {
|
||||
data.put(checkType, sucType);
|
||||
data.put(message, "成功");
|
||||
return Result.success(data);
|
||||
@ -152,10 +155,20 @@ public class UfaceRecognitionController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "fileUrl", value = "照片路径", paramType = "body", required = true, dataType = "String"),
|
||||
@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")
|
||||
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);
|
||||
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"));
|
||||
if (project == null) {
|
||||
data.put("checkType", "0");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user