更新app文件下载和GPS查询接口信息

This commit is contained in:
tangfutang 2020-06-28 10:28:53 +08:00
parent 176499463b
commit 8e24fe508a
4 changed files with 77 additions and 2 deletions

View File

@ -293,6 +293,7 @@ public class FlowDataServiceImpl implements FlowDataService{
body.put("CONTACT_PHONE", "");//现场联系人电话
body.put("INSTALL_TIME", "");//上门时间
body.put("ADDRESS_CODE", "");//上门地址最新国标编码
body.put("ADDRESS_CODE_SHOW", "");//上门地址名称
body.put("ADDRESS_DETAIL", "");//详细地址
body.put("WIRED_NUM", "1");//有线设备数量
body.put("WIRELESS_NUM", "1");//无线设备数量
@ -309,6 +310,7 @@ public class FlowDataServiceImpl implements FlowDataService{
body.put("CONTACT_PHONE", lgt.getAttribute("CONTACT_PHONE").toString());//现场联系人电话
body.put("INSTALL_TIME", lgt.getAttribute("INSTALL_TIME").toString());//上门时间
body.put("ADDRESS_CODE", lgt.getAttribute("ADDRESS_CODE").toString());//上门地址最新国标编码
body.put("ADDRESS_CODE_SHOW", NameManager.getItemName("AreaCode",lgt.getAttribute("ADDRESS_CODE").toString()));//上门地址名称
body.put("ADDRESS_DETAIL", lgt.getAttribute("ADDRESS_DETAIL").toString());//详细地址
body.put("WIRED_NUM", lgt.getAttribute("WIRED_NUM").toString());//有线设备数量
body.put("WIRELESS_NUM", lgt.getAttribute("WIRELESS_NUM").toString());//无线设备数量

View File

@ -41,12 +41,14 @@ public class DocManageService {
: lbDocMap.get("FILENAME".toLowerCase()).toString();
String sFilePath = lbDocMap.get("FILEPATH".toLowerCase()) == null ? ""
: lbDocMap.get("FILEPATH".toLowerCase()).toString();
String fullpath = lbDocMap.get("fullpath".toLowerCase()) == null ? ""
: lbDocMap.get("fullpath".toLowerCase()).toString();
String sFileSize = lbDocMap.get("CONTENTLENGTH".toLowerCase()) == null ? ""
: lbDocMap.get("CONTENTLENGTH".toLowerCase()).toString();
try {
DownloadAttUtil.downloadAtt(sFileName, sFilePath, sFileSize,
response, request, sDevType);
response, request, sDevType,fullpath);
} catch (Exception e) {
String contextPath = request.getContextPath();
response.setHeader("Refresh", "1;url=" + contextPath

View File

@ -182,4 +182,71 @@ public class DownloadAttUtil {
sCharset = "UTF-8";
response.setContentType("text/html; charset=" + sCharset);
}
/**
* 描述下载附件设置response
*
* @param fileName
* @param path
* @param fullpath
* @param fileSize
* @param response
* @param request
* @throws Exception
*/
public static void downloadAtt(String sFileName, String sPath,
String sFileSize, HttpServletResponse response,
HttpServletRequest request, String sDevType,String fullpath) throws Exception {
if ("ios".equals(sDevType))
sFileName = new String(sFileName.getBytes(), "ISO-8859-1");
else
sFileName = new String(sFileName.getBytes(), "ISO-8859-1");
response.reset();
response.setHeader("Content-disposition", "attachment; filename="
+ sFileName);
response.setContentType("application/octet-stream");// 指明response的返回对象是文件流
HttpSession session;
Configure CurConfig;
session = request.getSession(true);
if ((session == null) || (session.getAttributeNames() == null)) {
ARE.getLog().error("读取配置文件错误!请检查配置文件。");
throw new Exception("------Timeout------");
}
CurConfig = Configure.getInstance(session.getServletContext());
if (CurConfig == null) {
ARE.getLog().error("读取配置文件错误!请检查配置文件。");
throw new ServletException("读取配置文件错误!请检查配置文件。");
}
File file = new File(fullpath);
if (!file.exists()) {
ARE.getLog().error("读取文件错误!请检查[文件。");
throw new ServletException("读取文件错误!请检查[文件。");
}
response.setContentLength((int) file.length());
FileInputStream fileInputStream = null;
BufferedInputStream bufferedInputStream = null;
OutputStream outputStream = null;
try {
// 读出文件到response
// 这里是先需要把要把文件内容先读到缓冲区
// 再把缓冲区的内容写到response的输出流供用户下载
fileInputStream = new FileInputStream(file);
bufferedInputStream = new BufferedInputStream(
fileInputStream);
byte[] b = new byte[bufferedInputStream.available()];
bufferedInputStream.read(b);
outputStream = response.getOutputStream();
outputStream.write(b);
} catch (Exception e) {
ARE.getLog().error(e);
throw new Exception("输入流文件出现异常 " + e);
} finally {
// 人走带门
bufferedInputStream.close();
outputStream.flush();
outputStream.close();
fileInputStream.close();
}
}
}

View File

@ -182,7 +182,11 @@ public class DocListAction {
BizObjectManager bm=JBOFactory.getBizObjectManager(LB_DOCCONFIG.CLASS_NAME);
BizObject bo=bm.createQuery("id=:id").setParameter("id", this.configid).getSingleResult(true);
bo.setAttributeValue("DOC_RELATION_ID", this.relationid.replaceAll("@", ","));
if(this.relationid == null){
bo.setAttributeValue("DOC_RELATION_ID", "");
}else{
bo.setAttributeValue("DOC_RELATION_ID", this.relationid.replaceAll("@", ","));
}
bm.saveObject(bo);
return "操作成功!!";
}