图片上传
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
package com.fangjia.dal.sql.fangjia.dao;
|
||||
|
||||
import com.fangjia.dal.SqlDao;
|
||||
import com.fangjia.dal.sql.model.ReportFileAttach;
|
||||
import com.fangjia.dal.sql.model.UserCity;
|
||||
|
||||
public interface ReportFileAttachDao extends SqlDao<ReportFileAttach>{
|
||||
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.fangjia.dal.sql.fangjia.dao;
|
||||
|
||||
import com.fangjia.dal.GoojiaFangjiaSqlDao;
|
||||
import com.fangjia.dal.sql.model.ReportFileAttach;
|
||||
|
||||
public class ReportFileAttachDaoImpl extends GoojiaFangjiaSqlDao<ReportFileAttach> implements ReportFileAttachDao{
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.fangjia.dal.sql.model;
|
||||
|
||||
import com.fangjia.dal.SqlEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "report_file_attach")
|
||||
public class ReportFileAttach implements SqlEntity {
|
||||
private long id;
|
||||
private Integer userId;
|
||||
private Integer evaluationId;
|
||||
private String queryId;
|
||||
private Integer fileClass;
|
||||
private String fileName;
|
||||
private String fileId;
|
||||
|
||||
@Id
|
||||
@Column(name = "id")
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "user_id")
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Column(name = "evaluation_id")
|
||||
public Integer getEvaluationId() {
|
||||
return evaluationId;
|
||||
}
|
||||
|
||||
public void setEvaluationId(Integer evaluationId) {
|
||||
this.evaluationId = evaluationId;
|
||||
}
|
||||
|
||||
@Column(name = "query_id")
|
||||
public String getQueryId() {
|
||||
return queryId;
|
||||
}
|
||||
|
||||
public void setQueryId(String queryId) {
|
||||
this.queryId = queryId;
|
||||
}
|
||||
|
||||
@Column(name = "file_class")
|
||||
public Integer getFileClass() {
|
||||
return fileClass;
|
||||
}
|
||||
|
||||
public void setFileClass(Integer fileClass) {
|
||||
this.fileClass = fileClass;
|
||||
}
|
||||
|
||||
@Column(name = "file_name")
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
|
||||
public void setFileName(String fileName) {
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
@Column(name = "file_id")
|
||||
public String getFileId() {
|
||||
return fileId;
|
||||
}
|
||||
|
||||
public void setFileId(String fileId) {
|
||||
this.fileId = fileId;
|
||||
}
|
||||
}
|
||||
+232
-10
@@ -1,6 +1,8 @@
|
||||
package com.fangjia.open.controllers.weixin;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.*;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
@@ -10,18 +12,25 @@ import java.util.regex.Pattern;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.dal.sql.model.*;
|
||||
import com.fangjia.open.util.BHBankUtils;
|
||||
import com.fangjia.open.util.InsidePolygon2;
|
||||
import com.fangjia.service.mongo.fangjia.PriceBorderService;
|
||||
import com.fangjia.open.OpenConfig;
|
||||
import com.fangjia.open.dto.UniversalDto;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.FilesModel;
|
||||
import com.fangjia.open.util.*;
|
||||
import com.fangjia.service.mongo.fangjia.*;
|
||||
import com.fangjia.service.sql.*;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.apache.tools.ant.util.DateUtils;
|
||||
import org.bson.types.ObjectId;
|
||||
import org.sothis.core.util.Pager;
|
||||
import org.sothis.web.mvc.ActionContext;
|
||||
import org.sothis.web.mvc.annotation.Param;
|
||||
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
@@ -36,8 +45,6 @@ import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.compatible.model.JsonModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.open.model.weixin.EvaluationModel;
|
||||
import com.fangjia.open.util.InsidePolygon;
|
||||
import com.fangjia.open.util.Point;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import com.fangjia.service.bo.HouseBo;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
@@ -50,14 +57,12 @@ import com.fangjia.service.email.EmailService;
|
||||
import com.fangjia.service.email.Mail;
|
||||
import com.fangjia.service.email.MailUser;
|
||||
import com.fangjia.service.mongo.bkoff.DistrictHouseStatService;
|
||||
import com.fangjia.service.mongo.fangjia.AverageStatisticsService;
|
||||
import com.fangjia.service.mongo.fangjia.DealPriceService;
|
||||
import com.fangjia.service.mongo.fangjia.LatlngPolygonService;
|
||||
import com.fangjia.service.sms.SmsException;
|
||||
import com.fangjia.service.sms.SmsService;
|
||||
import com.fangjia.service.user.UsersInfoService;
|
||||
import com.fangjia.service.util.CookieUtils;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
/**
|
||||
* Created by wenyan on 2016/7/15.
|
||||
@@ -100,11 +105,16 @@ public class WeiXinEvaluationController {
|
||||
private GoldLogsService goldLogsService;
|
||||
private PriceBorderService priceBorderService;
|
||||
private BohaiEvaluationAuditService bohaiEvaluationAuditService;
|
||||
|
||||
private FileService fileService;
|
||||
private ReportFileAttachService reportFileAttachService;
|
||||
|
||||
private final static String DD_ID = "5938c43984aec20a36f474c5";
|
||||
|
||||
private static List<String> MOBILES = new ArrayList<String>();
|
||||
|
||||
private static long MAX_FILE_BYTES_SIZE = 1024 * 1024 * 5;
|
||||
private FileDao fileDao = FileDao.getInstance();
|
||||
|
||||
static {
|
||||
MOBILES.add("13916992399");
|
||||
MOBILES.add("15201904147");
|
||||
@@ -603,6 +613,21 @@ public class WeiXinEvaluationController {
|
||||
BohaiEvaluationAudit bohaiEvaluationAudit = bohaiEvaluationAuditService.findByBohaiEvaluationAuditId(Long.valueOf(evaluationId));
|
||||
model.setBohaiEvaluationAudit(bohaiEvaluationAudit);
|
||||
|
||||
if(bohaiEvaluationAudit != null){
|
||||
List<ReportFileAttach> reportFiles = reportFileAttachService.findAllByParams(Integer.valueOf(evaluationId), bohaiEvaluationAudit.getQueryId(), (int)fjtUser.getId());
|
||||
if(reportFiles != null && reportFiles.size()>0){
|
||||
Map<String, List<ReportFileAttach>> reportFileMap = new HashMap<String, List<ReportFileAttach>>();
|
||||
for(ReportFileAttach rfa : reportFiles){
|
||||
List<ReportFileAttach> list = reportFileMap.get(rfa.getFileClass().toString());
|
||||
if(list == null){
|
||||
list = new ArrayList<ReportFileAttach>();
|
||||
reportFileMap.put(rfa.getFileClass().toString(), list);
|
||||
}
|
||||
list.add(rfa);
|
||||
}
|
||||
model.setReportFileMap(reportFileMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(fjtUser!=null && fjtUser.getRole()==17 && district.getCity().equals("上海")){
|
||||
@@ -1130,6 +1155,195 @@ public class WeiXinEvaluationController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public Object upLoadEvaluationFileAction(EvaluationModel model, HttpServletRequest request){
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
List<CommonsMultipartFile> files = model.getReportFiles();
|
||||
if(files == null || files.size()<=1){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请选择要上传的文件"));
|
||||
return mav;
|
||||
}
|
||||
if(model.getEvaluationId()==null || model.getQueryId()==null){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("评估编号或查询编号为空"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
if(model.getFileClass()==3 && files.size()<7){
|
||||
mav.setModel(BasicModel.buildBadRequestModel("上传图片不能少于6张"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
String cookieUserId = CookieUtils.getCookieValue(request, "login_user_id");
|
||||
long userId = Long.valueOf(cookieUserId);
|
||||
FjtUsers fjtUser = fjtUsersService.findById(Long.valueOf(userId));
|
||||
UsersDetail usersDetail = usersDetailService.findById(fjtUser.getId());
|
||||
try {
|
||||
String id = new ObjectId().toString();
|
||||
List<File> uploadfiles = new ArrayList<File>();
|
||||
for (CommonsMultipartFile file : files) {
|
||||
if (file.getSize() == 0 ) {
|
||||
continue;
|
||||
}
|
||||
String contentType = file.getContentType();//getPicContentType(file);
|
||||
|
||||
if (StringUtils.isBlank(contentType)) {
|
||||
continue;
|
||||
}
|
||||
ReportFileAttach reportFileAttach = reportFileAttachService.findFirstByParams(Integer.valueOf(model.getEvaluationId()), model.getQueryId(), (int)fjtUser.getId(), model.getFileClass(), file.getOriginalFilename());
|
||||
if(reportFileAttach != null){
|
||||
continue;
|
||||
}
|
||||
String converFileName = new String(file.getOriginalFilename().getBytes(), "UTF-8");
|
||||
String fontUrl = ActionContext.getContext().getServletContext().getRealPath("/") + "files" + File.separator + model.getEvaluationId() + File.separator+converFileName;
|
||||
System.out.println(fontUrl);
|
||||
createFile(fontUrl);
|
||||
File tempFile = new File(fontUrl);
|
||||
|
||||
try {
|
||||
tempFile.createNewFile();
|
||||
} catch (IOException e) {
|
||||
//处理异常信息
|
||||
}
|
||||
try {
|
||||
inputStreamToFile(file.getInputStream(), tempFile);
|
||||
uploadfiles.add(tempFile);
|
||||
} catch (IOException e) {
|
||||
//处理异常信息
|
||||
}
|
||||
reportFileAttach = new ReportFileAttach();
|
||||
reportFileAttach.setEvaluationId(Integer.valueOf(model.getEvaluationId()));
|
||||
reportFileAttach.setQueryId(model.getQueryId());
|
||||
reportFileAttach.setUserId((int)fjtUser.getId());
|
||||
reportFileAttach.setFileClass(model.getFileClass());
|
||||
reportFileAttach.setFileName(file.getOriginalFilename());
|
||||
reportFileAttach.setFileId(id);
|
||||
reportFileAttachService.save(reportFileAttach);
|
||||
|
||||
fileDao.save(id,"upload","o", file.getBytes(), contentType);
|
||||
String href = DataUtil.encodePicUrl(id, "o", "upload");
|
||||
String link = "http://static.fangjia.com/stc/fs/"+href;
|
||||
System.out.println(link);
|
||||
}
|
||||
if(uploadfiles.size()>0){
|
||||
BHBankUtils.inquireUploadFiles2(usersDetail.getName(),model.getQueryId(), model.getFileClass(), uploadfiles);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("文件上传失败!"));
|
||||
}
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
private void createFile(String path) throws IOException {
|
||||
if (StringUtils.isNotEmpty(path)) {
|
||||
File file = new File(path);
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
}
|
||||
file.createNewFile();
|
||||
}
|
||||
}
|
||||
|
||||
//将InputStream类型转化为File类型
|
||||
private static void inputStreamToFile(InputStream ins, File file) {
|
||||
//将输出流转化为文件即可
|
||||
FileOutputStream os = null;
|
||||
try {
|
||||
os = new FileOutputStream(file);
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[1024];
|
||||
while ((bytesRead = ins.read(buffer)) != -1) {
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("调用inputStreamToFile产生异常:" + e.getMessage());
|
||||
} finally {
|
||||
try {
|
||||
if (os != null) {
|
||||
os.close();
|
||||
}
|
||||
if (ins != null) {
|
||||
ins.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("inputStreamToFile关闭io时产生异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 保存图片到FS
|
||||
*/
|
||||
private List<String> savePics(String districtId, List<File> pics) {
|
||||
List<String> ret = new ArrayList<String>(pics.size());
|
||||
for (File pic : pics) {
|
||||
if (pic.length() == 0 || pic.length() > MAX_FILE_BYTES_SIZE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String contentType = getPicContentType(pic);
|
||||
if (StringUtils.isBlank(contentType)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String picName = districtId + "/" + pic.getName();
|
||||
try {
|
||||
fileService.save(picName, FileServiceImpl.SIZE_ORIGINAL, IOUtils.toByteArray(new FileInputStream(pic)),
|
||||
contentType);
|
||||
fileService.save(picName, FileServiceImpl.SIZE_SUMMERY, IOUtils.toByteArray(new FileInputStream(pic)),
|
||||
contentType);
|
||||
fileService.save(picName, FileServiceImpl.SIZE_MEDIUM, IOUtils.toByteArray(new FileInputStream(pic)),
|
||||
contentType);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
ret.add(picName);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证图片文件类型,目前支持gif、jpg
|
||||
*
|
||||
* @param pic
|
||||
* @return
|
||||
*/
|
||||
private String getPicContentType(File pic) {
|
||||
byte[] b = new byte[4];
|
||||
FileInputStream is = null;
|
||||
try {
|
||||
is = new FileInputStream(pic);
|
||||
is.read(b, 0, b.length);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (null != is) {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
String type = DataUtil.byte2hex(b).toUpperCase();
|
||||
if (type.contains("FFD8FF") || type.contains("89504E47")) {
|
||||
return "image/jpeg";
|
||||
}
|
||||
if (type.contains("47494638")) {
|
||||
return "image/gif";
|
||||
}
|
||||
if (type.contains("424D")) {
|
||||
return "image/bmp";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFjtEvaluationService(FjtEvaluationService fjtEvaluationService) {
|
||||
this.fjtEvaluationService = fjtEvaluationService;
|
||||
@@ -1215,4 +1429,12 @@ public class WeiXinEvaluationController {
|
||||
public void setBohaiEvaluationAuditService(BohaiEvaluationAuditService bohaiEvaluationAuditService) {
|
||||
this.bohaiEvaluationAuditService = bohaiEvaluationAuditService;
|
||||
}
|
||||
|
||||
public void setFileService(FileService fileService) {
|
||||
this.fileService = fileService;
|
||||
}
|
||||
|
||||
public void setReportFileAttachService(ReportFileAttachService reportFileAttachService) {
|
||||
this.reportFileAttachService = reportFileAttachService;
|
||||
}
|
||||
}
|
||||
|
||||
+42
@@ -1,6 +1,8 @@
|
||||
package com.fangjia.open.model.weixin;
|
||||
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -8,8 +10,10 @@ import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.dal.sql.model.BohaiEvaluationAudit;
|
||||
import com.fangjia.dal.sql.model.EvaluationAudit;
|
||||
import com.fangjia.dal.sql.model.FjtEvaluation;
|
||||
import com.fangjia.dal.sql.model.ReportFileAttach;
|
||||
import com.fangjia.open.model.BaseModel;
|
||||
import com.fangjia.service.bo.DistrictStatBo;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
|
||||
/**
|
||||
@@ -48,6 +52,11 @@ public class EvaluationModel extends BaseModel{
|
||||
// private String preName;//眾漆諉諳--瞼攫靡備
|
||||
// private String countryCode;//眾漆諉諳--Е郖晤鎢
|
||||
// private String buildName;//眾漆諉諳--華硊
|
||||
|
||||
private List<CommonsMultipartFile> reportFiles;
|
||||
private String queryId;
|
||||
private Integer fileClass;
|
||||
private Map<String, List<ReportFileAttach>> reportFileMap;
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
@@ -260,4 +269,37 @@ public class EvaluationModel extends BaseModel{
|
||||
// public void setBuildName(String buildName) {
|
||||
// this.buildName = buildName;
|
||||
// }
|
||||
|
||||
|
||||
public List<CommonsMultipartFile> getReportFiles() {
|
||||
return reportFiles;
|
||||
}
|
||||
|
||||
public void setReportFiles(List<CommonsMultipartFile> reportFiles) {
|
||||
this.reportFiles = reportFiles;
|
||||
}
|
||||
|
||||
public String getQueryId() {
|
||||
return queryId;
|
||||
}
|
||||
|
||||
public void setQueryId(String queryId) {
|
||||
this.queryId = queryId;
|
||||
}
|
||||
|
||||
public Integer getFileClass() {
|
||||
return fileClass;
|
||||
}
|
||||
|
||||
public void setFileClass(Integer fileClass) {
|
||||
this.fileClass = fileClass;
|
||||
}
|
||||
|
||||
public Map<String, List<ReportFileAttach>> getReportFileMap() {
|
||||
return reportFileMap;
|
||||
}
|
||||
|
||||
public void setReportFileMap(Map<String, List<ReportFileAttach>> reportFileMap) {
|
||||
this.reportFileMap = reportFileMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,27 @@ package com.fangjia.open.util;
|
||||
|
||||
import com.fangjia.core.util.HttpRequest;
|
||||
import com.fangjia.core.util.MD5Util;
|
||||
import com.fangjia.core.util.MultipartUtility;
|
||||
import com.fangjia.dal.sql.model.FjtEvaluation;
|
||||
import com.fangjia.dal.sql.model.UsersDetail;
|
||||
import com.fangjia.open.model.weixin.EvaluationModel;
|
||||
import com.mashape.unirest.http.HttpResponse;
|
||||
import com.mashape.unirest.http.Unirest;
|
||||
import com.mashape.unirest.request.HttpRequestWithBody;
|
||||
import com.yeepay.shade.org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import okhttp3.*;
|
||||
import org.apache.commons.collections.map.MultiValueMap;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.http.HttpHeaders;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
@@ -16,11 +30,14 @@ import java.util.*;
|
||||
public class BHBankUtils {
|
||||
|
||||
// public static String token = "bohaifangjiatest";//测试token
|
||||
public static String token = "bohaifangjia";//正式token
|
||||
public static String nonce = "818975";
|
||||
// public static String uri = "http://topen.shbrea.com.cn/API";//测试
|
||||
|
||||
|
||||
public static String token = "bohaifangjia";//正式token
|
||||
public static String uri ="https://open.shbrea.com.cn/API";
|
||||
|
||||
|
||||
public static String nonce = "818975";
|
||||
public static Map<String, String > regionCodeMap = new HashMap<String, String>(){{
|
||||
put("310101000000","黄浦");
|
||||
put("310104000000","徐汇");
|
||||
@@ -279,4 +296,142 @@ public class BHBankUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void inquireUploadFiles(String name, String queryId, Integer fileClass){
|
||||
String feedbackId = null;
|
||||
List<JSONObject> list = new ArrayList<JSONObject>();
|
||||
Map params = new HashMap();
|
||||
params.put("queryId",queryId);
|
||||
params.put("userName",name);
|
||||
params.put("fileClass", fileClass.toString());
|
||||
|
||||
List<String> lists = Arrays.asList("queryId", "userName", "fileClass");
|
||||
|
||||
String s = "";
|
||||
for(String key : lists){
|
||||
String value = (String)params.get(key);
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
s = s + value;
|
||||
}
|
||||
}
|
||||
String s1 = null;
|
||||
try {
|
||||
s1 = URLEncoder.encode(s,"utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// params.put("file", new File("d:/a.jpg") );
|
||||
|
||||
Integer date1 = (int)(new Date().getTime()/1000);
|
||||
String str = token + date1.toString()+nonce+ s1;
|
||||
String md5str2 = MD5Util.encrypt(str,"utf-8");
|
||||
|
||||
Map headers = new HashMap();
|
||||
headers.put("timestamp", date1.toString());
|
||||
headers.put("sign", md5str2);
|
||||
headers.put("nonce", nonce.toString());
|
||||
|
||||
HttpRequest request = new HttpRequest();
|
||||
String content = null;
|
||||
try {
|
||||
content = request.post(uri+"/inquireUploadFiles/bh/", params, headers, "utf-8");
|
||||
if(StringUtils.isNotBlank(content)){
|
||||
JSONObject jsonObj = JSONObject.fromObject(content);
|
||||
System.out.println(jsonObj.toString());
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Integer inquireUploadFiles2(String name, String queryId, Integer fileClass , List<File> uploadfiles){
|
||||
Map params = new HashMap();
|
||||
params.put("queryId",queryId);
|
||||
params.put("userName",name);
|
||||
params.put("fileClass", fileClass.toString());
|
||||
|
||||
List<String> lists = Arrays.asList("queryId", "userName", "fileClass");
|
||||
|
||||
String s = "";
|
||||
for(String key : lists){
|
||||
String value = (String)params.get(key);
|
||||
if(StringUtils.isNotBlank(value)){
|
||||
s = s + value;
|
||||
}
|
||||
}
|
||||
String s1 = null;
|
||||
try {
|
||||
s1 = URLEncoder.encode(s,"utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Integer date1 = (int)(new Date().getTime()/1000);
|
||||
String str = token + date1.toString()+nonce+ s1;
|
||||
String md5str2 = MD5Util.encrypt(str,"utf-8");
|
||||
|
||||
Map headers = new HashMap();
|
||||
headers.put("timestamp", date1.toString());
|
||||
headers.put("sign", md5str2);
|
||||
headers.put("nonce", nonce.toString());
|
||||
|
||||
String url = uri+"/inquireUploadFiles/bh/";
|
||||
try{
|
||||
// HttpResponse<String> response= Unirest.post(url).header("sign",md5str2)
|
||||
// .header("timestamp",date1.toString())
|
||||
// .header("nonce",nonce.toString())
|
||||
// .field("queryId",queryId)
|
||||
// .field("fileClass",fileClass.toString())
|
||||
// .field("file", new File("d:\\a.jpg"))
|
||||
// .field("userName",name).asString();
|
||||
// MultipartBody responseBody = Unirest.post(url).header("sign",md5str2)
|
||||
// .header("timestamp",date1.toString())
|
||||
// .header("nonce",nonce.toString())
|
||||
// .field("queryId",queryId)
|
||||
// .field("fileClass",fileClass.toString())
|
||||
// .field("userName",name);
|
||||
//
|
||||
// for(File file : uploadfiles){
|
||||
// responseBody.field("file", file);
|
||||
// }
|
||||
// HttpResponse<String> response = responseBody.asString();
|
||||
OkHttpClient client = new OkHttpClient().newBuilder().build();
|
||||
MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM)
|
||||
.addFormDataPart("queryId",queryId)
|
||||
.addFormDataPart("fileClass",fileClass.toString())
|
||||
.addFormDataPart("userName",name);
|
||||
|
||||
for(File file : uploadfiles){
|
||||
System.out.println(file.getAbsoluteFile());
|
||||
System.out.println(file.getName());
|
||||
System.out.println(file.getPath());
|
||||
System.out.println(file.getCanonicalPath());
|
||||
System.out.println(file.getParentFile());
|
||||
builder.addFormDataPart("file",file.getPath(), RequestBody.create(MediaType.parse("application/octet-stream"), file));
|
||||
}
|
||||
RequestBody body = builder.build();
|
||||
Request request = new Request.Builder().url(url).method("POST",body)
|
||||
.addHeader("sign",md5str2)
|
||||
.addHeader("timestamp",date1.toString())
|
||||
.addHeader("nonce", nonce.toString())
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
|
||||
String content = response.body().string();
|
||||
JSONObject jsonObj = JSONObject.fromObject(content);
|
||||
System.out.println("上传接口返回:"+jsonObj.toString());
|
||||
Integer code = (Integer) jsonObj.get("errCode");
|
||||
if(code == 0){
|
||||
return code;
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class FileDao {
|
||||
try {
|
||||
filesCollection = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB("fangjia_fs").getCollection("files");
|
||||
gridFs = new GridFS(filesCollection.getDB(), "fangjia_fs");
|
||||
cappedCollection = new Mongo("capped.mongo.db.fangjia.com", Integer.getInteger("capped.mongo.port", 27017)).getDB("fangjia_fs").getCollection("files_capped");
|
||||
cappedCollection = new Mongo("capped.mongo.db.fangjia.com", Integer.getInteger("capped.mongo.port", 27000)).getDB("fangjia_fs").getCollection("files_capped");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<class>com.fangjia.dal.sql.model.EvaluationAudit</class>
|
||||
<class>com.fangjia.dal.sql.model.GoldLogs</class>
|
||||
<class>com.fangjia.dal.sql.model.BohaiEvaluationAudit</class>
|
||||
<class>com.fangjia.dal.sql.model.ReportFileAttach</class>
|
||||
<exclude-unlisted-classes>true</exclude-unlisted-classes>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
@@ -38,7 +38,7 @@ $(function () {
|
||||
return
|
||||
}
|
||||
}
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{3}-{2}</small></div></div></a></li>'
|
||||
var content = ""
|
||||
$(data).each(function () {
|
||||
var district = this
|
||||
@@ -52,7 +52,7 @@ $(function () {
|
||||
var region = $(li).attr("data-region");
|
||||
var isCompany=$("#t").val();
|
||||
if ($("#t").val() != "c") {
|
||||
saveCookie(id, name, addr)
|
||||
saveCookie(id, name, addr, region)
|
||||
}
|
||||
if ($("#t").val() == "b") {
|
||||
location.href = "districtDetail?id=" + id+"&city="+city
|
||||
@@ -75,11 +75,11 @@ $(function () {
|
||||
* @param name
|
||||
* @param addr
|
||||
*/
|
||||
function saveCookie(id, name, addr) {
|
||||
function saveCookie(id, name, addr, region) {
|
||||
var cookieKey = "history" + $("#t").val()
|
||||
var history = $.cookie(cookieKey)
|
||||
var his = []
|
||||
var item = {id: id, name: name, addr: addr}
|
||||
var item = {id: id, name: name, addr: addr, region:region}
|
||||
his.push(item)
|
||||
var ids = []
|
||||
ids.push(id)
|
||||
@@ -108,10 +108,16 @@ function resumeHistory() {
|
||||
var city = $("#cityName").val()
|
||||
var history = $.cookie(cookieKey)
|
||||
if (history && history != "") {
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{3}-{2}</small></div></div></a></li>'
|
||||
var template1 = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
|
||||
var content = '<li><a class="item-content" style="color:#333;"><div class="item-inner"><div class="item-subtitle"><i class="searchHistory"></i>搜索历史</div></div></a></li>'
|
||||
$(JSON.parse(history)).each(function () {
|
||||
content = content + template.template(this.id, this.name, this.addr)
|
||||
if(this.region!=undefined){
|
||||
content = content + template.template(this.id, this.name, this.addr, this.region)
|
||||
}else{
|
||||
content = content + template1.template(this.id, this.name, this.addr)
|
||||
}
|
||||
|
||||
})
|
||||
$("#searchSpan ul").empty().append(content).find("li>a.item-link").click(function () {
|
||||
var li = $(this).parent()
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
### jQuery Multiple File Upload Plugin v1.47 - 2010-03-26 ###
|
||||
|
||||
* Home: http://www.fyneworks.com/jquery/multiple-file-upload/
|
||||
* Code: http://code.google.com/p/jquery-multifile-plugin/
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
###
|
||||
*/
|
||||
//eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';3(X.1M)(6($){$.7.2=6(h){3(5.Q==0)8 5;3(R U[0]==\'1f\'){3(5.Q>1){l i=U;8 5.N(6(){$.7.2.14($(5),i)})};$.7.2[U[0]].14(5,$.27(U).26(1)||[]);8 5};l h=$.L({},$.7.2.D,h||{});$(\'21\').1D(\'2-S\').V(\'2-S\').1i($.7.2.15);3($.7.2.D.12){$.7.2.1s($.7.2.D.12);$.7.2.D.12=11};5.1D(\'.2-1a\').V(\'2-1a\').N(6(){X.2=(X.2||0)+1;l e=X.2;l g={e:5,E:$(5),P:$(5).P()};3(R h==\'1W\')h={m:h};l o=$.L({},$.7.2.D,h||{},($.1p?g.E.1p():($.2t?g.E.Z():11))||{},{});3(!(o.m>0)){o.m=g.E.K(\'2e\');3(!(o.m>0)){o.m=(u(g.e.1o.B(/\\b(m|2a)\\-([0-9]+)\\b/q)||[\'\']).B(/[0-9]+/q)||[\'\'])[0];3(!(o.m>0))o.m=-1;1Z o.m=u(o.m).B(/[0-9]+/q)[0]}};o.m=18 1X(o.m);o.j=o.j||g.E.K(\'j\')||\'\';3(!o.j){o.j=(g.e.1o.B(/\\b(j\\-[\\w\\|]+)\\b/q))||\'\';o.j=18 u(o.j).t(/^(j|1e)\\-/i,\'\')};$.L(g,o||{});g.A=$.L({},$.7.2.D.A,g.A);$.L(g,{n:0,J:[],2c:[],19:g.e.I||\'2\'+u(e),1k:6(z){8 g.19+(z>0?\'1U\'+u(z):\'\')},G:6(a,b){l c=g[a],k=$(b).K(\'k\');3(c){l d=c(b,k,g);3(d!=11)8 d}8 1h}});3(u(g.j).Q>1){g.j=g.j.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');g.1w=18 2h(\'\\\\.(\'+(g.j?g.j:\'\')+\')$\',\'q\')};g.M=g.19+\'25\';g.E.1j(\'<O T="2-1j" I="\'+g.M+\'"></O>\');g.1l=$(\'#\'+g.M+\'\');g.e.H=g.e.H||\'p\'+e+\'[]\';3(!g.C){g.1l.1d(\'<O T="2-C" I="\'+g.M+\'1m"></O>\');g.C=$(\'#\'+g.M+\'1m\')};g.C=$(g.C);g.10=6(c,d){g.n++;c.2=g;3(d>0)c.I=c.H=\'\';3(d>0)c.I=g.1k(d);c.H=u(g.1n.t(/\\$H/q,$(g.P).K(\'H\')).t(/\\$I/q,$(g.P).K(\'I\')).t(/\\$g/q,e).t(/\\$i/q,d));3((g.m>0)&&((g.n-1)>(g.m)))c.16=1h;g.17=g.J[d]=c;c=$(c);c.1g(\'\').K(\'k\',\'\')[0].k=\'\';c.V(\'2-1a\');c.2z(6(){$(5).1O();3(!g.G(\'1R\',5,g))8 y;l a=\'\',v=u(5.k||\'\');3(g.j&&v&&!v.B(g.1w))a=g.A.1q.t(\'$1e\',u(v.B(/\\.\\w{1,4}$/q)));1r(l f 29 g.J)3(g.J[f]&&g.J[f]!=5)3(g.J[f].k==v)a=g.A.1t.t(\'$p\',v.B(/[^\\/\\\\]+$/q));l b=$(g.P).P();b.V(\'2\');3(a!=\'\'){g.1u(a);g.n--;g.10(b[0],d);c.1v().2d(b);c.F();8 y};$(5).1x({1y:\'1N\',1z:\'-1P\'});c.1Q(b);g.1A(5,d);g.10(b[0],d+1);3(!g.G(\'1S\',5,g))8 y});$(c).Z(\'2\',g)};g.1A=6(c,d){3(!g.G(\'1T\',c,g))8 y;l r=$(\'<O T="2-1V"></O>\'),v=u(c.k||\'\'),a=$(\'<1B T="2-1C" 1C="\'+g.A.Y.t(\'$p\',v)+\'">\'+g.A.p.t(\'$p\',v.B(/[^\\/\\\\]+$/q)[0])+\'</1B>\'),b=$(\'<a T="2-F" 1Y="#\'+g.M+\'">\'+g.A.F+\'</a>\');g.C.1d(r.1d(b,\' \',a));b.1E(6(){3(!g.G(\'20\',c,g))8 y;g.n--;g.17.16=y;g.J[d]=11;$(c).F();$(5).1v().F();$(g.17).1x({1y:\'\',1z:\'\'});$(g.17).13().1g(\'\').K(\'k\',\'\')[0].k=\'\';3(!g.G(\'22\',c,g))8 y;8 y});3(!g.G(\'23\',c,g))8 y};3(!g.2)g.10(g.e,0);g.n++;g.E.Z(\'2\',g)})};$.L($.7.2,{13:6(){l a=$(5).Z(\'2\');3(a)a.C.24(\'a.2-F\').1E();8 $(5)},15:6(a){a=(R(a)==\'1f\'?a:\'\')||\'1F\';l o=[];$(\'1b:p.2\').N(6(){3($(5).1g()==\'\')o[o.Q]=5});8 $(o).N(6(){5.16=1h}).V(a)},1c:6(a){a=(R(a)==\'1f\'?a:\'\')||\'1F\';8 $(\'1b:p.\'+a).28(a).N(6(){5.16=y})},S:{},1s:6(b,c,d){l e,k;d=d||[];3(d.1G.1H().1I("1J")<0)d=[d];3(R(b)==\'6\'){$.7.2.15();k=b.14(c||X,d);1K(6(){$.7.2.1c()},1L);8 k};3(b.1G.1H().1I("1J")<0)b=[b];1r(l i=0;i<b.Q;i++){e=b[i]+\'\';3(e)(6(a){$.7.2.S[a]=$.7[a]||6(){};$.7[a]=6(){$.7.2.15();k=$.7.2.S[a].14(5,U);1K(6(){$.7.2.1c()},1L);8 k}})(e)}}});$.7.2.D={j:\'\',m:-1,1n:\'$H\',A:{F:\'x\',1q:\'2f 2g 2b a $1e p.\\2i 2j...\',p:\'$p\',Y:\'2k Y: $p\',1t:\'2l p 2m 2n 2o Y:\\n$p\'},12:[\'1i\',\'2p\',\'2q\',\'2r\',\'2s\'],1u:6(s){2u(s)}};$.7.13=6(){8 5.N(6(){2v{5.13()}2w(e){}})};$(6(){$("1b[2x=p].2y").2()})})(1M);',62,160,'||MultiFile|if||this|function|fn|return|||||||||||accept|value|var|max|||file|gi|||replace|String||||false||STRING|match|list|options||remove|trigger|name|id|slaves|attr|extend|wrapID|each|div|clone|length|typeof|intercepted|class|arguments|addClass||window|selected|data|addSlave|null|autoIntercept|reset|apply|disableEmpty|disabled|current|new|instanceKey|applied|input|reEnableEmpty|append|ext|string|val|true|submit|wrap|generateID|wrapper|_list|namePattern|className|metadata|denied|for|intercept|duplicate|error|parent|rxAccept|css|position|top|addToList|span|title|not|click|mfD|constructor|toString|indexOf|Array|setTimeout|1000|jQuery|absolute|blur|3000px|after|onFileSelect|afterFileSelect|onFileAppend|_F|label|number|Number|href|else|onFileRemove|form|afterFileRemove|afterFileAppend|find|_wrap|slice|makeArray|removeClass|in|limit|select|files|prepend|maxlength|You|cannot|RegExp|nTry|again|File|This|has|already|been|ajaxSubmit|ajaxForm|validate|valid|meta|alert|try|catch|type|multi|change'.split('|'),0,{}))
|
||||
|
||||
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';3(V.1r)(6($){$.8.2=6(l){3(5.Z==0)c 5;3(10 X[0]==\'1e\'){3(5.Z>1){h C=X;c 5.R(6(){$.8.2.18($(5),C)})};$.8.2[X[0]].18(5,$.2l(X).2i(1)||[]);c 5};h l=$.Q({},$.8.2.l,l||{});$(\'2g\').1F(\'2-U\').Y(\'2-U\').1H($.8.2.1a);3($.8.2.l.1b){$.8.2.1W($.8.2.l.1b);$.8.2.l.1b=15};5.1F(\'.2-1k\').Y(\'2-1k\').R(6(){V.2=(V.2||0)+1;h 19=V.2;h 2={e:5,E:$(5),P:$(5).P()};3(10 l==\'2o\')l={j:l};h o=$.Q({},$.8.2.l,l||{},($.1S?2.E.1S():($.2p?2.E.13():15))||{},{});3(!(o.j>0)){o.j=2.E.I(\'2b\');3(!(o.j>0)){o.j=(A(2.e.1u.F(/\\b(j|2x)\\-([0-9]+)\\b/m)||[\'\']).F(/[0-9]+/m)||[\'\'])[0];3(!(o.j>0))o.j=-1;2r o.j=A(o.j).F(/[0-9]+/m)[0]}};o.j=1i 2s(o.j);o.d=o.d||2.E.I(\'d\')||\'\';3(!o.d){o.d=(2.e.1u.F(/\\b(d\\-[\\w\\|]+)\\b/m))||\'\';o.d=1i A(o.d).t(/^(d|1m)\\-/i,\'\')};$.Q(2,o||{});2.D=$.Q({},$.8.2.l.D,2.D);$.Q(2,{n:0,J:[],2a:[],1j:2.e.N||\'2\'+A(19),1I:6(z){c 2.1j+(z>0?\'28\'+A(z):\'\')},L:6(1K,1g){h 1f=2[1K],k=$(1g).I(\'k\');3(1f){h 1o=1f(1g,k,2);3(1o!=15)c 1o}c 1d}});3(A(2.d).Z>1){2.d=2.d.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');2.1x=1i 24(\'\\\\.(\'+(2.d?2.d:\'\')+\')$\',\'m\')};2.T=2.1j+\'23\';2.E.1L(\'<O 11="2-1L" N="\'+2.T+\'"></O>\');2.1M=$(\'#\'+2.T+\'\');2.e.H=2.e.H||\'p\'+19+\'[]\';3(!2.M){2.1M.1n(\'<O 11="2-M" N="\'+2.T+\'1N"></O>\');2.M=$(\'#\'+2.T+\'1N\')};2.M=$(2.M);2.17=6(7,u){2.n++;7.2=2;3(u>0)7.N=7.H=\'\';3(u>0)7.N=2.1I(u);7.H=A(2.1G.t(/\\$H/m,$(2.P).I(\'H\')).t(/\\$N/m,$(2.P).I(\'N\')).t(/\\$g/m,19).t(/\\$i/m,u));3((2.j>0)&&((2.n-1)>(2.j)))7.14=1d;2.16=2.J[u]=7;7=$(7);7.1l(\'\').I(\'k\',\'\')[0].k=\'\';7.Y(\'2-1k\');7.29(6(){$(5).22();3(!2.L(\'27\',5,2))c y;h 12=\'\',v=A(5.k||\'\');3(2.d&&v&&!v.F(2.1x))12=2.D.1E.t(\'$1m\',A(v.F(/\\.\\w{1,4}$/m)));1Y(h f 25 2.J)3(2.J[f]&&2.J[f]!=5)3(2.J[f].k==v)12=2.D.1D.t(\'$p\',v.F(/[^\\/\\\\]+$/m));h S=$(2.P).P();S.Y(\'2\');3(12!=\'\'){2.1J(12);2.n--;2.17(S[0],u);7.1t().1Z(S);7.K();c y};$(5).1s({1v:\'20\',1w:\'-21\'});7.26(S);2.1z(5,u);2.17(S[0],u+1);3(!2.L(\'2z\',5,2))c y});$(7).13(\'2\',2)};2.1z=6(7,u){3(!2.L(\'2u\',7,2))c y;h r=$(\'<O 11="2-2t"></O>\'),v=A(7.k||\'\'),a=$(\'<1y 11="2-1A" 1A="\'+2.D.1C.t(\'$p\',v)+\'">\'+2.D.p.t(\'$p\',v.F(/[^\\/\\\\]+$/m)[0])+\'</1y>\'),b=$(\'<a 11="2-K" 2q="#\'+2.T+\'">\'+2.D.K+\'</a>\');2.M.1n(r.1n(b,\' \',a));b.1U(6(){3(!2.L(\'2v\',7,2))c y;2.n--;2.16.14=y;2.J[u]=15;$(7).K();$(5).1t().K();$(2.16).1s({1v:\'\',1w:\'\'});$(2.16).1c().1l(\'\').I(\'k\',\'\')[0].k=\'\';3(!2.L(\'2w\',7,2))c y;c y});3(!2.L(\'2B\',7,2))c y};3(!2.2)2.17(2.e,0);2.n++;2.E.13(\'2\',2)})};$.Q($.8.2,{1c:6(){h 1h=$(5).13(\'2\');3(1h)1h.M.2A(\'a.2-K\').1U();c $(5)},1a:6(q){q=(10(q)==\'1e\'?q:\'\')||\'1T\';h o=[];$(\'1p:p.2\').R(6(){3($(5).1l()==\'\')o[o.Z]=5});c $(o).R(6(){5.14=1d}).Y(q)},1q:6(q){q=(10(q)==\'1e\'?q:\'\')||\'1T\';c $(\'1p:p.\'+q).2y(q).R(6(){5.14=y})},U:{},1W:6(G,1Q,C){h B,k;C=C||[];3(C.1B.1R().1V("1X")<0)C=[C];3(10(G)==\'6\'){$.8.2.1a();k=G.18(1Q||V,C);1O(6(){$.8.2.1q()},1P);c k};3(G.1B.1R().1V("1X")<0)G=[G];1Y(h i=0;i<G.Z;i++){B=G[i]+\'\';3(B)(6(B){$.8.2.U[B]=$.8[B]||6(){};$.8[B]=6(){$.8.2.1a();k=$.8.2.U[B].18(5,X);1O(6(){$.8.2.1q()},1P);c k}})(B)}}});$.8.2.l={d:\'\',j:-1,1G:\'$H\',D:{K:\'x\',1E:\'不支持$1m文件.\\n请重试!\',p:\'$p\',1C:\'选择了文件: $p\',1D:\'文件已存在:\\n$p\'},1b:[\'1H\',\'2f\',\'2e\',\'2c\',\'2d\'],1J:6(s){2h(s)}};$.8.1c=6(){c 5.R(6(){2n{5.1c()}2m(e){}})};$(6(){$("1p[2j=p].2k").2()})})(1r);',62,162,'||MultiFile|if||this|function|slave|fn||||return|accept||||var||max|value|options|gi|||file|klass|||replace|slave_count||||false||String|method|args|STRING||match|methods|name|attr|slaves|remove|trigger|list|id|div|clone|extend|each|newEle|wrapID|intercepted|window||arguments|addClass|length|typeof|class|ERROR|data|disabled|null|current|addSlave|apply|group_count|disableEmpty|autoIntercept|reset|true|string|handler|element|settings|new|instanceKey|applied|val|ext|append|returnValue|input|reEnableEmpty|jQuery|css|parent|className|position|top|rxAccept|span|addToList|title|constructor|selected|duplicate|denied|not|namePattern|submit|generateID|error|event|wrap|wrapper|_list|setTimeout|1000|context|toString|metadata|mfD|click|indexOf|intercept|Array|for|prepend|absolute|3000px|blur|_wrap|RegExp|in|after|onFileSelect|_F|change|files|maxlength|validate|valid|ajaxForm|ajaxSubmit|form|alert|slice|type|multi|makeArray|catch|try|number|meta|href|else|Number|label|onFileAppend|onFileRemove|afterFileRemove|limit|removeClass|afterFileSelect|find|afterFileAppend'.split('|'),0,{}))
|
||||
@@ -202,6 +202,9 @@ input::-webkit-input-placeholder{
|
||||
.waiting{padding:0 4px;height:30px;background:#808080;border:solid 1px #545454;border-radius:2px;font-size:0.7rem;color:white;text-align:center;line-height:30px;float:right;position:absolute;right:0;top:8px;cursor:pointer;}
|
||||
.waiting1{height:30px;background:#808080;border:solid 1px #545454;border-radius:2px;font-size:0.7rem;color:white;text-align:center;line-height:30px;float:right;right:0;top:8px;cursor:pointer;}
|
||||
.change_btn{width:102px;height:38px;background:#f0f0f0;border:solid 1px #e1e1e1;text-align:center;line-height:38px;float:right;cursor:pointer;color: #333;font-size: 14px;}
|
||||
|
||||
.multi{width: 100px;}
|
||||
.MultiFile-wrap{margin-top: -50px;margin-left: 100px;}
|
||||
/* 自适应 */
|
||||
@media(max-width:1200px){
|
||||
.tabs{padding-top:67px;}
|
||||
@@ -212,9 +215,12 @@ input::-webkit-input-placeholder{
|
||||
.inputTopic02 .topicTitle .input_lender{width:36%;}
|
||||
#bhFrom .input_mobileNumber{width:63%;padding-left: 30px;}
|
||||
.change_btn{width:72px;}
|
||||
|
||||
}
|
||||
@media(max-width:414px){
|
||||
#bhFrom .input_mobileNumber{width:63%;padding-left: 30px;}
|
||||
.multi{width: 108px;}
|
||||
.MultiFile-wrap{margin-top: -50px;margin-left: 105px;}
|
||||
}
|
||||
@media(max-width:360px) {
|
||||
#bhFrom .input_mobileNumber{width:63%;padding-left: 30px;}
|
||||
@@ -222,5 +228,6 @@ input::-webkit-input-placeholder{
|
||||
|
||||
@media(max-width:375px){
|
||||
#bhFrom .input_mobileNumber{width:63%;padding-left: 40px;}
|
||||
.multi{width: 100px;}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,7 @@
|
||||
<div class="item-input">
|
||||
<input type="text" placeholder="请输入幢号" name="fjtEvaluation.houseNum" required>
|
||||
</div>
|
||||
<div style="width: 100%;">号</div>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
@@ -76,8 +77,9 @@
|
||||
<div class="item-inner">
|
||||
<div class="item-title label">室号或部位:</div>
|
||||
<div class="item-input">
|
||||
<input type="number" min="0" placeholder="请输入室号或部位" name="fjtEvaluation.roomNum" required>
|
||||
<input type="text" min="0" placeholder="请输入室号或部位" name="fjtEvaluation.roomNum" required>
|
||||
</div>
|
||||
<div style="margin-right: -5px;">室</div>
|
||||
</div>
|
||||
<div class="item-media"><span>(必填项)</span></div>
|
||||
</div>
|
||||
|
||||
@@ -16,6 +16,12 @@
|
||||
<style>
|
||||
.list-block02 ul:before,.list-block02 ul:after{height:0;}
|
||||
.moretext{display:inline-block;vertical-align:middle;max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
|
||||
|
||||
|
||||
.MultiFile-label{display: inline-block;margin-left: 10px;}
|
||||
.topicTitle01 p a{color:#a9a9a9;}
|
||||
.topicTitle01 p a.selected{color:#333;}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
@@ -29,6 +35,7 @@
|
||||
<div class="topicContent topicTop" style="padding:0px 20px;">
|
||||
<p>${fjtEvaluation.districtName!}</p>
|
||||
<p style="margin-top:-4px;"><i class="location"></i><small>${fjtEvaluation.address!} <#if fjtEvaluation.houseNum?? && (fjtEvaluation.houseNum?contains("栋") || fjtEvaluation.houseNum?contains("幢"))>${fjtEvaluation.houseNum!}<#else>${fjtEvaluation.houseNum!}号</#if>${fjtEvaluation.roomNum!}室</small> <a href="../district/weXinList?cityName=${fjtEvaluation.city!}" class="collectionLink" style="line-height: 32px;">重新评估 ></a></p>
|
||||
<p style="color: #F4A460;font-size: 12px;line-height: 20px;margin-top: -5px;margin-left: 20px;">*请确认与产证地址一致</p>
|
||||
<span></span>
|
||||
<#if bohaiEvaluationAudit?? && bohaiEvaluationAudit.auditStatus!=0>
|
||||
<p style="margin-top:14px;">评估总价:<#if fjtEvaluation??><strong class="<#if bohaiEvaluationAudit?? && bohaiEvaluationAudit.lastPrice??><#else>price_final</#if>">
|
||||
@@ -125,8 +132,39 @@
|
||||
</div>
|
||||
</#if>
|
||||
|
||||
|
||||
|
||||
<form id="fileForm" enctype="multipart/form-data" method="post" name="fileForm">
|
||||
<input type="hidden" name="evaluationId" value="${fjtEvaluation.id}">
|
||||
<input type="hidden" name="queryId" value="<#if bohaiEvaluationAudit??>${bohaiEvaluationAudit.queryId}</#if>">
|
||||
<div class="topic inputTopic02" id="inputTopic02b" style="border-bottom:none;margin-bottom:0;">
|
||||
<#if reportFileMap??>
|
||||
<div class="topicTitle topicTitle01 ">
|
||||
<span>已上传文件:</span>
|
||||
<#if reportFileMap["1"]??><span>询价单(${reportFileMap["1"]?size})</span></#if>
|
||||
<#if reportFileMap["2"]??><label style="margin-left: 10px;">产证(${reportFileMap["2"]?size})</label></#if>
|
||||
<#if reportFileMap["3"]??><label style="margin-left: 10px;">房屋照片(${reportFileMap["3"]?size})</label></#if>
|
||||
<#if reportFileMap["4"]??><label style="margin-left: 10px;">其它附件(${reportFileMap["4"]?size})</label></#if>
|
||||
</div>
|
||||
|
||||
</#if>
|
||||
|
||||
<div class="topicTitle topicTitle01 ">
|
||||
<span>文件类型:</span>
|
||||
<input name="fileClass" type="hidden" id="fileClass" placeholder="请选择类型" required>
|
||||
<p class="di"><a href="#" class="create-actions08">请选择类型</a></p>
|
||||
</div>
|
||||
<div class="topicTitle topicTitle01 ">
|
||||
<span>上传文件:</span>
|
||||
<a class="submit_btn" type="button" onClick ="uploadFile(this);" id="uploadBtn" style="border-left: none;">上传</a>
|
||||
<input id="file" name="reportFiles" class="multi" accept="" type="file" value="" onclick="changeFile(this)"/>
|
||||
</div>
|
||||
<div class="topicTitle topicTitle01" style="color: #F4A460;font-size: 12px;line-height: 20px;margin-top: -5px;">
|
||||
注:如需下载评估报告,产证为必填项
|
||||
房屋照片上传要求:小区入口1张,小区环境1张,门牌号1张,外立面1张,室内照片2张
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<div class="topic">
|
||||
<div class="topicTitle">房产基本信息</div>
|
||||
<div class="topicContent">
|
||||
@@ -389,7 +427,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<#if bohaiEvaluationAudit?? && fjtEvaluation.lender?? && bohaiEvaluationAudit.auditStatus!=0>
|
||||
<#if bohaiEvaluationAudit?? && fjtEvaluation.lender?? && bohaiEvaluationAudit.auditStatus!=0 && reportFileMap?? && reportFileMap["2"]??>
|
||||
<div class="content-block">
|
||||
<p><a href="#" class="button button-big button-fill download_btn">下载评估报告</a></p>
|
||||
</div>
|
||||
@@ -408,6 +446,7 @@
|
||||
<script type="text/javascript" src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
|
||||
<script type='text/javascript' src='../static/js/jquery.cookie.js' charset='utf-8'></script>
|
||||
<script type="text/javascript" src="../static/js/report.js?v=${t_util.currentTimeMillis()}"></script>
|
||||
<script type="text/javascript" src="../static/js/jquery.MultiFile.pack.js"></script>
|
||||
<script type="text/javascript">
|
||||
var eId = '${fjtEvaluation.id!}';
|
||||
var role = ${role}
|
||||
@@ -422,7 +461,115 @@
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
|
||||
function uploadFile(target) {
|
||||
var formData = new FormData($( "#fileForm" )[0]);
|
||||
var file = $("#fileClass").val();
|
||||
|
||||
if(file == ""){
|
||||
alert("请选择您要上传的文件类型!");
|
||||
}else{
|
||||
$.ajax({
|
||||
url: 'upLoadEvaluationFile',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
async: false,
|
||||
cache: false,
|
||||
contentType: false,
|
||||
processData: false,
|
||||
success: function (data) {
|
||||
if(data == null){
|
||||
alert("上传成功");
|
||||
window.location.reload();
|
||||
// $("#file_wrap_list").remove();
|
||||
// var boxes = $("input[name=reportFiles]")
|
||||
// if(boxes.length>1){
|
||||
// var i = 0;
|
||||
// boxes.forEach(function(element) {
|
||||
// i++;
|
||||
// if(i>2){
|
||||
// element.remove();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// $("a.create-actions08").empty().text("请选择类型")
|
||||
// $("#fileClass").val("")
|
||||
// $("a.create-actions08").removeClass("selected")
|
||||
}else{
|
||||
alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function (returndata) {
|
||||
alert("上传失败!");
|
||||
}
|
||||
});
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$(document).on('click', '.create-actions08', function () {
|
||||
var buttons1 = [
|
||||
{
|
||||
text: '请选择文件类型',
|
||||
label: true
|
||||
},
|
||||
{
|
||||
text: '询价单',
|
||||
bold: true,
|
||||
onClick: function () {
|
||||
$("a.create-actions08").empty().text(this.text).addClass("selected")
|
||||
$("#fileClass").val("1")
|
||||
$("input[name=reportFiles]").attr("accept",".pdf")
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '完整产证(必填)',
|
||||
onClick: function () {
|
||||
$("a.create-actions08").empty().text(this.text).addClass("selected")
|
||||
$("#fileClass").val("2")
|
||||
$("input[name=reportFiles]").attr("accept",".png, .jpg, .jpeg")
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '产证照片(必填)',
|
||||
onClick: function () {
|
||||
$("a.create-actions08").empty().text(this.text).addClass("selected")
|
||||
$("#fileClass").val("3")
|
||||
$("input[name=reportFiles]").attr("accept",".png, .jpg, .jpeg")
|
||||
}
|
||||
},
|
||||
{
|
||||
text: '其它附件',
|
||||
onClick: function () {
|
||||
$("a.create-actions08").empty().text(this.text).addClass("selected")
|
||||
$("#fileClass").val("4")
|
||||
$("input[name=reportFiles]").attr("accept",".png, .jpg, .jpeg")
|
||||
}
|
||||
}
|
||||
];
|
||||
var buttons2 = [
|
||||
{
|
||||
text: '取消',
|
||||
bg: 'gray'
|
||||
}
|
||||
];
|
||||
var groups = [buttons1, buttons2];
|
||||
$.actions(groups);
|
||||
});
|
||||
function changeFile(d){
|
||||
var val = $(d).attr("accept")
|
||||
if(val==""){
|
||||
var fileClass = $("#fileClass").val()
|
||||
if(fileClass == "1"){
|
||||
$(d).attr("accept",".pdf")
|
||||
}else{
|
||||
$(d).attr("accept",".png, .jpg, .jpeg")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -224,5 +224,15 @@
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.5.19</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mashape.unirest</groupId>
|
||||
<artifactId>unirest-java</artifactId>
|
||||
<version>1.4.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>3.14.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.fangjia.service.sql;
|
||||
import com.fangjia.dal.sql.model.ReportFileAttach;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ReportFileAttachService {
|
||||
|
||||
void save(ReportFileAttach reportFileAttach);
|
||||
|
||||
ReportFileAttach findFirstByParams(Integer evaluationId, String queryId, Integer userId, Integer fileClass, String fileName);
|
||||
|
||||
List<ReportFileAttach> findAllByParams(Integer evaluationId, String queryId, Integer userId);
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.fangjia.service.sql;
|
||||
|
||||
import com.fangjia.dal.QueryParam;
|
||||
import com.fangjia.dal.sql.fangjia.dao.ReportFileAttachDao;
|
||||
import com.fangjia.dal.sql.model.ReportFileAttach;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ReportFileAttachServiceImpl implements ReportFileAttachService{
|
||||
private ReportFileAttachDao reportFileAttachDao;
|
||||
|
||||
public ReportFileAttachDao getReportFileAttachDao() {
|
||||
return reportFileAttachDao;
|
||||
}
|
||||
|
||||
public void setReportFileAttachDao(ReportFileAttachDao reportFileAttachDao) {
|
||||
this.reportFileAttachDao = reportFileAttachDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save(ReportFileAttach reportFileAttach) {
|
||||
reportFileAttachDao.save(reportFileAttach);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportFileAttach findFirstByParams(Integer evaluationId, String queryId, Integer userId, Integer fileClass, String fileName) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("userId", userId));
|
||||
params.add(new QueryParam("evaluationId", evaluationId));
|
||||
params.add(new QueryParam("queryId", queryId));
|
||||
params.add(new QueryParam("fileClass", fileClass));
|
||||
params.add(new QueryParam("fileName", fileName));
|
||||
return reportFileAttachDao.findFirstByParams(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportFileAttach> findAllByParams(Integer evaluationId, String queryId, Integer userId) {
|
||||
List<QueryParam> params = new ArrayList<QueryParam>();
|
||||
params.add(new QueryParam("userId", userId));
|
||||
params.add(new QueryParam("evaluationId", evaluationId));
|
||||
params.add(new QueryParam("queryId", queryId));
|
||||
return reportFileAttachDao.findAllByParams(params);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user