日期:2014-05-17 浏览次数:20761 次
/**
* 还原图标
*
* @param model
* @param request
* @param operation
* @return
*/
@RequestMapping(value = Keys.SYS_SYSICON, params = "action=initPic")
public String initSysPagePic(Model model, HttpServletRequest request,
@RequestParam(value = "operation") int operation) {
String savePath = request.getServletContext().getRealPath(ICON_DIR);
String fileName = null;
if (operation == UPLOAD_LOGIN_PIC) {
fileName = LOGIN_PIC;
} else {
fileName = SYS_PIC;
}
int ret = -1;
File bak = new File(savePath + "/" + fileName + ".bak");
if (!bak.exists()) {
ret = 0;
} else {
new File(savePath + "/" + fileName).delete();
boolean isSuccess = bak
.renameTo(new File(savePath + "/" + fileName));
ret = isSuccess == true ? 0 : -1;
}
model.addAttribute(Keys.JSON_DATA, JsonUtil.toJSON(ret));
return Keys.AJAX_JSON;
}