优化、权限变更
This commit is contained in:
parent
fe73605f49
commit
94901a0799
@ -1,16 +1,21 @@
|
||||
package com.zhgd.xmgl.modules.basicdata.api.camera;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.GovernmentConfig;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.VideoConfig;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IVideoConfigService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IGovernmentConfigService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService;
|
||||
import com.zhgd.xmgl.security.SecurityUser;
|
||||
import com.zhgd.xmgl.security.SecurityUtil;
|
||||
import com.zhgd.xmgl.util.ParamEnum;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -32,7 +37,10 @@ public class CameraPreview {
|
||||
// @Value("${artemisConfig.appSecret}")
|
||||
// private String appSecret;
|
||||
@Autowired
|
||||
private IVideoConfigService videoConfigService;
|
||||
private IGovernmentService governmentService;
|
||||
|
||||
@Autowired
|
||||
private IGovernmentConfigService governmentConfigService;
|
||||
|
||||
public JSONObject GetCameraPreviewURL(String requestUrl, String body) {
|
||||
return GetCameraPreviewURL(requestUrl, body, null);
|
||||
@ -48,8 +56,15 @@ public class CameraPreview {
|
||||
/**
|
||||
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
||||
*/
|
||||
List<VideoConfig> list = videoConfigService.list();
|
||||
VideoConfig videoConfig = list.get(0);
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
String governmentSn = governmentService.getGovByUser(user.getAccountType(), user.getSn()).getGovernmentSn();
|
||||
GovernmentConfig config = governmentConfigService.getOne(Wrappers.<GovernmentConfig>lambdaQuery()
|
||||
.eq(GovernmentConfig::getGovernmentSn, governmentSn)
|
||||
.eq(GovernmentConfig::getConfigKey, ParamEnum.GovernmentConfig.VIDEO));
|
||||
if (config == null) {
|
||||
return null;
|
||||
}
|
||||
VideoConfig videoConfig = JSONObject.toJavaObject(JSONObject.parseObject(config.getValue()), VideoConfig.class);
|
||||
ArtemisConfig.host = videoConfig.getIp() + ":" + videoConfig.getPort();
|
||||
ArtemisConfig.appKey = videoConfig.getAppKey();
|
||||
ArtemisConfig.appSecret = videoConfig.getAppSecret();
|
||||
|
||||
@ -189,7 +189,7 @@ public class BaseMenuController {
|
||||
*/
|
||||
@OperLog(operModul = "系统菜单管理", operType = "查询", operDesc = "用户查询自身菜单树形列表")
|
||||
@ApiOperation(value = "用户查询自身菜单树形列表", notes = "用户查询自身菜单树形列表" , httpMethod="POST")
|
||||
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "body", required = true, dataType = "Long")
|
||||
@ApiImplicitParam(name = "moduleId", value = "模块ID", paramType = "bo dy", required = true, dataType = "Long")
|
||||
@PostMapping(value = "/queryBySelf")
|
||||
public Result<List<MenuTreeDto>> queryByModule(@ApiIgnore @RequestBody Map<String,Object> map) {
|
||||
return Result.success(baseMenuService.myTreeMenu(MapUtils.getLong(map,"moduleId")));
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.basicdata.controller.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
@ -139,7 +140,6 @@ public class BaseModuleController {
|
||||
result.success("修改成功!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -214,16 +214,19 @@ public class BaseModuleController {
|
||||
@ApiOperation(value = "当前用户获取相对应的模块信息", notes = "当前用户获取相对应的模块信息" , httpMethod="GET")
|
||||
@GetMapping(value = "/queryBySelf")
|
||||
public Result<Map<String, List<BaseModule>>> queryBySelf() {
|
||||
List<BaseModule> list = baseModuleService.queryBySelf();
|
||||
if (list == null || list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
Map<String, List<BaseModule>> map = new HashMap<>();
|
||||
map.put("important", list.stream().filter(m -> m.getIsImportantModule().equals(1)).collect(Collectors.toList()));
|
||||
List<String> titles = baseModuleService.getTitles();
|
||||
for (String title : titles) {
|
||||
map.put(title, list.stream().filter(m -> m.getLabelName().equals(title)
|
||||
&& m.getIsImportantModule() == 0).collect(Collectors.toList()));
|
||||
List<Long> ids = baseModuleService.queryBySelf(0);
|
||||
if (ids != null && ids.size() > 0) {
|
||||
List<BaseModule> list = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery()
|
||||
.in(BaseModule::getModuleId, ids).orderByDesc(BaseModule::getIsImportantModule).orderByAsc(BaseModule::getLabelSortNum, BaseModule::getPriority));
|
||||
if (list != null || list.size() > 0) {
|
||||
map.put("important", list.stream().filter(m -> m.getIsImportantModule().equals(1)).collect(Collectors.toList()));
|
||||
List<String> titles = baseModuleService.getTitles();
|
||||
for (String title : titles) {
|
||||
map.put(title, list.stream().filter(m -> m.getLabelName().equals(title)
|
||||
&& m.getIsImportantModule() == 0).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(map);
|
||||
}
|
||||
@ -241,7 +244,7 @@ public class BaseModuleController {
|
||||
Result<List<Long>> result = new Result<List<Long>>();
|
||||
QueryWrapper<ModuleTemplate> queryWrapper = QueryGenerator.initQueryWrapper(moduleTemplate);
|
||||
List<Long> moduleIds = moduleTemplateService.list(queryWrapper).stream()
|
||||
.map(m -> m.getModuleId()).collect(Collectors.toList());
|
||||
.map(m -> m.getAuthorityId()).collect(Collectors.toList());
|
||||
result.setSuccess(true);
|
||||
result.setResult(moduleIds);
|
||||
return result;
|
||||
@ -255,18 +258,21 @@ public class BaseModuleController {
|
||||
@ApiOperation(value = "获取所有模块标签", notes = "获取所有模块标签" , httpMethod="GET")
|
||||
@GetMapping(value = "/queryTitle")
|
||||
public Result<List<String>> queryTitle() {
|
||||
List<BaseModule> list = baseModuleService.queryBySelf();
|
||||
if (list == null || list.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
List<String> titles = baseModuleService.getTitles();
|
||||
Iterator<String> iterator = titles.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
long count = list.stream().filter(m -> m.getLabelName().equals(next)
|
||||
&& m.getIsImportantModule() == 0).collect(Collectors.toList()).size();
|
||||
if (count == 0) {
|
||||
iterator.remove();
|
||||
List<Long> ids = baseModuleService.queryBySelf(0);
|
||||
if (ids != null && ids.size() > 0) {
|
||||
List<BaseModule> list = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery()
|
||||
.in(BaseModule::getModuleId, ids).orderByDesc(BaseModule::getIsImportantModule).orderByAsc(BaseModule::getLabelSortNum, BaseModule::getPriority));
|
||||
if (list != null || list.size() > 0) {
|
||||
Iterator<String> iterator = titles.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
long count = list.stream().filter(m -> m.getLabelName().equals(next)
|
||||
&& m.getIsImportantModule() == 0).collect(Collectors.toList()).size();
|
||||
if (count == 0) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Result.success(titles);
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.basicdata.controller.admin;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
@ -14,7 +15,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -22,7 +22,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -87,100 +86,21 @@ public class GovernmentConfigController {
|
||||
@ApiOperation(value = " 添加政务配置信息", notes = "添加政务配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody GovernmentConfig governmentConfig) {
|
||||
governmentConfigService.save(governmentConfig);
|
||||
governmentConfigService.saveOrUpdate(governmentConfig);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param governmentConfig
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "政务配置管理", operType = "修改", operDesc = "编辑政务配置信息")
|
||||
@ApiOperation(value = "编辑政务配置信息", notes = "编辑政务配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<GovernmentConfig> edit(@RequestBody GovernmentConfig governmentConfig) {
|
||||
Result<GovernmentConfig> result = new Result<GovernmentConfig>();
|
||||
GovernmentConfig governmentConfigEntity = governmentConfigService.getById(governmentConfig.getId());
|
||||
if (governmentConfigEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = governmentConfigService.updateById(governmentConfig);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
* 通过key查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "政务配置管理", operType = "删除", operDesc = "删除政务配置信息")
|
||||
@ApiOperation(value = "删除政务配置信息", notes = "删除政务配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "政务配置ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/delete")
|
||||
public Result<GovernmentConfig> delete(@ApiIgnore @RequestBody GovernmentConfig governmentConfig) {
|
||||
Result<GovernmentConfig> result = new Result<GovernmentConfig>();
|
||||
GovernmentConfig governmentConfigEntity = governmentConfigService.getById(governmentConfig.getId());
|
||||
if (governmentConfigEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = governmentConfigService.removeById(governmentConfig.getId());
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "政务配置管理", operType = "批量删除", operDesc = "批量删除政务配置信息")
|
||||
@ApiOperation(value = "批量删除政务配置信息", notes = "批量删除政务配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "ids", value = "政务配置ID字符串", paramType = "body", required = true, dataType = "String")
|
||||
@PostMapping(value = "/deleteBatch")
|
||||
public Result<GovernmentConfig> deleteBatch(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<GovernmentConfig> result = new Result<GovernmentConfig>();
|
||||
String ids = MapUtils.getString(map, "ids");
|
||||
if (ids == null || "".equals(ids.trim())) {
|
||||
result.error500("参数不识别!");
|
||||
} else {
|
||||
this.governmentConfigService.removeByIds(Arrays.asList(ids.split(",")));
|
||||
result.success("删除成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "政务配置管理", operType = "查询", operDesc = "通过id查询政务配置信息")
|
||||
@ApiOperation(value = "通过id查询政务配置信息", notes = "通过id查询政务配置信息", httpMethod = "POST")
|
||||
@ApiImplicitParam(name = "id", value = "政务配置ID", paramType = "body", required = true, dataType = "Integer")
|
||||
@PostMapping(value = "/queryById")
|
||||
public Result<GovernmentConfig> queryById(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
Result<GovernmentConfig> result = new Result<GovernmentConfig>();
|
||||
GovernmentConfig governmentConfig = governmentConfigService.getById(MapUtils.getString(map, "id"));
|
||||
if (governmentConfig == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
result.setResult(governmentConfig);
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return result;
|
||||
@OperLog(operModul = "政务配置管理", operType = "查询", operDesc = "查询政务配置信息")
|
||||
@ApiOperation(value = "查询政务配置信息", notes = "查询政务配置信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/queryByKey")
|
||||
public Result<GovernmentConfig> queryByKey(@RequestBody GovernmentConfig governmentConfig) {
|
||||
return Result.success(governmentConfigService.getOne(Wrappers.<GovernmentConfig>lambdaQuery()
|
||||
.eq(GovernmentConfig::getGovernmentSn, governmentConfig.getGovernmentSn())
|
||||
.eq(GovernmentConfig::getConfigKey, governmentConfig.getConfigKey())));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,11 +3,14 @@ package com.zhgd.xmgl.modules.basicdata.controller.admin;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.system.query.QueryGenerator;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Government;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.ModuleTemplate;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IModuleTemplateService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@ -43,6 +46,9 @@ public class ModuleTemplateController {
|
||||
@Autowired
|
||||
private IModuleTemplateService moduleTemplateService;
|
||||
|
||||
@Autowired
|
||||
private IGovernmentService governmentService;
|
||||
|
||||
/**
|
||||
* 批量添加/修改
|
||||
* @return
|
||||
@ -51,6 +57,9 @@ public class ModuleTemplateController {
|
||||
@ApiOperation(value = " 批量添加/修改所属政务模块模板信息", notes = "批量添加所属政务模块模板信息" , httpMethod="POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "governmentSn", value = "政务SN", paramType = "body", dataType = "String"),
|
||||
@ApiImplicitParam(name = "moduleType", value = "2政务模块; 3企业模块,4项目模块", paramType = "body", dataType = "String"),
|
||||
@ApiImplicitParam(name = "enterpriseType", value = "企业主体类型", paramType = "body", dataType = "String"),
|
||||
@ApiImplicitParam(name = "moduleStyle", value = "系统版本(对应的模块风格1:标准版; 2:星璇版本; 3:衢州版本)", paramType = "body", dataType = "String"),
|
||||
@ApiImplicitParam(name = "moduleTemplates", value = "政务模块模板信息", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
})
|
||||
@PostMapping(value = "/saveOrUpdate")
|
||||
@ -59,14 +68,19 @@ public class ModuleTemplateController {
|
||||
Object templates = MapUtils.getObject(map, "moduleTemplates");
|
||||
List<ModuleTemplate> moduleTemplates = JSONArray.parseArray(JSON.toJSONString(templates), ModuleTemplate.class);
|
||||
String governmentSn = MapUtils.getString(map, "governmentSn");
|
||||
Integer moduleType = MapUtils.getInteger(map, "moduleType");
|
||||
Integer enterpriseType = MapUtils.getInteger(map, "enterpriseType");
|
||||
Integer moduleStyle = MapUtils.getInteger(map, "moduleStyle");
|
||||
if (moduleTemplates == null || moduleTemplates.size() == 0) {
|
||||
moduleTemplateService.remove(Wrappers.<ModuleTemplate>lambdaQuery()
|
||||
.eq(ModuleTemplate::getGovernmentSn, governmentSn));
|
||||
} else {
|
||||
List<Long> newIds = moduleTemplates.stream().map(m -> m.getModuleId()).collect(Collectors.toList());
|
||||
List<Long> newIds = moduleTemplates.stream().map(m -> m.getAuthorityId()).collect(Collectors.toList());
|
||||
List<Long> oldIds = moduleTemplateService.list(Wrappers.<ModuleTemplate>lambdaQuery()
|
||||
.eq(ModuleTemplate::getGovernmentSn, governmentSn))
|
||||
.stream().map(m -> m.getModuleId()).collect(Collectors.toList());
|
||||
.eq(ModuleTemplate::getGovernmentSn, governmentSn)
|
||||
.eq(ModuleTemplate::getModuleType, moduleType)
|
||||
.eq(enterpriseType != null, ModuleTemplate::getEnterpriseType, enterpriseType))
|
||||
.stream().map(m -> m.getAuthorityId()).collect(Collectors.toList());
|
||||
List<Long> addIds = new ArrayList<>();
|
||||
List<Long> delIds = new ArrayList<>();
|
||||
for (Long newId : newIds) {
|
||||
@ -82,12 +96,18 @@ public class ModuleTemplateController {
|
||||
if (delIds.size() > 0) {
|
||||
moduleTemplateService.remove(Wrappers.<ModuleTemplate>lambdaQuery()
|
||||
.eq(ModuleTemplate::getGovernmentSn, governmentSn)
|
||||
.in(ModuleTemplate::getModuleId, delIds));
|
||||
.eq(ModuleTemplate::getModuleType, moduleType)
|
||||
.eq(enterpriseType != null, ModuleTemplate::getEnterpriseType, enterpriseType)
|
||||
.in(ModuleTemplate::getAuthorityId, delIds));
|
||||
}
|
||||
if (addIds.size() > 0) {
|
||||
moduleTemplateService.saveBatch(moduleTemplates.stream().filter(m -> addIds.contains(m.getModuleId())).collect(Collectors.toList()));
|
||||
moduleTemplateService.saveBatch(moduleTemplates.stream().filter(m -> addIds.contains(m.getAuthorityId())).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
LambdaUpdateWrapper<Government> wrapper = Wrappers.<Government>lambdaUpdate();
|
||||
wrapper.set(Government::getModuleStyle, moduleStyle);
|
||||
wrapper.eq(Government::getGovernmentSn, governmentSn);
|
||||
governmentService.update(wrapper);
|
||||
result.success("操作成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -115,6 +115,7 @@ public class GovAcceptInspectRecordController {
|
||||
result.error500("该执法任务已提交审核");
|
||||
} else {
|
||||
acceptInspectRecordVo.setCreateBy(acceptInspectRecordEntity.getCreateBy());
|
||||
acceptInspectRecordVo.setInspectTime(new Date());
|
||||
acceptInspectRecordService.commit(acceptInspectRecordVo);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
if (StringUtils.isNotBlank(acceptInspectRecordEntity.getEngineeringSn())) {
|
||||
@ -151,7 +152,6 @@ public class GovAcceptInspectRecordController {
|
||||
}
|
||||
if (acceptInspectRecordEntity.getState() == 0) {
|
||||
acceptInspectRecord.setState(1);
|
||||
acceptInspectRecord.setInspectTime(new Date());
|
||||
}
|
||||
boolean ok = acceptInspectRecordService.updateById(acceptInspectRecord);
|
||||
if (ok) {
|
||||
|
||||
@ -42,19 +42,25 @@ public class ModuleTemplate implements Serializable {
|
||||
@ApiModelProperty(value = "2政务模块; 3企业模块,4项目模块")
|
||||
private Integer moduleType;
|
||||
/**
|
||||
* 模块id
|
||||
* 权限ID
|
||||
*/
|
||||
@Excel(name = "模块id", width = 15)
|
||||
@ApiModelProperty(value = "模块id")
|
||||
private Long moduleId;
|
||||
@Excel(name = "权限ID", width = 15)
|
||||
@ApiModelProperty(value = "权限ID")
|
||||
private Long authorityId;
|
||||
/**
|
||||
* 菜单类型,0:模块 1:菜单;2:按钮
|
||||
*/
|
||||
@Excel(name = "菜单类型,0:模块 1:菜单;2:按钮", width = 15)
|
||||
@ApiModelProperty(value = "菜单类型,0:模块 1:菜单;2:按钮")
|
||||
private Integer type;
|
||||
private Integer menuType;
|
||||
/**
|
||||
* 企业主体类型(1:建设;2:监理;3:施工;4:勘察;5:设计;)
|
||||
*/
|
||||
@Excel(name = "企业主体类型(1:建设;2:监理;3:施工;4:勘察;5:设计;)", width = 15)
|
||||
@ApiModelProperty(value = "企业主体类型(1:建设;2:监理;3:施工;4:勘察;5:设计;)")
|
||||
private Integer enterpriseType;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "子集数量")
|
||||
private Integer children = 0;
|
||||
private Integer children;
|
||||
}
|
||||
|
||||
@ -18,7 +18,12 @@ public interface IBaseModuleService extends IService<BaseModule> {
|
||||
|
||||
Page<BaseModule> pageList(Page page, Wrapper<BaseModule> wrapper);
|
||||
|
||||
List<BaseModule> queryBySelf();
|
||||
/**
|
||||
*
|
||||
* @param type 菜单类型,0:模块 1:菜单;2:按钮
|
||||
* @return
|
||||
*/
|
||||
List<Long> queryBySelf(Integer type);
|
||||
|
||||
boolean removeInfo(String id);
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ 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.modules.basicdata.service.IBaseModuleService;
|
||||
import com.zhgd.xmgl.security.SecurityUser;
|
||||
import com.zhgd.xmgl.security.SecurityUtil;
|
||||
import com.zhgd.xmgl.util.MessageUtil;
|
||||
@ -20,6 +21,7 @@ import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 系统资源-功能操作
|
||||
@ -35,6 +37,9 @@ public class BaseActionServiceImpl extends ServiceImpl<BaseActionMapper, BaseAct
|
||||
|
||||
@Autowired
|
||||
private SystemUserRoleMapper systemUserRoleMapper;
|
||||
|
||||
@Autowired
|
||||
private IBaseModuleService baseModuleService;
|
||||
// @Autowired
|
||||
// private IBaseAuthorityService baseAuthorityService;
|
||||
|
||||
@ -56,8 +61,12 @@ public class BaseActionServiceImpl extends ServiceImpl<BaseActionMapper, BaseAct
|
||||
public Set<String> queryBySelf() {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
Set<String> actionCodes = new HashSet<>();
|
||||
if (user.isManager()) {
|
||||
actionCodes = baseActionMapper.getActionCodes(user.getAccountType());
|
||||
if (user.isManager() && user.getAccountType() > 1) {
|
||||
List<Long> actionIds = baseModuleService.queryBySelf(2);
|
||||
if (actionIds.size() > 0) {
|
||||
actionCodes = baseActionMapper.selectList(Wrappers.<BaseAction>lambdaQuery().eq(BaseAction::getStatus, 1)
|
||||
.in(BaseAction::getActionId, actionIds)).stream().map(a -> a.getActionCode()).collect(Collectors.toSet());
|
||||
}
|
||||
} else {
|
||||
SystemUserRole systemUserRole = systemUserRoleMapper.selectOne(Wrappers.<SystemUserRole>lambdaQuery().eq(SystemUserRole::getUserId, user.getUserId()));
|
||||
if (systemUserRole != null) {
|
||||
|
||||
@ -82,7 +82,9 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
// 查询当前账号所属政务下的模块
|
||||
List<BaseModule> baseModules = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery()
|
||||
.eq(BaseModule::getModuleType, baseModule.getModuleType())
|
||||
.eq(BaseModule::getStyleType, baseModule.getStyleType()));
|
||||
.eq(BaseModule::getStyleType, baseModule.getStyleType())
|
||||
.orderByDesc(BaseModule::getIsImportantModule)
|
||||
.orderByAsc(BaseModule::getLabelSortNum, BaseModule::getPriority));
|
||||
if (baseModules.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
@ -95,13 +97,15 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
List<BaseAction> baseAction = baseActionMapper.selectList(Wrappers.<BaseAction>lambdaQuery().in(BaseAction::getMenuId,
|
||||
baseMenus.stream().map(m -> m.getMenuId()).collect(Collectors.toList())).eq(BaseAction::getStatus, 1));
|
||||
menuList.addAll(TreeUtil.formatAction(baseAction));
|
||||
return TreeUtil.build(menuList, 1, 0L, 1);
|
||||
return TreeUtil.build(menuList, 0, 0L, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuTreeDto> treeMenu(Integer type) {
|
||||
// 查询当前账号所属政务下的模块
|
||||
List<BaseModule> baseModules = baseModuleService.queryBySelf();
|
||||
List<Long> ids = baseModuleService.queryBySelf(0);
|
||||
List<BaseModule> baseModules = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery()
|
||||
.in(BaseModule::getModuleId, ids).orderByDesc(BaseModule::getIsImportantModule).orderByAsc(BaseModule::getLabelSortNum, BaseModule::getPriority));
|
||||
if (baseModules.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
@ -123,8 +127,9 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
List<BaseMenu> baseMenus = new ArrayList<>();
|
||||
if (user.isManager()) {
|
||||
List<Long> menuIds = baseModuleService.queryBySelf(1);
|
||||
// 查询相对应的菜单
|
||||
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId)
|
||||
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getMenuId, menuIds)
|
||||
.eq(BaseMenu::getStatus, 1).orderByAsc(BaseMenu::getPriority));
|
||||
} else {
|
||||
Long roleId = systemUserRoleService.getOne(Wrappers.<SystemUserRole>lambdaQuery()
|
||||
@ -173,7 +178,9 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
||||
@Override
|
||||
public Set<String> queryRouter() {
|
||||
// 查询当前账号所属政务下的模块
|
||||
List<BaseModule> baseModules = baseModuleService.queryBySelf();
|
||||
List<Long> ids = baseModuleService.queryBySelf(0);
|
||||
List<BaseModule> baseModules = baseModuleService.list(Wrappers.<BaseModule>lambdaQuery()
|
||||
.in(BaseModule::getModuleId, ids).orderByDesc(BaseModule::getIsImportantModule).orderByAsc(BaseModule::getLabelSortNum, BaseModule::getPriority));
|
||||
if (baseModules.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -47,6 +47,9 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
|
||||
@Autowired
|
||||
private ISystemUserRoleService systemUserRoleService;
|
||||
|
||||
@Autowired
|
||||
private IEnterpriseMainService enterpriseMainService;
|
||||
|
||||
@Override
|
||||
public Page<BaseModule> pageList(Page page, Wrapper<BaseModule> wrapper) {
|
||||
Page<BaseModule> pageList = baseMapper.selectPage(page, wrapper);
|
||||
@ -60,15 +63,22 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BaseModule> queryBySelf() {
|
||||
public List<Long> queryBySelf(Integer type) {
|
||||
SecurityUser user = SecurityUtil.getUser();
|
||||
// 查询用户所属政务
|
||||
String governmentSn = governmentService.getGovByUser(user.getAccountType(), user.getSn()).getGovernmentSn();
|
||||
// TODO 一步到位
|
||||
List<Long> ids = new ArrayList<>();
|
||||
List<Integer> mainTypes = new ArrayList<>();
|
||||
if (user.getAccountType() == 3) {
|
||||
mainTypes = enterpriseMainService.list(Wrappers.<EnterpriseMain>lambdaQuery().eq(EnterpriseMain::getEnterpriseSn, user.getSn())).stream().map(e -> e.getMainType()).collect(Collectors.toList());
|
||||
}
|
||||
List<Long> allIds = moduleTemplateService.list(Wrappers.<ModuleTemplate>lambdaQuery()
|
||||
.eq(ModuleTemplate::getModuleType, user.getAccountType())
|
||||
.eq(ModuleTemplate::getGovernmentSn, governmentSn)).stream().map(b -> b.getModuleId()).collect(Collectors.toList());
|
||||
.eq(ModuleTemplate::getGovernmentSn, governmentSn)
|
||||
.eq(ModuleTemplate::getMenuType, type)
|
||||
.in(user.getAccountType() == 3,ModuleTemplate::getEnterpriseType, mainTypes))
|
||||
.stream().distinct().map(b -> b.getAuthorityId()).collect(Collectors.toList());
|
||||
if (user.isManager()) {
|
||||
ids = allIds;
|
||||
} else {
|
||||
@ -78,11 +88,7 @@ public class BaseModuleServiceImpl extends ServiceImpl<BaseModuleMapper, BaseMod
|
||||
ids.removeIf(m -> !allIds.contains(m));
|
||||
}
|
||||
}
|
||||
if (ids.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
return this.list(Wrappers.<BaseModule>lambdaQuery()
|
||||
.in(BaseModule::getModuleId, ids).orderByDesc(BaseModule::getIsImportantModule).orderByAsc(BaseModule::getLabelSortNum, BaseModule::getPriority));
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.MessageRecord;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.MessageRecordMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.IMessageRecordService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -23,9 +24,8 @@ public class MessageRecordServiceImpl extends ServiceImpl<MessageRecordMapper, M
|
||||
List<MessageRecord> add = new ArrayList<>();
|
||||
for (String userId : userIds) {
|
||||
MessageRecord userRecord = new MessageRecord();
|
||||
userRecord.setMessageId(messageRecord.getMessageId());
|
||||
BeanUtils.copyProperties(messageRecord, userRecord);
|
||||
userRecord.setUserId(userId);
|
||||
userRecord.setType(messageRecord.getType());
|
||||
add.add(userRecord);
|
||||
}
|
||||
return this.saveBatch(add);
|
||||
|
||||
@ -34,23 +34,23 @@ public class ModuleTemplateServiceImpl extends ServiceImpl<ModuleTemplateMapper,
|
||||
public List<ModuleTemplate> listByGovernment(QueryWrapper<ModuleTemplate> wrapper) {
|
||||
// 查询角色下的菜单
|
||||
List<ModuleTemplate> moduleTemplateList = this.list(wrapper);
|
||||
List<Long> menuIds = moduleTemplateList.stream().filter(s -> s.getType() == 1).map(s -> s.getModuleId()).collect(Collectors.toList());
|
||||
List<Long> menuIds = moduleTemplateList.stream().filter(s -> s.getMenuType() == 1).map(s -> s.getAuthorityId()).collect(Collectors.toList());
|
||||
if (menuIds.size() == 0) {
|
||||
menuIds.add(0L);
|
||||
}
|
||||
List<BaseMenu> baseMenuList = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getMenuId, menuIds));
|
||||
List<Long> actionIds = moduleTemplateList.stream().filter(s -> s.getType() == 2).map(s -> s.getModuleId()).collect(Collectors.toList());
|
||||
List<Long> actionIds = moduleTemplateList.stream().filter(s -> s.getMenuType() == 2).map(s -> s.getAuthorityId()).collect(Collectors.toList());
|
||||
if (actionIds.size() == 0) {
|
||||
actionIds.add(0L);
|
||||
}
|
||||
List<BaseAction> baseActionList = baseActionMapper.selectList(Wrappers.<BaseAction>lambdaQuery().in(BaseAction::getActionId, actionIds));
|
||||
moduleTemplateList.stream().forEach(s -> {
|
||||
if (s.getType() == 0) {
|
||||
s.setChildren(baseMenuList.stream().filter(b -> b.getModuleId().equals(s.getModuleId())).collect(Collectors.toList()).size());
|
||||
} else if (s.getType() == 1) {
|
||||
int number = baseMenuList.stream().filter(b -> b.getParentId().equals(s.getModuleId())).collect(Collectors.toList()).size();
|
||||
if (s.getMenuType() == 0) {
|
||||
s.setChildren(baseMenuList.stream().filter(b -> b.getModuleId().equals(s.getAuthorityId())).collect(Collectors.toList()).size());
|
||||
} else if (s.getMenuType() == 1) {
|
||||
int number = baseMenuList.stream().filter(b -> b.getParentId().equals(s.getAuthorityId())).collect(Collectors.toList()).size();
|
||||
if (number == 0) {
|
||||
number = baseActionList.stream().filter(a -> a.getMenuId().equals(s.getModuleId())).collect(Collectors.toList()).size();
|
||||
number = baseActionList.stream().filter(a -> a.getMenuId().equals(s.getAuthorityId())).collect(Collectors.toList()).size();
|
||||
}
|
||||
s.setChildren(number);
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -71,6 +72,11 @@ public class JwtTokenProvider {
|
||||
return new UsernamePasswordAuthenticationToken(userDetails, "", userDetails.getAuthorities());
|
||||
}
|
||||
|
||||
public void setAuth(String username) {
|
||||
UserDetails userDetails = myUserDetailsImpl.loadUserByUsername(username);
|
||||
SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken(userDetails, "", userDetails.getAuthorities()));
|
||||
}
|
||||
|
||||
public String getUsername(String token) {
|
||||
return Jwts.parser().setSigningKey(secretKey).parseClaimsJws(token).getBody().getSubject();
|
||||
}
|
||||
|
||||
@ -5,8 +5,11 @@ import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.xmgl.modules.basicdata.api.camera.MonitorApi;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.wisdom.entity.*;
|
||||
import com.zhgd.xmgl.modules.wisdom.service.*;
|
||||
import com.zhgd.xmgl.security.JwtTokenProvider;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -48,27 +51,37 @@ public class DevStateTask {
|
||||
|
||||
@Autowired
|
||||
private MonitorApi monitorApi;
|
||||
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
@Autowired
|
||||
private JwtTokenProvider jwtTokenProvider;
|
||||
/**
|
||||
* ,每一个小时修正监控点的状态
|
||||
*/
|
||||
@Scheduled(cron = "0 30 * * * ?")
|
||||
private void monitorOnline() {
|
||||
List<MonitorDev> list = monitorDevService.list();
|
||||
JSONObject monitorOnline = monitorApi.getMonitorOnline(list.stream().map(p -> p.getCode()).collect(Collectors.toList()));
|
||||
if (monitorOnline == null) {
|
||||
log.info("=========定时修正监控点的状态任务出现异常========");
|
||||
return;
|
||||
}
|
||||
JSONArray resultList = monitorOnline.getJSONObject("data").getJSONArray("list");
|
||||
for (int i = 0; i < resultList.size(); i++) {
|
||||
String online = resultList.getJSONObject(i).getString("online");
|
||||
if (StringUtils.isNotBlank(online) && online.equals("1")) {
|
||||
list.get(i).setState(1);
|
||||
} else {
|
||||
list.get(i).setState(0);
|
||||
List<SystemUser> systemUserList = systemUserService.list(Wrappers.<SystemUser>lambdaQuery().eq(SystemUser::getAccountType, 2).eq(SystemUser::getIsManager, true));
|
||||
for (SystemUser systemUser : systemUserList) {
|
||||
jwtTokenProvider.setAuth(systemUser.getAccount());
|
||||
List<MonitorDev> list = monitorDevService.list();
|
||||
JSONObject monitorOnline = monitorApi.getMonitorOnline(list.stream().map(p -> p.getCode()).collect(Collectors.toList()));
|
||||
if (monitorOnline == null) {
|
||||
log.info("=========定时修正监控点的状态任务出现异常========");
|
||||
return;
|
||||
}
|
||||
JSONArray resultList = monitorOnline.getJSONObject("data").getJSONArray("list");
|
||||
for (int i = 0; i < resultList.size(); i++) {
|
||||
String online = resultList.getJSONObject(i).getString("online");
|
||||
if (StringUtils.isNotBlank(online) && online.equals("1")) {
|
||||
list.get(i).setState(1);
|
||||
} else {
|
||||
list.get(i).setState(0);
|
||||
}
|
||||
}
|
||||
monitorDevService.updateBatchById(list);
|
||||
}
|
||||
monitorDevService.updateBatchById(list);
|
||||
log.info("=========定时修正监控点的状态任务执行成功========");
|
||||
}
|
||||
|
||||
|
||||
@ -144,7 +144,9 @@ public class ParamEnum {
|
||||
* 政务配置键名
|
||||
*/
|
||||
public enum GovernmentConfig {
|
||||
EMAIL("email", "邮件配置");
|
||||
EMAIL("email", "邮件配置"),
|
||||
|
||||
VIDEO("video", "视频配置");
|
||||
|
||||
private String value;
|
||||
private String desc;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user