Просмотр исходного кода

Merge branch 'V0.0.2' of http://10.87.10.227:4000/jzyd_yyds/soc into V0.0.2

jiawuxian 2 лет назад
Родитель
Сommit
ff08f7f46f

+ 9 - 7
project_data/sql/0.0.3/soc/soc.sql

@@ -205,7 +205,7 @@ INSERT ignore INTO core_safety_index_calculate_rule_item (id, rule_id, indicator
 -- 新增安保综合评价规则目录、菜单、页面及页面权限
 delete from sys_menu where id in (1714247486990786561,1712277074707779586,1712278645189414914,1714187591810588674,1714187748136493058,1714187851295399937,1714188002965626881,1714188131026116609);
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1712277074707779586, '安全综合管理评价', 0, 13, '/safetyindex', null, null, 1, 0, 'M', '0', '0', '', '1', 'clipboard', null, null, now(), null, now(), '');
-INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1712278645189414914, '评价规则配置', 1712277074707779586, 1, 'evaluationRule', 'evaluationRule/index', null, 1, 1, 'C', '0', '0', null, '1', 'table', null, null, now(), '', null, '');
+INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1712278645189414914, '评价规则配置', 1712277074707779586, 1, 'evaluationRule', 'evaluationRule/index', null, 1, 1, 'C', '0', '0', 'core:safetyIndexRule:list', '1', 'table', null, null, now(), '', null, '');
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1714187591810588674, '综合评价规则新增', 1712278645189414914, 1, '', null, null, 1, 0, 'F', '0', '0', 'core:safetyIndexRule:add', '1', null, null, null, now(), '', null, '');
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1714187748136493058, '综合评价规则编辑', 1712278645189414914, 2, '', null, null, 1, 0, 'F', '0', '0', 'core:safetyIndexRule:edit', '1', null, null, null, now(), '', null, '');
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1714187851295399937, '综合评价规则详情', 1712278645189414914, 3, '', null, null, 1, 0, 'F', '0', '0', 'core:safetyIndexRule:query', '1', null, null, null, now(), '', null, '');
@@ -238,7 +238,7 @@ INSERT ignore INTO core_safe_level (id, level_name, min_value, max_value, risk_l
 
 -- 新增安全等级菜单及页面权限
 delete from sys_menu where id in (1717479664205783042,1717480807703076866,1717480976800636929,1717481080311865346,1717481175799390210,1717481251359776769);
-INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1717479664205783042, '安全等级配置', 1712277074707779586, 1, '/level', 'core/safeLevel/index', null, 1, 0, 'C', '0', '0', '', '1', 'button', null, null, now(), null, now(), null);
+INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1717479664205783042, '安全等级配置', 1712277074707779586, 1, '/level', 'core/safeLevel/index', null, 1, 0, 'C', '0', '0', 'core.safeIndex:safeLevel:list', '1', 'button', null, null, now(), null, now(), null);
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1717480807703076866, '安全等级列表', 1717479664205783042, 1, '', null, null, 1, 0, 'F', '0', '0', 'core.safeIndex:safeLevel:list', '1', null, null, null, now(), null, now(), null);
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1717480976800636929, '安全等级详情', 1717479664205783042, 2, '', null, null, 1, 0, 'F', '0', '0', 'core.safetyIndex:safeLevel:query', '1', null, null, null, now(), null, now(), null);
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1717481080311865346, '安全等级新增', 1717479664205783042, 3, '', null, null, 1, 0, 'F', '0', '0', 'core.safetyIndex:safeLevel:add', '1', null, null, null, now(), null, now(), null);
@@ -254,12 +254,14 @@ insert into sys_role_menu select  id,1717481175799390210 from sys_role where rol
 insert into sys_role_menu select  id,1717481251359776769 from sys_role where role_name like '%省联社安全保卫管理人员%';
 
 -- 新增综合计算得分菜单及菜单权限
-delete from sys_menu where id in (1718909968666697730,1719970958288199682);
-INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1718909968666697730, '计算综合得分', 1712277074707779586, 3, 'scorestatistics', 'scorestatistics/index', null, 1, 1, 'C', '0', '0', '', '1', 'system', null,  null, now(), null, now(), null);
+delete from sys_menu where id in (1718909968666697730,1719970958288199682,1719986164527636481);
+delete from sys_role_menu where menu_id in (1718909968666697730,1719970958288199682,1719986164527636481);
+INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1718909968666697730, '计算综合得分', 1712277074707779586, 3, 'scorestatistics', 'scorestatistics/index', null, 1, 1, 'C', '0', '0', 'core:safeMonthScore:list', '1', 'system', null,  null, now(), null, now(), null);
 INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1719970958288199682, '综合得分重新计算', 1718909968666697730, 1, '', null, null, 1, 0, 'F', '0', '0', 'core:safetyExceptionData:reCalculate', '1', null, null,  null, now(), null, now(), null);
