Commit 3bfb032d authored by tangwei's avatar tangwei

导入,导出 ,模板

parent 03350ab1
......@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 危化品
* '
*
* @author system_generator
* @date 2021-06-29
......
......@@ -39,7 +39,7 @@ public class FireTeamDto extends BaseDto {
private String companyCode;
@ExplicitConstraint(indexNum = 1, sourceClass = RoleNameExplicitConstraint.class,method="getFireTeam") //动态下拉内容
@ExcelProperty(value = "上级单位", index = 1)
@ExcelProperty(value = "上级队伍", index = 1)
@ApiModelProperty(value = "父级名称")
private String parentName;
......
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
......@@ -22,88 +26,99 @@ import org.omg.CORBA.PRIVATE_MEMBER;
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "LinkageUnitDto", description = "联动单位")
public class LinkageUnitDto extends BaseDto {
@ExcelIgnore
private static final long serialVersionUID = 1L;
@ExcelProperty(value = "单位名称", index = 0)
@ApiModelProperty(value = "单位名称")
private String unitName;
@ExcelIgnore
@ApiModelProperty(value = "单位code")
private String unitCode;
@ExcelIgnore
@ApiModelProperty(value = "父级单位id")
private String parentId;
@ApiModelProperty(value = "联动单位类别")
@ExcelProperty(value = "服务类别", index = 1)
@ExplicitConstraint(type = "LDDWLB", indexNum =1, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ApiModelProperty(value = "服务类别")
private String linkageUnitType;
@ExcelIgnore
@ApiModelProperty(value = "联动单位类别code")
private String linkageUnitTypeCode;
@ExcelIgnore
@ApiModelProperty(value = "行政区划")
private String administrativeDivisions;
@ExcelIgnore
@ApiModelProperty(value = "行政区划代码")
private String administrativeDivisionsCode;
@ExcelProperty(value = "地址", index = 2)
@ApiModelProperty(value = "地址")
private String address;
@ExcelProperty(value = "经度", index = 3)
@ApiModelProperty(value = "经度")
private Double longitude;
@ExcelProperty(value = "纬度", index = 4)
@ApiModelProperty(value = "纬度")
private Double latitude;
@ExcelProperty(value = "协议开始日期", index = 5)
@ApiModelProperty(value = "协议开始日期")
private Date agreementStartDate;
@ExcelProperty(value = "协议结束日期", index = 6)
@ApiModelProperty(value = "协议结束日期")
private Date agreementEndDate;
@ExcelProperty(value = "应急联动单位类别", index = 7)
@ExplicitConstraint(type = "YJLDDW", indexNum =7, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内容
@ApiModelProperty(value = "应急联动单位类别")
private String emergencyLinkageUnit;
@ExcelIgnore
@ApiModelProperty(value = "应急联动单位类别code")
private String emergencyLinkageUnitCode;
@ExcelProperty(value = "联系人", index = 8)
@ApiModelProperty(value = "联系人 ")
private String contactUser;
@ExcelProperty(value = "联系人电话", index = 9)
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
@ExcelIgnore
@ApiModelProperty(value = "实例id")
private Long instanceId;
@ExcelIgnore
@ApiModelProperty(value = "组织机构代码")
private String orgCode;
@ExcelIgnore
@ApiModelProperty(value = "操作人名称")
private String recUserName;
@ExcelIgnore
@ApiModelProperty(value = "是否在协议期 ")
private String inAgreement;
@ExcelProperty(value = "消防救援能力", index = 10)
@ApiModelProperty(value = "消防救援能力")
private String fireRescueCapability;
@ExcelProperty(value = "职责_简要情况", index = 11)
@ApiModelProperty(value = "职责_简要情况")
private String responsibilitiesSituation;
@ExcelProperty(value = "应急服务内容", index = 12)
@ApiModelProperty(value = "应急服务内容")
private String emergencyServiceContent;
@ExcelProperty(value = "单位_简要情况", index = 13)
@ApiModelProperty(value = "单位_简要情况")
private String unitSituation;
@ExcelIgnore
@ApiModelProperty(value = "联动单位图片")
private List<SourceFile> image;
@ExcelIgnore
@ApiModelProperty(value = "车辆数量")
private String vehicleNumber;
@ExcelIgnore
@ApiModelProperty(value = "特岗人数")
private String personNumber;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.excel.ExplicitConstraint;
import com.yeejoin.amos.boot.module.common.api.excel.RoleNameExplicitConstraint;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 机构/部门/人员表
*
* @author tb
* @date 2021-06-18
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="OrgUsrExcelDto", description="机构/部门/人员表")
public class OrgUsrExcelDto extends BaseDto {
@ExcelProperty(value = "姓名", index = 0)
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ExcelIgnore
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ExcelIgnore
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ExcelIgnore
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ExcelIgnore
@ApiModelProperty(value = "机构类型(部门:DEPARTMENT,单位:COMPANY,人员:PERSON)")
private String bizOrgType;
@ExcelIgnore
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ExcelIgnore
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
@ExcelProperty(value = "所属单位部门", index = 1)
@ExplicitConstraint(indexNum = 1, sourceClass = RoleNameExplicitConstraint.class, method = "getparent") //固定下拉内容
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentId;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性1")
private String orgExpandAttr1;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性2")
private String orgExpandAttr2;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性3")
private String orgExpandAttr3;
@ExcelIgnore
@ApiModelProperty(value = "扩展属性4")
private String orgExpandAttr4;
@ExcelIgnore
private String orgExpandAttr5;
@ExcelIgnore
private String orgExpandAttr6;
@ExcelIgnore
private String orgExpandAttr7;
@ExcelIgnore
private String orgExpandAttr8;
@ExcelIgnore
@ApiModelProperty(value = "更新人")
@TableField(fill= FieldFill.INSERT_UPDATE)
private String recUserName;
@ExcelIgnore
@ApiModelProperty(value = "动态表单值")
private List<DynamicFormInstance> dynamicFormValue;
@ExcelProperty(value = "行政职务", index = 2)
@ExplicitConstraint(type = "XZZW", indexNum =2, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String administrativePositionCode;// 行政职务
@ExcelProperty(value = "审核周期", index = 3)
@ExplicitConstraint(type = "SHZQ", indexNum =3, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String auditCycle; //审核周期
@ExcelProperty(value = "证件号码", index = 4)
private String certificatesNumber;// 证件号码
@ExcelProperty(value = "证件类型", index = 5)
@ExplicitConstraint(type = "RYZJLX", indexNum =5, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String certificatesTypeCode; //证件类型
@ExcelProperty(value = "持证类别", index = 6)
@ExplicitConstraint(type = "CZLB", indexNum =6, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String certificateType; //持证类别
@ExcelProperty(value = "消防管理岗位", index = 7)
@ExplicitConstraint(type = "XFGLGW", indexNum =7, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String fireManagementPostCode; //消防管理岗位
@ExcelProperty(value = "性别", index = 8)
@ExplicitConstraint(type = "XB", indexNum =8, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String gender; //性别
@ExcelProperty(value = "消防管理组织机构内部职务", index = 9)
@ExplicitConstraint(type = "JGNBZW", indexNum =9, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String internalPositionCode; //消防管理组织机构内部职务
@ExcelProperty(value = "员工编号", index = 10)
private String personNumber; //员工编号
@ExcelProperty(value = "岗位类型", index = 11)
@ExplicitConstraint(type = "GWMC", indexNum =11, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String positionType; //岗位类型
@ExcelProperty(value = "是否进行安全培训", index = 12)
@ExplicitConstraint(type = "AQPX", indexNum =12, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String safetyTraining; //是否进行安全培训
@ExcelProperty(value = "人员状态", index = 13)
@ExplicitConstraint(type = "RYZT", indexNum =13, sourceClass = RoleNameExplicitConstraint.class) //动态下拉内
private String stateCode; //人员状态
@ExcelProperty(value = "联系电话", index = 14)
private String telephone; //联系电话
}
......@@ -60,7 +60,7 @@ public interface LinkageUnitMapper extends BaseMapper<LinkageUnit> {
*/
Page<List<LinkageUnitDto>> getEmergencyLinkageUnitList(IPage<LinkageUnitDto> page,String unitName,
String linkageUnitTypeCode, String emergencyLinkageUnitCode);
List<LinkageUnitDto> exportToExcel();
}
......@@ -59,4 +59,8 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List< OrgUsrzhDto> getOrgUsrzhDto(@Param("bizOrgName")String bizOrgName);
List< Map<String,Object>> getparent();
List< OrgUsrExcelDto> exportToExcel();
}
......@@ -48,5 +48,6 @@ public interface ILinkageUnitService {
* @return
*/
public List<Menu> getEmergencyLinkageUnitCodeGroupBy(String type, String rootName) ;
List<LinkageUnitDto> exportToExcel();
}
......@@ -173,4 +173,7 @@ public interface IOrgUsrService {
List<ESOrgUsrDto> selectByIddata(String name);
List< Map<String,Object>> getparent();
List< OrgUsrExcelDto> exportToExcel();
}
......@@ -87,6 +87,29 @@
emergency_linkage_unit_code
</select>
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto">
select
a.unit_name unitName,
a.linkage_unit_type linkageUnitType,
a.address ,
a.latitude,
a.longitude,
a.agreement_start_date agreementStartDate,
a.agreement_end_date agreementEndDate,
a.contact_user contactUser,
a.contact_phone contactPhone,
b.*
from cb_linkage_unit a LEFT JOIN
(SELECT
m.instance_id,
max(case m.field_code when 'emergencyServiceContent' then m.field_value end) emergencyServiceContent,
max(case m.field_code when 'fireRescueCapability' then m.field_value end) fireRescueCapability,
max(case m.field_code when 'responsibilitiesSituation' then m.field_value end) responsibilitiesSituation,
max(case m.field_code when 'unitSituation' then m.field_value end) unitSituation
FROM cb_dynamic_form_instance m GROUP BY m.instance_id) b
on b.instance_id=a.instance_id where a.unit_name is not null
</select>
<select id="getEmergencyLinkageUnitList"
......
......@@ -297,4 +297,43 @@ LEFT JOIN (
keysite.belong_id
) keysite_sur ON company_sur.sequence_nbr = keysite_sur.belong_id
</select>
<select id="getparent" resultType="Map">
SELECT important_companys.id ,important_companys.name
FROM important_companys
</select>
<select id="exportToExcel" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto">
select
a.biz_org_name bizOrgName,
(select c.biz_org_name from cb_org_usr c where c.sequence_nbr=a.parent_id) parentId,
b.*
from cb_org_usr a LEFT JOIN
(SELECT
instance_id,
max(case field_code when 'administrativePositionCode' then field_value_label end) administrativePositionCode,
max(case field_code when 'auditCycle' then field_value_label end) auditCycle,
max(case field_code when 'certificatesNumber' then field_value end) certificatesNumber,
max(case field_code when 'certificatesTypeCode' then field_value_label end) certificatesTypeCode,
max(case field_code when 'certificateType' then field_value_label end) certificateType,
max(case field_code when 'fireManagementPostCode' then field_value_label end) fireManagementPostCode,
max(case field_code when 'gender' then field_value_label end) gender,
max(case field_code when 'internalPositionCode' then field_value_label end) internalPositionCode,
max(case field_code when 'personNumber' then field_value end) personNumber,
max(case field_code when 'positionType' then field_value_label end) positionType,
max(case field_code when 'safetyTraining' then field_value_label end) safetyTraining,
max(case field_code when 'stateCode' then field_value_label end) stateCode,
max(case field_code when 'telephone' then field_value end) telephone
FROM cb_dynamic_form_instance GROUP BY instance_id) b
on b.instance_id=a.sequence_nbr where a.biz_org_name is not null
</select>
</mapper>
package com.yeejoin.amos.boot.module.jcs.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 导出类型常量
***/
public class ExcelEnums {
public static final String WHP = "WHP";// ("WHP","危险品"),
public static final String XFZJ = "XFZJ";//("XFZJ","消防专家"),
public static final String SYXX = "SYXX";//("SYXX","水源信息"),
public static final String HKQ = "HKQ";//("HKQ","航空器");
public static final String XFDW = "XFDW";//("XFDW","消防队伍")
public static final String WXXFZ = "WXXFZ";//("WXXFZ","微型消防站")
public static final String XFRY = "XFRY";//("XFRY","消防人员")
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":重點部位}
@Getter
@AllArgsConstructor
public enum ExcelEnums {
WHP ("危险品", "危险品", "com.yeejoin.amos.boot.module.common.api.dto.FireChemicalDto","WHP"),// ("WHP","危险品"),
XFZJ ("消防专家", "消防专家", "com.yeejoin.amos.boot.module.common.api.dto.FireExpertsDto","XFZJ"),//("XFZJ","消防专家"),
SYXX ("水源信息", "水源信息", "com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto","SYXX"),//("SYXX","水源信息"),
HKQ ("航空器", "航空器", "com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto","HKQ"),//("HKQ","航空器");
XFDW ("消防队伍", "消防队伍", "com.yeejoin.amos.boot.module.common.api.dto.FireTeamDto","XFDW"),//("XFDW","消防队伍")
WXXFZ("微型消防站", "微型消防站", "com.yeejoin.amos.boot.module.common.api.dto.FireStationDto","WXXFZ"),//("WXXFZ","微型消防站")
XFRY ("消防人员", "消防人员", "com.yeejoin.amos.boot.module.common.api.dto.FirefightersExcelDto","XFRY"),//("XFRY","消防人员")
WBRY ("维保人员", "维保人员", "com.yeejoin.amos.boot.module.common.api.dto.MaintenancePersonExcleDto","WBRY"),//("WBRY",维保人员)
KEYSITE ("重點部位", "重點部位", "com.yeejoin.amos.boot.module.common.api.dto.KeySiteExcleDto","KEYSITE"),//{"KEYSITE":重點部位}
CLZQ ("车辆执勤", "车辆执勤", "com.yeejoin.amos.boot.module.common.api.dto.DutyCarExcelDto","CLZQ"),//("CLZQ","车辆执勤")
JCDWRY ("机场单位人员", "机场单位人员", "com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto","JCDWRY"),//("JCDW","机场单位")
LDDW ("联动单位", "联动单位", "com.yeejoin.amos.boot.module.common.api.dto.LinkageUnitDto","LDDW"),//("JCDW","机场单位")
RYZB ("人员值班", "人员值班", "com.yeejoin.amos.boot.module.common.api.dto.DutyPersonDto","RYZB");//("RYZB","人员值班")
private String fileName;
private String sheetName;
private String classUrl;
private String type;
public static ExcelEnums getByKey(String type) {
for (ExcelEnums status : ExcelEnums.values())
{
if (status.getType().equals(type))
{
return status;
}
}
return null;
}
}
......@@ -152,6 +152,27 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
return model;
}
public LinkageUnitDto saveLinkageModel(LinkageUnitDto linkageUnitDto) {
// 1.保存行数据
String groupCode = this.getGroupCode();
Map<String, Object> map = Bean.BeantoMap(linkageUnitDto);
Long instanceId = dynamicFormInstanceService.commonSave(groupCode, map);
linkageUnitDto.setInstanceId(instanceId);
// 2.保存基本信息
linkageUnitDto.setUnitCode(getUnitCodeStr());
LinkageUnitDto model = createWithModel(linkageUnitDto);
// 3.保存照片信息
sourceFileServiceImpl.saveSourceFile(model.getSequenceNbr(), model.getImage());
// 3.返回保存后的数据
return model;
}
@Override
public LinkageUnitDto queryOne(Long sequenceNbr) {
String groupCode = getGroupCode();
......@@ -290,4 +311,9 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
return menuList;
}
@Override
public List<LinkageUnitDto> exportToExcel() {
return linkageUnitMapper.exportToExcel();
}
}
\ No newline at end of file
......@@ -6,21 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.common.api.dto.CompanyPerson;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.ESOrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.FormValue;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonExcelDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
......@@ -974,7 +960,17 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
});
return lidataDtos;
}
@Override
public List<Map<String, Object>> getparent() {
return orgUsrMapper.getparent();
}
@Override
public List<OrgUsrExcelDto> exportToExcel() {
return orgUsrMapper.exportToExcel();
}
public List<OrgUsr> getCompanyDetailTree() {
LambdaQueryWrapper<OrgUsr> wrapper= new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getBizOrgType, "COMPANY");
......
......@@ -2,16 +2,12 @@ package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelDto;
import com.yeejoin.amos.boot.module.jcs.api.enums.ExcelEnums;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.ExcelServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -34,25 +30,15 @@ public class ExcelController extends BaseController {
private static final String NOT_DUTY = "休班";
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载模板")
@GetMapping("/template")
public void template(HttpServletResponse response, ExcelDto excelDto) {
try {
excelService.templateExport(response, excelDto);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "下载模板")
@GetMapping("/download/template")
public void downloadTemplate(HttpServletResponse response, @RequestParam(required = false) String fileName,
@RequestParam(required = false) String sheetName, @RequestParam String classUrl) {
@GetMapping("/download/template/{type}")
public void downloadTemplate(HttpServletResponse response, @PathVariable(value = "type") String type) {
try {
ExcelDto excelDto = new ExcelDto(fileName, sheetName, classUrl, toString());
ExcelEnums excelEnums= ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
excelService.templateExport(response, excelDto);
} catch (Exception e) {
e.printStackTrace();
......@@ -62,9 +48,11 @@ public class ExcelController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出公用类")
@GetMapping("/export")
public void getFireStationFile(HttpServletResponse response, ExcelDto excelDto) {
@GetMapping("/export/{type}")
public void getFireStationFile(HttpServletResponse response, @PathVariable(value = "type") String type) {
try {
ExcelEnums excelEnums= ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
excelService.commonExport(response, excelDto);
} catch (Exception e) {
e.printStackTrace();
......@@ -72,24 +60,15 @@ public class ExcelController extends BaseController {
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导出公用类2")
@GetMapping("/export/list")
public void exportByType(HttpServletResponse response, @RequestParam(required = false) String fileName,
@RequestParam(required = false) String sheetName, @RequestParam String type) {
try {
excelService.commonExport(response, new ExcelDto(fileName, sheetName, type));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "上传文件数据-")
@PostMapping("/upload")
public void upload(@RequestPart("file") MultipartFile multipartFile, ExcelDto excelDto) {
@ApiOperation(value = "导入公用")
@PostMapping("/upload/{type}")
public void upload(@RequestPart("file") MultipartFile multipartFile, @PathVariable(value = "type") String type) {
try {
ExcelEnums excelEnums= ExcelEnums.getByKey(type);
ExcelDto excelDto = new ExcelDto(excelEnums.getFileName(), excelEnums.getSheetName(), excelEnums.getClassUrl(), excelEnums.getType());
excelService.commonUpload(multipartFile, excelDto);
} catch (Exception e) {
e.printStackTrace();
......@@ -97,21 +76,36 @@ public class ExcelController extends BaseController {
}
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "上传文件数据-2")
@PostMapping("/upload2")
public void upload2(@RequestPart("file") MultipartFile multipartFile,
@RequestParam(required = false) String fileName,
@RequestParam(required = false) String sheetName,
@RequestParam String type) {
try {
excelService.commonUpload(multipartFile, new ExcelDto(fileName, sheetName, type));
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
}
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "上传文件数据-2")
// @PostMapping("/upload2")
// public void upload2(@RequestPart("file") MultipartFile multipartFile,
// @RequestParam(required = false) String fileName,
// @RequestParam(required = false) String sheetName,
// @RequestParam String type) {
// try {
// excelService.commonUpload(multipartFile, new ExcelDto(fileName, sheetName, type));
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("系统异常!");
// }
// }
// @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "导出公用类2")
// @GetMapping("/export/list")
// public void exportByType(HttpServletResponse response, @RequestParam(required = false) String fileName,
// @RequestParam(required = false) String sheetName, @RequestParam String type) {
// try {
// excelService.commonExport(response, new ExcelDto(fileName, sheetName, type));
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("系统异常!");
// }
// }
/**
* 导出值班模板
*
......
......@@ -127,6 +127,12 @@ public class DataSourcesImpl implements DataSources {
case "getCompanyDetailTree":
str =getCompanyDetailTree();
break;
case "getparent":
str =getparent();
break;
}
}
return str;
......@@ -273,4 +279,19 @@ public class DataSourcesImpl implements DataSources {
String[] str = stringList.toArray(new String[stringList.size()]);
return str;
}
private String[] getparent() throws Exception {
String[] str=null;
List<Map<String ,Object>> orgUsrTree = orgUsrService.getparent();
if(orgUsrTree!=null&&orgUsrTree.size()>0){
List<String> buildingNames = orgUsrTree.stream().map(item -> {
return item.get("name") + "@" + item.get("id");
}).collect(Collectors.toList());
str = buildingNames.toArray(new String[buildingNames.size()]);
}
return str;
}
}
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