From 80911312d9c3981341b518d833ccffd148dad678 Mon Sep 17 00:00:00 2001
From: hdw <496960745@qq.com>
Date: 星期四, 01 十一月 2018 15:29:44 +0800
Subject: [PATCH] 落后单体查询bug
---
gx_tieta/src/com/fgkj/actions/Deverror_recordAction.java | 66 +++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/gx_tieta/src/com/fgkj/actions/Deverror_recordAction.java b/gx_tieta/src/com/fgkj/actions/Deverror_recordAction.java
index 5b7b313..d4aaaf0 100644
--- a/gx_tieta/src/com/fgkj/actions/Deverror_recordAction.java
+++ b/gx_tieta/src/com/fgkj/actions/Deverror_recordAction.java
@@ -1,6 +1,14 @@
package com.fgkj.actions;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.sql.Blob;
+import java.sql.SQLException;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import com.fgkj.dto.BattInf;
import com.fgkj.dto.Deverror_record;
@@ -12,11 +20,33 @@
private Deverror_recordService service=new Deverror_recordService();
private String json;
private String result;
+ private List<File> file;
//鐢ㄦ埛鎵嬪姩娣诲姞闂
public String add(){
Deverror_record dev_record=getGson("yyyy-MM-dd").fromJson(json, Deverror_record.class);
User_inf uinf=(User_inf) getUser();
dev_record.setUid(uinf.getUId());
+ if(file.size()>0&&file!=null){
+ for (int i=0;i<file.size();i++) {
+ switch (i) {
+ case 0:
+ dev_record.setPicture_one(file.get(i));
+ break;
+ case 1:
+ dev_record.setPicture_two(file.get(i));
+ break;
+ case 2:
+ dev_record.setPicture_three(file.get(i));
+ break;
+ case 3:
+ dev_record.setPicture_four(file.get(i));
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ dev_record.setPicture_num(file.size());
ServiceModel model=service.add(dev_record);
result=tojson(model);
return SUCCESS;
@@ -30,6 +60,36 @@
result=tojson(model);
return SUCCESS;
}
+ //鏍规嵁num鍜屽垪鍚嶆煡璇㈠浘鐗�(note鏀惧垪鍚嶅瓧)
+ public void serchByInfo(){
+ InputStream is = null;
+ OutputStream os =null;
+ Deverror_record dev_record=getGson("yyyy-MM-dd").fromJson(json, Deverror_record.class);
+ ServiceModel model=service.serchByInfo(dev_record);
+ if(model.code == 1){
+ List list = (List) model.getData();
+ Blob blob = (Blob) list.get(0);
+ try {
+ is = blob.getBinaryStream();
+ os = ActionUtil.getResponse().getOutputStream();
+ byte[] image = IStoByteArr(is);
+ os.write(image);
+ os.flush();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally{
+ if(os != null){
+ try {
+ os.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+ }
public String getResult() {
return result;
@@ -37,6 +97,12 @@
public void setJson(String json) {
this.json = json;
}
+ public List<File> getFile() {
+ return file;
+ }
+ public void setFile(List<File> file) {
+ this.file = file;
+ }
}
--
Gitblit v1.9.1