Commit 6553791e authored by suhuiguang's avatar suhuiguang

1.重点部位权限调整

parent 13fa5dff
......@@ -100,4 +100,10 @@ public class KeySiteDto extends BaseDto implements Serializable{
@ApiModelProperty(value = "数组形式附件")
private List<String> attachmentsList;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
}
......@@ -101,4 +101,12 @@ public class KeySiteExcleDto implements Serializable {
@ExcelProperty(value = "备注", index = 15)
@ApiModelProperty(value = "备注")
private String remark;
@ExcelIgnore
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ExcelIgnore
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
}
......@@ -34,6 +34,12 @@ public class KeySite extends BaseEntity {
@TableField("belong_id")
private Long belongId;
/**
* 所属单位/部门名称
*/
private String belongName;
/**
* 所属建筑id
*/
......@@ -144,4 +150,14 @@ public class KeySite extends BaseEntity {
@TableField("latitude")
private Double latitude;
/**
* 机构/部门名称
*/
private String bizOrgName;
/**
* 机构编码
*/
private String bizOrgCode;
}
......@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import java.util.List;
import java.util.Map;
/**
* 重点部位 Mapper 接口
......@@ -21,13 +22,13 @@ public interface KeySiteMapper extends BaseMapper<KeySite> {
*/
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId,String belongName);
String useNature, String fireFacilitiesInfo, String bizOrgCode);
/**
* 获取所有的重点部位数据
* @return
*/
public List<KeySiteDto> getKeySiteList( String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId);
String useNature, String fireFacilitiesInfo, String bizOrgCode);
/**
* 根据id查找
* @param sequenceNbr
......
package com.yeejoin.amos.boot.module.common.api.service;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDateDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto;
......@@ -37,14 +38,15 @@ public boolean update(KeySiteDto keySite, AgencyUserModel userInfo) ;
/**
* 获取机场单位部位树,包含单位下所包含的部位的统计
* @return
* @param reginParams
*/
public List<OrgMenuDto> getOrguserTree();
public List<OrgMenuDto> getOrgUserTree(ReginParams reginParams);
/**
*
* @return
*/
public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId) ;
String useNature, String fireFacilitiesInfo, String bizOrgCode) ;
/**根据id查找
*
* @param sequenceNbr
......@@ -53,7 +55,7 @@ public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, Strin
public KeySiteDto getSequenceNbr(Long sequenceNbr);
public List<KeySiteExcleDto> exportToExcel(String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId);
String useNature, String fireFacilitiesInfo, String bizOrgCode);
/**获取所在建筑的树结构信息
*
......
......@@ -7,7 +7,7 @@
SELECT
c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
......@@ -33,7 +33,6 @@
c.use_nature_name as useNatureName
FROM
cb_key_site c
left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
where c.is_delete=FALSE
<if test="name != null and name != ''">
AND c.`name` like concat('%',#{name}, '%')
......@@ -50,11 +49,8 @@
<if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''">
AND c.`fire_facilities_info`= #{fireFacilitiesInfo}
</if>
<if test="belongId != null and belongId!='-1' and belongId != -1">
AND c.`belong_id`= #{belongId}
</if>
<if test="belongName != null and belongName !=''">
AND c.`belong_name` like concat('%',#{belongName},'%')
<if test="bizOrgCode != null and bizOrgCode !=''">
AND c.`biz_org_code` like concat(#{bizOrgCode},'%')
</if>
order by c.rec_date desc
</select>
......@@ -95,7 +91,7 @@
<select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name,
c.belong_id as belongId,
cou.biz_org_name as belongName,
c.biz_org_name as belongName,
c.building_id as buildingId,
c.building_name as buildingName,
c.address_desc as addressDesc,
......@@ -120,7 +116,6 @@
c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName
FROM cb_key_site c
left join cb_org_usr cou on c.belong_id = cou.sequence_nbr
where c.is_delete = FALSE
<if test="name != null and name != ''">
AND c.`name` like concat('%',#{name}, '%')
......@@ -137,8 +132,8 @@
<if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''">
AND c.`fire_facilities_info`= #{fireFacilitiesInfo}
</if>
<if test="belongId != null and belongId!='-1' and belongId != -1">
AND c.`belong_id`= #{belongId}
<if test="bizOrgCode != null and bizOrgCode!=''">
AND c.`biz_org_code` like concat(#{bizOrgCode}, '%')
</if>
</select>
......
......@@ -7,18 +7,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -26,12 +31,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -53,16 +54,23 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
OrgUsrMapper orgUsrMapper;
@Autowired
IOrgUsrService iOrgUsrService;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
private Sequence sequence;
@Value("${auth-key-key-site:key_site_info}")
private String authKey;
/**
* 分页查询
*/
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId, String belongName){
return keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId,belongName);
String useNature, String fireFacilitiesInfo, String bizOrgCode){
return keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,bizOrgCode);
}
@Override
......@@ -79,16 +87,16 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
*/
@Override
public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId) {
return keySiteMapper.getKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId);
String useNature, String fireFacilitiesInfo, String bizOrgCode) {
return keySiteMapper.getKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,bizOrgCode);
}
@Override
public List<KeySiteExcleDto> exportToExcel(String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId) {
List<KeySiteDto> list = this.queryForKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId);
String useNature, String fireFacilitiesInfo, String bizOrgCode) {
List<KeySiteDto> list = this.queryForKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,bizOrgCode);
List<KeySiteExcleDto> excleList = new ArrayList<>();
list.stream().forEach(i -> {
list.forEach(i -> {
KeySiteExcleDto keySiteExcleDto = new KeySiteExcleDto();
Bean.copyExistPropertis(i, keySiteExcleDto);
if (i.getFirePreventionFlag()) {
......@@ -184,10 +192,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
}
@Override
public List<OrgMenuDto> getOrguserTree() {
List<OrgUsrTreeDto> list = orgUsrMapper.getCompanyAndCountDepartment();
List<OrgMenuDto> menuList = list.stream().map(o -> {
OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName()+" ("+o.getNum() + ")",
public List<OrgMenuDto> getOrgUserTree(ReginParams reginParams) {
List<OrgUsr> comDeptList = iOrgUsrService.getListByBizOrgTypeCode(OrgPersonEnum.公司.getKey() +"," + OrgPersonEnum.部门.getKey(),reginParams.getPersonIdentity().getBizOrgCode());
List<KeySite> keySiteList = this.list(new LambdaQueryWrapper<KeySite>().eq(BaseEntity::getIsDelete,false));
comDeptList = comDeptList.stream().map(c-> c.setTotal(keySiteList.stream().filter(k->k.getBizOrgCode().contains(c.getBizOrgCode())).count())).collect(Collectors.toList());
List<OrgMenuDto> menuList = comDeptList.stream().map(o -> {
OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName()+" ("+o.getTotal() + ")",
ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.valueOf(o.getParentId()), o.getBizOrgType(), false,
o.getBizOrgCode());
return menu;
......@@ -228,6 +238,8 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
@Override
public boolean saveExcel(List<KeySiteExcleDto> excelDtoList) {
List<KeySite> excelList = new ArrayList<KeySite>();
List<OrgUsr> comDeptList = orgUsrMapper.companyTreeByUserAndType(null);
Map<Long,OrgUsr> comDeptMap = comDeptList.stream().collect(Collectors.toMap(BaseEntity::getSequenceNbr, Function.identity()));
for (KeySiteExcleDto keySiteExcleDto : excelDtoList) {
KeySite keySiteDto = new KeySite();
Bean.copyExistPropertis(keySiteExcleDto, keySiteDto);
......@@ -235,6 +247,8 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
if (StringUtils.isNotBlank(keySiteExcleDto.getBelongName())
&& keySiteExcleDto.getBelongName().contains("@")) {
keySiteDto.setBelongId(Long.parseLong(keySiteExcleDto.getBelongName().split("@")[1]));
keySiteDto.setBizOrgCode(comDeptMap.getOrDefault(keySiteDto.getBelongId(),new OrgUsr()).getBizOrgCode());
keySiteDto.setBizOrgName(comDeptMap.getOrDefault(keySiteDto.getBelongId(),new OrgUsr()).getBizOrgName());
}
if (StringUtils.isNotBlank(keySiteExcleDto.getBuildingName())
&& keySiteExcleDto.getBuildingName().contains("@")) {
......
......@@ -304,7 +304,7 @@ public class ExcelServiceImpl {
par.containsKey("fireEnduranceRate")?par.get("fireEnduranceRate").toString():null,
par.containsKey("useNature")?par.get("useNature").toString():null,
par.containsKey("fireFacilitiesInfo")?par.get("fireFacilitiesInfo").toString():null,
par.containsKey("belongId")?Long.valueOf(par.get("belongId").toString()):null);
par.containsKey("bizOrgCode")? par.get("bizOrgCode").toString():null);
}else{
keySiteDtoList = keySiteService.exportToExcel(null,null,null,null,null,null);
}
......
......@@ -2606,25 +2606,47 @@
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-07-3">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_firefighters" columnName="biz_org_name"/>
</not>
</preConditions>
<comment>cb_firefighters add column biz_org_name '所属单位名称'</comment>
<sql>
alter table `cb_firefighters` add column `biz_org_name` varchar(100) DEFAULT NULL COMMENT '所属单位名称';
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-07-4">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_firefighters" columnName="biz_org_name"/>
<columnExists tableName="cb_firefighters" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>cb_firefighters add column biz_org_name '所属单位名称'</comment>
<comment>cb_firefighters add column biz_org_code '所属单位code'</comment>
<sql>
alter table `cb_firefighters` add column `biz_org_name` varchar(100) DEFAULT NULL COMMENT '所属单位名称';
alter table `cb_firefighters` add column `biz_org_code` varchar(100) DEFAULT NULL COMMENT '所属单位code';
</sql>
</changeSet>
<changeSet author="litengwei" id="2021-11-07-4">
<changeSet author="suhuiguang" id="1641688114483-01">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_firefighters" columnName="biz_org_code"/>
<columnExists tableName="cb_key_site" columnName="biz_org_name"/>
</not>
</preConditions>
<comment>cb_firefighters add column biz_org_code '所属单位code'</comment>
<comment>cb_key_site add column biz_org_name '所属单位名称'</comment>
<sql>
alter table `cb_firefighters` add column `biz_org_code` varchar(100) DEFAULT NULL COMMENT '所属单位code';
alter table `cb_key_site` add column `biz_org_name` varchar(100) DEFAULT NULL COMMENT '所属单位名称';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1641688114483-02">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_key_site" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>cb_key_site add column biz_org_code '所属单位code'</comment>
<sql>
alter table `cb_key_site` add column `biz_org_code` varchar(100) DEFAULT NULL COMMENT '所属单位code';
</sql>
</changeSet>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment