Commit 6553791e authored by suhuiguang's avatar suhuiguang

1.重点部位权限调整

parent 13fa5dff
...@@ -100,4 +100,10 @@ public class KeySiteDto extends BaseDto implements Serializable{ ...@@ -100,4 +100,10 @@ public class KeySiteDto extends BaseDto implements Serializable{
@ApiModelProperty(value = "数组形式附件") @ApiModelProperty(value = "数组形式附件")
private List<String> attachmentsList; private List<String> attachmentsList;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
} }
...@@ -101,4 +101,12 @@ public class KeySiteExcleDto implements Serializable { ...@@ -101,4 +101,12 @@ public class KeySiteExcleDto implements Serializable {
@ExcelProperty(value = "备注", index = 15) @ExcelProperty(value = "备注", index = 15)
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remark; private String remark;
@ExcelIgnore
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ExcelIgnore
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
} }
...@@ -34,6 +34,12 @@ public class KeySite extends BaseEntity { ...@@ -34,6 +34,12 @@ public class KeySite extends BaseEntity {
@TableField("belong_id") @TableField("belong_id")
private Long belongId; private Long belongId;
/**
* 所属单位/部门名称
*/
private String belongName;
/** /**
* 所属建筑id * 所属建筑id
*/ */
...@@ -144,4 +150,14 @@ public class KeySite extends BaseEntity { ...@@ -144,4 +150,14 @@ public class KeySite extends BaseEntity {
@TableField("latitude") @TableField("latitude")
private Double latitude; private Double latitude;
/**
* 机构/部门名称
*/
private String bizOrgName;
/**
* 机构编码
*/
private String bizOrgCode;
} }
...@@ -8,6 +8,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto; ...@@ -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 com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 重点部位 Mapper 接口 * 重点部位 Mapper 接口
...@@ -21,13 +22,13 @@ public interface KeySiteMapper extends BaseMapper<KeySite> { ...@@ -21,13 +22,13 @@ public interface KeySiteMapper extends BaseMapper<KeySite> {
*/ */
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate, 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 * @return
*/ */
public List<KeySiteDto> getKeySiteList( String name, Long buildingId, String fireEnduranceRate, public List<KeySiteDto> getKeySiteList( String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId); String useNature, String fireFacilitiesInfo, String bizOrgCode);
/** /**
* 根据id查找 * 根据id查找
* @param sequenceNbr * @param sequenceNbr
......
package com.yeejoin.amos.boot.module.common.api.service; 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.KeySiteDateDto;
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;
...@@ -37,14 +38,15 @@ public boolean update(KeySiteDto keySite, AgencyUserModel userInfo) ; ...@@ -37,14 +38,15 @@ public boolean update(KeySiteDto keySite, AgencyUserModel userInfo) ;
/** /**
* 获取机场单位部位树,包含单位下所包含的部位的统计 * 获取机场单位部位树,包含单位下所包含的部位的统计
* @return * @return
* @param reginParams
*/ */
public List<OrgMenuDto> getOrguserTree(); public List<OrgMenuDto> getOrgUserTree(ReginParams reginParams);
/** /**
* *
* @return * @return
*/ */
public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, String fireEnduranceRate, public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId) ; String useNature, String fireFacilitiesInfo, String bizOrgCode) ;
/**根据id查找 /**根据id查找
* *
* @param sequenceNbr * @param sequenceNbr
...@@ -53,7 +55,7 @@ public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, Strin ...@@ -53,7 +55,7 @@ public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, Strin
public KeySiteDto getSequenceNbr(Long sequenceNbr); public KeySiteDto getSequenceNbr(Long sequenceNbr);
public List<KeySiteExcleDto> exportToExcel(String name, Long buildingId, String fireEnduranceRate, 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 @@ ...@@ -7,7 +7,7 @@
SELECT SELECT
c.`name` as name, c.`name` as name,
c.belong_id as belongId, c.belong_id as belongId,
cou.biz_org_name as belongName, c.biz_org_name as belongName,
c.building_id as buildingId, c.building_id as buildingId,
c.building_name as buildingName, c.building_name as buildingName,
c.address_desc as addressDesc, c.address_desc as addressDesc,
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
c.use_nature_name as useNatureName c.use_nature_name as useNatureName
FROM FROM
cb_key_site c cb_key_site c
left join cb_org_usr cou on c.belong_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` like concat('%',#{name}, '%') AND c.`name` like concat('%',#{name}, '%')
...@@ -50,11 +49,8 @@ ...@@ -50,11 +49,8 @@
<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="bizOrgCode != null and bizOrgCode !=''">
AND c.`belong_id`= #{belongId} AND c.`biz_org_code` like concat(#{bizOrgCode},'%')
</if>
<if test="belongName != null and belongName !=''">
AND c.`belong_name` like concat('%',#{belongName},'%')
</if> </if>
order by c.rec_date desc order by c.rec_date desc
</select> </select>
...@@ -95,7 +91,7 @@ ...@@ -95,7 +91,7 @@
<select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto"> <select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT c.`name` as name, SELECT c.`name` as name,
c.belong_id as belongId, c.belong_id as belongId,
cou.biz_org_name as belongName, c.biz_org_name as belongName,
c.building_id as buildingId, c.building_id as buildingId,
c.building_name as buildingName, c.building_name as buildingName,
c.address_desc as addressDesc, c.address_desc as addressDesc,
...@@ -120,7 +116,6 @@ ...@@ -120,7 +116,6 @@
c.fire_endurance_rate_name as fireEnduranceRateName, c.fire_endurance_rate_name as fireEnduranceRateName,
c.use_nature_name as useNatureName c.use_nature_name as useNatureName
FROM cb_key_site c FROM cb_key_site c
left join cb_org_usr cou on c.belong_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` like concat('%',#{name}, '%') AND c.`name` like concat('%',#{name}, '%')
...@@ -137,8 +132,8 @@ ...@@ -137,8 +132,8 @@
<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="bizOrgCode != null and bizOrgCode!=''">
AND c.`belong_id`= #{belongId} AND c.`biz_org_code` like concat(#{bizOrgCode}, '%')
</if> </if>
</select> </select>
......
...@@ -4,12 +4,16 @@ import com.alibaba.fastjson.JSONArray; ...@@ -4,12 +4,16 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.interceptors.PermissionInterceptorContext;
import com.yeejoin.amos.boot.module.common.api.core.framework.PersonIdentify;
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.KeySiteDateDto; 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.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto; import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite; import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
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.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService; import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService; import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
...@@ -19,15 +23,8 @@ import io.swagger.annotations.Api; ...@@ -19,15 +23,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -49,189 +46,195 @@ import java.util.Map; ...@@ -49,189 +46,195 @@ import java.util.Map;
@RequestMapping(value = "/common/key-site") @RequestMapping(value = "/common/key-site")
public class KeySiteController extends BaseController { public class KeySiteController extends BaseController {
@Autowired @Autowired
KeySiteServiceImpl keySiteServiceImpl; KeySiteServiceImpl keySiteServiceImpl;
@Autowired @Autowired
IKeySiteService keySiteService; IKeySiteService keySiteService;
@Autowired @Autowired
IOrgUsrService iOrgUsrService; IOrgUsrService iOrgUsrService;
@Autowired @Autowired
SourceFileServiceImpl sourceFileService; SourceFileServiceImpl sourceFileService;
@Autowired @Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
/** @Value("${auth-key-key-site:key_site_info}")
* 新增重点部位 private String authKey;
*
* @return /**
*/ * 新增重点部位
@TycloudOperation(ApiLevel = UserType.AGENCY) *
@PostMapping(value = "/save") * @return
@ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位") */
public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) { @TycloudOperation(ApiLevel = UserType.AGENCY)
JSONObject json = getBulid(model.getBuildingId()); @PostMapping(value = "/save")
if (json != null && StringUtils.isNotBlank(json.getString("latitude")) && StringUtils.isNotBlank(json.getString("longitude"))) { @ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位")
model.setLatitude(Double.parseDouble(json.getString("latitude"))); public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) {
model.setLongitude(Double.parseDouble(json.getString("longitude"))); JSONObject json = getBulid(model.getBuildingId());
} if (json != null && StringUtils.isNotBlank(json.getString("latitude")) && StringUtils.isNotBlank(json.getString("longitude"))) {
model.setIsDelete(false); model.setLatitude(Double.parseDouble(json.getString("latitude")));
KeySiteDto entity = keySiteService.save(model); model.setLongitude(Double.parseDouble(json.getString("longitude")));
return ResponseHelper.buildResponse(entity); }
} model.setIsDelete(false);
KeySiteDto entity = keySiteService.save(model);
public JSONObject getBulid(Long id) { return ResponseHelper.buildResponse(entity);
ResponseModel<Object> equipObj = equipFeignClient.getOne(id); }
JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
if (!equipjSONObject.containsKey("parentId")) { public JSONObject getBulid(Long id) {
return null; ResponseModel<Object> equipObj = equipFeignClient.getOne(id);
} JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
if (!"0".equals(equipjSONObject.getString("parentId"))) { if (!equipjSONObject.containsKey("parentId")) {
String parentId = equipjSONObject.getString("parentId"); return null;
if (StringUtils.isNotBlank(parentId)) { }
return getBulid(Long.parseLong(parentId)); if (!"0".equals(equipjSONObject.getString("parentId"))) {
} String parentId = equipjSONObject.getString("parentId");
} if (StringUtils.isNotBlank(parentId)) {
return equipjSONObject; return getBulid(Long.parseLong(parentId));
} }
}
/** return equipjSONObject;
* 根据sequenceNbr更新 }
*
* @param sequenceNbr 主键 /**
* @return * 根据sequenceNbr更新
*/ *
@TycloudOperation(ApiLevel = UserType.AGENCY) * @param sequenceNbr 主键
@PutMapping(value = "update/{sequenceNbr}") * @return
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位") */
public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model) { @TycloudOperation(ApiLevel = UserType.AGENCY)
JSONObject json = getBulid(model.getBuildingId()); @PutMapping(value = "update/{sequenceNbr}")
if (json != null) { @ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位")
model.setLatitude(Double.parseDouble(json.getString("latitude"))); public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model) {
model.setLongitude(Double.parseDouble(json.getString("longitude"))); JSONObject json = getBulid(model.getBuildingId());
} if (json != null) {
return ResponseHelper.buildResponse(keySiteService.update(model, getUserInfo())); model.setLatitude(Double.parseDouble(json.getString("latitude")));
} model.setLongitude(Double.parseDouble(json.getString("longitude")));
}
/** return ResponseHelper.buildResponse(keySiteService.update(model, getUserInfo()));
* 根据sequenceNbr删除 }
*
* @param sequenceNbr 主键 /**
* @return * 根据sequenceNbr删除
*/ *
@TycloudOperation(ApiLevel = UserType.AGENCY) * @param sequenceNbr 主键
@DeleteMapping(value = "delete") * @return
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位") */
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestParam(value = "ids") String ids) { @DeleteMapping(value = "delete")
List<Long> sequenceNbrList = new ArrayList<>(); @ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
/* BUG 2670 litw start */ public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
String[] idsArr = ids.split(","); @RequestParam(value = "ids") String ids) {
for (String str : idsArr) { List<Long> sequenceNbrList = new ArrayList<>();
sequenceNbrList.add(Long.valueOf(str)); /* BUG 2670 litw start */
} String[] idsArr = ids.split(",");
/* BUG 2670 end */ for (String str : idsArr) {
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList)); sequenceNbrList.add(Long.valueOf(str));
} }
/* BUG 2670 end */
/** return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList));
* 根据sequenceNbr查询 }
*
* @param sequenceNbr 主键 /**
* @return * 根据sequenceNbr查询
*/ *
@TycloudOperation(ApiLevel = UserType.AGENCY) * @param sequenceNbr 主键
@GetMapping(value = "find/{sequenceNbr}") * @return
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个重点部位", notes = "根据sequenceNbr查询单个重点部位") */
public ResponseModel<KeySiteDto> selectOne(@PathVariable Long sequenceNbr) { @TycloudOperation(ApiLevel = UserType.AGENCY)
List<String> list = new ArrayList<String>(); @GetMapping(value = "find/{sequenceNbr}")
Map<String, List<AttachmentDto>> files = sourceFileService.getAttachments(sequenceNbr); @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个重点部位", notes = "根据sequenceNbr查询单个重点部位")
KeySiteDto dto = keySiteService.getSequenceNbr(sequenceNbr); public ResponseModel<KeySiteDto> selectOne(@PathVariable Long sequenceNbr) {
if (files != null && dto != null) { List<String> list = new ArrayList<String>();
dto.setAttachments(files); Map<String, List<AttachmentDto>> files = sourceFileService.getAttachments(sequenceNbr);
JSONArray array = JSONArray.parseArray(JSONArray.toJSONString(files.get("keySitePhoto"))); KeySiteDto dto = keySiteService.getSequenceNbr(sequenceNbr);
if (array != null && array.size() > 0) { if (files != null && dto != null) {
for (Object i : array) { dto.setAttachments(files);
JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(i)); JSONArray array = JSONArray.parseArray(JSONArray.toJSONString(files.get("keySitePhoto")));
list.add(object.getString("url")); if (array != null && array.size() > 0) {
} for (Object i : array) {
} JSONObject object = JSONObject.parseObject(JSONObject.toJSONString(i));
} list.add(object.getString("url"));
dto.setAttachmentsList(list); }
return ResponseHelper.buildResponse(dto); }
} }
dto.setAttachmentsList(list);
/** return ResponseHelper.buildResponse(dto);
* 列表分页查询 }
*
* @param current 当前页 /**
* @param current 每页大小 * 列表分页查询
* @return *
*/ * @param current 当前页
@TycloudOperation(ApiLevel = UserType.AGENCY) * @param current 每页大小
@GetMapping(value = "/page") * @return
@ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询") */
public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current, @TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestParam(value = "size") int size, @RequestParam(required = false) String name, @GetMapping(value = "/page")
@RequestParam(required = false) Long buildingId, @RequestParam(required = false) String fireEnduranceRate, @ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
@RequestParam(required = false) String useNature, @RequestParam(required = false) String fireFacilitiesInfo, public ResponseModel<IPage<KeySiteDto>> queryForPage(
@RequestParam(required = false) Long belongId, @RequestParam(required = false) String belongName) { @RequestParam(value = "current") int current,
Page<KeySiteDto> page = new Page<KeySiteDto>(); @RequestParam(value = "size") int size,
page.setCurrent(current); @RequestParam(required = false) String name,
page.setSize(size); @RequestParam(required = false) Long buildingId,
return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate, @RequestParam(required = false) String fireEnduranceRate,
useNature, fireFacilitiesInfo, belongId,belongName)); @RequestParam(required = false) String useNature,
} @RequestParam(required = false) String fireFacilitiesInfo,
@RequestParam String bizOrgCode) {
/** Page<KeySiteDto> page = new Page<KeySiteDto>();
* 列表全部数据查询 page.setCurrent(current);
* page.setSize(size);
* @return return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate,
*/ useNature, fireFacilitiesInfo, bizOrgCode));
// @TycloudOperation(ApiLevel = UserType.AGENCY) }
// @ApiOperation(httpMethod = "GET",value = "重点部位列表全部数据查询", notes = "重点部位列表全部数据查询")
// @GetMapping(value = "/list") @PersonIdentify
// public ResponseModel<List<KeySite>> selectForList() { @TycloudOperation(ApiLevel = UserType.AGENCY)
// return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySiteList()); @ApiOperation(httpMethod = "GET", value = "机场单位部门部位统计树", notes = "机场单位部门部位统计树")
// } @GetMapping(value = "/getOrguserTree")
public ResponseModel<List<OrgMenuDto>> getOrgUserTree() {
@TycloudOperation(ApiLevel = UserType.AGENCY) // 获取登陆人角色
@ApiOperation(httpMethod = "GET", value = "机场单位部位树", notes = "机场单位部位树") ReginParams reginParams = getSelectedOrgInfo();
@GetMapping(value = "/getOrguserTree") // 权限赋值
public ResponseModel<List<OrgMenuDto>> getOrguserTree() { PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> list = new ArrayList<OrgMenuDto>(); List<OrgMenuDto> list = keySiteService.getOrgUserTree(reginParams);
OrgMenuDto orgMenuDto = new OrgMenuDto(); return ResponseHelper.buildResponse(list);
orgMenuDto.setChildren(keySiteService.getOrguserTree()); }
orgMenuDto.setName("单位管理");
orgMenuDto.setKey(-1L); @TycloudOperation(ApiLevel = UserType.AGENCY)
orgMenuDto.setTitle("单位管理"); @ApiOperation(httpMethod = "GET", value = "建筑部位树", notes = "建筑部位树")
list.add(orgMenuDto); @GetMapping(value = "/getBuildTree/{buildingId}")
return ResponseHelper.buildResponse(list); public ResponseModel<List<OrgMenuDto>> getBuildTree(@PathVariable Long buildingId) {
} return ResponseHelper.buildResponse(keySiteService.getBuildAndKeyTree(buildingId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "建筑部位树", notes = "建筑部位树")
@GetMapping(value = "/getBuildTree/{buildingId}") @TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel<List<OrgMenuDto>> getBuildTree(@PathVariable Long buildingId) { @ApiOperation(httpMethod = "GET", value = "部位", notes = "部位")
return ResponseHelper.buildResponse(keySiteService.getBuildAndKeyTree(buildingId)); @GetMapping(value = "/getKeySiteDate")
} public ResponseModel<List<KeySiteDateDto>> getKeySiteDate(@RequestParam(required = false) Long id) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDate(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "部位", notes = "部位") @ApiOperation(httpMethod = "GET", value = "通过名称模糊查询重点部位的信息", notes = "通过名称模糊查询重点部位的信息")
@GetMapping(value = "/getKeySiteDate") @GetMapping(value = "/getKeySiteDateByNameLike")
public ResponseModel<List<KeySiteDateDto>> getKeySiteDate(@RequestParam(required = false) Long id) { public ResponseModel<List<KeySite>> getKeySiteDateByNameLike(@RequestParam(required = false) Long companyId) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDate(id)); return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike(companyId));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @PersonIdentify
@ApiOperation(httpMethod = "GET",value = "通过名称模糊查询重点部位的信息", notes = "通过名称模糊查询重点部位的信息") @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getKeySiteDateByNameLike") @RequestMapping(value = "/companyTreeByUserAndType", method = RequestMethod.GET)
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike(@RequestParam(required = false) Long companyId) { @ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司树", notes = "根据登录人及类型获取公司树")
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike(companyId)); public ResponseModel<List<OrgMenuDto>> companyTreeByUserAndType() {
} // 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
// 权限赋值
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserAndType(reginParams, OrgPersonEnum.公司.getKey());
return ResponseHelper.buildResponse(menus);
}
} }
...@@ -7,18 +7,23 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -7,18 +7,23 @@ 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.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; 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.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite; 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.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.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper; 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.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService; 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 com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
...@@ -26,12 +31,8 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -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.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.function.Function;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -53,16 +54,23 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -53,16 +54,23 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
OrgUsrMapper orgUsrMapper; OrgUsrMapper orgUsrMapper;
@Autowired @Autowired
IOrgUsrService iOrgUsrService;
@Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
@Autowired @Autowired
private Sequence sequence; 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, 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 keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId,belongName); return keySiteMapper.getPageList(page,name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,bizOrgCode);
} }
@Override @Override
...@@ -79,16 +87,16 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -79,16 +87,16 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
*/ */
@Override @Override
public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, String fireEnduranceRate, public List<KeySiteDto> queryForKeySiteList( String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId) { String useNature, String fireFacilitiesInfo, String bizOrgCode) {
return keySiteMapper.getKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId); return keySiteMapper.getKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,bizOrgCode);
} }
@Override @Override
public List<KeySiteExcleDto> exportToExcel(String name, Long buildingId, String fireEnduranceRate, public List<KeySiteExcleDto> exportToExcel(String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo, Long belongId) { String useNature, String fireFacilitiesInfo, String bizOrgCode) {
List<KeySiteDto> list = this.queryForKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,belongId); List<KeySiteDto> list = this.queryForKeySiteList(name,buildingId,fireEnduranceRate,useNature,fireFacilitiesInfo,bizOrgCode);
List<KeySiteExcleDto> excleList = new ArrayList<>(); List<KeySiteExcleDto> excleList = new ArrayList<>();
list.stream().forEach(i -> { list.forEach(i -> {
KeySiteExcleDto keySiteExcleDto = new KeySiteExcleDto(); KeySiteExcleDto keySiteExcleDto = new KeySiteExcleDto();
Bean.copyExistPropertis(i, keySiteExcleDto); Bean.copyExistPropertis(i, keySiteExcleDto);
if (i.getFirePreventionFlag()) { if (i.getFirePreventionFlag()) {
...@@ -184,10 +192,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -184,10 +192,12 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
} }
@Override @Override
public List<OrgMenuDto> getOrguserTree() { public List<OrgMenuDto> getOrgUserTree(ReginParams reginParams) {
List<OrgUsrTreeDto> list = orgUsrMapper.getCompanyAndCountDepartment(); List<OrgUsr> comDeptList = iOrgUsrService.getListByBizOrgTypeCode(OrgPersonEnum.公司.getKey() +"," + OrgPersonEnum.部门.getKey(),reginParams.getPersonIdentity().getBizOrgCode());
List<OrgMenuDto> menuList = list.stream().map(o -> { List<KeySite> keySiteList = this.list(new LambdaQueryWrapper<KeySite>().eq(BaseEntity::getIsDelete,false));
OrgMenuDto menu = new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName()+" ("+o.getNum() + ")", 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, ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.valueOf(o.getParentId()), o.getBizOrgType(), false,
o.getBizOrgCode()); o.getBizOrgCode());
return menu; return menu;
...@@ -228,6 +238,8 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -228,6 +238,8 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
@Override @Override
public boolean saveExcel(List<KeySiteExcleDto> excelDtoList) { public boolean saveExcel(List<KeySiteExcleDto> excelDtoList) {
List<KeySite> excelList = new ArrayList<KeySite>(); 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) { for (KeySiteExcleDto keySiteExcleDto : excelDtoList) {
KeySite keySiteDto = new KeySite(); KeySite keySiteDto = new KeySite();
Bean.copyExistPropertis(keySiteExcleDto, keySiteDto); Bean.copyExistPropertis(keySiteExcleDto, keySiteDto);
...@@ -235,6 +247,8 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite ...@@ -235,6 +247,8 @@ public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySite
if (StringUtils.isNotBlank(keySiteExcleDto.getBelongName()) if (StringUtils.isNotBlank(keySiteExcleDto.getBelongName())
&& keySiteExcleDto.getBelongName().contains("@")) { && keySiteExcleDto.getBelongName().contains("@")) {
keySiteDto.setBelongId(Long.parseLong(keySiteExcleDto.getBelongName().split("@")[1])); 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()) if (StringUtils.isNotBlank(keySiteExcleDto.getBuildingName())
&& keySiteExcleDto.getBuildingName().contains("@")) { && keySiteExcleDto.getBuildingName().contains("@")) {
......
...@@ -304,7 +304,7 @@ public class ExcelServiceImpl { ...@@ -304,7 +304,7 @@ public class ExcelServiceImpl {
par.containsKey("fireEnduranceRate")?par.get("fireEnduranceRate").toString():null, par.containsKey("fireEnduranceRate")?par.get("fireEnduranceRate").toString():null,
par.containsKey("useNature")?par.get("useNature").toString():null, par.containsKey("useNature")?par.get("useNature").toString():null,
par.containsKey("fireFacilitiesInfo")?par.get("fireFacilitiesInfo").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{ }else{
keySiteDtoList = keySiteService.exportToExcel(null,null,null,null,null,null); keySiteDtoList = keySiteService.exportToExcel(null,null,null,null,null,null);
} }
......
...@@ -2606,25 +2606,47 @@ ...@@ -2606,25 +2606,47 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-11-07-3"> <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"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="cb_firefighters" columnName="biz_org_name"/> <columnExists tableName="cb_firefighters" columnName="biz_org_code"/>
</not> </not>
</preConditions> </preConditions>
<comment>cb_firefighters add column biz_org_name '所属单位名称'</comment> <comment>cb_firefighters add column biz_org_code '所属单位code'</comment>
<sql> <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> </sql>
</changeSet> </changeSet>
<changeSet author="litengwei" id="2021-11-07-4"> <changeSet author="suhuiguang" id="1641688114483-01">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<not> <not>
<columnExists tableName="cb_firefighters" columnName="biz_org_code"/> <columnExists tableName="cb_key_site" columnName="biz_org_name"/>
</not> </not>
</preConditions> </preConditions>
<comment>cb_firefighters add column biz_org_code '所属单位code'</comment> <comment>cb_key_site add column biz_org_name '所属单位名称'</comment>
<sql> <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> </sql>
</changeSet> </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