发表于: 2017-11-02 22:32:33
1 940
今天完成的事情:
1.调试common.service
messageServiceImpl中引入了userservice,提示这个bean无法自动注入。
2.图片上传
// 图片上传
@RequestMapping(value = "/a/u/img/{module}", method = RequestMethod.POST)
public String uploadFile(HttpServletRequest request,
HttpServletResponse response, ModelMap model,
@RequestParam MultipartFile file, @PathVariable String module)
throws Exception {
log.info("hello upload " + module);
if (org.apache.commons.lang3.StringUtils.isBlank(module)) {
module = "common";
}
int code = 0;
log.info(file.getOriginalFilename());
//Long uid = cookieUtil.getID(request, response);
try {
String type = file.getContentType();
long size = file.getSize();
log.info(" size is =" + size / 1048576);
String extend = FileUtil.getFileExtension(file
.getOriginalFilename());
String fileName = "";
if("apk".equals(extend)){
fileName = file.getOriginalFilename();
}else {
fileName = UUID.randomUUID().toString() + "." + extend;
}
log.info("new name is " + fileName);
String filePath = "/data/temp/" + fileName;
File tempPic = new File(filePath);
file.transferTo(tempPic);
String url = this.imgStorageUtil.imgStorage(module, module + "/"
+ fileName, filePath);
log.info(module + " upload success ,and file name is " + fileName
+ "temp path is " + filePath + " access url is " + url);
tempPic.delete();
log.info(file.getOriginalFilename() + " delete success ");
model.addAttribute("url", url);
model.addAttribute("code", 0);
return "/common/img";
} catch (Throwable t) {
t.printStackTrace();
log.error(t.getMessage());
return "/common/success";
}
}
明天计划的事情:修复bug,对比接口文档查看是否有遗漏
遇到的问题:支付接口以及相关的提现无法完成了,我能做的都做了,接下来的事情,部署以及后续工作交给家铭
收获:第三方API
评论