Commit f31ca8a6 authored by tangwei's avatar tangwei

word 转化,到场力量,重点单位 ,飞机参数

parent 76b1019f
package com.yeejoin.amos.boot.biz.common.utils;
import org.springframework.web.multipart.MultipartFile;
/***
*
*文件类
*
* **/
public interface FileService {
String uploadFile(MultipartFile file,String product,String appKey,String token );
}
package com.yeejoin.amos.boot.biz.common.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
import org.apache.poi.xwpf.converter.core.FileImageExtractor;
import org.apache.poi.xwpf.converter.core.FileURIResolver;
import org.apache.poi.xwpf.converter.pdf.PdfConverter;
import org.apache.poi.xwpf.converter.pdf.PdfOptions;
import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
import org.apache.poi.xwpf.converter.xhtml.XHTMLOptions;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
/**
* 文档转换工具
*/
public class WordConverterUtils {
public static MultipartFile fileToMultipartFile(File file) {
FileItem fileItem = createFileItem(file);
MultipartFile multipartFile = new CommonsMultipartFile(fileItem);
return multipartFile;
}
private static FileItem createFileItem(File file) {
FileItemFactory factory = new DiskFileItemFactory(16, null);
FileItem item = factory.createItem("textField", "text/plain", true, file.getName());
int bytesRead = 0;
byte[] buffer = new byte[8192];
try {
FileInputStream fis = new FileInputStream(file);
OutputStream os = item.getOutputStream();
while ((bytesRead = fis.read(buffer, 0, 8192)) != -1) {
os.write(buffer, 0, bytesRead);
}
os.close();
fis.close();
} catch (IOException e) {
e.printStackTrace();
}
return item;
}
/**
* word文档转html文档
*
* @param srcFile 原文档
* @param targetFile 目标文档
* @param fileService 图片上传接口
*/
public static void wordToHtml(String srcFile, String targetFile, String imagePathStr,String readUrl,FileService fileService,String product,String appKey,String token ) {
//File doc = new File(srcFile);
File html = new File(targetFile);
if ( html.exists()) {
return;
} else {
if (srcFile.endsWith(".doc")) {
docToHtml( imagePathStr,readUrl,srcFile, html, fileService, product, appKey, token);
}
// else if (srcFile.endsWith(".docx")) {
// docxToHtml( imagePathStr,readUrl,srcFile, html, fileService, product, appKey, token);
// }
}
}
/**
* .doc文档转换成html
*
* @param srcFile 原文档
* @param targetFile 目标文档
* @param fileService 图片上传接口
*/
private static void docToHtml( String imagePathStr,String readUrl,String srcFile, File targetFile, FileService fileService,String product,String appKey,String token ) {
try {
File imagePath = new File(imagePathStr);
if (!imagePath.exists()) {
imagePath.mkdirs();
}
URL url = new URL(srcFile);
//链接url
URLConnection uc = url.openConnection();
//获取输入流
InputStream in = uc.getInputStream();
HWPFDocument wordDocument = new HWPFDocument(in);
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
WordToHtmlConverter wordToHtmlConverter = new WordToHtmlConverter(document);
wordToHtmlConverter.setPicturesManager((content, pictureType, name, width, height) -> {
try {
FileOutputStream out = new FileOutputStream(imagePathStr + name);
out.write(content);
String urlString= fileService.uploadFile(fileToMultipartFile(new File(imagePathStr + name)), product, appKey, token );
//上传平台
return readUrl+urlString;
} catch (Exception e) {
e.printStackTrace();
return "";
}
});
wordToHtmlConverter.processDocument(wordDocument);
org.w3c.dom.Document htmlDocument = wordToHtmlConverter.getDocument();
DOMSource domSource = new DOMSource(htmlDocument);
StreamResult streamResult = new StreamResult(targetFile);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer serializer = tf.newTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
serializer.setOutputProperty(OutputKeys.METHOD, "html");
serializer.transform(domSource, streamResult);
} catch (Exception e) {
e.printStackTrace();
}
}
// /**
// * .docx文档转换成html
// *
// * @param srcFile 原文档
// * @param targetFile 目标文档
// * @param fileService 图片上传接口
// */
// private static void docxToHtml( String imagePathStr,String readUrl,String srcFile, File targetFile, FileService fileService,String product,String appKey,String token) {
//
// File imagePath = new File(imagePathStr);
// if (!imagePath.exists()) {
// imagePath.mkdirs();
// }
// OutputStream outputStreamWriter=null;
// try {
//
// URL url = new URL(srcFile);
// //链接url
// URLConnection uc = url.openConnection();
// //获取输入流
// InputStream in = uc.getInputStream();
// XWPFDocument document = new XWPFDocument(in);
// //存储图片
// PdfOptions options=PdfOptions.create();
//
// outputStreamWriter=new FileOutputStream(targetFile);
// PdfConverter.getInstance().convert(document,outputStreamWriter,options);
//
//
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// try {
// if (outputStreamWriter != null) {
// outputStreamWriter.close();
// }
// } catch (Exception e2) {
// e2.printStackTrace();
// }
//
// }
//
// }
}
......@@ -84,7 +84,7 @@ public class Swagger2Config {
private List<Parameter> setHeaderToken() {
List<Parameter> pars = new ArrayList<>();
ParameterBuilder tokenPar = new ParameterBuilder();
tokenPar.name(CommonConstant.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
tokenPar.name("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
ParameterBuilder appKey = new ParameterBuilder();
appKey.name("appKey").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
ParameterBuilder product = new ParameterBuilder();
......
package com.yeejoin.amos.boot.module.common.api.dto;
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 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
@ApiModel(value="OrgUsrzhDto", description="机构/部门/人员表")
public class OrgUsrzhDto {
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
@ApiModelProperty(value = "归属机构")
private String parentName;
@ApiModelProperty(value = "经营类别")
private String businessCategory;
@ApiModelProperty(value = "女员工人数")
private String companyFemaleEmployees;
@ApiModelProperty(value = "单位地址")
private String companyLocation;
@ApiModelProperty(value = "男员工人数")
private String companyMaleEmployees;
@ApiModelProperty(value = "单位性质")
private String companyNature;
@ApiModelProperty(value = "单位电话")
private String companyPhone;
@ApiModelProperty(value = "单位照片")
private String companyPhoto;
@ApiModelProperty(value = "管理类别")
private String managementType;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @description:
* @author: tw
* @createDate: 2021/7/26
*/
@Data
@ApiModel(value="OrgusrDataxDto", description="处置对象单位信息")
public class OrgusrDataxDto {
@ApiModelProperty(value = "单位基本信息")
private OrgUsrzhDto OrgUsrzhDto;
@ApiModelProperty(value = "现场图片")
private List<String> scenePicture;
@ApiModelProperty(value = "平面图")
private List<String> planePicture;
}
......@@ -52,5 +52,5 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
Integer listContractDtoCount(@Param("par")RequestData par);
OrgUsrzhDto getOrgUsrzhDto(@Param("id")Long id);
}
......@@ -158,5 +158,14 @@ public interface IOrgUsrService {
*/
Integer listContractDtoCount(RequestData par);
/**
* * @param null
* @return
* <PRE>
* author tw
* date 2021/7/26
* </PRE>
*/
OrgUsrzhDto getOrgUsrzhDto(Long id);
}
......@@ -241,6 +241,25 @@
</if>
</select>
<select id="getOrgUsrzhDto" resultType="com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto">
SELECT
a.biz_org_name bizOrgName,
a.build_name buildName,
a.build_id buildId,
( SELECT v.biz_org_name FROM cb_org_usr v WHERE v.sequence_nbr = a.parent_id ) parentName,
max( CASE b.field_code WHEN 'businessCategory' THEN b.field_value_label ELSE "" END ) AS 'businessCategory',
max( CASE b.field_code WHEN 'companyFemaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyFemaleEmployees',
max( CASE b.field_code WHEN 'companyLocation' THEN b.field_value ELSE "" END ) AS 'companyLocation',
max( CASE b.field_code WHEN 'companyMaleEmployees' THEN b.field_value ELSE "" END ) AS 'companyMaleEmployees',
max( CASE b.field_code WHEN 'companyNature' THEN b.field_value_label ELSE "" END ) AS 'companyNature',
max( CASE b.field_code WHEN 'companyPhone' THEN b.field_value ELSE "" END ) AS 'companyPhone',
max( CASE b.field_code WHEN 'companyPhoto' THEN b.field_value ELSE "" END ) AS 'companyPhoto',
max( CASE b.field_code WHEN 'managementType' THEN b.field_value_label ELSE "" END ) AS 'managementType'
FROM
cb_org_usr a
LEFT JOIN cb_dynamic_form_instance b ON a.sequence_nbr = b.instance_id
WHERE
a.sequence_nbr = #{id}
</select>
</mapper>
......@@ -11,6 +11,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 航空器信息
*
......@@ -167,4 +169,11 @@ public class AircraftDto extends BaseDto {
@ApiModelProperty(value = "三维模型")
private String models;
@ApiModelProperty(value = "现场图片")
private List<String> scenePicture;
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
/**
* 航空器信息接口类
*
......@@ -8,5 +10,5 @@ package com.yeejoin.amos.boot.module.jcs.api.service;
* @date 2021-06-29
*/
public interface IAircraftService {
AircraftDto queryByAircraftSeq(String agencyCode, Long seq);
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import java.util.List;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
/**
* 服务类
*
......@@ -7,5 +11,5 @@ package com.yeejoin.amos.boot.module.jcs.api.service;
* @date 2021-06-17
*/
public interface IAlertFormValueService {
List<AlertFormValue> getzqlist(Long id);
}
......@@ -26,7 +26,7 @@
a.call_time callTime,
a.rescue_grid rescueGrid,
a.alert_type alertType,
a.alarm_type_code alarmTypeCode,
a.alert_type_code alarmTypeCode,
a.unit_involved unitInvolved,
a.trapped_num trappedNum,
a.casualties_num casualtiesNum,
......
package com.yeejoin.amos.boot.module.command.biz.controller;
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.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.WordConverterUtils;
import com.yeejoin.amos.boot.module.command.api.dao.SeismometeorologyDtoDao;
import com.yeejoin.amos.boot.module.command.api.dto.SeismometeorologyDto;
import com.yeejoin.amos.boot.module.command.biz.service.impl.RemoteSecurityService;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.service.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.AircraftDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.StateDot;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.service.IAircraftService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFormValueService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
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.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* *指挥资源Api
......@@ -71,9 +90,27 @@ public class CommandController extends BaseController {
@Autowired
IFirefightersService firefightersService;
@Autowired
private IAircraftService aircraftService;
@Autowired
IPowerTransferService powerTransferService;
@Autowired
RemoteSecurityService remoteSecurityService;
@Autowired
IAlertFormValueService alertFormValueService;
// 文件读取参数
@Value("${file.url}")
private String readUrl;
/**
* 图片存储相对文档路径
*/
@Value("${file.imagePathStr}")
private String imagePathStr;
//本地临时文件夹
@Value("${file.htmlPath}")
private String htmlPath;
/**
* 警情列表
*
......@@ -553,4 +590,94 @@ public class CommandController extends BaseController {
return ResponseHelper.buildResponse(powerTransferService.getPowerCompanyCountDtocount(id));
}
/**
*
*
* @return
*/
@TycloudOperation( needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/lookHtmlText", produces = "application/json;charset=UTF-8")
@ApiOperation(value = "查看文件内容", notes = "查看文件内容")
public ResponseModel<Object> lookHtmlText( HttpServletResponse response,@RequestParam(value = "fileUrl")String fileUrl ,@RequestParam(value = "product")String product,@RequestParam(value = "appKey")String appKey,@RequestParam(value = "token")String token /* @PathVariable String fileName */)
throws Exception {
String fileName =readUrl+fileUrl; //目标文件
if (fileName.endsWith(".doc") || fileName.endsWith(".docx")) {
String htmlFileName = htmlPath + UUID.randomUUID().toString().replaceAll("-", "")+".html";
File htmlFile = new File(htmlFileName);
WordConverterUtils.wordToHtml(fileName, htmlFileName, imagePathStr,readUrl, remoteSecurityService,product, appKey, token);
FileInputStream fis = new FileInputStream(htmlFile);
response.setContentType("multipart/form-data");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
// 2.设置文件头:最后一个参数是设置下载文件名
ServletOutputStream out;
// 3.通过response获取ServletOutputStream对象(out)
out = response.getOutputStream();
int b = 0;
byte[] buffer = new byte[1024];
while ((b = fis.read(buffer)) != -1) {
// 4.写到输出流(out)中
out.write(buffer, 0, b);
}
fis.close();
out.flush();
out.close();
return ResponseHelper.buildResponse("");
} else {
return null;
}
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "根据灾情查询单个航空器信息", notes = "根据灾情查询单个航空器信息")
public ResponseModel<AircraftDto> seleteaircraftOne(@PathVariable Long sequenceNbr) {
// 警情动态表单数据
List<AlertFormValue> list = alertFormValueService.getzqlist(sequenceNbr);
for (AlertFormValue alertFormValue : list) {
if("aircraftModel".equals(alertFormValue.getFieldCode())) {
String aircraftModel=alertFormValue.getFieldValueCode();
if(aircraftModel!=null&&!"".equals(aircraftModel)) {
AircraftDto aircraftDto=aircraftService.queryByAircraftSeq(RequestContext.getAgencyCode(),Long.valueOf(aircraftModel));
//现场照片 待完成,
return ResponseHelper.buildResponse(aircraftDto);
}
}
}
return ResponseHelper.buildResponse(null);
}
@TycloudOperation( needAuth = false, ApiLevel = UserType.AGENCY)
@GetMapping(value = "getOrgUsrzhDto/{id}")
@ApiOperation(httpMethod = "GET", value = "处置对象单位详情", notes = "处置对象单位详情")
public ResponseModel<OrgusrDataxDto> getOrgUsrzhDto(@PathVariable Long id) {
OrgusrDataxDto orgusrDataxDto=new OrgusrDataxDto();
OrgUsrzhDto orgUsrzhDto= iOrgUsrService.getOrgUsrzhDto(id);
orgusrDataxDto.setOrgUsrzhDto(orgUsrzhDto);
//现场照片 待完成,
//平面图。待完成
return ResponseHelper.buildResponse(orgusrDataxDto);
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.command.biz.service.impl;
import com.yeejoin.amos.boot.biz.common.utils.FileService;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import org.bouncycastle.jcajce.provider.asymmetric.ec.SignatureSpi.ecCVCDSA;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/***
*
* 平台安全接口实现类
*
* ***/
@Service("remoteSecurityService")
public class RemoteSecurityService implements FileService{
@Override
public String uploadFile(MultipartFile file,String product,String appKey,String token ) {
try {
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
RequestContext.setToken(token);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString="";
if (date != null) {
Map<String, String> map = date.getResult();
Iterator<String> it = map.keySet().iterator();
while (it.hasNext()) {
urlString=it.next();
}
}
return urlString;
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException();
}
}
}
......@@ -916,4 +916,10 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
public OrgUsrDto queryForListByParentIdAndOrgType( String amosOrgId) {
return this.queryModelByParams( amosOrgId );
}
@Override
public OrgUsrzhDto getOrgUsrzhDto(Long id) {
// TODO Auto-generated method stub
return orgUsrMapper.getOrgUsrzhDto(id);
}
}
......@@ -87,6 +87,7 @@ public class AircraftServiceImpl extends BaseService<AircraftDto, Aircraft, Airc
* @param seq
* @return
*/
@Override
public AircraftDto queryByAircraftSeq(String agencyCode, Long seq) {
AircraftDto aircraftDto = this.queryBySeq(seq);
//填充航空器附件信息
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertFormValueDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertForm;
......@@ -52,4 +53,13 @@ public class AlertFormValueServiceImpl extends BaseService<AlertFormValueDto,Al
List<String> fieldCodes = Lists.transform(columns, AlertForm::getFieldCode);
return this.baseMapper.listAll(fieldCodes, groupCode, queryParams);
}
@Override
public List<AlertFormValue> getzqlist(Long id) {
//根据灾情获取航空器
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
return this.list(queryWrapper);
}
}
//package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
//
//import java.util.ArrayList;
//import java.util.Collection;
//import java.util.List;
//import java.util.Map;
//import java.util.Set;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.util.StringUtils;
//import org.springframework.web.multipart.MultipartFile;
//import org.typroject.tyboot.core.foundation.context.RequestContext;
//import org.typroject.tyboot.core.restful.utils.ResponseHelper;
//import org.typroject.tyboot.core.restful.utils.ResponseModel;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.yeejoin.amos.component.feign.config.InnerInvokException;
//import com.yeejoin.amos.component.feign.model.FeignClientResult;
//import com.yeejoin.amos.component.feign.utils.FeignUtil;
//import com.yeejoin.amos.feign.privilege.Privilege;
//import com.yeejoin.amos.feign.privilege.client.AgencyUserClient;
//import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
//import com.yeejoin.amos.feign.privilege.model.CompanyModel;
//import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
//import com.yeejoin.amos.feign.privilege.model.PermissionModel;
//import com.yeejoin.amos.feign.systemctl.Systemctl;
//import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
//
///***
// *
// * 平台安全接口实现类
// *
// * ***/
//@Service("remoteSecurityService")
//public class RemoteSecurityService {
//
//
// @Autowired
// private HttpServletRequest request;
//
// // * 根据公司id查询机构用户
//
//// public List<AgencyUserModel> listUserByCompanyId(String companyId) {
//// if (StringUtils.isEmpty(companyId)) {
//// return null;
//// }
//// List<AgencyUserModel> AgencyUserModel = null;
//// FeignClientResult feignClientResult;
//// try {
//// feignClientResult = Privilege.agencyUserClient.queryByCompanyId(Long.valueOf(companyId), null);
//// AgencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult();
////
//// } catch (InnerInvokException e) {
//// e.printStackTrace();
//// throw new RuntimeException();
//// }
//// return AgencyUserModel;
//// }
//
// /**
// * 用户id批量获取用户信息
// *
// * @param userIds 用户ids
// * @return List<AgencyUserModel>
// */
//// public List<AgencyUserModel> listUserByUserIds(String userIds) {
//// List<AgencyUserModel> agencyUserModel = null;
//// FeignClientResult feignClientResult;
//// try {
//// feignClientResult = Privilege.agencyUserClient.queryByIds(userIds);
//// agencyUserModel = (List<AgencyUserModel>) feignClientResult.getResult();
////
//// } catch (InnerInvokException e) {
//// e.printStackTrace();
//// throw new RuntimeException();
//// }
//// return agencyUserModel;
//// }
//
// /**
// * 用户id获取用户信息
// *
// * @param userId 用户编号
// * @return AgencyUserModel
// */
// public AgencyUserModel getUserById(String userId) {
// if (StringUtils.isEmpty(userId)) {
// return null;
// }
// AgencyUserModel agencyUserModel;
// try {
// agencyUserModel = FeignUtil.remoteCall(() -> Privilege.agencyUserClient.queryByUserId(userId));
// } catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException();
// }
// return agencyUserModel;
// }
//
// // 根据orgCode查询机构用户
//// public List<AgencyUserModel> listUserByOrgCode(String orgCode) {
//// if (StringUtils.isEmpty(orgCode)) {
//// return null;
//// }
//// Set<AgencyUserModel> agencyUserModel;
//// try {
//// agencyUserModel = FeignUtil.remoteCall(() -> Privilege.agencyUserClient.queryByOrgCode(orgCode));
//// } catch (Exception e) {
//// e.printStackTrace();
//// throw new RuntimeException();
//// }
//// return new ArrayList<>(agencyUserModel);
//// }
//
// // 根据部门id查询机构用户
//// public List<AgencyUserModel> listUserByDepartmentId(Long departmentId) {
//// if (departmentId == null) {
//// return null;
//// }
//// List<AgencyUserModel> agencyUserModel;
//// try {
//// agencyUserModel = FeignUtil.remoteCall() -> Privilege.agencyUserClient.queryByDepartmentId(departmentId, null));
//// } catch (Exception e) {
//// e.printStackTrace();
//// throw new RuntimeException();
//// }
//// return agencyUserModel;
//// }
//
// // 根据orgCode查询机构
// public Map<String, Object> listByOrgCode(String orgCode) {
// if (StringUtils.isEmpty(orgCode)) {
// return null;
// }
// Map<String, Object> agencyUserModel = null;
// FeignClientResult feignClientResult;
// try {
// feignClientResult = Privilege.companyClient.queryByOrgcode(orgCode);
// agencyUserModel = (Map<String, Object>) feignClientResult.getResult();
// } catch (InnerInvokException e) {
// e.printStackTrace();
// throw new RuntimeException();
// }
// return agencyUserModel;
// }
//
// // 查询指定公司的部门树
// public List<DepartmentModel> getDepartmentTreeByCompanyId(Long companyId) {
// if (companyId == null) {
// return null;
// }
// List<DepartmentModel> departmentModel = null;
// FeignClientResult feignClientResult;
// try {
// feignClientResult = Privilege.departmentClient.queryDeptTree(null, companyId);
// departmentModel = (List<DepartmentModel>) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// e.printStackTrace();
// throw new RuntimeException();
// }
// return departmentModel;
//
// }
//
//
// /**
// * 基础平台全部菜单权限树,用于平台登录前端初始化路由
// */
// public ResponseModel<Object> searchPermissionTree(long id, String appType) {
// List<PermissionModel> dictionarieModel = null;
// FeignClientResult<Collection<PermissionModel>> feignClientResult;
// try {
// feignClientResult = Privilege.permissionClient.treeByRole(id, appType, null, null);
// dictionarieModel = (List<PermissionModel>) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// throw new RuntimeException();
// }
// ResponseModel<Object> commonResponse = ResponseHelper.buildResponse( dictionarieModel);
// return commonResponse;
// }
//
// /**
// * 根据Code查询指定的字典信息
// *
// * @param dictCode 字典编号
// * @return List<DictionarieValueModel>
// */
// public List<DictionarieValueModel> listDictionaryByDictCode(String dictCode) {
// List<DictionarieValueModel> dictionarieModel = null;
// FeignClientResult<List<DictionarieValueModel>> feignClientResult;
// try {
// feignClientResult = Systemctl.dictionarieClient.dictValues(dictCode);
// dictionarieModel = (List<DictionarieValueModel>) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// throw new RuntimeException();
// }
//
// return dictionarieModel;
// }
//
// /**
// * 查询指定公司信息与其部门用户树
// */
// public CompanyModel listUserByCompanyId1(Long companyId) {
// if (companyId == null) {
// return null;
// }
// CompanyModel companyModel = null;
// FeignClientResult feignClientResult;
// try {
// feignClientResult = Privilege.companyClient.withDeptAndUsers(companyId);
// companyModel = (CompanyModel) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// throw new RuntimeException();
// }
// return companyModel;
//
// }
//
//
//
//
//
// public JSONArray listDepartmentUserTree(Long companyId) {
//
// CompanyModel companyModel = null;
// FeignClientResult feignClientResult;
// try {
// feignClientResult = Privilege.companyClient.withDeptAndUsers(companyId);
// companyModel = (CompanyModel) feignClientResult.getResult();
//
// } catch (InnerInvokException e) {
// e.printStackTrace();
// throw new RuntimeException();
// }
//
// if (companyModel != null) {
// String jsonStr = null;
//
// jsonStr = JSON.toJSONString(companyModel.getChildren());
//
// return JSONArray.parseArray(jsonStr);
// }
// return null;
//
// }
//
// public boolean editPassword(String userId, String oldPassword, String newPassword) throws InnerInvokException {
// boolean flag = false;
// AgencyUserModel agencyUserModel = new AgencyUserModel();
// agencyUserModel.setPassword(newPassword);
// agencyUserModel.setRePassword(newPassword);
// agencyUserModel.setOriginalPassword(oldPassword);
// AgencyUserModel agencyUserModel2 = null;
// FeignClientResult feignClientResult;
// feignClientResult = Privilege.agencyUserClient.modifyPassword(userId, agencyUserModel);
// agencyUserModel = (AgencyUserModel) feignClientResult.getResult();
// if (agencyUserModel2 != null) {
// flag = true;
// }
// return false;
// }
//
// public FeignClientResult<Map<String, String>> fileImage(MultipartFile file) {
// String product = request.getHeader("product");
// String appKey = request.getHeader("appKey");
// try {
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
//
// return date;
// } catch (InnerInvokException e) {
// e.printStackTrace();
// throw new RuntimeException();
// }
//
// }
//
// public FeignClientResult<Map<String, String>> fileImage(MultipartFile[] files) {
//
// try {
// FeignClientResult<java.util.Map<String, String>> date = Systemctl.fileStorageClient
// .updateCommonFiles(files);
//
// return date;
// } catch (InnerInvokException e) {
// e.printStackTrace();
// throw new RuntimeException();
// }
//
// }
//
// public AgencyUserModel getAgencyUser() {
// FeignClientResult<AgencyUserModel> agencyUser = null;
// AgencyUserModel userModel = null;
// try {
// AgencyUserClient agencyUserClient = Privilege.agencyUserClient;
// agencyUser = agencyUserClient.getme();
// userModel = agencyUser.getResult();
// } catch (InnerInvokException e) {
// throw new RuntimeException(e.getMessage());
// }
// return userModel;
// }
//}
......@@ -79,6 +79,72 @@
<version>2.4</version>
<scope>compile</scope>
</dependency>
<!--集成apache poi word 转html -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.17</version>
<exclusions>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
<exclusions>
<exclusion>
<artifactId>poi</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
<exclusion>
<artifactId>poi-ooxml-schemas</artifactId>
<groupId>org.apache.poi</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.opensagres.xdocreport</groupId>
<artifactId>xdocreport</artifactId>
<version>1.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
<exclusions>
<exclusion>
<artifactId>xmlbeans</artifactId>
<groupId>org.apache.xmlbeans</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
......
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