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>
......
......@@ -4,12 +4,16 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.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.KeySiteDateDto;
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.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.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
......@@ -19,15 +23,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
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.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -49,189 +46,195 @@ import java.util.Map;
@RequestMapping(value = "/common/key-site")
public class KeySiteController extends BaseController {
@Autowired
KeySiteServiceImpl keySiteServiceImpl;
@Autowired
IKeySiteService keySiteService;
@Autowired
IOrgUsrService iOrgUsrService;
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
EquipFeignClient equipFeignClient;
/**
* 新增重点部位
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位")
public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) {
JSONObject json = getBulid(model.getBuildingId());
if (json != null && StringUtils.isNotBlank(json.getString("latitude")) && StringUtils.isNotBlank(json.getString("longitude"))) {
model.setLatitude(Double.parseDouble(json.getString("latitude")));
model.setLongitude(Double.parseDouble(json.getString("longitude")));
}
model.setIsDelete(false);
KeySiteDto entity = keySiteService.save(model);
return ResponseHelper.buildResponse(entity);
}
public JSONObject getBulid(Long id) {
ResponseModel<Object> equipObj = equipFeignClient.getOne(id);
JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
if (!equipjSONObject.containsKey("parentId")) {
return null;
}
if (!"0".equals(equipjSONObject.getString("parentId"))) {
String parentId = equipjSONObject.getString("parentId");
if (StringUtils.isNotBlank(parentId)) {
return getBulid(Long.parseLong(parentId));
}
}
return equipjSONObject;
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "update/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位")
public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model) {
JSONObject json = getBulid(model.getBuildingId());
if (json != null) {
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
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@RequestParam(value = "ids") String ids) {
List<Long> sequenceNbrList = new ArrayList<>();
/* BUG 2670 litw start */
String[] idsArr = ids.split(",");
for (String str : idsArr) {
sequenceNbrList.add(Long.valueOf(str));
}
/* BUG 2670 end */
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "find/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个重点部位", notes = "根据sequenceNbr查询单个重点部位")
public ResponseModel<KeySiteDto> selectOne(@PathVariable Long sequenceNbr) {
List<String> list = new ArrayList<String>();
Map<String, List<AttachmentDto>> files = sourceFileService.getAttachments(sequenceNbr);
KeySiteDto dto = keySiteService.getSequenceNbr(sequenceNbr);
if (files != null && dto != null) {
dto.setAttachments(files);
JSONArray array = JSONArray.parseArray(JSONArray.toJSONString(files.get("keySitePhoto")));
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);
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size, @RequestParam(required = false) String name,
@RequestParam(required = false) Long buildingId, @RequestParam(required = false) String fireEnduranceRate,
@RequestParam(required = false) String useNature, @RequestParam(required = false) String fireFacilitiesInfo,
@RequestParam(required = false) Long belongId, @RequestParam(required = false) String belongName) {
Page<KeySiteDto> page = new Page<KeySiteDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate,
useNature, fireFacilitiesInfo, belongId,belongName));
}
/**
* 列表全部数据查询
*
* @return
*/
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(httpMethod = "GET",value = "重点部位列表全部数据查询", notes = "重点部位列表全部数据查询")
// @GetMapping(value = "/list")
// public ResponseModel<List<KeySite>> selectForList() {
// return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySiteList());
// }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "机场单位部位树", notes = "机场单位部位树")
@GetMapping(value = "/getOrguserTree")
public ResponseModel<List<OrgMenuDto>> getOrguserTree() {
List<OrgMenuDto> list = new ArrayList<OrgMenuDto>();
OrgMenuDto orgMenuDto = new OrgMenuDto();
orgMenuDto.setChildren(keySiteService.getOrguserTree());
orgMenuDto.setName("单位管理");
orgMenuDto.setKey(-1L);
orgMenuDto.setTitle("单位管理");
list.add(orgMenuDto);
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) {
return ResponseHelper.buildResponse(keySiteService.getBuildAndKeyTree(buildingId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "部位", notes = "部位")
@GetMapping(value = "/getKeySiteDate")
public ResponseModel<List<KeySiteDateDto>> getKeySiteDate(@RequestParam(required = false) Long id) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDate(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "通过名称模糊查询重点部位的信息", notes = "通过名称模糊查询重点部位的信息")
@GetMapping(value = "/getKeySiteDateByNameLike")
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike(@RequestParam(required = false) Long companyId) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike(companyId));
}
@Autowired
KeySiteServiceImpl keySiteServiceImpl;
@Autowired
IKeySiteService keySiteService;
@Autowired
IOrgUsrService iOrgUsrService;
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
EquipFeignClient equipFeignClient;
@Value("${auth-key-key-site:key_site_info}")
private String authKey;
/**
* 新增重点部位
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位")
public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) {
JSONObject json = getBulid(model.getBuildingId());
if (json != null && StringUtils.isNotBlank(json.getString("latitude")) && StringUtils.isNotBlank(json.getString("longitude"))) {
model.setLatitude(Double.parseDouble(json.getString("latitude")));
model.setLongitude(Double.parseDouble(json.getString("longitude")));
}
model.setIsDelete(false);
KeySiteDto entity = keySiteService.save(model);
return ResponseHelper.buildResponse(entity);
}
public JSONObject getBulid(Long id) {
ResponseModel<Object> equipObj = equipFeignClient.getOne(id);
JSONObject equipjSONObject = JSONObject.parseObject(JSONObject.toJSONString(equipObj.getResult()));
if (!equipjSONObject.containsKey("parentId")) {
return null;
}
if (!"0".equals(equipjSONObject.getString("parentId"))) {
String parentId = equipjSONObject.getString("parentId");
if (StringUtils.isNotBlank(parentId)) {
return getBulid(Long.parseLong(parentId));
}
}
return equipjSONObject;
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "update/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位")
public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model) {
JSONObject json = getBulid(model.getBuildingId());
if (json != null) {
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
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "delete")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request,
@RequestParam(value = "ids") String ids) {
List<Long> sequenceNbrList = new ArrayList<>();
/* BUG 2670 litw start */
String[] idsArr = ids.split(",");
for (String str : idsArr) {
sequenceNbrList.add(Long.valueOf(str));
}
/* BUG 2670 end */
return ResponseHelper.buildResponse(keySiteService.deleteById(sequenceNbrList));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "find/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个重点部位", notes = "根据sequenceNbr查询单个重点部位")
public ResponseModel<KeySiteDto> selectOne(@PathVariable Long sequenceNbr) {
List<String> list = new ArrayList<String>();
Map<String, List<AttachmentDto>> files = sourceFileService.getAttachments(sequenceNbr);
KeySiteDto dto = keySiteService.getSequenceNbr(sequenceNbr);
if (files != null && dto != null) {
dto.setAttachments(files);
JSONArray array = JSONArray.parseArray(JSONArray.toJSONString(files.get("keySitePhoto")));
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);
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPage(
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false) String name,
@RequestParam(required = false) Long buildingId,
@RequestParam(required = false) String fireEnduranceRate,
@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 ResponseHelper.buildResponse(keySiteServiceImpl.getPageList(page, name, buildingId, fireEnduranceRate,
useNature, fireFacilitiesInfo, bizOrgCode));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "机场单位部门部位统计树", notes = "机场单位部门部位统计树")
@GetMapping(value = "/getOrguserTree")
public ResponseModel<List<OrgMenuDto>> getOrgUserTree() {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
// 权限赋值
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> list = keySiteService.getOrgUserTree(reginParams);
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) {
return ResponseHelper.buildResponse(keySiteService.getBuildAndKeyTree(buildingId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "部位", notes = "部位")
@GetMapping(value = "/getKeySiteDate")
public ResponseModel<List<KeySiteDateDto>> getKeySiteDate(@RequestParam(required = false) Long id) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDate(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "通过名称模糊查询重点部位的信息", notes = "通过名称模糊查询重点部位的信息")
@GetMapping(value = "/getKeySiteDateByNameLike")
public ResponseModel<List<KeySite>> getKeySiteDateByNameLike(@RequestParam(required = false) Long companyId) {
return ResponseHelper.buildResponse(keySiteService.getKeySiteDateByNameLike(companyId));
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeByUserAndType", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司树", notes = "根据登录人及类型获取公司树")
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;
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