Commit 3629cb7f authored by 王琮's avatar 王琮

修改接口所在文件

parent 94282bf9
...@@ -147,9 +147,9 @@ public class FileCtrl { ...@@ -147,9 +147,9 @@ public class FileCtrl {
fileName = file.getFileName(); fileName = file.getFileName();
String originPath = ""; String originPath = "";
if (fileNum.startsWith("http")) { if (fileNum.startsWith("http")) {
originPath = fileName; originPath = fileNum;
} else { } else {
originPath = this.getfileUrl() + fileName; originPath = this.getfileUrl() + fileNum;
} }
String targetPath = myPath + fileName; String targetPath = myPath + fileName;
...@@ -220,7 +220,7 @@ public class FileCtrl { ...@@ -220,7 +220,7 @@ public class FileCtrl {
map.put("fileName", myfile.getOriginalFilename()); map.put("fileName", myfile.getOriginalFilename());
map.put("fileID", uuid); map.put("fileID", uuid);
byte[] buffer = myfile.getBytes(); byte[] buffer = myfile.getBytes();
FileOutputStream fos = new FileOutputStream(this.getfileUrl() + myfile.getOriginalFilename()); FileOutputStream fos = new FileOutputStream(this.getfileUrl() + fileNum);
fos.write(buffer); fos.write(buffer);
fos.close(); fos.close();
File file = new File(); File file = new File();
......
...@@ -265,7 +265,7 @@ public class QuestionnaireCtrl { ...@@ -265,7 +265,7 @@ public class QuestionnaireCtrl {
if (!fileForExists.exists()) { if (!fileForExists.exists()) {
FileUtil.mkdirFolders(myPath); FileUtil.mkdirFolders(myPath);
} }
List<String> fileID = this.fileServer.selectFileId(optionId,recordId); List<String> fileID = this.questionnaireService.selectFileId(optionId,recordId);
for(int i=0;i<fileID.size();++i) { for(int i=0;i<fileID.size();++i) {
File file = this.fileServer.selectFileByFileID(fileID.get(i)); File file = this.fileServer.selectFileByFileID(fileID.get(i));
try { try {
......
...@@ -6,8 +6,6 @@ ...@@ -6,8 +6,6 @@
package com.tiptimes.dao; package com.tiptimes.dao;
import com.tiptimes.model.File; import com.tiptimes.model.File;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
public interface FileDao { public interface FileDao {
...@@ -18,7 +16,4 @@ public interface FileDao { ...@@ -18,7 +16,4 @@ public interface FileDao {
List<File> listFileByFileID(String var1); List<File> listFileByFileID(String var1);
List<String> listFileNameByFileID(String var1); List<String> listFileNameByFileID(String var1);
List<String> selectFileId(@Param("optionId") Long optionId,
@Param("recordId")Long recordId);
} }
...@@ -32,4 +32,7 @@ public interface QuestionnaireDao { ...@@ -32,4 +32,7 @@ public interface QuestionnaireDao {
Record selectById(Long recordId); Record selectById(Long recordId);
List<Record> selectRecordList(Record record); List<Record> selectRecordList(Record record);
List<String> selectFileId(@Param("optionId") Long optionId,
@Param("recordId")Long recordId);
} }
...@@ -2,16 +2,12 @@ package com.tiptimes.service; ...@@ -2,16 +2,12 @@ package com.tiptimes.service;
import com.tiptimes.model.File; import com.tiptimes.model.File;
import java.util.List;
public interface FileService { public interface FileService {
File selectFileByFileID(String paramString); File selectFileByFileID(String paramString);
void saveFile(File paramFile); void saveFile(File paramFile);
String updateFile(String paramString1, String paramString2); String updateFile(String paramString1, String paramString2);
//根据选项id查询文件对应id
List<String> selectFileId(Long optionId,Long recordId);
} }
......
...@@ -86,6 +86,9 @@ public interface QuestionnaireService { ...@@ -86,6 +86,9 @@ public interface QuestionnaireService {
* @return * @return
*/ */
List<Record> selectRecordList(Record record); List<Record> selectRecordList(Record record);
//根据选项id查询文件对应id
List<String> selectFileId(Long optionId,Long recordId);
} }
...@@ -45,14 +45,4 @@ public class FileServiceImpl implements FileService { ...@@ -45,14 +45,4 @@ public class FileServiceImpl implements FileService {
return ""; return "";
} }
/**
*
* @param optionId
* @return
*/
@Override
public List<String> selectFileId(Long optionId,Long recordId) {
return fileDao.selectFileId(optionId,recordId);
}
} }
...@@ -131,4 +131,9 @@ public class QuestionnaireServiceImpl implements QuestionnaireService { ...@@ -131,4 +131,9 @@ public class QuestionnaireServiceImpl implements QuestionnaireService {
public List<Record> selectRecordList(Record record) { public List<Record> selectRecordList(Record record) {
return questionnaireDao.selectRecordList(record); return questionnaireDao.selectRecordList(record);
} }
@Override
public List<String> selectFileId(Long optionId, Long recordId) {
return questionnaireDao.selectFileId(optionId,recordId);
}
} }
...@@ -156,6 +156,7 @@ public class FileUtil { ...@@ -156,6 +156,7 @@ public class FileUtil {
public static File copyFileByPath(String originPath, String targetPath, String targetPathForRepeat) throws IOException { public static File copyFileByPath(String originPath, String targetPath, String targetPathForRepeat) throws IOException {
File targetFile = new File(targetPath); File targetFile = new File(targetPath);
try { try {
BufferedInputStream input = null; BufferedInputStream input = null;
if (originPath.startsWith("http")) { if (originPath.startsWith("http")) {
...@@ -172,16 +173,20 @@ public class FileUtil { ...@@ -172,16 +173,20 @@ public class FileUtil {
byte[] buffer = new byte[1048576]; byte[] buffer = new byte[1048576];
int bytesum = 0; int bytesum = 0;
boolean var8 = false;
int byteread; int byteread;
while((byteread = input.read(buffer)) != -1) { while((byteread = input.read(buffer)) != -1) {
bytesum += byteread; bytesum += byteread;
fps.write(buffer, 0, byteread); fps.write(buffer, 0, byteread);
fps.flush(); fps.flush();
} }
fps.close(); fps.close();
input.close(); input.close();
} catch (Exception var9) { } catch (Exception var9) {
} }
return targetFile; return targetFile;
} }
} }
...@@ -46,8 +46,4 @@ ...@@ -46,8 +46,4 @@
where pf.FileID=#{fileID} where pf.FileID=#{fileID}
AND pf.UserLifeCycle=0 AND pf.UserLifeCycle=0
</select> </select>
<select id="selectFileId" resultType="java.lang.String">
select `value` from t_answer where options_id=#{optionId} and record_id =#{recordId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -111,4 +111,8 @@ ...@@ -111,4 +111,8 @@
AND process_status #{processStatus} AND process_status #{processStatus}
</if> </if>
</select> </select>
<select id="selectFileId" resultType="java.lang.String">
select `value` from t_answer where options_id=#{optionId} and record_id =#{recordId}
</select>
</mapper> </mapper>
\ No newline at end of file
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