| | |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.HttpStatus; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.all.SettingData; |
| | | import com.lf.server.entity.sys.AttachEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.FileHelper; |
| | |
| | | @Autowired |
| | | AttachService attachService; |
| | | |
| | | private static long MAX_FILE_SIZE = 20 * 1024 * 1024; |
| | | |
| | | private final static Log log = LogFactory.getLog(FileService.class); |
| | | |
| | | private static final String NO_FILE = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NOT_FOUND, "文件找不到")); |
| | |
| | | if (file == null && file.isEmpty()) { |
| | | return ctrl.fail("文件上传为空", null); |
| | | } |
| | | if (file.getSize() > MAX_FILE_SIZE) { |
| | | return ctrl.fail(String.format("文件大于 %d MB", MAX_FILE_SIZE / 1024 / 1024), null); |
| | | if (file.getSize() > SettingData.MAX_FILE_SIZE) { |
| | | return ctrl.fail(String.format("文件大于 %d MB", SettingData.MAX_FILE_SIZE / 1024 / 1024), null); |
| | | } |
| | | |
| | | // 传输文件 |