Commit 725b3169 authored by changhong's avatar changhong

Merge branch 'developer' of http://172.16.10.76/moa/amos-boot-biz into developer

parents 210a7453 308ecb23
...@@ -66,12 +66,22 @@ public class KeySite extends BaseEntity { ...@@ -66,12 +66,22 @@ public class KeySite extends BaseEntity {
*/ */
@TableField("fire_endurance_rate") @TableField("fire_endurance_rate")
private String fireEnduranceRate; private String fireEnduranceRate;
/**
* 耐火等级名称
*/
@TableField("fire_endurance_rate_name")
private String fireEnduranceRateName;
/** /**
* 使用性质 * 使用性质
*/ */
@TableField("use_nature") @TableField("use_nature")
private String useNature; private String useNature;
/**
* 使用性质名称
*/
@TableField("use_nature_name")
private String useNatureName;
/** /**
* 责任人 * 责任人
......
...@@ -19,7 +19,7 @@ public interface IKeySiteService { ...@@ -19,7 +19,7 @@ public interface IKeySiteService {
* @param id * @param id
* @return * @return
*/ */
public boolean deleteById(Long id); public boolean deleteById(List<Long> sequenceNbrList);
/** /**
* 保存 * 保存
* @param model * @param model
...@@ -33,7 +33,7 @@ public KeySiteDto save(KeySiteDto model); ...@@ -33,7 +33,7 @@ public KeySiteDto save(KeySiteDto model);
*/ */
public boolean update(KeySiteDto keySite, AgencyUserModel userInfo) ; public boolean update(KeySiteDto keySite, AgencyUserModel userInfo) ;
/** /**
* 获取机场单位组织结构树,包含单位下部门数量的统计 * 获取机场单位部位树,包含单位下所包含的部位的统计
* @return * @return
*/ */
public List<OrgMenuDto> getOrguserTree(); public List<OrgMenuDto> getOrguserTree();
...@@ -56,5 +56,12 @@ public List<KeySiteExcleDto> exportToExcel(); ...@@ -56,5 +56,12 @@ public List<KeySiteExcleDto> exportToExcel();
* @return * @return
*/ */
public List<Object> getBuildTree() ; public List<Object> getBuildTree() ;
public boolean saveExcel(List<KeySiteExcleDto> excelDtoList); public boolean saveExcel(List<KeySiteExcleDto> excelDtoList);
/**
* 获取所在建筑的建筑部位树
* @param sequenceNbr 所在建筑的id
* @return
*/
public List<OrgMenuDto> getBuildAndKeyTree(Long sequenceNbr);
} }
...@@ -31,45 +31,29 @@ SELECT ...@@ -31,45 +31,29 @@ SELECT
c.rec_user_id AS recUserId, c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName, c.rec_user_name AS recUserName,
c.rec_date AS recDate, c.rec_date AS recDate,
fer.`name` as fireEnduranceRateName, c.fire_endurance_rate_name as fireEnduranceRateName,
un.`name` as useNatureName c.use_nature_name as useNatureName
FROM FROM
cb_key_site c cb_key_site c
LEFT JOIN ( left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
SELECT
c.fire_endurance_rate,
b.`name`
FROM
cb_key_site c
LEFT JOIN cb_data_dictionary b ON c.fire_endurance_rate = b.`code` and b.type ='NHDJ' group by b.`name`
) fer ON c.fire_endurance_rate = fer.fire_endurance_rate
LEFT JOIN (
SELECT
c.use_nature,
b.`name`
FROM
cb_key_site c
LEFT JOIN cb_data_dictionary b ON c.use_nature = b.`code` and b.type ='SYXZ' group by b.`name`
) un ON c.use_nature = un.use_nature
left join cb_org_usr cou on c.building_id =cou.sequence_nbr
where c.is_delete=FALSE where c.is_delete=FALSE
<if test="name != null and name != ''"> <if test="name != null and name != ''">
AND c.`name`=#{name} AND c.`name` like concat(#{name}, '%')
</if> </if>
<if test="buildingId != null and buildingId != -1"> <if test="buildingId != null and buildingId != -1">
AND c.`building_id`=#{buildingId} AND c.`building_id`= #{buildingId}
</if> </if>
<if test="fireEnduranceRate != null and fireEnduranceRate != ''"> <if test="fireEnduranceRate != null and fireEnduranceRate != ''">
AND c.`fire_endurance_rate`=#{fireEnduranceRate} AND c.`fire_endurance_rate`= #{fireEnduranceRate}
</if> </if>
<if test="useNature != null and useNature != ''"> <if test="useNature != null and useNature != ''">
AND c.`use_nature`=#{useNature} AND c.`use_nature`= #{useNature}
</if> </if>
<if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''"> <if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''">
AND c.`fire_facilities_info`=#{fireFacilitiesInfo} AND c.`fire_facilities_info`= #{fireFacilitiesInfo}
</if> </if>
<if test="belongId != null and belongId!='-1' and belongId != -1"> <if test="belongId != null and belongId!='-1' and belongId != -1">
AND c.`belong_id`=#{belongId} AND c.`belong_id`= #{belongId}
</if> </if>
</select> </select>
...@@ -101,27 +85,11 @@ where c.is_delete=FALSE ...@@ -101,27 +85,11 @@ where c.is_delete=FALSE
c.rec_user_id AS recUserId, c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName, c.rec_user_name AS recUserName,
c.rec_date AS recDate, c.rec_date AS recDate,
fer.`name` as fireEnduranceRateName, c.fire_endurance_rate_name as fireEnduranceRateName,
un.`name` as useNatureName c.use_nature_name as useNatureName
FROM FROM
cb_key_site c cb_key_site c
LEFT JOIN ( left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
SELECT
c.fire_endurance_rate,
b.`name`
FROM
cb_key_site c
LEFT JOIN cb_data_dictionary b ON c.fire_endurance_rate = b.`code` group by b.`name`
) fer ON c.fire_endurance_rate = fer.fire_endurance_rate
LEFT JOIN (
SELECT
c.use_nature,
b.`name`
FROM
cb_key_site c
LEFT JOIN cb_data_dictionary b ON c.use_nature = b.`code` group by b.`name`
) un ON c.use_nature = un.use_nature
left join cb_org_usr cou on c.building_id =cou.sequence_nbr
where c.sequence_nbr=#{sequenceNbr} and c.is_delete=FALSE; where c.sequence_nbr=#{sequenceNbr} and c.is_delete=FALSE;
</select> </select>
...@@ -152,30 +120,12 @@ where c.sequence_nbr=#{sequenceNbr} and c.is_delete=FALSE; ...@@ -152,30 +120,12 @@ where c.sequence_nbr=#{sequenceNbr} and c.is_delete=FALSE;
c.rec_user_id AS recUserId, c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName, c.rec_user_name AS recUserName,
c.rec_date AS recDate, c.rec_date AS recDate,
fer.`name` as fireEnduranceRateName, c.fire_endurance_rate_name as fireEnduranceRateName,
un.`name` as useNatureName c.use_nature_name as useNatureName
FROM FROM
cb_key_site c cb_key_site c
LEFT JOIN ( left join cb_org_usr cou on c.belong_id =cou.sequence_nbr
SELECT
c.fire_endurance_rate,
b.`name`
FROM
cb_key_site c
LEFT JOIN cb_data_dictionary b ON c.fire_endurance_rate = b.`code` group by b.`name`
) fer ON c.fire_endurance_rate = fer.fire_endurance_rate
LEFT JOIN (
SELECT
c.use_nature,
b.`name`
FROM
cb_key_site c
LEFT JOIN cb_data_dictionary b ON c.use_nature = b.`code` group by b.`name`
) un ON c.use_nature = un.use_nature
left join cb_org_usr cou on c.building_id =cou.sequence_nbr
where c.is_delete=FALSE; where c.is_delete=FALSE;
</select> </select>
</mapper> </mapper>
...@@ -91,10 +91,10 @@ public class KeySiteController extends BaseController { ...@@ -91,10 +91,10 @@ public class KeySiteController extends BaseController {
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "delete/{sequenceNbr}") @DeleteMapping(value = "delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位") @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,@RequestParam(value = "sequenceNbrList") List<Long> sequenceNbrList){
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbr)); return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList));
} }
/** /**
...@@ -124,14 +124,14 @@ public class KeySiteController extends BaseController { ...@@ -124,14 +124,14 @@ public class KeySiteController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/page") @PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST",value = "重点部位分页查询", notes = "重点部位分页查询") @ApiOperation(httpMethod = "GET",value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size, (value = "size") int size,@RequestParam(required = false) String name,@RequestParam(required = false) Long buildingId,@RequestParam(required = false) String fireEnduranceRate,
@RequestBody KeySite keySite) { @RequestParam(required = false) String useNature,@RequestParam(required = false) String fireFacilitiesInfo,@RequestParam(required = false) Long belongId) {
Page<KeySiteDto> page = new Page<KeySiteDto>(); Page<KeySiteDto> page = new Page<KeySiteDto>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySitePage(page,keySite)); return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId));
} }
/** /**
...@@ -147,7 +147,7 @@ public class KeySiteController extends BaseController { ...@@ -147,7 +147,7 @@ public class KeySiteController extends BaseController {
// } // }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "机场单位组织结构树", notes = "机场单位组织结构树") @ApiOperation(httpMethod = "GET",value = "机场单位部位树", notes = "机场单位部位树")
@GetMapping(value = "/getOrguserTree") @GetMapping(value = "/getOrguserTree")
public ResponseModel<List<OrgMenuDto>> getOrguserTree() throws Exception{ public ResponseModel<List<OrgMenuDto>> getOrguserTree() throws Exception{
List<OrgMenuDto> list = new ArrayList<OrgMenuDto>(); List<OrgMenuDto> list = new ArrayList<OrgMenuDto>();
...@@ -158,5 +158,10 @@ public class KeySiteController extends BaseController { ...@@ -158,5 +158,10 @@ public class KeySiteController extends BaseController {
list.add(orgMenuDto); list.add(orgMenuDto);
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "建筑部位树", notes = "建筑部位树")
@GetMapping(value = "/getBuildTree/{buildingId}")
public ResponseModel<List<OrgMenuDto>> getBuildTree(@PathVariable Long buildingId) throws Exception{
return ResponseHelper.buildResponse(keySiteService.getBuildAndKeyTree(buildingId));
}
} }
...@@ -20,10 +20,12 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -20,10 +20,12 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence; import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto; import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto; import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto; import com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto;
...@@ -63,11 +65,10 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -63,11 +65,10 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
/** /**
* 分页查询 * 分页查询
*/ */
public IPage<KeySiteDto> queryForKeySitePage(Page<KeySiteDto> page, KeySite keySite) { public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate,
return keySiteMapper.getPageList(page, keySite.getName(), keySite.getBuildingId(), String useNature, String fireFacilitiesInfo, Long belongId){
keySite.getFireEnduranceRate(), keySite.getUseNature(), keySite.getFireFacilitiesInfo(),keySite.getBelongId()); return keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId);
} }
@Override @Override
public List<Object> getBuildTree() { public List<Object> getBuildTree() {
ResponseModel<Object> response = equipFeignClient.getBuildingTree(); ResponseModel<Object> response = equipFeignClient.getBuildingTree();
...@@ -106,17 +107,22 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -106,17 +107,22 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
} }
@Override @Override
public boolean deleteById(Long id) { public boolean deleteById(List<Long> sequenceNbrList) {
KeySite keySite = keySiteMapper.selectById(id); if(ObjectUtils.isEmpty(sequenceNbrList)) {
if (keySite == null) {
return false; return false;
} }
keySite.setIsDelete(true); try {
int number = keySiteMapper.updateById(keySite); sequenceNbrList.stream().forEach(i->{
if (number > 0) { KeySite keySite = keySiteMapper.selectById(i);
return true; if (keySite != null) {
keySite.setIsDelete(true);
keySiteMapper.updateById(keySite);
}
});
} catch (Exception e) {
return false;
} }
return false; return true;
} }
@Override @Override
...@@ -181,16 +187,17 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -181,16 +187,17 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
@Override @Override
public List<OrgMenuDto> getOrguserTree() { public List<OrgMenuDto> getOrguserTree() {
return buildTreeParallel(orgUsrMapper.getCompanyAndCountDepartment()); List<OrgUsrTreeDto> list = orgUsrMapper.getCompanyAndCountDepartment();
}
public static List<OrgMenuDto> buildTreeParallel(List<OrgUsrTreeDto> list) {
List<OrgMenuDto> menuList = list.stream().map(o -> { List<OrgMenuDto> menuList = list.stream().map(o -> {
OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName()+" "+o.getNum(), OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName()+" "+o.getNum(),
ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.valueOf(o.getParentId()), o.getBizOrgType(), false, ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.valueOf(o.getParentId()), o.getBizOrgType(), false,
o.getBizOrgCode()); o.getBizOrgCode());
return menu; return menu;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
return buildTreeParallel(menuList);
}
public static List<OrgMenuDto> buildTreeParallel(List<OrgMenuDto> menuList) {
List<OrgMenuDto> result = new ArrayList<>(); List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size()); Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
...@@ -260,4 +267,31 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -260,4 +267,31 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
} }
return this.saveBatch(excelList); return this.saveBatch(excelList);
} }
@Override
public List<OrgMenuDto> getBuildAndKeyTree(Long sequenceNbr) {
LambdaQueryWrapper<KeySite> mapper =new LambdaQueryWrapper<KeySite>();
mapper.eq(KeySite::getBuildingId, sequenceNbr);
mapper.eq(KeySite::getIsDelete, false);
List<KeySite> list=this.baseMapper.selectList(mapper);
if(list==null || list.size()==0) {
return null;
}
String buildNameString=list.get(0).getBuildingName();
List<OrgMenuDto> menuList = list.stream().map(o -> {
OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getName(),
ObjectUtils.isEmpty(o.getBelongId()) ? 0L : Long.valueOf(o.getBelongId()), null, false,
null);
return menu;
}).collect(Collectors.toList());
List<OrgMenuDto> list1 = new ArrayList<OrgMenuDto>();
OrgMenuDto orgMenuDto =new OrgMenuDto();
orgMenuDto.setChildren(buildTreeParallel(menuList));
orgMenuDto.setName(buildNameString);
orgMenuDto.setTitle(buildNameString);
list1.add(orgMenuDto);
return list1;
}
} }
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