按钮权限修改
This commit is contained in:
parent
d306cb2163
commit
8a924f53b1
@ -86,6 +86,17 @@ public class DataScopeInterceptor extends JsqlParserSupport implements InnerInte
|
||||
FromItem fromItem = plainSelect.getFromItem();
|
||||
if (fromItem instanceof Table) {
|
||||
this.dataScopeHandler.getSqlSegment(plainSelect, obj);
|
||||
} else {
|
||||
processFromItem(fromItem, obj);
|
||||
}
|
||||
}
|
||||
|
||||
protected void processFromItem(FromItem fromItem, Object obj) {
|
||||
if (fromItem instanceof SubSelect) {
|
||||
SubSelect subSelect = (SubSelect) fromItem;
|
||||
if (subSelect.getSelectBody() != null) {
|
||||
processSelectBody(subSelect.getSelectBody(), obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,10 +15,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
@ -53,14 +50,23 @@ public class BaseActionController {
|
||||
|
||||
@OperLog(operModul = "功能按钮管理", operType = "查询", operDesc = "查询菜单下的按钮权限CODE")
|
||||
@ApiOperation(value = "查询菜单下的按钮权限CODE", notes = "查询菜单下的按钮权限CODE", httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "menuId", value = "menuId", paramType = "form"),
|
||||
})
|
||||
@ApiImplicitParam(name = "menuId", value = "menuId", paramType = "body")
|
||||
@PostMapping("/codeList")
|
||||
public Result<Set<String>> getMenuCode(@ApiIgnore @RequestBody Map<String,Object> map) {
|
||||
return Result.success(baseActionService.getMenuCode(MapUtils.getString(map,"menuId")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户查询自身菜单按钮权限列表
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "功能按钮管理", operType = "查询", operDesc = "用户查询自身菜单按钮权限列表")
|
||||
@ApiOperation(value = "用户查询自身菜单按钮权限列表", notes = "用户查询自身菜单按钮权限列表" , httpMethod="GET")
|
||||
@GetMapping(value = "/queryBySelf")
|
||||
public Result<Set<String>> queryBySelf() {
|
||||
return Result.success(baseActionService.queryBySelf());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param baseAction
|
||||
|
||||
@ -40,15 +40,13 @@
|
||||
</select>
|
||||
|
||||
<select id="getActionCodes" resultType="java.lang.String">
|
||||
SELECT action_code FROM base_action WHERE EXISTS(
|
||||
SELECT * FROM base_menu WHERE EXISTS(
|
||||
SELECT action_code FROM base_action WHERE status = 1 AND menu_id IN (
|
||||
SELECT menu_id FROM base_menu WHERE module_id IN (
|
||||
SELECT module_id FROM base_module WHERE module_type = #{accountType}))
|
||||
</select>
|
||||
|
||||
<select id="getActionCodeByRole" resultType="java.lang.String">
|
||||
SELECT * FROM base_action WHERE EXISTS(
|
||||
SELECT * FROM base_menu WHERE EXISTS(
|
||||
SELECT menu_id FROM system_role_menu WHERE role_id = #{roleId}))
|
||||
SELECT action_code FROM base_action WHERE status = 1 AND action_id IN (SELECT authority_id FROM system_role_menu WHERE role_id = #{roleId} AND type = 2 )
|
||||
</select>
|
||||
|
||||
<select id="getMenuCode" resultType="java.lang.String">
|
||||
|
||||
@ -24,6 +24,8 @@ public interface IBaseActionService extends IService<BaseAction> {
|
||||
|
||||
Set<String> getMenuCode(String menuId);
|
||||
|
||||
Set<String> queryBySelf();
|
||||
|
||||
void addBaseAction(BaseAction baseAction);
|
||||
|
||||
void editBaseAction(BaseAction baseAction);
|
||||
|
||||
@ -1,17 +1,23 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.jeecg.common.execption.OpenAlertException;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.BaseAction;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUserRole;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.BaseActionMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserRoleMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IBaseActionService;
|
||||
import com.zhgd.xmgl.security.SecurityUser;
|
||||
import com.zhgd.xmgl.security.SecurityUtil;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@ -26,6 +32,9 @@ import java.util.Set;
|
||||
public class BaseActionServiceImpl extends ServiceImpl<BaseActionMapper, BaseAction> implements IBaseActionService {
|
||||
@Autowired
|
||||
private BaseActionMapper baseActionMapper;
|
||||
|
||||
@Autowired
|
||||
private SystemUserRoleMapper systemUserRoleMapper;
|
||||
// @Autowired
|
||||
// private IBaseAuthorityService baseAuthorityService;
|
||||
|
||||
@ -43,6 +52,22 @@ public class BaseActionServiceImpl extends ServiceImpl<BaseActionMapper, BaseAct
|
||||
return baseActionMapper.getMenuCode(menuId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> queryBySelf() {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
Set<String> actionCodes = new HashSet<>();
|
||||
if (user.isManager()) {
|
||||
actionCodes = baseActionMapper.getActionCodes(user.getAccountType());
|
||||
} else {
|
||||
SystemUserRole systemUserRole = systemUserRoleMapper.selectOne(Wrappers.<SystemUserRole>lambdaQuery().eq(SystemUserRole::getUserId, user.getUserId()));
|
||||
if (systemUserRole != null) {
|
||||
Long roleId = systemUserRole.getRoleId();
|
||||
actionCodes = baseActionMapper.getActionCodeByRole(roleId);
|
||||
}
|
||||
}
|
||||
return actionCodes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBaseAction(BaseAction aciton) {
|
||||
if (aciton.getPriority() == null) {
|
||||
|
||||
@ -99,7 +99,7 @@ public class ProjectNodePlan implements Serializable {
|
||||
*/
|
||||
@Excel(name = "节点责任人编号", width = 15)
|
||||
@ApiModelProperty(value = "节点责任人编号")
|
||||
private String chargerNumber;
|
||||
private String chargerPhone;
|
||||
/**
|
||||
* 节点责任人
|
||||
*/
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.zhgd.xmgl.modules.safety.mapper.InspectRecordMapper">
|
||||
|
||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.safety.dto.InspectRecordDto">
|
||||
SELECT i.*, GROUP_CONCAT(u.real_name) inspectUserName, p.project_name, e.engineering_name,
|
||||
SELECT * FROM (SELECT i.*, GROUP_CONCAT(u.real_name) inspectUserName, p.project_name, IFNULL( e.engineering_name, p.project_name) engineering_name,
|
||||
(SELECT MAX(CASE WHEN m.type = 1 THEN s.enterprise_name ELSE '' END) FROM engineering_main m
|
||||
LEFT JOIN enterprise s ON m.enterprise_sn = s.enterprise_sn WHERE m.engineering_sn = e.engineering_sn) buildEnt,
|
||||
(SELECT MAX(CASE WHEN m.type = 2 THEN s.enterprise_name ELSE '' END) FROM engineering_main m
|
||||
@ -22,8 +22,8 @@
|
||||
FROM inspect_record i
|
||||
LEFT JOIN project p ON i.project_sn = p.project_sn
|
||||
LEFT JOIN engineering e ON i.engineering_sn = e.engineering_sn
|
||||
LEFT JOIN system_user u ON FIND_IN_SET(u.user_id, i.inspect_user)
|
||||
${ew.customSqlSegment} GROUP BY i.id ORDER BY i.create_time DESC
|
||||
LEFT JOIN system_user u ON FIND_IN_SET(u.user_id, i.inspect_user) GROUP BY i.id ORDER BY i.create_time DESC) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="getDetail" resultType="com.zhgd.xmgl.modules.safety.dto.InspectRecordDto">
|
||||
|
||||
@ -40,23 +40,7 @@ public class InspectQuestionExamineServiceImpl extends ServiceImpl<InspectQuesti
|
||||
wrapperQuestion.eq(InspectQuestion::getId, inspectQuestionExamine.getInspectQuestionId());
|
||||
inspectQuestionService.update(wrapperQuestion);
|
||||
// 查询是否全部整改完成
|
||||
InspectQuestion inspectQuestion = inspectQuestionService.getById(inspectQuestionExamine.getInspectQuestionId());
|
||||
List<InspectQuestion> inspectQuestions = inspectQuestionService.list(Wrappers.<InspectQuestion>lambdaQuery().eq(InspectQuestion::getRecordId, inspectQuestion.getRecordId()));
|
||||
Integer state = 3;
|
||||
if (inspectQuestions.stream().filter(i -> i.getState() == 3).collect(Collectors.toList()).size() == inspectQuestions.size()) {
|
||||
state = 4;
|
||||
} else if (inspectQuestions.stream().filter(i -> i.getState() < 3).collect(Collectors.toList()).size() == 0) {
|
||||
state = 5;
|
||||
}
|
||||
if (state != 3) {
|
||||
LambdaUpdateWrapper<InspectRecord> recordWrapper = Wrappers.<InspectRecord>lambdaUpdate();
|
||||
recordWrapper.set(InspectRecord::getState, state);
|
||||
if (state == 4) {
|
||||
recordWrapper.set(InspectRecord::getSolveTime, new Date());
|
||||
}
|
||||
recordWrapper.eq(InspectRecord::getId, inspectQuestion.getRecordId());
|
||||
inspectRecordService.update(recordWrapper);
|
||||
}
|
||||
updateState(inspectQuestionExamine);
|
||||
return this.updateById(inspectQuestionExamine);
|
||||
}
|
||||
|
||||
@ -66,6 +50,29 @@ public class InspectQuestionExamineServiceImpl extends ServiceImpl<InspectQuesti
|
||||
wrapperQuestion.set(InspectQuestion::getState, 2);
|
||||
wrapperQuestion.eq(InspectQuestion::getId, inspectQuestionExamine.getInspectQuestionId());
|
||||
inspectQuestionService.update(wrapperQuestion);
|
||||
updateState(inspectQuestionExamine);
|
||||
return this.save(inspectQuestionExamine);
|
||||
}
|
||||
|
||||
private void updateState(InspectQuestionExamine inspectQuestionExamine) {
|
||||
InspectQuestion inspectQuestion = inspectQuestionService.getById(inspectQuestionExamine.getInspectQuestionId());
|
||||
List<InspectQuestion> inspectQuestions = inspectQuestionService.list(Wrappers.<InspectQuestion>lambdaQuery().eq(InspectQuestion::getRecordId, inspectQuestion.getRecordId()));
|
||||
Integer state = 2;
|
||||
if (inspectQuestions.stream().filter(i -> i.getState() == 3).collect(Collectors.toList()).size() == inspectQuestions.size()) {
|
||||
state = 4;
|
||||
} else if (inspectQuestions.stream().filter(i -> i.getState() < 3).collect(Collectors.toList()).size() == 0) {
|
||||
state = 5;
|
||||
} else if (inspectQuestions.stream().filter(i -> i.getState() < 2).collect(Collectors.toList()).size() == 0) {
|
||||
state = 3;
|
||||
}
|
||||
if (state != 2) {
|
||||
LambdaUpdateWrapper<InspectRecord> recordWrapper = Wrappers.<InspectRecord>lambdaUpdate();
|
||||
recordWrapper.set(InspectRecord::getState, state);
|
||||
if (state == 4) {
|
||||
recordWrapper.set(InspectRecord::getSolveTime, new Date());
|
||||
}
|
||||
recordWrapper.eq(InspectRecord::getId, inspectQuestion.getRecordId());
|
||||
inspectRecordService.update(recordWrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,25 +75,25 @@ public class InspectRecordServiceImpl extends ServiceImpl<InspectRecordMapper, I
|
||||
String engineeringName = MapUtils.getString(map, "engineeringName");
|
||||
QueryWrapper<InspectRecord> wrapper = Wrappers.<InspectRecord>query();
|
||||
if (StringUtils.isNotBlank(engineeringSn)) {
|
||||
wrapper.eq("i.engineering_sn", engineeringSn);
|
||||
wrapper.eq("a.engineering_sn", engineeringSn);
|
||||
}
|
||||
if (StringUtils.isNotBlank(engineeringName)) {
|
||||
wrapper.like("e.engineering_name", engineeringName);
|
||||
wrapper.like("a.engineering_name", engineeringName);
|
||||
}
|
||||
if (StringUtils.isNotBlank(projectSn)) {
|
||||
wrapper.eq("i.project_sn", projectSn).eq("i.engineering_sn", "");
|
||||
wrapper.eq("a.project_sn", projectSn).eq("a.engineering_sn", "");
|
||||
}
|
||||
if (null != type) {
|
||||
wrapper.eq("i.type", type);
|
||||
wrapper.eq("a.type", type);
|
||||
}
|
||||
if (null != state) {
|
||||
wrapper.eq("i.state", state);
|
||||
wrapper.eq("a.state", state);
|
||||
}
|
||||
if (null != joinFlag && joinFlag) {
|
||||
wrapper.ne("i.create_by", userId).apply("FIND_IN_SET({0}, i.inspect_user)", userId);
|
||||
wrapper.ne("a.create_by", userId).apply("FIND_IN_SET({0}, a.inspect_user)", userId);
|
||||
}
|
||||
if (SecurityUtil.getUser().getAccountType() > 2) {
|
||||
wrapper.gt("i.state", 1);
|
||||
wrapper.gt("a.state", 1);
|
||||
}
|
||||
Page<InspectRecordDto> inspectRecordDtoPage = baseMapper.pageList(page, wrapper);
|
||||
inspectRecordDtoPage.getRecords().forEach(i -> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user