-insert into sys_role_menu select  id,1718909968666697730 from sys_role where role_name like '%省联社安全保卫管理人员%';
-insert into sys_role_menu select  id,1719970958288199682 from sys_role where role_name like '%省联社安全保卫管理人员%';
-
+INSERT INTO sys_menu (id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, platform_type, icon, image_path, create_by, create_time, update_by, update_time, remark) VALUES (1719986164527636481, '综合得分指数分布', 1718909968666697730, 2, '', null, null, 1, 0, 'F', '0', '0', 'core:safeMonthScore:list', '1', null, null,  null, now(), null, now(), null);
+insert into sys_role_menu select  id,1718909968666697730 from sys_role where org_type in (1,2,3);
+insert into sys_role_menu select  id,1719970958288199682 from sys_role where org_type in (1,2,3);
+insert into sys_role_menu select  id,1719986164527636481 from sys_role where org_type in (1,2,3);
 
 
 ALTER TABLE  core_protection MODIFY COLUMN id bigint NOT NULL COMMENT '主键';

+ 4 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/domain/CoreSafetySourceData.java

@@ -41,6 +41,10 @@ public class CoreSafetySourceData extends BaseEntity {
     @ApiModelProperty(value = "机构id")
     private Long orgId;
 
+    @TableField(value = "org_name")
+    @ApiModelProperty(value = "机构id")
+    private String orgName;
+
     @TableField(value = "data_year")
     @ApiModelProperty(value = "数据所在年")
     private Integer dataYear;

+ 3 - 0
soc-common/soc-common-core/src/main/java/com/xunmei/common/core/domain/safetyindex/dto/CoreSafeMonthScorePageDto.java

@@ -6,6 +6,7 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.util.Date;
+import java.util.List;
 
 @Data
 @EqualsAndHashCode(callSuper = true)
@@ -17,6 +18,8 @@ public class CoreSafeMonthScorePageDto extends PageRequest {
 
     private Integer dataMonth;
 
+    private List<Long> orgIdList;
+
     public void setDate(Date date) {
         this.date = date;
         if (null != date){

+ 2 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/controller/CoreSafeMonthScoreController.java

@@ -39,7 +39,7 @@ public class CoreSafeMonthScoreController extends BaseController {
     }
 
     @ApiOperation(value = "查询某机构下级机构指数分布情况")
-    @RequiresPermissions("core:safeMonthScore:query")
+    //@RequiresPermissions("core:safeMonthScore:query")
     @PostMapping(value = "/detail")
     public TableDataInfo<CoreSafeMonthScoreDetailPageVo> getInfo(@RequestBody CoreSafeMonthScoreDetailPageDto request) {
         return coreSafeMonthScoreService.selectDetailPageData(request);
@@ -47,7 +47,7 @@ public class CoreSafeMonthScoreController extends BaseController {
 
 
     @ApiOperation(value = "获取某机构指数分布详情")
-    @RequiresPermissions("core:safeMonthScore:query")
+    //@RequiresPermissions("core:safeMonthScore:query")
     @PostMapping("/find/singleOrg")
     public Object singleOrg(@RequestBody CoreSafeMonthScorePageDto request) {
         return coreSafeMonthScoreService.singleOrg(request);

+ 12 - 4
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafeMonthScoreServiceImpl.java

@@ -1,5 +1,6 @@
 package com.xunmei.core.safetyindex.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -12,6 +13,7 @@ import com.xunmei.common.core.domain.safetyindex.dto.CoreSafeMonthScoreDetailPag
 import com.xunmei.common.core.domain.safetyindex.dto.CoreSafeMonthScorePageDto;
 import com.xunmei.common.core.domain.safetyindex.vo.CoreSafeMonthScoreDetailPageVo;
 import com.xunmei.common.core.domain.safetyindex.vo.CoreSafeMonthScorePageVo;
+import com.xunmei.common.core.enums.OrgTypeEnum;
 import com.xunmei.common.core.util.BeanHelper;
 import com.xunmei.common.core.web.page.TableDataInfo;
 import com.xunmei.core.safetyindex.mapper.CoreSafeLevelMapper;
@@ -40,10 +42,16 @@ public class CoreSafeMonthScoreServiceImpl extends ServiceImpl<CoreSafeMonthScor
     private RemoteOrgService orgService;
     @Autowired
     private CoreSafeLevelMapper safeLevelMapper;
+
     @Override
     public TableDataInfo<CoreSafeMonthScorePageVo> selectPage(CoreSafeMonthScorePageDto req) {
 
-
+        List<SysOrg> sysOrgList = orgService.selectOrgTreeListByCurOrgId(req.getOrgId(), SecurityConstants.INNER);
+        if (ObjectUtil.isEmpty(sysOrgList)) {
+            return TableDataInfo.build();
+        }
+        List<Long> orgIdList = sysOrgList.stream().map(SysOrg::getId).collect(Collectors.toList());
+        req.setOrgIdList(orgIdList);
         //获取数据
         IPage<CoreSafeMonthScorePageVo> page = coreSafeMonthScoreMapper.selectPageData(req.getPageRequest(), req);
         //抓换为TableDataInfo适配前端
@@ -55,8 +63,8 @@ public class CoreSafeMonthScoreServiceImpl extends ServiceImpl<CoreSafeMonthScor
 
     @Override
     public TableDataInfo<CoreSafeMonthScoreDetailPageVo> selectDetailPageData(CoreSafeMonthScoreDetailPageDto request) {
-        Long orgId = request.getOrgId();
-        List<SysOrg> childrenIds = this.orgService.selectSysOrgByParentId(orgId,SecurityConstants.INNER);
+        SysOrg sysOrg = orgService.selectOrgById(request.getOrgId(), SecurityConstants.INNER);
+        List<SysOrg> childrenIds = this.orgService.selectByOrgPathAndOrgType(sysOrg.getPath(), OrgTypeEnum.YINGYE_WANGDIAN.getCode(), SecurityConstants.INNER);
         List<Long> idList = childrenIds.stream().map(SysOrg::getId).collect(Collectors.toList());
         idList.add(request.getOrgId());
         LambdaQueryWrapper<CoreSafeMonthScore> wrapper = Wrappers.lambdaQuery();
@@ -70,7 +78,7 @@ public class CoreSafeMonthScoreServiceImpl extends ServiceImpl<CoreSafeMonthScor
             wrapper.eq(CoreSafeMonthScore::getLevelId, levelId);
         }
         Page<CoreSafeMonthScore> page = baseMapper.selectPage(request.getPageRequest(), wrapper);
-        if (page.getRecords().size()>0){
+        if (page.getRecords().size() > 0) {
             IPage<CoreSafeMonthScoreDetailPageVo> page1 = page.convert(this::getSafeMonthScoreDetailPageVo);
             return TableDataInfo.build(page1);
         }

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/safetyindex/service/impl/CoreSafetyExceptionDataServiceImpl.java

@@ -632,6 +632,7 @@ public class CoreSafetyExceptionDataServiceImpl extends ServiceImpl<CoreSafetyEx
     }
 
     private CoreSafetySourceData doNewSafetySourceData(SafeIndexRuleCountVo indexConfigCountVo, Long orgId, double deductScore, int year, int month, int time) {
+        List<SysOrgVO> orgList = RedisUtils.getCacheList(CacheConstants.ORG_CACHE_LIST_KEY);
         CoreSafetySourceData safeSourceData = new CoreSafetySourceData();
         safeSourceData.setId(IdWorker.getId());
         safeSourceData.setRuleId(indexConfigCountVo.getRuleId());

+ 4 - 1
soc-modules/soc-modules-core/src/main/resources/mapper/safetyindex/CoreSafeMonthScoreMapper.xml

@@ -188,7 +188,10 @@
         max(if(q.level_id=4,q.size,0)) level_lt70
         FROM (select m.org_id, m.org_name, m.level_id, m.data_year, m.data_month, count(1) size
         from (select a.id org_id, a.`name` org_name, t.level_id, t.data_year, t.data_month
-        from (select id, name, path from sys_org where parent_id = #{request.orgId,jdbcType=BIGINT}) a
+        from (select id, name, path from sys_org where id in
+        <foreach collection="request.orgIdList" item="orgId" open="(" separator="," close=")">
+            #{orgId}
+        </foreach>) a
         , (SELECT a.*, b.path from core_safe_month_score a, sys_org b where a.org_id = b.id and b.deleted = 0
         <if test="request.date != null">
             and a.data_year = #{request.dataYear,javaType=int}