package com.yc.sdk.shopping.action.jiazhuang; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.dao.DataAccessException; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.yc.action.BaseAction; import com.yc.action.upload.AttachmentAction; import com.yc.entity.DataSourceEntity; import com.yc.entity.attachment.AttachmentEntity; import com.yc.entity.attachment.AttachmentWhereEntity; import com.yc.factory.FactoryBean; import com.yc.multiData.MultiDataSource; import com.yc.multiData.SpObserver; import com.yc.sdk.shopping.entity.CustomerFeedbackEntity; import com.yc.sdk.shopping.entity.CustomerFeedbackParameterEntity; import com.yc.sdk.shopping.entity.CustomerFeedbackReplyMessageEntiy; import com.yc.sdk.shopping.entity.FeedbackTypeEntity; import com.yc.sdk.shopping.entity.SettingEntity; import com.yc.sdk.shopping.service.SettingIfc; import com.yc.sdk.shopping.service.imagedata.ShoppingImageDataIfc; import com.yc.sdk.shopping.service.panicBuying.CustomerFeedbackIfc; import com.yc.sdk.shopping.util.SettingKey; import com.yc.service.upload.AttachmentIfc; import com.yc.utils.FileUtil; import com.yc.utils.SessionKey; @Controller @Scope("prototype") @RequestMapping("/shopping/customerFeedback.do") public class CustomerFeedback extends BaseAction { @Autowired SettingIfc settingIfc; @Autowired ShoppingImageDataIfc imgData; @Autowired CustomerFeedbackIfc customerFeedbackIfc; /** * 上传附件 到意见反馈表 Images 字段 * @param request * @param response */ @RequestMapping(params = "m=uploadAttachment") public void uploadAttachment(HttpServletRequest request, HttpServletResponse response) {// MultipartHttpServletRequest multipartRequest= FileUtil.getMultipartHttpServletRequest(request); MultipartFile file = multipartRequest.getFile("file"); if(file==null){ file= multipartRequest.getFiles("data").get(0); } JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); String fieldId = "Images"; String unid = multipartRequest.getParameter(SettingKey.UNID); String seqStr = request.getParameter("seq") ; Integer seq = null ; try { if (seqStr!=null&&!"".equals(seqStr)) { seq = Integer.valueOf( seqStr) ; } }catch (NumberFormatException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } File newFile = new File(file.getOriginalFilename()); try { DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); SettingEntity settingEntity = settingIfc.getSettingEntity(request) ; FileUtils.copyInputStreamToFile(file.getInputStream(), newFile); AttachmentEntity attachmentEntity = new AttachmentEntity() ; attachmentEntity.setDoccode(null) ; attachmentEntity.setRowId(null) ; attachmentEntity.setFormId(710819) ; attachmentEntity.setUnid(unid) ; attachmentEntity.setSeq(seq) ; attachmentEntity.setFieldId(fieldId); attachmentEntity.setPhysicalFile(newFile.getName()); attachmentEntity.setOriginalFileName(newFile.getName()); AttachmentIfc attachmentIfc = (AttachmentIfc) FactoryBean.getBean("AttachmentImpl"); //保存附件 AttachmentWhereEntity attachmentWhereEntity = attachmentIfc.saveAttachment( attachmentEntity , newFile,"2") ; //输出 url String url = imgData.getImageUrl(attachmentWhereEntity.getUnid() +";" + attachmentWhereEntity.getSeq(), settingEntity.getImageProductWidth(), settingEntity.getImageProductHeight(), settingEntity.isShowProductOrgImage(), settingEntity.isFromCached(), request); //json.addProperty(SettingKey.DOCCODE, docCode); //json.addProperty(SettingKey.ROWID, rowId); json.addProperty(SettingKey.UNID, attachmentWhereEntity.getUnid()); json.addProperty("seq", attachmentWhereEntity.getSeq()); json.addProperty("url", url); json.addProperty("state", "success"); this.printJson(response, json.toString()); return; // return attachmentWhereEntity.getUnid() +";/getImage.do?uuid=" + unid + "&type=1&dbid=" + dbid; } catch (DataAccessException e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } catch (IOException e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } finally { SpObserver.setDBtoInstance(); if (newFile != null && newFile.exists()&&newFile.isFile()) { log.info("del>>userCode:"+request.getSession().getAttribute(SessionKey.USERCODE)+"|dbid:"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID)+"|"+newFile.getAbsolutePath()); newFile.delete() ; } } } /** * 删除单据表 CoverImage 和 Images 字段 里的附件 * @param request * @param response */ @RequestMapping(params = "m=deleteAttachment") public void deleteAttachment(HttpServletRequest request, HttpServletResponse response) {// HttpSession session = request.getSession(); JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); String unid = request.getParameter(SettingKey.UNID) ; String seqStr = request.getParameter("seq") ; Integer seq = null ; try { if (seqStr!=null&&!"".equals(seqStr)) { seq = Integer.valueOf( seqStr) ; } }catch (NumberFormatException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } File newFile = new File(System.getProperty("java.io.tmpdir")); try { DataSourceEntity dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId()); AttachmentIfc attachmentIfc = (AttachmentIfc) FactoryBean.getBean("AttachmentImpl"); String userCode = session.getAttribute(SessionKey.USERCODE) + ""; String userName = session.getAttribute(SessionKey.USERNAME) + ""; String ip = AttachmentAction.getIp(request); //删除附件 attachmentIfc.deleteAttachment( unid, seq, 2,"删除", userCode, userName, ip) ; json.addProperty("state", "success"); this.printJson(response, json.toString()); return; // return attachmentWhereEntity.getUnid() +";/getImage.do?uuid=" + unid + "&type=1&dbid=" + dbid; } catch (DataAccessException e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } catch (IOException e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage():e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } finally { SpObserver.setDBtoInstance(); if (newFile != null && newFile.exists()&&newFile.isFile()) { log.info("del>>userCode:"+request.getSession().getAttribute(SessionKey.USERCODE)+"|dbid:"+request.getSession().getAttribute(SessionKey.DATA_BASE_ID)+"|"+newFile.getAbsolutePath()); newFile.delete() ; } } } /** * 保存意见反馈 * @param request * @param response */ @RequestMapping(params = "m=saveDocCode") public void saveDocCode(@RequestBody CustomerFeedbackParameterEntity customerFeedbackParameter,HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); //String cltCode = (session.getAttribute(SettingKey.CLTCODE) == null?"": (String)session.getAttribute(SettingKey.CLTCODE)) ; //String cltName = (session.getAttribute(SettingKey.CLTNAME) == null?"": (String)session.getAttribute(SettingKey.CLTNAME)) ; String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); if (customerFeedbackParameter == null) { errJson.addProperty("warning","调用 [/shopping/customerFeedback.do?m=saveDocCode] 接口时,必须传递相关信息" ); json.add("error", errJson); this.printJson(response, json.toString()); return; } if (customerFeedbackParameter.getDocType() == null||"".equals(customerFeedbackParameter.getDocType())) { errJson.addProperty("warning","必须选择分类" ); json.add("error", errJson); this.printJson(response, json.toString()); return; } if (customerFeedbackParameter.getTopic() == null||"".equals(customerFeedbackParameter.getTopic())) { errJson.addProperty("warning","必须填写主题" ); json.add("error", errJson); this.printJson(response, json.toString()); return; } if (customerFeedbackParameter.getDescription() == null||"".equals(customerFeedbackParameter.getDescription())) { errJson.addProperty("warning","必须填写内容" ); json.add("error", errJson); this.printJson(response, json.toString()); return; } DataSourceEntity dataSourceEntity ; try { dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; }catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } try { SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 //SettingEntity settingEntity = settingIfc.getSettingEntity(); //生成订单 String docCode = customerFeedbackIfc.saveDocCode(openId,customerFeedbackParameter); json.addProperty("DocCode", docCode); json.addProperty("state", "success"); this.printJson(response, json.toString()); return; } catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } finally { SpObserver.setDBtoInstance(); } } /** * 保存回复信息 * @param request * @param response */ @RequestMapping(params = "m=saveReplyMessage") public void saveReplyMessage(@RequestBody CustomerFeedbackParameterEntity customerFeedbackParameter,HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); //String cltCode = (session.getAttribute(SettingKey.CLTCODE) == null?"": (String)session.getAttribute(SettingKey.CLTCODE)) ; //String cltName = (session.getAttribute(SettingKey.CLTNAME) == null?"": (String)session.getAttribute(SettingKey.CLTNAME)) ; String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); if (customerFeedbackParameter == null) { errJson.addProperty("warning","调用 [/shopping/customerFeedback.do?m=saveReplyMessage] 接口时,必须传递相关信息" ); json.add("error", errJson); this.printJson(response, json.toString()); return; } if (customerFeedbackParameter.getReplyMessage() == null||"".equals(customerFeedbackParameter.getReplyMessage())) { errJson.addProperty("warning","必须填写内容" ); json.add("error", errJson); this.printJson(response, json.toString()); return; } DataSourceEntity dataSourceEntity ; try { dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; }catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } try { SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 //SettingEntity settingEntity = settingIfc.getSettingEntity(); //保存回复信息 customerFeedbackIfc.saveReplyMessage(openId,customerFeedbackParameter.getDocCode(),customerFeedbackParameter.getReplyMessage(),customerFeedbackParameter.getImages()); json.addProperty("state", "success"); this.printJson(response, json.toString()); return; } catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } finally { SpObserver.setDBtoInstance(); } } /** * 获取意见反馈列表 * @param request * @param response */ @RequestMapping(params = "m=getFeedbackList") public void getFeedbackList(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; //SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") ; SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm") ; DataSourceEntity dataSourceEntity ; try { dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; }catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } try { SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 List customerFeedbackList = customerFeedbackIfc.getFeedbackList( openId); JsonArray customerFeedbackJsonArray = new JsonArray(); for (int i = 0; customerFeedbackList!=null&&i < customerFeedbackList.size(); i++) { CustomerFeedbackEntity customerFeedbackEntity = customerFeedbackList.get(i); JsonObject customerFeedbackEntityJsonObject = new JsonObject(); customerFeedbackEntityJsonObject.addProperty("docCode", customerFeedbackEntity.getDocCode()); customerFeedbackEntityJsonObject.addProperty("docDate",customerFeedbackEntity.getDocDate()==null?"": sdf3.format( customerFeedbackEntity.getDocDate())); customerFeedbackEntityJsonObject.addProperty("enterDate",customerFeedbackEntity.getEnterDate()==null?"": sdf3.format( customerFeedbackEntity.getEnterDate())); customerFeedbackEntityJsonObject.addProperty("docType", customerFeedbackEntity.getDocType()); customerFeedbackEntityJsonObject.addProperty("status", customerFeedbackEntity.getStatus()); String statusName = "正在处理"; switch (customerFeedbackEntity.getStatus()) { case 1: statusName = "正在处理"; break; case 2: statusName = "已回复"; break; case 3: statusName = "已关闭"; break; default: break; } customerFeedbackEntityJsonObject.addProperty("statusName", statusName); customerFeedbackEntityJsonObject.addProperty("openId", customerFeedbackEntity.getOpenId()); customerFeedbackEntityJsonObject.addProperty("nickName", customerFeedbackEntity.getNickName()); customerFeedbackEntityJsonObject.addProperty("weiXinAvatarUnid", customerFeedbackEntity.getWeiXinAvatarUnid()); customerFeedbackEntityJsonObject.addProperty("headimgurl", customerFeedbackEntity.getHeadimgurl()); customerFeedbackEntityJsonObject.addProperty("topic", customerFeedbackEntity.getTopic()); customerFeedbackEntityJsonObject.addProperty("desctiption", customerFeedbackEntity.getDesctiption()); customerFeedbackEntityJsonObject.addProperty("unreadTimes", customerFeedbackEntity.getUnreadTimes()); //customerFeedbackEntityJsonObject.addProperty("images", customerFeedbackEntity.getImages()); //customerFeedbackEntityJsonObject.addProperty("imagesUrl", customerFeedbackEntity.getImagesUrl()); customerFeedbackJsonArray.add(customerFeedbackEntityJsonObject); } json.add("list", customerFeedbackJsonArray); json.addProperty("state", "success"); this.printJson(response, json.toString()); } catch (DataAccessException e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }finally { SpObserver.setDBtoInstance(); } } /** * 获取意见反馈明细 * @param request * @param response */ @RequestMapping(params = "m=getFeedbackDetail") public void getFeedbackDetail(HttpServletRequest request, HttpServletResponse response) { //HttpSession session = request.getSession(); JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); //String openId = (session.getAttribute(SessionKey.WEIXIN_OPENID) == null ? "": (String) session.getAttribute(SessionKey.WEIXIN_OPENID)); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd") ; //SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") ; SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy-MM-dd HH:mm") ; String hostUrl = SettingKey.getHostUrl(request); DataSourceEntity dataSourceEntity ; try { dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; }catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } String docCode = request.getParameter(SettingKey.DOCCODE) ; try { SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 CustomerFeedbackEntity customerFeedbackEntity = customerFeedbackIfc.getFeedbackHeader( docCode); JsonArray customerFeedbackJsonArray = new JsonArray(); if (customerFeedbackEntity != null) { JsonObject customerFeedbackEntityJsonObject = new JsonObject(); customerFeedbackEntityJsonObject.addProperty("docCode", customerFeedbackEntity.getDocCode()); customerFeedbackEntityJsonObject.addProperty("docDate",customerFeedbackEntity.getDocDate()==null?"": sdf.format( customerFeedbackEntity.getDocDate())); customerFeedbackEntityJsonObject.addProperty("enterDate",customerFeedbackEntity.getEnterDate()==null?"": sdf3.format( customerFeedbackEntity.getEnterDate())); customerFeedbackEntityJsonObject.addProperty("docType", customerFeedbackEntity.getDocType()); customerFeedbackEntityJsonObject.addProperty("status", customerFeedbackEntity.getStatus()); String statusName = "正在处理"; switch (customerFeedbackEntity.getStatus()) { case 1: statusName = "正在处理"; break; case 2: statusName = "已回复"; break; case 3: statusName = "已关闭"; break; default: break; } customerFeedbackEntityJsonObject.addProperty("statusName", statusName); customerFeedbackEntityJsonObject.addProperty("openId", customerFeedbackEntity.getOpenId()); customerFeedbackEntityJsonObject.addProperty("nickName", customerFeedbackEntity.getNickName()); customerFeedbackEntityJsonObject.addProperty("weiXinAvatarUnid", customerFeedbackEntity.getWeiXinAvatarUnid()); customerFeedbackEntityJsonObject.addProperty("headimgurl", customerFeedbackEntity.getHeadimgurl()); customerFeedbackEntityJsonObject.addProperty("topic", customerFeedbackEntity.getTopic()); customerFeedbackEntityJsonObject.addProperty("desctiption", customerFeedbackEntity.getDesctiption()); //取出客户上传的图片 JsonArray orderDetailImageJsonArray = new JsonArray(); if (customerFeedbackEntity.getImagesUrl()!=null && !customerFeedbackEntity.getImagesUrl().equals("")) { String images[] = customerFeedbackEntity.getImages().split(";") ; String imagesUrl[] = customerFeedbackEntity.getImagesUrl().split(";") ; for (int j = 0; j < imagesUrl.length; j++) { JsonObject imageJsonObject = new JsonObject(); imageJsonObject.addProperty("unid", images[0]); imageJsonObject.addProperty("seq", images[j+1]); imageJsonObject.addProperty("url", SettingKey.getUrl(hostUrl, imagesUrl[j], dataSourceEntity.getDbId()+"",null)); orderDetailImageJsonArray.add(imageJsonObject); } } customerFeedbackEntityJsonObject.addProperty("images",customerFeedbackEntity.getImages()) ; customerFeedbackEntityJsonObject.add("imagesUrl",orderDetailImageJsonArray) ; customerFeedbackJsonArray.add(customerFeedbackEntityJsonObject); } json.add("list", customerFeedbackJsonArray); List customerFeedbackReplyMessageList = customerFeedbackIfc.getFeedbackReplyMessageList( docCode); JsonArray replyMessageJsonArray = new JsonArray(); for (int i = 0;customerFeedbackReplyMessageList!= null&& i < customerFeedbackReplyMessageList.size(); i++) { CustomerFeedbackReplyMessageEntiy customerFeedbackReplyMessageEntiy = customerFeedbackReplyMessageList.get(i) ; JsonObject feedbackReplyEntityJsonObject = new JsonObject(); feedbackReplyEntityJsonObject.addProperty("docCode", customerFeedbackReplyMessageEntiy.getDocCode()); feedbackReplyEntityJsonObject.addProperty("rowId", customerFeedbackReplyMessageEntiy.getRowId()); feedbackReplyEntityJsonObject.addProperty("docItem", customerFeedbackReplyMessageEntiy.getDocItem()); feedbackReplyEntityJsonObject.addProperty("replyMessage", customerFeedbackReplyMessageEntiy.getReplyMessage()); //取出客户上传的图片 JsonArray orderDetailImageJsonArray = new JsonArray(); if (customerFeedbackReplyMessageEntiy.getImagesUrl()!=null && !customerFeedbackReplyMessageEntiy.getImagesUrl().equals("")) { String images[] = customerFeedbackReplyMessageEntiy.getImages().split(";") ; String imagesUrl[] = customerFeedbackReplyMessageEntiy.getImagesUrl().split(";") ; for (int j = 0; j < imagesUrl.length; j++) { JsonObject imageJsonObject = new JsonObject(); imageJsonObject.addProperty("unid", images[0]); imageJsonObject.addProperty("seq", images[j+1]); imageJsonObject.addProperty("url", SettingKey.getUrl(hostUrl, imagesUrl[j], dataSourceEntity.getDbId()+"",null)); orderDetailImageJsonArray.add(imageJsonObject); } } feedbackReplyEntityJsonObject.addProperty("images",customerFeedbackEntity.getImages()) ; feedbackReplyEntityJsonObject.add("imagesUrl",orderDetailImageJsonArray) ; feedbackReplyEntityJsonObject.addProperty("insertTime",customerFeedbackReplyMessageEntiy.getInsertTime()==null?"": sdf3.format( customerFeedbackReplyMessageEntiy.getInsertTime())); feedbackReplyEntityJsonObject.addProperty("sendUserCode", customerFeedbackReplyMessageEntiy.getSendUserCode()); feedbackReplyEntityJsonObject.addProperty("sendUserName", customerFeedbackReplyMessageEntiy.getSendUserName()); feedbackReplyEntityJsonObject.addProperty("avatarUnid", customerFeedbackReplyMessageEntiy.getAvatarUnid()); feedbackReplyEntityJsonObject.addProperty("avatarUrl",SettingKey.getUrl(hostUrl, customerFeedbackReplyMessageEntiy.getAvatarUrl(), dataSourceEntity.getDbId()+"",null) ); replyMessageJsonArray.add(feedbackReplyEntityJsonObject); } json.add("replyMessageList", replyMessageJsonArray); json.addProperty("state", "success"); this.printJson(response, json.toString()); //更新意见反馈单据为已读状态(即把 UnreadTimes 字段值改为 0 ) customerFeedbackIfc.updateUnreadTimesToRead(docCode) ; return; } catch (DataAccessException e) { e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ e.printStackTrace(); errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }finally { SpObserver.setDBtoInstance(); } } /** * 获取意见反馈分类 * @param request * @param response */ @RequestMapping(params = "m=getFeedbackType") public void getFeedbackType(HttpServletRequest request, HttpServletResponse response) { //HttpSession session = request.getSession(); JsonObject json = new JsonObject(); JsonObject errJson = new JsonObject(); DataSourceEntity dataSourceEntity ; try { dataSourceEntity = MultiDataSource.getDataSourceMap( request) ; }catch (DataAccessException e) { errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; }catch (Exception e ){ errJson.addProperty("warning", (e.getCause()!=null?e.getCause().getMessage(): e.getMessage())); json.add("error", errJson); this.printJson(response, json.toString()); return; } try { SpObserver.setDBtoInstance("_" + dataSourceEntity.getDbId());// 切换数据源 List feedbackTypeList = customerFeedbackIfc.getFeedbackType(); JsonArray customerFeedbackJsonArray = new JsonArray(); for (int i = 0;feedbackTypeList!=null&& i