Commit 49cca074 authored by chenhao's avatar chenhao

修改公司人員的mapper.xml,和添加重點部位代碼 by 陳浩

parent cbb1dd45
package com.yeejoin.amos.boot.module.common.api.dto;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 重点部位
......@@ -16,7 +20,7 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="KeySiteDto", description="重点部位")
public class KeySiteDto extends BaseDto {
public class KeySiteDto extends BaseDto implements Serializable{
private static final long serialVersionUID = 1L;
......@@ -69,7 +73,15 @@ public class KeySiteDto extends BaseDto {
@ApiModelProperty(value = "防范手段措施")
private String preventiveMeasures;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "耐火等级名称")
private String fireEnduranceRateName;
@ApiModelProperty(value = "使用性质名称")
private String useNatureName;
@ApiModelProperty(value = "附件")
private Map<String, List<AttachmentDto>> attachments;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import java.io.Serializable;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "KeySite", description = "重点部位")
public class KeySiteExcleDto implements Serializable {
/**
*
*/
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "序号")
@ExcelIgnore
private Integer number;
@ExcelProperty(value = "重点部位名称", index = 0)
@ApiModelProperty(value = "重点部位名称")
private String name;
@ExcelProperty(value = "所属单位/部门id", index = 1)
@ApiModelProperty(value = "所属单位/部门id")
private String belongName;
@ExcelIgnore
private Long belongId;
@ExcelProperty(value = "所属建筑id", index = 2)
@ApiModelProperty(value = "所属建筑id")
private String buildingName;
@ExcelIgnore
private Long buildingId;
@ExcelProperty(value = "位置描述", index = 3)
@ApiModelProperty(value = "位置描述")
private String addressDesc;
@ExcelProperty(value = "建筑面积(㎡)", index = 4)
@ApiModelProperty(value = "建筑面积(㎡)")
private String buildingArea;
@ExcelProperty(value = "建筑高度(m)", index = 5)
@ApiModelProperty(value = "建筑高度(m)")
private String buildingHeight;
@ExcelProperty(value = "耐火等级", index = 6)
@ApiModelProperty(value = "耐火等级")
private String fireEnduranceRate;
@ExcelProperty(value = "使用性质", index = 7)
@ApiModelProperty(value = "使用性质")
private String useNature;
@ExcelProperty(value = "责任人", index = 8)
@ApiModelProperty(value = "责任人")
private String chargePerson;
@ExcelProperty(value = "责任人身份证", index = 9)
@ApiModelProperty(value = "责任人身份证")
private String chargePersonId;
@ExcelProperty(value = "确定重点防火部位的原因", index = 10)
@ApiModelProperty(value = "确定重点防火部位的原因")
private String keyPreventionReason;
@ExcelProperty(value = "消防设施情况", index = 11)
@ExplicitConstraint(indexNum=11,source = {"有","无"})
@ApiModelProperty(value = "消防设施情况")
private String fireFacilitiesInfo;
@ExcelProperty(value = "防火标志设立情况", index = 12)
@ApiModelProperty(value = "防火标志设立情况")
private String firePreventionFlag;
@ExcelProperty(value = "危险源", index = 13)
@ApiModelProperty(value = "危险源")
private String hazard;
@ExcelProperty(value = "消防安全管理措施", index = 14)
@ApiModelProperty(value = "消防安全管理措施")
private String safetyManagementMeasures;
@ExcelProperty(value = "防范手段措施", index = 15)
@ApiModelProperty(value = "防范手段措施")
private String preventiveMeasures;
@ExcelProperty(value = "备注", index = 16)
@ApiModelProperty(value = "备注")
private String remark;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import java.io.Serializable;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value = "OrgUsr", description = "机构/部门/人员表")
public class OrgUsrTreeDto extends BaseDto implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "机构名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "机构类型(部门:DEPARTMENT,单位:COMPANY,人员:PERSON)")
private String bizOrgType;
@ApiModelProperty(value = "归属机构")
private String parentId;
@ApiModelProperty(value = "部门数量")
private String num;
}
package com.yeejoin.amos.boot.module.common.api.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
/**
* 重点部位 Mapper 接口
......@@ -10,5 +15,21 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2021-07-26
*/
public interface KeySiteMapper extends BaseMapper<KeySite> {
/**
* 分页查询
*/
public IPage<KeySiteDto> getPageList(Page<KeySiteDto> page, String name, Long buildingId, String fireEnduranceRate,
String useNature, String fireFacilitiesInfo);
/**
* 获取所有的重点部位数据
* @return
*/
public List<KeySiteDto> getKeySiteList();
/**
* 根据id查找
* @param sequenceNbr
* @return
*/
public KeySiteDto getSequenceNbr(Long sequenceNbr);
}
......@@ -51,6 +51,10 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<CompanyDto> listContractDto(@Param("pageNum")int pageNum, @Param("pageSize")int pageSize, @Param("par") RequestData par);
Integer listContractDtoCount(@Param("par")RequestData par);
/**
* 获取机场单位树,包含对应单位下部门的数量
* @return
*/
List<OrgUsrTreeDto> getCompanyAndCountDepartment();
}
package com.yeejoin.amos.boot.module.common.api.service;
import java.util.List;
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.OrgUsrTreeDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
/**
* 重点部位接口类
......@@ -8,5 +14,42 @@ package com.yeejoin.amos.boot.module.common.api.service;
* @date 2021-07-26
*/
public interface IKeySiteService {
/**
* 根据主键做逻辑假删除
* @param id
* @return
*/
public boolean deletebyId(Long id);
/**
* 保存
* @param model
* @return
*/
public KeySiteDto save(KeySiteDto model);
/**
* 修改
* @param keySite
* @return
*/
public boolean update (KeySite keySite);
/**
* 获取机场单位组织结构树,包含单位下部门数量的统计
* @return
*/
public List<OrgUsrTreeDto> getOrguserTree();
/**
*
* @return
*/
public List<KeySiteDto> queryForKeySiteList() ;
/**根据id查找
*
* @param sequenceNbr
* @return
*/
public KeySiteDto getSequenceNbr(Long sequenceNbr);
public List<KeySiteExcleDto> exportToExcel();
public boolean saveExcle(List<KeySiteExcleDto> excelDtoList);
}
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
......@@ -162,4 +163,6 @@ public interface IMaintenanceCompanyService {
*/
public List<MaintenancePersonExcleDto> exportToMaintenancePersonExcel();
public Map<String, List<AttachmentDto>> getAttachments(Long sequenceNbr);
}
......@@ -82,7 +82,7 @@
and i.APP_KEY = #{appKey}
</if>
<foreach collection="params" index="key" item="value" separator="">
<if test="key != null and key = 'instanceIds' ">
<if test="key != null and key == 'instanceIds' ">
and find_in_set(i.instance_id, #{value}) > 0
</if>
</foreach>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper">
<mapper
namespace="com.yeejoin.amos.boot.module.common.api.mapper.KeySiteMapper">
<select id="getPageList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
c.building_id as buildingId,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
fer.`name` as fireEnduranceRateName,
un.`name` as useNatureName
FROM
cb_key_site c
LEFT JOIN (
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`
) 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`
) un ON c.use_nature = un.use_nature
where c.is_delete=FALSE
<if test="name != null and name != ''">
AND c.`name`=#{name}
</if>
<if test="buildingId != null and buildingId != -1">
AND c.`building_id`=#{buildingId}
</if>
<if test="fireEnduranceRate != null and fireEnduranceRate != ''">
AND c.`fire_endurance_rate`=#{fireEnduranceRate}
</if>
<if test="useNature != null and useNature != ''">
AND c.`use_nature`=#{useNature}
</if>
<if test="fireFacilitiesInfo != null and fireFacilitiesInfo != ''">
AND c.`fire_facilities_info`=#{fireFacilitiesInfo}
</if>
</select>
<select id="getSequenceNbr" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
c.building_id as buildingId,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
fer.`name` as fireEnduranceRateName,
un.`name` as useNatureName
FROM
cb_key_site c
LEFT JOIN (
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`
) 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`
) un ON c.use_nature = un.use_nature
where c.sequence_nbr=#{sequenceNbr} and c.is_delete=FALSE;
</select>
<select id="getKeySiteList" resultType="com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto">
SELECT
c.`name` as name,
c.belong_id as belongId,
c.building_id as buildingId,
c.address_desc as addressDesc,
c.building_area as buildingArea,
c.building_height as buildingHeight,
c.fire_endurance_rate as fireEnduranceRate,
c.use_nature as useNature,
c.charge_person AS chargePerson,
c.sequence_nbr AS sequenceNbr,
c.charge_person_id AS chargePersonId,
c.key_prevention_reason AS keyPreventionReason,
c.fire_facilities_info AS fireFacilitiesInfo,
c.fire_prevention_flag AS firePreventionFlag,
c.hazard AS hazard,
c.safety_management_measures AS safetyManagementMeasures,
c.preventive_measures AS preventiveMeasures,
c.remark AS remark,
c.is_delete AS isDelete,
c.rec_user_id AS recUserId,
c.rec_user_name AS recUserName,
c.rec_date AS recDate,
fer.`name` as fireEnduranceRateName,
un.`name` as useNatureName
FROM
cb_key_site c
LEFT JOIN (
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`
) 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`
) un ON c.use_nature = un.use_nature
where c.is_delete=FALSE;
</select>
</mapper>
......@@ -14,4 +14,5 @@ public class ExcelEnums {
public static final String CLZQ = "CLZQ";//("CLZQ","车辆执勤")
public static final String RYZB = "RYZB";//("RYZB","人员值班")
public static final String WBRY = "WBRY";//("WBRY",维保人员)
public static final String KEYSITE = "KEYSITE";//{"KEYSITE":重點部位}
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
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 io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.KeySiteDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.KeySiteServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 重点部位
......@@ -30,7 +49,14 @@ public class KeySiteController extends BaseController {
@Autowired
KeySiteServiceImpl keySiteServiceImpl;
@Autowired
IKeySiteService keySiteService;
@Autowired
IOrgUsrService iOrgUsrService;
@Autowired
IMaintenanceCompanyService maintenanceCompanyService;
/**
* 新增重点部位
*
......@@ -40,8 +66,9 @@ public class KeySiteController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增重点部位", notes = "新增重点部位")
public ResponseModel<KeySiteDto> save(@RequestBody KeySiteDto model) {
model = keySiteServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
model.setIsDelete(false);
KeySiteDto entity= keySiteService.save(model);
return ResponseHelper.buildResponse(entity);
}
/**
......@@ -51,11 +78,10 @@ public class KeySiteController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@PutMapping(value = "update/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新重点部位", notes = "根据sequenceNbr更新重点部位")
public ResponseModel<KeySiteDto> updateBySequenceNbrKeySite(@RequestBody KeySiteDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(keySiteServiceImpl.updateWithModel(model));
public ResponseModel<Boolean> updateBySequenceNbrKeySite(@RequestBody KeySite model) {
return ResponseHelper.buildResponse(keySiteService.update(model));
}
/**
......@@ -65,10 +91,10 @@ public class KeySiteController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@DeleteMapping(value = "delete/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除重点部位", notes = "根据sequenceNbr删除重点部位")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(keySiteServiceImpl.removeById(sequenceNbr));
return ResponseHelper.buildResponse(keySiteService.deletebyId(sequenceNbr));
}
/**
......@@ -78,10 +104,15 @@ public class KeySiteController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@GetMapping(value = "find/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个重点部位", notes = "根据sequenceNbr查询单个重点部位")
public ResponseModel<KeySiteDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(keySiteServiceImpl.queryBySeq(sequenceNbr));
Map<String, List<AttachmentDto>> files = maintenanceCompanyService.getAttachments(sequenceNbr);
KeySiteDto dto= keySiteService.getSequenceNbr(sequenceNbr);
if(files!=null && dto!=null) {
dto.setAttachments(files);
}
return ResponseHelper.buildResponse(dto);
}
/**
......@@ -92,14 +123,15 @@ public class KeySiteController extends BaseController {
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<Page<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
@PostMapping(value = "/page")
@ApiOperation(httpMethod = "POST",value = "重点部位分页查询", notes = "重点部位分页查询")
public ResponseModel<IPage<KeySiteDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size,
@RequestBody KeySite keySite) {
Page<KeySiteDto> page = new Page<KeySiteDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySitePage(page));
return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySitePage(page,keySite));
}
/**
......@@ -107,10 +139,24 @@ public class KeySiteController extends BaseController {
*
* @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 = "/list")
public ResponseModel<List<KeySiteDto>> selectForList() {
return ResponseHelper.buildResponse(keySiteServiceImpl.queryForKeySiteList());
@ApiOperation(httpMethod = "GET",value = "机场单位组织结构树", notes = "机场单位组织结构树")
@GetMapping(value = "/getOrguserTree")
public ResponseModel<List<OrgMenuDto>> getOrguserTree() throws Exception{
List<OrgMenuDto> menus = iOrgUsrService.getTree(null,
keySiteService.getOrguserTree(), OrgUsrTreeDto.class.getName(),
"getSequenceNbr", 2, "getBizOrgName", "getParentId", "getNum");
return ResponseHelper.buildResponse(menus);
}
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.SourceFileDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -23,8 +19,14 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.SourceFileDto;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 公共附件
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
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.KeySiteExcleDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrTreeDto;
import com.yeejoin.amos.boot.module.common.api.entity.KeySite;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
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.dto.KeySiteDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 重点部位服务实现类
......@@ -16,18 +34,130 @@ import java.util.List;
* @date 2021-07-26
*/
@Service
public class KeySiteServiceImpl extends BaseService<KeySiteDto,KeySite,KeySiteMapper> implements IKeySiteService {
public class KeySiteServiceImpl extends BaseService<KeySiteDto, KeySite, KeySiteMapper> implements IKeySiteService {
@Autowired
KeySiteMapper keySiteMapper;
@Autowired
SourceFileServiceImpl sourceFileService;
@Autowired
OrgUsrMapper orgUsrMapper;
/**
* 分页查询
*/
public Page<KeySiteDto> queryForKeySitePage(Page<KeySiteDto> page) {
return this.queryForPage(page, null, false);
public IPage<KeySiteDto> queryForKeySitePage(Page<KeySiteDto> page, KeySite keySite) {
return keySiteMapper.getPageList(page, keySite.getName(), keySite.getBuildingId(),
keySite.getFireEnduranceRate(), keySite.getUseNature(), keySite.getFireFacilitiesInfo());
}
/**
* 列表查询 示例
*/
public List<KeySiteDto> queryForKeySiteList() {
return this.queryForList("" , false);
return keySiteMapper.getKeySiteList();
}
public List<KeySiteExcleDto> exportToExcel() {
List<KeySiteDto> list = this.queryForKeySiteList();
return JSONArray.parseArray(JSONArray.toJSONString(list), KeySiteExcleDto.class);
}
@Override
public boolean deletebyId(Long id) {
KeySite keySite = keySiteMapper.selectById(id);
if (keySite == null) {
return false;
}
keySite.setIsDelete(true);
int number = keySiteMapper.updateById(keySite);
if (number > 0) {
return true;
}
return false;
}
@Override
@Transactional(rollbackFor = Exception.class)
public KeySiteDto save(KeySiteDto model) {
KeySite keySite = new KeySite();
Bean.copyExistPropertis(model, keySite);
this.save(keySite);
this.saveAttachments(model);
// TODO Auto-generated method stub
return model;
}
public void saveAttachments(KeySiteDto keySiteDto) {
if (!ValidationUtil.isEmpty(keySiteDto.getAttachments())) {
List<SourceFile> sourceFiles = Lists.newArrayList();
Map<String, List<AttachmentDto>> attachmentMap = keySiteDto.getAttachments();
attachmentMap.entrySet().forEach(entry -> {
List<AttachmentDto> atts = entry.getValue();
sourceFiles.addAll(attachment2SourceFile(entry.getKey(), atts));
});
sourceFileService.saveSourceFile(keySiteDto.getSequenceNbr(), sourceFiles);
}
}
private List<SourceFile> attachment2SourceFile(String type, List<AttachmentDto> attachmentDtoList) {
List<SourceFile> sourceFiles = Lists.newArrayList();
if (!ValidationUtil.isEmpty(attachmentDtoList)) {
attachmentDtoList.forEach(a -> {
SourceFile s = new SourceFile();
s.setFilePath(a.getUrl());
s.setFileName(a.getName());
s.setFileCategory(type);
sourceFiles.add(s);
});
}
return sourceFiles;
}
public boolean update(KeySite keySite) {
keySite.setIsDelete(false);
int num = keySiteMapper.updateById(keySite);
if (num > 0) {
return true;
}
return false;
}
@Override
public List<OrgUsrTreeDto> getOrguserTree() {
return orgUsrMapper.getCompanyAndCountDepartment();
}
@Override
public KeySiteDto getSequenceNbr(Long sequenceNbr) {
return keySiteMapper.getSequenceNbr(sequenceNbr);
}
@Override
public boolean saveExcle(List<KeySiteExcleDto> excelDtoList) {
List<KeySite> excelList = new ArrayList<KeySite>();
for (KeySiteExcleDto keySiteExcleDto : excelDtoList) {
KeySite keySiteDto = new KeySite();
Bean.copyExistPropertis(keySiteExcleDto, keySiteDto);
keySiteDto.setIsDelete(false);
if (StringUtils.isNotBlank(keySiteExcleDto.getFireEnduranceRate())
&& keySiteExcleDto.getFireEnduranceRate().contains("@")) {
String[] fireEnduranceRateArray = keySiteExcleDto.getFireEnduranceRate().split("@");
if (fireEnduranceRateArray.length > 1) {
keySiteDto.setFireEnduranceRate(fireEnduranceRateArray[1]);
}
}
if (StringUtils.isNotBlank(keySiteExcleDto.getUseNature())
&& keySiteExcleDto.getUseNature().contains("@")) {
String[] useNatureArray = keySiteExcleDto.getUseNature().split("@");
if (useNatureArray.length > 1) {
keySiteDto.setFireEnduranceRate(useNatureArray[1]);
}
}
excelList.add(keySiteDto);
}
return this.saveBatch(excelList);
}
}
\ No newline at end of file
......@@ -434,7 +434,7 @@ public class MaintenanceCompanyServiceImpl
return mainMap;
}
private Map<String, List<AttachmentDto>> getAttachments(Long sequenceNbr) {
public Map<String, List<AttachmentDto>> getAttachments(Long sequenceNbr) {
Map<String, List<AttachmentDto>> attachmentMap = Maps.newHashMap();
List<SourceFile> sourceFileList = sourceFileService.findBySourceId(sequenceNbr);
if (!ValidationUtil.isEmpty(sourceFileList)) {
......
......@@ -33,6 +33,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.collect.Lists;
......@@ -52,6 +53,8 @@ import com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
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.MaintenancePersonExcleDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
......@@ -65,6 +68,7 @@ import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
import com.yeejoin.amos.boot.module.common.api.entity.FirefightersContacts;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.service.IKeySiteService;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.biz.service.IDutyPersonService;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyCarServiceImpl;
......@@ -145,6 +149,9 @@ public class ExcelController extends BaseController {
@Autowired
Sequence sequence;
@Autowired
IKeySiteService keySiteService;
private static final String NOT_DUTY = "休班";
private static final String PERSON = "PERSON";
......@@ -213,6 +220,11 @@ public class ExcelController extends BaseController {
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
maintenancePersonExcleDtoList, MaintenancePersonExcleDto.class, null, false);
break;
case ExcelEnums.KEYSITE:
List<KeySiteExcleDto> keySiteDtoList = keySiteService.exportToExcel();
ExcelUtil.createTemplate(response, excelDto.getFileName(), excelDto.getSheetName(),
keySiteDtoList, KeySiteExcleDto.class, null, false);
break;
}
} catch (Exception e) {
e.printStackTrace();
......@@ -255,12 +267,30 @@ public class ExcelController extends BaseController {
excelImportDutyPerson(multipartFile, ExcelEnums.RYZB);
case ExcelEnums.WBRY:
excelImportMaintenancePerson(multipartFile, ExcelEnums.WBRY);
case ExcelEnums.KEYSITE:
excelImportkeySite(multipartFile, ExcelEnums.KEYSITE);
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
/**
* @author chenhao
* @param multipartFile
* @param wbry
* @throws Exception
*/
@SuppressWarnings("unused")
private void excelImportkeySite(MultipartFile multipartFile, String wbry) throws Exception {
List<KeySiteExcleDto> excelDtoList = ExcelUtil.readFirstSheetExcel(multipartFile,
KeySiteExcleDto.class, 1);
keySiteService.saveExcle( excelDtoList);
}
/**
* @author chenhao
* @param multipartFile
......
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